Files
i-buy.properties/js/main.js
2017-02-07 12:55:56 -06:00

57 lines
1.7 KiB
JavaScript

/*globals $,window,document,Handlebars*/
var ibuyproperties=(function(){
"use strict";
var isDebugMode = false;
function navShow(cls,ele){
$("."+cls).addClass('hide');
$("#pnl_"+ele).removeClass('hide');
$(".topNav"+cls).removeClass('active');
$(".topNav"+ele).addClass('active');
}
function toggleButton(elEnable,elDisable){
elEnable.addClass('active btn-warning');
elDisable.removeClass('active btn-warning');
elDisable.addClass('btn-default');
}
$(document).ready(function(){
if (window.location.search.match(/[?&]debug=true/)) {
console.log("Enabling Debugging Mode");
ibuyproperties.isDebugMode=true;
} else {
ibuyproperties.isDebugMode=false;
}
ibuyproperties.templateHelper.load(ibuyproperties.templates.getAll()).done(function(){
if (ibuyproperties.isDebugMode) { console.log("All Templates Loaded."); }
$.each(ibuyproperties.templates.getType("partials"),function(index,thePartial){
if (ibuyproperties.isDebugMode){ console.log("Load Partial",thePartial);}
Handlebars.registerPartial(thePartial,ibuyproperties.templateHelper.get(thePartial)());
});
$("body").prepend(ibuyproperties.templateHelper.get("nav")({}));
$("body").append(ibuyproperties.templateHelper.get("impressum")({}));
$("body").append(ibuyproperties.templateHelper.get("about")({}));
if (ibuyproperties.isDebugMode) {
$("body").append(ibuyproperties.templateHelper.get("debug")({}));
}
ibuyproperties.router.route();
$(window).on('hashchange', ibuyproperties.router.route);
});
});
return {
navShow: navShow,
toggleButton: toggleButton,
isDebugMode:isDebugMode
};
}());