var smartbgimage; $("#smart-bgimages") .fadeOut(); $('#demo-setting') .click(function () { //console.log('setting'); $('.demo') .toggleClass('activate'); }) /* * FIXED HEADER */ $('input[type="checkbox"]#smart-fixed-header') .click(function () { if ($(this) .is(':checked')) { //checked $.root_.addClass("fixed-header"); localStorage.setItem('fixed-header', 'fixed-header'); } else { //unchecked $('input[type="checkbox"]#smart-fixed-ribbon') .prop('checked', false); $('input[type="checkbox"]#smart-fixed-navigation') .prop('checked', false); $.root_.removeClass("fixed-header"); $.root_.removeClass("fixed-navigation"); $.root_.removeClass("fixed-ribbon"); localStorage.setItem('fixed-header', ''); } }); /* * FIXED NAV */ $('input[type="checkbox"]#smart-fixed-navigation') .click(function () { if ($(this) .is(':checked')) { //checked $('input[type="checkbox"]#smart-fixed-header') .prop('checked', true); $.root_.addClass("fixed-header"); $.root_.addClass("fixed-navigation"); $('input[type="checkbox"]#smart-fixed-container') .prop('checked', false); $.root_.removeClass("container"); localStorage.setItem('fixed-header', 'fixed-header'); localStorage.setItem('fixed-container', ''); localStorage.setItem('fixed-navigation', 'fixed-navigation'); } else { //unchecked $('input[type="checkbox"]#smart-fixed-ribbon') .prop('checked', false); $.root_.removeClass("fixed-navigation"); $.root_.removeClass("fixed-ribbon"); localStorage.setItem('fixed-ribbon', ''); localStorage.setItem('fixed-navigation', ''); } }); /* * FIXED RIBBON */ $('input[type="checkbox"]#smart-fixed-ribbon') .click(function () { if ($(this) .is(':checked')) { //checked $('input[type="checkbox"]#smart-fixed-header') .prop('checked', true); $('input[type="checkbox"]#smart-fixed-navigation') .prop('checked', true); $('input[type="checkbox"]#smart-fixed-ribbon') .prop('checked', true); //apply $.root_.addClass("fixed-header"); $.root_.addClass("fixed-navigation"); $.root_.addClass("fixed-ribbon"); $('input[type="checkbox"]#smart-fixed-container') .prop('checked', false); $.root_.removeClass("container"); localStorage.setItem('fixed-header', 'fixed-header'); localStorage.setItem('fixed-container', ''); localStorage.setItem('fixed-navigation', 'fixed-navigation'); localStorage.setItem('fixed-ribbon', 'fixed-ribbon'); } else { //unchecked $.root_.removeClass("fixed-ribbon"); localStorage.setItem('fixed-ribbon', ''); } }); /* * FIXED FOOTER */ $('input[type="checkbox"]#smart-fixed-footer') .click(function () { if ($(this) .is(':checked')) { //checked $.root_.addClass("fixed-page-footer"); localStorage.setItem('fixed-page-footer', 'fixed-page-footer'); } else { //unchecked $.root_.removeClass("fixed-page-footer"); localStorage.setItem('fixed-page-footer', ''); } }); /* * RTL SUPPORT */ $('input[type="checkbox"]#smart-rtl') .click(function () { if ($(this) .is(':checked')) { //checked $.root_.addClass("smart-rtl"); localStorage.setItem('smart-rtl', 'smart-rtl'); } else { //unchecked $.root_.removeClass("smart-rtl"); localStorage.setItem('smart-rtl', ''); } }); /* * MENU ON TOP */ $('#smart-topmenu') .on('change', function (e) { if ($(this) .prop('checked')) { //window.location.href = '?menu=top'; localStorage.setItem('sm-setmenu', 'top'); location.reload(); } else { //window.location.href = '?'; localStorage.setItem('sm-setmenu', 'left'); location.reload(); } }); if (localStorage.getItem('sm-setmenu') == 'top') { $('#smart-topmenu') .prop('checked', true); } else { $('#smart-topmenu') .prop('checked', false); } /* * COLORBLIND FRIENDLY */ $('input[type="checkbox"]#colorblind-friendly') .click(function () { if ($(this) .is(':checked')) { //checked $.root_.addClass("colorblind-friendly"); } else { //unchecked $.root_.removeClass("colorblind-friendly"); } }); /* * INSIDE CONTAINER */ $('input[type="checkbox"]#smart-fixed-container') .click(function () { if ($(this) .is(':checked')) { //checked $.root_.addClass("container"); $('input[type="checkbox"]#smart-fixed-ribbon') .prop('checked', false); $.root_.removeClass("fixed-ribbon"); $('input[type="checkbox"]#smart-fixed-navigation') .prop('checked', false); $.root_.removeClass("fixed-navigation"); $("#smart-bgimages") .fadeIn(); localStorage.setItem('fixed-container', 'fixed-container'); $.cookie('fixed-container', 'fixed-container', {path:'/'}); } else { //unchecked $.root_.removeClass("container"); $("#smart-bgimages") .fadeOut(); localStorage.setItem('fixed-container', ''); $.cookie('fixed-container', null, { path:'/'}); } }); $("#smart-bgimages img") .bind("click", function () { var $this = $(this); var $html = $('html') bgurl = ($this.data("htmlbg-url")); $html.css("background-image", "url(" + bgurl + ")"); localStorage.setItem('smart-fixed-background-image', bgurl); }); /* * REFRESH WIDGET */ $("#reset-smart-widget") .bind("click", function () { $('#refresh') .click(); return false; }); /* * STYLES */ $("#smart-styles > a") .on('click', function() { var $this = $(this); var $logo = $("#logo img"); $.root_.removeClassPrefix('smart-style') .addClass($this.attr("id")); $('html').removeClassPrefix('smart-style') .addClass($this.attr("id")); $logo.attr('src', $this.data("skinlogo")); $("#smart-styles > a #skin-checked") .remove(); $this.prepend(""); $.cookie('smart-style', $this.attr("id"), { path:'/'} ); }); $('.minifyme') .click(function () { if (!$.root_.hasClass("menu-on-top")){ if($.root_.hasClass("minified")){ $.root_.removeClass("minified"); $.root_.removeClass("hidden-menu"); $('html').removeClass("hidden-menu-mobile-lock"); localStorage.setItem('minified', ''); $.cookie('minified', null, { path:'/'}); }else{ $.root_.addClass("minified"); $.root_.removeClass("hidden-menu"); $('html').removeClass("hidden-menu-mobile-lock"); localStorage.setItem('minified', 'minified'); $.cookie('minified', 'minified', { path:'/'}); } } }); $('.toggleMenu') .click(function () { if (!$.root_.hasClass("menu-on-top")){ $('html').toggleClass("hidden-menu-mobile-lock"); $.root_.toggleClass("hidden-menu"); $.root_.removeClass("minified"); //} else if ( $.root_.hasClass("menu-on-top") && $.root_.hasClass("mobile-view-activated") ) { // suggested fix from Christian Jäger } else if ( $.root_.hasClass("menu-on-top") && $(window).width() < 979 ) { $('html').toggleClass("hidden-menu-mobile-lock"); $.root_.toggleClass("hidden-menu"); $.root_.removeClass("minified"); } if($.root_.hasClass("hidden-menu")){ localStorage.setItem('hidden-menu', 'hidden-menu'); $.cookie('hidden-menu', 'hidden-menu', { path:'/'}); $(window).scrollTop(0); }else{ localStorage.setItem('hidden-menu', ''); $.cookie('hidden-menu', null, { path:'/'}); } }); // local header if (localStorage.getItem('fixed-header') == 'fixed-header') { $('input[type="checkbox"]#smart-fixed-header') .prop('checked', true); $.root_.addClass("fixed-header"); } else { $('input[type="checkbox"]#smart-fixed-header') .prop('checked', false); $.root_.removeClass("fixed-header"); $.root_.removeClass("fixed-navigation"); $.root_.removeClass("fixed-ribbon"); } // local navigation if (localStorage.getItem('fixed-navigation') == 'fixed-navigation') { $('input[type="checkbox"]#smart-fixed-header') .prop('checked', true); $('input[type="checkbox"]#smart-fixed-navigation') .prop('checked', true); $.root_.addClass("fixed-header"); $.root_.addClass("fixed-navigation"); } else { $('input[type="checkbox"]#smart-fixed-navigation') .prop('checked', false); $.root_.removeClass("fixed-navigation"); $.root_.removeClass("fixed-ribbon"); } // local ribbon if (localStorage.getItem('fixed-ribbon') == 'fixed-ribbon') { $('input[type="checkbox"]#smart-fixed-header') .prop('checked', true); $('input[type="checkbox"]#smart-fixed-navigation') .prop('checked', true); $('input[type="checkbox"]#smart-fixed-ribbon') .prop('checked', true); $.root_.addClass("fixed-header"); $.root_.addClass("fixed-navigation"); $.root_.addClass("fixed-ribbon"); } else { $('input[type="checkbox"]#smart-fixed-ribbon') .prop('checked', false); $.root_.removeClass("fixed-ribbon"); } // local page-footer if (localStorage.getItem('fixed-page-footer') == 'fixed-page-footer') { $('input[type="checkbox"]#smart-fixed-footer') .prop('checked', true); $.root_.addClass("fixed-page-footer"); } else { $('input[type="checkbox"]#smart-fixed-footer') .prop('checked', false); $.root_.removeClass("fixed-page-footer"); } // local smart-rtl if (localStorage.getItem('smart-rtl') == 'smart-rtl') { $('input[type="checkbox"]#smart-rtl') .prop('checked', true); $.root_.addClass("smart-rtl"); } else { $('input[type="checkbox"]#smart-rtl') .prop('checked', false); $.root_.removeClass("smart-rtl"); } // local ribbon if (localStorage.getItem('fixed-container') == 'fixed-container') { $('input[type="checkbox"]#smart-fixed-container') .prop('checked', true); $('input[type="checkbox"]#smart-fixed-navigation') .prop('checked', false); $('input[type="checkbox"]#smart-fixed-ribbon') .prop('checked', false); $.root_.removeClass("fixed-navigation"); $.root_.removeClass("fixed-ribbon"); if (smartbgimage) { $("#smart-bgimages") .append(smartbgimage) .fadeIn(1000); $("#smart-bgimages img") .bind("click", function () { var $this = $(this); var $html = $('html') bgurl = ($this.data("htmlbg-url")); $html.css("background-image", "url(" + bgurl + ")"); localStorage.setItem('smart-fixed-background-image', bgurl); }) smartbgimage = null; } else { $("#smart-bgimages") .fadeIn(1000); } if (localStorage.getItem('smart-fixed-background-image') ) { bgurl = localStorage.getItem('smart-fixed-background-image'); $('html').css("background-image", "url(" + bgurl + ")"); } $.cookie('fixed-container', 'fixed-container', { path:'/'}); $.root_.addClass("container"); } else { $('input[type="checkbox"]#smart-fixed-container') .prop('checked', false); $.root_.removeClass("container"); $.cookie('fixed-container', null, { path:'/'}); } if (localStorage.getItem('minified') == 'minified') { $.root_.addClass("minified"); if ($.root_.hasClass("menu-on-top")){ $.root_.removeClass("minified"); } } else { $.root_.removeClass("minified"); } if (localStorage.getItem('hidden-menu') == 'hidden-menu') { $.root_.addClass("hidden-menu"); if ($.root_.hasClass("menu-on-top")){ $.root_.removeClass("hidden-menu"); } } else { $.root_.removeClass("hidden-menu"); } if( $(window).width() < 979 ){ $.root_.removeClass("hidden-menu"); }