function init_sidebar(){var a=function(){$RIGHT_COL.css("min-height",$(window).height());var a=$BODY.outerHeight(),b=$BODY.hasClass("footer_fixed")?-10:$FOOTER.height(),c=$LEFT_COL.eq(1).height()+$SIDEBAR_FOOTER.height(),d=a File upload error '+c+" ").prependTo("#alerts")}"undefined"!=typeof $.fn.wysiwyg&&(console.log("init_wysiwyg"),$(".editor-wrapper").each(function(){var a=$(this).attr("id");$(this).wysiwyg({toolbarSelector:'[data-target="#'+a+'"]',fileUploadError:b})}),window.prettyPrint,prettyPrint())}function init_cropper(){if("undefined"!=typeof $.fn.cropper){console.log("init_cropper");var a=$("#image"),b=$("#download"),c=$("#dataX"),d=$("#dataY"),e=$("#dataHeight"),f=$("#dataWidth"),g=$("#dataRotate"),h=$("#dataScaleX"),i=$("#dataScaleY"),j={aspectRatio:16/9,preview:".img-preview",crop:function(a){c.val(Math.round(a.x)),d.val(Math.round(a.y)),e.val(Math.round(a.height)),f.val(Math.round(a.width)),g.val(a.rotate),h.val(a.scaleX),i.val(a.scaleY)}};$('[data-toggle="tooltip"]').tooltip(),a.on({"build.cropper":function(a){console.log(a.type)},"built.cropper":function(a){console.log(a.type)},"cropstart.cropper":function(a){console.log(a.type,a.action)},"cropmove.cropper":function(a){console.log(a.type,a.action)},"cropend.cropper":function(a){console.log(a.type,a.action)},"crop.cropper":function(a){console.log(a.type,a.x,a.y,a.width,a.height,a.rotate,a.scaleX,a.scaleY)},"zoom.cropper":function(a){console.log(a.type,a.ratio)}}).cropper(j),$.isFunction(document.createElement("canvas").getContext)||$('button[data-method="getCroppedCanvas"]').prop("disabled",!0),"undefined"==typeof document.createElement("cropper").style.transition&&($('button[data-method="rotate"]').prop("disabled",!0),$('button[data-method="scale"]').prop("disabled",!0)),"undefined"==typeof b[0].download&&b.addClass("disabled"),$(".docs-toggles").on("change","input",function(){var e,f,b=$(this),c=b.attr("name"),d=b.prop("type");a.data("cropper")&&("checkbox"===d?(j[c]=b.prop("checked"),e=a.cropper("getCropBoxData"),f=a.cropper("getCanvasData"),j.built=function(){a.cropper("setCropBoxData",e),a.cropper("setCanvasData",f)}):"radio"===d&&(j[c]=b.val()),a.cropper("destroy").cropper(j))}),$(".docs-buttons").on("click","[data-method]",function(){var e,f,c=$(this),d=c.data();if(!c.prop("disabled")&&!c.hasClass("disabled")&&a.data("cropper")&&d.method){if(d=$.extend({},d),"undefined"!=typeof d.target&&(e=$(d.target),"undefined"==typeof d.option))try{d.option=JSON.parse(e.val())}catch(a){console.log(a.message)}switch(f=a.cropper(d.method,d.option,d.secondOption),d.method){case"scaleX":case"scaleY":$(this).data("option",-d.option);break;case"getCroppedCanvas":f&&($("#getCroppedCanvasModal").modal().find(".modal-body").html(f),b.hasClass("disabled")||b.attr("href",f.toDataURL()))}if($.isPlainObject(f)&&e)try{e.val(JSON.stringify(f))}catch(a){console.log(a.message)}}}),$(document.body).on("keydown",function(b){if(a.data("cropper")&&!(this.scrollTop>300))switch(b.which){case 37:b.preventDefault(),a.cropper("move",-1,0);break;case 38:b.preventDefault(),a.cropper("move",0,-1);break;case 39:b.preventDefault(),a.cropper("move",1,0);break;case 40:b.preventDefault(),a.cropper("move",0,1)}});var m,k=$("#inputImage"),l=window.URL||window.webkitURL;l?k.change(function(){var c,b=this.files;a.data("cropper")&&b&&b.length&&(c=b[0],/^image\/\w+$/.test(c.type)?(m=l.createObjectURL(c),a.one("built.cropper",function(){l.revokeObjectURL(m)}).cropper("reset").cropper("replace",m),k.val("")):window.alert("Please choose an image file."))}):k.prop("disabled",!0).parent().addClass("disabled")}}function init_knob(){if("undefined"!=typeof $.fn.knob){console.log("init_knob"),$(".knob").knob({change:function(a){},release:function(a){console.log("release : "+a)},cancel:function(){console.log("cancel : ",this)},draw:function(){if("tron"==this.$.data("skin")){this.cursorExt=.3;var b,a=this.arc(this.cv),c=1;return this.g.lineWidth=this.lineWidth,this.o.displayPrevious&&(b=this.arc(this.v),this.g.beginPath(),this.g.strokeStyle=this.pColor,this.g.arc(this.xy,this.xy,this.radius-this.lineWidth,b.s,b.e,b.d),this.g.stroke()),this.g.beginPath(),this.g.strokeStyle=c?this.o.fgColor:this.fgColor,this.g.arc(this.xy,this.xy,this.radius-this.lineWidth,a.s,a.e,a.d),this.g.stroke(),this.g.lineWidth=2,this.g.beginPath(),this.g.strokeStyle=this.o.fgColor,this.g.arc(this.xy,this.xy,this.radius-this.lineWidth+1+2*this.lineWidth/3,0,2*Math.PI,!1),this.g.stroke(),!1}}});var a,b=0,c=0,d=0,e=$("div.idir"),f=$("div.ival"),g=function(){d++,e.show().html("+").fadeOut(),f.html(d)},h=function(){d--,e.show().html("-").fadeOut(),f.html(d)};$("input.infinite").knob({min:0,max:20,stopper:!1,change:function(){a>this.cv?b?(h(),b=0):(b=1,c=0):a