/* Template Name: Your template name Template URI: http://bootexperts.com Author: BootExperts Author URI: http://bootexperts.com NOTE: This is js file contents all jQuery plugins. */ /*================================================ [ Table of contents ] ================================================ 01. Avoid `console` errors in browsers that lack a console. 02. scrollup jquery 03. slick jquery carousel 3.1 Slick MouseWheel 04. jQuery UI / price range 05. WOW / scrolling animation 06. meanMenu jquery menu plugin / mobile menu 07. Counter up min js 08. jQuery Knob (cartpie) 09. jQuery.appear (cartpie) 10. MixItUp 11. Treeview 13. Elevator Zoom 14. bootstrap-select.js 15. style customizer ====================================== [ End table content ] ======================================*/ /*------------------------------------------------------------- 01. Avoid `console` errors in browsers that lack a console. ---------------------------------------------------------------*/ (function() { var css_disclaimer_cookie = ' style="display:none; position:fixed; bottom:0; left:0; width:100%; padding:40px 10px; z-index:99999999; background:#333; color:#fff; font-size:16px;" '; var css_disclaimer_cookie_button_ok = ' style="display:inline-block; padding: 20px; margin-left:30px; background:#fff; color:#000; font-size:16px;" '; var css_disclaimer_cookie_link_normal = ' style="color:#fff; font-size:16px; text-decoration:underline;" '; if (getCookie('WG_disclaimer_cookies') == '') { $("body").append( '' ); $(".disclaimer_cookie").show(); } var method; var noop = function () {}; var methods = [ 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn' ]; var length = methods.length; var console = (window.console = window.console || {}); while (length--) { method = methods[length]; // Only stub undefined methods. if (!console[method]) { console[method] = noop; } } }()); // Place any jQuery/helper plugins in here. /*------------------------------------------------------------- 02. scrollup jquery ---------------------------------------------------------------*/ /*! * scrollup v2.4.1 * Url: http://markgoodyear.com/labs/scrollup/ * Copyright (c) Mark Goodyear — @markgdyr — http://markgoodyear.com * License: MIT */ !function(l,o,e){"use strict";l.fn.scrollUp=function(o){l.data(e.body,"scrollUp")||(l.data(e.body,"scrollUp",!0),l.fn.scrollUp.init(o))},l.fn.scrollUp.init=function(r){var s,t,c,i,n,a,d,p=l.fn.scrollUp.settings=l.extend({},l.fn.scrollUp.defaults,r),f=!1;switch(d=p.scrollTrigger?l(p.scrollTrigger):l("",{id:p.scrollName,href:"#top"}),p.scrollTitle&&d.attr("title",p.scrollTitle),d.appendTo("body"),p.scrollImg||p.scrollTrigger||d.html(p.scrollText),d.css({display:"none",position:"fixed",zIndex:p.zIndex}),p.activeOverlay&&l("
",{id:p.scrollName+"-active"}).css({position:"absolute",top:p.scrollDistance+"px",width:"100%",borderTop:"1px dotted"+p.activeOverlay,zIndex:p.zIndex}).appendTo("body"),p.animation){case"fade":s="fadeIn",t="fadeOut",c=p.animationSpeed;break;case"slide":s="slideDown",t="slideUp",c=p.animationSpeed;break;default:s="show",t="hide",c=0}i="top"===p.scrollFrom?p.scrollDistance:l(e).height()-l(o).height()-p.scrollDistance,n=l(o).scroll(function(){l(o).scrollTop()>i?f||(d[s](c),f=!0):f&&(d[t](c),f=!1)}),p.scrollTarget?"number"==typeof p.scrollTarget?a=p.scrollTarget:"string"==typeof p.scrollTarget&&(a=Math.floor(l(p.scrollTarget).offset().top)):a=0,d.click(function(o){o.preventDefault(),l("html, body").animate({scrollTop:a},p.scrollSpeed,p.easingType)})},l.fn.scrollUp.defaults={scrollName:"scrollUp",scrollDistance:300,scrollFrom:"top",scrollSpeed:300,easingType:"linear",animation:"fade",animationSpeed:200,scrollTrigger:!1,scrollTarget:!1,scrollText:"Scroll to top",scrollTitle:!1,scrollImg:!1,activeOverlay:!1,zIndex:2147483647},l.fn.scrollUp.destroy=function(r){l.removeData(e.body,"scrollUp"),l("#"+l.fn.scrollUp.settings.scrollName).remove(),l("#"+l.fn.scrollUp.settings.scrollName+"-active").remove(),l.fn.jquery.split(".")[1]>=7?l(o).off("scroll",r):l(o).unbind("scroll",r)},l.scrollUp=l.fn.scrollUp}(jQuery,window,document); /*------------------------------------------------------------- 03. slick jquery carousel ---------------------------------------------------------------*/ /* _ _ _ _ ___| (_) ___| | __ (_)___ / __| | |/ __| |/ / | / __| \__ \ | | (__| < _ | \__ \ |___/_|_|\___|_|\_(_)/ |___/ |__/ Version: 1.6.0 Author: Ken Wheeler Website: http://kenwheeler.github.io Docs: http://kenwheeler.github.io/slick Repo: http://github.com/kenwheeler/slick Issues: http://github.com/kenwheeler/slick/issues */ !function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";var b=window.Slick||{};b=function(){function c(c,d){var f,e=this;e.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:a(c),appendDots:a(c),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(b,c){return a('' + this.options.header + '
' : ''; var searchbox = this.options.liveSearch ? '' : ''; var actionsbox = this.multiple && this.options.actionsBox ? '
' + '
' + '' + '' + '
' + '
' : ''; var donebutton = this.multiple && this.options.doneButton ? '
' + '
' + '' + '
' + '
' : ''; var drop = '
' + '' + '' + '
'; return $(drop); }, createView: function () { var $drop = this.createDropdown(), li = this.createLi(); $drop.find('ul')[0].innerHTML = li; return $drop; }, reloadLi: function () { //Remove all children. this.destroyLi(); //Re build var li = this.createLi(); this.$menuInner[0].innerHTML = li; }, destroyLi: function () { this.$menu.find('li').remove(); }, createLi: function () { var that = this, _li = [], optID = 0, titleOption = document.createElement('option'), liIndex = -1; // increment liIndex whenever a new
  • element is created to ensure liObj is correct // Helper functions /** * @param content * @param [index] * @param [classes] * @param [optgroup] * @returns {string} */ var generateLI = function (content, index, classes, optgroup) { return '' + content + '
  • '; }; /** * @param text * @param [classes] * @param [inline] * @param [tokens] * @returns {string} */ var generateA = function (text, classes, inline, tokens) { return '' + text + '' + ''; }; if (this.options.title && !this.multiple) { // this option doesn't create a new
  • element, but does add a new option, so liIndex is decreased // since liObj is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended liIndex--; if (!this.$element.find('.bs-title-option').length) { // Use native JS to prepend option (faster) var element = this.$element[0]; titleOption.className = 'bs-title-option'; titleOption.appendChild(document.createTextNode(this.options.title)); titleOption.value = ''; element.insertBefore(titleOption, element.firstChild); // Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option. // the selected item may have been changed by user or programmatically before the bootstrap select plugin runs, // if so, the option will have the data-selected attribute var $opt = $(element.options[element.selectedIndex]); if ($opt.attr('selected') === undefined && $opt.data('selected') === undefined) { titleOption.selected = true; } } } this.$element.find('option').each(function (index) { var $this = $(this); liIndex++; if ($this.hasClass('bs-title-option')) return; // Get the class and text for the option var optionClass = this.className || '', inline = this.style.cssText, text = $this.data('content') ? $this.data('content') : $this.html(), tokens = $this.data('tokens') ? $this.data('tokens') : null, subtext = typeof $this.data('subtext') !== 'undefined' ? '' + $this.data('subtext') + '' : '', icon = typeof $this.data('icon') !== 'undefined' ? ' ' : '', $parent = $this.parent(), isOptgroup = $parent[0].tagName === 'OPTGROUP', isOptgroupDisabled = isOptgroup && $parent[0].disabled, isDisabled = this.disabled || isOptgroupDisabled; if (icon !== '' && isDisabled) { icon = '' + icon + ''; } if (that.options.hideDisabled && (isDisabled && !isOptgroup || isOptgroupDisabled)) { liIndex--; return; } if (!$this.data('content')) { // Prepend any icon and append any subtext to the main text. text = icon + '' + text + subtext + ''; } if (isOptgroup && $this.data('divider') !== true) { if (that.options.hideDisabled && isDisabled) { if ($parent.data('allOptionsDisabled') === undefined) { var $options = $parent.children(); $parent.data('allOptionsDisabled', $options.filter(':disabled').length === $options.length); } if ($parent.data('allOptionsDisabled')) { liIndex--; return; } } var optGroupClass = ' ' + $parent[0].className || ''; if ($this.index() === 0) { // Is it the first option of the optgroup? optID += 1; // Get the opt group label var label = $parent[0].label, labelSubtext = typeof $parent.data('subtext') !== 'undefined' ? '' + $parent.data('subtext') + '' : '', labelIcon = $parent.data('icon') ? ' ' : ''; label = labelIcon + '' + label + labelSubtext + ''; if (index !== 0 && _li.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown? liIndex++; _li.push(generateLI('', null, 'divider', optID + 'div')); } liIndex++; _li.push(generateLI(label, null, 'dropdown-header' + optGroupClass, optID)); } if (that.options.hideDisabled && isDisabled) { liIndex--; return; } _li.push(generateLI(generateA(text, 'opt ' + optionClass + optGroupClass, inline, tokens), index, '', optID)); } else if ($this.data('divider') === true) { _li.push(generateLI('', index, 'divider')); } else if ($this.data('hidden') === true) { _li.push(generateLI(generateA(text, optionClass, inline, tokens), index, 'hidden is-hidden')); } else { var showDivider = this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP'; // if previous element is not an optgroup and hideDisabled is true if (!showDivider && that.options.hideDisabled) { // get previous elements var $prev = $(this).prevAll(); for (var i = 0; i < $prev.length; i++) { // find the first element in the previous elements that is an optgroup if ($prev[i].tagName === 'OPTGROUP') { var optGroupDistance = 0; // loop through the options in between the current option and the optgroup // and check if they are hidden or disabled for (var d = 0; d < i; d++) { var prevOption = $prev[d]; if (prevOption.disabled || $(prevOption).data('hidden') === true) optGroupDistance++; } // if all of the options between the current option and the optgroup are hidden or disabled, show the divider if (optGroupDistance === i) showDivider = true; break; } } } if (showDivider) { liIndex++; _li.push(generateLI('', null, 'divider', optID + 'div')); } _li.push(generateLI(generateA(text, optionClass, inline, tokens), index)); } that.liObj[index] = liIndex; }); //If we are not multiple, we don't have a selected item, and we don't have a title, select the first element so something is set in the button if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) { this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected'); } return _li.join(''); }, findLis: function () { if (this.$lis == null) this.$lis = this.$menu.find('li'); return this.$lis; }, /** * @param [updateLi] defaults to true */ render: function (updateLi) { var that = this, notDisabled; //Update the LI to match the SELECT if (updateLi !== false) { this.$element.find('option').each(function (index) { var $lis = that.findLis().eq(that.liObj[index]); that.setDisabled(index, this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled, $lis); that.setSelected(index, this.selected, $lis); }); this.togglePlaceholder(); } this.tabIndex(); var selectedItems = this.$element.find('option').map(function () { if (this.selected) { if (that.options.hideDisabled && (this.disabled || this.parentNode.tagName === 'OPTGROUP' && this.parentNode.disabled)) return; var $this = $(this), icon = $this.data('icon') && that.options.showIcon ? ' ' : '', subtext; if (that.options.showSubtext && $this.data('subtext') && !that.multiple) { subtext = ' ' + $this.data('subtext') + ''; } else { subtext = ''; } if (typeof $this.attr('title') !== 'undefined') { return $this.attr('title'); } else if ($this.data('content') && that.options.showContent) { return $this.data('content'); } else { return icon + $this.html() + subtext; } } }).toArray(); //Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled //Convert all the values into a comma delimited string var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator); //If this is multi select, and the selectText type is count, the show 1 of 2 selected etc.. if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) { var max = this.options.selectedTextFormat.split('>'); if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) { notDisabled = this.options.hideDisabled ? ', [disabled]' : ''; var totalCount = this.$element.find('option').not('[data-divider="true"], [data-hidden="true"]' + notDisabled).length, tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText; title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString()); } } if (this.options.title == undefined) { this.options.title = this.$element.attr('title'); } if (this.options.selectedTextFormat == 'static') { title = this.options.title; } //If we dont have a title, then use the default, or if nothing is set at all, use the not selected text if (!title) { title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText; } //strip all html-tags and trim the result this.$button.attr('title', $.trim(title.replace(/<[^>]*>?/g, ''))); this.$button.children('.filter-option').html(title); this.$element.trigger('rendered.bs.select'); }, /** * @param [style] * @param [status] */ setStyle: function (style, status) { if (this.$element.attr('class')) { this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); } var buttonClass = style ? style : this.options.style; if (status == 'add') { this.$button.addClass(buttonClass); } else if (status == 'remove') { this.$button.removeClass(buttonClass); } else { this.$button.removeClass(this.options.style); this.$button.addClass(buttonClass); } }, liHeight: function (refresh) { if (!refresh && (this.options.size === false || this.sizeInfo)) return; var newElement = document.createElement('div'), menu = document.createElement('div'), menuInner = document.createElement('ul'), divider = document.createElement('li'), li = document.createElement('li'), a = document.createElement('a'), text = document.createElement('span'), header = this.options.header && this.$menu.find('.popover-title').length > 0 ? this.$menu.find('.popover-title')[0].cloneNode(true) : null, search = this.options.liveSearch ? document.createElement('div') : null, actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null; text.className = 'text'; newElement.className = this.$menu[0].parentNode.className + ' open'; menu.className = 'dropdown-menu open'; menuInner.className = 'dropdown-menu inner'; divider.className = 'divider'; text.appendChild(document.createTextNode('Inner text')); a.appendChild(text); li.appendChild(a); menuInner.appendChild(li); menuInner.appendChild(divider); if (header) menu.appendChild(header); if (search) { // create a span instead of input as creating an input element is slower var input = document.createElement('span'); search.className = 'bs-searchbox'; input.className = 'form-control'; search.appendChild(input); menu.appendChild(search); } if (actions) menu.appendChild(actions); menu.appendChild(menuInner); if (doneButton) menu.appendChild(doneButton); newElement.appendChild(menu); document.body.appendChild(newElement); var liHeight = a.offsetHeight, headerHeight = header ? header.offsetHeight : 0, searchHeight = search ? search.offsetHeight : 0, actionsHeight = actions ? actions.offsetHeight : 0, doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, dividerHeight = $(divider).outerHeight(true), // fall back to jQuery if getComputedStyle is not supported menuStyle = typeof getComputedStyle === 'function' ? getComputedStyle(menu) : false, $menu = menuStyle ? null : $(menu), menuPadding = { vert: parseInt(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + parseInt(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + parseInt(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + parseInt(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), horiz: parseInt(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) + parseInt(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) + parseInt(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) + parseInt(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth')) }, menuExtras = { vert: menuPadding.vert + parseInt(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + parseInt(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2, horiz: menuPadding.horiz + parseInt(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) + parseInt(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2 } document.body.removeChild(newElement); this.sizeInfo = { liHeight: liHeight, headerHeight: headerHeight, searchHeight: searchHeight, actionsHeight: actionsHeight, doneButtonHeight: doneButtonHeight, dividerHeight: dividerHeight, menuPadding: menuPadding, menuExtras: menuExtras }; }, setSize: function () { this.findLis(); this.liHeight(); if (this.options.header) this.$menu.css('padding-top', 0); if (this.options.size === false) return; var that = this, $menu = this.$menu, $menuInner = this.$menuInner, $window = $(window), selectHeight = this.$newElement[0].offsetHeight, selectWidth = this.$newElement[0].offsetWidth, liHeight = this.sizeInfo['liHeight'], headerHeight = this.sizeInfo['headerHeight'], searchHeight = this.sizeInfo['searchHeight'], actionsHeight = this.sizeInfo['actionsHeight'], doneButtonHeight = this.sizeInfo['doneButtonHeight'], divHeight = this.sizeInfo['dividerHeight'], menuPadding = this.sizeInfo['menuPadding'], menuExtras = this.sizeInfo['menuExtras'], notDisabled = this.options.hideDisabled ? '.disabled' : '', menuHeight, menuWidth, getHeight, getWidth, selectOffsetTop, selectOffsetBot, selectOffsetLeft, selectOffsetRight, getPos = function() { var pos = that.$newElement.offset(), $container = $(that.options.container), containerPos; if (that.options.container && !$container.is('body')) { containerPos = $container.offset(); containerPos.top += parseInt($container.css('borderTopWidth')); containerPos.left += parseInt($container.css('borderLeftWidth')); } else { containerPos = { top: 0, left: 0 }; } selectOffsetTop = pos.top - containerPos.top - $window.scrollTop(); selectOffsetBot = $window.height() - selectOffsetTop - selectHeight - containerPos.top; selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft(); selectOffsetRight = $window.width() - selectOffsetLeft - selectWidth - containerPos.left; }; getPos(); if (this.options.size === 'auto') { var getSize = function () { var minHeight, hasClass = function (className, include) { return function (element) { if (include) { return (element.classList ? element.classList.contains(className) : $(element).hasClass(className)); } else { return !(element.classList ? element.classList.contains(className) : $(element).hasClass(className)); } }; }, lis = that.$menuInner[0].getElementsByTagName('li'), lisVisible = Array.prototype.filter ? Array.prototype.filter.call(lis, hasClass('hidden', false)) : that.$lis.not('.hidden'), optGroup = Array.prototype.filter ? Array.prototype.filter.call(lisVisible, hasClass('dropdown-header', true)) : lisVisible.filter('.dropdown-header'); getPos(); menuHeight = selectOffsetBot - menuExtras.vert; menuWidth = selectOffsetRight - menuExtras.horiz; if (that.options.container) { if (!$menu.data('height')) $menu.data('height', $menu.height()); getHeight = $menu.data('height'); if (!$menu.data('width')) $menu.data('width', $menu.width()); getWidth = $menu.data('width'); } else { getHeight = $menu.height(); getWidth = $menu.width(); } if (that.options.dropupAuto) { that.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras.vert) < getHeight); } if (that.$newElement.hasClass('dropup')) { menuHeight = selectOffsetTop - menuExtras.vert; } if (that.options.dropdownAlignRight === 'auto') { $menu.toggleClass('dropdown-menu-right', selectOffsetLeft > selectOffsetRight && (menuWidth - menuExtras.horiz) < (getWidth - selectWidth)); } if ((lisVisible.length + optGroup.length) > 3) { minHeight = liHeight * 3 + menuExtras.vert - 2; } else { minHeight = 0; } $menu.css({ 'max-height': menuHeight + 'px', 'overflow': 'hidden', 'min-height': minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px' }); $menuInner.css({ 'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert + 'px', 'overflow-y': 'auto', 'min-height': Math.max(minHeight - menuPadding.vert, 0) + 'px' }); }; getSize(); this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize); $window.off('resize.getSize scroll.getSize').on('resize.getSize scroll.getSize', getSize); } else if (this.options.size && this.options.size != 'auto' && this.$lis.not(notDisabled).length > this.options.size) { var optIndex = this.$lis.not('.divider').not(notDisabled).children().slice(0, this.options.size).last().parent().index(), divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length; menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert; if (that.options.container) { if (!$menu.data('height')) $menu.data('height', $menu.height()); getHeight = $menu.data('height'); } else { getHeight = $menu.height(); } if (that.options.dropupAuto) { //noinspection JSUnusedAssignment this.$newElement.toggleClass('dropup', selectOffsetTop > selectOffsetBot && (menuHeight - menuExtras.vert) < getHeight); } $menu.css({ 'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight + 'px', 'overflow': 'hidden', 'min-height': '' }); $menuInner.css({ 'max-height': menuHeight - menuPadding.vert + 'px', 'overflow-y': 'auto', 'min-height': '' }); } }, setWidth: function () { if (this.options.width === 'auto') { this.$menu.css('min-width', '0'); // Get correct width if element is hidden var $selectClone = this.$menu.parent().clone().appendTo('body'), $selectClone2 = this.options.container ? this.$newElement.clone().appendTo('body') : $selectClone, ulWidth = $selectClone.children('.dropdown-menu').outerWidth(), btnWidth = $selectClone2.css('width', 'auto').children('button').outerWidth(); $selectClone.remove(); $selectClone2.remove(); // Set width to whatever's larger, button title or longest option this.$newElement.css('width', Math.max(ulWidth, btnWidth) + 'px'); } else if (this.options.width === 'fit') { // Remove inline min-width so width can be changed from 'auto' this.$menu.css('min-width', ''); this.$newElement.css('width', '').addClass('fit-width'); } else if (this.options.width) { // Remove inline min-width so width can be changed from 'auto' this.$menu.css('min-width', ''); this.$newElement.css('width', this.options.width); } else { // Remove inline min-width/width so width can be changed this.$menu.css('min-width', ''); this.$newElement.css('width', ''); } // Remove fit-width class if width is changed programmatically if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { this.$newElement.removeClass('fit-width'); } }, selectPosition: function () { this.$bsContainer = $('
    '); var that = this, $container = $(this.options.container), pos, containerPos, actualHeight, getPlacement = function ($element) { that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup')); pos = $element.offset(); if (!$container.is('body')) { containerPos = $container.offset(); containerPos.top += parseInt($container.css('borderTopWidth')) + $container.scrollTop(); containerPos.left += parseInt($container.css('borderLeftWidth')) + $container.scrollLeft(); } else { containerPos = { top: 0, left: 0 }; } actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight; that.$bsContainer.css({ 'top': pos.top - containerPos.top + actualHeight, 'left': pos.left - containerPos.left, 'width': $element[0].offsetWidth }); }; this.$button.on('click', function () { var $this = $(this); if (that.isDisabled()) { return; } getPlacement(that.$newElement); that.$bsContainer .appendTo(that.options.container) .toggleClass('open', !$this.hasClass('open')) .append(that.$menu); }); $(window).on('resize scroll', function () { getPlacement(that.$newElement); }); this.$element.on('hide.bs.select', function () { that.$menu.data('height', that.$menu.height()); that.$bsContainer.detach(); }); }, /** * @param {number} index - the index of the option that is being changed * @param {boolean} selected - true if the option is being selected, false if being deselected * @param {JQuery} $lis - the 'li' element that is being modified */ setSelected: function (index, selected, $lis) { if (!$lis) { this.togglePlaceholder(); // check if setSelected is being called by changing the value of the select $lis = this.findLis().eq(this.liObj[index]); } $lis.toggleClass('selected', selected); }, /** * @param {number} index - the index of the option that is being disabled * @param {boolean} disabled - true if the option is being disabled, false if being enabled * @param {JQuery} $lis - the 'li' element that is being modified */ setDisabled: function (index, disabled, $lis) { if (!$lis) { $lis = this.findLis().eq(this.liObj[index]); } if (disabled) { $lis.addClass('disabled').children('a').attr('href', '#').attr('tabindex', -1); } else { $lis.removeClass('disabled').children('a').removeAttr('href').attr('tabindex', 0); } }, isDisabled: function () { return this.$element[0].disabled; }, checkDisabled: function () { var that = this; if (this.isDisabled()) { this.$newElement.addClass('disabled'); this.$button.addClass('disabled').attr('tabindex', -1); } else { if (this.$button.hasClass('disabled')) { this.$newElement.removeClass('disabled'); this.$button.removeClass('disabled'); } if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) { this.$button.removeAttr('tabindex'); } } this.$button.click(function () { return !that.isDisabled(); }); }, togglePlaceholder: function () { var value = this.$element.val(); this.$button.toggleClass('bs-placeholder', value === null || value === ''); }, tabIndex: function () { if (this.$element.data('tabindex') !== this.$element.attr('tabindex') && (this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) { this.$element.data('tabindex', this.$element.attr('tabindex')); this.$button.attr('tabindex', this.$element.data('tabindex')); } this.$element.attr('tabindex', -98); }, clickListener: function () { var that = this, $document = $(document); this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); }); $document.data('spaceSelect', false); this.$button.on('keyup', function (e) { if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { e.preventDefault(); $document.data('spaceSelect', false); } }); this.$button.on('click', function () { that.setSize(); }); this.$element.on('shown.bs.select', function () { if (!that.options.liveSearch && !that.multiple) { that.$menuInner.find('.selected a').focus(); } else if (!that.multiple) { var selectedIndex = that.liObj[that.$element[0].selectedIndex]; if (typeof selectedIndex !== 'number' || that.options.size === false) return; // scroll to selected option var offset = that.$lis.eq(selectedIndex)[0].offsetTop - that.$menuInner[0].offsetTop; offset = offset - that.$menuInner[0].offsetHeight/2 + that.sizeInfo.liHeight/2; that.$menuInner[0].scrollTop = offset; } }); this.$menuInner.on('click', 'li a', function (e) { var $this = $(this), clickedIndex = $this.parent().data('originalIndex'), prevValue = that.$element.val(), prevIndex = that.$element.prop('selectedIndex'), triggerChange = true; // Don't close on multi choice menu if (that.multiple && that.options.maxOptions !== 1) { e.stopPropagation(); } e.preventDefault(); //Don't run if we have been disabled if (!that.isDisabled() && !$this.parent().hasClass('disabled')) { var $options = that.$element.find('option'), $option = $options.eq(clickedIndex), state = $option.prop('selected'), $optgroup = $option.parent('optgroup'), maxOptions = that.options.maxOptions, maxOptionsGrp = $optgroup.data('maxOptions') || false; if (!that.multiple) { // Deselect all others if not multi select box $options.prop('selected', false); $option.prop('selected', true); that.$menuInner.find('.selected').removeClass('selected'); that.setSelected(clickedIndex, true); } else { // Toggle the one we have chosen if we are multi select. $option.prop('selected', !state); that.setSelected(clickedIndex, !state); $this.blur(); if (maxOptions !== false || maxOptionsGrp !== false) { var maxReached = maxOptions < $options.filter(':selected').length, maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { if (maxOptions && maxOptions == 1) { $options.prop('selected', false); $option.prop('selected', true); that.$menuInner.find('.selected').removeClass('selected'); that.setSelected(clickedIndex, true); } else if (maxOptionsGrp && maxOptionsGrp == 1) { $optgroup.find('option:selected').prop('selected', false); $option.prop('selected', true); var optgroupID = $this.parent().data('optgroup'); that.$menuInner.find('[data-optgroup="' + optgroupID + '"]').removeClass('selected'); that.setSelected(clickedIndex, true); } else { var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText, maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText, maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), $notify = $('
    '); // If {var} is set in array, replace it /** @deprecated */ if (maxOptionsArr[2]) { maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); } $option.prop('selected', false); that.$menu.append($notify); if (maxOptions && maxReached) { $notify.append($('
    ' + maxTxt + '
    ')); triggerChange = false; that.$element.trigger('maxReached.bs.select'); } if (maxOptionsGrp && maxReachedGrp) { $notify.append($('
    ' + maxTxtGrp + '
    ')); triggerChange = false; that.$element.trigger('maxReachedGrp.bs.select'); } setTimeout(function () { that.setSelected(clickedIndex, false); }, 10); $notify.delay(750).fadeOut(300, function () { $(this).remove(); }); } } } } if (!that.multiple || (that.multiple && that.options.maxOptions === 1)) { that.$button.focus(); } else if (that.options.liveSearch) { that.$searchbox.focus(); } // Trigger select 'change' if (triggerChange) { if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) { // $option.prop('selected') is current option state (selected/unselected). state is previous option state. that.$element .trigger('changed.bs.select', [clickedIndex, $option.prop('selected'), state]) .triggerNative('change'); } } } }); this.$menu.on('click', 'li.disabled a, .popover-title, .popover-title :not(.close)', function (e) { if (e.currentTarget == this) { e.preventDefault(); e.stopPropagation(); if (that.options.liveSearch && !$(e.target).hasClass('close')) { that.$searchbox.focus(); } else { that.$button.focus(); } } }); this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { e.preventDefault(); e.stopPropagation(); if (that.options.liveSearch) { that.$searchbox.focus(); } else { that.$button.focus(); } }); this.$menu.on('click', '.popover-title .close', function () { that.$button.click(); }); this.$searchbox.on('click', function (e) { e.stopPropagation(); }); this.$menu.on('click', '.actions-btn', function (e) { if (that.options.liveSearch) { that.$searchbox.focus(); } else { that.$button.focus(); } e.preventDefault(); e.stopPropagation(); if ($(this).hasClass('bs-select-all')) { that.selectAll(); } else { that.deselectAll(); } }); this.$element.change(function () { that.render(false); }); }, liveSearchListener: function () { var that = this, $no_results = $('
  • '); this.$button.on('click.dropdown.data-api touchstart.dropdown.data-api', function () { that.$menuInner.find('.active').removeClass('active'); if (!!that.$searchbox.val()) { that.$searchbox.val(''); that.$lis.not('.is-hidden').removeClass('hidden'); if (!!$no_results.parent().length) $no_results.remove(); } if (!that.multiple) that.$menuInner.find('.selected').addClass('active'); setTimeout(function () { that.$searchbox.focus(); }, 10); }); this.$searchbox.on('click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api', function (e) { e.stopPropagation(); }); this.$searchbox.on('input propertychange', function () { if (that.$searchbox.val()) { var $searchBase = that.$lis.not('.is-hidden').removeClass('hidden').children('a'); if (that.options.liveSearchNormalize) { $searchBase = $searchBase.not(':a' + that._searchStyle() + '("' + normalizeToBase(that.$searchbox.val()) + '")'); } else { $searchBase = $searchBase.not(':' + that._searchStyle() + '("' + that.$searchbox.val() + '")'); } $searchBase.parent().addClass('hidden'); that.$lis.filter('.dropdown-header').each(function () { var $this = $(this), optgroup = $this.data('optgroup'); if (that.$lis.filter('[data-optgroup=' + optgroup + ']').not($this).not('.hidden').length === 0) { $this.addClass('hidden'); that.$lis.filter('[data-optgroup=' + optgroup + 'div]').addClass('hidden'); } }); var $lisVisible = that.$lis.not('.hidden'); // hide divider if first or last visible, or if followed by another divider $lisVisible.each(function (index) { var $this = $(this); if ($this.hasClass('divider') && ( $this.index() === $lisVisible.first().index() || $this.index() === $lisVisible.last().index() || $lisVisible.eq(index + 1).hasClass('divider'))) { $this.addClass('hidden'); } }); if (!that.$lis.not('.hidden, .no-results').length) { if (!!$no_results.parent().length) { $no_results.remove(); } $no_results.html(that.options.noneResultsText.replace('{0}', '"' + htmlEscape(that.$searchbox.val()) + '"')).show(); that.$menuInner.append($no_results); } else if (!!$no_results.parent().length) { $no_results.remove(); } } else { that.$lis.not('.is-hidden').removeClass('hidden'); if (!!$no_results.parent().length) { $no_results.remove(); } } that.$lis.filter('.active').removeClass('active'); if (that.$searchbox.val()) that.$lis.not('.hidden, .divider, .dropdown-header').eq(0).addClass('active').children('a').focus(); $(this).focus(); }); }, _searchStyle: function () { var styles = { begins: 'ibegins', startsWith: 'ibegins' }; return styles[this.options.liveSearchStyle] || 'icontains'; }, val: function (value) { if (typeof value !== 'undefined') { this.$element.val(value); this.render(); return this.$element; } else { return this.$element.val(); } }, changeAll: function (status) { if (!this.multiple) return; if (typeof status === 'undefined') status = true; this.findLis(); var $options = this.$element.find('option'), $lisVisible = this.$lis.not('.divider, .dropdown-header, .disabled, .hidden'), lisVisLen = $lisVisible.length, selectedOptions = []; if (status) { if ($lisVisible.filter('.selected').length === $lisVisible.length) return; } else { if ($lisVisible.filter('.selected').length === 0) return; } $lisVisible.toggleClass('selected', status); for (var i = 0; i < lisVisLen; i++) { var origIndex = $lisVisible[i].getAttribute('data-original-index'); selectedOptions[selectedOptions.length] = $options.eq(origIndex)[0]; } $(selectedOptions).prop('selected', status); this.render(false); this.togglePlaceholder(); this.$element .trigger('changed.bs.select') .triggerNative('change'); }, selectAll: function () { return this.changeAll(true); }, deselectAll: function () { return this.changeAll(false); }, toggle: function (e) { e = e || window.event; if (e) e.stopPropagation(); this.$button.trigger('click'); }, keydown: function (e) { var $this = $(this), $parent = $this.is('input') ? $this.parent().parent() : $this.parent(), $items, that = $parent.data('this'), index, next, first, last, prev, nextPrev, prevIndex, isActive, selector = ':not(.disabled, .hidden, .dropdown-header, .divider)', keyCodeMap = { 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z', 96: '0', 97: '1', 98: '2', 99: '3', 100: '4', 101: '5', 102: '6', 103: '7', 104: '8', 105: '9' }; if (that.options.liveSearch) $parent = $this.parent().parent(); if (that.options.container) $parent = that.$menu; $items = $('[role="listbox"] li', $parent); isActive = that.$newElement.hasClass('open'); if (!isActive && (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode >= 65 && e.keyCode <= 90)) { if (!that.options.container) { that.setSize(); that.$menu.parent().addClass('open'); isActive = true; } else { that.$button.trigger('click'); } that.$searchbox.focus(); return; } if (that.options.liveSearch) { if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) { e.preventDefault(); that.$menu.parent().removeClass('open'); if (that.options.container) that.$newElement.removeClass('open'); that.$button.focus(); } // $items contains li elements when liveSearch is enabled $items = $('[role="listbox"] li' + selector, $parent); if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) { if ($items.filter('.active').length === 0) { $items = that.$menuInner.find('li'); if (that.options.liveSearchNormalize) { $items = $items.filter(':a' + that._searchStyle() + '(' + normalizeToBase(keyCodeMap[e.keyCode]) + ')'); } else { $items = $items.filter(':' + that._searchStyle() + '(' + keyCodeMap[e.keyCode] + ')'); } } } } if (!$items.length) return; if (/(38|40)/.test(e.keyCode.toString(10))) { index = $items.index($items.find('a').filter(':focus').parent()); first = $items.filter(selector).first().index(); last = $items.filter(selector).last().index(); next = $items.eq(index).nextAll(selector).eq(0).index(); prev = $items.eq(index).prevAll(selector).eq(0).index(); nextPrev = $items.eq(next).prevAll(selector).eq(0).index(); if (that.options.liveSearch) { $items.each(function (i) { if (!$(this).hasClass('disabled')) { $(this).data('index', i); } }); index = $items.index($items.filter('.active')); first = $items.first().data('index'); last = $items.last().data('index'); next = $items.eq(index).nextAll().eq(0).data('index'); prev = $items.eq(index).prevAll().eq(0).data('index'); nextPrev = $items.eq(next).prevAll().eq(0).data('index'); } prevIndex = $this.data('prevIndex'); if (e.keyCode == 38) { if (that.options.liveSearch) index--; if (index != nextPrev && index > prev) index = prev; if (index < first) index = first; if (index == prevIndex) index = last; } else if (e.keyCode == 40) { if (that.options.liveSearch) index++; if (index == -1) index = 0; if (index != nextPrev && index < next) index = next; if (index > last) index = last; if (index == prevIndex) index = first; } $this.data('prevIndex', index); if (!that.options.liveSearch) { $items.eq(index).children('a').focus(); } else { e.preventDefault(); if (!$this.hasClass('dropdown-toggle')) { $items.removeClass('active').eq(index).addClass('active').children('a').focus(); $this.focus(); } } } else if (!$this.is('input')) { var keyIndex = [], count, prevKey; $items.each(function () { if (!$(this).hasClass('disabled')) { if ($.trim($(this).children('a').text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) { keyIndex.push($(this).index()); } } }); count = $(document).data('keycount'); count++; $(document).data('keycount', count); prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1); if (prevKey != keyCodeMap[e.keyCode]) { count = 1; $(document).data('keycount', count); } else if (count >= keyIndex.length) { $(document).data('keycount', 0); if (count > keyIndex.length) count = 1; } $items.eq(keyIndex[count - 1]).children('a').focus(); } // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. if ((/(13|32)/.test(e.keyCode.toString(10)) || (/(^9$)/.test(e.keyCode.toString(10)) && that.options.selectOnTab)) && isActive) { if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault(); if (!that.options.liveSearch) { var elem = $(':focus'); elem.click(); // Bring back focus for multiselects elem.focus(); // Prevent screen from scrolling if the user hit the spacebar e.preventDefault(); // Fixes spacebar selection of dropdown items in FF & IE $(document).data('spaceSelect', true); } else if (!/(32)/.test(e.keyCode.toString(10))) { that.$menuInner.find('.active a').click(); $this.focus(); } $(document).data('keycount', 0); } if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) { that.$menu.parent().removeClass('open'); if (that.options.container) that.$newElement.removeClass('open'); that.$button.focus(); } }, mobile: function () { this.$element.addClass('mobile-device'); }, refresh: function () { this.$lis = null; this.liObj = {}; this.reloadLi(); this.render(); this.checkDisabled(); this.liHeight(true); this.setStyle(); this.setWidth(); if (this.$lis) this.$searchbox.trigger('propertychange'); this.$element.trigger('refreshed.bs.select'); }, hide: function () { this.$newElement.hide(); }, show: function () { this.$newElement.show(); }, remove: function () { this.$newElement.remove(); this.$element.remove(); }, destroy: function () { this.$newElement.before(this.$element).remove(); if (this.$bsContainer) { this.$bsContainer.remove(); } else { this.$menu.remove(); } this.$element .off('.bs.select') .removeData('selectpicker') .removeClass('bs-select-hidden selectpicker'); } }; // SELECTPICKER PLUGIN DEFINITION // ============================== function Plugin(option, event) { // get the args of the outer function.. var args = arguments; // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them // to get lost/corrupted in android 2.3 and IE9 #715 #775 var _option = option, _event = event; [].shift.apply(args); var value; var chain = this.each(function () { var $this = $(this); if ($this.is('select')) { var data = $this.data('selectpicker'), options = typeof _option == 'object' && _option; if (!data) { var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options); config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template); $this.data('selectpicker', (data = new Selectpicker(this, config, _event))); } else if (options) { for (var i in options) { if (options.hasOwnProperty(i)) { data.options[i] = options[i]; } } } if (typeof _option == 'string') { if (data[_option] instanceof Function) { value = data[_option].apply(data, args); } else { value = data.options[_option]; } } } }); if (typeof value !== 'undefined') { //noinspection JSUnusedAssignment return value; } else { return chain; } } var old = $.fn.selectpicker; $.fn.selectpicker = Plugin; $.fn.selectpicker.Constructor = Selectpicker; // SELECTPICKER NO CONFLICT // ======================== $.fn.selectpicker.noConflict = function () { $.fn.selectpicker = old; return this; }; $(document) .data('keycount', 0) .on('keydown.bs.select', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input', Selectpicker.prototype.keydown) .on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="listbox"], .bs-searchbox input', function (e) { e.stopPropagation(); }); // SELECTPICKER DATA-API // ===================== $(window).on('load.bs.select.data-api', function () { $('.selectpicker').each(function () { var $selectpicker = $(this); Plugin.call($selectpicker, $selectpicker.data()); }) }); })(jQuery); /*=========================================================== ======================15. style customizer=================== ============================================================*/ /*! * jQuery Cookie Plugin v1.4.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2006, 2014 Klaus Hartl * Released under the MIT license */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function c(a){return h.raw?a:encodeURIComponent(a)}function d(a){return h.raw?a:decodeURIComponent(a)}function e(a){return c(h.json?JSON.stringify(a):String(a))}function f(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(b," ")),h.json?JSON.parse(a):a}catch(c){}}function g(b,c){var d=h.raw?b:f(b);return a.isFunction(c)?c(d):d}var b=/\+/g,h=a.cookie=function(b,f,i){if(arguments.length>1&&!a.isFunction(f)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[c(b),"=",e(f),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=b?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=d(p.shift()),r=p.join("=");if(b&&b===q){l=g(r,f);break}b||void 0===(r=g(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}); /* Template: Theme Name Author: http://bootexperts.com/ Version: 1 Design and Developed by: http://bootexperts.com/ NOTE: This is js of style customizer, This file Change the styling of color, backgrond patterns, Background images and box layout of the actual Template. so you can change as your requirement. */ /* style-customizer */ jQuery(document).ready(function($) { /************************* Left sidebar *************************/ style_switcher = $('.style-customizer'), panelWidth = style_switcher.outerWidth(true); $('.style-customizer .opener').on("click", function(){ var $this = $(this); if ($(".style-customizer.closed").length>0) { style_switcher.animate({"left" : "0px"}); $(".style-customizer.closed").removeClass("closed"); $(".style-customizer").addClass("opened"); } else { $(".style-customizer.opened").removeClass("opened"); $(".style-customizer").addClass("closed"); style_switcher.animate({"left" : '-' + panelWidth}); } return false; }); /************************* style change *************************/ var link = $('link[data-style="styles"]'), link_no_cookie = $('link[data-style="styles-no-cookie"]'); /**************************************** Resume from last selected style ****************************************/ var tp_stylesheet = $.cookie('tp_stylesheet'), footer_bg = $.cookie('footer_bg'), customizer_mode = $.cookie('customizer_mode'), pattern = $.cookie('pattern'); $(".style-customizer .selected").removeClass("selected"); if (!($.cookie('tp_stylesheet'))) { $.cookie('tp_stylesheet', 'skin-default', 30); tp_stylesheet = $.cookie('tp_stylesheet'); $('.style-customizer .styleChange li[data-style="'+tp_stylesheet+'"]').addClass("selected"); } else { if (link.length>0) { link.attr('href','css/color/' + tp_stylesheet + '.css'); $('.style-customizer .styleChange li[data-style="'+tp_stylesheet+'"]').addClass("selected"); if ($(".swicher-title-page-dark").length>0) { document.getElementById("logo_img").src="images/customizer/logo/logo_dark_swicher-title_" + tp_stylesheet + ".png"; } else { if ($("#logo_img").length>0) { document.getElementById("logo_img").src="images/customizer/logo/logo_" + tp_stylesheet + ".png"; }; if ($("#logo_dark_img").length>0) { document.getElementById("logo_dark_img").src="images/customizer/logo/dark/logo_" + tp_stylesheet + ".png"; }; if ($("#logo-footer").length>0) { document.getElementById("logo-footer").src="images/customizer/logo/logo_" + tp_stylesheet + ".png"; }; }; }; }; if (!($.cookie('customizer_mode'))) { $.cookie('customizer_mode', 'wide-layout', 30); customizer_mode = $.cookie('customizer_mode'); $("body").addClass(customizer_mode); $('.style-customizer .layoutstyle li[data-style="wide-layout"]').addClass("selected"); } else { if (customizer_mode=="boxed-layout") { $("body").addClass(customizer_mode); $("body").removeClass("wide-layout"); $('.style-customizer .layoutstyle li[data-style="boxed-layout"]').addClass("selected"); $('.style-customizer .layoutstyle li[data-style="wide-layout"]').removeClass("selected"); $(".owl-carousel .container").css("marginLeft", "0"); } else { $("body").addClass(customizer_mode); $("body").removeClass("boxed-layout pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); $('.style-customizer .layoutstyle li[data-style="boxed-layout"]').removeClass("selected"); $('.style-customizer .layoutstyle li[data-style="wide-layout"]').addClass("selected"); $(".owl-carousel .container").css("marginLeft", "auto"); }; }; if ((customizer_mode =="boxed-layout") && $.cookie('pattern')) { $('.style-customizer .patternChange li[data-style="'+pattern+'"]').addClass("selected"); $("body").removeClass("pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); $("body").addClass(pattern); } else if (customizer_mode =="boxed-layout") { $("body").removeClass("pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); $('.style-customizer .patternChange li[data-style="pattern-0"]').addClass("selected"); } else { $('.style-customizer .patternChange li.selected').removeClass("selected"); $("body").removeClass("pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); }; /************************* Color Changer *************************/ $('.style-customizer .styleChange li').on('click',function(){ if (link.length>0) { var $this = $(this), tp_stylesheet = $this.data('style'); $(".style-customizer .styleChange .selected").removeClass("selected"); $this.addClass("selected"); link.attr('href', 'css/color/' + tp_stylesheet + '.css'); if ($(".swicher-title-page-dark").length>0) { document.getElementById("logo_img").src="images/customizer/logo/logo_dark_swicher-title_" + tp_stylesheet + ".png"; } else { if ($("#logo_img").length>0) { document.getElementById("logo_img").src="images/customizer/logo/logo_" + tp_stylesheet + ".png"; }; if ($("#logo_dark_img").length>0) { document.getElementById("logo_dark_img").src="images/customizer/logo/dark/logo_" + tp_stylesheet + ".png"; }; if ($("#logo-footer").length>0) { document.getElementById("logo-footer").src="images/customizer/logo/logo_" + tp_stylesheet + ".png"; }; }; $.cookie('tp_stylesheet', tp_stylesheet, 30); } else { var $this = $(this), tp_stylesheet_no_cookie = $this.data('style'); $(".style-customizer .styleChange .selected").removeClass("selected"); $this.addClass("selected"); link_no_cookie.attr('href', 'css/color/' + tp_stylesheet_no_cookie + '.css'); if ($(".swicher-title-page-dark").length>0) { document.getElementById("logo_img").src="images/customizer/logo/logo_dark_swicher-title_" + tp_stylesheet_no_cookie + ".png"; } else { if ($("#logo_img").length>0) { document.getElementById("logo_img").src="images/customizer/logo/logo_" + tp_stylesheet_no_cookie + ".png"; }; if ($("#logo_dark_img").length>0) { document.getElementById("logo_dark_img").src="images/customizer/logo/dark/logo_" + tp_stylesheet_no_cookie + ".png"; }; if ($("#logo-footer").length>0) { document.getElementById("logo-footer").src="images/customizer/logo/logo_" + tp_stylesheet_no_cookie + ".png"; }; }; }; }); /************************* Patterns Changer *************************/ $('.style-customizer .patternChange li').on('click',function(){ var $this = $(this), pattern = $this.data('style'); $(".style-customizer .patternChange .selected").removeClass("selected"); $this.addClass("selected"); $("body").removeClass("pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); $("body").addClass(pattern); $("body").addClass("boxed-layout"); $('.style-customizer .layoutstyle li[data-style="boxed-layout"]').addClass("selected"); $('.style-customizer .layoutstyle li[data-style="wide-layout"]').removeClass("selected"); $(".owl-carousel .container").css("marginLeft", "0"); $(".style-customizer select").val("boxed-layout"); $.cookie('pattern', pattern, 30); $.cookie('customizer_mode', 'boxed-layout', 30); $(window).trigger('resize'); }); /********************************************* layout Changer (boxed Layout) **********************************************/ $('.style-customizer .layoutstyle li.boxed-layout').on('click',function(){ $("body").addClass("boxed-layout"); $("body").removeClass("wide-layout"); $('.style-customizer .layoutstyle li[data-style="boxed-layout"]').addClass("selected"); $('.style-customizer .layoutstyle li[data-style="wide-layout"]').removeClass("selected"); $(".owl-carousel .container").css("marginLeft", "0"); $.cookie('customizer_mode', 'boxed-layout', 30); if ($.cookie('pattern')) { var pattern = $.cookie('pattern'); $('.style-customizer .patternChange li[data-style="'+pattern+'"]').addClass("selected"); $("body").removeClass("pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); $("body").addClass(pattern); } else { $('.style-customizer .patternChange li[data-style="pattern-0"]').addClass("selected"); } $(window).trigger('resize'); }); /********************************************* layout Changer (Wide Layout) **********************************************/ $('.style-customizer .layoutstyle li.wide-layout').on('click',function(){ $("body").addClass("wide-layout"); $("body").removeClass("boxed-layout pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); $("body").removeClass(""); $('.style-customizer .layoutstyle li[data-style="boxed-layout"]').removeClass("selected"); $('.style-customizer .layoutstyle li[data-style="wide-layout"]').addClass("selected"); $(".owl-carousel .container").css("marginLeft", "auto"); $('.style-customizer .patternChange li.selected').removeClass("selected"); $.cookie('customizer_mode', 'wide-layout', 30); $(window).trigger('resize'); }); /************************************** Reset all customize styles **************************************/ $('.style-customizer .resetAll li a.button-reset').on('click',function() { $.cookie('customizer_mode', 'wide-layout', 30); $("body").addClass("wide-layout"); $("body").removeClass("boxed-layout"); $('.style-customizer .layoutstyle li[data-style="boxed-layout"]').removeClass("selected"); $('.style-customizer .layoutstyle li[data-style="wide-layout"]').addClass("selected"); $(".owl-carousel .container").css("marginLeft", "auto"); $('.style-customizer .patternChange li.selected').removeClass("selected"); //patterns and backgrond change $.cookie('pattern', 'pattern-0', 30); $("body").removeClass("reset pattern-0 pattern-1 pattern-2 pattern-3 pattern-4 pattern-5 pattern-6 pattern-7 pattern-8 main-bg-1 main-bg-2 main-bg-3 main-bg-4 main-bg-5 main-bg-6 main-bg-7 main-bg-8 "); $(".style-customizer .patternChange .selected").removeClass("selected"); //Logo change $.cookie('tp_stylesheet', 'skin-default', 30); var tp_stylesheet = 'skin-default'; $('.style-customizer .styleChange li.selected').removeClass("selected"); $('.style-customizer .styleChange li[data-style="'+tp_stylesheet+'"]').addClass("selected"); link.attr('href', 'css/color/' + tp_stylesheet + '.css'); if ($("#logo_img").length>0) { document.getElementById("logo_img").src="images/customizer/logo/logo_" + tp_stylesheet + ".png"; }; if ($("#logo_dark_img").length>0) { document.getElementById("logo_dark_img").src="images/customizer/logo/dark/logo_" + tp_stylesheet + ".png"; }; if ($("#logo-footer").length>0) { document.getElementById("logo-footer").src="images/customizer/logo/logo_" + tp_stylesheet + ".png"; }; $(window).trigger('resize'); $('.desktopTopFixed').removeClass('desktopTopFixed'); }); });