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; userinfo = null;
document.addEventListener("deviceready", function () { /**
if (cordova.platformId == 'android') { * Switches the app to the given screen.
StatusBar.backgroundColorByHexString("#1976d2"); * @param {String} screenname The name of the screen to show.
} * @param {String} effect FADE, SLIDE, or nothing
* @returns {undefined}
// Enable/disable jQuery animations depending on user preference */
$.fx.off = !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true"); function openscreen(screenname, effect) {
if (effect === 'FADE') {
/* Fade out alerts */ $('#content-zone').fadeOut(300, function () {
$(".alert .close").click(function (e) { $('#content-zone').load("views/" + screenname + ".html", function () {
$(this).parent().fadeOut("slow"); $('#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 { } 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 * 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) { function openfragment(fragment, target, effect) {
if (effect === 'FADE') { if (effect === 'FADE') {
$(target).fadeOut('slow', function () { $(target).fadeOut('slow', function () {
@ -226,3 +203,26 @@ document.addEventListener("backbutton", function (event) {
} }
} }
}, false); }, 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);