144 lines
4.2 KiB
JavaScript
144 lines
4.2 KiB
JavaScript
// Ionic Starter App
|
|
|
|
/*
|
|
* Global variable für alle Superglobalen Werte
|
|
* Gesetzt aber noch ungenutzt
|
|
*/
|
|
window.globalVariable = {
|
|
//custom color style variable
|
|
color: {
|
|
appPrimaryColor: ""
|
|
},// End custom color style variable
|
|
backgroundimage: "img/Background/background.svg",
|
|
adMob: "ca-app-pub-3940256099942544/6300978111", //Use for AdMob API clientID.
|
|
adfree: ""
|
|
};// End Global variable
|
|
|
|
// angular.module is a global place for creating, registering and retrieving Angular modules
|
|
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
|
|
// the 2nd parameter is an array of 'requires'
|
|
angular.module('kinderspiel', ['ionic', 'ngCordova','ngAnimate', 'ngDraggable', 'mn', 'angularCSS', 'kinderspiel.controllers', 'kinderspiel.services'])
|
|
|
|
.run(function($ionicPlatform, $rootScope, $state, backgroundsounds_mediahandler) {
|
|
|
|
$ionicPlatform.ready(function() {
|
|
|
|
if(window.cordova && window.cordova.plugins.Keyboard) {
|
|
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
|
|
// for form inputs)
|
|
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
|
|
|
|
// Don't remove this line unless you know what you are doing. It stops the viewport
|
|
// from snapping when text inputs are focused. Ionic handles this internally for
|
|
// a much nicer keyboard experience.
|
|
cordova.plugins.Keyboard.disableScroll(true);
|
|
}
|
|
|
|
if(window.StatusBar) {
|
|
StatusBar.styleDefault();
|
|
}
|
|
|
|
/*
|
|
* Bildschirm in Landscape modus drehen und halten
|
|
*/
|
|
screen.lockOrientation('landscape');
|
|
|
|
/*
|
|
* Bildschirm aktiv halten einschalten
|
|
*/
|
|
window.plugins.insomnia.keepAwake();
|
|
/*
|
|
* Bildschirm aktiv halten ausschalten
|
|
*/
|
|
//window.plugins.insomnia.allowSleepAgain();
|
|
|
|
//SetBackgroundpic
|
|
$rootScope.backgroundimage = window.globalVariable.backgroundimage;
|
|
|
|
/*
|
|
* Homebutton und Backgroundinfos abrufen
|
|
*/
|
|
document.addEventListener("resume", onResume, false);
|
|
function onResume() {
|
|
setTimeout(function() {
|
|
backgroundsounds_mediahandler.setbackgroundstate(false);
|
|
backgroundsounds_mediahandler.playbackgroundmusic();
|
|
//console.log("The application is resuming from the background" + backgroundsounds_mediahandler.getbackgroundstate());
|
|
}, 0);
|
|
}
|
|
|
|
document.addEventListener("pause", onPause, false);
|
|
function onPause() {
|
|
setTimeout(function() {
|
|
backgroundsounds_mediahandler.setbackgroundstate(true);
|
|
backgroundsounds_mediahandler.stopbackgroundmusic();
|
|
//console.log("The application is going to the background" + backgroundsounds_mediahandler.getbackgroundstate());
|
|
}, 0);
|
|
}
|
|
|
|
/*
|
|
* Backbutton Handling
|
|
*/
|
|
$ionicPlatform.registerBackButtonAction(function (event) {
|
|
/*
|
|
* Startseite
|
|
*/
|
|
if($state.current.name=="home"){
|
|
backgroundsounds_mediahandler.stopbackgroundmusic();
|
|
/*
|
|
* App-Beenden
|
|
*/
|
|
navigator.app.exitApp();
|
|
}
|
|
else {
|
|
|
|
navigator.app.backHistory();
|
|
}
|
|
}, 100);
|
|
|
|
|
|
});
|
|
})
|
|
|
|
.config(function($stateProvider, $urlRouterProvider) {
|
|
|
|
// Ionic uses AngularUI Router which uses the concept of states
|
|
// Learn more here: https://github.com/angular-ui/ui-router
|
|
// Set up the various states which the app can be in.
|
|
// Each state's controller can be found in controllers.js
|
|
$stateProvider
|
|
|
|
/*
|
|
* Routen setzen
|
|
*/
|
|
.state('home', {
|
|
url: '/home',
|
|
abstract: false,
|
|
templateUrl: 'templates/home.html',
|
|
css: 'css/style.css',
|
|
controller: 'home',
|
|
reload: true
|
|
})
|
|
.state('suchspiel', {
|
|
url: '/suchspiel',
|
|
cache: false,
|
|
templateUrl: 'spielsets/spielset1/templates/suchspiel.html',
|
|
css: 'spielsets/spielset1/css/spielset.css',
|
|
controller: 'Suchspiel',
|
|
reload: true
|
|
})
|
|
.state('minispiel1', {
|
|
url: '/minispiel1',
|
|
cache: false,
|
|
templateUrl: 'spielsets/minispielset1/templates/minispiel1.html',
|
|
css: 'spielsets/minispielset1/css/minispiel.css',
|
|
controller: 'Minispiel1',
|
|
reload: true
|
|
})
|
|
|
|
/*
|
|
* Standard-Route setzen
|
|
*/
|
|
$urlRouterProvider.otherwise('/home');
|
|
|
|
}); |