}
};
this.eff_opt = {};
-
- this.splash= {};
+ this.splash= {
+ enable: false,
+ $splash: null,
+ is_open: true,
+ };
this.clock = setInterval(() => {
$(this).trigger("tick");
init() {
// initailize globals
+ this.splash.$splash = $("#splash-screen");
this.$content = $("#splash-screen-content");
// adjust each background image
let ss = this.eff_opt["splash-screen"];
if (typeof ss == "object") {
+ this.splash.enable = true;
+ this.splash.is_open = false;
// initilize global values if specfied in the config
if (ss.filter == true) {
$imgs.addClass("filter");
this.initClock(ss.clock);
}
+ /* will toggle the splash screen and animate it opening and closing
+ adds a resetTimeout function to automatically close when after user
+ inactivity */
+ this.splash.toggle = (o_time=550, c_time=500) => {
+ if (this.splash.is_open)
+ this.splash.$splash.animate({
+ top: "0"
+ }, c_time, "swing", () => {
+ this.splash.is_open = false
+ clearTimeout(this.splash.resetTimeout);
+ });
+ else
+ this.splash.$splash.animate({
+ top: "-100%"
+ }, o_time, "swing", () => {
+ this.splash.is_open = true;
+ // close the splash screen after 1 minute of inactivty
+ this.splash.resetTimeout = setTimeout(() => {
+ if (this.splash.is_open == true) {
+ this.splash.toggle(o_time, c_time);
+ $(this).trigger("timeout");
+ }
+ }, 60*1000);
+ });
+ };
+
}
+ $(document).keyup((e) => {
+ // handle events in seperate method
+ this.keyHandler.call(this,e);
+ });
+
/* trigger ready event to signigy init has completed and the
login manager is ready */
$(this).trigger("ready");
}
+ /**
+ * handles the key events for the splash
+ */
+ keyHandler(e) {
+ let splash = this.splash;
+
+ switch (e.keyCode) {
+ case 13:
+ if (splash.enable)
+ splash.toggle();
+ break;
+ case 27:
+ if (splash.enable)
+ splash.toggle();
+ break;
+ }
+ }
/**
* Creates clock elements based on the usr config
*/
opts.css = [opts.css];
for (let i in opts.format) {
- // if (i >= opts.css.length)
- // break;
let $format = $("<sub></sub>");
// create text field in clock
// create singleton
const greeter = new LoginManager();
-
$(document).ready(function() {
greeter.init();
greeter.login("jay", "");