var myTheme = { init : function(){ var ie_v = $exe.isIE(); if (ie_v && ie_v<8) return false; setTimeout(function(){ $(window).resize(function() { myTheme.reset(); }); },1000); var l = $(''); $("#siteNav").before(l); $("#topPagination .pagination").prepend(''+$exe_i18n.print+' '); this.addNavArrows(); this.bigInputs(); var url = window.location.href; url = url.split("?"); if (url.length>1){ if (url[1].indexOf("nav=false")!=-1) { myTheme.hideMenu(); return false; } } myTheme.setNavHeight(); // We execute this more than once because sometimes the height changes because of the videos, etc. setTimeout(function(){ myTheme.setNavHeight(); },1000); $(window).load(function(){ myTheme.setNavHeight(); }); }, isMobile : function(){ try { document.createEvent("TouchEvent"); return true; } catch(e) { return false; } }, bigInputs : function(){ if (this.isMobile()) { $(".MultiSelectIdevice,.MultichoiceIdevice,.QuizTestIdevice,.TrueFalseIdevice").each(function(){ $('input:radio',this).screwDefaultButtons({ image: 'url("_style_input_radio.png")', width: 30, height: 30 }); $('input:checkbox',this).screwDefaultButtons({ image: 'url("_style_input_checkbox.png")', width: 30, height: 30 }); $(this).addClass("custom-inputs"); }); } }, addNavArrows : function(){ $("#siteNav ul ul .daddy").each( function(){ this.innerHTML+=''; } ); }, hideMenu : function(){ $("#siteNav").hide(); $(document.body).addClass("no-nav"); myTheme.params("add"); $("#toggle-nav").attr("class","show-nav").attr("title",$exe_i18n.show); }, setNavHeight : function(){ var n = $("#siteNav"); var c = $("#main-wrapper"); if (typeof(myTheme.mediaWrapped)=='undefined') { $("video.mediaelement",c).each(function(){ var h = this.height; if (h && !isNaN(h) && h>0) { // Issue #480 $(this).wrapp(''); } }); myTheme.mediaWrapped = true; } var nH = n.height(); var cH = c.height(); var isMobile = $("#siteNav").css("float")=="none"; if (cH").css({display:"none"});var s=t.attr("class"),o=t.attr("onclick"),u=t.parent("div");u.addClass(s);u.attr("onclick",o);u.css({"background-image":r,width:n.width,height:n.height,cursor:"pointer"});var a=0,f=-n.height;if(t.is(":disabled")){a=-(n.height*2);f=-(n.height*3)}t.on("disableBtn",function(){t.attr("disabled","disabled");a=-(n.height*2);f=-(n.height*3);t.trigger("resetBackground")});t.on("enableBtn",function(){t.removeAttr("disabled");a=0;f=-n.height;t.trigger("resetBackground")});t.on("resetBackground",function(){t.is(":checked")?u.css({backgroundPosition:"0 "+f+"px"}):u.css({backgroundPosition:"0 "+a+"px"})});t.trigger("resetBackground");if(t.is(":checkbox")){u.on("click",function(){t.is(":disabled")||t.change()});u.addClass("styledCheckbox");t.on("change",function(){if(t.prop("checked")){t.prop("checked",!1);u.css({backgroundPosition:"0 "+a+"px"})}else{t.prop("checked",!0);u.css({backgroundPosition:"0 "+f+"px"})}})}else if(t.is(":radio")){u.addClass("styledRadio");var l=t.attr("name");u.on("click",function(){!t.prop("checked")&&!t.is(":disabled")&&t.change()});t.on("change",function(){if(t.prop("checked")){t.prop("checked",!1);u.css({backgroundPosition:"0 "+a+"px"})}else{t.prop("checked",!0);u.css({backgroundPosition:"0 "+f+"px"});var n=e('input[name="'+l+'"]').not(t);n.trigger("radioSwitch")}});t.on("radioSwitch",function(){u.css({backgroundPosition:"0 "+a+"px"})});var c=e(this).attr("id"),h=e('label[for="'+c+'"]');h.on("click",function(){u.trigger("click")})}if(!e.support.leadingWhitespace){var c=e(this).attr("id"),h=e('label[for="'+c+'"]');h.on("click",function(){u.trigger("click")})}})},check:function(){return this.each(function(){var t=e(this);i.isChecked(t)||t.change()})},uncheck:function(){return this.each(function(){var t=e(this);i.isChecked(t)&&t.change()})},toggle:function(){return this.each(function(){var t=e(this);t.change()})},disable:function(){return this.each(function(){var t=e(this);t.trigger("disableBtn")})},enable:function(){return this.each(function(){var t=e(this);t.trigger("enableBtn")})},isChecked:function(e){return e.prop("checked")?!0:!1}};e.fn.screwDefaultButtons=function(t,n){if(i[t])return i[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return i.init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery.screwDefaultButtons")};return this})(jQuery);