0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-06-02 04:34:32 +02:00
doodle3d-client/js_src/sidebar.js
Adriaan Wormgoor f0f97198ec Big changes to order and placement of JS files:
- grunt file updated to include automatic production of doodle3d-client.js and doodle3d-client.min.js
- all individual JS files moved to outside scope of 'www' dir to reflect these changes
2013-10-22 12:04:46 +02:00

63 lines
1.5 KiB
JavaScript

var sidebarLeft;
var sidebarRight;
function initSidebars() {
console.log("f:initSidebars()");
sidebarLeft = new SideBar();
sidebarLeft.init(".leftpanel", "hideleft", function() {
$(".leftpanel").show();
});
sidebarRight = new SideBar();
sidebarRight.init(".rightpanel", "hideright", function() {
$(".rightpanel").show();
});
}
function SideBar() {
this.initted = false;
this.$contentTarg = undefined;
this.$sideBtn = undefined;
this.contentHidden = false;
this.hideClass = "";
this.init = function(targ, hideClass, callback) {
console.log("SideBar >> f:init >> targ: " , $(targ) , ", hideClass: " + hideClass);
this.$contentTarg = $(targ);
this.hideClass = hideClass;
this.$contentTarg.addClass(this.hideClass);
this.contentHidden = true;
this.$contentTarg.append("<div class='sidebutton'></div>");
this.$sideBtn = $(targ +" .sidebutton");
var self = this;
this.$sideBtn.on('click', function(e) {
console.log("sidebutton");
self.toggleShowHide();
});
this.initted = true;
callback();
}
this.toggleShowHide = function() {
if (this.contentHidden) {
this.contentHidden = false;
this.$contentTarg.removeClass(this.hideClass);
// self.$sideBtn.addClass("sidebuttonin");
this.$sideBtn.addClass("sidebuttonin");
} else {
this.contentHidden = true;
this.$contentTarg.addClass(this.hideClass);
// self.$sideBtn.removeClass("sidebuttonin");
this.$sideBtn.removeClass("sidebuttonin");
}
}
}