Minor code formatting adjustments

This commit is contained in:
Skylar Ittner 2017-12-21 00:34:05 -07:00
parent fe3b9e1637
commit e23ad3b0d5
10 changed files with 507 additions and 507 deletions

View File

@ -4,28 +4,30 @@
userinfo = null;
document.addEventListener("deviceready", function () {
if (cordova.platformId == 'android') {
StatusBar.backgroundColorByHexString("#1976d2");
}
// Enable/disable jQuery animations depending on user preference
$.fx.off = !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true");
/* Fade out alerts */
$(".alert .close").click(function (e) {
$(this).parent().fadeOut("slow");
/**
* Switches the app to the given screen.
* @param {String} screenname The name of the screen to show.
* @param {String} effect FADE, SLIDE, or nothing
* @returns {undefined}
*/
function openscreen(screenname, effect) {
if (effect === 'FADE') {
$('#content-zone').fadeOut(300, function () {
$('#content-zone').load("views/" + screenname + ".html", function () {
$('#content-zone').fadeIn(300);
});
});
} else if (effect === 'SLIDE') {
$('#content-zone').slideToggle('400', function () {
$('#content-zone').load("views/" + screenname + ".html", function () {
$('#content-zone').slideToggle('400');
});
if (localStorage.getItem("setupcomplete")) {
getuserinfo(function () {
openscreen("home");
});
} else {
openscreen("setup1");
$('#content-zone').load("views/" + screenname + ".html");
}
currentscreen = screenname;
}
setTimeout(navigator.splashscreen.hide, 1000);
}, false);
/**
* Fetch user info (name, email, etc) from the server and save to the global
@ -57,31 +59,6 @@ function getuserinfo(callback) {
});
}
/**
* Switches the app to the given screen.
* @param {String} screenname The name of the screen to show.
* @param {String} effect FADE, SLIDE, or nothing
* @returns {undefined}
*/
function openscreen(screenname, effect) {
if (effect === 'FADE') {
$('#content-zone').fadeOut(300, function () {
$('#content-zone').load("views/" + screenname + ".html", function () {
$('#content-zone').fadeIn(300);
});
});
} else if (effect === 'SLIDE') {
$('#content-zone').slideToggle('400', function () {
$('#content-zone').load("views/" + screenname + ".html", function () {
$('#content-zone').slideToggle('400');
});
});
} else {
$('#content-zone').load("views/" + screenname + ".html");
}
currentscreen = screenname;
}
function openfragment(fragment, target, effect) {
if (effect === 'FADE') {
$(target).fadeOut('slow', function () {
@ -226,3 +203,26 @@ document.addEventListener("backbutton", function (event) {
}
}
}, false);
document.addEventListener("deviceready", function () {
if (cordova.platformId == 'android') {
StatusBar.backgroundColorByHexString("#1976d2");
}
// Enable/disable jQuery animations depending on user preference
$.fx.off = !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true");
/* Fade out alerts */
$(".alert .close").click(function (e) {
$(this).parent().fadeOut("slow");
});
if (localStorage.getItem("setupcomplete")) {
getuserinfo(function () {
openscreen("home");
});
} else {
openscreen("setup1");
}
setTimeout(navigator.splashscreen.hide, 1000);
}, false);