Initial checkin
This commit is contained in:
56
js/main.js
Normal file
56
js/main.js
Normal file
@@ -0,0 +1,56 @@
|
||||
/*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
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user