68 lines
2.0 KiB
JavaScript
68 lines
2.0 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 disabled');
|
|
$(".topNav"+cls).removeAttr('href');
|
|
|
|
$.each($(".topNav"+cls+">a"),function(pos,ele){
|
|
$(ele).attr("href", $(ele).attr("mytargeturl"));
|
|
});
|
|
|
|
|
|
$($(".topNav"+ele)[0]).addClass('active disabled');
|
|
$($(".topNav"+ele)[0]).addClass('active disabled');
|
|
$($(".topNav"+ele+">a")[0]).removeAttr('href');
|
|
|
|
}
|
|
|
|
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
|
|
};
|
|
|
|
}());
|
|
|
|
|
|
|
|
|