1 2; /* Start:"a:4:{s:4:"full";s:64:"/local/templates/elektro_flat/js/jquery.cookie.js?15330357783095";s:6:"source";s:49:"/local/templates/elektro_flat/js/jquery.cookie.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3/*! 4 * jQuery Cookie Plugin v1.4.0 5 * https://github.com/carhartl/jquery-cookie 6 * 7 * Copyright 2013 Klaus Hartl 8 * Released under the MIT license 9 */ 10(function (factory) { 11 if (typeof define === 'function' && define.amd) { 12 // AMD. Register as anonymous module. 13 define(['jquery'], factory); 14 } else { 15 // Browser globals. 16 factory(jQuery); 17 } 18}(function ($) { 19 20 var pluses = /\+/g; 21 22 function encode(s) { 23 return config.raw ? s : encodeURIComponent(s); 24 } 25 26 function decode(s) { 27 return config.raw ? s : decodeURIComponent(s); 28 } 29 30 function stringifyCookieValue(value) { 31 return encode(config.json ? JSON.stringify(value) : String(value)); 32 } 33 34 function parseCookieValue(s) { 35 if (s.indexOf('"') === 0) { 36 // This is a quoted cookie as according to RFC2068, unescape... 37 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 38 } 39 40 try { 41 // Replace server-side written pluses with spaces. 42 // If we can't decode the cookie, ignore it, it's unusable. 43 s = decodeURIComponent(s.replace(pluses, ' ')); 44 } catch(e) { 45 return; 46 } 47 48 try { 49 // If we can't parse the cookie, ignore it, it's unusable. 50 return config.json ? JSON.parse(s) : s; 51 } catch(e) {} 52 } 53 54 function read(s, converter) { 55 var value = config.raw ? s : parseCookieValue(s); 56 return $.isFunction(converter) ? converter(value) : value; 57 } 58 59 var config = $.cookie = function (key, value, options) { 60 61 // Write 62 if (value !== undefined && !$.isFunction(value)) { 63 options = $.extend({}, config.defaults, options); 64 65 if (typeof options.expires === 'number') { 66 var days = options.expires, t = options.expires = new Date(); 67 t.setDate(t.getDate() + days); 68 } 69 70 return (document.cookie = [ 71 encode(key), '=', stringifyCookieValue(value), 72 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 73 options.path ? '; path=' + options.path : '', 74 options.domain ? '; domain=' + options.domain : '', 75 options.secure ? '; secure' : '' 76 ].join('')); 77 } 78 79 // Read 80 81 var result = key ? undefined : {}; 82 83 // To prevent the for loop in the first place assign an empty array 84 // in case there are no cookies at all. Also prevents odd result when 85 // calling $.cookie(). 86 var cookies = document.cookie ? document.cookie.split('; ') : []; 87 88 for (var i = 0, l = cookies.length; i < l; i++) { 89 var parts = cookies[i].split('='); 90 var name = decode(parts.shift()); 91 var cookie = parts.join('='); 92 93 if (key && key === name) { 94 // If second argument (value) is a function it's a converter... 95 result = read(cookie, value); 96 break; 97 } 98 99 // Prevent storing a cookie that we couldn't decode. 100 if (!key && (cookie = read(cookie)) !== undefined) { 101 result[name] = cookie; 102 } 103 } 104 105 return result; 106 }; 107 108 config.defaults = {}; 109 110 $.removeCookie = function (key, options) { 111 if ($.cookie(key) !== undefined) { 112 // Must not alter options, thus extending a fresh object... 113 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 114 return true; 115 } 116 return false; 117 }; 118 119})); 120 121/* End */ 122; 123; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/elektro_flat/js/moremenu.js?15330357785011";s:6:"source";s:44:"/local/templates/elektro_flat/js/moremenu.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 124(function (factory) { 125 if(typeof define === "function" && define.amd) { 126 define(["jquery"], factory); 127 } else { 128 factory(jQuery); 129 } 130}(function ($) { 131 var moreObjects = []; 132 133 function adjustMoreMenu() { 134 $(moreObjects).each(function () { 135 $(this).moreMenu({ 136 "undo" : true 137 }).moreMenu(this.options); 138 }); 139 } 140 141 $(window).resize(function () { 142 adjustMoreMenu(); 143 }); 144 145 $.fn.moreMenu = function (options) { 146 var checkMoreObject, 147 s = $.extend({ 148 "threshold": 2, 149 "linkText": "...", 150 "undo": false 151 }, options); 152 this.options = s;
153 checkMoreObject = $.inArray(this, moreObjects); 154 if(checkMoreObject >= 0) { 155 moreObjects.splice(checkMoreObject, 1); 156 } else { 157 moreObjects.push(this); 158 } 159 return this.each(function () { 160 var $this = $(this), 161 isTopMenu = $this.hasClass("store-horizontal"), 162 $items = $this.find("> li"), 163 $firstItem = $items.first(), 164 $lastItem = $items.last(), 165 numItems = $this.find("li").length, 166 firstItemTop = Math.floor($firstItem.offset().top), 167 firstItemHeight = Math.floor($firstItem.outerHeight(true)), 168 $lastChild, 169 keepLooking, 170 $moreItem, 171 numToRemove, 172 $menu, 173 i; 174 175 function needsMenu($itemOfInterest) { 176 var result = (Math.ceil($itemOfInterest.offset().top) >= (firstItemTop + firstItemHeight)) ? true : false; 177 return result; 178 } 179 180 if(needsMenu($lastItem) && numItems > s.threshold && !s.undo && $this.is(":visible")) { 181 var $popup = !!isTopMenu ? $("<ul class='dropdown-menu more-menu'></ul>") : $("<ul class='submenuMore'></ul>"); 182 183 for(i = numItems; i > 1; i--) { 184 $lastChild = $this.find("> li:last-child"); 185 keepLooking = (needsMenu($lastChild)); 186 if(keepLooking) { 187 $lastChild.appendTo($popup); 188 } else { 189 break; 190 } 191 } 192 193 if(!!isTopMenu) 194 $this.append("<li class='dropdown more'><a href='javascript:void(0)'>" + s.linkText + "</a></li>"); 195 else 196 $this.append("<li class='parentMore'><a href='javascript:void(0)'>" + s.linkText + "</a><span class='arrow'></span></li>"); 197 198 $moreItem = !!isTopMenu ? $this.find("> li.more") : $this.find("> li.parentMore"); 199 if(needsMenu($moreItem)) { 200 $this.find("> li:nth-last-child(2)").appendTo($popup); 201 } 202 203 $popup.children().each(function (i, li) { 204 $popup.prepend(li); 205 }); 206 207 $moreItem.append($popup); 208 if(!!isTopMenu) { 209 $moreItem.hover(function() { 210 var menu = $(this).closest(".store-horizontal"), 211 menuWidth = menu.outerWidth(), 212 menuLeft = menu.offset().left, 213 menuRight = menuLeft + menuWidth, 214 dropdownMenu = $(this).children(".dropdown-menu"), 215 dropdownMenuWidth = dropdownMenu.outerWidth(), 216 dropdownMenuLeft = $(this).offset().left, 217 dropdownMenuRight = dropdownMenuLeft + dropdownMenuWidth; 218 if(dropdownMenuRight > menuRight) { 219 dropdownMenu.css({"right": "0"}); 220 } 221 dropdownMenu.stop(true, true).delay(200).fadeIn(150); 222 }, function() { 223 $(this).children(".dropdown-menu").stop(true, true).delay(200).fadeOut(150); 224 }); 225 } else { 226 $moreItem.hover(function() { 227 var pos = $(this).position(), 228 menu = $(this).closest(".left-menu"), 229 dropdownMenu = $(this).children(".submenuMore"), 230 dropdownMenuLeft = pos.left + "px", 231 dropdownMenuTop = pos.top + $(this).height() + 13 + "px", 232 arrow = $(this).children(".arrow"), 233 arrowLeft = pos.left + ($(this).width() / 2) + "px", 234 arrowTop = pos.top + $(this).height() + 3 + "px"; 235 if(menu.width() - pos.left < $popup.width()) { 236 dropdownMenu.css({"left": "auto", "right": "10px", "top": dropdownMenuTop}); 237 arrow.css({"left": arrowLeft, "top": arrowTop}); 238 } else { 239 dropdownMenu.css({"left": dropdownMenuLeft, "right": "auto", "top": dropdownMenuTop}); 240 arrow.css({"left": arrowLeft, "top": arrowTop}); 241 } 242 dropdownMenu.stop(true, true).delay(200).fadeIn(150); 243 arrow.stop(true, true).delay(200).fadeIn(150); 244 }, function() { 245 $(this).children(".submenuMore").stop(true, true).delay(200).fadeOut(150); 246 $(this).children(".arrow").stop(true, true).delay(200).fadeOut(150); 247 }); 248 } 249 } else if(s.undo && ($this.find("ul.submenuMore") || $this.find("ul.more-menu"))) { 250 $menu = !!isTopMenu ? $this.find("ul.more-menu") : $this.find("ul.submenuMore"); 251 numToRemove = $menu.find("li").length; 252 for(i = 1; i <= numToRemove; i++) { 253 $menu.find("> li:first-child").appendTo($this); 254 } 255 $menu.remove(); 256 if(!!isTopMenu) { 257 $this.find("> li.more").remove(); 258 $this.find(".dropdown-menu").removeAttr("style"); 259 } else { 260 $this.find("> li.parentMore").remove(); 261 $this.find(".arrow, .catalog-section-childs").removeAttr("style"); 262 } 263 } 264 }); 265 }; 266})); 267/* End */ 268; 269; /* Start:"a:4:{s:4:"full";s:79:"/local/templates/elektro_flat/js/jquery.inputmask.bundle.min.js?153303577870473";s:6:"source";s:63:"/local/templates/elektro_flat/js/jquery.inputmask.bundle.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 270/*! 271* jquery.inputmask.bundle.js 272* https://github.com/RobinHerbots/jquery.inputmask 273* Copyright (c) 2010 - 2016 Robin Herbots 274* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) 275* Version: 3.3.1-9 276*/ 277!function(a){function b(c,d){return this instanceof b?(a.isPlainObject(c)?d=c:(d=d||{},d.alias=c),this.el=void 0,this.opts=a.extend(!0,{},this.defaults,d),this.noMasksCache=d&&void 0!==d.definitions,this.userOptions=d||{},this.events={},void e(this.opts.alias,d,this.opts)):new b(c,d)}function c(a){var b=document.createElement("input"),c="on"+a,d=c in b;return d||(b.setAttribute(c,"return;"),d="function"==typeof b[c]),b=null,d}function d(b,c){var d=b.getAttribute("type"),e="INPUT"===b.tagName&&-1!==a.inArray(d,c.supportsInputType)||b.isContentEditable||"TEXTAREA"===b.tagName;if(!e&&"INPUT"===b.tagName){var f=document.createElement("input");f.setAttribute("type",d),e="text"===f.type,f=null}return e}function e(b,c,d){var f=d.aliases[b];return f?(f.alias&&e(f.alias,void 0,d),a.extend(!0,d,f),a.extend(!0,d,c),!0):(null===d.mask&&(d.mask=b),!1)}function f(b,c,d){function f(a,c){c=void 0!==c?c:b.getAttribute("data-inputmask-"+a),null!==c&&("string"==typeof c&&(0===a.indexOf("on")?c=window[c]:"false"===c?c=!1:"true"===c&&(c=!0)),d[a]=c)}var g,h,i,j,k=b.getAttribute("data-inputmask");if(k&&""!==k&&(k=k.replace(new RegExp("'","g"),'"'),h=JSON.parse("{"+k+"}")),h){i=void 0;for(j in h)if("alias"===j.toLowerCase()){i=h[j];break}}f("alias",i),d.alias&&e(d.alias,d,c);for(g in c){if(h){i=void 0;for(j in h)if(j.toLowerCase()===g.toLowerCase()){i=h[j];break}}
277f(g,i)}return a.extend(!0,c,d),c}function g(c,d){function e(b){function d(a,b,c,d){this.matches=[],this.isGroup=a||!1,this.isOptional=b||!1,this.isQuantifier=c||!1,this.isAlternator=d||!1,this.quantifier={min:1,max:1}}function e(b,d,e){var f=c.definitions[d];e=void 0!==e?e:b.matches.length;var g=b.matches[e-1];if(f&&!r){f.placeholder=a.isFunction(f.placeholder)?f.placeholder(c):f.placeholder;for(var h=f.prevalidator,i=h?h.length:0,j=1;j<f.cardinality;j++){var k=i>=j?h[j-1]:[],l=k.validator,m=k.cardinality;b.matches.splice(e++,0,{fn:l?"string"==typeof l?new RegExp(l):new function(){this.test=l}:new RegExp("."),cardinality:m?m:1,optionality:b.isOptional,newBlockMarker:void 0===g||g.def!==(f.definitionSymbol||d),casing:f.casing,def:f.definitionSymbol||d,placeholder:f.placeholder,mask:d}),g=b.matches[e-1]}b.matches.splice(e++,0,{fn:f.validator?"string"==typeof f.validator?new RegExp(f.validator):new function(){this.test=f.validator}:new RegExp("."),cardinality:f.cardinality,optionality:b.isOptional,newBlockMarker:void 0===g||g.def!==(f.definitionSymbol||d),casing:f.casing,def:f.definitionSymbol||d,placeholder:f.placeholder,mask:d})}else b.matches.splice(e++,0,{fn:null,cardinality:0,optionality:b.isOptional,newBlockMarker:void 0===g||g.def!==d,casing:null,def:c.staticDefinitionSymbol||d,placeholder:void 0!==c.staticDefinitionSymbol?d:void 0,mask:d}),r=!1}function f(a,b){a.isGroup&&(a.isGroup=!1,e(a,c.groupmarker.start,0),b!==!0&&e(a,c.groupmarker.end))}function g(a,b,c,d){b.matches.length>0&&(void 0===d||d)&&(c=b.matches[b.matches.length-1],f(c)),e(b,a)}function h(){if(t.length>0){if(m=t[t.length-1],g(k,m,o,!m.isAlternator),m.isAlternator){n=t.pop();for(var a=0;a<n.matches.length;a++)n.matches[a].isGroup=!1;t.length>0?(m=t[t.length-1],m.matches.push(n)):s.matches.push(n)}}else g(k,s,o)}function i(a){function b(a){return a===c.optionalmarker.start?a=c.optionalmarker.end:a===c.optionalmarker.end?a=c.optionalmarker.start:a===c.groupmarker.start?a=c.groupmarker.end:a===c.groupmarker.end&&(a=c.groupmarker.start),a}a.matches=a.matches.reverse();for(var d in a.matches){var e=parseInt(d);if(a.matches[d].isQuantifier&&a.matches[e+1]&&a.matches[e+1].isGroup){var f=a.matches[d];a.matches.splice(d,1),a.matches.splice(e+1,0,f)}void 0!==a.matches[d].matches?a.matches[d]=i(a.matches[d]):a.matches[d]=b(a.matches[d])}return a}for(var j,k,l,m,n,o,p,q=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g,r=!1,s=new d,t=[],u=[];j=q.exec(b);)if(k=j[0],r)h();else switch(k.charAt(0)){case c.escapeChar:r=!0;break;case c.optionalmarker.end:case c.groupmarker.end:if(l=t.pop(),void 0!==l)if(t.length>0){if(m=t[t.length-1],m.matches.push(l),m.isAlternator){n=t.pop();for(var v=0;v<n.matches.length;v++)n.matches[v].isGroup=!1;t.length>0?(m=t[t.length-1],m.matches.push(n)):s.matches.push(n)}}else s.matches.push(l);else h();break;case c.optionalmarker.start:t.push(new d(!1,!0));break;case c.groupmarker.start:t.push(new d(!0));break;case c.quantifiermarker.start:var w=new d(!1,!1,!0);k=k.replace(/[{}]/g,"");var x=k.split(","),y=isNaN(x[0])?x[0]:parseInt(x[0]),z=1===x.length?y:isNaN(x[1])?x[1]:parseInt(x[1]);if(("*"===z||"+"===z)&&(y="*"===z?0:1),w.quantifier={min:y,max:z},t.length>0){var A=t[t.length-1].matches;j=A.pop(),j.isGroup||(p=new d(!0),p.matches.push(j),j=p),A.push(j),A.push(w)}else j=s.matches.pop(),j.isGroup||(p=new d(!0),p.matches.push(j),j=p),s.matches.push(j),s.matches.push(w);break;case c.alternatormarker:t.length>0?(m=t[t.length-1],o=m.matches.pop()):o=s.matches.pop(),o.isAlternator?t.push(o):(n=new d(!1,!1,!1,!0),n.matches.push(o),t.push(n));break;default:h()}for(;t.length>0;)l=t.pop(),f(l,!0),s.matches.push(l);return s.matches.length>0&&(o=s.matches[s.matches.length-1],f(o),u.push(s)),c.numericInput&&i(u[0]),u}function f(f,g){if(null===f||""===f)return void 0;if(1===f.length&&c.greedy===!1&&0!==c.repeat&&(c.placeholder=""),c.repeat>0||"*"===c.repeat||"+"===c.repeat){var h="*"===c.repeat?0:"+"===c.repeat?1:c.repeat;f=c.groupmarker.start+f+c.groupmarker.end+c.quantifiermarker.start+h+","+c.repeat+c.quantifiermarker.end}var i;return void 0===b.prototype.masksCache[f]||d===!0?(i={mask:f,maskToken:e(f),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:g},d!==!0&&(b.prototype.masksCache[c.numericInput?f.split("").reverse().join(""):f]=i,i=a.extend(!0,{},b.prototype.masksCache[c.numericInput?f.split("").reverse().join(""):f]))):i=a.extend(!0,{},b.prototype.masksCache[c.numericInput?f.split("").reverse().join(""):f]),i}
277function g(a){return a=a.toString()}var h;if(a.isFunction(c.mask)&&(c.mask=c.mask(c)),a.isArray(c.mask)){if(c.mask.length>1){c.keepStatic=null===c.keepStatic?!0:c.keepStatic;var i="(";return a.each(c.numericInput?c.mask.reverse():c.mask,function(b,c){i.length>1&&(i+=")|("),i+=g(void 0===c.mask||a.isFunction(c.mask)?c:c.mask)}),i+=")",f(i,c.mask)}c.mask=c.mask.pop()}return c.mask&&(h=void 0===c.mask.mask||a.isFunction(c.mask.mask)?f(g(c.mask),c.mask):f(g(c.mask.mask),c.mask)),h}function h(e,f,g){function i(a,b,c){b=b||0;var d,e,f,h=[],i=0,j=o();do{if(a===!0&&m().validPositions[i]){var k=m().validPositions[i];e=k.match,d=k.locator.slice(),h.push(c===!0?k.input:I(i,e))}else f=r(i,d,i-1),e=f.match,d=f.locator.slice(),(g.jitMasking===!1||j>i||isFinite(g.jitMasking)&&g.jitMasking>i)&&h.push(I(i,e));i++}while((void 0===ha||ha>i-1)&&null!==e.fn||null===e.fn&&""!==e.def||b>=i);return""===h[h.length-1]&&h.pop(),h}function m(){return f}function n(a){var b=m();b.buffer=void 0,a!==!0&&(b.tests={},b._buffer=void 0,b.validPositions={},b.p=0)}function o(a,b){var c=-1,d=-1,e=m().validPositions;void 0===a&&(a=-1);for(var f in e){var g=parseInt(f);e[g]&&(b||null!==e[g].match.fn)&&(a>=g&&(c=g),g>=a&&(d=g))}return-1!==c&&a-c>1||a>d?c:d}function p(b,c,d,e){if(e||g.insertMode&&void 0!==m().validPositions[b]&&void 0===d){var f,h=a.extend(!0,{},m().validPositions),i=o();for(f=b;i>=f;f++)delete m().validPositions[f];m().validPositions[b]=c;var j,k=!0,l=m().validPositions,p=!1;for(f=j=b;i>=f;f++){var q=h[f];if(void 0!==q)for(var r=j,s=-1;r<D()&&(null==q.match.fn&&l[f]&&(l[f].match.optionalQuantifier===!0||l[f].match.optionality===!0)||null!=q.match.fn);){if(null===q.match.fn||!g.keepStatic&&l[f]&&(void 0!==l[f+1]&&v(f+1,l[f].locator.slice(),f).length>1||void 0!==l[f].alternation)?r++:r=E(j),p===!1&&h[r]&&h[r].match.def===q.match.def){m().validPositions[r]=a.extend(!0,{},h[r]),m().validPositions[r].input=q.input,j=r,k=!0;break}if(t(r,q.match.def)){var u=B(r,q.input,!0,!0);if(k=u!==!1,j=u.caret||u.insert?o():r,p=!0,k)break}else{if(k=null==q.match.fn,s===r)break;s=r}}if(!k)break}if(!k)return m().validPositions=a.extend(!0,{},h),n(!0),!1}else m().validPositions[b]=c;return n(!0),!0}function q(b,c,d,e){function f(a){var b=m().validPositions[a];if(void 0!==b&&null===b.match.fn){var c=m().validPositions[a-1],d=m().validPositions[a+1];return void 0!==c&&void 0!==d}return!1}var h,i=b,j=a.extend(!0,{},m().validPositions),k=!1;for(m().p=b,h=c-1;h>=i;h--)void 0!==m().validPositions[h]&&(d===!0||!f(h)&&g.canClearPosition(m(),h,o(),e,g)!==!1)&&delete m().validPositions[h];for(n(!0),h=i+1;h<=o();){for(;void 0!==m().validPositions[i];)i++;var l=m().validPositions[i];if(i>h&&(h=i+1),void 0===m().validPositions[h]&&C(h)||void 0!==l)h++;else{var p=r(h);k===!1&&j[i]&&j[i].match.def===p.match.def?(m().validPositions[i]=a.extend(!0,{},j[i]),m().validPositions[i].input=p.input,delete m().validPositions[h],h++):t(i,p.match.def)?B(i,p.input||I(h),!0)!==!1&&(delete m().validPositions[h],h++,k=!0):C(h)||(h++,i--),i++}}n(!0)}function r(a,b,c){var d=m().validPositions[a];if(void 0===d)for(var e=v(a,b,c),f=o(),h=m().validPositions[f]||v(0)[0],i=void 0!==h.alternation?h.locator[h.alternation].toString().split(","):[],j=0;j<e.length&&(d=e[j],!(d.match&&(g.greedy&&d.match.optionalQuantifier!==!0||(d.match.optionality===!1||d.match.newBlockMarker===!1)&&d.match.optionalQuantifier!==!0)&&(void 0===h.alternation||h.alternation!==d.alternation||void 0!==d.locator[h.alternation]&&A(d.locator[h.alternation].toString().split(","),i))));j++);return d}function s(a){return m().validPositions[a]?m().validPositions[a].match:v(a)[0].match}function t(a,b){for(var c=!1,d=v(a),e=0;e<d.length;e++)if(d[e].match&&d[e].match.def===b){c=!0;break}return c}function u(b,c){var d,e;return(m().tests[b]||m().validPositions[b])&&a.each(m().tests[b]||[m().validPositions[b]],function(a,b){var f=b.alternation?b.locator[b.alternation].toString().indexOf(c):-1;(void 0===e||e>f)&&-1!==f&&(d=b,e=f)}),d}function v(b,c,d){function e(c,d,f,h){function j(f,h,o){function p(b,c){var d=0===a.inArray(b,c.matches);return d||a.each(c.matches,function(a,e){return e.isQuantifier===!0&&(d=p(b,c.matches[a-1]
277))?!1:void 0}),d}function q(a,b){var c=u(a,b);return c?c.locator.slice(c.alternation+1):[]}if(i>1e4)throw"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+m().mask;if(i===b&&void 0===f.matches)return k.push({match:f,locator:h.reverse(),cd:n}),!0;if(void 0!==f.matches){if(f.isGroup&&o!==f){if(f=j(c.matches[a.inArray(f,c.matches)+1],h))return!0}else if(f.isOptional){var r=f;if(f=e(f,d,h,o)){if(g=k[k.length-1].match,!p(g,r))return!0;l=!0,i=b}}else if(f.isAlternator){var s,t=f,v=[],w=k.slice(),x=h.length,y=d.length>0?d.shift():-1;if(-1===y||"string"==typeof y){var z,A=i,B=d.slice(),C=[];if("string"==typeof y)C=y.split(",");else for(z=0;z<t.matches.length;z++)C.push(z);for(var D=0;D<C.length;D++){if(z=parseInt(C[D]),k=[],d=q(i,z),f=j(t.matches[z]||c.matches[z],[z].concat(h),o)||f,f!==!0&&void 0!==f&&C[C.length-1]<t.matches.length){var E=a.inArray(f,c.matches)+1;c.matches.length>E&&(f=j(c.matches[E],[E].concat(h.slice(1,h.length)),o),f&&(C.push(E.toString()),a.each(k,function(a,b){b.alternation=h.length-1})))}s=k.slice(),i=A,k=[];for(var F=0;F<B.length;F++)d[F]=B[F];for(var G=0;G<s.length;G++){var H=s[G];H.alternation=H.alternation||x;for(var I=0;I<v.length;I++){var J=v[I];if(H.match.def===J.match.def&&("string"!=typeof y||-1!==a.inArray(H.locator[H.alternation].toString(),C))){H.match.mask===J.match.mask&&(s.splice(G,1),G--),-1===J.locator[H.alternation].toString().indexOf(H.locator[H.alternation])&&(J.locator[H.alternation]=J.locator[H.alternation]+","+H.locator[H.alternation],J.alternation=H.alternation);break}}}v=v.concat(s)}"string"==typeof y&&(v=a.map(v,function(b,c){if(isFinite(c)){var d,e=b.alternation,f=b.locator[e].toString().split(",");b.locator[e]=void 0,b.alternation=void 0;for(var g=0;g<f.length;g++)d=-1!==a.inArray(f[g],C),d&&(void 0!==b.locator[e]?(b.locator[e]+=",",b.locator[e]+=f[g]):b.locator[e]=parseInt(f[g]),b.alternation=e);if(void 0!==b.locator[e])return b}})),k=w.concat(v),i=b,l=k.length>0}else f=j(t.matches[y]||c.matches[y],[y].concat(h),o);if(f)return!0}else if(f.isQuantifier&&o!==c.matches[a.inArray(f,c.matches)-1])for(var K=f,L=d.length>0?d.shift():0;L<(isNaN(K.quantifier.max)?L+1:K.quantifier.max)&&b>=i;L++){var M=c.matches[a.inArray(K,c.matches)-1];if(f=j(M,[L].concat(h),M)){if(g=k[k.length-1].match,g.optionalQuantifier=L>K.quantifier.min-1,p(g,M)){if(L>K.quantifier.min-1){l=!0,i=b;break}return!0}return!0}}else if(f=e(f,d,h,o))return!0}else i++}for(var o=d.length>0?d.shift():0;o<c.matches.length;o++)if(c.matches[o].isQuantifier!==!0){var p=j(c.matches[o],[o].concat(f),h);if(p&&i===b)return p;if(i>b)break}}function f(a){var b=a[0]||a;return b.locator.slice()}var g,h=m().maskToken,i=c?d:0,j=c||[0],k=[],l=!1,n=c?c.join(""):"";if(b>-1){if(void 0===c){for(var o,p=b-1;void 0===(o=m().validPositions[p]||m().tests[p])&&p>-1;)p--;void 0!==o&&p>-1&&(j=f(o),n=j.join(""),o=o[0]||o,i=p)}if(m().tests[b]&&m().tests[b][0].cd===n)return m().tests[b];for(var q=j.shift();q<h.length;q++){var r=e(h[q],j,[q]);if(r&&i===b||i>b)break}}return(0===k.length||l)&&k.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]}),m().tests[b]=a.extend(!0,[],k),m().tests[b]}function w(){return void 0===m()._buffer&&(m()._buffer=i(!1,1)),m()._buffer}function x(a){if(void 0===m().buffer||a===!0){if(a===!0)for(var b in m().tests)void 0===m().validPositions[b]&&delete m().tests[b];m().buffer=i(!0,o(),!0)}return m().buffer}function y(a,b,c){var d;if(c=c,a===!0)n(),a=0,b=c.length;else for(d=a;b>d;d++)delete m().validPositions[d],delete m().tests[d];for(d=a;b>d;d++)n(!0),c[d]!==g.skipOptionalPartCharacter&&B(d,c[d],!0,!0)}function z(a,b){switch(b.casing){case"upper":a=a.toUpperCase();break;case"lower":a=a.toLowerCase()}return a}function A(b,c){for(var d=g.greedy?c:c.slice(0,1),e=!1,f=0;f<b.length;f++)if(-1!==a.inArray(b[f],d)){e=!0;break}return e}function B(c,d,e,f){function h(a){return ja?a.begin-a.end>1||a.begin-a.end===1&&g.insertMode:a.end-a.begin>1||a.end-a.begin===1&&g.insertMode}function i(b,d,e,f){var i=!1;return a.each(v(b),function(j,k){for(var l=k.match,r=d?1:0,s="",t=l.cardinality;t>r;t--)s+=G(b-(t-1));if(d&&(s+=d),x(!0),i=null!=l.fn?l.fn.test(s,m(),b,e,g,h(c)):d!==l.def&&d!==g.skipOptionalPartCharacter||""===l.def?!1:{c:l.placeholder||l.def,pos:b},i!==!1){var u=void 0!==i.c?i.c:d;u=u===g.skipOptionalPartCharacter&&null===l.fn?l.placeholder||l.def:u;var v=b,w=x();if(void 0!==i.remove&&(a.isArray(i.remove)||(i.remove=[i.remove]),a.each(i.remove.sort(function(a,b){return b-
277a}),function(a,b){q(b,b+1,!0)})),void 0!==i.insert&&(a.isArray(i.insert)||(i.insert=[i.insert]),a.each(i.insert.sort(function(a,b){return a-b}),function(a,b){B(b.pos,b.c,!1,f)})),i.refreshFromBuffer){var A=i.refreshFromBuffer;if(e=!0,y(A===!0?A:A.start,A.end,w),void 0===i.pos&&void 0===i.c)return i.pos=o(),!1;if(v=void 0!==i.pos?i.pos:b,v!==b)return i=a.extend(i,B(v,u,!0,f)),!1}else if(i!==!0&&void 0!==i.pos&&i.pos!==b&&(v=i.pos,y(b,v,x().slice()),v!==b))return i=a.extend(i,B(v,u,!0)),!1;return i!==!0&&void 0===i.pos&&void 0===i.c?!1:(j>0&&n(!0),p(v,a.extend({},k,{input:z(u,l)}),f,h(c))||(i=!1),!1)}}),i}function j(b,c,d,e){for(var f,h,i,j,k,l,p=a.extend(!0,{},m().validPositions),q=a.extend(!0,{},m().tests),s=o();s>=0&&(j=m().validPositions[s],!j||void 0===j.alternation||(f=s,h=m().validPositions[f].alternation,r(f).locator[j.alternation]===j.locator[j.alternation]));s--);if(void 0!==h){f=parseInt(f);for(var t in m().validPositions)if(t=parseInt(t),j=m().validPositions[t],t>=f&&void 0!==j.alternation){var v;0===f?(v=[],a.each(m().tests[f],function(a,b){void 0!==b.locator[h]&&(v=v.concat(b.locator[h].toString().split(",")))})):v=m().validPositions[f].locator[h].toString().split(",");var w=void 0!==j.locator[h]?j.locator[h]:v[0];w.length>0&&(w=w.split(",")[0]);for(var x=0;x<v.length;x++){var y=[],z=0,A=0;if(w<v[x]){for(var C,D,E=t;E>=0;E--)if(C=m().validPositions[E],void 0!==C){var F=u(E,v[x]);m().validPositions[E].match.def!==F.match.def&&(y.push(m().validPositions[E].input),m().validPositions[E]=F,m().validPositions[E].input=I(E),null===m().validPositions[E].match.fn&&A++,C=F),D=C.locator[h],C.locator[h]=parseInt(v[x]);break}if(w!==C.locator[h]){for(k=t+1;k<o(void 0,!0)+1;k++)l=m().validPositions[k],l&&null!=l.match.fn?y.push(l.input):b>k&&z++,delete m().validPositions[k],delete m().tests[k];for(n(!0),g.keepStatic=!g.keepStatic,i=!0;y.length>0;){var G=y.shift();if(G!==g.skipOptionalPartCharacter&&!(i=B(o(void 0,!0)+1,G,!1,e)))break}if(C.alternation=h,C.locator[h]=D,i){var H=o(b)+1;for(k=t+1;k<o()+1;k++)l=m().validPositions[k],(void 0===l||null==l.match.fn)&&b>k&&A++;b+=A-z,i=B(b>H?H:b,c,d,e)}if(g.keepStatic=!g.keepStatic,i)return i;n(),m().validPositions=a.extend(!0,{},p),m().tests=a.extend(!0,{},q)}}}break}}return!1}function k(b,c){for(var d=m().validPositions[c],e=d.locator,f=e.length,g=b;c>g;g++)if(void 0===m().validPositions[g]&&!C(g,!0)){var h=v(g),i=h[0],j=-1;a.each(h,function(a,b){for(var c=0;f>c&&(void 0!==b.locator[c]&&A(b.locator[c].toString().split(","),e[c].toString().split(",")));c++)c>j&&(j=c,i=b)}),p(g,a.extend({},i,{input:i.match.placeholder||i.match.def}),!0)}}e=e===!0;var l=c;void 0!==c.begin&&(l=ja&&!h(c)?c.end:c.begin);for(var s=!1,t=a.extend(!0,{},m().validPositions),w=l-1;w>-1&&!m().validPositions[w];w--);var F;for(w++;l>w;w++)void 0===m().validPositions[w]&&(g.jitMasking===!1||g.jitMasking>w)&&((F=r(w)).match.def===g.radixPointDefinitionSymbol||!C(w,!0)||a.inArray(g.radixPoint,x())<w&&F.match.fn&&F.match.fn.test(I(w),m(),w,!1,g))&&i(o(w,!0)+1,F.match.placeholder||(null==F.match.fn?F.match.def:""!==I(w)?I(w):x()[w]),!0,f);if(h(c)&&(Q(void 0,b.keyCode.DELETE,c),l=m().p),l<D()&&(s=i(l,d,e,f),(!e||f===!0)&&s===!1)){var H=m().validPositions[l];if(!H||null!==H.match.fn||H.match.def!==d&&d!==g.skipOptionalPartCharacter){if((g.insertMode||void 0===m().validPositions[E(l)])&&!C(l,!0)){var J=r(l).match;J=J.placeholder||J.def,i(l,J,e,f);for(var K=l+1,L=E(l);L>=K;K++)if(s=i(K,d,e,f),s!==!1){k(l,K),l=K;break}}}else s={caret:E(l)}}return s===!1&&g.keepStatic&&(s=j(l,d,e,f)),s===!0&&(s={pos:l}),a.isFunction(g.postValidation)&&s!==!1&&!e&&f!==!0&&(s=g.postValidation(x(!0),s,g)?s:!1),void 0===s.pos&&(s.pos=l),s===!1&&(n(!0),m().validPositions=a.extend(!0,{},t)),s}function C(a,b){var c;if(b?(c=r(a).match,""===c.def&&(c=s(a))):c=s(a),null!=c.fn)return c.fn;if(b!==!0&&a>-1&&!g.keepStatic&&void 0===m().validPositions[a]){var d=v(a);return d.length>2}return!1}function D(){var a;ha=void 0!==fa?fa.maxLength:void 0,-1===ha&&(ha=void 0);var b,c=o(),d=m().validPositions[c],e=void 0!==d?d.locator.slice():void 0;for(b=c+1;void 0===d||null!==d.match.fn||null===d.match.fn&&""!==d.match.def;b++)d=r(b,e,b-1),e=d.locator.slice();var f=s(b-1);return a=""!==f.def?b:b-1,void 0===ha||ha>a?a:ha}function E(a,b){var c=D();if(a>=c)return c;for(var d=a;++d<c&&(b===!0&&(s(d).newBlockMarker!==!0||!C(d))||b!==!0&&!C(d)&&(g.nojumps!==!0||g.nojumpsThreshold>d)););return d}function F(a,b){var c=a;if(0>=c)return 0;for(;--c>0&&(b===!0&&s(c).newBlockMarker!==!0||b!==!0&&!C(c)););return c}function G(a){return void 0===m().validPositions[a]?I(a):m().validPositions[a].input}function H(b,c,d,e,f){if(e&&a.isFunction(g.onBeforeWrite)){var h=g.onBeforeWrite(e,c,d,g);if(h){if(h.refreshFromBuffer){var i=h.refreshFromBuffer;y(i===!0?i:i.start,i.end,h.buffer||c),c=x(!0)}void 0!==d&&(d=void 0!==h.caret?h.caret:d)}}b.inputmask._valueSet(c.join("")),void 0===d||void 0!==e&&"blur"===e.type||L(b,d),f===!0&&(la=!0,a(b).trigger("input"))}function I(a,b){if(b=b||s(a),void 0!==b.placeholder)return b.placeholder;if(null===b.fn){if(a>
277-1&&!g.keepStatic&&void 0===m().validPositions[a]){var c,d=v(a),e=0;if(d.length>2)for(var f=0;f<d.length;f++)if(d[f].match.optionality!==!0&&d[f].match.optionalQuantifier!==!0&&(null===d[f].match.fn||void 0===c||d[f].match.fn.test(c.match.def,m(),a,!0,g)!==!1)&&(e++,null===d[f].match.fn&&(c=d[f]),e>1))return g.placeholder.charAt(a%g.placeholder.length)}return b.def}return g.placeholder.charAt(a%g.placeholder.length)}function J(c,d,e,f){function h(){var a=!1,b=w().slice(l,E(l)).join("").indexOf(k);if(-1!==b&&!C(l)){a=!0;for(var c=w().slice(l,l+b),d=0;d<c.length;d++)if(" "!==c[d]){a=!1;break}}return a}var i,j=f.slice(),k="",l=0;if(n(),m().p=E(-1),!e)if(g.autoUnmask!==!0){var p=w().slice(0,E(-1)).join(""),q=j.join("").match(new RegExp("^"+b.escapeRegex(p),"g"));q&&q.length>0&&(j.splice(0,q.length*p.length),l=E(l))}else l=E(l);a.each(j,function(b,d){if(void 0!==d){var f=new a.Event("keypress");f.which=d.charCodeAt(0),k+=d;var j=o(void 0,!0),p=m().validPositions[j],q=r(j+1,p?p.locator.slice():void 0,j);if(!h()||e||g.autoUnmask){var s=e?b:null==q.match.fn&&q.match.optionality&&j+1<m().p?j+1:m().p;i=S.call(c,f,!0,!1,e,s),l=s+1,k=""}else i=S.call(c,f,!0,!1,!0,j+1);if(!e&&a.isFunction(g.onBeforeWrite)&&(i=g.onBeforeWrite(f,x(),i.forwardPosition,g),i&&i.refreshFromBuffer)){var t=i.refreshFromBuffer;y(t===!0?t:t.start,t.end,i.buffer),n(!0),i.caret&&(m().p=i.caret)}}}),d&&H(c,x(),document.activeElement===c?E(o(0)):void 0,new a.Event("checkval"))}function K(b){if(b&&void 0===b.inputmask)return b.value;var c=[],d=m().validPositions;for(var e in d)d[e].match&&null!=d[e].match.fn&&c.push(d[e].input);var f=0===c.length?null:(ja?c.reverse():c).join("");if(null!==f){var h=(ja?x().slice().reverse():x()).join("");a.isFunction(g.onUnMask)&&(f=g.onUnMask(h,f,g)||f)}return f}function L(a,b,c,d){function e(a){if(d!==!0&&ja&&"number"==typeof a&&(!g.greedy||""!==g.placeholder)){var b=x().join("").length;a=b-a}return a}var f;if("number"!=typeof b)return a.setSelectionRange?(b=a.selectionStart,c=a.selectionEnd):window.getSelection?(f=window.getSelection().getRangeAt(0),(f.commonAncestorContainer.parentNode===a||f.commonAncestorContainer===a)&&(b=f.startOffset,c=f.endOffset)):document.selection&&document.selection.createRange&&(f=document.selection.createRange(),b=0-f.duplicate().moveStart("character",-a.inputmask._valueGet().length),c=b+f.text.length),{begin:e(b),end:e(c)};b=e(b),c=e(c),c="number"==typeof c?c:b;var h=parseInt(((a.ownerDocument.defaultView||window).getComputedStyle?(a.ownerDocument.defaultView||window).getComputedStyle(a,null):a.currentStyle).fontSize)*c;if(a.scrollLeft=h>a.scrollWidth?h:0,j||g.insertMode!==!1||b!==c||c++,a.setSelectionRange)a.selectionStart=b,a.selectionEnd=c;else if(window.getSelection){if(f=document.createRange(),void 0===a.firstChild||null===a.firstChild){var i=document.createTextNode("");a.appendChild(i)}f.setStart(a.firstChild,b<a.inputmask._valueGet().length?b:a.inputmask._valueGet().length),f.setEnd(a.firstChild,c<a.inputmask._valueGet().length?c:a.inputmask._valueGet().length),f.collapse(!0);var k=window.getSelection();k.removeAllRanges(),k.addRange(f)}else a.createTextRange&&(f=a.createTextRange(),f.collapse(!0),f.moveEnd("character",c),f.moveStart("character",b),f.select())}function M(b){var c,d,e=x(),f=e.length,g=o(),h={},i=m().validPositions[g],j=void 0!==i?i.locator.slice():void 0;for(c=g+1;c<e.length;c++)d=r(c,j,c-1),j=d.locator.slice(),h[c]=a.extend(!0,{},d);var k=i&&void 0!==i.alternation?i.locator[i.alternation]:void 0;for(c=f-1;c>g&&(d=h[c],(d.match.optionality||d.match.optionalQuantifier||k&&(k!==h[c].locator[i.alternation]&&null!=d.match.fn||null===d.match.fn&&d.locator[i.alternation]&&A(d.locator[i.alternation].toString().split(","),k.toString().split(","))&&""!==v(c)[0].def))&&e[c]===I(c,d.match));c--)f--;return b?{l:f,def:h[f]?h[f].match:void 0}:f}function N(a){for(var b=M(),c=a.length-1;c>b&&!C(c);c--);return a.splice(b,c+1-b),a}function O(b){if(a.isFunction(g.isComplete))return g.isComplete(b,g);if("*"===g.repeat)return void 0;var c=!1,d=M(!0),e=F(d.l);if(void 0===d.def||d.def.newBlockMarker||d.def.optionality||d.def.optionalQuantifier){c=!0;for(var f=0;e>=f;f++){var h=r(f).match;if(null!==h.fn&&void 0===m().validPositions[f]&&h.optionality!==!0&&h.optionalQuantifier!==!0||null===h.fn&&b[f]!==I(f,h)){c=!1;break}}}return c}function P(b){function c(b){if(a.valHooks&&(void 0===a.valHooks[b]||a.valHooks[b].inputmaskpatch!==!0)){var c=a.valHooks[b]&&a.valHooks[b].get?a.valHooks[b].get:function(a){return a.value},d=a.valHooks[b]&&a.valHooks[b].set?a.valHooks[b].set:function(a,b){return a.value=b,a};
277a.valHooks[b]={get:function(a){if(a.inputmask){if(a.inputmask.opts.autoUnmask)return a.inputmask.unmaskedvalue();var b=c(a);return-1!==o()||g.nullable!==!0?b:""}return c(a)},set:function(b,c){var e,f=a(b);return e=d(b,c),b.inputmask&&f.trigger("setvalue"),e},inputmaskpatch:!0}}}function d(){return this.inputmask?this.inputmask.opts.autoUnmask?this.inputmask.unmaskedvalue():-1!==o()||g.nullable!==!0?document.activeElement===this&&g.clearMaskOnLostFocus?(ja?N(x().slice()).reverse():N(x().slice())).join(""):h.call(this):"":h.call(this)}function e(b){i.call(this,b),this.inputmask&&a(this).trigger("setvalue")}function f(b){oa.on(b,"mouseenter",function(b){var c=a(this),d=this,e=d.inputmask._valueGet();e!==x().join("")&&c.trigger("setvalue")})}var h,i;if(!b.inputmask.__valueGet){if(Object.getOwnPropertyDescriptor){var j=Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(b),"value"):void 0;j&&j.get&&j.set?(h=j.get,i=j.set,Object.defineProperty(b,"value",{get:d,set:e,configurable:!0})):"INPUT"!==b.tagName&&(h=function(){return this.textContent},i=function(a){this.textContent=a},Object.defineProperty(b,"value",{get:d,set:e,configurable:!0}))}else document.__lookupGetter__&&b.__lookupGetter__("value")&&(h=b.__lookupGetter__("value"),i=b.__lookupSetter__("value"),b.__defineGetter__("value",d),b.__defineSetter__("value",e));b.inputmask.__valueGet=h,b.inputmask._valueGet=function(a){return ja&&a!==!0?h.call(this.el).split("").reverse().join(""):h.call(this.el)},b.inputmask.__valueSet=i,b.inputmask._valueSet=function(a,b){i.call(this.el,null===a||void 0===a?"":b!==!0&&ja?a.split("").reverse().join(""):a)},void 0===h&&(h=function(){return this.value},i=function(a){this.value=a},c(b.type),f(b))}}function Q(c,d,e,f){function h(){if(g.keepStatic){n(!0);var b,d=[],e=a.extend(!0,{},m().validPositions);for(b=o();b>=0;b--){var f=m().validPositions[b];if(f&&(null!=f.match.fn&&d.push(f.input),delete m().validPositions[b],void 0!==f.alternation&&f.locator[f.alternation]===r(b).locator[f.alternation]))break}if(b>-1)for(;d.length>0;){m().p=E(o());var h=new a.Event("keypress");h.which=d.pop().charCodeAt(0),S.call(c,h,!0,!1,!1,m().p)}else m().validPositions=a.extend(!0,{},e)}}if((g.numericInput||ja)&&(d===b.keyCode.BACKSPACE?d=b.keyCode.DELETE:d===b.keyCode.DELETE&&(d=b.keyCode.BACKSPACE),ja)){var i=e.end;e.end=e.begin,e.begin=i}d===b.keyCode.BACKSPACE&&(e.end-e.begin<1||g.insertMode===!1)?(e.begin=F(e.begin),void 0===m().validPositions[e.begin]||m().validPositions[e.begin].input!==g.groupSeparator&&m().validPositions[e.begin].input!==g.radixPoint||e.begin--):d===b.keyCode.DELETE&&e.begin===e.end&&(e.end=C(e.end)?e.end+1:E(e.end)+1,void 0===m().validPositions[e.begin]||m().validPositions[e.begin].input!==g.groupSeparator&&m().validPositions[e.begin].input!==g.radixPoint||e.end++),q(e.begin,e.end,!1,f),f!==!0&&h();var j=o(e.begin);j<e.begin?(-1===j&&n(),m().p=E(j)):f!==!0&&(m().p=e.begin)}function R(d){var e=this,f=a(e),h=d.keyCode,i=L(e);if(h===b.keyCode.BACKSPACE||h===b.keyCode.DELETE||l&&h===b.keyCode.BACKSPACE_SAFARI||d.ctrlKey&&h===b.keyCode.X&&!c("cut"))d.preventDefault(),Q(e,h,i),H(e,x(),m().p,d,ea!==x().join("")),e.inputmask._valueGet()===w().join("")?f.trigger("cleared"):O(x())===!0&&f.trigger("complete"),g.showTooltip&&(e.title=g.tooltip||m().mask);else if(h===b.keyCode.END||h===b.keyCode.PAGE_DOWN){d.preventDefault();var j=E(o());g.insertMode||j!==D()||d.shiftKey||j--,L(e,d.shiftKey?i.begin:j,j,!0)}else h===b.keyCode.HOME&&!d.shiftKey||h===b.keyCode.PAGE_UP?(d.preventDefault(),L(e,0,d.shiftKey?i.begin:0,!0)):(g.undoOnEscape&&h===b.keyCode.ESCAPE||90===h&&d.ctrlKey)&&d.altKey!==!0?(J(e,!0,!1,ea.split("")),f.trigger("click")):h!==b.keyCode.INSERT||d.shiftKey||d.ctrlKey?g.tabThrough===!0&&h===b.keyCode.TAB?(d.shiftKey===!0?(null===s(i.begin).fn&&(i.begin=E(i.begin)),i.end=F(i.begin,!0),i.begin=F(i.end,!0)):(i.begin=E(i.begin,!0),i.end=E(i.begin,!0),i.end<D()&&i.end--),i.begin<D()&&(d.preventDefault(),L(e,i.begin,i.end))):g.insertMode!==!1||d.shiftKey||(h===b.keyCode.RIGHT?setTimeout(function(){var a=L(e);L(e,a.begin)},0):h===b.keyCode.LEFT&&setTimeout(function(){var a=L(e);L(e,ja?a.begin+1:a.begin-1)},0)):(g.insertMode=!g.insertMode,L(e,g.insertMode||i.begin!==D()?i.begin:i.begin-1));g.onKeyDown.call(this,d,x(),L(e).begin,g),ma=-1!==a.inArray(h,g.ignorables)}
277function S(c,d,e,f,h){var i=this,j=a(i),k=c.which||c.charCode||c.keyCode;if(!(d===!0||c.ctrlKey&&c.altKey)&&(c.ctrlKey||c.metaKey||ma))return k===b.keyCode.ENTER&&ea!==x().join("")&&(ea=x().join(""),setTimeout(function(){j.trigger("change")},0)),!0;if(k){46===k&&c.shiftKey===!1&&","===g.radixPoint&&(k=44);var l,o=d?{begin:h,end:h}:L(i),p=String.fromCharCode(k);m().writeOutBuffer=!0;var q=B(o,p,f);if(q!==!1){var r=q.pos;if(n(!0),void 0!==q.caret)l=q.caret;else{var s=m().validPositions;l=!g.keepStatic&&(void 0!==s[r+1]&&v(r+1,s[r].locator.slice(),r).length>1||void 0!==s[r].alternation)?r+1:E(r)}m().p=l}if(e!==!1){var t=this;if(setTimeout(function(){g.onKeyValidation.call(t,k,q,g)},0),m().writeOutBuffer&&q!==!1){var u=x();H(i,u,g.numericInput&&void 0===q.caret?F(l):l,c,d!==!0),d!==!0&&setTimeout(function(){O(u)===!0&&j.trigger("complete")},0)}}if(g.showTooltip&&(i.title=g.tooltip||m().mask),c.preventDefault(),d)return q.forwardPosition=l,q}}function T(b){var c,d=this,e=b.originalEvent||b,f=a(d),h=d.inputmask._valueGet(!0),i=L(d);ja&&(c=i.end,i.end=i.begin,i.begin=c);var j=h.substr(0,i.begin),k=h.substr(i.end,h.length);j===(ja?w().reverse():w()).slice(0,i.begin).join("")&&(j=""),k===(ja?w().reverse():w()).slice(i.end).join("")&&(k=""),ja&&(c=j,j=k,k=c),window.clipboardData&&window.clipboardData.getData?h=j+window.clipboardData.getData("Text")+k:e.clipboardData&&e.clipboardData.getData&&(h=j+e.clipboardData.getData("text/plain")+k);var l=h;if(a.isFunction(g.onBeforePaste)){if(l=g.onBeforePaste(h,g),l===!1)return b.preventDefault();l||(l=h)}return J(d,!1,!1,ja?l.split("").reverse():l.toString().split("")),H(d,x(),E(o()),b,!0),O(x())===!0&&f.trigger("complete"),b.preventDefault()}function U(c){var d=this,e=d.inputmask._valueGet();if(x().join("")!==e){var f=L(d);if(e=e.replace(new RegExp("("+b.escapeRegex(w().join(""))+")*"),""),k){var g=e.replace(x().join(""),"");if(1===g.length){var h=new a.Event("keypress");return h.which=g.charCodeAt(0),S.call(d,h,!0,!0,!1,m().validPositions[f.begin-1]?f.begin:f.begin-1),!1}}if(f.begin>e.length&&(L(d,e.length),f=L(d)),x().length-e.length!==1||e.charAt(f.begin)===x()[f.begin]||e.charAt(f.begin+1)===x()[f.begin]||C(f.begin)){for(var i=o()+1,j=x().slice(i).join("");null===e.match(b.escapeRegex(j)+"$");)j=j.slice(1);e=e.replace(j,""),e=e.split(""),J(d,!0,!1,e),O(x())===!0&&a(d).trigger("complete")}else c.keyCode=b.keyCode.BACKSPACE,R.call(d,c);c.preventDefault()}}function V(b){var c=this,d=c.inputmask._valueGet();J(c,!0,!1,(a.isFunction(g.onBeforeMask)?g.onBeforeMask(d,g)||d:d).split("")),ea=x().join(""),(g.clearMaskOnLostFocus||g.clearIncomplete)&&c.inputmask._valueGet()===w().join("")&&c.inputmask._valueSet("")}function W(a){var b=this,c=b.inputmask._valueGet();g.showMaskOnFocus&&(!g.showMaskOnHover||g.showMaskOnHover&&""===c)?b.inputmask._valueGet()!==x().join("")&&H(b,x(),E(o())):na===!1&&L(b,E(o())),g.positionCaretOnTab===!0&&setTimeout(function(){L(b,E(o()))},0),ea=x().join("")}function X(a){var b=this;if(na=!1,g.clearMaskOnLostFocus&&document.activeElement!==b){var c=x().slice(),d=b.inputmask._valueGet();d!==b.getAttribute("placeholder")&&""!==d&&(-1===o()&&d===w().join("")?c=[]:N(c),H(b,c))}}function Y(b){function c(b){if(g.radixFocus&&""!==g.radixPoint){var c=m().validPositions;if(void 0===c[b]||c[b].input===I(b)){if(b<E(-1))return!0;var d=a.inArray(g.radixPoint,x()); 278if(-1!==d){for(var e in c)if(e>d&&c[e].input!==I(e))return!1;return!0}}}return!1}var d=this;setTimeout(function(){if(document.activeElement===d){var b=L(d);if(b.begin===b.end)if(c(b.begin))L(d,g.numericInput?E(a.inArray(g.radixPoint,x())):a.inArray(g.radixPoint,x()));else{var e=b.begin,f=o(e,!0),h=E(f);if(h>e)L(d,C(e)||C(e-1)?e:E(e));else{var i=I(h);(""!==i&&x()[h]!==i||!C(h,!0)&&s(h).def===i)&&(h=E(h)),L(d,h)}}}},0)}function Z(a){var b=this;setTimeout(function(){L(b,0,E(o()))},0)}function $(c){var d=this,e=a(d),f=L(d),h=c.originalEvent||c,i=window.clipboardData||h.clipboardData,j=ja?x().slice(f.end,f.begin):x().slice(f.begin,f.end);i.setData("text",ja?j.reverse().join(""):j.join("")),document.execCommand&&document.execCommand("copy"),Q(d,b.keyCode.DELETE,f),H(d,x(),m().p,c,ea!==x().join("")),d.inputmask._valueGet()===w().join("")&&e.trigger("cleared"),g.showTooltip&&(d.title=g.tooltip||m().mask)}function _(b){var c=a(this),d=this;if(d.inputmask){var e=d.inputmask._valueGet(),f=x().slice();ea!==f.join("")&&setTimeout(function(){c.trigger("change"),ea=f.join("")},0),""!==e&&(g.clearMaskOnLostFocus&&(-1===o()&&e===w().join("")?f=[]:N(f)),O(f)===!1&&(setTimeout(function(){c.trigger("incomplete")},0),g.clearIncomplete&&(n(),f=g.clearMaskOnLostFocus?[]:w().slice())),H(d,f,void 0,b))}}function aa(a){var b=this;na=!0,document.activeElement!==b&&g.showMaskOnHover&&b.inputmask._valueGet()!==x().join("")&&H(b,x())}function ba(a){ea!==x().join("")&&ga.trigger("change"),g.clearMaskOnLostFocus&&-1===o()&&fa.inputmask._valueGet&&fa.inputmask._valueGet()===w().join("")&&fa.inputmask._valueSet(""),g.removeMaskOnSubmit&&(fa.inputmask._valueSet(fa.inputmask.unmaskedvalue(),!0),setTimeout(function(){H(fa,x())},0))}function ca(a){setTimeout(function(){ga.trigger("setvalue")},0)}function da(b){if(fa=b,ga=a(fa),g.showTooltip&&(fa.title=g.tooltip||m().mask),("rtl"===fa.dir||g.rightAlign)&&(fa.style.textAlign="right"),("rtl"===fa.dir||g.numericInput)&&(fa.dir="ltr",fa.removeAttribute("dir"),fa.inputmask.isRTL=!0,ja=!0),oa.off(fa),P(fa),d(fa,g)&&(oa.on(fa,"submit",ba),oa.on(fa,"reset",ca),oa.on(fa,"mouseenter",aa),oa.on(fa,"blur",_),oa.on(fa,"focu
278s",W),oa.on(fa,"mouseleave",X),oa.on(fa,"click",Y),oa.on(fa,"dblclick",Z),oa.on(fa,"paste",T),oa.on(fa,"dragdrop",T),oa.on(fa,"drop",T),oa.on(fa,"cut",$),oa.on(fa,"complete",g.oncomplete),oa.on(fa,"incomplete",g.onincomplete),oa.on(fa,"cleared",g.oncleared),oa.on(fa,"keydown",R),oa.on(fa,"keypress",S),oa.on(fa,"input",U)),oa.on(fa,"setvalue",V),""!==fa.inputmask._valueGet()||g.clearMaskOnLostFocus===!1||document.activeElement===fa){var c=a.isFunction(g.onBeforeMask)?g.onBeforeMask(fa.inputmask._valueGet(),g)||fa.inputmask._valueGet():fa.inputmask._valueGet();J(fa,!0,!1,c.split(""));var e=x().slice();ea=e.join(""),O(e)===!1&&g.clearIncomplete&&n(),g.clearMaskOnLostFocus&&document.activeElement!==fa&&(-1===o()?e=[]:N(e)),H(fa,e),document.activeElement===fa&&L(fa,E(o()))}}var ea,fa,ga,ha,ia,ja=!1,ka=!1,la=!1,ma=!1,na=!0,oa={on:function(c,d,e){var f=function(c){if(void 0===this.inputmask&&"FORM"!==this.nodeName){var d=a.data(this,"_inputmask_opts");d?new b(d).mask(this):oa.off(this)}else{if("setvalue"===c.type||!(this.disabled||this.readOnly&&!("keydown"===c.type&&c.ctrlKey&&67===c.keyCode||g.tabThrough===!1&&c.keyCode===b.keyCode.TAB))){switch(c.type){case"input":if(la===!0)return la=!1,c.preventDefault();break;case"keydown":ka=!1,la=!1;break;case"keypress":if(ka===!0)return c.preventDefault();ka=!0;break;case"click":if(k){var f=this;return setTimeout(function(){e.apply(f,arguments)},0),!1}}var h=e.apply(this,arguments);return h===!1&&(c.preventDefault(),c.stopPropagation()),h}c.preventDefault()}};c.inputmask.events[d]=c.inputmask.events[d]||[],c.inputmask.events[d].push(f),-1!==a.inArray(d,["submit","reset"])?null!=c.form&&a(c.form).on(d,f):a(c).on(d,f)},off:function(b,c){if(b.inputmask&&b.inputmask.events){var d;c?(d=[],d[c]=b.inputmask.events[c]):d=b.inputmask.events,a.each(d,function(c,d){for(;d.length>0;){var e=d.pop();-1!==a.inArray(c,["submit","reset"])?null!=b.form&&a(b.form).off(c,e):a(b).off(c,e)}delete b.inputmask.events[c]})}}};if(void 0!==e)switch(e.action){case"isComplete":return fa=e.el,O(x());case"unmaskedvalue":return fa=e.el,void 0!==fa&&void 0!==fa.inputmask?(f=fa.inputmask.maskset,g=fa.inputmask.opts,ja=fa.inputmask.isRTL):(ia=e.value,g.numericInput&&(ja=!0),ia=(a.isFunction(g.onBeforeMask)?g.onBeforeMask(ia,g)||ia:ia).split(""),J(void 0,!1,!1,ja?ia.reverse():ia),a.isFunction(g.onBeforeWrite)&&g.onBeforeWrite(void 0,x(),0,g)),K(fa);case"mask":fa=e.el,f=fa.inputmask.maskset,g=fa.inputmask.opts,ja=fa.inputmask.isRTL,ea=x().join(""),da(fa);break;case"format":return g.numericInput&&(ja=!0),ia=(a.isFunction(g.onBeforeMask)?g.onBeforeMask(e.value,g)||e.value:e.value).split(""),J(void 0,!1,!1,ja?ia.reverse():ia),a.isFunction(g.onBeforeWrite)&&g.onBeforeWrite(void 0,x(),0,g),e.metadata?{value:ja?x().slice().reverse().join(""):x().join(""),metadata:h({action:"getmetadata"},f,g)}:ja?x().slice().reverse().join(""):x().join("");case"isValid":g.numericInput&&(ja=!0),e.value?(ia=e.value.split(""),J(void 0,!1,!0,ja?ia.reverse():ia)):e.value=x().join("");for(var pa=x(),qa=M(),ra=pa.length-1;ra>qa&&!C(ra);ra--);return pa.splice(qa,ra+1-qa),O(pa)&&e.value===x().join("");case"getemptymask":return w().join("");case"remove":fa=e.el,ga=a(fa),f=fa.inputmask.maskset,g=fa.inputmask.opts,fa.inputmask._valueSet(K(fa)),oa.off(fa);var sa;Object.getOwnPropertyDescriptor&&Object.getPrototypeOf?(sa=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(fa),"value"),sa&&fa.inputmask.__valueGet&&Object.defineProperty(fa,"value",{get:fa.inputmask.__valueGet,set:fa.inputmask.__valueSet,configurable:!0})):document.__lookupGetter__&&fa.__lookupGetter__("value")&&fa.inputmask.__valueGet&&(fa.__defineGetter__("value",fa.inputmask.__valueGet),fa.__defineSetter__("value",fa.inputmask.__valueSet)),fa.inputmask=void 0;break;case"getmetadata":if(a.isArray(f.metadata)){for(var ta,ua=o(void 0,!0),va=ua;va>=0;va--)if(m().validPositions[va]&&void 0!==m().validPositions[va].alternation){ta=m().validPositions[va].alternation;break}return void 0!==ta?f.metadata[m().validPositions[va].locator[ta]]:[]}return f.metadata}}b.prototype={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:a.noop,onincomplete:a.noop,oncleared:a.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyDown:a.noop,onBeforeMask:null,onBeforePaste:function(b,c){return a.isFunction(c.onBeforeMask)?c.onBeforeMask(b,c):b},onBeforeWrite:null,onUnMask:null,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:a.noop,skipOptionalPartCharacter:" ",showTooltip:!1,tooltip:void 0,numericInput:!1,rightAlign:!1,undoOnEscape:!0,radixPoint:"",radixPointDefinitionSymbol:void 0,groupSeparator:"",radixFocus:!1,nojumps:!1,nojumpsThreshold:0,keepStatic:null,positionCaretOnTab:!1,tabThrough:!1,supportsInputType:["text","tel","password"],definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:null,canClearPosition:a.noop,postValidation:null,staticDefinitionSymbol:void 0,jitMasking:!1,nullable:!0},masksCache:{},mask:function(c){var d=this;return"string"==typeof c&&(c=document.getElementById(c)||document.querySelectorAll(c)),c=c.nodeName?[c]:c,a.each(c,function(c,e){var i=a.extend(!0,{},d.opts);f(e,i,a.extend(!0,{},d.userOptions));var j=g(i,d.noMasksCache);void 0!==j&&(void 0!==e.inputmask&&e.inputmask.remove(),e.inputmask=new b,e.inputmask.opts=i,e.inputmask.noMasksCache=d.noMasksCache,e.inputmask.userOptions=a.extend(!0,{},d.userOptions),e.inputmask.el=e,e.inputmask.maskset=j,e.inputmask.isRTL=!1,a.data(e,"_inputmask_opts",i),h({action:"mask",el:e}))}),c&&c[0]?c[0].inputmask||this:this},option:function(b,c){return"string"==typeof b?this.opts[b]:"object"==typeof b?(a.extend(this.userOptions,b),this.el&&c!==!0&&this.mask(this.el),this):void 0},unmaskedvalue:function(a){return h({action:"unmaskedvalue",el:this.el,value:a},this.el&&this.el.inputmask?this.el.inputmask.maskset:g(this.opts,this.noMasksCache),this.opts)},remove:function(){return this.el?(h({action:"remove",el:this.el}),this.el.inputmask=void 0,this.el):void 0},getemptymask:function(){return h({action:"getemptymask"},this.maskset||g(this.opts,this.noMasksCache),this.opts)},hasMaskedValue:function(){return!this.opts.autoUnmask},isComplete:function(){return h({action:"isComplete",el:this.el},this.maskset||g(this.opts,this.noMasksCache),this.opts)},getmetadata:function(){return h({action:"getmetadata"},this.maskset||g(this.opts,this.noMasksCache),this.opts)},isValid:function(a){return h({action:"isValid",value:a},this.maskset||g(this.opts,this.noMasksCache),this.opts)},format:function(a,b){return h({action:"format",value:a,metadata:b},this.maskset||g(this.opts,this.noMasksCache),this.opts)}},b.extendDefaults=function(c){a.extend(!0,b.prototype.defaults,c)},b.extendDefinitions=function(c){a.extend(!0,b.prototype.defaults.definitions,c)},b.extendAliases=function(c){a.extend(!0,b.prototype.defaults.aliases,c)},b.format=function(a,c,d){return b(c).format(a,d)}
278,b.unmask=function(a,c){return b(c).unmaskedvalue(a)},b.isValid=function(a,c){return b(c).isValid(a)},b.remove=function(b){a.each(b,function(a,b){b.inputmask&&b.inputmask.remove()})},b.escapeRegex=function(a){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"];return a.replace(new RegExp("(\\"+b.join("|\\")+")","gim"),"\\$1")},b.keyCode={ALT:18,BACKSPACE:8,BACKSPACE_SAFARI:127,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91,X:88};var i=navigator.userAgent,j=/mobile/i.test(i),k=/iemobile/i.test(i),l=/iphone/i.test(i)&&!k;/android.*safari.*/i.test(i)&&!k;return window.Inputmask=b,b}(jQuery),function(a,b){return void 0===a.fn.inputmask&&(a.fn.inputmask=function(c,d){var e,f=this[0];if(void 0===d&&(d={}),"string"==typeof c)switch(c){case"unmaskedvalue":return f&&f.inputmask?f.inputmask.unmaskedvalue():a(f).val();case"remove":return this.each(function(){this.inputmask&&this.inputmask.remove()});case"getemptymask":return f&&f.inputmask?f.inputmask.getemptymask():"";case"hasMaskedValue":return f&&f.inputmask?f.inputmask.hasMaskedValue():!1;case"isComplete":return f&&f.inputmask?f.inputmask.isComplete():!0;case"getmetadata":return f&&f.inputmask?f.inputmask.getmetadata():void 0;case"setvalue":a(f).val(d),f&&void 0!==f.inputmask&&a(f).triggerHandler("setvalue");break;case"option":if("string"!=typeof d)return this.each(function(){return void 0!==this.inputmask?this.inputmask.option(d):void 0});if(f&&void 0!==f.inputmask)return f.inputmask.option(d);break;default:return d.alias=c,e=new b(d),this.each(function(){e.mask(this)})}else{if("object"==typeof c)return e=new b(c),void 0===c.mask&&void 0===c.alias?this.each(function(){return void 0!==this.inputmask?this.inputmask.option(c):void e.mask(this)}):this.each(function(){e.mask(this)});if(void 0===c)return this.each(function(){e=new b(d),e.mask(this)})}}),a.fn.inputmask}(jQuery,Inputmask),function(a,b){return b.extendDefinitions({h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}}),b.extendAliases({"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[1-9]|[12][0-9]|3[01]"),val2pre:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+c+"[01])")},val2:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[1-9]|[12][0-9])"+c+"(0[1-9]|1[012]))|(30"+c+"(0[13-9]|1[012]))|(31"+c+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,b,c){if(isNaN(a))return!1;var d=parseInt(a.concat(b.toString().slice(a.length))),e=parseInt(a.concat(c.toString().slice(a.length)));return(isNaN(d)?!1:d>=b&&c>=d)||(isNaN(e)?!1:e>=b&&c>=e)},determinebaseyear:function(a,b,c){var d=(new Date).getFullYear();if(a>d)return a;if(d>b){for(var e=b.toString().slice(0,2),f=b.toString().slice(2,4);e+c>b;)e--;var g=e+f;return a>g?a:g}if(d>=a&&b>=d){for(var h=d.toString().slice(0,2);h+c>b;)h--;var i=h+c;return a>i?a:i}return d},onKeyDown:function(c,d,e,f){var g=a(this);if(c.ctrlKey&&c.keyCode===b.keyCode.RIGHT){var h=new Date;g.val(h.getDate().toString()+(h.getMonth()+1).toString()+h.getFullYear().toString()),g.trigger("setvalue")}},getFrontValue:function(a,b,c){for(var d=0,e=0,f=0;f<a.length&&"2"!==a.charAt(f);f++){var g=c.definitions[a.charAt(f)];g?(d+=e,e=g.cardinality):e++}return b.join("").substr(d,e)},definitions:{1:{validator:function(a,b,c,d,e){var f=e.regex.val1.test(a);return d||f||a.charAt(1)!==e.separator&&-1==="-./".indexOf(a.charAt(1))||!(f=e.regex.val1.test("0"+a.charAt(0)))?f:(b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)})}
278,cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=a;isNaN(b.buffer[c+1])||(f+=b.buffer[c+1]);var g=1===f.length?e.regex.val1pre.test(f):e.regex.val1.test(f);if(!d&&!g){if(g=e.regex.val1.test(a+"0"))return b.buffer[c]=a,b.buffer[++c]="0",{pos:c,c:"0"};if(g=e.regex.val1.test("0"+a))return b.buffer[c]="0",c++,{pos:c}}return g},cardinality:1}]},2:{validator:function(a,b,c,d,e){var f=e.getFrontValue(b.mask,b.buffer,e);-1!==f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=e.regex.val2(e.separator).test(f+a);if(!d&&!g&&(a.charAt(1)===e.separator||-1!=="-./".indexOf(a.charAt(1)))&&(g=e.regex.val2(e.separator).test(f+"0"+a.charAt(0))))return b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)};if(e.mask.indexOf("2")===e.mask.length-1&&g){var h=b.buffer.join("").substr(4,4)+a;if(h!==e.leapday)return!0;var i=parseInt(b.buffer.join("").substr(0,4),10);return i%4===0?i%100===0?i%400===0?!0:!1:!0:!1}return g},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=e.getFrontValue(b.mask,b.buffer,e);-1!==f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=1===a.length?e.regex.val2pre(e.separator).test(f+a):e.regex.val2(e.separator).test(f+a);return d||g||!(g=e.regex.val2(e.separator).test(f+"0"+a))?g:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},y:{validator:function(a,b,c,d,e){if(e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)){var f=b.buffer.join("").substr(0,6);if(f!==e.leapday)return!0;var g=parseInt(a,10);return g%4===0?g%100===0?g%400===0?!0:!1:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,1);if(f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,2),f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),b.buffer[c++]=g.charAt(1),{pos:c}}return f},cardinality:1},{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2);if(f=e.isInYearRange(a[0]+g[1]+a[1],e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(1),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2),e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear)){var h=b.buffer.join("").substr(0,6);if(h!==e.leapday)f=!0;else{var i=parseInt(a,10);f=i%4===0?i%100===0?i%400===0?!0:!1:!0:!1}}else f=!1;if(f)return b.buffer[c-1]=g.charAt(0),b.buffer[c++]=g.charAt(1),b.buffer[c++]=a.charAt(0),{refreshFromBuffer:{start:c-3,end:c},pos:c}}return f},cardinality:2},{validator:function(a,b,c,d,e){return e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[13-9]|1[012])"+c+"[0-3])|(02"+c+"[0-2])")},val2:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+c+"30)|((0[13578]|1[02])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyDown:function(c,d,e,f){var g=a(this);if(c.ctrlKey&&c.keyCode===b.keyCode.RIGHT){var h=new Date;g.val((h.getMonth()+1).toString()+h.getDate().toString()+h.getFullYear().toString()),g.trigger("setvalue")}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyDown:function(c,d,e,f){var g=a(this);if(c.ctrlKey&&c.keyCode===b.keyCode.RIGHT){var h=new Date;g.val(h.getFullYear().toString()+(h.getMonth()+1).toString()+h.getDate().toString()),g.trigger("setvalue")}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:new RegExp("[012]"),hrs24:new RegExp("2[0-4]|1[3-9]"),hrs:new RegExp("[01][0-9]|2[0-4]"),ampm:new RegExp("^[a|p|A|P][m|M]"),mspre:new RegExp("[0-5]"),ms:new RegExp("[0-5][0-9]")},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,b,c,d,e){if("24"===e.hourFormat&&24===parseInt(a,10))return b.buffer[c-1]="0",b.buffer[c]="0",{refreshFromBuffer:{start:c-1,end:c},c:"0"};var f=e.regex.hrs.test(a);if(!d&&!f&&(a.charAt(1)===e.timeseparator||-1!=="-.:".indexOf(a.charAt(1)))&&(f=e.regex.hrs.test("0"+a.charAt(0))))return b.buffer[c-1]="0",b.buffer[c]=a.charAt(0),c++,{refreshFromBuffer:{start:c-2,end:c},pos:c,c:e.timeseparator};if(f&&"24"!==e.hourFormat&&e.regex.hrs24.test(a)){var g=parseInt(a,10);return 24===g?(b.buffer[c+5]="a",b.buffer[c+6]="m"):(b.buffer[c+5]="p",b.buffer[c+6]="m"),g-=12,10>g?(b.buffer[c]=g.toString(),b.buffer[c-1]="0"):(b.buffer[c]=g.toString().charAt(1),b.buffer[c-1]=g.toString().charAt(0)),{refreshFromBuffer:{start:c-1,end:c+6},c:b.buffer[c]}}return f}
278,cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.hrspre.test(a);return d||f||!(f=e.regex.hrs.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.mspre.test(a);return d||f||!(f=e.regex.ms.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},t:{validator:function(a,b,c,d,e){return e.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"mm/dd/yyyy hh:mm xm":{mask:"1/2/y h:s t\\m",placeholder:"mm/dd/yyyy hh:mm xm",alias:"datetime12",regex:{val2pre:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[13-9]|1[012])"+c+"[0-3])|(02"+c+"[0-2])")},val2:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+c+"30)|((0[13578]|1[02])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyDown:function(c,d,e,f){var g=a(this);if(c.ctrlKey&&c.keyCode===b.keyCode.RIGHT){var h=new Date;g.val((h.getMonth()+1).toString()+h.getDate().toString()+h.getFullYear().toString()),g.trigger("setvalue")}}},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"},shamsi:{regex:{val2pre:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[1-9]|1[012])"+c+"[0-3])")},val2:function(a){var c=b.escapeRegex.call(this,a);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[1-9]|1[012])"+c+"30)|((0[1-6])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},yearrange:{minyear:1300,maxyear:1499},mask:"y/1/2",leapday:"/12/30",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",clearIncomplete:!0}}),b}(jQuery,Inputmask),function(a,b){return b.extendDefinitions({A:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"},"&":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Fa-f]",cardinality:1,casing:"upper"}}),b.extendAliases({url:{definitions:{i:{validator:".",cardinality:1}},mask:"(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(a,b,c,d,e){return c-1>-1&&"."!==b.buffer[c-1]?(a=b.buffer[c-1]+a,a=c-2>
278-1&&"."!==b.buffer[c-2]?b.buffer[c-2]+a:"0"+a):a="00"+a,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(a)},cardinality:1}},onUnMask:function(a,b,c){return a}},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",greedy:!1,onBeforePaste:function(a,b){return a=a.toLowerCase(),a.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"},"-":{validator:"[0-9A-Za-z-]",cardinality:1,casing:"lower"}},onUnMask:function(a,b,c){return a}},mac:{mask:"##:##:##:##:##:##"},vin:{mask:"V{13}9{4}",definitions:{V:{validator:"[A-HJ-NPR-Za-hj-npr-z\\d]",cardinality:1,casing:"upper"}},clearIncomplete:!0,autoUnmask:!0}}),b}(jQuery,Inputmask),function(a,b){return b.extendAliases({numeric:{mask:function(a){function c(b){for(var c="",d=0;d<b.length;d++)c+=a.definitions[b.charAt(d)]||a.optionalmarker.start===b.charAt(d)||a.optionalmarker.end===b.charAt(d)||a.quantifiermarker.start===b.charAt(d)||a.quantifiermarker.end===b.charAt(d)||a.groupmarker.start===b.charAt(d)||a.groupmarker.end===b.charAt(d)||a.alternatormarker===b.charAt(d)?"\\"+b.charAt(d):b.charAt(d);return c}if(0!==a.repeat&&isNaN(a.integerDigits)&&(a.integerDigits=a.repeat),a.repeat=0,a.groupSeparator===a.radixPoint&&("."===a.radixPoint?a.groupSeparator=",":","===a.radixPoint?a.groupSeparator=".":a.groupSeparator="")," "===a.groupSeparator&&(a.skipOptionalPartCharacter=void 0),a.autoGroup=a.autoGroup&&""!==a.groupSeparator,a.autoGroup&&("string"==typeof a.groupSize&&isFinite(a.groupSize)&&(a.groupSize=parseInt(a.groupSize)),isFinite(a.integerDigits))){var d=Math.floor(a.integerDigits/a.groupSize),e=a.integerDigits%a.groupSize;a.integerDigits=parseInt(a.integerDigits)+(0===e?d-1:d),a.integerDigits<1&&(a.integerDigits="*")}a.placeholder.length>1&&(a.placeholder=a.placeholder.charAt(0)),a.radixFocus=a.radixFocus&&""!==a.placeholder&&a.integerOptional===!0,a.definitions[";"]=a.definitions["~"],a.definitions[";"].definitionSymbol="~",a.numericInput===!0&&(a.radixFocus=!1,a.digitsOptional=!1,isNaN(a.digits)&&(a.digits=2),a.decimalProtect=!1);var f=c(a.prefix);return f+="[+]",f+=a.integerOptional===!0?"~{1,"+a.integerDigits+"}":"~{"+a.integerDigits+"}",void 0!==a.digits&&(isNaN(a.digits)||parseInt(a.digits)>0)&&(a.decimalProtect&&(a.radixPointDefinitionSymbol=":"),f+=a.digitsOptional?"["+(a.decimalProtect?":":a.radixPoint)+";{1,"+a.digits+"}]":(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}"),f+="[-]",f+=c(a.suffix),a.greedy=!1,null!==a.min&&(a.min=a.min.toString().replace(new RegExp(b.escapeRegex(a.groupSeparator),"g"),""),","===a.radixPoint&&(a.min=a.min.replace(a.radixPoint,"."))),null!==a.max&&(a.max=a.max.toString().replace(new RegExp(b.escapeRegex(a.groupSeparator),"g"),""),","===a.radixPoint&&(a.max=a.max.replace(a.radixPoint,"."))),f},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,radixPoint:".",radixFocus:!0,groupSize:3,groupSeparator:"",autoGroup:!1,allowPlus:!0,allowMinus:!0,negationSymbol:{front:"-",back:""},integerDigits:"+",integerOptional:!0,prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,min:null,max:null,step:1,insertMode:!0,autoUnmask:!1,unmaskAsNumber:!1,postFormat:function(c,d,e){e.numericInput===!0&&(c=c.reverse(),isFinite(d)&&(d=c.join("").length-d-1));var f,g,h=!1;c.length>=e.suffix.length&&c.join("").indexOf(e.suffix)===c.length-e.suffix.length&&(c.length=c.length-e.suffix.length,h=!0),d=d>=c.length?c.length-1:d<e.prefix.length?e.prefix.length:d;var i=!1,j=c[d],k=c.slice();j===e.groupSeparator&&(k.splice(d--,1),j=k[d]),j!==e.radixPoint&&j!==e.negationSymbol.front&&j!==e.negationSymbol.back&&(k[d]="?");var l=k.join(""),m=l;if(l.length>0&&e.autoGroup||-1!==l.indexOf(e.groupSeparator)){var n=b.escapeRegex(e.groupSeparator);i=0===l.indexOf(e.groupSeparator),l=l.replace(new RegExp(n,"g"),"");var o=l.split(e.radixPoint);if(l=""===e.radixPoint?l:o[0],l!==e.prefix+"?0"&&l.length>=e.groupSize+e.prefix.length)for(var p=new RegExp("([-+]?[\\d?]+)([\\d?]{"+e.groupSize+"})");p.test(l)&&""!==e.groupSeparator;)l=l.replace(p,"$1"+e.groupSeparator+"$2"),l=l.replace(e.groupSeparator+e.groupSeparator,e.groupSeparator);""!==e.radixPoint&&o.length>1&&(l+=e.radixPoint+o[1])}for(i=m!==l,c.length=l.length,f=0,g=l.length;g>f;f++)c[f]=l.charAt(f);var q=a.inArray("?",c);if(-1===q&&(q=a.inArray(j,c)),c[q]=j,!i&&h)for(f=0,g=e.suffix.length;g>f;f++)c.push(e.suffix.charAt(f));return q=e.numericInput&&isFinite(d)?c.join("").length-q-1:q,e.numericInput&&(c=c.reverse(),a.inArray(e.radixPoint,c)<q&&c.join("").length-e.suffix.length!==q&&(q-=1)),{pos:q,refreshFromBuffer:i,buffer:c}},onBeforeWrite:function(c,d,e,f){var g;
278if(c&&("blur"===c.type||"checkval"===c.type||"keydown"===c.type)){var h=f.numericInput?d.slice().reverse().join(""):d.join(""),i=h.replace(f.prefix,"");i=i.replace(f.suffix,""),i=i.replace(new RegExp(b.escapeRegex(f.groupSeparator),"g"),""),","===f.radixPoint&&(i=i.replace(f.radixPoint,"."));var j=i.match(new RegExp("[-"+b.escapeRegex(f.negationSymbol.front)+"]","g"));if(j=null!==j&&1===j.length,i=i.replace(new RegExp("[-"+b.escapeRegex(f.negationSymbol.front)+"]","g"),""),i=i.replace(new RegExp(b.escapeRegex(f.negationSymbol.back)+"$"),""),isNaN(f.placeholder)&&(i=i.replace(new RegExp(b.escapeRegex(f.placeholder),"g"),"")),i=i===f.negationSymbol.front?i+"0":i,""!==i&&isFinite(i)){var k=parseFloat(i),l=j?-1*k:k;if(null!==f.min&&isFinite(f.min)&&l<parseFloat(f.min)?(k=Math.abs(f.min),j=f.min<0,h=void 0):null!==f.max&&isFinite(f.max)&&l>parseFloat(f.max)&&(k=Math.abs(f.max),j=f.max<0,h=void 0),i=k.toString().replace(".",f.radixPoint).split(""),isFinite(f.digits)){var m=a.inArray(f.radixPoint,i),n=a.inArray(f.radixPoint,h);-1===m&&(i.push(f.radixPoint),m=i.length-1);for(var o=1;o<=f.digits;o++)f.digitsOptional||void 0!==i[m+o]&&i[m+o]!==f.placeholder.charAt(0)?-1!==n&&void 0!==h[n+o]&&(i[m+o]=i[m+o]||h[n+o]):i[m+o]="0";i[i.length-1]===f.radixPoint&&delete i[i.length-1]}if(k.toString()!==i&&k.toString()+"."!==i||j)return!j||0===k&&"blur"===c.type||(i.unshift(f.negationSymbol.front),i.push(f.negationSymbol.back)),i=(f.prefix+i.join("")).split(""),f.numericInput&&(i=i.reverse()),g=f.postFormat(i,f.numericInput?e:e-1,f),g.buffer&&(g.refreshFromBuffer=g.buffer.join("")!==d.join("")),g}}return f.autoGroup?(g=f.postFormat(d,f.numericInput?e:e-1,f),g.caret=e<=f.prefix.length?g.pos:g.pos+1,g):void 0},regex:{integerPart:function(a){return new RegExp("["+b.escapeRegex(a.negationSymbol.front)+"+]?\\d+")},integerNPart:function(a){return new RegExp("[\\d"+b.escapeRegex(a.groupSeparator)+b.escapeRegex(a.placeholder.charAt(0))+"]+")}},signHandler:function(a,b,c,d,e){if(!d&&e.allowMinus&&"-"===a||e.allowPlus&&"+"===a){var f=b.buffer.join("").match(e.regex.integerPart(e));if(f&&f[0].length>0)return b.buffer[f.index]===("-"===a?"+":e.negationSymbol.front)?"-"===a?""!==e.negationSymbol.back?{pos:f.index,c:e.negationSymbol.front,remove:f.index,caret:c,insert:{pos:b.buffer.length-e.suffix.length-1,c:e.negationSymbol.back}}:{pos:f.index,c:e.negationSymbol.front,remove:f.index,caret:c}:""!==e.negationSymbol.back?{pos:f.index,c:"+",remove:[f.index,b.buffer.length-e.suffix.length-1],caret:c}:{pos:f.index,c:"+",remove:f.index,caret:c}:b.buffer[f.index]===("-"===a?e.negationSymbol.front:"+")?"-"===a&&""!==e.negationSymbol.back?{remove:[f.index,b.buffer.length-e.suffix.length-1],caret:c-1}:{remove:f.index,caret:c-1}:"-"===a?""!==e.negationSymbol.back?{pos:f.index,c:e.negationSymbol.front,caret:c+1,insert:{pos:b.buffer.length-e.suffix.length,c:e.negationSymbol.back}}:{pos:f.index,c:e.negationSymbol.front,caret:c+1}:{pos:f.index,c:a,caret:c+1}}return!1},radixHandler:function(b,c,d,e,f){if(!e&&f.numericInput!==!0&&b===f.radixPoint&&void 0!==f.digits&&(isNaN(f.digits)||parseInt(f.digits)>0)){var g=a.inArray(f.radixPoint,c.buffer),h=c.buffer.join("").match(f.regex.integerPart(f));if(-1!==g&&c.validPositions[g])return c.validPositions[g-1]?{caret:g+1}:{pos:h.index,c:h[0],caret:g+1};if(!h||"0"===h[0]&&h.index+1!==d)return c.buffer[h?h.index:d]="0",{pos:(h?h.index:d)+1,c:f.radixPoint}}return!1},leadingZeroHandler:function(b,c,d,e,f,g){if(!e)if(f.numericInput===!0){var h=c.buffer.slice("").reverse(),i=h[f.prefix.length];if("0"===i&&void 0===c.validPositions[d-1])return{pos:d,remove:h.length-f.prefix.length-1}}else{var j=a.inArray(f.radixPoint,c.buffer),k=c.buffer.slice(0,-1!==j?j:void 0).join("").match(f.regex.integerNPart(f));if(k&&(-1===j||j>=d)){var l=-1===j?0:parseInt(c.buffer.slice(j+1).join(""));if(0===k[0].indexOf(""!==f.placeholder?f.placeholder.charAt(0):"0")&&(k.index+1===d||g!==!0&&0===l))return c.buffer.splice(k.index,1),{pos:k.index,remove:k.index};if("0"===b&&d<=k.index&&k[0]!==f.groupSeparator)return!1}}return!0},definitions:{"~":{validator:function(c,d,e,f,g,h){var i=g.signHandler(c,d,e,f,g);if(!i&&(i=g.radixHandler(c,d,e,f,g),!i&&(i=f?new RegExp("[0-9"+b.escapeRegex(g.groupSeparator)+"]").test(c):new RegExp("[0-9]").test(c),i===!0&&(i=g.leadingZeroHandler(c,d,e,f,g,h),i===!0)))){var j=a.inArray(g.radixPoint,d.buffer);i=-1!==j&&(g.digitsOptional===!1||d.validPositions[e])&&g.numericInput!==!0&&e>j&&!f?{pos:e,remove:e}:{pos:e}}return i},cardinality:1},"+":{validator:function(a,b,c,d,e){var f=e.signHandler(a,b,c,d,e);return!f&&(d&&e.allowMinus&&a===e.negationSymbol.front||e.allowMinus&&"-"===a||e.allowPlus&&"+"===a)&&(f=d||"-"!==a?!0:""!==e.negationSymbol.back?{pos:c,c:"-"===a?e.negationSymbol.front:"+",caret:c+1,insert:{pos:b.buffer.length,c:e.negationSymbol.back}}:{pos:c,c:"-"===a?e.negationSymbol.front:"+", 279caret:c+1}),f},cardinality:1,placeholder:""},"-":{validator:function(a,b,c,d,e){var f=e.signHandler(a,b,c,d,e);return!f&&d&&e.allowMinus&&a===e.negationSymbol.back&&(f=!0),f},cardinality:1,placeholder:""},":":{validator:function(a,c,d,e,f){var g=f.signHandler(a,c,d,e,f);if(!g){var h="["+b.escapeRegex(f.radixPoint)+"]";g=new RegExp(h).test(a),g&&c.validPositions[d]&&c.validPositions[d].match.placeholder===f.radixPoint&&(g={caret:d+1})}return g?{c:f.radixPoint}:g},cardinality:1,placeholder:function(a){return a.radixPoint}}},onUnMask:function(a,c,d){var e=a.replace(d.prefix,"");return e=e.replace(d.suffix,""),e=e.replace(new RegExp(b.escapeRegex(d.groupSeparator),"g"),""),d.unmaskAsNumber?(""!==d.radixPoint&&-1!==e.indexOf(d.radixPoint)&&(e=e.replace(b.escapeRegex.call(this,d.radixPoint),".")),Number(e)):e},isComplete:function(a,c){var d=a.join(""),e=a.slice();if(c.postFormat(e,0,c),e.join("")!==d)return!1;var f=d.replace(c.prefix,"");return f=f.replace(c.suffix,""),f=f.replace(new RegExp(b.escapeRegex(c.groupSeparator),"g"),""),","===c.radixPoint&&(f=f.replace(b.escapeRegex(c.radixPoint),".")),isFinite(f)},onBeforeMask:function(a,c){if(""!==c.radixPoint&&isFinite(a))a=a.toString().replace(".",c.radixPoint);else{var d=a.match(/,/g),e=a.match(/\./g);e&&d?e.length>d.length?(a=a.replace(/\./g,""),a=a.replace(",",c.radixPoint)):d.length>e.length?(a=a.replace(/,/g,""),a=a.replace(".",c.radixPoint)):a=a.indexOf(".")<a.indexOf(",")?a.replace(/\./g,""):a=a.replace(/,/g,""):a=a.replace(new RegExp(b.escapeRegex(c.groupSeparator),"g"),"")}if(0===c.digits&&(-1!==a.indexOf(".")?a=a.substring(0,a.indexOf(".")):-1!==a.indexOf(",")&&(a=a.substring(0,a.indexOf(",")))),""!==c.radixPoint&&isFinite(c.digits)&&-1!==a.indexOf(c.radixPoint)){var f=a.split(c.radixPoint),g=f[1].match(new RegExp("\\d*"))[0];if(parseInt(c.digits)<g.toString().length){var h=Math.pow(10,parseInt(c.digits));a=a.replace(b.escapeRegex(c.radixPoint),"."),a=Math.round(parseFloat(a)*h)/h,a=a.toString().replace(".",c.radixPoint)}}return a.toString()},canClearPosition:function(a,b,c,d,e){var f=a.validPositions[b].input,g=f!==e.radixPoint||null!==a.validPositions[b].match.fn&&e.decimalProtect===!1||isFinite(f)||b===c||f===e.groupSeparator||f===e.negationSymbol.front||f===e.negationSymbol.back;return g},onKeyDown:function(c,d,e,f){var g=a(this);if(c.ctrlKey)switch(c.keyCode){case b.keyCode.UP:g.val(parseFloat(this.inputmask.unmaskedvalue())+parseInt(f.step)),g.trigger("setvalue");break;case b.keyCode.DOWN:g.val(parseFloat(this.inputmask.unmaskedvalue())-parseInt(f.step)),g.trigger("setvalue")}}},currency:{prefix:"$ ",groupSeparator:",",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1}
279,decimal:{alias:"numeric"},integer:{alias:"numeric",digits:0,radixPoint:""},percentage:{alias:"numeric",digits:2,radixPoint:".",placeholder:"0",autoGroup:!1,min:0,max:100,suffix:" %",allowPlus:!1,allowMinus:!1}}),b}(jQuery,Inputmask),function(a,b){return b.extendAliases({phone:{url:"phone-codes/phone-codes.js",countrycode:"",phoneCodeCache:{},mask:function(b){if(void 0===b.phoneCodeCache[b.url]){var c=[];b.definitions["#"]=b.definitions[9],a.ajax({url:b.url,async:!1,type:"get",dataType:"json",success:function(a){c=a},error:function(a,c,d){alert(d+" - "+b.url)}}),b.phoneCodeCache[b.url]=c.sort(function(a,b){return(a.mask||a)<(b.mask||b)?-1:1})}return b.phoneCodeCache[b.url]},keepStatic:!1,nojumps:!0,nojumpsThreshold:1,onBeforeMask:function(a,b){var c=a.replace(/^0{1,2}/,"").replace(/[\s]/g,"");return(c.indexOf(b.countrycode)>1||-1===c.indexOf(b.countrycode))&&(c="+"+b.countrycode+c),c}},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",countrycode:"32",nojumpsThreshold:4}}),b}(jQuery,Inputmask),function(a,b){return b.extendAliases({Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(a,b){return new RegExp(b.regex).test(a.join(""))},definitions:{r:{validator:function(b,c,d,e,f){function g(a,b){this.matches=[],this.isGroup=a||!1,this.isQuantifier=b||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function h(){var a,b,c=new g,d=[];for(f.regexTokens=[];a=f.tokenizer.exec(f.regex);)switch(b=a[0],b.charAt(0)){case"(":d.push(new g(!0));break;case")":k=d.pop(),d.length>0?d[d.length-1].matches.push(k):c.matches.push(k);break;case"{":case"+":case"*":var e=new g(!1,!0);b=b.replace(/[{}]/g,"");var h=b.split(","),i=isNaN(h[0])?h[0]:parseInt(h[0]),j=1===h.length?i:isNaN(h[1])?h[1]:parseInt(h[1]);if(e.quantifier={min:i,max:j},d.length>0){var l=d[d.length-1].matches;a=l.pop(),a.isGroup||(k=new g(!0),k.matches.push(a),a=k),l.push(a),l.push(e)}else a=c.matches.pop(),a.isGroup||(k=new g(!0),k.matches.push(a),a=k),c.matches.push(a),c.matches.push(e);break;default:d.length>0?d[d.length-1].matches.push(b):c.matches.push(b)}c.matches.length>0&&f.regexTokens.push(c)}function i(b,c){var d=!1;c&&(m+="(",o++);for(var e=0;e<b.matches.length;e++){var f=b.matches[e];if(f.isGroup===!0)d=i(f,!0);else if(f.isQuantifier===!0){var g=a.inArray(f,b.matches),h=b.matches[g-1],k=m;if(isNaN(f.quantifier.max)){for(;f.repeaterPart&&f.repeaterPart!==m&&f.repeaterPart.length>m.length&&!(d=i(h,!0)););d=d||i(h,!0),d&&(f.repeaterPart=m),m=k+f.quantifier.max}else{for(var l=0,n=f.quantifier.max-1;n>l&&!(d=i(h,!0));l++);m=k+"{"+f.quantifier.min+","+f.quantifier.max+"}"}}else if(void 0!==f.matches)for(var p=0;p<f.length&&!(d=i(f[p],c));p++);else{var q;if("["==f.charAt(0)){q=m,q+=f;for(var r=0;o>r;r++)q+=")";var s=new RegExp("^("+q+")$");d=s.test(j)}else for(var t=0,u=f.length;u>t;t++)if("\\"!==f.charAt(t)){q=m,q+=f.substr(0,t+1),q=q.replace(/\|$/,"");for(var r=0;o>r;r++)q+=")";var s=new RegExp("^("+q+")$");if(d=s.test(j))break}m+=f}if(d)break}return c&&(m+=")",o--),d}var j,k,l=c.buffer.slice(),m="",n=!1,o=0;null===f.regexTokens&&h(),l.splice(d,0,b),j=l.join("");for(var p=0;p<f.regexTokens.length;p++){var q=f.regexTokens[p];if(n=i(q,q.isGroup))break}return n},cardinality:1}}}}),b}(jQuery,Inputmask); 280/* End */ 281; 282; /* Start:"a:4:{s:4:"full";s:83:"/local/templates/elektro_flat/js/anythingslider/jquery.easing.1.2.js?15330357784757";s:6:"source";s:68:"/local/templates/elektro_flat/js/anythingslider/jquery.easing.1.2.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 283/* 284 * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php 285 * 286 * Uses the built In easIng capabilities added In jQuery 1.1 287 * to offer multiple easIng options 288 * 289 * Copyright (c) 2007 George Smith 290 * Licensed under the MIT License: 291 * http://www.opensource.org/licenses/mit-license.php 292 */ 293 294// t: current time, b: begInnIng value, c: change In value, d: duration 295 296jQuery.extend( jQuery.easing, 297{ 298 easeInQuad: function (x, t, b, c, d) { 299 return c*(t/=d)*t + b; 300 }, 301 easeOutQuad: function (x, t, b, c, d) { 302 return -c *(t/=d)*(t-2) + b; 303 }, 304 easeInOutQuad: function (x, t, b, c, d) { 305 if ((t/=d/2) < 1) return c/2*t*t + b; 306 return -c/2 * ((--t)*(t-2) - 1) + b; 307 }, 308 easeInCubic: function (x, t, b, c, d) {
vendor: 4,376 bytes, lines 309-427
309 return c*(t/=d)*t*t + b; 310 }, 311 easeOutCubic: function (x, t, b, c, d) { 312 return c*((t=t/d-1)*t*t + 1) + b; 313 }, 314 easeInOutCubic: function (x, t, b, c, d) { 315 if ((t/=d/2) < 1) return c/2*t*t*t + b; 316 return c/2*((t-=2)*t*t + 2) + b; 317 }, 318 easeInQuart: function (x, t, b, c, d) { 319 return c*(t/=d)*t*t*t + b; 320 }, 321 easeOutQuart: function (x, t, b, c, d) { 322 return -c * ((t=t/d-1)*t*t*t - 1) + b; 323 }, 324 easeInOutQuart: function (x, t, b, c, d) { 325 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 326 return -c/2 * ((t-=2)*t*t*t - 2) + b; 327 }, 328 easeInQuint: function (x, t, b, c, d) { 329 return c*(t/=d)*t*t*t*t + b; 330 }, 331 easeOutQuint: function (x, t, b, c, d) { 332 return c*((t=t/d-1)*t*t*t*t + 1) + b; 333 }, 334 easeInOutQuint: function (x, t, b, c, d) { 335 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 336 return c/2*((t-=2)*t*t*t*t + 2) + b; 337 }, 338 easeInSine: function (x, t, b, c, d) { 339 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 340 }, 341 easeOutSine: function (x, t, b, c, d) { 342 return c * Math.sin(t/d * (Math.PI/2)) + b; 343 }, 344 easeInOutSine: function (x, t, b, c, d) { 345 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 346 }, 347 easeInExpo: function (x, t, b, c, d) { 348 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 349 }, 350 easeOutExpo: function (x, t, b, c, d) { 351 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 352 }, 353 easeInOutExpo: function (x, t, b, c, d) { 354 if (t==0) return b; 355 if (t==d) return b+c; 356 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 357 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 358 }, 359 easeInCirc: function (x, t, b, c, d) { 360 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 361 }, 362 easeOutCirc: function (x, t, b, c, d) { 363 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 364 }, 365 easeInOutCirc: function (x, t, b, c, d) { 366 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 367 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 368 }, 369 easeInElastic: function (x, t, b, c, d) { 370 var s=1.70158;var p=0;var a=c; 371 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 372 if (a < Math.abs(c)) { a=c; var s=p/4; } 373 else var s = p/(2*Math.PI) * Math.asin (c/a); 374 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 375 }, 376 easeOutElastic: function (x, t, b, c, d) { 377 var s=1.70158;var p=0;var a=c; 378 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 379 if (a < Math.abs(c)) { a=c; var s=p/4; } 380 else var s = p/(2*Math.PI) * Math.asin (c/a); 381 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 382 }, 383 easeInOutElastic: function (x, t, b, c, d) { 384 var s=1.70158;var p=0;var a=c; 385 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 386 if (a < Math.abs(c)) { a=c; var s=p/4; } 387 else var s = p/(2*Math.PI) * Math.asin (c/a); 388 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 389 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 390 }, 391 easeInBack: function (x, t, b, c, d, s) { 392 if (s == undefined) s = 1.70158; 393 return c*(t/=d)*t*((s+1)*t - s) + b; 394 }, 395 easeOutBack: function (x, t, b, c, d, s) { 396 if (s == undefined) s = 1.70158; 397 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 398 }, 399 easeInOutBack: function (x, t, b, c, d, s) { 400 if (s == undefined) s = 1.70158; 401 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 402 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 403 }, 404 easeInBounce: function (x, t, b, c, d) { 405 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 406 }, 407 easeOutBounce: function (x, t, b, c, d) { 408 if ((t/=d) < (1/2.75)) { 409 return c*(7.5625*t*t) + b; 410 } else if (t < (2/2.75)) { 411 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 412 } else if (t < (2.5/2.75)) { 413 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 414 } else { 415 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 416 } 417 }, 418 easeInOutBounce: function (x, t, b, c, d) { 419 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 420 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 421 } 422}); 423/* End */ 424; 425; /* Start:"a:4:{s:4:"full";s:92:"/local/templates/elektro_flat/js/anythingslider/jquery.anythingslider.min.js?153303577818707";s:6:"source";s:76:"/local/templates/elektro_flat/js/anythingslider/jquery.anythingslider.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 426/*! 427 AnythingSlider v1.9.6 minified using Google Closure Compiler
428 Original by Chris Coyier: http://css-tricks.com 429 Get the latest version: https://github.com/CSS-Tricks/AnythingSlider 430*/ 431;(function(d,l,n){d.anythingSlider=function(m,p){var a=this,b,k;a.el=m;a.$el=d(m).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=b=d.extend({},d.anythingSlider.defaults,p);a.initialized=!1;d.isFunction(b.onBeforeInitialize)&&a.$el.bind("before_initialize",b.onBeforeInitialize);a.$el.trigger("before_initialize",a);d('\x3c!--[if lte IE 8]><script>jQuery("body").addClass("as-oldie");\x3c/script><![endif]--\x3e').appendTo("body").remove(); 432a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+b.theme);a.$outer=a.$wrapper.parent();a.$window=a.$el.closest("div.anythingWindow");a.$win=d(l);a.$controls=d('<div class="anythingControls"></div>');a.$nav=d('<ul class="thumbNav"><li><a><span></span></a></li></ul>');a.$startStop=d('<a href="#" class="start-stop"></a>');(b.buildStartStop||b.buildNavigation)&&a.$controls.appendTo(b.appendControlsTo&&d(b.appendControlsTo).length?d(b.appendControlsTo):a.$wrapper);b.buildNavigation&& 433a.$nav.appendTo(b.appendNavigationTo&&d(b.appendNavigationTo).length?d(b.appendNavigationTo):a.$controls);b.buildStartStop&&a.$startStop.appendTo(b.appendStartStopTo&&d(b.appendStartStopTo).length?d(b.appendStartStopTo):a.$controls);a.runTimes=d(".anythingBase").length;a.regex=b.hashTags?new RegExp("panel"+a.runTimes+"-(\\d+)","i"):null;1===a.runTimes&&a.makeActive();a.flag=!1;b.autoPlayLocked&&(b.autoPlay=!0);a.playing=b.autoPlay;a.slideshow=!1;a.hovered=!1;a.panelSize=[];a.currentPage=a.targetPage= 434b.startPanel=parseInt(b.startPanel,10)||1;b.changeBy=parseInt(b.changeBy,10)||1;k=(b.mode||"h").toLowerCase().match(/(h|v|f)/);k=b.vertical?"v":(k||["h"])[0];b.mode="v"===k?"vertical":"f"===k?"fade":"horizontal";"f"===k&&(b.showMultiple=1,b.infiniteSlides=!1);a.adj=b.infiniteSlides?0:1;a.adjustMultiple=0;b.playRtl&&a.$wrapper.addClass("rtl");b.buildStartStop&&a.buildAutoPlay();b.buildArrows&&a.buildNextBackButtons();a.$lastPage=a.$targetPage=a.$currentPage;if(b.expand){if(!0===b.aspectRatio)b.aspectRatio= 435a.$el.width()/a.$el.height();else if("string"===typeof b.aspectRatio&&-1!==b.aspectRatio.indexOf(":")){var c=b.aspectRatio.split(":");b.aspectRatio=c[0]/c[1]}0<b.aspectRatio&&1<b.showMultiple&&(b.aspectRatio*=b.showMultiple)}a.updateSlider();b.expand&&(a.$window.css({width:"100%",height:"100%"}),a.checkResize());d.isFunction(d.easing[b.easing])||(b.easing="swing");b.pauseOnHover&&a.$wrapper.hover(function(){a.playing&&(a.$el.trigger("slideshow_paused",a),a.clearTimer(!0))},function(){a.playing&&(a.$el.trigger("slideshow_unpaused", 436a),a.startStop(a.playing,!0))});a.slideControls(!1);a.$wrapper.bind("mouseenter mouseleave",function(b){d(this)["mouseenter"===b.type?"addClass":"removeClass"]("anythingSlider-hovered");a.hovered="mouseenter"===b.type?!0:!1;a.slideControls(a.hovered)});d(n).keyup(function(c){if(b.enableKeyboard&&a.$wrapper.hasClass("activeSlider")&&!c.target.tagName.match("TEXTAREA|INPUT|SELECT")&&("vertical"===b.mode||38!==c.which&&40!==c.which))switch(c.which){case 39:case 40:a.goForward();break;case 37:case 38:a.goBack()}}); 437a.currentPage=(b.hashTags?a.gotoHash():"")||b.startPanel||1;a.gotoPage(a.currentPage,!1,null,-1);var f="slideshow_resized slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");d.each("onSliderResize onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "),function(c,h){d.isFunction(b[h])&&a.$el.bind(f[c],b[h])});d.isFunction(b.onSlideComplete)&&a.$el.bind("slide_complete", 438function(){setTimeout(function(){b.onSlideComplete(a)},0);return!1});a.initialized=!0;a.$el.trigger("initialized",a);a.startStop(b.autoPlay)};a.updateSlider=function(){a.$el.children(".cloned").remove();a.navTextVisible="hidden"!==a.$nav.find("span:first").css("visibility");a.$nav.empty();a.currentPage=a.currentPage||1;a.$items=a.$el.children();a.pages=a.$items.length;a.dir="vertical"===b.mode?"top":"left";b.showMultiple=parseInt(b.showMultiple,10)||1;b.navigationSize=!1===b.navigationSize?0:parseInt(b.navigationSize, 43910)||0;a.$items.find("a").unbind("focus.AnythingSlider").bind("focus.AnythingSlider",function(c){var f=d(this).closest(".panel"),f=a.$items.index(f)+a.adj;a.$items.find(".focusedLink").removeClass("focusedLink");d(this).addClass("focusedLink");a.$window.scrollLeft(0).scrollTop(0);-1!==f&&(f>=a.currentPage+b.showMultiple||f<a.currentPage)&&(a.gotoPage(f),c.preventDefault())});
4391<b.showMultiple&&(b.showMultiple>a.pages&&(b.showMultiple=a.pages),a.adjustMultiple=b.infiniteSlides&&1<a.pages?0:b.showMultiple- 4401);a.$controls.add(a.$nav).add(a.$startStop).add(a.$forward).add(a.$back)[1>=a.pages?"hide":"show"]();1<a.pages&&a.buildNavigation();"fade"!==b.mode&&b.infiniteSlides&&1<a.pages&&(a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned")),1<b.showMultiple?a.$el.append(a.$items.filter(":lt("+b.showMultiple+")").clone().addClass("cloned multiple")):a.$el.append(a.$items.filter(":first").clone().addClass("cloned")),a.$el.find(".cloned").each(function(){d(this).find("a,input,textarea,select,button,area,form").attr({disabled:"disabled", 441name:""});d(this).find("[id]")[d.fn.addBack?"addBack":"andSelf"]().removeAttr("id")}));a.$items=a.$el.addClass(b.mode).children().addClass("panel");a.setDimensions();b.resizeContents?(a.$items.css("width",a.width),a.$wrapper.css("width",a.getDim(a.currentPage)[0]).add(a.$items).css("height",a.height)):a.$win.load(function(){a.setDimensions();k=a.getDim(a.currentPage);a.$wrapper.css({width:k[0],height:k[1]});a.setCurrentPage(a.currentPage,!1)});a.currentPage>a.pages&&(a.currentPage=a.pages);a.setCurrentPage(a.currentPage, 442!1);a.$nav.find("a").eq(a.currentPage-1).addClass("cur");"fade"===b.mode&&(k=a.$items.eq(a.currentPage-1),b.resumeOnVisible?k.css({opacity:1,visibility:"visible"}).siblings().css({opacity:0,visibility:"hidden"}):(a.$items.css("opacity",1),k.fadeIn(0).siblings().fadeOut(0)))};a.buildNavigation=function(){if(b.buildNavigation&&1<a.pages){var c,f,e,h,g;a.$items.filter(":not(.cloned)").each(function(q){g=d("<li/>");e=q+1;f=(1===e?" first":"")+(e===a.pages?" last":"");c='<a class="panel'+e+(a.navTextVisible? 443'"':" "+b.tooltipClass+'" title="@"')+' href="#"><span>@</span></a>';d.isFunction(b.navigationFormatter)?(h=b.navigationFormatter(e,d(this)),"string"===typeof h?g.html(c.replace(/@/g,h)):g=d("<li/>",h)):g.html(c.replace(/@/g,e));g.appendTo(a.$nav).addClass(f).data("index",e)});a.$nav.children("li").bind(b.clickControls,function(c){!a.flag&&b.enableNavigation&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.gotoPage(d(this).data("index")));c.preventDefault()});b.navigationSize&&b.navigationSize< 444a.pages&&(a.$controls.find(".anythingNavWindow").length||a.$nav.before('<ul><li class="prev"><a href="#"><span>'+b.backText+"</span></a></li></ul>").after('<ul><li class="next"><a href="#"><span>'+b.forwardText+"</span></a></li></ul>").wrap('<div class="anythingNavWindow"></div>'),a.navWidths=a.$nav.find("li").map(function(){return d(this).outerWidth(!0)+Math.ceil(parseInt(d(this).find("span").css("left"),10)/2||0)}).get(),a.navLeft=1,a.$nav.width(a.navWidth(1,a.pages+1)+25),a.$controls.find(".anythingNavWindow").width(a.navWidth(1, 445b.navigationSize+1)).end().find(".prev,.next").bind(b.clickControls,function(c){a.flag||(a.flag=!0,setTimeout(function(){a.flag=!1},200),a.navWindow(a.navLeft+b.navigationSize*(d(this).is(".prev")?-1:1)));c.preventDefault()}))}};a.navWidth=function(b,f){var e,d=Math.max(b,f),g=0;for(e=Math.min(b,f);e<d;e++)g+=a.navWidths[e-1]||0;return g};a.navWindow=function(c){if(b.navigationSize&&b.navigationSize<a.pages&&a.navWidths){var f=a.pages-b.navigationSize+1;c=1>=c?1:1<c&&c<f?c:f;c!==a.navLeft&&(a.$controls.find(".anythingNavWindow").animate({scrollLeft:a.navWidth(1, 446c),width:a.navWidth(c,c+b.navigationSize)},{queue:!1,duration:b.animationTime}),a.navLeft=c)}};a.buildNextBackButtons=function(){a.$forward=d('<span class="arrow forward"><a href="#"><span>'+b.forwardText+"</span></a></span>");a.$back=d('<span class="arrow back"><a href="#"><span>'+b.backText+"</span></a></span>");a.$back.bind(b.clickBackArrow,function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goBack());c.preventDefault()});a.$forward.bind(b.clickForwardArrow, 447function(c){b.enableArrows&&!a.flag&&(a.flag=!0,setTimeout(function(){a.flag=!1},100),a.goForward());c.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){d(this).toggleClass("hover")});a.$back.appendTo(b.appendBackTo&&d(b.appendBackTo).length?d(b.appendBackTo):a.$wrapper);a.$forward.appendTo(b.appendForwardTo&&d(b.appendForwardTo).length?d(b.appendForwardTo):a.$wrapper);a.arrowWidth=a.$forward.width();a.arrowRight=parseInt(a.$forward.css("right"),10);a.arrowLeft= 448parseInt(a.$back.css("left"),10)};a.buildAutoPlay=function(){a.$startStop.html("<span>"+(a.playing?b.stopText:b.startText)+"</span>").bind(b.clickSlideshow,function(c){b.enableStartStop&&(a.startStop(!a.playing),a.makeActive(),a.playing&&!b.autoPlayDelayed&&a.goForward(!0,b.playRtl));c.preventDefault()}).bind("focusin focusout",function(){d(this).toggleClass("hover")})};a.checkResize=function(b){var f=!!(n.hidden||n.webkitHidden||n.mozHidden||n.msHidden);clearTimeout(a.resizeTimer);a.resizeTimer= 449setTimeout(function(){var e=a.$outer.width(),d="BODY"===a.$outer[0].tagName?a.$win.height():a.$outer.he
449ight();f||a.lastDim[0]===e&&a.lastDim[1]===d||(a.setDimensions(),a.$el.trigger("slideshow_resized",a),a.gotoPage(a.currentPage,a.playing,null,-1));"undefined"===typeof b&&a.checkResize()},f?2E3:500)};a.setDimensions=function(){a.$wrapper.find(".anythingWindow, .anythingBase, .panel")[d.fn.addBack?"addBack":"andSelf"]().css({width:"",height:""});a.width=a.$el.width();a.height=a.$el.height();a.outerPad= 450[a.$wrapper.innerWidth()-a.$wrapper.width(),a.$wrapper.innerHeight()-a.$wrapper.height()];var c,f,e,h,g=0,m={width:"100%",height:"100%"},k=1<b.showMultiple&&"horizontal"===b.mode?a.width||a.$window.width()/b.showMultiple:a.$window.width(),n=1<b.showMultiple&&"vertical"===b.mode?a.height/b.showMultiple||a.$window.height()/b.showMultiple:a.$window.height();if(b.expand){a.lastDim=[a.$outer.width(),a.$outer.height()];c=a.lastDim[0]-a.outerPad[0];f=a.lastDim[1]-a.outerPad[1];if(b.aspectRatio&&b.aspectRatio< 451a.width){var l=f*b.aspectRatio;l<c?c=l:(l=c/b.aspectRatio,l<f&&(f=l))}a.$wrapper.add(a.$window).css({width:c,height:f});a.height=f=1<b.showMultiple&&"vertical"===b.mode?n:f;a.width=k=1<b.showMultiple&&"horizontal"===b.mode?c/b.showMultiple:c;a.$items.css({width:k,height:n})}a.$items.each(function(l){h=d(this);e=h.children();b.resizeContents?(c=a.width,f=a.height,h.css({width:c,height:f}),e.length&&("EMBED"===e[0].tagName&&e.attr(m),"OBJECT"===e[0].tagName&&e.find("embed").attr(m),1===e.length&&e.css(m))): 452("vertical"===b.mode?(c=h.css("display","inline-block").width(),h.css("display","")):c=h.width()||a.width,1===e.length&&c>=k&&(c=e.width()>=k?k:e.width(),e.css("max-width",c)),h.css({width:c,height:""}),f=1===e.length?e.outerHeight(!0):h.height(),f<=a.outerPad[1]&&(f=a.height),h.css("height",f));a.panelSize[l]=[c,f,g];g+="vertical"===b.mode?f:c});a.$el.css("vertical"===b.mode?"height":"width","fade"===b.mode?a.width:g)};a.getDim=function(c){var f,e,d=a.width,g=a.height;if(1>a.pages||isNaN(c))return[d, 453g];c=b.infiniteSlides&&1<a.pages?c:c-1;if(e=a.panelSize[c])d=e[0]||d,g=e[1]||g;if(1<b.showMultiple)for(e=1;e<b.showMultiple;e++)f=c+e,"vertical"===b.mode?(d=Math.max(d,a.panelSize[f][0]),g+=a.panelSize[f][1]):(d+=a.panelSize[f][0],g=Math.max(g,a.panelSize[f][1]));return[d,g]};a.goForward=function(c,d){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]+b.changeBy*(d?-1:1),c)};a.goBack=function(c){a.gotoPage(a[b.allowRapidChange?"targetPage":"currentPage"]-b.changeBy,c)};a.gotoPage=function(c, 454f,e,h){!0!==f&&(f=!1,a.startStop(!1),a.makeActive());/^[#|.]/.test(c)&&d(c).length&&(c=d(c).closest(".panel").index()+a.adj);if(1!==b.changeBy){var g=a.pages-a.adjustMultiple;1>c&&(c=b.stopAtEnd?1:b.infiniteSlides?a.pages+c:b.showMultiple>1-c?1:g);c>a.pages?c=b.stopAtEnd?a.pages:b.showMultiple>1-c?1:c-=g:c>=g&&(c=g)}1>=a.pages||(a.$lastPage=a.$currentPage,"number"!==typeof c&&(c=parseInt(c,10)||b.startPanel,a.setCurrentPage(c)),f&&b.isVideoPlaying(a)||(b.stopAtEnd&&!b.infiniteSlides&&c>a.pages-b.showMultiple&& 455(c=a.pages-b.showMultiple+1),a.exactPage=c,c>a.pages+1-a.adj&&(c=b.infiniteSlides||b.stopAtEnd?a.pages:1),c<a.adj&&(c=b.infiniteSlides||b.stopAtEnd?1:a.pages),b.infiniteSlides||(a.exactPage=c),a.currentPage=c>a.pages?a.pages:1>c?1:a.currentPage,a.$currentPage=a.$items.eq(a.currentPage-a.adj),a.targetPage=0===c?a.pages:c>a.pages?1:c,a.$targetPage=a.$items.eq(a.targetPage-a.adj),h="undefined"!==typeof h?h:b.animationTime,0<=h&&a.$el.trigger("slide_init",a),0<h&&!0===b.toggleControls&&a.slideControls(!0), 456b.buildNavigation&&a.setNavigation(a.targetPage),!0!==f&&(f=!1),(!f||b.stopAtEnd&&c===a.pages)&&a.startStop(!1),0<=h&&a.$el.trigger("slide_begin",a),setTimeout(function(d){var f,g=!0;b.allowRapidChange&&a.$wrapper.add(a.$el).add(a.$items).stop(!0,!0);b.resizeContents||(f=a.getDim(c),d={},a.$wrapper.width()!==f[0]&&(d.width=f[0]||a.width,g=!1),a.$wrapper.height()!==f[1]&&(d.height=f[1]||a.height,g=!1),g||a.$wrapper.filter(":not(:animated)").animate(d,{queue:!1,duration:0>h?0:h,easing:b.easing}));"fade"=== 457b.mode?a.$lastPage[0]!==a.$targetPage[0]?(a.fadeIt(a.$lastPage,0,h),a.fadeIt(a.$targetPage,1,h,function(){a.endAnimation(c,e,h)})):a.endAnimation(c,e,h):(d={},d[a.dir]=-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2],"vertical"!==b.mode||b.resizeContents||(d.width=f[0]),a.$el.filter(":not(:animated)").animate(d,{queue:!1,duration:0>h?0:h,easing:b.easing,complete:function(){a.endAnimation(c,e,h)}}))},parseInt(b.delayBeforeAnimate,10)||0)))};a.endAnimation=function(c,d,e){0===c?(a.$el.css(a.dir,"fade"===
458b.mode?0:-a.panelSize[a.pages][2]),c=a.pages):c>a.pages&&(a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[1][2]),c=1);a.exactPage=c;a.setCurrentPage(c,!1);"fade"===b.mode&&a.fadeIt(a.$items.not(":eq("+(c-a.adj)+")"),0,0);a.hovered||a.slideControls(!1);b.hashTags&&a.setHash(c);0<=e&&a.$el.trigger("slide_complete",a);"function"===typeof d&&d(a);b.autoPlayLocked&&!a.playing&&setTimeout(function(){a.startStop(!0)},b.resumeDelay-(b.autoPlayDelayed?b.delay:0))};a.fadeIt=function(a,f,e,h){var g=a.filter(":not(:animated)"); 459a=0>e?0:e;if(b.resumeOnVisible)1===f&&g.css("visibility","visible"),g.fadeTo(a,f,function(){0===f&&g.css("visibility","hidden");d.isFunction(h)&&h()});else g[0===f?"fadeOut":"fadeIn"](a,h)};a.setCurrentPage=function(c,d){c=parseInt(c,10);if(!(1>a.pages||0===c||isNaN(c))){c>a.pages+1-a.adj&&(c=a.pages-a.adj);c<a.adj&&(c=1);b.buildArrows&&!b.infiniteSlides&&b.stopAtEnd&&(a.$forward[c===a.pages-a.adjustMultiple?"addClass":"removeClass"]("disabled"),a.$back[1===c?"addClass":"removeClass"]("disabled"), 460c===a.pages&&a.playing&&a.startStop());if(!d){var e=a.getDim(c);a.$wrapper.css({width:e[0],height:e[1]}).add(a.$window).scrollLeft(0).scrollTop(0);a.$el.css(a.dir,"fade"===b.mode?0:-a.panelSize[b.infiniteSlides&&1<a.pages?c:c-1][2])}a.currentPage=c;a.$currentPage=a.$items.removeClass("activePage").eq(c-a.adj).addClass("activePage");b.buildNavigation&&a.setNavigation(c)}};a.setNavigation=function(b){a.$nav.find(".cur").removeClass("cur").end().find("a").eq(b-1).addClass("cur")};a.makeActive=function(){a.$wrapper.hasClass("activeSlider")|| 461(d(".activeSlider").removeClass("activeSlider"),a.$wrapper.addClass("activeSlider"))};a.gotoHash=function(){var c=l.location.hash,f=c.indexOf("&"),e=c.match(a.regex);null!==e||/^#&/.test(c)||/#!?\//.test(c)||/\=/.test(c)?null!==e&&(e=b.hashTags?parseInt(e[1],10):null):(c=c.substring(0,0<=f?f:c.length),e=d(c).length&&d(c).closest(".anythingBase")[0]===a.el?a.$items.index(d(c).closest(".panel"))+a.adj:null);return e};a.setHash=function(b){var d="panel"+a.runTimes+"-",e=l.location.hash;"undefined"!== 462typeof e&&(l.location.hash=0<e.indexOf(d)?e.replace(a.regex,d+b):e+"&"+d+b)};a.slideControls=function(c){var d=c?"slideDown":"slideUp",e=c?0:b.animationTime,h=c?b.animationTime:0,g=c?1:0;c=c?0:1;b.toggleControls&&a.$controls.stop(!0,!0).delay(e)[d](b.animationTime/2).delay(h);b.buildArrows&&b.toggleArrows&&(!a.hovered&&a.playing&&(c=1,g=0),a.$forward.stop(!0,!0).delay(e).animate({right:a.arrowRight+c*a.arrowWidth,opacity:g},b.animationTime/2),a.$back.stop(!0,!0).delay(e).animate({left:a.arrowLeft+ 463c*a.arrowWidth,opacity:g},b.animationTime/2))};a.clearTimer=function(b){a.timer&&(l.clearInterval(a.timer),!b&&a.slideshow&&(a.$el.trigger("slideshow_stop",a),a.slideshow=!1))};a.startStop=function(c,d){!0!==c&&(c=!1);(a.playing=c)&&!d&&(a.$el.trigger("slideshow_start",a),a.slideshow=!0);b.buildStartStop&&(a.$startStop.toggleClass("playing",c).find("span").html(c?b.stopText:b.startText),"hidden"===a.$startStop.find("span").css("visibility")&&a.$startStop.addClass(b.tooltipClass).attr("title",c?b.stopText: 464b.startText));c?(a.clearTimer(!0),a.timer=l.setInterval(function(){n.hidden||n.webkitHidden||n.mozHidden||n.msHidden?b.autoPlayLocked||a.startStop():b.isVideoPlaying(a)?b.resumeOnVideoEnd||a.startStop():a.goForward(!0,b.playRtl)},b.delay)):a.clearTimer()};a.init()};d.anythingSlider.defaults={theme:"default",mode:"horiz",expand:!1,resizeContents:!0,showMultiple:!1,easing:"swing",buildArrows:!0,buildNavigation:!0,buildStartStop:!0,toggleArrows:!1,toggleControls:!1,startText:"Start",stopText:"Stop", 465forwardText:"»",backText:"«",tooltipClass:"tooltip",enableArrows:!0,enableNavigation:!0,enableStartStop:!0,enableKeyboard:!0,startPanel:1,changeBy:1,hashTags:!0,infiniteSlides:!0,navigationFormatter:null,navigationSize:!1,autoPlay:!1,autoPlayLocked:!1,autoPlayDelayed:!1,pauseOnHover:!0,stopAtEnd:!1,playRtl:!1,delay:3E3,resumeDelay:15E3,animationTime:600,delayBeforeAnimate:0,clickForwardArrow:"click",clickBackArrow:"click",clickControls:"click focusin",clickSlideshow:"click",allowRapidChange:!1, 466resumeOnVideoEnd:!0,resumeOnVisible:!0,isVideoPlaying:function(d){return!1}};d.fn.anythingSlider=function(m,l){return this.each(function(){var a,b=d(this).data("AnythingSlider");(typeof m).match("object|undefined")?b?b.updateSlider():new d.anythingSlider(this,m):/\d/.test(m)&&!isNaN(m)&&b?(a="number"===typeof m?m:parseInt(d.trim(m),10),1<=a&&a<=b.pages&&b.gotoPage(a,!1,l)):/^[#|.]/.test(m)&&d(m).length&&b.gotoPage(m,!1,l)})}})(jQuery,window,document); 467/* End */ 468; 469; /* Start:"a:4:{s:4:"full";s:83:"/local/templates/elektro_flat/js/custom-forms/jquery.custom-forms.js?15330357783042";s:6:"source";s:68:"/local/templates/elektro_flat/js/custom-forms/jquery.custom-forms.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 470(function($) { 471 var methods; 472 var customClass = 'custom-forms-wrapper'; 473 var customSelector = '.' + customClass; 474 methods = { 475 init: function (options) { 476 return this.each(function () { 477 var self = $(this); 478 var inputs = self.children('input'); 479 self.addClass(customClass); 480 //Êëàññû äëÿ îáåðòîê 481 inputs.each(function () { 482 var self = $(this); 483 var parent = self.parent(customSelector); 484 switch( $(this).attr('type') ) { 485 case 'checkbox': 486 parent.addClass('checkbox'); 487 self.addClass('master'); 488 break; 489 case 'radio': 490 parent.addClass('radio'); 491 self.addClass('master'); 492 break; 493 case 'text': 494 parent.addClass('text'); 495 self.addClass('master'); 496 break; 497 case 'file': 498 parent.addClass('file'); 499 self.addClass('invisible'); 500 parent.append('<div class="master">Âûáåðèòå ôàéë</div>'); 501 parent.append('<div class="slave file"></div>'); 502 parent.append('<div class="slave file-blocker"></div>'); 503 break; 504 505 } 506 }); 507 //Ñèíõðîíèçèðóåì êëàññû îáåðòîê ñ ñîñòîÿíèåì ïî óìîë÷àíèþ ó èíïóòîâ 508 inputs.each(function(){ 509 var parent = $(this).parent(customSelector); 510 if ($(this).is(':checked')) 511 parent.addClass('active'); 512 else 513 parent.removeClass('active'); 514 515 if ($(this).is(':disabled')) 516 parent.addClass('disable'); 517 else 518 parent.removeClass('disable'); 519 }); 520 //Îáíîâëÿåì ñîñòîÿíèå 521 inputs.change(function(){ 522 $(this).customForms('refresh'); 523 }); 524 //Íàâèãàöèÿ 525 inputs.focus(function(){ 526 var parent = $(this).parent(customSelector); 527 parent.addClass('focus'); 528 }); 529 inputs.blur(function(){ 530 var parent = $(this).parent(customSelector); 531 parent.removeClass('focus'); 532 }); 533 }); 534 }, 535 refresh: function() { 536 var parent = $(this).parent(customSelector); 537 //Óáèðàåì âûäåëåíèå ñ ãðóïïû ðàäèî 538 if( $(this).is('[type=radio]') ) 539 $(customSelector + '.radio input[name="'+ $(this).attr('name') +'"]').each(function () { 540 var parent = $(this).parent(customSelector); 541 parent.removeClass('active'); 542 }); 543 //Ìåíÿåì èìÿ â ôàéë-ôåéêå 544 if( $(this).is('[type=file]') ) { 545 var file = $(this).val(); 546 file = file.replace("C:\\fakepath\\",""); 547 if (file) { 548 parent.find('.master').text(file); 549 } else { 550 parent.find('.master').text('Âûáåðèòå ôàéë'); 551 } 552 } 553 //Ïðîñòàâëÿåì êëàññû îáíîâëÿåìîìó ýëåìåíòó 554 if ($(this).is(':checked')) 555 parent.addClass('active'); 556 else 557 parent.removeClass('active'); 558 559 if ($(this).is(':disabled')) 560 parent.addClass('disable'); 561 else 562 parent.removeClass('disable'); 563 } 564 }; 565 $.fn.customForms = function ( method ) { 566 if ( methods[method] ) { 567 return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); 568 } else if ( typeof method === 'object' || ! method ) { 569 return methods.init.apply( this, arguments ); 570 } else { 571 $.error( 'Ìåòîä ' + method + ' â jQuery.customForms íå ñóùåñòâóåò' ); 572 } 573 }; 574})(jQuery); 575/* End */ 576; 577; /* Start:"a:4:{s:4:"full";s:87:"/local/templates/elektro_flat/js/fancybox/jquery.fancybox-1.3.1.pack.js?153303577814386";s:6:"source";s:71:"/local/templates/elektro_flat/js/fancybox/jquery.fancybox-1.3.1.pack.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 578/*FancyBox - jQuery Plugin*/ 579(function(b){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,
579y=b.extend(b("<div/>")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})}, 580K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r; 581w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length){a=b("<div/>").text(a).html();switch(c.titlePosition){case "inside":return a;case "over":return'<span id="fancybox-title-over">'+ 582a+"</span>";default:return'<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">'+a+'</span><span id="fancybox-title-right"></span></span>'}}return false},V=function(){var a=c.title,d=l.width,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('<div id="fancybox-title" class="'+f+'" />').css({width:d,paddingLeft:c.padding, 583paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode== 58437){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a= 585j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb", 586b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+ 587"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left
587:a.left-c.padding- 58820}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}); 589x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding* 5902,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity= 5910;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("<img />").attr({id:"fancybox-img", 592src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f= 593"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false; 594return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity(); 595s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+d+'"></param>';w="";b.each(e.swf,function(r,R){t+='<param name="'+r+'" value="'+R+'"></param>';w+=" "+r+'="'+R+'"'});t+='<embed src="'+d+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+w+"></embed></object>";m.html(t); 596F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" scrolling="'+e.scrolling+'" src="'+e.href+'"></iframe>').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div", 597u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),u=b('<div id="fancybox-loading"><div></div></div>'),x=b('<div id="fancybox-overlay"></div>'),g=b('<div id="fancybox-wrap"></div>'));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('<div id="fancybox-outer"></div>').append('<div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div>').appendTo(g); 598D.append(i=b('<div id="fancybox-inner"></div>'),z=b('<a id="fancybox-close"></a>'),A=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),B=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height", 599"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>')}}}; 600b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;f<o;f++)if(typeof a[f]== 601"object")b(a[f]).data("fancybox",b.extend({},d,a[f]));else a[f]=b({}).data("fancybox",b.extend({content:a[f]},d));q=jQuery.merge(q,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},d,a));else a=b({}).data("fancybox",b.extend({content:a},d));q.push(a)}if(p>q.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n- 6021)};
602b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false} 603if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut, 604step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("<div style='overflow:auto'></div>").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+ 605d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast", 606easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery); 607/* End */ 608; 609; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/elektro_flat/js/spectrum/spectrum.js?153303577879093";s:6:"source";s:53:"/local/templates/elektro_flat/js/spectrum/spectrum.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 610// Spectrum Colorpicker v1.7.1 611// https://github.com/bgrins/spectrum 612// Author: Brian Grinstead 613// License: MIT 614 615(function (factory) { 616 "use strict"; 617 618 if (typeof define === 'function' && define.amd) { // AMD 619 define(['jquery'], factory); 620 } 621 else if (typeof exports == "object" && typeof module == "object") { // CommonJS 622 module.exports = factory; 623 } 624 else { // Browser 625 factory(jQuery); 626 } 627})(function($, undefined) { 628 "use strict"; 629 630 var defaultOpts = { 631 632 // Callbacks 633 beforeShow: noop, 634 move: noop, 635 change: noop, 636 show: noop, 637 hide: noop, 638 639 // Options 640 color: false, 641 flat: false, 642 showInput: false, 643 allowEmpty: false, 644 showButtons: true, 645 clickoutFiresChange: true, 646 showInitial: false, 647 showPalette: false, 648 showPaletteOnly: false, 649 hideAfterPaletteSelect: false, 650 togglePaletteOnly: false, 651 showSelectionPalette: true, 652 localStorageKey: false, 653 appendTo: "body", 654 maxSelectionSize: 7, 655 cancelText: "cancel", 656 chooseText: "choose", 657 togglePaletteMoreText: "more", 658 togglePaletteLessText: "less", 659 clearText: "Clear Color Selection", 660 noColorSelectedText: "No Color Selected", 661 preferredFormat: false, 662 className: "", // Deprecated - use containerClassName and replacerClassName instead. 663 containerClassName: "", 664 replacerClassName: "", 665 showAlpha: false, 666 theme: "sp-light", 667 palette: [["#ffffff", "#000000", "#ff0000", "#ff8000", "#ffff00", "#008000", "#0000ff", "#4b0082", "#9400d3"]], 668 selectionPalette: [], 669 disabled: false, 670 offset: null 671 }, 672 spectrums = [], 673 IE = !!/msie/i.exec( window.navigator.userAgent ), 674 rgbaSupport = (function() { 675 function contains( str, substr ) {
vendor: 34,548 bytes, lines 676-1642
676 return !!~('' + str).indexOf(substr); 677 } 678 679 var elem = document.createElement('div'); 680 var style = elem.style; 681 style.cssText = 'background-color:rgba(0,0,0,.5)'; 682 return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla'); 683 })(), 684 replaceInput = [ 685 "<div class='sp-replacer'>", 686 "<div class='sp-preview'><div class='sp-preview-inner'></div></div>", 687 "<div class='sp-dd'>▼</div>", 688 "</div>" 689 ].join(''), 690 markup = (function () { 691 692 // IE does not support gradients with multiple stops, so we need to simulate 693 // that for the rainbow slider with 8 divs that each have a single gradient 694 var gradientFix = ""; 695 if (IE) { 696 for (var i = 1; i <= 6; i++) { 697 gradientFix += "<div class='sp-" + i + "'></div>"; 698 } 699 } 700 701 return [ 702 "<div class='sp-container sp-hidden'>", 703 "<div class='sp-palette-container'>", 704 "<div class='sp-palette sp-thumb sp-cf'></div>", 705 "<div class='sp-palette-button-container sp-cf'>", 706 "<button type='button' class='sp-palette-toggle'></button>", 707 "</div>", 708 "</div>", 709 "<div class='sp-picker-container'>", 710 "<div class='sp-top sp-cf'>", 711 "<div class='sp-fill'></div>", 712 "<div class='sp-top-inner'>", 713 "<div class='sp-color'>", 714 "<div class='sp-sat'>", 715 "<div class='sp-val'>", 716 "<div class='sp-dragger'></div>", 717 "</div>", 718 "</div>", 719 "</div>", 720 "<div class='sp-clear sp-clear-display'>", 721 "</div>", 722 "<div class='sp-hue'>", 723 "<div class='sp-slider'></div>", 724 gradientFix, 725 "</div>", 726 "</div>", 727 "<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>", 728 "</div>", 729 "<div class='sp-input-container sp-cf'>", 730 "<input class='sp-input' type='text' spellcheck='false' />", 731 "</div>", 732 "<div class='sp-initial sp-thumb sp-cf'></div>", 733 "<div class='sp-button-container sp-cf'>", 734 "<a href='javascript:void(0)' class='sp-cancel'><i class='fa fa-times'></i></a>", 735 "<button type='button' class='btn_buy apuo sp-choose'></button>", 736 "</div>", 737 "</div>", 738 "</div>" 739 ].join(""); 740 })(); 741 742 function paletteTemplate (p, color, className, opts) { 743 var html = []; 744 for (var i = 0; i < p.length; i++) { 745 var current = p[i]; 746 if(current) { 747 var tiny = tinycolor(current); 748 var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light"; 749 c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : ""; 750 var formattedString = tiny.toString(opts.preferredFormat || "rgb"); 751 var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter(); 752 html.push('<span title="' + formattedString + '" data-color="' + tiny.toRgbString() + '" class="' + c + '"><span class="sp-thumb-inner" style="' + swatchStyle + ';" /></span>'); 753 } else { 754 var cls = 'sp-clear-display'; 755 html.push($('<div />') 756 .append($('<span data-color="" style="background-color:transparent;" class="' + cls + '"></span>') 757 .attr('title', opts.noColorSelectedText) 758 ) 759 .html() 760 ); 761 } 762 } 763 return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>"; 764 } 765 766 function hideAll() { 767 for (var i = 0; i < spectrums.length; i++) { 768 if (spectrums[i]) { 769 spectrums[i].hide(); 770 } 771 } 772 } 773 774 function instanceOptions(o, callbackContext) { 775 var opts = $.extend({}, defaultOpts, o); 776 opts.callbacks = { 777 'move': bind(opts.move, callbackContext), 778 'change': bind(opts.change, callbackContext), 779 'show': bind(opts.show, callbackContext), 780 'hide': bind(opts.hide, callbackContext), 781 'beforeShow': bind(opts.beforeShow, callbackContext) 782 }; 783 784 return opts; 785 } 786 787 function spectrum(element, o) { 788 789 var opts = instanceOptions(o, element), 790 flat = opts.flat, 791 showSelectionPalette = opts.showSelectionPalette, 792 localStorageKey = opts.localStorageKey, 793 theme = opts.theme, 794 callbacks = opts.callbacks, 795 resize = throttle(reflow, 10), 796 visible = false, 797 isDragging = false, 798 dragWidth = 0, 799 dragHeight = 0, 800 dragHelperHeight = 0, 801 slideHeight = 0, 802 slideWidth = 0, 803 alphaWidth = 0, 804 alphaSlideHelperWidth = 0, 805 slideHelperHeight = 0, 806 currentHue = 0, 807 currentSaturation = 0, 808 currentValue = 0, 809 currentAlpha = 1, 810 palette = [], 811 paletteArray = [], 812 paletteLookup = {}, 813 selectionPalette = opts.selectionPalette.slice(0), 814 maxSelectionSize = opts.maxSelectionSize, 815 draggingClass = "sp-dragging", 816 shiftMovementDirection = null; 817 818 var doc = element.ownerDocument, 819 body = doc.body, 820 boundElement = $(element), 821 disabled = false, 822 container = $(markup, doc).addClass(theme), 823 pickerContainer = container.find(".sp-picker-container"), 824 dragger = container.find(".sp-color"), 825 dragHelper = container.find(".sp-dragger"), 826 slider = container.find(".sp-hue"), 827 slideHelper = container.find(".sp-slider"), 828 alphaSliderInner = container.find(".sp-alpha-inner"), 829 alphaSlider = container.find(".sp-alpha"), 830 alphaSlideHelper = container.find(".sp-alpha-handle"), 831 textInput = container.find(".sp-input"), 832 paletteContainer = container.find(".sp-palette"), 833 initialColorContainer = container.find(".sp-initial"), 834 cancelButton = container.find(".sp-cancel"), 835 clearButton = container.find(".sp-clear"), 836 chooseButton = container.find(".sp-choose"), 837 toggleButton = container.find(".sp-palette-toggle"), 838 isInput = boundElement.is("input"), 839 isInputTypeColor = isInput && boundElement.attr("type") === "color" && inputTypeColorSupport(), 840 shouldReplace = isInput && !flat, 841 replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]), 842 offsetElement = (shouldReplace) ? replacer : boundElement, 843 previewElement = replacer.find(".sp-preview-inner"), 844 initialColor = opts.color || (isInput && boundElement.val()), 845 colorOnShow = false, 846 preferredFormat = opts.preferredFormat, 847 currentPreferredFormat = preferredFormat, 848 clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange, 849 isEmpty = !initialColor, 850 allowEmpty = opts.allowEmpty && !isInputTypeColor; 851 852 function applyOptions() { 853 854 if (opts.showPaletteOnly) { 855 opts.showPalette = true; 856 } 857 858 toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText); 859 860 if (opts.palette) { 861 palette = opts.palette.slice(0); 862 paletteArray = $.isArray(palette[0]) ? palette : [palette]; 863 paletteLookup = {}; 864 for (var i = 0; i < paletteArray.length; i++) { 865 for (var j = 0; j < paletteArray[i].length; j++) { 866 var rgb = tinycolor(paletteArray[i][j]).toRgbString(); 867 paletteLookup[rgb] = true; 868 } 869 } 870 } 871 872 container.toggleClass("sp-flat", flat); 873 container.toggleClass("sp-input-disabled", !opts.showInput); 874 container.toggleClass("sp-alpha-enabled", opts.showAlpha); 875 container.toggleClass("sp-clear-enabled", allowEmpty); 876 container.toggleClass("sp-buttons-disabled", !opts.showButtons); 877 container.toggleClass("sp-palette-buttons-disabled", !opts.togglePaletteOnly); 878 container.toggleClass("sp-palette-disabled", !opts.showPalette); 879 container.toggleClass("sp-palette-only", opts.showPaletteOnly); 880 container.toggleClass("sp-initial-disabled", !opts.showInitial); 881 container.addClass(opts.className).addClass(opts.containerClassName); 882 883 reflow(); 884 } 885 886 function initialize() { 887 888 if (IE) { 889 container.find("*:not(input)").attr("unselectable", "on"); 890 } 891 892 applyOptions(); 893 894 if (shouldReplace) { 895 boundElement.after(replacer).hide(); 896 } 897 898 if (!allowEmpty) { 899 clearButton.hide(); 900 } 901 902 if (flat) { 903 boundElement.after(container).hide(); 904 } 905 else { 906 907 var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo); 908 if (appendTo.length !== 1) { 909 appendTo = $("body"); 910 } 911 912 appendTo.append(container); 913 } 914 915 updateSelectionPaletteFromStorage(); 916 917 offsetElement.bind("click.spectrum touchstart.spectrum", function (e) { 918 if (!disabled) { 919 toggle(); 920 } 921 922 e.stopPropagation(); 923 924 if (!$(e.target).is("input")) { 925 e.preventDefault(); 926 } 927 }); 928 929 if(boundElement.is(":disabled") || (opts.disabled === true)) { 930 disable(); 931 } 932 933 // Prevent clicks from bubbling up to document. This would cause it to be hidden. 934 container.click(stopPropagation); 935 936 // Handle user typed input 937 textInput.change(setFromTextInput); 938 textInput.bind("paste", function () { 939 setTimeout(setFromTextInput, 1); 940 }); 941 textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } }); 942 943 cancelButton.html(opts.cancelText); 944 cancelButton.bind("click.spectrum", function (e) { 945 e.stopPropagation(); 946 e.preventDefault(); 947 revert(); 948 hide(); 949 }); 950 951 clearButton.attr("title", opts.clearText); 952 clearButton.bind("click.spectrum", function (e) { 953 e.stopPropagation(); 954 e.preventDefault(); 955 isEmpty = true; 956 move(); 957 958 if(flat) { 959 //for the flat style, this is a change event 960 updateOriginalInput(true); 961 } 962 }); 963 964 chooseButton.text(opts.chooseText); 965 chooseButton.bind("click.spectrum", function (e) { 966 e.stopPropagation(); 967 e.preventDefault(); 968 969 if (IE && textInput.is(":focus")) { 970 textInput.trigger('change'); 971 } 972 973 if (isValid()) { 974 updateOriginalInput(true); 975 hide(); 976 } 977 }); 978 979 toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText); 980 toggleButton.bind("click.spectrum", function (e) { 981 e.stopPropagation(); 982 e.preventDefault(); 983 984 opts.showPaletteOnly = !opts.showPaletteOnly; 985 986 // To make sure the Picker area is drawn on the right, next to the 987 // Palette area (and not below the palette), first move the Palette 988 // to the left to make space for the picker, plus 5px extra. 989 // The 'applyOptions' function puts the whole container back into place 990 // and takes care of the button-text and the sp-palette-only CSS class. 991 if (!opts.showPaletteOnly && !flat) { 992 container.css('left', '-=' + (pickerContainer.outerWidth(true) + 5)); 993 } 994 applyOptions(); 995 }); 996 997 draggable(alphaSlider, function (dragX, dragY, e) { 998 currentAlpha = (dragX / alphaWidth); 999 isEmpty = false; 1000 if (e.shiftKey) { 1001 currentAlpha = Math.round(currentAlpha * 10) / 10; 1002 } 1003 1004 move(); 1005 }, dragStart, dragStop); 1006 1007 draggable(slider, function (dragX, dragY) { 1008 currentHue = parseFloat(dragY / slideHeight); 1009 isEmpty = false; 1010 if (!opts.showAlpha) { 1011 currentAlpha = 1; 1012 } 1013 move(); 1014 }, dragStart, dragStop); 1015 1016 draggable(dragger, function (dragX, dragY, e) { 1017 1018 // shift+drag should snap the movement to either the x or y axis. 1019 if (!e.shiftKey) { 1020 shiftMovementDirection = null; 1021 } 1022 else if (!shiftMovementDirection) { 1023 var oldDragX = currentSaturation * dragWidth; 1024 var oldDragY = dragHeight - (currentValue * dragHeight); 1025 var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY); 1026 1027 shiftMovementDirection = furtherFromX ? "x" : "y"; 1028 } 1029 1030 var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x"; 1031 var setValue = !shiftMovementDirection || shiftMovementDirection === "y"; 1032 1033 if (setSaturation) { 1034 currentSaturation = parseFloat(dragX / dragWidth); 1035 } 1036 if (setValue) { 1037 currentValue = parseFloat((dragHeight - dragY) / dragHeight); 1038 } 1039 1040 isEmpty = false; 1041 if (!opts.showAlpha) { 1042 currentAlpha = 1; 1043 } 1044 1045 move(); 1046 1047 }, dragStart, dragStop); 1048 1049 if (!!initialColor) { 1050 set(initialColor); 1051 1052 // In case color was black - update the preview UI and set the format 1053 // since the set function will not run (default color is black). 1054 updateUI(); 1055 currentPreferredFormat = preferredFormat || tinycolor(initialColor).format; 1056 1057 addColorToSelectionPalette(initialColor); 1058 } 1059 else { 1060 updateUI(); 1061 } 1062 1063 if (flat) { 1064 show(); 1065 } 1066 1067 function paletteElementClick(e) { 1068 if (e.data && e.data.ignore) { 1069 set($(e.target).closest(".sp-thumb-el").data("color")); 1070 move(); 1071 } 1072 else { 1073 set($(e.target).closest(".sp-thumb-el").data("color")); 1074 move(); 1075 updateOriginalInput(true); 1076 if (opts.hideAfterPaletteSelect) { 1077 hide(); 1078 } 1079 } 1080 1081 return false; 1082 } 1083 1084 var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum"; 1085 paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick); 1086 initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick); 1087 } 1088 1089 function updateSelectionPaletteFromStorage() { 1090 1091 if (localStorageKey && window.localStorage) { 1092 1093 // Migrate old palettes over to new format. May want to remove this eventually. 1094 try { 1095 var oldPalette = window.localStorage[localStorageKey].split(",#"); 1096 if (oldPalette.length > 1) { 1097 delete window.localStorage[localStorageKey]; 1098 $.each(oldPalette, function(i, c) { 1099 addColorToSelectionPalette(c); 1100 }); 1101 } 1102 } 1103 catch(e) { } 1104 1105 try { 1106 selectionPalette = window.localStorage[localStorageKey].split(";"); 1107 } 1108 catch (e) { } 1109 } 1110 } 1111 1112 function addColorToSelectionPalette(color) { 1113 if (showSelectionPalette) { 1114 var rgb = tinycolor(color).toRgbString(); 1115 if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) { 1116 selectionPalette.push(rgb); 1117 while(selectionPalette.length > maxSelectionSize) { 1118 selectionPalette.shift(); 1119 } 1120 } 1121 1122 if (localStorageKey && window.localStorage) { 1123 try { 1124 window.localStorage[localStorageKey] = selectionPalette.join(";"); 1125 } 1126 catch(e) { } 1127 } 1128 } 1129 } 1130 1131 function getUniqueSelectionPalette() { 1132 var unique = []; 1133 if (opts.showPalette) { 1134 for (var i = 0; i < selectionPalette.length; i++) { 1135 var rgb = tinycolor(selectionPalette[i]).toRgbString(); 1136 1137 if (!paletteLookup[rgb]) { 1138 unique.push(selectionPalette[i]); 1139 } 1140 } 1141 } 1142 1143 return unique.reverse().slice(0, opts.maxSelectionSize); 1144 } 1145 1146 function drawPalette() { 1147 1148 var currentColor = get(); 1149 1150 var html = $.map(paletteArray, function (palette, i) { 1151 return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts); 1152 }); 1153 1154 updateSelectionPaletteFromStorage(); 1155 1156 if (selectionPalette) { 1157 html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts)); 1158 } 1159 1160 paletteContainer.html(html.join("")); 1161 } 1162 1163 function drawInitial() { 1164 if (opts.showInitial) { 1165 var initial = colorOnShow; 1166 var current = get(); 1167 initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial", opts)); 1168 } 1169 } 1170 1171 function dragStart() { 1172 if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) { 1173 reflow(); 1174 } 1175 isDragging = true; 1176 container.addClass(draggingClass); 1177 shiftMovementDirection = null; 1178 boundElement.trigger('dragstart.spectrum', [ get() ]); 1179 } 1180 1181 function dragStop() { 1182 isDragging = false; 1183 container.removeClass(draggingClass); 1184 boundElement.trigger('dragstop.spectrum', [ get() ]); 1185 } 1186 1187 function setFromTextInput() { 1188 1189 var value = textInput.val(); 1190 1191 if ((value === null || value === "") && allowEmpty) { 1192 set(null); 1193 updateOriginalInput(true); 1194 } 1195 else { 1196 var tiny = tinycolor(value); 1197 if (tiny.isValid()) { 1198 set(tiny); 1199 updateOriginalInput(true); 1200 } 1201 else { 1202 textInput.addClass("sp-validation-error"); 1203 } 1204 } 1205 } 1206 1207 function toggle() { 1208 if (visible) { 1209 hide(); 1210 } 1211 else { 1212 show(); 1213 } 1214 } 1215 1216 function show() { 1217 var event = $.Event('beforeShow.spectrum'); 1218 1219 if (visible) { 1220 reflow(); 1221 return; 1222 } 1223 1224 boundElement.trigger(event, [ get() ]); 1225 1226 if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) { 1227 return; 1228 } 1229 1230 hideAll(); 1231 visible = true; 1232 1233 $(doc).bind("keydown.spectrum", onkeydown); 1234 $(doc).bind("click.spectrum", clickout); 1235 $(window).bind("resize.spectrum", resize); 1236 replacer.addClass("sp-active"); 1237 container.removeClass("sp-hidden"); 1238 1239 reflow(); 1240 updateUI(); 1241 1242 colorOnShow = get(); 1243 1244 drawInitial(); 1245 callbacks.show(colorOnShow); 1246 boundElement.trigger('show.spectrum', [ colorOnShow ]); 1247 } 1248 1249 function onkeydown(e) { 1250 // Close on ESC 1251 if (e.keyCode === 27) { 1252 hide(); 1253 } 1254 } 1255 1256 function clickout(e) { 1257 // Return on right click. 1258 if (e.button == 2) { return; } 1259 1260 // If a drag event was happening during the mouseup, don't hide 1261 // on click. 1262 if (isDragging) { return; } 1263 1264 if (clickoutFiresChange) { 1265 updateOriginalInput(true); 1266 } 1267 else { 1268 revert(); 1269 } 1270 hide(); 1271 } 1272 1273 function hide() { 1274 // Return if hiding is unnecessary 1275 if (!visible || flat) { return; } 1276 visible = false; 1277 1278 $(doc).unbind("keydown.spectrum", onkeydown); 1279 $(doc).unbind("click.spectrum", clickout); 1280 $(window).unbind("resize.spectrum", resize); 1281 1282 replacer.removeClass("sp-active"); 1283 container.addClass("sp-hidden"); 1284 1285 callbacks.hide(get()); 1286 boundElement.trigger('hide.spectrum', [ get() ]); 1287 } 1288 1289 function revert() { 1290 set(colorOnShow, true); 1291 } 1292 1293 function set(color, ignoreFormatChange) { 1294 if (tinycolor.equals(color, get())) { 1295 // Update UI just in case a validation error needs 1296 // to be cleared. 1297 updateUI(); 1298 return; 1299 } 1300 1301 var newColor, newHsv; 1302 if (!color && allowEmpty) { 1303 isEmpty = true; 1304 } else { 1305 isEmpty = false; 1306 newColor = tinycolor(color); 1307 newHsv = newColor.toHsv(); 1308 1309 currentHue = (newHsv.h % 360) / 360; 1310 currentSaturation = newHsv.s; 1311 currentValue = newHsv.v; 1312 currentAlpha = newHsv.a; 1313 } 1314 updateUI(); 1315 1316 if (newColor && newColor.isValid() && !ignoreFormatChange) { 1317 currentPreferredFormat = preferredFormat || newColor.getFormat(); 1318 } 1319 } 1320 1321 function get(opts) { 1322 opts = opts || { }; 1323 1324 if (allowEmpty && isEmpty) { 1325 return null; 1326 } 1327 1328 return tinycolor.fromRatio({ 1329 h: currentHue, 1330 s: currentSaturation, 1331 v: currentValue, 1332 a: Math.round(currentAlpha * 100) / 100 1333 }, { format: opts.format || currentPreferredFormat }); 1334 } 1335 1336 function isValid() { 1337 return !textInput.hasClass("sp-validation-error"); 1338 } 1339 1340 function move() { 1341 updateUI(); 1342 1343 callbacks.move(get()); 1344 boundElement.trigger('move.spectrum', [ get() ]); 1345 } 1346 1347 function updateUI() { 1348 1349 textInput.removeClass("sp-validation-error"); 1350 1351 updateHelperLocations(); 1352 1353 // Update dragger background color (gradients take care of saturation and value). 1354 var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 }); 1355 dragger.css("background-color", flatColor.toHexString()); 1356 1357 // Get a format that alpha will be included in (hex and names ignore alpha) 1358 var format = currentPreferredFormat; 1359 if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) { 1360 if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") { 1361 format = "rgb"; 1362 } 1363 } 1364 1365 var realColor = get({ format: format }), 1366 displayColor = ''; 1367 1368 //reset background info for preview element 1369 previewElement.removeClass("sp-clear-display"); 1370 previewElement.css('background-color', 'transparent'); 1371 1372 if (!realColor && allowEmpty) { 1373 // Update the replaced elements background with icon indicating no color selection 1374 previewElement.addClass("sp-clear-display"); 1375 } 1376 else { 1377 var realHex = realColor.toHexString(), 1378 realRgb = realColor.toRgbString(); 1379 1380 // Update the replaced elements background color (with actual selected color) 1381 if (rgbaSupport || realColor.alpha === 1) { 1382 previewElement.css("background-color", realRgb); 1383 } 1384 else { 1385 previewElement.css("background-color", "transparent"); 1386 previewElement.css("filter", realColor.toFilter()); 1387 } 1388 1389 if (opts.showAlpha) { 1390 var rgb = realColor.toRgb(); 1391 rgb.a = 0; 1392 var realAlpha = tinycolor(rgb).toRgbString(); 1393 var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")"; 1394 1395 if (IE) { 1396 alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex)); 1397 } 1398 else { 1399 alphaSliderInner.css("background", "-webkit-" + gradient); 1400 alphaSliderInner.css("background", "-moz-" + gradient); 1401 alphaSliderInner.css("background", "-ms-" + gradient); 1402 // Use current syntax gradient on unprefixed property. 1403 alphaSliderInner.css("background", 1404 "linear-gradient(to right, " + realAlpha + ", " + realHex + ")"); 1405 } 1406 } 1407 1408 displayColor = realColor.toString(format); 1409 } 1410 1411 // Update the text entry input as it changes happen 1412 if (opts.showInput) { 1413 textInput.val(displayColor); 1414 } 1415 1416 if (opts.showPalette) { 1417 drawPalette(); 1418 } 1419 1420 drawInitial(); 1421 } 1422 1423 function updateHelperLocations() { 1424 var s = currentSaturation; 1425 var v = currentValue; 1426 1427 if(allowEmpty && isEmpty) { 1428 //if selected color is empty, hide the helpers 1429 alphaSlideHelper.hide(); 1430 slideHelper.hide(); 1431 dragHelper.hide(); 1432 } 1433 else { 1434 //make sure helpers are visible 1435 alphaSlideHelper.show(); 1436 slideHelper.show(); 1437 dragHelper.show(); 1438 1439 // Where to show the little circle in that displays your current selected color 1440 var dragX = s * dragWidth; 1441 var dragY = dragHeight - (v * dragHeight); 1442 dragX = Math.max( 1443 -dragHelperHeight, 1444 Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight) 1445 ); 1446 dragY = Math.max( 1447 -dragHelperHeight, 1448 Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight) 1449 ); 1450 dragHelper.css({ 1451 "top": dragY + "px", 1452 "left": dragX + "px" 1453 }); 1454 1455 var alphaX = currentAlpha * alphaWidth; 1456 alphaSlideHelper.css({ 1457 "left": (alphaX - (alphaSlideHelperWidth / 2)) + "px" 1458 }); 1459 1460 // Where to show the bar that displays your current selected hue 1461 var slideY = (currentHue) * slideHeight; 1462 slideHelper.css({ 1463 "top": (slideY - slideHelperHeight) + "px" 1464 }); 1465 } 1466 } 1467 1468 function updateOriginalInput(fireCallback) { 1469 var color = get(), 1470 displayColor = '', 1471 hasChanged = !tinycolor.equals(color, colorOnShow); 1472 1473 if (color) { 1474 displayColor = color.toString(currentPreferredFormat); 1475 // Update the selection palette with the current color 1476 addColorToSelectionPalette(color); 1477 } 1478 1479 if (isInput) { 1480 boundElement.val(displayColor); 1481 } 1482 1483 if (fireCallback && hasChanged) { 1484 callbacks.change(color); 1485 boundElement.trigger('change', [ color ]); 1486 } 1487 } 1488 1489 function reflow() { 1490 dragWidth = dragger.width(); 1491 dragHeight = dragger.height(); 1492 dragHelperHeight = dragHelper.height(); 1493 slideWidth = slider.width(); 1494 slideHeight = slider.height(); 1495 slideHelperHeight = slideHelper.height(); 1496 alphaWidth = alphaSlider.width(); 1497 alphaSlideHelperWidth = alphaSlideHelper.width(); 1498 1499 if (!flat) { 1500 container.css("position", "absolute"); 1501 if (opts.offset) { 1502 container.offset(opts.offset); 1503 } else { 1504 container.offset(getOffset(container, offsetElement)); 1505 } 1506 } 1507 1508 updateHelperLocations(); 1509 1510 if (opts.showPalette) { 1511 drawPalette(); 1512 } 1513 1514 boundElement.trigger('reflow.spectrum'); 1515 } 1516 1517 function destroy() { 1518 boundElement.show(); 1519 offsetElement.unbind("click.spectrum touchstart.spectrum"); 1520 container.remove(); 1521 replacer.remove(); 1522 spectrums[spect.id] = null; 1523 } 1524 1525 function option(optionName, optionValue) { 1526 if (optionName === undefined) { 1527 return $.extend({}, opts); 1528 } 1529 if (optionValue === undefined) { 1530 return opts[optionName]; 1531 } 1532 1533 opts[optionName] = optionValue; 1534 applyOptions(); 1535 } 1536 1537 function enable() { 1538 disabled = false; 1539 boundElement.attr("disabled", false); 1540 offsetElement.removeClass("sp-disabled"); 1541 } 1542 1543 function disable() { 1544 hide(); 1545 disabled = true; 1546 boundElement.attr("disabled", true); 1547 offsetElement.addClass("sp-disabled"); 1548 } 1549 1550 function setOffset(coord) { 1551 opts.offset = coord; 1552 reflow(); 1553 } 1554 1555 initialize(); 1556 1557 var spect = { 1558 show: show, 1559 hide: hide, 1560 toggle: toggle, 1561 reflow: reflow, 1562 option: option, 1563 enable: enable, 1564 disable: disable, 1565 offset: setOffset, 1566 set: function (c) { 1567 set(c); 1568 updateOriginalInput(); 1569 }, 1570 get: get, 1571 destroy: destroy, 1572 container: container 1573 }; 1574 1575 spect.id = spectrums.push(spect) - 1; 1576 1577 return spect; 1578 } 1579 1580 /** 1581 * checkOffset - get the offset below/above and left/right element depending on screen position 1582 * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js 1583 */ 1584 function getOffset(picker, input) { 1585 var extraY = 0; 1586 var dpWidth = picker.outerWidth(); 1587 var dpHeight = picker.outerHeight(); 1588 var inputHeight = input.outerHeight(); 1589 var doc = picker[0].ownerDocument; 1590 var docElem = doc.documentElement; 1591 var viewWidth = docElem.clientWidth + $(doc).scrollLeft(); 1592 var viewHeight = docElem.clientHeight + $(doc).scrollTop(); 1593 var offset = input.offset(); 1594 offset.top += inputHeight; 1595 1596 offset.left -= 1597 Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? 1598 Math.abs(offset.left + dpWidth - viewWidth) : 0) + 20; 1599 1600 offset.top -= 1601 Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? 1602 Math.abs(dpHeight + inputHeight - extraY) : extraY)) - 9; 1603 1604 return offset; 1605 } 1606 1607 /** 1608 * noop - do nothing 1609 */ 1610 function noop() { 1611 1612 } 1613 1614 /** 1615 * stopPropagation - makes the code only doing this a little easier to read in line 1616 */ 1617 function stopPropagation(e) { 1618 e.stopPropagation(); 1619 } 1620 1621 /** 1622 * Create a function bound to a given object 1623 * Thanks to underscore.js 1624 */ 1625 function bind(func, obj) { 1626 var slice = Array.prototype.slice; 1627 var args = slice.call(arguments, 2); 1628 return function () { 1629 return func.apply(obj, args.concat(slice.call(arguments))); 1630 }; 1631 } 1632 1633 /** 1634 * Lightweight drag helper. Handles containment within the element, so that 1635 * when dragging, the x is within [0,element.width] and y is within [0,element.height] 1636 */ 1637 function draggable(element, onmove, onstart, onstop) { 1638 onmove = onmove || function () { }; 1639 onstart = onstart || function () { }; 1640 onstop = onstop || function () { }; 1641 var doc = document; 1642 var dragging = false;
vendor: 6,056 bytes, lines 1643-1831
1643 var offset = {}; 1644 var maxHeight = 0; 1645 var maxWidth = 0; 1646 var hasTouch = ('ontouchstart' in window); 1647 1648 var duringDragEvents = {}; 1649 duringDragEvents["selectstart"] = prevent; 1650 duringDragEvents["dragstart"] = prevent; 1651 duringDragEvents["touchmove mousemove"] = move; 1652 duringDragEvents["touchend mouseup"] = stop; 1653 1654 function prevent(e) { 1655 if (e.stopPropagation) { 1656 e.stopPropagation(); 1657 } 1658 if (e.preventDefault) { 1659 e.preventDefault(); 1660 } 1661 e.returnValue = false; 1662 } 1663 1664 function move(e) { 1665 if (dragging) { 1666 // Mouseup happened outside of window 1667 if (IE && doc.documentMode < 9 && !e.button) { 1668 return stop(); 1669 } 1670 1671 var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0]; 1672 var pageX = t0 && t0.pageX || e.pageX; 1673 var pageY = t0 && t0.pageY || e.pageY; 1674 1675 var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth)); 1676 var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight)); 1677 1678 if (hasTouch) { 1679 // Stop scrolling in iOS 1680 prevent(e); 1681 } 1682 1683 onmove.apply(element, [dragX, dragY, e]); 1684 } 1685 } 1686 1687 function start(e) { 1688 var rightclick = (e.which) ? (e.which == 3) : (e.button == 2); 1689 1690 if (!rightclick && !dragging) { 1691 if (onstart.apply(element, arguments) !== false) { 1692 dragging = true; 1693 maxHeight = $(element).height(); 1694 maxWidth = $(element).width(); 1695 offset = $(element).offset(); 1696 1697 $(doc).bind(duringDragEvents); 1698 $(doc.body).addClass("sp-dragging"); 1699 1700 move(e); 1701 1702 prevent(e); 1703 } 1704 } 1705 } 1706 1707 function stop() { 1708 if (dragging) { 1709 $(doc).unbind(duringDragEvents); 1710 $(doc.body).removeClass("sp-dragging"); 1711 1712 // Wait a tick before notifying observers to allow the click event 1713 // to fire in Chrome. 1714 setTimeout(function() { 1715 onstop.apply(element, arguments); 1716 }, 0); 1717 } 1718 dragging = false; 1719 } 1720 1721 $(element).bind("touchstart mousedown", start); 1722 } 1723 1724 function throttle(func, wait, debounce) { 1725 var timeout; 1726 return function () { 1727 var context = this, args = arguments; 1728 var throttler = function () { 1729 timeout = null; 1730 func.apply(context, args); 1731 }; 1732 if (debounce) clearTimeout(timeout); 1733 if (debounce || !timeout) timeout = setTimeout(throttler, wait); 1734 }; 1735 } 1736 1737 function inputTypeColorSupport() { 1738 return $.fn.spectrum.inputTypeColorSupport(); 1739 } 1740 1741 /** 1742 * Define a jQuery plugin 1743 */ 1744 var dataID = "spectrum.id"; 1745 $.fn.spectrum = function (opts, extra) { 1746 1747 if (typeof opts == "string") { 1748 1749 var returnValue = this; 1750 var args = Array.prototype.slice.call( arguments, 1 ); 1751 1752 this.each(function () { 1753 var spect = spectrums[$(this).data(dataID)]; 1754 if (spect) { 1755 var method = spect[opts]; 1756 if (!method) { 1757 throw new Error( "Spectrum: no such method: '" + opts + "'" ); 1758 } 1759 1760 if (opts == "get") { 1761 returnValue = spect.get(); 1762 } 1763 else if (opts == "container") { 1764 returnValue = spect.container; 1765 } 1766 else if (opts == "option") { 1767 returnValue = spect.option.apply(spect, args); 1768 } 1769 else if (opts == "destroy") { 1770 spect.destroy(); 1771 $(this).removeData(dataID); 1772 } 1773 else { 1774 method.apply(spect, args); 1775 } 1776 } 1777 }); 1778 1779 return returnValue; 1780 } 1781 1782 // Initializing a new instance of spectrum 1783 return this.spectrum("destroy").each(function () { 1784 var options = $.extend({}, opts, $(this).data()); 1785 var spect = spectrum(this, options); 1786 $(this).data(dataID, spect.id); 1787 }); 1788 }; 1789 1790 $.fn.spectrum.load = true; 1791 $.fn.spectrum.loadOpts = {}; 1792 $.fn.spectrum.draggable = draggable; 1793 $.fn.spectrum.defaults = defaultOpts; 1794 $.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() { 1795 if (typeof inputTypeColorSupport._cachedResult === "undefined") { 1796 var colorInput = $("<input type='color'/>")[0]; // if color element is supported, value will default to not null 1797 inputTypeColorSupport._cachedResult = colorInput.type === "color" && colorInput.value !== ""; 1798 } 1799 return inputTypeColorSupport._cachedResult; 1800 }; 1801 1802 $.spectrum = { }; 1803 $.spectrum.localization = { }; 1804 $.spectrum.palettes = { }; 1805 1806 $.fn.spectrum.processNativeColorInputs = function () { 1807 var colorInputs = $("input[type=color]"); 1808 if (colorInputs.length && !inputTypeColorSupport()) { 1809 colorInputs.spectrum({ 1810 preferredFormat: "hex6" 1811 }); 1812 } 1813 }; 1814 1815 // TinyColor v1.1.2 1816 // https://github.com/bgrins/TinyColor 1817 // Brian Grinstead, MIT License 1818 1819 (function() { 1820 1821 var trimLeft = /^[\s,#]+/, 1822 trimRight = /\s+$/, 1823 tinyCounter = 0, 1824 math = Math, 1825 mathRound = math.round, 1826 mathMin = math.min, 1827 mathMax = math.max, 1828 mathRandom = math.random; 1829 1830 var tinycolor = function(color, opts) { 1831
vendor: 2,033 bytes, lines 1832-1891
1832 color = (color) ? color : ''; 1833 opts = opts || { }; 1834 1835 // If input is already a tinycolor, return itself 1836 if (color instanceof tinycolor) { 1837 return color; 1838 } 1839 // If we are called as a function, call using new instead 1840 if (!(this instanceof tinycolor)) { 1841 return new tinycolor(color, opts); 1842 } 1843 1844 var rgb = inputToRGB(color); 1845 this._originalInput = color, 1846 this._r = rgb.r, 1847 this._g = rgb.g, 1848 this._b = rgb.b, 1849 this._a = rgb.a, 1850 this._roundA = mathRound(100*this._a) / 100, 1851 this._format = opts.format || rgb.format; 1852 this._gradientType = opts.gradientType; 1853 1854 // Don't let the range of [0,255] come back in [0,1]. 1855 // Potentially lose a little bit of precision here, but will fix issues where 1856 // .5 gets interpreted as half of the total, instead of half of 1 1857 // If it was supposed to be 128, this was already taken care of by `inputToRgb` 1858 if (this._r < 1) { this._r = mathRound(this._r); } 1859 if (this._g < 1) { this._g = mathRound(this._g); } 1860 if (this._b < 1) { this._b = mathRound(this._b); } 1861 1862 this._ok = rgb.ok; 1863 this._tc_id = tinyCounter++; 1864 }; 1865 1866 tinycolor.prototype = { 1867 isDark: function() { 1868 return this.getBrightness() < 128; 1869 }, 1870 isLight: function() { 1871 return !this.isDark(); 1872 }, 1873 isValid: function() { 1874 return this._ok; 1875 }, 1876 getOriginalInput: function() { 1877 return this._originalInput; 1878 }, 1879 getFormat: function() { 1880 return this._format; 1881 }, 1882 getAlpha: function() { 1883 return this._a; 1884 }, 1885 getBrightness: function() { 1886 var rgb = this.toRgb(); 1887 return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; 1888 }, 1889 setAlpha: function(value) { 1890 this._a = boundAlpha(value); 1891 this._roundA = mathRound(100*this._a) / 1
vendor: 34,532 bytes, lines 1891-2926
189100; 1892 return this; 1893 }, 1894 toHsv: function() { 1895 var hsv = rgbToHsv(this._r, this._g, this._b); 1896 return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; 1897 }, 1898 toHsvString: function() { 1899 var hsv = rgbToHsv(this._r, this._g, this._b); 1900 var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); 1901 return (this._a == 1) ? 1902 "hsv(" + h + ", " + s + "%, " + v + "%)" : 1903 "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; 1904 }, 1905 toHsl: function() { 1906 var hsl = rgbToHsl(this._r, this._g, this._b); 1907 return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; 1908 }, 1909 toHslString: function() { 1910 var hsl = rgbToHsl(this._r, this._g, this._b); 1911 var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); 1912 return (this._a == 1) ? 1913 "hsl(" + h + ", " + s + "%, " + l + "%)" : 1914 "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; 1915 }, 1916 toHex: function(allow3Char) { 1917 return rgbToHex(this._r, this._g, this._b, allow3Char); 1918 }, 1919 toHexString: function(allow3Char) { 1920 return '#' + this.toHex(allow3Char); 1921 }, 1922 toHex8: function() { 1923 return rgbaToHex(this._r, this._g, this._b, this._a); 1924 }, 1925 toHex8String: function() { 1926 return '#' + this.toHex8(); 1927 }, 1928 toRgb: function() { 1929 return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; 1930 }, 1931 toRgbString: function() { 1932 return (this._a == 1) ? 1933 "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : 1934 "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; 1935 }, 1936 toPercentageRgb: function() { 1937 return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; 1938 }, 1939 toPercentageRgbString: function() { 1940 return (this._a == 1) ? 1941 "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : 1942 "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; 1943 }, 1944 toName: function() { 1945 if (this._a === 0) { 1946 return "transparent"; 1947 } 1948 1949 if (this._a < 1) { 1950 return false; 1951 } 1952 1953 return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; 1954 }, 1955 toFilter: function(secondColor) { 1956 var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a); 1957 var secondHex8String = hex8String; 1958 var gradientType = this._gradientType ? "GradientType = 1, " : ""; 1959 1960 if (secondColor) { 1961 var s = tinycolor(secondColor); 1962 secondHex8String = s.toHex8String(); 1963 } 1964 1965 return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; 1966 }, 1967 toString: function(format) { 1968 var formatSet = !!format; 1969 format = format || this._format; 1970 1971 var formattedString = false; 1972 var hasAlpha = this._a < 1 && this._a >= 0; 1973 var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "name"); 1974 1975 if (needsAlphaFormat) { 1976 // Special case for "transparent", all other non-alpha formats 1977 // will return rgba when there is transparency. 1978 if (format === "name" && this._a === 0) { 1979 return this.toName(); 1980 } 1981 return this.toRgbString(); 1982 } 1983 if (format === "rgb") { 1984 formattedString = this.toRgbString(); 1985 } 1986 if (format === "prgb") { 1987 formattedString = this.toPercentageRgbString(); 1988 } 1989 if (format === "hex" || format === "hex6") { 1990 formattedString = this.toHexString(); 1991 } 1992 if (format === "hex3") { 1993 formattedString = this.toHexString(true); 1994 } 1995 if (format === "hex8") { 1996 formattedString = this.toHex8String(); 1997 } 1998 if (format === "name") { 1999 formattedString = this.toName(); 2000 } 2001 if (format === "hsl") { 2002 formattedString = this.toHslString(); 2003 } 2004 if (format === "hsv") { 2005 formattedString = this.toHsvString(); 2006 } 2007 2008 return formattedString || this.toHexString(); 2009 }, 2010 2011 _applyModification: function(fn, args) { 2012 var color = fn.apply(null, [this].concat([].slice.call(args))); 2013 this._r = color._r; 2014 this._g = color._g; 2015 this._b = color._b; 2016 this.setAlpha(color._a); 2017 return this; 2018 }, 2019 lighten: function() { 2020 return this._applyModification(lighten, arguments); 2021 }, 2022 brighten: function() { 2023 return this._applyModification(brighten, arguments); 2024 }, 2025 darken: function() { 2026 return this._applyModification(darken, arguments); 2027 }, 2028 desaturate: function() { 2029 return this._applyModification(desaturate, arguments); 2030 }, 2031 saturate: function() { 2032 return this._applyModification(saturate, arguments); 2033 }, 2034 greyscale: function() { 2035 return this._applyModification(greyscale, arguments); 2036 }, 2037 spin: function() { 2038 return this._applyModification(spin, arguments); 2039 }, 2040 2041 _applyCombination: function(fn, args) { 2042 return fn.apply(null, [this].concat([].slice.call(args))); 2043 }, 2044 analogous: function() { 2045 return this._applyCombination(analogous, arguments); 2046 }, 2047 complement: function() { 2048 return this._applyCombination(complement, arguments); 2049 }, 2050 monochromatic: function() { 2051 return this._applyCombination(monochromatic, arguments); 2052 }, 2053 splitcomplement: function() { 2054 return this._applyCombination(splitcomplement, arguments); 2055 }, 2056 triad: function() { 2057 return this._applyCombination(triad, arguments); 2058 }, 2059 tetrad: function() { 2060 return this._applyCombination(tetrad, arguments); 2061 } 2062 }; 2063 2064 // If input is an object, force 1 into "1.0" to handle ratios properly 2065 // String input requires "1.0" as input, so 1 will be treated as 1 2066 tinycolor.fromRatio = function(color, opts) { 2067 if (typeof color == "object") { 2068 var newColor = {}; 2069 for (var i in color) { 2070 if (color.hasOwnProperty(i)) { 2071 if (i === "a") { 2072 newColor[i] = color[i]; 2073 } 2074 else { 2075 newColor[i] = convertToPercentage(color[i]); 2076 } 2077 } 2078 } 2079 color = newColor; 2080 } 2081 2082 return tinycolor(color, opts); 2083 }; 2084 2085 // Given a string or object, convert that input to RGB 2086 // Possible string inputs: 2087 // 2088 // "red" 2089 // "#f00" or "f00" 2090 // "#ff0000" or "ff0000" 2091 // "#ff000000" or "ff000000" 2092 // "rgb 255 0 0" or "rgb (255, 0, 0)" 2093 // "rgb 1.0 0 0" or "rgb (1, 0, 0)" 2094 // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" 2095 // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" 2096 // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" 2097 // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" 2098 // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" 2099 // 2100 function inputToRGB(color) { 2101 2102 var rgb = { r: 0, g: 0, b: 0 }; 2103 var a = 1; 2104 var ok = false; 2105 var format = false; 2106 2107 if (typeof color == "string") { 2108 color = stringInputToObject(color); 2109 } 2110 2111 if (typeof color == "object") { 2112 if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) { 2113 rgb = rgbToRgb(color.r, color.g, color.b); 2114 ok = true; 2115 format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; 2116 } 2117 else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) { 2118 color.s = convertToPercentage(color.s); 2119 color.v = convertToPercentage(color.v); 2120 rgb = hsvToRgb(color.h, color.s, color.v); 2121 ok = true; 2122 format = "hsv"; 2123 } 2124 else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) { 2125 color.s = convertToPercentage(color.s); 2126 color.l = convertToPercentage(color.l); 2127 rgb = hslToRgb(color.h, color.s, color.l); 2128 ok = true; 2129 format = "hsl"; 2130 } 2131 2132 if (color.hasOwnProperty("a")) { 2133 a = color.a; 2134 } 2135 } 2136 2137 a = boundAlpha(a); 2138 2139 return { 2140 ok: ok, 2141 format: color.format || format, 2142 r: mathMin(255, mathMax(rgb.r, 0)), 2143 g: mathMin(255, mathMax(rgb.g, 0)), 2144 b: mathMin(255, mathMax(rgb.b, 0)), 2145 a: a 2146 }; 2147 } 2148 2149 2150 // Conversion Functions 2151 // -------------------- 2152 2153 // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: 2154 // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript> 2155 2156 // `rgbToRgb` 2157 // Handle bounds / percentage checking to conform to CSS color spec 2158 // <http://www.w3.org/TR/css3-color/> 2159 // *Assumes:* r, g, b in [0, 255] or [0, 1] 2160 // *Returns:* { r, g, b } in [0, 255] 2161 function rgbToRgb(r, g, b){ 2162 return { 2163 r: bound01(r, 255) * 255, 2164 g: bound01(g, 255) * 255, 2165 b: bound01(b, 255) * 255 2166 }; 2167 } 2168 2169 // `rgbToHsl` 2170 // Converts an RGB color value to HSL. 2171 // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] 2172 // *Returns:* { h, s, l } in [0,1] 2173 function rgbToHsl(r, g, b) { 2174 2175 r = bound01(r, 255); 2176 g = bound01(g, 255); 2177 b = bound01(b, 255); 2178 2179 var max = mathMax(r, g, b), min = mathMin(r, g, b); 2180 var h, s, l = (max + min) / 2; 2181 2182 if(max == min) { 2183 h = s = 0; // achromatic 2184 } 2185 else { 2186 var d = max - min; 2187 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 2188 switch(max) { 2189 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 2190 case g: h = (b - r) / d + 2; break; 2191 case b: h = (r - g) / d + 4; break; 2192 } 2193 2194 h /= 6; 2195 } 2196 2197 return { h: h, s: s, l: l }; 2198 } 2199 2200 // `hslToRgb` 2201 // Converts an HSL color value to RGB. 2202 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] 2203 // *Returns:* { r, g, b } in the set [0, 255] 2204 function hslToRgb(h, s, l) { 2205 var r, g, b; 2206 2207 h = bound01(h, 360); 2208 s = bound01(s, 100); 2209 l = bound01(l, 100); 2210 2211 function hue2rgb(p, q, t) { 2212 if(t < 0) t += 1; 2213 if(t > 1) t -= 1; 2214 if(t < 1/6) return p + (q - p) * 6 * t; 2215 if(t < 1/2) return q; 2216 if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; 2217 return p; 2218 } 2219 2220 if(s === 0) { 2221 r = g = b = l; // achromatic 2222 } 2223 else { 2224 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 2225 var p = 2 * l - q; 2226 r = hue2rgb(p, q, h + 1/3); 2227 g = hue2rgb(p, q, h); 2228 b = hue2rgb(p, q, h - 1/3); 2229 } 2230 2231 return { r: r * 255, g: g * 255, b: b * 255 }; 2232 } 2233 2234 // `rgbToHsv` 2235 // Converts an RGB color value to HSV 2236 // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] 2237 // *Returns:* { h, s, v } in [0,1] 2238 function rgbToHsv(r, g, b) { 2239 2240 r = bound01(r, 255); 2241 g = bound01(g, 255); 2242 b = bound01(b, 255); 2243 2244 var max = mathMax(r, g, b), min = mathMin(r, g, b); 2245 var h, s, v = max; 2246 2247 var d = max - min; 2248 s = max === 0 ? 0 : d / max; 2249 2250 if(max == min) { 2251 h = 0; // achromatic 2252 } 2253 else { 2254 switch(max) { 2255 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 2256 case g: h = (b - r) / d + 2; break; 2257 case b: h = (r - g) / d + 4; break; 2258 } 2259 h /= 6; 2260 } 2261 return { h: h, s: s, v: v }; 2262 } 2263 2264 // `hsvToRgb` 2265 // Converts an HSV color value to RGB. 2266 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] 2267 // *Returns:* { r, g, b } in the set [0, 255] 2268 function hsvToRgb(h, s, v) { 2269 2270 h = bound01(h, 360) * 6; 2271 s = bound01(s, 100); 2272 v = bound01(v, 100); 2273 2274 var i = math.floor(h), 2275 f = h - i, 2276 p = v * (1 - s), 2277 q = v * (1 - f * s), 2278 t = v * (1 - (1 - f) * s), 2279 mod = i % 6, 2280 r = [v, q, p, p, t, v][mod], 2281 g = [t, v, v, q, p, p][mod], 2282 b = [p, p, t, v, v, q][mod]; 2283 2284 return { r: r * 255, g: g * 255, b: b * 255 }; 2285 } 2286 2287 // `rgbToHex` 2288 // Converts an RGB color to hex 2289 // Assumes r, g, and b are contained in the set [0, 255] 2290 // Returns a 3 or 6 character hex 2291 function rgbToHex(r, g, b, allow3Char) { 2292 2293 var hex = [ 2294 pad2(mathRound(r).toString(16)), 2295 pad2(mathRound(g).toString(16)), 2296 pad2(mathRound(b).toString(16)) 2297 ]; 2298 2299 // Return a 3 character hex if possible 2300 if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { 2301 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); 2302 } 2303 2304 return hex.join(""); 2305 } 2306 // `rgbaToHex` 2307 // Converts an RGBA color plus alpha transparency to hex 2308 // Assumes r, g, b and a are contained in the set [0, 255] 2309 // Returns an 8 character hex 2310 function rgbaToHex(r, g, b, a) { 2311 2312 var hex = [ 2313 pad2(convertDecimalToHex(a)), 2314 pad2(mathRound(r).toString(16)), 2315 pad2(mathRound(g).toString(16)), 2316 pad2(mathRound(b).toString(16)) 2317 ]; 2318 2319 return hex.join(""); 2320 } 2321 2322 // `equals` 2323 // Can be called with any tinycolor input 2324 tinycolor.equals = function (color1, color2) { 2325 if (!color1 || !color2) { return false; } 2326 return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); 2327 }; 2328 tinycolor.random = function() { 2329 return tinycolor.fromRatio({ 2330 r: mathRandom(), 2331 g: mathRandom(), 2332 b: mathRandom() 2333 }); 2334 }; 2335 2336 2337 // Modification Functions 2338 // ---------------------- 2339 // Thanks to less.js for some of the basics here 2340 // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js> 2341 2342 function desaturate(color, amount) { 2343 amount = (amount === 0) ? 0 : (amount || 10); 2344 var hsl = tinycolor(color).toHsl(); 2345 hsl.s -= amount / 100; 2346 hsl.s = clamp01(hsl.s); 2347 return tinycolor(hsl); 2348 } 2349 2350 function saturate(color, amount) { 2351 amount = (amount === 0) ? 0 : (amount || 10); 2352 var hsl = tinycolor(color).toHsl(); 2353 hsl.s += amount / 100; 2354 hsl.s = clamp01(hsl.s); 2355 return tinycolor(hsl); 2356 } 2357 2358 function greyscale(color) { 2359 return tinycolor(color).desaturate(100); 2360 } 2361 2362 function lighten (color, amount) { 2363 amount = (amount === 0) ? 0 : (amount || 10); 2364 var hsl = tinycolor(color).toHsl(); 2365 hsl.l += amount / 100; 2366 hsl.l = clamp01(hsl.l); 2367 return tinycolor(hsl); 2368 } 2369 2370 function brighten(color, amount) { 2371 amount = (amount === 0) ? 0 : (amount || 10); 2372 var rgb = tinycolor(color).toRgb(); 2373 rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); 2374 rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); 2375 rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); 2376 return tinycolor(rgb); 2377 } 2378 2379 function darken (color, amount) { 2380 amount = (amount === 0) ? 0 : (amount || 10); 2381 var hsl = tinycolor(color).toHsl(); 2382 hsl.l -= amount / 100; 2383 hsl.l = clamp01(hsl.l); 2384 return tinycolor(hsl); 2385 } 2386 2387 // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. 2388 // Values outside of this range will be wrapped into this range. 2389 function spin(color, amount) { 2390 var hsl = tinycolor(color).toHsl(); 2391 var hue = (mathRound(hsl.h) + amount) % 360; 2392 hsl.h = hue < 0 ? 360 + hue : hue; 2393 return tinycolor(hsl); 2394 } 2395 2396 // Combination Functions 2397 // --------------------- 2398 // Thanks to jQuery xColor for some of the ideas behind these 2399 // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js> 2400 2401 function complement(color) { 2402 var hsl = tinycolor(color).toHsl(); 2403 hsl.h = (hsl.h + 180) % 360; 2404 return tinycolor(hsl); 2405 } 2406 2407 function triad(color) { 2408 var hsl = tinycolor(color).toHsl(); 2409 var h = hsl.h; 2410 return [ 2411 tinycolor(color), 2412 tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), 2413 tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) 2414 ]; 2415 } 2416 2417 function tetrad(color) { 2418 var hsl = tinycolor(color).toHsl(); 2419 var h = hsl.h; 2420 return [ 2421 tinycolor(color), 2422 tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), 2423 tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), 2424 tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) 2425 ]; 2426 } 2427 2428 function splitcomplement(color) { 2429 var hsl = tinycolor(color).toHsl(); 2430 var h = hsl.h; 2431 return [ 2432 tinycolor(color), 2433 tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), 2434 tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) 2435 ]; 2436 } 2437 2438 function analogous(color, results, slices) { 2439 results = results || 6; 2440 slices = slices || 30; 2441 2442 var hsl = tinycolor(color).toHsl(); 2443 var part = 360 / slices; 2444 var ret = [tinycolor(color)]; 2445 2446 for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { 2447 hsl.h = (hsl.h + part) % 360; 2448 ret.push(tinycolor(hsl)); 2449 } 2450 return ret; 2451 } 2452 2453 function monochromatic(color, results) { 2454 results = results || 6; 2455 var hsv = tinycolor(color).toHsv(); 2456 var h = hsv.h, s = hsv.s, v = hsv.v; 2457 var ret = []; 2458 var modification = 1 / results; 2459 2460 while (results--) { 2461 ret.push(tinycolor({ h: h, s: s, v: v})); 2462 v = (v + modification) % 1; 2463 } 2464 2465 return ret; 2466 } 2467 2468 // Utility Functions 2469 // --------------------- 2470 2471 tinycolor.mix = function(color1, color2, amount) { 2472 amount = (amount === 0) ? 0 : (amount || 50); 2473 2474 var rgb1 = tinycolor(color1).toRgb(); 2475 var rgb2 = tinycolor(color2).toRgb(); 2476 2477 var p = amount / 100; 2478 var w = p * 2 - 1; 2479 var a = rgb2.a - rgb1.a; 2480 2481 var w1; 2482 2483 if (w * a == -1) { 2484 w1 = w; 2485 } else { 2486 w1 = (w + a) / (1 + w * a); 2487 } 2488 2489 w1 = (w1 + 1) / 2; 2490 2491 var w2 = 1 - w1; 2492 2493 var rgba = { 2494 r: rgb2.r * w1 + rgb1.r * w2, 2495 g: rgb2.g * w1 + rgb1.g * w2, 2496 b: rgb2.b * w1 + rgb1.b * w2, 2497 a: rgb2.a * p + rgb1.a * (1 - p) 2498 }; 2499 2500 return tinycolor(rgba); 2501 }; 2502 2503 2504 // Readability Functions 2505 // --------------------- 2506 // <http://www.w3.org/TR/AERT#color-contrast> 2507 2508 // `readability` 2509 // Analyze the 2 colors and returns an object with the following properties: 2510 // `brightness`: difference in brightness between the two colors 2511 // `color`: difference in color/hue between the two colors 2512 tinycolor.readability = function(color1, color2) { 2513 var c1 = tinycolor(color1); 2514 var c2 = tinycolor(color2); 2515 var rgb1 = c1.toRgb(); 2516 var rgb2 = c2.toRgb(); 2517 var brightnessA = c1.getBrightness(); 2518 var brightnessB = c2.getBrightness(); 2519 var colorDiff = ( 2520 Math.max(rgb1.r, rgb2.r) - Math.min(rgb1.r, rgb2.r) + 2521 Math.max(rgb1.g, rgb2.g) - Math.min(rgb1.g, rgb2.g) + 2522 Math.max(rgb1.b, rgb2.b) - Math.min(rgb1.b, rgb2.b) 2523 ); 2524 2525 return { 2526 brightness: Math.abs(brightnessA - brightnessB), 2527 color: colorDiff 2528 }; 2529 }; 2530 2531 // `readable` 2532 // http://www.w3.org/TR/AERT#color-contrast 2533 // Ensure that foreground and background color combinations provide sufficient contrast. 2534 // *Example* 2535 // tinycolor.isReadable("#000", "#111") => false 2536 tinycolor.isReadable = function(color1, color2) { 2537 var readability = tinycolor.readability(color1, color2); 2538 return readability.brightness > 125 && readability.color > 500; 2539 }; 2540 2541 // `mostReadable` 2542 // Given a base color and a list of possible foreground or background 2543 // colors for that base, returns the most readable color. 2544 // *Example* 2545 // tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000" 2546 tinycolor.mostReadable = function(baseColor, colorList) { 2547 var bestColor = null; 2548 var bestScore = 0; 2549 var bestIsReadable = false; 2550 for (var i=0; i < colorList.length; i++) { 2551 2552 // We normalize both around the "acceptable" breaking point, 2553 // but rank brightness constrast higher than hue. 2554 2555 var readability = tinycolor.readability(baseColor, colorList[i]); 2556 var readable = readability.brightness > 125 && readability.color > 500; 2557 var score = 3 * (readability.brightness / 125) + (readability.color / 500); 2558 2559 if ((readable && ! bestIsReadable) || 2560 (readable && bestIsReadable && score > bestScore) || 2561 ((! readable) && (! bestIsReadable) && score > bestScore)) { 2562 bestIsReadable = readable; 2563 bestScore = score; 2564 bestColor = tinycolor(colorList[i]); 2565 } 2566 } 2567 return bestColor; 2568 }; 2569 2570 2571 // Big List of Colors 2572 // ------------------ 2573 // <http://www.w3.org/TR/css3-color/#svg-color> 2574 var names = tinycolor.names = { 2575 aliceblue: "f0f8ff", 2576 antiquewhite: "faebd7", 2577 aqua: "0ff", 2578 aquamarine: "7fffd4", 2579 azure: "f0ffff", 2580 beige: "f5f5dc", 2581 bisque: "ffe4c4", 2582 black: "000", 2583 blanchedalmond: "ffebcd", 2584 blue: "00f", 2585 blueviolet: "8a2be2", 2586 brown: "a52a2a", 2587 burlywood: "deb887", 2588 burntsienna: "ea7e5d", 2589 cadetblue: "5f9ea0", 2590 chartreuse: "7fff00", 2591 chocolate: "d2691e", 2592 coral: "ff7f50", 2593 cornflowerblue: "6495ed", 2594 cornsilk: "fff8dc", 2595 crimson: "dc143c", 2596 cyan: "0ff", 2597 darkblue: "00008b", 2598 darkcyan: "008b8b", 2599 darkgoldenrod: "b8860b", 2600 darkgray: "a9a9a9", 2601 darkgreen: "006400", 2602 darkgrey: "a9a9a9", 2603 darkkhaki: "bdb76b", 2604 darkmagenta: "8b008b", 2605 darkolivegreen: "556b2f", 2606 darkorange: "ff8c00", 2607 darkorchid: "9932cc", 2608 darkred: "8b0000", 2609 darksalmon: "e9967a", 2610 darkseagreen: "8fbc8f", 2611 darkslateblue: "483d8b", 2612 darkslategray: "2f4f4f", 2613 darkslategrey: "2f4f4f", 2614 darkturquoise: "00ced1", 2615 darkviolet: "9400d3", 2616 deeppink: "ff1493", 2617 deepskyblue: "00bfff", 2618 dimgray: "696969", 2619 dimgrey: "696969", 2620 dodgerblue: "1e90ff", 2621 firebrick: "b22222", 2622 floralwhite: "fffaf0", 2623 forestgreen: "228b22", 2624 fuchsia: "f0f", 2625 gainsboro: "dcdcdc", 2626 ghostwhite: "f8f8ff", 2627 gold: "ffd700", 2628 goldenrod: "daa520", 2629 gray: "808080", 2630 green: "008000", 2631 greenyellow: "adff2f", 2632 grey: "808080", 2633 honeydew: "f0fff0", 2634 hotpink: "ff69b4", 2635 indianred: "cd5c5c", 2636 indigo: "4b0082", 2637 ivory: "fffff0", 2638 khaki: "f0e68c", 2639 lavender: "e6e6fa", 2640 lavenderblush: "fff0f5", 2641 lawngreen: "7cfc00", 2642 lemonchiffon: "fffacd", 2643 lightblue: "add8e6", 2644 lightcoral: "f08080", 2645 lightcyan: "e0ffff", 2646 lightgoldenrodyellow: "fafad2", 2647 lightgray: "d3d3d3", 2648 lightgreen: "90ee90", 2649 lightgrey: "d3d3d3", 2650 lightpink: "ffb6c1", 2651 lightsalmon: "ffa07a", 2652 lightseagreen: "20b2aa", 2653 lightskyblue: "87cefa", 2654 lightslategray: "789", 2655 lightslategrey: "789", 2656 lightsteelblue: "b0c4de", 2657 lightyellow: "ffffe0", 2658 lime: "0f0", 2659 limegreen: "32cd32", 2660 linen: "faf0e6", 2661 magenta: "f0f", 2662 maroon: "800000", 2663 mediumaquamarine: "66cdaa", 2664 mediumblue: "0000cd", 2665 mediumorchid: "ba55d3", 2666 mediumpurple: "9370db", 2667 mediumseagreen: "3cb371", 2668 mediumslateblue: "7b68ee", 2669 mediumspringgreen: "00fa9a", 2670 mediumturquoise: "48d1cc", 2671 mediumvioletred: "c71585", 2672 midnightblue: "191970", 2673 mintcream: "f5fffa", 2674 mistyrose: "ffe4e1", 2675 moccasin: "ffe4b5", 2676 navajowhite: "ffdead", 2677 navy: "000080", 2678 oldlace: "fdf5e6", 2679 olive: "808000", 2680 olivedrab: "6b8e23", 2681 orange: "ffa500", 2682 orangered: "ff4500", 2683 orchid: "da70d6", 2684 palegoldenrod: "eee8aa", 2685 palegreen: "98fb98", 2686 paleturquoise: "afeeee", 2687 palevioletred: "db7093", 2688 papayawhip: "ffefd5", 2689 peachpuff: "ffdab9", 2690 peru: "cd853f", 2691 pink: "ffc0cb", 2692 plum: "dda0dd", 2693 powderblue: "b0e0e6", 2694 purple: "800080", 2695 rebeccapurple: "663399", 2696 red: "f00", 2697 rosybrown: "bc8f8f", 2698 royalblue: "4169e1", 2699 saddlebrown: "8b4513", 2700 salmon: "fa8072", 2701 sandybrown: "f4a460", 2702 seagreen: "2e8b57", 2703 seashell: "fff5ee", 2704 sienna: "a0522d", 2705 silver: "c0c0c0", 2706 skyblue: "87ceeb", 2707 slateblue: "6a5acd", 2708 slategray: "708090", 2709 slategrey: "708090", 2710 snow: "fffafa", 2711 springgreen: "00ff7f", 2712 steelblue: "4682b4", 2713 tan: "d2b48c", 2714 teal: "008080", 2715 thistle: "d8bfd8", 2716 tomato: "ff6347", 2717 turquoise: "40e0d0", 2718 violet: "ee82ee", 2719 wheat: "f5deb3", 2720 white: "fff", 2721 whitesmoke: "f5f5f5", 2722 yellow: "ff0", 2723 yellowgreen: "9acd32" 2724 }; 2725 2726 // Make it easy to access colors via `hexNames[hex]` 2727 var hexNames = tinycolor.hexNames = flip(names); 2728 2729 2730 // Utilities 2731 // --------- 2732 2733 // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` 2734 function flip(o) { 2735 var flipped = { }; 2736 for (var i in o) { 2737 if (o.hasOwnProperty(i)) { 2738 flipped[o[i]] = i; 2739 } 2740 } 2741 return flipped; 2742 } 2743 2744 // Return a valid alpha value [0,1] with all invalid values being set to 1 2745 function boundAlpha(a) { 2746 a = parseFloat(a); 2747 2748 if (isNaN(a) || a < 0 || a > 1) { 2749 a = 1; 2750 } 2751 2752 return a; 2753 } 2754 2755 // Take input from [0, n] and return it as [0, 1] 2756 function bound01(n, max) { 2757 if (isOnePointZero(n)) { n = "100%"; } 2758 2759 var processPercent = isPercentage(n); 2760 n = mathMin(max, mathMax(0, parseFloat(n))); 2761 2762 // Automatically convert percentage into number 2763 if (processPercent) { 2764 n = parseInt(n * max, 10) / 100; 2765 } 2766 2767 // Handle floating point rounding errors 2768 if ((math.abs(n - max) < 0.000001)) { 2769 return 1; 2770 } 2771 2772 // Convert into [0, 1] range if it isn't already 2773 return (n % max) / parseFloat(max); 2774 } 2775 2776 // Force a number between 0 and 1 2777 function clamp01(val) { 2778 return mathMin(1, mathMax(0, val)); 2779 } 2780 2781 // Parse a base-16 hex value into a base-10 integer 2782 function parseIntFromHex(val) { 2783 return parseInt(val, 16); 2784 } 2785 2786 // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 2787 // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0> 2788 function isOnePointZero(n) { 2789 return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; 2790 } 2791 2792 // Check to see if string passed in is a percentage 2793 function isPercentage(n) { 2794 return typeof n === "string" && n.indexOf('%') != -1; 2795 } 2796 2797 // Force a hex value to have 2 characters 2798 function pad2(c) { 2799 return c.length == 1 ? '0' + c : '' + c; 2800 } 2801 2802 // Replace a decimal with it's percentage value 2803 function convertToPercentage(n) { 2804 if (n <= 1) { 2805 n = (n * 100) + "%"; 2806 } 2807 2808 return n; 2809 } 2810 2811 // Converts a decimal to a hex value 2812 function convertDecimalToHex(d) { 2813 return Math.round(parseFloat(d) * 255).toString(16); 2814 } 2815 // Converts a hex value to a decimal 2816 function convertHexToDecimal(h) { 2817 return (parseIntFromHex(h) / 255); 2818 } 2819 2820 var matchers = (function() { 2821 2822 // <http://www.w3.org/TR/css3-values/#integers> 2823 var CSS_INTEGER = "[-\\+]?\\d+%?"; 2824 2825 // <http://www.w3.org/TR/css3-values/#number-value> 2826 var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; 2827 2828 // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. 2829 var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; 2830 2831 // Actual matching. 2832 // Parentheses and commas are optional, but not required. 2833 // Whitespace can take the place of commas or opening paren 2834 var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 2835 var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 2836 2837 return { 2838 rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), 2839 rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), 2840 hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), 2841 hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), 2842 hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), 2843 hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), 2844 hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 2845 hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, 2846 hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ 2847 }; 2848 })(); 2849 2850 // `stringInputToObject` 2851 // Permissive string parsing. Take in a number of formats, and output an object 2852 // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` 2853 function stringInputToObject(color) { 2854 2855 color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); 2856 var named = false; 2857 if (names[color]) { 2858 color = names[color]; 2859 named = true; 2860 } 2861 else if (color == 'transparent') { 2862 return { r: 0, g: 0, b: 0, a: 0, format: "name" }; 2863 } 2864 2865 // Try to match string input using regular expressions. 2866 // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] 2867 // Just return an object and let the conversion functions handle that. 2868 // This way the result will be the same whether the tinycolor is initialized with string or object. 2869 var match; 2870 if ((match = matchers.rgb.exec(color))) { 2871 return { r: match[1], g: match[2], b: match[3] }; 2872 } 2873 if ((match = matchers.rgba.exec(color))) { 2874 return { r: match[1], g: match[2], b: match[3], a: match[4] }; 2875 } 2876 if ((match = matchers.hsl.exec(color))) { 2877 return { h: match[1], s: match[2], l: match[3] }; 2878 } 2879 if ((match = matchers.hsla.exec(color))) { 2880 return { h: match[1], s: match[2], l: match[3], a: match[4] }; 2881 } 2882 if ((match = matchers.hsv.exec(color))) { 2883 return { h: match[1], s: match[2], v: match[3] }; 2884 } 2885 if ((match = matchers.hsva.exec(color))) { 2886 return { h: match[1], s: match[2], v: match[3], a: match[4] }; 2887 } 2888 if ((match = matchers.hex8.exec(color))) { 2889 return { 2890 a: convertHexToDecimal(match[1]), 2891 r: parseIntFromHex(match[2]), 2892 g: parseIntFromHex(match[3]), 2893 b: parseIntFromHex(match[4]), 2894 format: named ? "name" : "hex8" 2895 }; 2896 } 2897 if ((match = matchers.hex6.exec(color))) { 2898 return { 2899 r: parseIntFromHex(match[1]), 2900 g: parseIntFromHex(match[2]), 2901 b: parseIntFromHex(match[3]), 2902 format: named ? "name" : "hex" 2903 }; 2904 } 2905 if ((match = matchers.hex3.exec(color))) { 2906 return { 2907 r: parseIntFromHex(match[1] + '' + match[1]), 2908 g: parseIntFromHex(match[2] + '' + match[2]), 2909 b: parseIntFromHex(match[3] + '' + match[3]), 2910 format: named ? "name" : "hex" 2911 }; 2912 } 2913 2914 return false; 2915 } 2916 2917 window.tinycolor = tinycolor; 2918 })(); 2919 2920 $(function () { 2921 if ($.fn.spectrum.load) { 2922 $.fn.spectrum.processNativeColorInputs(); 2923 } 2924 }); 2925 2926});
2927 2928/* End */ 2929; 2930; /* Start:"a:4:{s:4:"full";s:62:"/local/templates/elektro_flat/js/countUp.min.js?15330357782608";s:6:"source";s:47:"/local/templates/elektro_flat/js/countUp.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 2931function countUp(a,b,c,d,e,f){this.options=f||{useEasing:!0,useGrouping:!0,separator:",",decimal:"."};for(var g=0,h=["webkit","moz","ms"],i=0;i<h.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[h[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[h[i]+"CancelAnimationFrame"]||window[h[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var c=(new Date).getTime(),d=Math.max(0,16-(c-g)),e=window.setTimeout(function(){a(c+d)},d);return g=c+d,e}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});var j=this;this.d="string"==typeof a?document.getElementById(a):a,this.startVal=Number(b),this.endVal=Number(c),this.countDown=this.startVal>this.endVal?!0:!1,this.startTime=null,this.timestamp=null,this.remaining=null,this.frameVal=this.startVal,this.rAF=null,this.decimals=Math.max(0,d||0),this.dec=Math.pow(10,this.decimals),this.duration=1e3*e||2e3,this.easeOutExpo=function(a,b,c,d){return 1024*c*(-Math.pow(2,-10*a/d)+1)/1023+b},this.count=function(a){null===j.startTime&&(j.startTime=a),j.timestamp=a;var b=a-j.startTime;if(j.remaining=j.duration-b,j.options.useEasing)if(j.countDown){var c=j.easeOutExpo(b,0,j.startVal-j.endVal,j.duration);j.frameVal=j.startVal-c}else j.frameVal=j.easeOutExpo(b,j.startVal,j.endVal-j.startVal,j.duration);else if(j.countDown){var c=(j.startVal-j.endVal)*(b/j.duration);j.frameVal=j.startVal-c}else j.frameVal=j.startVal+(j.endVal-j.startVal)*(b/j.duration);j.frameVal=Math.round(j.frameVal*j.dec)/j.dec,j.frameVal=j.countDown?j.frameVal<j.endVal?j.endVal:j.frameVal:j.frameVal>j.endVal?j.endVal:j.frameVal,j.d.innerHTML=j.formatNumber(j.frameVal.toFixed(j.decimals)),b<j.duration?j.rAF=requestAnimationFrame(j.count):null!=j.callback&&j.callback()},this.start=function(a){return j.callback=a,isNaN(j.endVal)||isNaN(j.startVal)?(console.log("countUp error: startVal or endVal is not a number"),j.d.innerHTML="--"):j.rAF=requestAnimationFrame(j.count),!1},this.stop=function(){cancelAnimationFrame(j.rAF)},this.reset=function(){j.startTime=null,cancelAnimationFrame(j.rAF),j.d.innerHTML=j.formatNumber(j.startVal.toFixed(j.decimals))},this.resume=function(){j.startTime=null,j.duration=j.remaining,j.startVal=j.frameVal,requestAnimationFrame(j.count)},this.formatNumber=function(a){a+="";var b,c,d,e;if(b=a.split("."),c=b[0],d=b.length>1?j.options.decimal+b[1]:"",e=/(\d+)(\d{3})/,j.options.useGrouping)for(;e.test(c);)c=c.replace(e,"$1"+j.options.separator+"$2");return c+d},j.d.innerHTML=j.formatNumber(j.startVal.toFixed(j.decimals))} 2932/* End */ 2933; 2934; /* Start:"a:4:{s:4:"full";s:75:"/local/templates/elektro_flat/js/countdown/jquery.plugin.js?153303577811513";s:6:"source";s:59:"/local/templates/elektro_flat/js/countdown/jquery.plugin.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 2935/* Simple JavaScript Inheritance 2936 * By John Resig http://ejohn.org/ 2937 * MIT Licensed. 2938 */ 2939// Inspired by base2 and Prototype 2940(function(){ 2941 var initializing = false; 2942 2943 // The base JQClass implementation (does nothing) 2944 window.JQClass = function(){}; 2945 2946 // Collection of derived classes 2947 JQClass.classes = {}; 2948 2949 // Create a new JQClass that inherits from this class 2950 JQClass.extend = function extender(prop) { 2951 var base = this.prototype; 2952 2953 // Instantiate a base class (but only create the instance, 2954 // don't run the init constructor) 2955 initializing = true; 2956 var prototype = new this(); 2957 initializing = false; 2958 2959 // Copy the properties over onto the new prototype 2960 for (var name in prop) { 2961 // Check if we're overwriting an existing function 2962 prototype[name] = typeof prop[name] == 'function' && 2963 typeof base[name] == 'function' ? 2964 (function(name, fn){ 2965 return function() { 2966 var __super = this._super; 2967 2968 // Add a new ._super() method that is the same method 2969 // but on the super-class 2970 this._super = function(args) { 2971 return base[name].apply(this, args || []); 2972 }; 2973 2974 var ret = fn.apply(this, arguments); 2975 2976 // The method only need to be bound temporarily, so we 2977 // remove it when we're done executing 2978 this._super = __super; 2979 2980 return ret; 2981 }; 2982 })(name, prop[name]) : 2983 prop[name]; 2984 } 2985 2986 // The dummy class constructor 2987 function JQClass() { 2988 // All construction is actually done in the init method 2989 if (!initializing && this._init) { 2990 this._init.apply(this, arguments); 2991 } 2992 } 2993 2994 // Populate our constructed prototype object 2995 JQClass.prototype = prototype; 2996 2997 // Enforce the constructor to be what we expect 2998 JQClass.prototype.constructor = JQClass; 2999 3000 // And make this class extendable 3001 JQClass.extend = extender; 3002 3003 return JQClass; 3004 }; 3005})(); 3006 3007(function($) { // Ensure $, encapsulate 3008
3009 /** Abstract base class for collection plugins v1.0.1. 3010 Written by Keith Wood (kbwood{at}iinet.com.au) December 2013. 3011 Licensed under the MIT (http://keith-wood.name/licence.html) license. 3012 @module $.JQPlugin 3013 @abstract */ 3014 JQClass.classes.JQPlugin = JQClass.extend({ 3015 3016 /** Name to identify this plugin. 3017 @example name: 'tabs' */ 3018 name: 'plugin', 3019 3020 /** Default options for instances of this plugin (default: {}). 3021 @example defaultOptions: { 3022 selectedClass: 'selected', 3023 triggers: 'click' 3024 } */ 3025 defaultOptions: {}, 3026 3027 /** Options dependent on the locale. 3028 Indexed by language and (optional) country code, with '' denoting the default language (English/US). 3029 @example regionalOptions: { 3030 '': { 3031 greeting: 'Hi' 3032 } 3033 } */ 3034 regionalOptions: {}, 3035 3036 /** Names of getter methods - those that can't be chained (default: []). 3037 @example _getters: ['activeTab'] */ 3038 _getters: [], 3039 3040 /** Retrieve a marker class for affected elements. 3041 @private 3042 @return {string} The marker class. */ 3043 _getMarker: function() { 3044 return 'is-' + this.name; 3045 }, 3046 3047 /** Initialise the plugin. 3048 Create the jQuery bridge - plugin name <code>xyz</code> 3049 produces <code>$.xyz</code> and <code>$.fn.xyz</code>. */ 3050 _init: function() { 3051 // Apply default localisations 3052 $.extend(this.defaultOptions, (this.regionalOptions && this.regionalOptions['']) || {}); 3053 // Camel-case the name 3054 var jqName = camelCase(this.name); 3055 // Expose jQuery singleton manager 3056 $[jqName] = this; 3057 // Expose jQuery collection plugin 3058 $.fn[jqName] = function(options) { 3059 var otherArgs = Array.prototype.slice.call(arguments, 1); 3060 if ($[jqName]._isNotChained(options, otherArgs)) { 3061 return $[jqName][options].apply($[jqName], [this[0]].concat(otherArgs)); 3062 } 3063 return this.each(function() { 3064 if (typeof options === 'string') { 3065 if (options[0] === '_' || !$[jqName][options]) { 3066 throw 'Unknown method: ' + options; 3067 } 3068 $[jqName][options].apply($[jqName], [this].concat(otherArgs)); 3069 } 3070 else { 3071 $[jqName]._attach(this, options); 3072 } 3073 }); 3074 }; 3075 }, 3076 3077 /** Set default values for all subsequent instances. 3078 @param options {object} The new default options. 3079 @example $.plugin.setDefauls({name: value}) */ 3080 setDefaults: function(options) { 3081 $.extend(this.defaultOptions, options || {}); 3082 }, 3083 3084 /** Determine whether a method is a getter and doesn't permit chaining. 3085 @private 3086 @param name {string} The method name. 3087 @param otherArgs {any[]} Any other arguments for the method. 3088 @return {boolean} True if this method is a getter, false otherwise. */ 3089 _isNotChained: function(name, otherArgs) { 3090 if (name === 'option' && (otherArgs.length === 0 || 3091 (otherArgs.length === 1 && typeof otherArgs[0] === 'string'))) { 3092 return true; 3093 } 3094 return $.inArray(name, this._getters) > -1; 3095 }, 3096 3097 /** Initialise an element. Called internally only. 3098 Adds an instance object as data named for the plugin. 3099 @param elem {Element} The element to enhance. 3100 @param options {object} Overriding settings. */ 3101 _attach: function(elem, options) { 3102 elem = $(elem); 3103 if (elem.hasClass(this._getMarker())) { 3104 return; 3105 } 3106 elem.addClass(this._getMarker()); 3107 options = $.extend({}, this.defaultOptions, this._getMetadata(elem), options || {}); 3108 var inst = $.extend({name: this.name, elem: elem, options: options}, 3109 this._instSettings(elem, options)); 3110 elem.data(this.name, inst); // Save instance against element 3111 this._postAttach(elem, inst); 3112 this.option(elem, options); 3113 }, 3114 3115 /** Retrieve additional instance settings. 3116 Override this in a sub-class to provide extra settings. 3117 @param elem {jQuery} The current jQuery element. 3118 @param options {object} The instance options. 3119 @return {object} Any extra instance values. 3120 @example _instSettings: function(elem, options) { 3121 return {nav: elem.find(options.navSelector)}; 3122 } */ 3123 _instSettings: function(elem, options) { 3124 return {}; 3125 }, 3126 3127 /** Plugin specific post initialisation. 3128 Override this in a sub-class to perform extra activities. 3129 @param elem {jQuery} The current jQuery element. 3130 @param inst {object} The instance settings. 3131 @example _postAttach: function(elem, inst) { 3132 elem.on('click.' + this.name, function() { 3133 ... 3134 }); 3135 } */ 3136 _postAttach: function(elem, inst) { 3137 }, 3138 3139 /** Retrieve metadata configuration from the element. 3140 Metadata is specified as an attribute: 3141 <code>data-<plugin name>="<setting name>: '<value>', ..."</code>. 3142 Dates should be specified as strings in this format: 'new Date(y, m-1, d)'. 3143 @private 3144 @param elem {jQuery} The source element. 3145 @return {object} The inline configuration or {}. */ 3146 _getMetadata: function(elem) { 3147 try { 3148 var data = elem.data(this.name.toLowerCase()) || ''; 3149 data = data.replace(/'/g, '"'); 3150 data = data.replace(/([a-zA-Z0-9]+):/g, function(match, group, i) { 3151 var count = data.substring(0, i).match(/"/g); // Handle embedded ':' 3152 return (!count || count.length % 2 === 0 ? '"' + group + '":' : group + ':'); 3153 }); 3154 data = $.parseJSON('{' + data + '}'); 3155 for (var name in data) { // Convert dates 3156 var value = data[name]; 3157 if (typeof value === 'string' && value.match(/^new Date\((.*)\)$/)) { 3158 data[name] = eval(value); 3159 } 3160 } 3161 return data; 3162 } 3163 catch (e) { 3164 return {}; 3165 } 3166 }, 3167 3168 /** Retrieve the instance data for element. 3169 @param elem {Element} The source element. 3170 @return {object} The instance data or {}. */ 3171 _getInst: function(elem) { 3172 return $(elem).data(this.name) || {}; 3173 }, 3174 3175 /** Retrieve or reconfigure the settings for a plugin. 3176 @param elem {Element} The source element. 3177 @param name {object|string} The collection of new option values or the name of a single option. 3178 @param [value] {any} The value for a single named option. 3179 @return {any|object} If retrieving a single value or all options. 3180 @example $(selector).plugin('option', 'name', value) 3181 $(selector).plugin('option', {name: value, ...}) 3182 var value = $(selector).plugin('option', 'name') 3183 var options = $(selector).plugin('option') */ 3184 option: function(elem, name, value) { 3185 elem = $(elem); 3186 var inst = elem.data(this.name); 3187 if (!name || (typeof name === 'string' && value == null)) { 3188 var options = (inst || {}).options; 3189 return (options && name ? options[name] : options); 3190 } 3191 if (!elem.hasClass(this._getMarker())) { 3192 return; 3193 } 3194 var options = name || {}; 3195 if (typeof name === 'string') { 3196 options = {}; 3197 options[name] = value; 3198 } 3199 this._optionsChanged(elem, inst, options); 3200 $.extend(inst.options, options); 3201 }, 3202 3203 /** Plugin specific options processing. 3204 Old value available in <code>inst.options[name]</code>, new value in <code>options[name]</code>. 3205 Override this in a sub-class to perform extra activities. 3206 @param elem {jQuery} The current jQuery element. 3207 @param inst {object} The instance settings. 3208 @param options {object} The new options. 3209 @example _optionsChanged: function(elem, inst, options) { 3210 if (options.name != inst.options.name) { 3211 elem.removeClass(inst.options.name).addClass(options.name); 3212 } 3213 } */ 3214 _optionsChanged: function(elem, inst, options) { 3215 }, 3216 3217 /** Remove all trace of the plugin. 3218 Override <code>_preDestroy</code> for plugin-specific processing. 3219 @param elem {Element} The source element. 3220 @example $(selector).plugin('destroy') */ 3221 destroy: function(elem) { 3222 elem = $(elem); 3223 if (!elem.hasClass(this._getMarker())) { 3224 return; 3225 } 3226 this._preDestroy(elem, this._getInst(elem)); 3227 elem.removeData(this.name).removeClass(this._getMarker()); 3228 }, 3229 3230 /** Plugin specific pre destruction. 3231 Override this in a sub-class to perform extra activities and undo everything that was 3232 done in the <code>_postAttach</code> or <code>_optionsChanged</code> functions. 3233 @param elem {jQuery} The current jQuery element. 3234 @param inst {object} The instance settings. 3235 @example _preDestroy: function(elem, inst) { 3236 elem.off('.' + this.name); 3237 } */ 3238 _preDestroy: function(elem, inst) { 3239 } 3240 }); 3241 3242 /** Convert names from hyphenated to camel-case. 3243 @private 3244 @param value {string} The original hyphenated name. 3245 @return {string} The camel-case version. */ 3246 function camelCase(name) { 3247 return name.replace(/-([a-z])/g, function(match, group) { 3248 return group.toUpperCase(); 3249 }); 3250 } 3251 3252 /** Expose the plugin base. 3253 @namespace "$.JQPlugin" */ 3254 $.JQPlugin = { 3255 3256 /** Create a new collection plugin. 3257 @memberof "$.JQPlugin"
3258 @param [superClass='JQPlugin'] {string} The name of the parent class to inherit from. 3259 @param overrides {object} The property/function overrides for the new class. 3260 @example $.JQPlugin.createPlugin({ 3261 name: 'tabs', 3262 defaultOptions: {selectedClass: 'selected'}, 3263 _initSettings: function(elem, options) { return {...}; }, 3264 _postAttach: function(elem, inst) { ... } 3265 }); */ 3266 createPlugin: function(superClass, overrides) { 3267 if (typeof superClass === 'object') { 3268 overrides = superClass; 3269 superClass = 'JQPlugin'; 3270 } 3271 superClass = camelCase(superClass); 3272 var className = camelCase(overrides.name); 3273 JQClass.classes[className] = JQClass.classes[superClass].extend(overrides); 3274 new JQClass.classes[className](); 3275 } 3276 }; 3277 3278})(jQuery); 3279/* End */ 3280; 3281; /* Start:"a:4:{s:4:"full";s:78:"/local/templates/elektro_flat/js/countdown/jquery.countdown.js?153303577835864";s:6:"source";s:62:"/local/templates/elektro_flat/js/countdown/jquery.countdown.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3282/* http://keith-wood.name/countdown.html 3283 Countdown for jQuery v2.0.2. 3284 Written by Keith Wood (kbwood{at}iinet.com.au) January 2008. 3285 Available under the MIT (http://keith-wood.name/licence.html) license. 3286 Please attribute the author if you use it. */ 3287 3288(function($) { // Hide scope, no $ conflict 3289 3290 var pluginName = 'countdown'; 3291 3292 var Y = 0; // Years 3293 var O = 1; // Months 3294 var W = 2; // Weeks 3295 var D = 3; // Days 3296 var H = 4; // Hours 3297 var M = 5; // Minutes 3298 var S = 6; // Seconds 3299 3300 /** Create the countdown plugin. 3301 <p>Sets an element to show the time remaining until a given instant.</p> 3302 <p>Expects HTML like:</p> 3303 <pre><div></div></pre> 3304 <p>Provide inline configuration like:</p> 3305 <pre><div data-countdown="name: 'value'"></div></pre> 3306 @module Countdown 3307 @augments JQPlugin 3308 @example $(selector).countdown({until: +300}) */ 3309 $.JQPlugin.createPlugin({ 3310 3311 /** The name of the plugin. */ 3312 name: pluginName, 3313 3314 /** Countdown expiry callback. 3315 Triggered when the countdown expires. 3316 @callback expiryCallback */ 3317 3318 /** Countdown server synchronisation callback. 3319 Triggered when the countdown is initialised. 3320 @callback serverSyncCallback 3321 @return {Date} The current date/time on the server as expressed in the local timezone. */ 3322 3323 /** Countdown tick callback. 3324 Triggered on every <code>tickInterval</code> ticks of the countdown. 3325 @callback tickCallback 3326 @param periods {number[]} The breakdown by period (years, months, weeks, days, 3327 hours, minutes, seconds) of the time remaining/passed. */ 3328 3329 /** Countdown which labels callback. 3330 Triggered when the countdown is being display to determine which set of labels 3331 (<code>labels</code>, <code>labels1</code>, ...) are to be used for the current period value. 3332 @callback whichLabelsCallback 3333 @param num {number} The current period value. 3334 @return {number} The suffix for the label set to use. */ 3335 3336 /** Default settings for the plugin. 3337 @property until {Date|number|string} The date/time to count down to, or number of seconds 3338 offset from now, or string of amounts and units for offset(s) from now: 3339 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds. 3340 @example until: new Date(2013, 12-1, 25, 13, 30) 3341 until: +300 3342 until: '+1O -2D' 3343 @property [since] {Date|number|string} The date/time to count up from, or 3344 number of seconds offset from now, or string for unit offset(s): 3345 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds. 3346 @example since: new Date(2013, 1-1, 1) 3347 since: -300 3348 since: '-1O +2D' 3349 @property [timezone=null] {number} The timezone (hours or minutes from GMT) for the target times, 3350 or null for client local timezone. 3351 @example timezone: +10 3352 timezone: -60 3353 @property [serverSync=null] {serverSyncCallback} A function to retrieve the current server time 3354 for synchronisation. 3355 @property [format='dHMS'] {string} The format for display - upper case for always, lower case only if non-zero, 3356 'Y' years, 'O' months, 'W' weeks, 'D' days, 'H' hours, 'M' minutes, 'S' seconds. 3357 @property [layout=''] {string} Build your own layout for the countdown. 3358 @example layout: '{d<}{dn} {dl}{d>} {hnn}:{mnn}:{snn}' 3359 @property [compact=false] {boolean} True to display in a compact format, false for an expanded one. 3360 @property [padZeroes=false] {boolean} True to add leading zeroes 3361 @property [significant=0] {number} The number of periods with non-zero values to show, zero for all. 3362 @property [description=''] {string} The description displayed for the countdown. 3363 @property [expiryUrl=''] {string} A URL to load upon expiry, replacing the current page. 3364 @property [expiryText=''] {string} Text to display upon expiry, replacing the countdown. This may be HTML. 3365 @property [alwaysExpire=false] {boolean} True to trigger <code>onExpiry</code> even if target time has passed. 3366 @property [onExpiry=null] {expiryCallback} Callback when the countdown expires - 3367 receives no parameters and <code>this</code> is the containing division. 3368 @example onExpiry: function() { 3369 ... 3370 } 3371 @property [onTick=null] {tickCallback} Callback when the countdown is updated - 3372 receives <code>number[7]</code> being the breakdown by period 3373 (years, months, weeks, days, hours, minutes, seconds - based on 3374 <code>format</code>) and <code>this</code> is the containing division. 3375 @example onTick: function(periods) { 3376 var secs = $.countdown.periodsToSeconds(periods); 3377 if (secs < 300) { // Last five minutes 3378 ... 3379 } 3380 } 3381 @property [tickInterval=1] {number} The interval (seconds) between <code>onTick</code> callbacks. */ 3382 defaultOptions: { 3383 until: null, 3384 since: null, 3385 timezone: null, 3386 serverSync: null, 3387 format: 'dHMS', 3388 layout: '', 3389 compact: false, 3390 padZeroes: true, 3391 significant: 0, 3392 description: '', 3393 expiryUrl: '', 3394 expiryText: '', 3395 alwaysExpire: false, 3396 onExpiry: null, 3397 onTick: null, 3398 tickInterval: 1 3399 }, 3400 3401 /** Localisations for the plugin. 3402 Entries are objects indexed by the language code ('' being the default US/English). 3403 Each object has the following attributes. 3404 @property [labels=['Years','Months','Weeks','Days','Hours','Minutes','Seconds']] {string[]} 3405 The display texts for the counter periods. 3406 @property [labels1=['Year','Month','Week','Day','Hour','Minute','Second']] {string[]} 3407 The display texts for the counter periods if they have a value of 1. 3408 Add other <code>labels<em>n</em></code> attributes as necessary to 3409 cater for other numeric idiosyncrasies of the localisation. 3410 @property [compactLabels=['y','m','w','d']] {string[]} The compact texts for the counter periods. 3411 @property [whichLabels=null] {whichLabelsCallback} A function to determine which 3412 <code>labels<em>n</em></code> to use. 3413 @example whichLabels: function(num) { 3414 return (num > 1 ? 0 : 1); 3415 } 3416 @property [digits=['0','1',...,'9']] {number[]} The digits to display (0-9). 3417 @property [timeSeparator=':'] {string} Separator for time periods in the compact layout. 3418 @property [isRTL=false] {boolean} True for right-to-left languages, false for left-to-right. */ 3419 regionalOptions: { // Available regional settings, indexed by language/country code 3420 '': { // Default regional settings - English/US 3421 labels: ['Years', 'Months', 'Weeks', 'Days', 'Hours', 'Minutes', 'Seconds'], 3422 labels1: ['Year', 'Month', 'Week', 'Day', 'Hour', 'Minute', 'Second'], 3423 compactLabels: ['y', 'm', 'w', 'd'], 3424 whichLabels: null, 3425 digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 3426 timeSeparator: ':', 3427 isRTL: false 3428 } 3429 }, 3430 3431 /** Names of getter methods - those that can't be chained. */ 3432 _getters: ['getTimes'], 3433 3434 /* Class name for the right-to-left marker. */ 3435 _rtlClass: pluginName + '-rtl', 3436 /* Class name for the countdown section marker. */ 3437 _sectionClass: pluginName + '-section',
3438 /* Class name for the period amount marker. */ 3439 _amountClass: pluginName + '-amount', 3440 /* Class name for the period name marker. */ 3441 _periodClass: pluginName + '-period', 3442 /* Class name for the countdown row marker. */ 3443 _rowClass: pluginName + '-row', 3444 /* Class name for the holding countdown marker. */ 3445 _holdingClass: pluginName + '-holding', 3446 /* Class name for the showing countdown marker. */ 3447 _showClass: pluginName + '-show', 3448 /* Class name for the description marker. */ 3449 _descrClass: pluginName + '-descr', 3450 3451 /* List of currently active countdown elements. */ 3452 _timerElems: [], 3453 3454 /** Additional setup for the countdown. 3455 Apply default localisations. 3456 Create the timer. */ 3457 _init: function() { 3458 var self = this; 3459 this._super(); 3460 this._serverSyncs = []; 3461 var now = (typeof Date.now == 'function' ? Date.now : 3462 function() { return new Date().getTime(); }); 3463 var perfAvail = (window.performance && typeof window.performance.now == 'function'); 3464 // Shared timer for all countdowns 3465 function timerCallBack(timestamp) { 3466 var drawStart = (timestamp < 1e12 ? // New HTML5 high resolution timer 3467 (perfAvail ? (performance.now() + performance.timing.navigationStart) : now()) : 3468 // Integer milliseconds since unix epoch 3469 timestamp || now()); 3470 if (drawStart - animationStartTime >= 1000) { 3471 self._updateElems(); 3472 animationStartTime = drawStart; 3473 } 3474 requestAnimationFrame(timerCallBack); 3475 } 3476 var requestAnimationFrame = window.requestAnimationFrame || 3477 window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || 3478 window.oRequestAnimationFrame || window.msRequestAnimationFrame || null; 3479 // This is when we expect a fall-back to setInterval as it's much more fluid 3480 var animationStartTime = 0; 3481 if (!requestAnimationFrame || $.noRequestAnimationFrame) { 3482 $.noRequestAnimationFrame = null; 3483 setInterval(function() { self._updateElems(); }, 980); // Fall back to good old setInterval 3484 } 3485 else { 3486 animationStartTime = window.animationStartTime || 3487 window.webkitAnimationStartTime || window.mozAnimationStartTime || 3488 window.oAnimationStartTime || window.msAnimationStartTime || now(); 3489 requestAnimationFrame(timerCallBack); 3490 } 3491 }, 3492 3493 /** Convert a date/time to UTC. 3494 @param tz {number} The hour or minute offset from GMT, e.g. +9, -360. 3495 @param year {Date|number} the date/time in that timezone or the year in that timezone. 3496 @param [month] {number} The month (0 - 11) (omit if <code>year</code> is a <code>Date</code>). 3497 @param [day] {number} The day (omit if <code>year</code> is a <code>Date</code>). 3498 @param [hours] {number} The hour (omit if <code>year</code> is a <code>Date</code>). 3499 @param [mins] {number} The minute (omit if <code>year</code> is a <code>Date</code>). 3500 @param [secs] {number} The second (omit if <code>year</code> is a <code>Date</code>). 3501 @param [ms] {number} The millisecond (omit if <code>year</code> is a <code>Date</code>). 3502 @return {Date} The equivalent UTC date/time. 3503 @example $.countdown.UTCDate(+10, 2013, 12-1, 25, 12, 0) 3504 $.countdown.UTCDate(-7, new Date(2013, 12-1, 25, 12, 0)) */ 3505 UTCDate: function(tz, year, month, day, hours, mins, secs, ms) { 3506 if (typeof year == 'object' && year.constructor == Date) { 3507 ms = year.getMilliseconds(); 3508 secs = year.getSeconds(); 3509 mins = year.getMinutes(); 3510 hours = year.getHours(); 3511 day = year.getDate(); 3512 month = year.getMonth(); 3513 year = year.getFullYear(); 3514 } 3515 var d = new Date(); 3516 d.setUTCFullYear(year); 3517 d.setUTCDate(1); 3518 d.setUTCMonth(month || 0); 3519 d.setUTCDate(day || 1); 3520 d.setUTCHours(hours || 0); 3521 d.setUTCMinutes((mins || 0) - (Math.abs(tz) < 30 ? tz * 60 : tz)); 3522 d.setUTCSeconds(secs || 0); 3523 d.setUTCMilliseconds(ms || 0); 3524 return d; 3525 }, 3526 3527 /** Convert a set of periods into seconds. 3528 Averaged for months and years. 3529 @param periods {number[]} The periods per year/month/week/day/hour/minute/second. 3530 @return {number} The corresponding number of seconds. 3531 @example var secs = $.countdown.periodsToSeconds(periods) */
3532 periodsToSeconds: function(periods) { 3533 return periods[0] * 31557600 + periods[1] * 2629800 + periods[2] * 604800 + 3534 periods[3] * 86400 + periods[4] * 3600 + periods[5] * 60 + periods[6]; 3535 }, 3536 3537 /** Resynchronise the countdowns with the server. 3538 @example $.countdown.resync() */ 3539 resync: function() { 3540 var self = this; 3541 $('.' + this._getMarker()).each(function() { // Each countdown 3542 var inst = $.data(this, self.name); 3543 if (inst.options.serverSync) { // If synced 3544 var serverSync = null; 3545 for (var i = 0; i < self._serverSyncs.length; i++) { 3546 if (self._serverSyncs[i][0] == inst.options.serverSync) { // Find sync details 3547 serverSync = self._serverSyncs[i]; 3548 break; 3549 } 3550 } 3551 if (serverSync[2] == null) { // Recalculate if missing 3552 var serverResult = ($.isFunction(inst.options.serverSync) ? 3553 inst.options.serverSync.apply(this, []) : null); 3554 serverSync[2] = 3555 (serverResult ? new Date().getTime() - serverResult.getTime() : 0) - serverSync[1]; 3556 } 3557 if (inst._since) { // Apply difference 3558 inst._since.setMilliseconds(inst._since.getMilliseconds() + serverSync[2]); 3559 } 3560 inst._until.setMilliseconds(inst._until.getMilliseconds() + serverSync[2]); 3561 } 3562 }); 3563 for (var i = 0; i < self._serverSyncs.length; i++) { // Update sync details 3564 if (self._serverSyncs[i][2] != null) { 3565 self._serverSyncs[i][1] += self._serverSyncs[i][2]; 3566 delete self._serverSyncs[i][2]; 3567 } 3568 } 3569 }, 3570 3571 _instSettings: function(elem, options) { 3572 return {_periods: [0, 0, 0, 0, 0, 0, 0]}; 3573 }, 3574 3575 /** Add an element to the list of active ones. 3576 @private 3577 @param elem {Element} The countdown element. */ 3578 _addElem: function(elem) { 3579 if (!this._hasElem(elem)) { 3580 this._timerElems.push(elem); 3581 } 3582 }, 3583 3584 /** See if an element is in the list of active ones. 3585 @private 3586 @param elem {Element} The countdown element. 3587 @return {boolean} True if present, false if not. */ 3588 _hasElem: function(elem) { 3589 return ($.inArray(elem, this._timerElems) > -1); 3590 }, 3591 3592 /** Remove an element from the list of active ones. 3593 @private 3594 @param elem {Element} The countdown element. */ 3595 _removeElem: function(elem) { 3596 this._timerElems = $.map(this._timerElems, 3597 function(value) { return (value == elem ? null : value); }); // delete entry 3598 }, 3599 3600 /** Update each active timer element. 3601 @private */ 3602 _updateElems: function() { 3603 for (var i = this._timerElems.length - 1; i >= 0; i--) { 3604 this._updateCountdown(this._timerElems[i]); 3605 } 3606 }, 3607 3608 _optionsChanged: function(elem, inst, options) { 3609 if (options.layout) { 3610 options.layout = options.layout.replace(/</g, '<').replace(/>/g, '>'); 3611 } 3612 this._resetExtraLabels(inst.options, options); 3613 var timezoneChanged = (inst.options.timezone != options.timezone); 3614 $.extend(inst.options, options); 3615 this._adjustSettings(elem, inst, 3616 options.until != null || options.since != null || timezoneChanged); 3617 var now = new Date(); 3618 if ((inst._since && inst._since < now) || (inst._until && inst._until > now)) { 3619 this._addElem(elem[0]); 3620 } 3621 this._updateCountdown(elem, inst); 3622 }, 3623 3624 /** Redisplay the countdown with an updated display. 3625 @private 3626 @param elem {Element|jQuery} The containing division. 3627 @param inst {object} The current settings for this instance. */ 3628 _updateCountdown: function(elem, inst) { 3629 elem = elem.jquery ? elem : $(elem); 3630 inst = inst || this._getInst(elem); 3631 if (!inst) { 3632 return; 3633 } 3634 elem.html(this._generateHTML(inst)).toggleClass(this._rtlClass, inst.options.isRTL); 3635 if ($.isFunction(inst.options.onTick)) { 3636 var periods = inst._hold != 'lap' ? inst._periods : 3637 this._calculatePeriods(inst, inst._show, inst.options.significant, new Date()); 3638 if (inst.options.tickInterval == 1 || 3639 this.periodsToSeconds(periods) % inst.options.tickInterval == 0) { 3640 inst.options.onTick.apply(elem[0], [periods]); 3641 } 3642 } 3643 var expired = inst._hold != 'pause' && 3644 (inst._since ? inst._now.getTime() < inst._since.getTime() : 3645 inst._now.getTime() >= inst._until.getTime()); 3646 if (expired && !inst._expiring) { 3647 inst._expiring = true; 3648 if (this._hasElem(elem[0]) || inst.options.alwaysExpire) { 3649 this._removeElem(elem[0]); 3650 if ($.isFunction(inst.options.onExpiry)) { 3651 inst.options.onExpiry.apply(elem[0], []); 3652 } 3653 if (inst.options.expiryText) { 3654 var layout = inst.options.layout; 3655 inst.options.layout = inst.options.expiryText; 3656 this._updateCountdown(elem[0], inst); 3657 inst.options.layout = layout; 3658 } 3659 if (inst.options.expiryUrl) { 3660 window.location = inst.options.expiryUrl; 3661 } 3662 } 3663 inst._expiring = false;
3664 } 3665 else if (inst._hold == 'pause') { 3666 this._removeElem(elem[0]); 3667 } 3668 }, 3669 3670 /** Reset any extra labelsn and compactLabelsn entries if changing labels. 3671 @private 3672 @param base {object} The options to be updated. 3673 @param options {object} The new option values. */ 3674 _resetExtraLabels: function(base, options) { 3675 for (var n in options) { 3676 if (n.match(/[Ll]abels[02-9]|compactLabels1/)) { 3677 base[n] = options[n]; 3678 } 3679 } 3680 for (var n in base) { // Remove custom numbered labels 3681 if (n.match(/[Ll]abels[02-9]|compactLabels1/) && typeof options[n] === 'undefined') { 3682 base[n] = null; 3683 } 3684 } 3685 }, 3686 3687 /** Calculate internal settings for an instance. 3688 @private 3689 @param elem {jQuery} The containing division. 3690 @param inst {object} The current settings for this instance. 3691 @param recalc {boolean} True if until or since are set. */ 3692 _adjustSettings: function(elem, inst, recalc) { 3693 var serverEntry = null; 3694 for (var i = 0; i < this._serverSyncs.length; i++) { 3695 if (this._serverSyncs[i][0] == inst.options.serverSync) { 3696 serverEntry = this._serverSyncs[i][1]; 3697 break; 3698 } 3699 } 3700 if (serverEntry != null) { 3701 var serverOffset = (inst.options.serverSync ? serverEntry : 0); 3702 var now = new Date(); 3703 } 3704 else { 3705 var serverResult = ($.isFunction(inst.options.serverSync) ? 3706 inst.options.serverSync.apply(elem[0], []) : null); 3707 var now = new Date(); 3708 var serverOffset = (serverResult ? now.getTime() - serverResult.getTime() : 0); 3709 this._serverSyncs.push([inst.options.serverSync, serverOffset]); 3710 } 3711 var timezone = inst.options.timezone; 3712 timezone = (timezone == null ? -now.getTimezoneOffset() : timezone); 3713 if (recalc || (!recalc && inst._until == null && inst._since == null)) { 3714 inst._since = inst.options.since; 3715 if (inst._since != null) { 3716 inst._since = this.UTCDate(timezone, this._determineTime(inst._since, null)); 3717 if (inst._since && serverOffset) { 3718 inst._since.setMilliseconds(inst._since.getMilliseconds() + serverOffset); 3719 } 3720 } 3721 inst._until = this.UTCDate(timezone, this._determineTime(inst.options.until, now)); 3722 if (serverOffset) { 3723 inst._until.setMilliseconds(inst._until.getMilliseconds() + serverOffset); 3724 } 3725 } 3726 inst._show = this._determineShow(inst); 3727 }, 3728 3729 /** Remove the countdown widget from a div. 3730 @param elem {jQuery} The containing division. 3731 @param inst {object} The current instance object. */ 3732 _preDestroy: function(elem, inst) { 3733 this._removeElem(elem[0]); 3734 elem.empty(); 3735 }, 3736 3737 /** Pause a countdown widget at the current time. 3738 Stop it running but remember and display the current time. 3739 @param elem {Element} The containing division. 3740 @example $(selector).countdown('pause') */ 3741 pause: function(elem) { 3742 this._hold(elem, 'pause'); 3743 }, 3744 3745 /** Pause a countdown widget at the current time. 3746 Stop the display but keep the countdown running. 3747 @param elem {Element} The containing division. 3748 @example $(selector).countdown('lap') */ 3749 lap: function(elem) { 3750 this._hold(elem, 'lap'); 3751 }, 3752 3753 /** Resume a paused countdown widget. 3754 @param elem {Element} The containing division. 3755 @example $(selector).countdown('resume') */ 3756 resume: function(elem) { 3757 this._hold(elem, null); 3758 }, 3759 3760 /** Toggle a paused countdown widget. 3761 @param elem {Element} The containing division. 3762 @example $(selector).countdown('toggle') */ 3763 toggle: function(elem) { 3764 var inst = $.data(elem, this.name) || {}; 3765 this[!inst._hold ? 'pause' : 'resume'](elem); 3766 }, 3767 3768 /** Toggle a lapped countdown widget. 3769 @param elem {Element} The containing division. 3770 @example $(selector).countdown('toggleLap') */ 3771 toggleLap: function(elem) { 3772 var inst = $.data(elem, this.name) || {}; 3773 this[!inst._hold ? 'lap' : 'resume'](elem); 3774 }, 3775 3776 /** Pause or resume a countdown widget. 3777 @private 3778 @param elem {Element} The containing division. 3779 @param hold {string} The new hold setting. */ 3780 _hold: function(elem, hold) { 3781 var inst = $.data(elem, this.name); 3782 if (inst) { 3783 if (inst._hold == 'pause' && !hold) { 3784 inst._periods = inst._savePeriods; 3785 var sign = (inst._since ? '-' : '+'); 3786 inst[inst._since ? '_since' : '_until'] =
3787 this._determineTime(sign + inst._periods[0] + 'y' + 3788 sign + inst._periods[1] + 'o' + sign + inst._periods[2] + 'w' + 3789 sign + inst._periods[3] + 'd' + sign + inst._periods[4] + 'h' + 3790 sign + inst._periods[5] + 'm' + sign + inst._periods[6] + 's'); 3791 this._addElem(elem); 3792 } 3793 inst._hold = hold; 3794 inst._savePeriods = (hold == 'pause' ? inst._periods : null); 3795 $.data(elem, this.name, inst); 3796 this._updateCountdown(elem, inst); 3797 } 3798 }, 3799 3800 /** Return the current time periods. 3801 @param elem {Element} The containing division. 3802 @return {number[]} The current periods for the countdown. 3803 @example var periods = $(selector).countdown('getTimes') */ 3804 getTimes: function(elem) { 3805 var inst = $.data(elem, this.name); 3806 return (!inst ? null : (inst._hold == 'pause' ? inst._savePeriods : (!inst._hold ? inst._periods : 3807 this._calculatePeriods(inst, inst._show, inst.options.significant, new Date())))); 3808 }, 3809 3810 /** A time may be specified as an exact value or a relative one. 3811 @private 3812 @param setting {string|number|Date} The date/time value as a relative or absolute value. 3813 @param defaultTime {Date} The date/time to use if no other is supplied. 3814 @return {Date} The corresponding date/time. */ 3815 _determineTime: function(setting, defaultTime) { 3816 var self = this; 3817 var offsetNumeric = function(offset) { // e.g. +300, -2 3818 var time = new Date(); 3819 time.setTime(time.getTime() + offset * 1000); 3820 return time; 3821 }; 3822 var offsetString = function(offset) { // e.g. '+2d', '-4w', '+3h +30m' 3823 offset = offset.toLowerCase(); 3824 var time = new Date(); 3825 var year = time.getFullYear(); 3826 var month = time.getMonth(); 3827 var day = time.getDate(); 3828 var hour = time.getHours(); 3829 var minute = time.getMinutes(); 3830 var second = time.getSeconds(); 3831 var pattern = /([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g; 3832 var matches = pattern.exec(offset); 3833 while (matches) { 3834 switch (matches[2] || 's') { 3835 case 's': second += parseInt(matches[1], 10); break; 3836 case 'm': minute += parseInt(matches[1], 10); break; 3837 case 'h': hour += parseInt(matches[1], 10); break; 3838 case 'd': day += parseInt(matches[1], 10); break; 3839 case 'w': day += parseInt(matches[1], 10) * 7; break; 3840 case 'o': 3841 month += parseInt(matches[1], 10); 3842 day = Math.min(day, self._getDaysInMonth(year, month)); 3843 break; 3844 case 'y': 3845 year += parseInt(matches[1], 10); 3846 day = Math.min(day, self._getDaysInMonth(year, month)); 3847 break; 3848 } 3849 matches = pattern.exec(offset); 3850 } 3851 return new Date(year, month, day, hour, minute, second, 0); 3852 }; 3853 var time = (setting == null ? defaultTime : 3854 (typeof setting == 'string' ? offsetString(setting) : 3855 (typeof setting == 'number' ? offsetNumeric(setting) : setting))); 3856 if (time) time.setMilliseconds(0); 3857 return time; 3858 }, 3859 3860 /** Determine the number of days in a month. 3861 @private 3862 @param year {number} The year. 3863 @param month {number} The month. 3864 @return {number} The days in that month. */ 3865 _getDaysInMonth: function(year, month) { 3866 return 32 - new Date(year, month, 32).getDate(); 3867 }, 3868 3869 /** Default implementation to determine which set of labels should be used for an amount. 3870 Use the <code>labels</code> attribute with the same numeric suffix (if it exists). 3871 @private 3872 @param num {number} The amount to be displayed. 3873 @return {number} The set of labels to be used for this amount. */ 3874 _normalLabels: function(num) { 3875 return num; 3876 }, 3877 3878 /** Generate the HTML to display the countdown widget. 3879 @private 3880 @param inst {object} The current settings for this instance. 3881 @return {string} The new HTML for the countdown display. */ 3882 _generateHTML: function(inst) { 3883 var self = this; 3884 // Determine what to show 3885 inst._periods = (inst._hold ? inst._periods : 3886 this._calculatePeriods(inst, inst._show, inst.options.significant, new Date())); 3887 // Show all 'asNeeded' after first non-zero value 3888 var shownNonZero = false; 3889 var showCount = 0; 3890 var sigCount = inst.options.significant; 3891 var show = $.extend({}, inst._show); 3892 for (var period = Y; period <= S; period++) {
3893 shownNonZero |= (inst._show[period] == '?' && inst._periods[period] > 0); 3894 show[period] = (inst._show[period] == '?' && !shownNonZero ? null : inst._show[period]); 3895 showCount += (show[period] ? 1 : 0); 3896 sigCount -= (inst._periods[period] > 0 ? 1 : 0); 3897 } 3898 var showSignificant = [false, false, false, false, false, false, false]; 3899 for (var period = S; period >= Y; period--) { // Determine significant periods 3900 if (inst._show[period]) { 3901 if (inst._periods[period]) { 3902 showSignificant[period] = true; 3903 } 3904 else { 3905 showSignificant[period] = sigCount > 0; 3906 sigCount--; 3907 } 3908 } 3909 } 3910 var labels = (inst.options.compact ? inst.options.compactLabels : inst.options.labels); 3911 var whichLabels = inst.options.whichLabels || this._normalLabels; 3912 var showCompact = function(period) { 3913 var labelsNum = inst.options['compactLabels' + whichLabels(inst._periods[period])]; 3914 return (show[period] ? self._translateDigits(inst, inst._periods[period]) + 3915 (labelsNum ? labelsNum[period] : labels[period]) + ' ' : ''); 3916 }; 3917 var minDigits = (inst.options.padZeroes ? 2 : 1); 3918 var showFull = function(period) { 3919 var labelsNum = inst.options['labels' + whichLabels(inst._periods[period])]; 3920 return ((!inst.options.significant && show[period]) || 3921 (inst.options.significant && showSignificant[period]) ? 3922 '<span class="' + self._sectionClass + '">' + 3923 '<span class="' + self._amountClass + '">' + 3924 self._minDigits(inst, inst._periods[period], minDigits) + '</span>' + 3925 '<span class="' + self._periodClass + '">' + 3926 (labelsNum ? labelsNum[period] : labels[period]) + '</span></span>' : ''); 3927 }; 3928 return (inst.options.layout ? this._buildLayout(inst, show, inst.options.layout, 3929 inst.options.compact, inst.options.significant, showSignificant) : 3930 ((inst.options.compact ? // Compact version 3931 '<span class="' + this._rowClass + ' ' + this._amountClass + 3932 (inst._hold ? ' ' + this._holdingClass : '') + '">' + 3933 showCompact(Y) + showCompact(O) + showCompact(W) + showCompact(D) + 3934 (show[H] ? this._minDigits(inst, inst._periods[H], 2) : '') + 3935 (show[M] ? (show[H] ? inst.options.timeSeparator : '') + 3936 this._minDigits(inst, inst._periods[M], 2) : '') + 3937 (show[S] ? (show[H] || show[M] ? inst.options.timeSeparator : '') + 3938 this._minDigits(inst, inst._periods[S], 2) : '') : 3939 // Full version 3940 '<span class="' + this._rowClass + ' ' + this._showClass + (inst.options.significant || showCount) + 3941 (inst._hold ? ' ' + this._holdingClass : '') + '">' + 3942 showFull(Y) + showFull(O) + showFull(W) + showFull(D) + 3943 showFull(H) + showFull(M) + showFull(S)) + '</span>' + 3944 (inst.options.description ? '<span class="' + this._rowClass + ' ' + this._descrClass + '">' + 3945 inst.options.description + '</span>' : ''))); 3946 }, 3947 3948 /** Construct a custom layout. 3949 @private 3950 @param inst {object} The current settings for this instance. 3951 @param show {boolean[]} Flags indicating which periods are requested. 3952 @param layout {string} The customised layout. 3953 @param compact {boolean} True if using compact labels. 3954 @param significant {number} The number of periods with values to show, zero for all. 3955 @param showSignificant {boolean[]} Other periods to show for significance. 3956 @return {string} The custom HTML. */ 3957 _buildLayout: function(inst, show, layout, compact, significant, showSignificant) { 3958 var labels = inst.options[compact ? 'compactLabels' : 'labels']; 3959 var whichLabels = inst.options.whichLabels || this._normalLabels; 3960 var labelFor = function(index) { 3961 return (inst.options[(compact ? 'compactLabels' : 'labels') + 3962 whichLabels(inst._periods[index])] || labels)[index]; 3963 }; 3964 var digit = function(value, position) { 3965 return inst.options.digits[Math.floor(value / position) % 10]; 3966 }; 3967 var subs = {desc: inst.options.description, sep: inst.options.timeSeparator, 3968 yl: labelFor(Y), yn: this._minDigits(inst, inst._periods[Y], 1), 3969 ynn: this._minDigits(inst, inst._periods[Y], 2), 3970 ynnn: this._minDigits(inst, inst._periods[Y], 3), y1: digit(inst._periods[Y], 1),
3971 y10: digit(inst._periods[Y], 10), y100: digit(inst._periods[Y], 100), 3972 y1000: digit(inst._periods[Y], 1000), 3973 ol: labelFor(O), on: this._minDigits(inst, inst._periods[O], 1), 3974 onn: this._minDigits(inst, inst._periods[O], 2), 3975 onnn: this._minDigits(inst, inst._periods[O], 3), o1: digit(inst._periods[O], 1), 3976 o10: digit(inst._periods[O], 10), o100: digit(inst._periods[O], 100), 3977 o1000: digit(inst._periods[O], 1000), 3978 wl: labelFor(W), wn: this._minDigits(inst, inst._periods[W], 1), 3979 wnn: this._minDigits(inst, inst._periods[W], 2), 3980 wnnn: this._minDigits(inst, inst._periods[W], 3), w1: digit(inst._periods[W], 1), 3981 w10: digit(inst._periods[W], 10), w100: digit(inst._periods[W], 100), 3982 w1000: digit(inst._periods[W], 1000), 3983 dl: labelFor(D), dn: this._minDigits(inst, inst._periods[D], 1), 3984 dnn: this._minDigits(inst, inst._periods[D], 2), 3985 dnnn: this._minDigits(inst, inst._periods[D], 3), d1: digit(inst._periods[D], 1), 3986 d10: digit(inst._periods[D], 10), d100: digit(inst._periods[D], 100), 3987 d1000: digit(inst._periods[D], 1000), 3988 hl: labelFor(H), hn: this._minDigits(inst, inst._periods[H], 1), 3989 hnn: this._minDigits(inst, inst._periods[H], 2), 3990 hnnn: this._minDigits(inst, inst._periods[H], 3), h1: digit(inst._periods[H], 1), 3991 h10: digit(inst._periods[H], 10), h100: digit(inst._periods[H], 100), 3992 h1000: digit(inst._periods[H], 1000), 3993 ml: labelFor(M), mn: this._minDigits(inst, inst._periods[M], 1), 3994 mnn: this._minDigits(inst, inst._periods[M], 2), 3995 mnnn: this._minDigits(inst, inst._periods[M], 3), m1: digit(inst._periods[M], 1), 3996 m10: digit(inst._periods[M], 10), m100: digit(inst._periods[M], 100), 3997 m1000: digit(inst._periods[M], 1000), 3998 sl: labelFor(S), sn: this._minDigits(inst, inst._periods[S], 1), 3999 snn: this._minDigits(inst, inst._periods[S], 2), 4000 snnn: this._minDigits(inst, inst._periods[S], 3), s1: digit(inst._periods[S], 1), 4001 s10: digit(inst._periods[S], 10), s100: digit(inst._periods[S], 100), 4002 s1000: digit(inst._periods[S], 1000)}; 4003 var html = layout; 4004 // Replace period containers: {p<}...{p>} 4005 for (var i = Y; i <= S; i++) { 4006 var period = 'yowdhms'.charAt(i); 4007 var re = new RegExp('\\{' + period + '<\\}([\\s\\S]*)\\{' + period + '>\\}', 'g'); 4008 html = html.replace(re, ((!significant && show[i]) || 4009 (significant && showSignificant[i]) ? '$1' : '')); 4010 } 4011 // Replace period values: {pn} 4012 $.each(subs, function(n, v) { 4013 var re = new RegExp('\\{' + n + '\\}', 'g'); 4014 html = html.replace(re, v); 4015 }); 4016 return html; 4017 }, 4018 4019 /** Ensure a numeric value has at least n digits for display. 4020 @private 4021 @param inst {object} The current settings for this instance. 4022 @param value {number} The value to display. 4023 @param len {number} The minimum length. 4024 @return {string} The display text. */ 4025 _minDigits: function(inst, value, len) { 4026 value = '' + value; 4027 if (value.length >= len) { 4028 return this._translateDigits(inst, value); 4029 } 4030 value = '0000000000' + value; 4031 return this._translateDigits(inst, value.substr(value.length - len)); 4032 }, 4033 4034 /** Translate digits into other representations. 4035 @private 4036 @param inst {object} The current settings for this instance. 4037 @param value {string} The text to translate. 4038 @return {string} The translated text. */ 4039 _translateDigits: function(inst, value) { 4040 return ('' + value).replace(/[0-9]/g, function(digit) { 4041 return inst.options.digits[digit]; 4042 }); 4043 }, 4044 4045 /** Translate the format into flags for each period. 4046 @private 4047 @param inst {object} The current settings for this instance. 4048 @return {string[]} Flags indicating which periods are requested (?) or 4049 required (!) by year, month, week, day, hour, minute, second. */ 4050 _determineShow: function(inst) { 4051 var format = inst.options.format; 4052 var show = []; 4053 show[Y] = (format.match('y') ? '?' : (format.match('Y') ? '!' : null)); 4054 show[O] = (format.match('o') ? '?' : (format.match('O') ? '!' : null)); 4055 show[W] = (format.match('w') ? '?' : (format.match('W') ? '!' : null)); 4056 show[D] = (format.match('d') ? '?' : (format.match('D') ? '!' : null)); 4057 show[H] = (format.match('h') ? '?' : (format.match('H') ? '!' : null)); 4058 show[M] = (format.match('m') ? '?' : (format.match('M') ? '!' : null)); 4059 show[S] = (format.match('s') ? '?' : (format.match('S') ? '!' : null)); 4060 return show; 4061 }, 4062 4063 /** Calculate the requested periods between now and the target time. 4064 @private 4065 @param inst {object} The current settings for this instance. 4066 @param show {string[]} Flags indicating which periods are requested/required. 4067 @param significant {number} The number of periods with values to show, zero for all. 4068 @param now {Date} The current date and time. 4069 @return {number[]} The current time periods (always positive) 4070 by year, month, week, day, hour, minute, second. */
4071 _calculatePeriods: function(inst, show, significant, now) { 4072 // Find endpoints 4073 inst._now = now; 4074 inst._now.setMilliseconds(0); 4075 var until = new Date(inst._now.getTime()); 4076 if (inst._since) { 4077 if (now.getTime() < inst._since.getTime()) { 4078 inst._now = now = until; 4079 } 4080 else { 4081 now = inst._since; 4082 } 4083 } 4084 else { 4085 until.setTime(inst._until.getTime()); 4086 if (now.getTime() > inst._until.getTime()) { 4087 inst._now = now = until; 4088 } 4089 } 4090 // Calculate differences by period 4091 var periods = [0, 0, 0, 0, 0, 0, 0]; 4092 if (show[Y] || show[O]) { 4093 // Treat end of months as the same 4094 var lastNow = this._getDaysInMonth(now.getFullYear(), now.getMonth()); 4095 var lastUntil = this._getDaysInMonth(until.getFullYear(), until.getMonth()); 4096 var sameDay = (until.getDate() == now.getDate() || 4097 (until.getDate() >= Math.min(lastNow, lastUntil) && 4098 now.getDate() >= Math.min(lastNow, lastUntil))); 4099 var getSecs = function(date) { 4100 return (date.getHours() * 60 + date.getMinutes()) * 60 + date.getSeconds(); 4101 }; 4102 var months = Math.max(0, 4103 (until.getFullYear() - now.getFullYear()) * 12 + until.getMonth() - now.getMonth() + 4104 ((until.getDate() < now.getDate() && !sameDay) || 4105 (sameDay && getSecs(until) < getSecs(now)) ? -1 : 0)); 4106 periods[Y] = (show[Y] ? Math.floor(months / 12) : 0); 4107 periods[O] = (show[O] ? months - periods[Y] * 12 : 0); 4108 // Adjust for months difference and end of month if necessary 4109 now = new Date(now.getTime()); 4110 var wasLastDay = (now.getDate() == lastNow); 4111 var lastDay = this._getDaysInMonth(now.getFullYear() + periods[Y], 4112 now.getMonth() + periods[O]); 4113 if (now.getDate() > lastDay) { 4114 now.setDate(lastDay); 4115 } 4116 now.setFullYear(now.getFullYear() + periods[Y]); 4117 now.setMonth(now.getMonth() + periods[O]); 4118 if (wasLastDay) { 4119 now.setDate(lastDay); 4120 } 4121 } 4122 var diff = Math.floor((until.getTime() - now.getTime()) / 1000); 4123 var extractPeriod = function(period, numSecs) { 4124 periods[period] = (show[period] ? Math.floor(diff / numSecs) : 0); 4125 diff -= periods[period] * numSecs; 4126 }; 4127 extractPeriod(W, 604800); 4128 extractPeriod(D, 86400); 4129 extractPeriod(H, 3600); 4130 extractPeriod(M, 60); 4131 extractPeriod(S, 1); 4132 if (diff > 0 && !inst._since) { // Round up if left overs 4133 var multiplier = [1, 12, 4.3482, 7, 24, 60, 60]; 4134 var lastShown = S; 4135 var max = 1; 4136 for (var period = S; period >= Y; period--) { 4137 if (show[period]) { 4138 if (periods[lastShown] >= max) { 4139 periods[lastShown] = 0; 4140 diff = 1; 4141 } 4142 if (diff > 0) { 4143 periods[period]++; 4144 diff = 0; 4145 lastShown = period; 4146 max = 1; 4147 } 4148 } 4149 max *= multiplier[period]; 4150 } 4151 } 4152 if (significant) { // Zero out insignificant periods 4153 for (var period = Y; period <= S; period++) { 4154 if (significant && periods[period]) { 4155 significant--; 4156 } 4157 else if (!significant) { 4158 periods[period] = 0; 4159 } 4160 } 4161 } 4162 return periods; 4163 } 4164 }); 4165 4166})(jQuery); 4167 4168/* End */ 4169; 4170; /* Start:"a:4:{s:4:"full";s:46:"/ds-comf/ds-form/js/dsforms.js?153304467738459";s:6:"source";s:30:"/ds-comf/ds-form/js/dsforms.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 4171// ________________ __________ 4172// ___ __ \_ ___/ ___ ____/___________________ ___ 4173// __ / / /____ \ __ /_ _ __ \_ ___/_ __ `__ | 4174// _ /_/ /____/ / _ __/ / /_/ / / _ / / / / / 4175// /_____/ /____/ /_/ \____//_/ /_/ /_/ /_/ 4176// 4177dsformROOT = '/ds-comf/ds-form/'; 4178 4179function compareVersionjQuery(v) { 4180 var required = v.split('.', 2), 4181 current = gKweri.fn.jquery.split('.', 2); 4182 return (parseInt(current[0]) > parseInt(required[0])) || 4183 (parseInt(current[0]) == parseInt(required[0]) && 4184 parseInt(current[1]) >= parseInt(required[1])); 4185} 4186if (!window.gKweri && window.jQuery) { 4187 window.gKweri = window.jQuery 4188} 4189 4190if (!window.gKweri || !compareVersionjQuery('1.5')) { 4191 console.error('Version jQuery < 1.5 or jQuery is not found!'); 4192} 4193else { 4194 4195 (function(window, document, $, undefined) { 4196 "use strict"; 4197 var W = $(window), 4198 D = $(document), 4199 version = '4.1.0', 4200 root = dsformROOT, 4201 lib = dsformROOT + 'js/plugins/', 4202 F, 4203 gData = window.dsformglobaldata = {}, 4204 Modals = window.dsformglobaldata.buttonindexes = {},
4205 usings = 'External included scripts: \n \ 4206 Input Mask: https://github.com/RobinHerbots/jquery.inputmask \n \ 4207 jQuery Form Styler: http://dimox.name/jquery-form-styler/ \n \ 4208 popDate: https://github.com/jokernakartama/popdate', 4209 pseudoRandom = function() { 4210 var now = new Date, 4211 res = String(Math.abs(now.getMilliseconds() - (Math.floor(Math.random() * (999 - 1)) + 1))) + 4212 String((Math.floor(Math.random() * (999 - 1)) + 1)); 4213 return res; 4214 }, 4215 F = function(o, options) { 4216 4217 var self = this; //simple way 4218 4219 4220 4221 /*private vars*/ 4222 var _id = '', //form id 4223 _modal, 4224 _formLoaded = false, 4225 _visible, 4226 _bi = pseudoRandom() + pseudoRandom(), // kinda unique index for buttons 4227 _o = o && o.hasOwnProperty && o instanceof $ ? o : $(o); // wrap DOM objects in jQuery 4228 4229 4230 /*public vars*/ 4231 self.options = {}, 4232 self.container = {}, 4233 self.form = {}, 4234 self.report = undefined, 4235 self.config = undefined, 4236 self.sended = false, 4237 self.element = _o; 4238 4239 4240 4241 /* defaults */ 4242 var defaults = { 4243 formID: undefined, 4244 modal: true, // if true, the determined element uses as button 4245 additionalClass: undefined, 4246 config: '', 4247 inputmask: {}, //options for inputmask 4248 dates: {}, 4249 showLoader: true, 4250 useFormStyler: false, // uses jQuery Form Styler plugin http://dimox.name/jquery-form-styler/ 4251 reload: true, 4252 stackErrors: true, 4253 clearErrors: false, 4254 4255 4256 // callbacks 4257 onLoad: undefined, // when form loads, mostly runs one time for each defined element 4258 onShow: undefined, // when modal window opens 4259 onSuccess: undefined, // when form data successfully sends 4260 onFail: undefined, // in case of input errors 4261 onClose: undefined, // when modal window close 4262 onServerError: undefined, // in case of form data cannot be send 4263 onInit: undefined, // when inits form 4264 4265 // modals 4266 animationspeed: 300, //how fast animations are 4267 closeonbackgroundclick: true, //if you click background will modal close 4268 4269 formstyler: {}, 4270 }; 4271 4272 /* private methods */ 4273 var __init__ = function() { 4274 4275 _o.get(0).dsformmarker = true; 4276 4277 //extendnig defaults with options 4278 self.options = $.extend({}, defaults, options); 4279 _id = self.options.formID; // for comfortable coding 4280 _modal = self.options.modal; 4281 self.config = self.options.config; 4282 4283 if (typeof onInit === 'function') { 4284 self.options.onInit.call(self, $); 4285 } 4286 4287 if (!compareVersionjQuery('1.7') && self.options.useFormStyler) { 4288 self.options.useFormStyler = false; 4289 console.warn('DSFORM(#' + _id + '): Form Styler uses version jQuery 1.7.1 and higher. '); 4290 } 4291 4292 if (self.options.useFormStyler) { 4293 self.run(lib + 'formstyler.js', function() { 4294 $(null).styler(null); 4295 }, 'formstyler'); 4296 } //preload if use styler 4297 4298 if (_modal) { // if button 4299 // check the container existing 4300 if ($('*[data-dsform-id="' + _id + '"]').get().length > 0) { 4301 self.container = $('*[data-dsform-id="' + _id + '"]'); 4302 } 4303 else {
4304 self.container = $('<div class="ds-form dspopup-modal ' + _id + '"><div/>').appendTo('body'); 4305 self.container.attr('data-dsform-id', _id); 4306 } 4307 4308 // binding modal on click 4309 _o.bind('click', function(e) { 4310 e.preventDefault(); 4311 self.config = $(this).attr('data-dsconfig') || self.config; 4312 //refresh form only if another button was clicked 4313 if (_bi != Modals[_id] || (self.sended && self.options.reload)) { 4314 Modals[_id] = _bi; 4315 self.getForm(); 4316 } 4317 if (_formLoaded) __align__(); 4318 __reveal__(); 4319 if (self.options.additionalClass) self.container.addClass(self.options.additionalClass); 4320 }); 4321 } 4322 else { // if container 4323 self.container = _o; 4324 if (self.options.additionalClass) self.container.addClass(self.options.additionalClass); 4325 self.container.addClass('ds-form'); 4326 self.config = _o.attr('data-dsconfig') || self.config; 4327 self.getForm(); 4328 } 4329 } // init ends 4330 4331 var __align__ = function() { 4332 // restart modal window geometry if this function was used before 4333 if (self.container.children().is('.scrollform')) { 4334 self.form.appendTo(self.container); 4335 self.container.find('.scrollform').remove(); 4336 self.container.css({ 4337 'height': 'auto' 4338 }); 4339 } 4340 var scrollbar = 0; 4341 self.container.css({ 4342 'height': '', 4343 'width': '' 4344 }); // remove inline styles at first 4345 // determine browser geometry 4346 var windowWidth = window.innerWidth || 4347 document.documentElement.clientWidth || 4348 document.body.clientWidth, 4349 windowHeight = window.innerHeight || 4350 document.documentElement.clientHeight || 4351 document.body.clientHeight; 4352 if (window.innerWidth && document.documentElement.clientWidth) { 4353 scrollbar = window.innerWidth - document.documentElement.clientWidth; 4354 } 4355 4356 // but if width is too large, make the modal window a bit smaller than browser window 4357 if (windowWidth < (self.container.innerWidth() + 20)) { 4358 self.container.width(+windowWidth - scrollbar - 20 - (self.container.innerWidth() - self.container.width())); 4359 } 4360 4361 var widthForm = self.container.innerWidth(), 4362 heightForm = self.container.outerHeight(true), 4363 leftForm = Math.round((windowWidth - widthForm - scrollbar) / 2); // calculate left margin with some fixes 4364 4365 if (windowHeight <= (heightForm + 20)) { 4366 var topForm = 20, 4367 marginScroll = 15, 4368 paddingForm = heightForm - self.container.height(); 4369 self.container.append('<div class="scrollform"></div>'); 4370 self.form.appendTo(self.container.find('.scrollform')); 4371 console.log(1, self.form) 4372 heightForm = windowHeight - topForm * 2; 4373 self.container.find('.scrollform').height(heightForm - paddingForm - marginScroll); 4374 self.container.find('.scrollform').css({ 4375 'overflow-y': 'scroll', 4376 'margin': marginScroll + 'px 0' 4377 }); 4378 } 4379 else { 4380 // if evrthng is ok, calculate margins 4381 var topForm = Math.round((windowHeight - heightForm) / 2); 4382 } 4383 // use the geometry 4384 self.container.css({ 4385 'top': topForm + 'px', 4386 'left': leftForm + 'px', 4387 }); 4388 } // align ends 4389 4390 var __send__ = function() { 4391 4392 if (self.options.showLoader) { 4393 var h = self.container.find('input[type="submit"]').outerHeight(true), 4394 w = self.container.find('input[type="submit"]').outerWidth(true), 4395 mt = 0, 4396 ml; 4397 4398 if (+h > 32) { 4399 mt = (+h - 32) / 2; 4400 h = 32; 4401 } 4402 ml = (((+w) - (+h)) / 2), 4403 mt = mt + 'px'; 4404 ml = ml + 'px'; 4405 4406 $('img.loadform').siblings('input[type="submit"]').toggle(); 4407 4408 self.form.find('input[type="submit"]').hide(); 4409 4410 $('img.loadform').appendTo(self.container.find('input[type="submit"]').parent()).css({ 4411 'height': h, 4412 'width': h, 4413 'margin': mt + ' ' + ml, 4414 'display': 'inline', 4415 'verticalAlign': 'middle', 4416 }); 4417 } 4418 4419 if (!window.FormData) { 4420 var dataform = self.form.serialize(); 4421 dataform = dataform + '&formid=' + _id + '&route=DSFormSend'; 4422 $.ajax({ 4423 type: "POST", 4424 url: root + "index.php?s", 4425 dataType: "json", 4426 cache: false, 4427 data: dataform, 4428 success: function(data) { 4429 __result__(data); 4430 } 4431 }); 4432 // new browsers use FormData 4433 } 4434 else { 4435 var formData = new FormData(self.form.get(0)); 4436 formData.append('formid', _id); 4437 formData.append('route', 'DSFormSend'); 4438 $.ajax({ 4439 url: root + "index.php?s", 4440 type: "POST", 4441 contentType: false, 4442 processData: false, 4443 data: formData, 4444 dataType: 'json', 4445 success: function(data) { 4446 __result__(data); 4447 } 4448 }); 4449 } 4450 return false;
4451 } // send ends 4452 4453 var __help__ = function() { 4454 4455 self.form.find('input[data-dsform-date]').each(function() { 4456 var field = $(this), 4457 format = field.attr('data-dsform-date'); 4458 if (!self.options.dates[field.attr('name')]) self.options.dates[field.attr('name')] = {}; 4459 if (!self.options.dates[field.attr('name')].format) { 4460 self.options.dates[field.attr('name')].format = format; 4461 } 4462 }); 4463 4464 self.form.find('input[data-dsform-mask]').each(function() { 4465 var field = $(this), 4466 format = field.attr('data-dsform-mask'); 4467 if (!self.options.inputmask[field.attr('name')]) self.options.inputmask[field.attr('name')] = {}; 4468 if (!self.options.inputmask[field.attr('name')].mask) { 4469 self.options.inputmask[field.attr('name')].mask = format; 4470 } 4471 }); 4472 4473 4474 (function() { 4475 for (var i in self.options.dates) { 4476 if (i) { 4477 var field = self.form.find('input[name="' + i + '"]'); 4478 var customs = typeof self.options.dates[i] === 'object' ? self.options.dates[i] : {}; 4479 customs.format = customs.format ? customs.format : field.attr('data-dsform-date'); 4480 self.run(lib + 'dscalendar.js', function() { 4481 dscalendar(field.get(0), customs); 4482 }, 'dscalendar'); 4483 } 4484 } 4485 })(); 4486 4487 4488 (function() { 4489 for (var i in self.options.inputmask) { 4490 if (i) { 4491 var field = self.form.find('input[name="' + i + '"]'); 4492 var customs = typeof self.options.inputmask[i] === 'object' ? self.options.inputmask[i] : {}; 4493 customs.mask = customs.mask ? customs.mask : field.attr('data-dsform-mask'); 4494 self.run(lib + 'inputmask.js', function() { 4495 field.inputmask(customs); 4496 }, 'inputmask'); 4497 } 4498 } 4499 })(); 4500 4501 if (self.options.useFormStyler !== false) { 4502 var s = typeof self.options.useFormStyler === 'string' ? self.options.useFormStyler : 'select, input'; 4503 self.run(lib + 'formstyler.js', function() { 4504 self.form.find(s).styler(self.options.formstyler); 4505 }, 'formstyler'); 4506 } 4507 } 4508 4509 var __validate__ = function() { 4510 self.form.find('input, textarea').bind('keyup', function() { 4511 var field = $(this); 4512 4513 if (field.attr('pattern') && !field.val().match(field.attr('pattern'))) { 4514 field.addClass('improper-value'); 4515 if (!self.options.stackErrors) { 4516 field.siblings('.dsform-field-error.named_as_' + field.attr('name')).removeClass('hint-proper'); 4517 } 4518 } 4519 else if (field.attr('pattern') && field.hasClass('improper-value')) { 4520 field.removeClass('improper-value'); 4521 if (!self.options.stackErrors) { 4522 field.siblings('.dsform-field-error.named_as_' + field.attr('name')).addClass('hint-proper'); 4523 } 4524 } 4525 4526 if (!field.attr('pattern') && field.hasClass('improper-value')) { 4527 field.removeClass('improper-value'); 4528 if (!self.options.stackErrors) { 4529 field.siblings('.dsform-field-error.named_as_' + field.attr('name')).addClass('hint-proper'); 4530 } 4531 } 4532 }); 4533 } //validate ends 4534 4535 var __construct__ = function(jsoncode) { 4536 var htmlcode = '', 4537 response = JSON.parse(jsoncode); 4538 4539 if (response.error == 0) { 4540 htmlcode = response.error_text; 4541 } 4542 else if (response.error == 3) { 4543 console.error(response.error_text); 4544 } 4545 4546 // clean container from other forms (actual for buttons) 4547 if (self.container.find('form').get().length > 0) { 4548 self.container.find('form').remove(); 4549 }; 4550 4551 self.container.find('#' + _id + 'formmessagereport').remove(); 4552 self.container.append(htmlcode); 4553 4554 self.form = self.container.find('form'); 4555 4556 // auto resize modals 4557 if (!_formLoaded && _modal) { 4558 _formLoaded = true; 4559 $('.dspopup-modal-bg .loadform').hide(); 4560 } 4561 4562 if (self.form && self.form.length > 0) { 4563 __help__(); 4564 __validate__(); 4565 self.form.bind('submit', __send__); 4566 __refocus__(); 4567 } 4568 4569 if (!window.FormData) { 4570 self.container.find(' *[type="file"]').css('display', 'none'); 4571 } 4572 4573 4574 // call onLoad 4575 if (typeof(self.options.onLoad) == "function") { 4576 self.options.onLoad.call(self, $); 4577 } 4578 4579 // focus autofocused on simple blocks 4580 if (!self.container.hasClass('dspopup-modal') || !_modal) { 4581 self.container.find('*[autofocus]').focus(); 4582 } 4583 else { 4584 // calculate geometry of modal 4585 __align__(); 4586 } 4587 4588 } //construct ends 4589 4590 var __result__ = function(data) { 4591 // hide animation 4592 if (self.options.showLoader) { 4593 self.container.find('img.loadform').hide(); 4594 self.container.find('input[type="submit"]').show(); 4595 } 4596 4597 // order recieved data
4598 delete(data['formid']); 4599 // validation error 4600 if (data['error'] == 1) { 4601 delete(data['error']); 4602 if (self.options.stackErrors) { 4603 self.container.find('.error_form').empty(); 4604 } 4605 else { 4606 self.container.find('.dsform-field-error').remove(); 4607 } 4608 var error_array = []; 4609 // define "alert" class for improper fields 4610 $.each(data, function(index, val) { 4611 if ($.inArray(val, error_array) == -1 && val != 1) error_array.push(val); 4612 self.container.find('*[name="' + index + '"]').addClass('improper-value'); 4613 if (!self.options.stackErrors) { 4614 $('<span class="dsform-field-error named_as_' + index + '"><span>' + val + '</span></span>').appendTo(self.form.find('[name="' + index + '"]').parent()); 4615 } 4616 }); 4617 self.container.find('*[required]').each(function() { 4618 var field = $(this); 4619 if (field.hasClass('improper-value') && !data[field.attr('name')]) { 4620 field.removeClass('improper-value'); 4621 } 4622 }); 4623 4624 if (self.options.stackErrors) { 4625 var error_text = '<ul class="error-form">' + "\n"; 4626 $.each(error_array, function(index, val) { 4627 error_text += '<li>' + val + '</li>' + "\n"; 4628 }) 4629 error_text += '</ul>' + "\n"; 4630 self.container.find('.error_form').append(error_text); 4631 } 4632 if (typeof self.options.onFail === 'function') { 4633 self.options.onFail.call(self, $); 4634 } 4635 // recalc geometry for modals 4636 if (_modal) { 4637 __align__(); 4638 } 4639 else { 4640 self.container.css('height', 'auto'); 4641 } 4642 // if data was send successfully or not, show response message 4643 } 4644 else if (data['error'] == 0 || data['error'] == 2) { 4645 self.form.remove(); 4646 self.container.find('.scrollform').remove(); 4647 console.log(2, self.form); 4648 self.container.find('.scrollform').css('height', 'auto'); 4649 self.container.css('height', 'auto'); 4650 self.report = document.createElement('div'); 4651 self.report.id = _id + 'formmessagereport'; 4652 self.report.className = 'report-message'; 4653 self.report = $(self.report); 4654 self.report.append(data['error_text']); 4655 self.container.append(self.report); 4656 self.report.find('.repeatform').bind('click', function(e) { 4657 e.preventDefault(); 4658 $(this).unbind('click'); 4659 self.report.remove(); 4660 self.getForm(); 4661 }); 4662 4663 4664 // call user functions if need 4665 if (data['error'] == 0) self.sended = true; 4666 4667 if (data['error'] == 0 && typeof self.options.onSuccess === 'function') { 4668 self.options.onSuccess.call(self, $); 4669 } 4670 if (data['error'] == 2 && typeof self.options.onServerError === 'function') { 4671 self.options.onServerError.call(self, $); 4672 } 4673 4674 if (self.container.hasClass('dspopup-modal') || _modal) { 4675 __align__(); 4676 } 4677 4678 } 4679 } // result ends 4680 4681 var __refocus__ = function() { 4682 self.form.find('input, textarea, select').bind('focusin', function() { 4683 self.form.find('input[type="text"], textarea, select').each(function() { 4684 $(this).removeClass('focusout'); 4685 }); 4686 }); 4687 self.form.find('input[type="text"]:not(input[readonly]),textarea:not(textarea[readonly]), select').bind('focusout', function() { 4688 $(this).addClass('focusout'); 4689 }); 4690 } // refocus ends 4691 4692 // just copy reveal modal code locked on the container 4693 var __reveal__ = function() { 4694 var modal = self.container, 4695 locked = false, 4696 modalBG = $('.dspopup-modal-bg'); 4697 4698 if (modalBG.length == 0) { 4699 modalBG = $('<div class="dspopup-modal-bg"></div>').insertAfter(modal); 4700 } 4701 4702 if (!_formLoaded) { 4703 var windowHeight = window.innerHeight || 4704 document.documentElement.clientHeight || 4705 document.body.clientHeight; 4706 $('img.loadform').appendTo('.dspopup-modal-bg').css({ 4707 'height': '64px', 4708 'width': '64px', 4709 'margin': ((+windowHeight / 2) - 32) + 'px auto auto', 4710 'display': 'block', 4711 }); 4712 } 4713 4714 modal.bind('dspopup:open', function() { 4715 modalBG.unbind('click.modalEvent'); 4716 $('.close-dspopup-modal').unbind('click.modalEvent'); 4717 if (!locked) { 4718 lockModal(); 4719 modal.append('<div class="close-dspopup-modal dsclose-button"></div>'); 4720 modal.css({ 4721 'opacity': 0, 4722 'visibility': 'visible', 4723 'display': 'block' 4724 }); 4725 modal.addClass('active-dspopup'); 4726 modalBG.fadeIn(self.options.animationspeed / 2); 4727 modal.delay(self.options.animationspeed / 2).animate({ 4728 "opacity": 1 4729 }, 4730 self.options.animationspeed, 4731 function() { 4732 _visible = true; 4733 self.container.find('*[autofocus]').focus(); 4734 if (typeof self.options.onShow === "function") { 4735 self.options.onShow.call(self, $); 4736 } 4737 unlockModal(); 4738 }); 4739 } 4740 modal.unbind('dspopup:open'); 4741 }); 4742 4743 modal.bind('dspopup:close', function() { 4744 if (!locked) { 4745 lockModal(); 4746 $('.close-dspopup-modal').remove(); 4747 modal.removeClass('active-dspopup'); 4748 modalBG.delay(self.options.animationspeed).fadeOut(self.options.animationspeed); 4749 modal.animate({ 4750 "opacity": 0 4751 }, 4752 self.options.animationspeed, 4753 function() { 4754 _visible = false;
4755 modal.css({ 4756 'opacity': 1, 4757 'visibility': 'hidden', 4758 'display': 'none' 4759 }); 4760 if (self.options.additionalClass) self.container.removeClass(self.options.additionalClass); 4761 if (typeof self.options.onClose === "function") { 4762 self.options.onClose.call(self, $); 4763 } 4764 unlockModal(); 4765 if (self.options.clearErrors) { 4766 self.form.find('.error-form, .dsform-field-error').remove(); 4767 self.form.find('input.improper-value, textarea.improper-value').removeClass('improper-value'); 4768 } 4769 } 4770 ); 4771 } 4772 modal.unbind('dspopup:close'); 4773 }); 4774 4775 modal.trigger('dspopup:open'); 4776 var closeButton = $('.close-dspopup-modal').bind('click.modalEvent', function() { 4777 modal.trigger('dspopup:close'); 4778 }); 4779 if (self.options.closeonbackgroundclick) { 4780 modalBG.css({ 4781 "cursor": "pointer" 4782 }) 4783 modalBG.bind('click.modalEvent', function() { 4784 modal.trigger('dspopup:close'); 4785 }); 4786 } 4787 $('body').keyup(function(e) { 4788 if (e.which === 27) { 4789 modal.trigger('dspopup:close'); 4790 } // 27 is the keycode for the Escape key 4791 }); 4792 4793 function unlockModal() { 4794 locked = false; 4795 } 4796 4797 function lockModal() { 4798 locked = true; 4799 } 4800 } // reveal ends 4801 4802 4803 var __path__ = function($o, path) { 4804 // The first time this function is called, path won't be defined. 4805 if (typeof path == 'undefined') path = ''; 4806 4807 // If this element is <html> we've reached the end of the path. 4808 if ($o.is('html')) 4809 return 'html' + path; 4810 4811 // Add the element name. 4812 4813 var cur = $o.get(0).nodeName.toLowerCase(); 4814 4815 // Determine the IDs and path. 4816 var id = $o.attr('id'), 4817 className = $o.attr('class'); 4818 4819 4820 // Add the #id if there is one. 4821 if (typeof id != 'undefined') 4822 cur += '#' + id; 4823 4824 // Add any classes. 4825 if (typeof className != 'undefined') 4826 cur += '.' + className.split(/[\s\n]+/).join('.'); 4827 4828 // Recurse up the DOM. 4829 return __path__($o.parent(), ' > ' + cur + path); 4830 } // path ends 4831 4832 4833 /* public methods */ 4834 4835 self.open = function() { 4836 if (_modal) self.element.trigger('click'); 4837 } //open ends 4838 4839 self.close = function() { 4840 if (_modal) self.container.trigger('dspopup:close'); 4841 } //close ends 4842 4843 self.getPath = function(e) { 4844 if (!e) e = self.element; 4845 return __path__(e); 4846 } 4847 4848 self.run = function(path, func, fname) { 4849 try { 4850 func.apply(this, arguments); 4851 if (!gData[fname]) console.info('DSFORM: ' + fname + ' was loaded before'); 4852 } 4853 catch (err) { 4854 if (!gData[fname]) { // if script includes first time 4855 var s = document.createElement('script'); 4856 s.src = path; 4857 document.head.appendChild(s); 4858 gData[fname] = true; 4859 } 4860 setTimeout(function() { 4861 self.run(path, func, fname); 4862 }, 1000); 4863 } 4864 } // run ends 4865 4866 4867 self.getForm = function() { 4868 self.sended = false;
4869 // create query string for ajax 4870 var datajax; 4871 datajax = "formid=" + _id + '&route=DSFormView'; 4872 if (self.config) { 4873 var configs = self.config.replace(/'/g, '"'); 4874 try { 4875 eval(JSON.parse(configs)); 4876 datajax += "&dsconfig=" + configs; 4877 } 4878 catch (e) { 4879 console.error('JSON array is improper for #' + _id + '!'); 4880 } 4881 } 4882 // send to template constructor 4883 $.ajax({ 4884 url: root + "index.php?s", 4885 type: "POST", 4886 dataType: "text", 4887 data: datajax, 4888 cache: false, 4889 success: function(data) { 4890 __construct__(data); 4891 } 4892 }); 4893 } //getform ends 4894 4895 self.isOpen = function(){ 4896 return _visible; 4897 } 4898 4899 self.field = function(name) { 4900 if (name.indexOf('#') === 0) { 4901 return $(name); 4902 } 4903 else { 4904 return $('[name="' + name + '"]'); 4905 } 4906 } 4907 4908 4909 if (o && options.formID && !_o.get(0).dsformmarker) { 4910 __init__(); 4911 } 4912 else if (_o.get(0).dsformmarker === true) { 4913 console.warn('DSFORM (' + options.formID + '): element already uses \n Path: ' + __path__(self.element) + '\n Element:', self.element.get(0)); 4914 } 4915 else if (!options.formID) { 4916 console.warn('DSFORM: formID is undefined \n Path: ' + __path__(self.element) + ' \n Element:', self.element.get(0)); 4917 } 4918 return self; 4919 } // dsform object ends 4920 4921 // jQuery method 4922 $.dsform = function(opts, o) { 4923 if (o === undefined) { 4924 opts.modal = true; 4925 o = document.createElement('figure'); 4926 } 4927 var result = new F(o, opts); 4928 return result; 4929 } 4930 4931 $.dsform.ver = function() { 4932 return version; 4933 } 4934 $.dsform.uses = function() { 4935 return usings; 4936 } 4937 $.dsform.close = function(f_id) { 4938 $('[data-dsform-id="' + f_id + '"]').trigger('dspopup:close') 4939 } 4940 4941 // jQuery plugin 4942 $.fn.dsform = function(options) { 4943 this.each(function() { 4944 new F($(this), options); 4945 }); 4946 return this; 4947 } 4948 4949 D.ready(function() { 4950 $('<img />', { 4951 'src': root + 'images/loading.gif', 4952 'class': 'loadform' 4953 }).css("display", "none").appendTo('body'); 4954 var styleforms = document.createElement('link'); 4955 styleforms.rel = "stylesheet"; 4956 styleforms.href = root + "index.php?m=getcss"; 4957 document.head.appendChild(styleforms); 4958 4959 $('.ds-form').each(function() { 4960 $.dsform({ 4961 formID: $(this).attr('id'), 4962 modal: false 4963 }, $(this)); 4964 }); 4965 4966 $('*[data-dspopup-id]').each(function() { 4967 var id = $(this).attr('data-dspopup-id'); 4968 $.dsform({ 4969 formID: id 4970 }, $(this)); 4971 }); 4972 }); // ready ends 4973 4974 }(window, document, gKweri)); 4975 4976} 4977/* End */ 4978; 4979; /* Start:"a:4:{s:4:"full";s:42:"/ds-comf/ds-form/jsaction.js?1637742302209";s:6:"source";s:28:"/ds-comf/ds-form/jsaction.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 4980$(document).ready(function(){ 4981 $('.dscallBack').dsform({ 4982 formID : 'calSpecDiscount', 4983 modal : false, 4984 }); 4985 $('.dsone-click').dsform({ 4986 formID : 'dsone-click', 4987 modal : true, 4988 }); 4989}); 4990/* End */ 4991; 4992; /* Start:"a:4:{s:4:"full";s:55:"/local/templates/elektro_flat/js/main.js?15943612045368";s:6:"source";s:40:"/local/templates/elektro_flat/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 4993$(function() { 4994 //SCROLL_UP// 4995 var top_show = 150, 4996 delay = 500; 4997 $("body").append($("<a />").addClass("scroll-up").attr({"href": "javascript:void(0)", "id": "scrollUp"}).append($("<i />").addClass("fa fa-angle-up"))); 4998 $("#scrollUp").click(function(e) { 4999 e.preventDefault(); 5000 $("body, html").animate({scrollTop: 0}, delay); 5001 return false;
5002 }); 5003 $(window).scroll(function () { 5004 if($(this).scrollTop() > top_show) { 5005 $("#scrollUp").fadeIn(); 5006 } else { 5007 $("#scrollUp").fadeOut(); 5008 } 5009 }); 5010 5011 //DISABLE_FORM_SUBMIT_ENTER// 5012 $(".add2basket_form").on("keyup keypress", function(e) { 5013 var keyCode = e.keyCode || e.which; 5014 if(keyCode === 13) { 5015 e.preventDefault(); 5016 return false; 5017 } 5018 }); 5019 5020 //TOP_PANEL_CONTACTS// 5021 $(".showcontacts").click(function() { 5022 var clickitem = $(this); 5023 if(clickitem.parent("li").hasClass("")) { 5024 clickitem.parent("li").addClass("active"); 5025 } else { 5026 clickitem.parent("li").removeClass("active"); 5027 } 5028 if($(".showsection").parent("li").hasClass("active")) { 5029 $(".showsection").parent("li").removeClass("active"); 5030 $(".showsection").parent("li").find(".catalog-section-list").css({"display":"none"}); 5031 } 5032 if($(".showsubmenu").parent("li").hasClass("active")) { 5033 $(".showsubmenu").parent("li").removeClass("active"); 5034 $(".showsubmenu").parent("li").find("ul.submenu").css({"display":"none"}); 5035 } 5036 if($(".showsearch").parent("li").hasClass("active")) { 5037 $(".showsearch").parent("li").removeClass("active"); 5038 $(".search_block").css({"display":"none"}); 5039 $(".title-search-result").css({"display":"none"}); 5040 } 5041 $(".header_4").slideToggle(); 5042 }); 5043 5044 //TOP_PANEL_SEARCH// 5045 $(".showsearch").click(function() { 5046 var clickitem = $(this); 5047 if(clickitem.parent("li").hasClass("")) { 5048 clickitem.parent("li").addClass("active"); 5049 } else { 5050 clickitem.parent("li").removeClass("active"); 5051 $(".title-search-result").css({"display":"none"}); 5052 } 5053 if($(".showsection").parent("li").hasClass("active")) { 5054 $(".showsection").parent("li").removeClass("active"); 5055 $(".showsection").parent("li").find(".catalog-section-list").css({"display":"none"}); 5056 } 5057 if($(".showsubmenu").parent("li").hasClass("active")) { 5058 $(".showsubmenu").parent("li").removeClass("active"); 5059 $(".showsubmenu").parent("li").find("ul.submenu").css({"display":"none"}); 5060 } 5061 if($(".showcontacts").parent("li").hasClass("active")) { 5062 $(".showcontacts").parent("li").removeClass("active"); 5063 $(".header_4").css({"display":"none"}); 5064 } 5065 $(".search_block").slideToggle(); 5066 }); 5067 5068 //TABS// 5069 if($(".tabs__box.new .filtered-items").length < 1) 5070 $(".tabs__tab.new, .tabs__box.new").remove(); 5071 if($(".tabs__box.hit .filtered-items").length < 1) 5072 $(".tabs__tab.hit, .tabs__box.hit").remove(); 5073 if($(".tabs__box.discount .filtered-items").length < 1) 5074 $(".tabs__tab.discount, .tabs__box.discount").remove(); 5075 5076 $(".tabs__tab").first().addClass("current"); 5077 $(".tabs__box").first().css({"display":"block"}); 5078 5079 //ITEMS_HEIGHT// 5080 var itemsTable = $(".filtered-items:visible .catalog-item-card"); 5081 if(!!itemsTable && itemsTable.length > 0) { 5082 $(window).resize(function() { 5083 adjustItemHeight(itemsTable); 5084 }); 5085 adjustItemHeight(itemsTable); 5086 } 5087 5088 $(".tabs").on("click", ".tabs__tab:not(.current)", function() { 5089 $(this).addClass("current").siblings().removeClass("current") 5090 .parent().siblings(".tabs__box").eq($(this).index()).fadeIn(150).siblings(".tabs__box").hide(); 5091 5092 //ITEMS_HEIGHT// 5093 var itemsTable = $(this).parent().siblings(".tabs__box").eq($(this).index()).find(".catalog-item-card"); 5094 if(!!itemsTable && itemsTable.length > 0) { 5095 $(window).resize(function() { 5096 adjustItemHeight(itemsTable); 5097 }); 5098 adjustItemHeight(itemsTable); 5099 } 5100 }); 5101 5102 var tabIndex = window.location.hash.replace("#tab", "") - 1; 5103 if(tabIndex != -1) 5104 $(".tabs__tab").eq(tabIndex).click(); 5105 5106 $(".tabs__tab a[href*=#tab]").click(function() { 5107 var tabIndex = $(this).attr("href").replace(/(.*)#tab/, "") - 1; 5108 $(".tabs__tab").eq(tabIndex).click(); 5109 }); 5110 5111 //DELAY// 5112 var currPage = window.location.pathname; 5113 var delayIndex = window.location.search; 5114 if(currPage == "/personal/cart/"){ 5115/* 5116 $('.left-column').css({ 5117 'visibility':'hidden', 5118 'height':'100px' 5119 }); 5120*/ 5121 $('[id^= "bigdata_recommended_products"]').css('display','none'); 5122 } 5123 if((currPage == "/personal/cart/") && (document.getElementById("id-shelve-list")) && (delayIndex == "?delay=Y")) { 5124 $("#id-shelve-list").show(); 5125 $("#id-cart-list").hide(); 5126 } else { 5127 $("#id-shelve-list").hide(); 5128 $("#id-cart-list").show(); 5129 } 5130 5131 //CUSTOM_FORMS// 5132 $(".custom-forms").customForms({}); 5133 5134 $('.add2basket_form .plus, .add2basket_form .minus').on('click', function(){ 5135 let sQuantityValue = $(this).closest('.add2basket_form').find('.quantity').val(); 5136 let sPrice = $(this).closest('.catalog-item-card').find('meta[itemprop="price"]').attr('content'); 5137 $(this).closest('.catalog-item-card').find('.catalog-item-price').text((sPrice * sQuantityValue).toFixed(2)); 5138 }); 5139 5140 $('.price_buy_detail .plus, .price_buy_detail .minus').on('click', function(){ 5141 let sQuantityValue = $(this).closest('.add2basket_form').find('.quantity').val(); 5142 let sPrice = $(this).closest('.price_buy_detail').find('meta[itemprop="price"]').attr('content'); 5143 $(this).closest('.price_buy_detail').find('.catalog-detail-item-price .cPrice').text((sPrice * sQuantityValue).toFixed(2)); 5144 }); 5145}); 5146/* End */ 5147; 5148; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/elektro_flat/js/addEventOnButton.js?16660956623007";s:6:"source";s:52:"/local/templates/elektro_flat/js/addEventOnButton.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 5149document.addEventListener('DOMContentLoaded', () =>{ 5150 (() => { 5151 'use strict'; 5152 5153 class AddEventOnButton { 5154 addEventOnButton(selector) { 5155 const btns = document.querySelectorAll(selector); 5156 5157 btns.forEach(btn => { 5158 btn.addEventListener('click', () => { 5159 setTimeout(() => { 5160 const popupID = AddEventOnButton.getPopupID(); 5161 if (popupID) { 5162 AddEventOnButton.popupClearAlert(popupID); 5163 document.getElementById(popupID).addEventListener('click', AddEventOnButton.submit); 5164 } 5165 }, 200); 5166 }); 5167 }); 5168 } 5169 //полÑÑаем ID модалÑого окна 5170 static getPopupID(){ 5171 const popup = document.querySelectorAll('.popup-window'); 5172
5173 for(let i = 0; i < popup.length; i++){ 5174 if (popup[i].style.display === 'block'){ 5175 return popup[i].getAttribute('id'); 5176 } 5177 } 5178 } 5179 // полÑÑаем заголовок окна 5180 static getPopupTitle(id){ 5181 return document.getElementById(id).querySelector('div.popup-window-titlebar > span').innerHTML; 5182 } 5183 // ÑдалÑем ÑообÑение об оÑибке 5184 static popupClearAlert(id){ 5185 const popup = document.getElementById(id); 5186 5187 if (popup) { 5188 popup.addEventListener('focusin', () => { 5189 popup.querySelector('.alert').textContent = ''; 5190 }); 5191 } 5192 } 5193 // пÑовеÑÑем Ð¿Ð¾Ð»Ñ Ð¾Ð±ÑзаÑелÑнÑе Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ 5194 static requeridField(formID, btn = false){ 5195 let err = false, 5196 rows = document.getElementById(formID).querySelectorAll('.row'); 5197 5198 for (let i = 0; i < rows.length; i++) { 5199 if (rows[i].querySelector('.mf-req')) { 5200 const input = rows[i].querySelector('input'); 5201 5202 if (input.value === '') { 5203 err = true; 5204 if (btn) { 5205 btn.disabled = false; 5206 } 5207 break; 5208 } 5209 } 5210 } 5211 // еÑли неÑÑ Ð¾Ñибки пеÑекидÑваем на ÑÑÑаниÑÑ Ð±Ð»Ð°Ð³Ð¾Ð´Ð°ÑноÑÑи 5212 if (!err) { 5213 if (btn) { 5214 btn.disabled = true; 5215 } 5216 document.location.href = '/thank-you/'; 5217 } 5218 } 5219 //оÑпÑавка даннÑÑ 5220 static submit(event) { 5221 const target = event.target; 5222 if(target.classList.contains('btn_buy')) { 5223 AddEventOnButton.requeridField(target.form.id, target); 5224 } 5225 } 5226 } 5227 5228 const newEvent = new AddEventOnButton(); 5229 // ÑобÑÑие на кнопке "заказаÑÑ Ð·Ð²Ð¾Ð½Ð¾Ðº" 5230 newEvent.addEventOnButton('.callback_btn'); 5231 // ÑобÑÑие на кнопке "заказаÑÑ ÑоваÑ" 5232 newEvent.addEventOnButton('.detail-ask-price'); 5233 // ÑобÑÑие на кнопке "кÑпиÑÑ Ð² один клик" 5234 newEvent.addEventOnButton('.boc_anch'); 5235 // ÑобÑÑие на кнопке "наÑли деÑевле" 5236 newEvent.addEventOnButton('.cheaper_anch'); 5237 // ÑобÑÑие на кнопке "ÐапÑоÑиÑÑ ÑенÑ" 5238 newEvent.addEventOnButton('.apuo'); 5239 // ÑобÑÑие на кнопке "ÐапÑоÑиÑÑ ÑенÑ" 5240 newEvent.addEventOnButton('.ask_price_list'); 5241 })(); 5242}); 5243/* End */ 5244; 5245; /* Start:"a:4:{s:4:"full";s:55:"/local/templates/elektro_flat/js/myJS.js?16636830722174";s:6:"source";s:40:"/local/templates/elektro_flat/js/myJS.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 5246// ôîðìà "Âîçíèêëè âîïðîñû?" 5247$(document).ready(function(){ 5248 let dsForm = $( '.ds-form' ); 5249 dsForm.on( 'focusin', 'input', function(){ 5250 dsForm.find('.error_form').empty(); 5251 }); 5252 5253 dsForm.on( 'click', 'input[type=submit]', function(){ 5254 let err = false; 5255 let reqField = dsForm.find( 'input' ); 5256 for( let i = 0; i < reqField.length; i++ ){ 5257 let req = $(reqField[i]); 5258 if( req.val() == '' && req.attr( 'required' ) == 'required'){ 5259 err = true; 5260 break; 5261 } 5262 } 5263 5264 // åñëè íåòó îøèáêè ïåðåêèäûâàåì íà ñòðàíèöó áäëàãîäàðíîñòè 5265 if(!err){ 5266 document.location.href = '/thank-you/'; 5267 } 5268 5269 }); 5270}); 5271 5272$(document).ready(function(){ 5273 let dsForm = $( '.dspopup-modal' ); 5274 dsForm.on( 'input', function(){ 5275 dsForm.find('.error_form').empty(); 5276 }); 5277 5278 dsForm.on( 'click', 'input[type=submit]', function(){ 5279 let err = false; 5280 let reqField = dsForm.find( 'input' ); 5281 for( let i = 0; i < reqField.length; i++ ){ 5282 let req = $(reqField[i]); 5283 if( req.val() == '' && req.attr( 'required' ) == 'required'){ 5284 err = true; 5285 break; 5286 } 5287 } 5288 5289 // åñëè íåòó îøèáêè ïåðåêèäûâàåì íà ñòðàíèöó áäëàãîäàðíîñòè 5290 if(!err){ 5291 document.location.href = '/thank-you/'; 5292 } 5293 5294 }); 5295}); 5296 5297$(document).ready(function(){ 5298 var urlSity=window.location.href; 5299 5300 $(function () { 5301 siteCode = getLastPartOfUrl(urlSity); 5302 $('body').addClass(siteCode); 5303 }); 5304 5305 var getLastPartOfUrl = function($url) { 5306 var url = $url; 5307 var urlsplit = url.split("/"); 5308 var lastpart = urlsplit[urlsplit.length-1]; 5309 if(lastpart===''){ 5310 lastpart = urlsplit[urlsplit.length-2]; 5311 } 5312 return lastpart; 5313 } 5314 5315 $('.callcont .btn_buy').click(function() { 5316 $('.exit').click(); 5317 }); 5318 5319 if (Function('/*@cc_on return document.documentMode===10@*/')()){ 5320 document.documentElement.className+=' ie10'; 5321 } 5322 5323 $('.callback_btn, .btn_buy.boc_anch, .catalog-item-card .full, a.apuo_detail').on('click', function() { 5324 setTimeout(function(){ 5325 // console.log('time'); 5326 $('form input[name="NAME"]').attr('placeholder', 'Âàøå èìÿ'); 5327 $('form input[name="PHONE"]').attr('placeholder', '+7 (___) ___-__-__'); 5328 $('form input[name="TIME"]').attr('placeholder', '__-__'); 5329 },500); 5330 }); 5331}); 5332 5333/* End */ 5334; 5335; /* Start:"a:4:{s:4:"full";s:73:"/local/templates/elektro_flat/js/jquery.maskedinput.min.js?15330357784324";s:6:"source";s:58:"/local/templates/elektro_flat/js/jquery.maskedinput.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 5336/* 5337 jQuery Masked Input Plugin 5338 Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com) 5339 Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 5340 Version: 1.4.1 5341*/ 5342!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a<g.placeholder.length?a:0)}function q(a){for(;++a<n&&!j[a];);return a}function r(a){for(;--a>=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.begin<l&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}else{for(A(!0);b.begin<n&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}h()}function v(){A(),B.val()!=E&&B.change()}function w(a){if(!B.prop("readonly")){var b,c,e,f=a.which||a.keyCode;o=B.val(),8===f||46===f||d&&127===f?(b=B.caret(),c=b.begin,e=b.end,e-c===0&&(c=46!==f?r(c):e=q(c-1),e=46===f?q(e):e),y(c,e),s(c,e-1),a.preventDefault()):13===f?v.call(this,a):27===f&&(B.val(E),B.caret(0,A()),a.preventDefault())}}function x(b){if(!B.prop("readonly")){var c,d,e,g=b.which||b.keyCode,i=B.caret();if(!(b.ctrlKey||b.altKey||b.metaKey||32>g)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++<e.length;)if(c=e.charAt(d-1),j[b].test(c)){C[b]=c,f=b;break}if(d>e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})}); 5343/* End */ 5344; 5345; /* Start:"a:4:{s:4:"full";s:54:"/local/templates/elektro_flat/script.js?16984121266636";s:6:"source";s:39:"/local/templates/elektro_flat/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 5346function adjustItemHeight(item) { 5347 var maxHeight = 0; 5348 item.css("height", "auto"); 5349 item.each(function() { 5350 if($(this).height() > maxHeight) { 5351 maxHeight = $(this).height(); 5352 } 5353 }); 5354 item.height(maxHeight); 5355} 5356 5357$(function(){ 5358 $(".close").live("click", function() { 5359 CloseModalWindow("#addItemInCart") 5360 }); 5361 $(document).keyup(function(event){ 5362 if(event.keyCode == 27) { 5363 CloseModalWindow("#addItemInCart") 5364 } 5365 }); 5366}); 5367 5368function CentriredModalWindow(ModalName){ 5369 $(window).resize(function () {
5370 modalHeight = ($(window).height() - $(ModalName).height()) / 2; 5371 $(ModalName).css({ 5372 'top': modalHeight + 'px' 5373 }); 5374 }); 5375 $(window).resize(); 5376} 5377 5378function OpenModalWindow(ModalName){ 5379 $(ModalName).fadeIn(300); 5380 $("#bgmod").fadeIn(300); 5381} 5382 5383function CloseModalWindow(ModalName){ 5384 $("#bgmod").fadeOut(300); 5385 $(ModalName).fadeOut(300); 5386} 5387 5388function refreshCartLine(result, disabled) { 5389 disabled = disabled || false; 5390 5391 var basketCont, sumOld, sumCurr; 5392 5393 basketCont = $(".cart_line"); 5394 5395 basketCont.find(".qnt").text($(result).find(".qnt").text()); 5396 5397 basketCont.find(".sum").data("decimal", $(result).find(".sum").data("decimal")); 5398 5399 sumOld = basketCont.find(".sum").data("sum"); 5400 basketCont.find(".sum").data("sum", $(result).find(".sum").data("sum")); 5401 sumCurr = basketCont.find(".sum").data("sum"); 5402 5403 if(sumCurr != sumOld) { 5404 var options = { 5405 useEasing: false, 5406 useGrouping: true, 5407 separator: basketCont.find(".sum").data("separator"), 5408 decimal: basketCont.find(".sum").data("dec-point") 5409 } 5410 var counter = new countUp("cartCounter", sumOld, sumCurr, basketCont.find(".sum").data("decimal"), 0.5, options); 5411 counter.start(); 5412 } 5413 5414 if(disabled != true) 5415 basketCont.find(".oformit_cont").html($(result).find(".oformit_cont").html()); 5416} 5417 5418function addToCompare(href, btn, site_dir) { 5419 $.ajax({ 5420 type: "POST", 5421 url: href, 5422 success: function(html){ 5423 $.post(site_dir + "ajax/compare_line.php", function(data) { 5424 $(".compare_line").replaceWith(data); 5425 }); 5426 $("#" + btn).removeClass("catalog-item-compare").addClass("catalog-item-compared").removeAttr("onclick").css({"cursor": "default"}); 5427 } 5428 }); 5429 return false; 5430} 5431 5432function addToDelay(id, qnt_cont, props, select_props, btn, site_dir, dsbl) { 5433 dsbl = dsbl || false; 5434 $.ajax({ 5435 type: "POST", 5436 url: site_dir + "ajax/add2delay.php", 5437 data: "id=" + id + "&qnt=" + $("#" + qnt_cont).val() + "&props=" + props + "&select_props=" +select_props, 5438 success: function(html){ 5439 $.post(site_dir + "ajax/delay_line.php", function(data) { 5440 $(".delay_line").replaceWith(data); 5441 }); 5442 $.post(site_dir + "ajax/basket_line.php", function(data) { 5443 refreshCartLine(data, dsbl); 5444 }); 5445 $("#" + btn).removeClass("catalog-item-delay").addClass("catalog-item-delayed").removeAttr("onclick").css({"cursor": "default"}); 5446 } 5447 }); 5448 return false; 5449} 5450 5451// Ðàñêðûâàåì ôèëüòðû. 5452// Îñòàâëÿåì ïàðàìåòðû "Ðîçíè÷íàÿ öåíà" è "Ïðîèçâîäèòåëü" îñòàëüíîå ñêðûâàåì è äîáàâëÿåì ññûëêó "Ïîêàçàòü âñå ïàðàìåòðû". 5453// Êëèêàÿ ïî ññûëêå ðàñêðûâàåì âñå îñòàëüíûå ïàðàìåòðû. 5454document.addEventListener('DOMContentLoaded', () => { 5455 (() => { 5456 'use strict'; 5457 const filterList = document.querySelectorAll('.bx_filter_box'); 5458 5459 if (filterList.length != 0) { 5460 init(document.querySelector('.filter table tbody')); 5461 5462 const btnShowFilter = document.querySelector('.btn__show_filter'); 5463 5464 hideProps(filterList, btnShowFilter); 5465 5466 btnShowFilter.addEventListener('click', () => { 5467 showProps(filterList, btnShowFilter); 5468 }); 5469 } 5470 5471 function init(parent) { 5472 let tr = document.createElement('tr'); 5473 tr.innerHTML = '<tr style="display: block;"><td colspan="2" style="text-align:center; color:#cd3367; cursor:pointer;"><div class="btn__show_filter">Ïîêàçàòü âñå ïàðàìåòðû</div></td></tr>'; 5474 parent.append(tr); 5475 5476 const toogleFilter = document.querySelector('.catalog_item_toogle_filter'); 5477 if (!toogleFilter.classList.contains('active')) { 5478 toogleFilter.classList.add('active'); 5479 document.querySelector('.filter').style.display = 'block'; 5480 } 5481 } 5482 5483 function show(elem) { 5484 elem.style.display = 'block'; 5485 } 5486 5487 function hide(elem) { 5488 elem.style.display = 'none'; 5489 } 5490 5491 function hideProps(boxs, btn) { 5492 boxs.forEach(item => { 5493 const name = item.children[0].innerText; 5494 if (name.indexOf('Ðîçíè÷íàÿ öåíà') == 0 || name.indexOf('Ïðîèçâîäèòåëü') == 0) { 5495 show(item); 5496 } else { 5497 hide(item) 5498 } 5499 }); 5500 5501 if(btn) { 5502 btn.classList = 'btn__show_filter'; 5503 btn.innerText = 'Ïîêàçàòü âñå ïàðàìåòðû'; 5504 btn.addEventListener('click', () => { 5505 showProps(boxs, btn); 5506 }); 5507 } 5508 } 5509 5510 function showProps(boxs, btn) { 5511 boxs.forEach(item => { 5512 if (item.style.display == 'none') { 5513 show(item); 5514 } 5515 }); 5516 5517 btn.classList = 'btn__hide_filter';
5518 btn.innerText = 'Ñêðûòü ïàðàìåòðû'; 5519 5520 btn.addEventListener('click', () => { 5521 hideProps(boxs, btn); 5522 }); 5523 } 5524 5525 })(); 5526}); 5527 5528 5529document.addEventListener('DOMContentLoaded', () => { 5530 (() => { 5531 'use strict'; 5532 let meta = ''; 5533 let title = ''; 5534 let catalogDescription = document.querySelector('.catalog_description') 5535 5536 5537 })(); 5538}); 5539 5540 5541document.addEventListener("DOMContentLoaded", () => { 5542 (() => { 5543 // use query selector that matches your class name 5544 // you may assign it to a variable; we have used literal here 5545 // to make this example more clear. 5546 5547 const lazyBackgrounds = [].slice.call(document.querySelectorAll(".lazy-background")); 5548 5549 if ("IntersectionObserver" in window) { 5550 let lazyBackgroundObserver = 5551 new IntersectionObserver(function(entries, observer) { 5552 entries.forEach(function(entry) { 5553 if (entry.isIntersecting) { 5554 5555 // remove the lazy class name 5556 // when image enters viewport 5557 entry.target.classList.remove("lazy-background"); 5558 lazyBackgroundObserver.unobserve(entry.target); 5559 } 5560 }); 5561 }); 5562 5563 lazyBackgrounds.forEach(function(lazyBackground) { 5564 lazyBackgroundObserver.observe(lazyBackground); 5565 }); 5566 } else { 5567 lazyBackgrounds.forEach(function(entry) { 5568 entry.classList.remove("lazy-background"); 5569 }); 5570 } 5571 })(); 5572}); 5573/* End */ 5574; 5575; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/components/altop/search.title/script.js?15330357728506";s:6:"source";s:47:"/bitrix/components/altop/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 5576function JCTitleSearch(arParams) 5577{ 5578 var _this = this; 5579 5580 this.arParams = {
5581 'AJAX_PAGE': arParams.AJAX_PAGE, 5582 'CONTAINER_ID': arParams.CONTAINER_ID, 5583 'INPUT_ID': arParams.INPUT_ID, 5584 'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN) 5585 }; 5586 if(arParams.WAIT_IMAGE) 5587 this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE; 5588 if(arParams.MIN_QUERY_LEN <= 0) 5589 arParams.MIN_QUERY_LEN = 1; 5590 5591 this.cache = []; 5592 this.cache_key = null; 5593 5594 this.startText = ''; 5595 this.currentRow = -1; 5596 this.RESULT = null; 5597 this.CONTAINER = null; 5598 this.INPUT = null; 5599 this.WAIT = null; 5600 5601 this.ShowResult = function(result) 5602 { 5603 var pos = BX.pos(_this.CONTAINER); 5604 pos.width = (pos.right - pos.left) + 28; 5605 _this.RESULT.style.position = 'absolute'; 5606 _this.RESULT.style.top = (pos.bottom + 16) + 'px'; 5607 _this.RESULT.style.left = pos.left + 'px'; 5608 _this.RESULT.style.width = pos.width + 'px'; 5609 if(result != null) 5610 _this.RESULT.innerHTML = result; 5611 5612 if(_this.RESULT.innerHTML.length > 0) 5613 _this.RESULT.style.display = 'block'; 5614 else 5615 _this.RESULT.style.display = 'none'; 5616 5617 //ajust left column to be an outline 5618 var th; 5619 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 5620 if(tbl) th = BX.findChild(tbl, {'tag':'th'}, true); 5621 if(th) 5622 { 5623 var tbl_pos = BX.pos(tbl); 5624 tbl_pos.width = tbl_pos.right - tbl_pos.left; 5625 5626 var th_pos = BX.pos(th); 5627 th_pos.width = th_pos.right - th_pos.left; 5628 th.style.width = th_pos.width + 'px'; 5629 5630 _this.RESULT.style.width = (pos.width + th_pos.width) + 'px'; 5631 5632 //Move table to left by width of the first column 5633 _this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px'; 5634 5635 //Shrink table when it's too wide 5636 if((tbl_pos.width - th_pos.width) > pos.width) 5637 _this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px'; 5638 5639 //Check if table is too wide and shrink result div to it's width 5640 tbl_pos = BX.pos(tbl); 5641 var res_pos = BX.pos(_this.RESULT); 5642 if(res_pos.right > tbl_pos.right) 5643 { 5644 _this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px'; 5645 } 5646 } 5647 5648 var fade; 5649 if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true); 5650 if(fade && th) 5651 { 5652 res_pos = BX.pos(_this.RESULT); 5653 fade.style.left = (res_pos.right - res_pos.left - 18) + 'px'; 5654 fade.style.width = 18 + 'px'; 5655 fade.style.top = 0 + 'px'; 5656 fade.style.height = (res_pos.bottom - res_pos.top) + 'px'; 5657 fade.style.display = 'block'; 5658 } 5659 } 5660 5661 this.onKeyPress = function(keyCode) 5662 { 5663 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 5664 if(!tbl) 5665 return false; 5666 5667 var cnt = tbl.rows.length; 5668 5669 switch (keyCode) 5670 { 5671 case 27: // escape key - close search div 5672 _this.RESULT.style.display = 'none'; 5673 _this.currentRow = -1; 5674 _this.UnSelectAll(); 5675 return true; 5676 5677 case 40: // down key - navigate down on search results 5678 if(_this.RESULT.style.display == 'none') 5679 _this.RESULT.style.display = 'block'; 5680 5681 var first = -1; 5682 for(var i = 0; i < cnt; i++) 5683 { 5684 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 5685 { 5686 if(first == -1) 5687 first = i; 5688 5689 if(_this.currentRow < i) 5690 { 5691 _this.currentRow = i; 5692 break; 5693 } 5694 else if(tbl.rows[i].className == 'title-search-selected') 5695 { 5696 tbl.rows[i].className = ''; 5697 } 5698 } 5699 } 5700 5701 if(i == cnt && _this.currentRow != i) 5702 _this.currentRow = first; 5703 5704 tbl.rows[_this.currentRow].className = 'title-search-selected'; 5705 return true; 5706 5707 case 38: // up key - navigate up on search results 5708 if(_this.RESULT.style.display == 'none') 5709 _this.RESULT.style.display = 'block'; 5710 5711 var last = -1; 5712 for(var i = cnt-1; i >= 0; i--) 5713 { 5714 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 5715 { 5716 if(last == -1) 5717 last = i; 5718 5719 if(_this.currentRow > i) 5720 { 5721 _this.currentRow = i; 5722 break; 5723 } 5724 else if(tbl.rows[i].className == 'title-search-selected') 5725 { 5726 tbl.rows[i].className = ''; 5727 } 5728 } 5729 } 5730 5731 if(i < 0 && _this.currentRow != i) 5732 _this.currentRow = last; 5733 5734 tbl.rows[_this.currentRow].className = 'title-search-selected'; 5735 return true; 5736 5737 case 13: // enter key - choose current search result 5738 if(_this.RESULT.style.display == 'block') 5739 { 5740 for(var i = 0; i < cnt; i++) 5741 { 5742 if(_this.currentRow == i) 5743 { 5744 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 5745 { 5746 var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true); 5747 if(a) 5748 { 5749 window.location = a.href; 5750 return true; 5751 } 5752 } 5753 } 5754 } 5755 } 5756 return false;
5757 } 5758 5759 return false; 5760 } 5761 5762 this.onTimeout = function() 5763 { 5764 if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText) 5765 { 5766 if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN) 5767 { 5768 _this.oldValue = _this.INPUT.value; 5769 _this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value; 5770 if(_this.cache[_this.cache_key] == null) 5771 { 5772 if(_this.WAIT) 5773 { 5774 var pos = BX.pos(_this.INPUT); 5775 _this.WAIT.style.top = (pos.top+12) + 'px'; 5776 _this.WAIT.style.left = (pos.left+10) + 'px'; 5777 _this.WAIT.style.display = 'block'; 5778 } 5779 5780 BX.ajax.post( 5781 _this.arParams.AJAX_PAGE, 5782 { 5783 'ajax_call':'y', 5784 'INPUT_ID':_this.arParams.INPUT_ID, 5785 'q':_this.INPUT.value 5786 }, 5787 function(result) 5788 { 5789 _this.cache[_this.cache_key] = result; 5790 _this.ShowResult(result); 5791 _this.currentRow = -1; 5792 _this.EnableMouseEvents(); 5793 if(_this.WAIT) 5794 _this.WAIT.style.display = 'none'; 5795 setTimeout(_this.onTimeout, 500); 5796 } 5797 ); 5798 } 5799 else 5800 { 5801 _this.ShowResult(_this.cache[_this.cache_key]); 5802 _this.currentRow = -1; 5803 _this.EnableMouseEvents(); 5804 setTimeout(_this.onTimeout, 500); 5805 } 5806 } 5807 else 5808 { 5809 _this.RESULT.style.display = 'none'; 5810 _this.currentRow = -1; 5811 _this.UnSelectAll(); 5812 setTimeout(_this.onTimeout, 500); 5813 } 5814 } 5815 else 5816 { 5817 setTimeout(_this.onTimeout, 500); 5818 } 5819 } 5820 5821 this.UnSelectAll = function() 5822 { 5823 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 5824 if(tbl) 5825 { 5826 var cnt = tbl.rows.length; 5827 for(var i = 0; i < cnt; i++) 5828 tbl.rows[i].className = ''; 5829 } 5830 } 5831 5832 this.EnableMouseEvents = function() 5833 { 5834 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 5835 if(tbl) 5836 { 5837 var cnt = tbl.rows.length; 5838 for(var i = 0; i < cnt; i++) 5839 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 5840 { 5841 tbl.rows[i].id = 'row_' + i; 5842 tbl.rows[i].onmouseover = function (e) { 5843 if(_this.currentRow != this.id.substr(4)) 5844 { 5845 _this.UnSelectAll(); 5846 this.className = 'title-search-selected'; 5847 _this.currentRow = this.id.substr(4); 5848 } 5849 }; 5850 tbl.rows[i].onmouseout = function (e) { 5851 this.className = ''; 5852 _this.currentRow = -1; 5853 }; 5854 } 5855 } 5856 } 5857 5858 this.onFocusLost = function(hide) 5859 { 5860 setTimeout(function(){_this.RESULT.style.display = 'none';}, 250); 5861 } 5862 5863 this.onFocusGain = function() 5864 { 5865 if(_this.RESULT.innerHTML.length) { 5866 _this.ShowResult(); 5867 } 5868 } 5869 5870 this.onKeyDown = function(e) 5871 { 5872 if(!e) 5873 e = window.event; 5874 5875 if (_this.RESULT.style.display == 'block') 5876 { 5877 if(_this.onKeyPress(e.keyCode)) 5878 return BX.PreventDefault(e); 5879 } 5880 } 5881 5882 this.Init = function() 5883 { 5884 this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID); 5885 this.RESULT = document.body.appendChild(document.createElement("DIV")); 5886 this.RESULT.className = 'title-search-result'; 5887 this.INPUT = document.getElementById(this.arParams.INPUT_ID); 5888 this.startText = this.oldValue = this.INPUT.value; 5889 BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()}); 5890 //BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()}); 5891 5892 if(BX.browser.IsSafari() || BX.browser.IsIE()) 5893 this.INPUT.onkeydown = this.onKeyDown; 5894 else 5895 this.INPUT.onkeypress = this.onKeyDown; 5896 5897 if(this.arParams.WAIT_IMAGE) 5898 { 5899 this.WAIT = document.body.appendChild(document.createElement("DIV")); 5900 this.WAIT.innerHTML = "<i class='fa fa-spinner fa-pulse'></i>"; 5901 this.WAIT.className = 'title-search-wait'; 5902 this.WAIT.style.background = "#fff"; 5903 this.WAIT.style.display = 'none'; 5904 this.WAIT.style.position = 'absolute'; 5905 this.WAIT.style.zIndex = '1100'; 5906 } 5907 5908 setTimeout(this.onTimeout, 500); 5909 } 5910 5911 BX.ready(function (){_this.Init(arParams)}); 5912} 5913 5914/* End */ 5915; 5916; /* Start:"a:4:{s:4:"full";s:82:"/bitrix/components/altop/search.title/templates/.default/script.js?153303577221763";s:6:"source";s:66:"/bitrix/components/altop/search.title/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 5917(function (window) { 5918
5919 if(!!window.JCCatalogSectionSearch) { 5920 return; 5921 } 5922 5923 var BasketButton = function(params) { 5924 BasketButton.superclass.constructor.apply(this, arguments); 5925 this.buttonNode = BX.create("button", { 5926 text: params.text, 5927 attrs: { 5928 name: params.name, 5929 className: params.className 5930 }, 5931 events : this.contextEvents 5932 }); 5933 }; 5934 BX.extend(BasketButton, BX.PopupWindowButton); 5935 5936 window.JCCatalogSectionSearch = function (arParams) { 5937 this.productType = 0; 5938 this.visual = { 5939 ID: '', 5940 PICT_ID: '', 5941 PRICE_ID: '', 5942 BUY_ID: '', 5943 }; 5944 this.product = { 5945 name: '', 5946 id: 0, 5947 pict: {}, 5948 }; 5949 5950 this.offersView = null; 5951 this.offers = []; 5952 this.offerNum = 0; 5953 this.treeProps = []; 5954 this.obTreeRows = []; 5955 this.selectedValues = {}; 5956 this.selectProps = []; 5957 this.obSelectRows = []; 5958 5959 this.obProduct = null; 5960 this.obPict = null; 5961 this.obPrice = null; 5962 this.obBuy = null; 5963 this.obTree = null; 5964 this.obSelect = null; 5965 this.obBuyBtn = null; 5966 5967 this.obPopupWin = null; 5968 this.basketParams = {}; 5969 5970 this.errorCode = 0; 5971 5972 if('object' === typeof arParams) { 5973 this.productType = parseInt(arParams.PRODUCT_TYPE, 10); 5974 this.visual = arParams.VISUAL; 5975 5976 switch (this.productType) { 5977 case 1://product 5978 case 2://set 5979 if(!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT)) { 5980 this.product.name = arParams.PRODUCT.NAME; 5981 this.product.pict = arParams.PRODUCT.PICT; 5982 this.product.id = arParams.PRODUCT.ID; 5983 if(!!arParams.SELECT_PROPS) { 5984 this.selectProps = arParams.SELECT_PROPS; 5985 } 5986 } else { 5987 this.errorCode = -1; 5988 } 5989 break; 5990 case 3://sku 5991 if(!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS)) { 5992 if(!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT)) { 5993 this.product.name = arParams.PRODUCT.NAME; 5994 this.product.pict = arParams.PRODUCT.PICT; 5995 this.product.id = arParams.PRODUCT.ID; 5996 if(!!arParams.SELECT_PROPS) { 5997 this.selectProps = arParams.SELECT_PROPS; 5998 } 5999 } 6000 if(!!arParams.OFFERS_VIEW) { 6001 this.offersView = arParams.OFFERS_VIEW; 6002 } 6003 this.offers = arParams.OFFERS; 6004 this.offerNum = 0; 6005 if(!!arParams.OFFER_SELECTED) { 6006 this.offerNum = parseInt(arParams.OFFER_SELECTED, 10); 6007 } 6008 if(isNaN(this.offerNum)) { 6009 this.offerNum = 0; 6010 } 6011 if(!!arParams.TREE_PROPS) { 6012 this.treeProps = arParams.TREE_PROPS; 6013 } 6014 } else { 6015 this.errorCode = -1; 6016 } 6017 break; 6018 default: 6019 this.errorCode = -1; 6020 } 6021 } 6022 if(0 === this.errorCode) { 6023 BX.ready(BX.delegate(this.Init,this)); 6024 } 6025 }; 6026 6027 window.JCCatalogSectionSearch.prototype.Init = function() { 6028 var i = 0, 6029 strPrefix = '', 6030 selPrefix = '', 6031 TreeItems = null, 6032 SelectItems = null, 6033 buyBtnItems = null; 6034 6035 this.obProduct = BX(this.visual.ID); 6036 if(!this.obProduct) { 6037 this.errorCode = -1; 6038 } 6039 6040 if(3 === this.productType) { 6041 if("LIST" !== this.offersView) { 6042 this.obPict = BX(this.visual.PICT_ID); 6043 if(!this.obPict) { 6044 this.errorCode = -16; 6045 } 6046 6047 this.obPrice = BX(this.visual.PRICE_ID); 6048 if(!this.obPrice) { 6049 this.errorCode = -16; 6050 } 6051 6052 this.obBuy = BX(this.visual.BUY_ID); 6053 if(!this.obBuy) { 6054 this.errorCode = -16; 6055 } 6056 6057 if(!!this.visual.TREE_ID) { 6058 this.obTree = BX(this.visual.TREE_ID); 6059 if(!this.obTree) { 6060 this.errorCode = -256; 6061 } 6062 strPrefix = this.visual.TREE_ITEM_ID; 6063 for(i = 0; i < this.treeProps.length; i++) { 6064 this.obTreeRows[i] = { 6065 LIST: BX(strPrefix+this.treeProps[i].ID+'_list'), 6066 CONT: BX(strPrefix+this.treeProps[i].ID+'_cont') 6067 }; 6068 if(!this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT) { 6069 this.errorCode = -512; 6070 break; 6071 } 6072 } 6073 } 6074 } 6075 } 6076 6077 if(!!this.visual.SELECT_PROP_ID) { 6078 this.obSelect = BX(this.visual.SELECT_PROP_ID); 6079 if(!this.obSelect) { 6080 this.errorCode = -256; 6081 } 6082 selPrefix = this.visual.SELECT_PROP_ITEM_ID; 6083 for(i = 0; i < this.selectProps.length; i++) { 6084 this.obSelectRows[i] = BX(selPrefix+this.selectProps[i].ID); 6085 if(!this.obSelectRows[i]) { 6086 this.errorCode = -512; 6087 break; 6088 } 6089 } 6090 } 6091 6092 if(!!this.visual.BTN_BUY_ID) { 6093 this.obBuyBtn = BX(this.visual.BTN_BUY_ID); 6094 } 6095 6096 if(0 === this.errorCode) { 6097 switch (this.productType) { 6098 case 1://product 6099 case 2://set 6100 if(!!this.obSelect) { 6101 SelectItems = BX.findChildren(this.obSelect, {tagName: 'li'}, true); 6102 if(!!SelectItems && 0 < SelectItems.length) { 6103 for(i = 0; i < SelectItems.length; i++) { 6104 BX.bind(SelectItems[i], 'click', BX.delegate(this.SelectProp, this)); 6105 } 6106 this.SetSelectCurrent(); 6107 } 6108 } 6109 break; 6110 case 3://sku 6111 if("LIST" !== this.offersView) { 6112 TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true); 6113 if(!!TreeItems && 0 < TreeItems.length) { 6114 for(i = 0; i < TreeItems.length; i++) { 6115 BX.bind(TreeItems[i], 'click', BX.delegate(this.SelectOfferProp, this)); 6116 } 6117 } 6118 this.SetCurrent(); 6119 } 6120 6121 if(!!this.obSelect) { 6122 SelectItems = BX.findChildren(this.obSelect, {tagName: 'li'}, true); 6123 if(!!SelectItems && 0 < SelectItems.length) { 6124 for(i = 0; i < SelectItems.length; i++) { 6125 BX.bind(SelectItems[i], 'click', BX.delegate(this.SelectProp, this)); 6126 } 6127 this.SetSelectCurrent(); 6128 } 6129 } 6130 break; 6131 } 6132 } 6133 6134 switch(this.productType) { 6135 case 1://product 6136 case 2://set 6137 if(!!this.obBuyBtn) 6138 BX.bind(this.obBuyBtn, "click", BX.delegate(this.Add2Basket, this)); 6139 break; 6140 case 3://sku 6141 if("LIST" !== this.offersView) { 6142 if(!!this.obBuy) { 6143 buyBtnItems = BX.findChildren(this.obBuy, {tagName: "button"}, true); 6144 if(!!buyBtnItems && 0 < buyBtnItems.length) { 6145 for(i = 0; i < buyBtnItems.length; i++) { 6146 BX.bind(buyBtnItems[i], "click", BX.delegate(this.Add2Basket, this)); 6147 } 6148 } 6149 } 6150 } else { 6151 if(!!this.obProduct) { 6152 buyBtnItems = BX.findChildren(this.obProduct, {tagName: "button", attribute: {name: "add2basket"}}, true); 6153 if(!!buyBtnItems && 0 < buyBtnItems.length) { 6154 for(i = 0; i < buyBtnItems.length; i++) { 6155 BX.bind(buyBtnItems[i], "click", BX.delegate(this.Add2Basket, this)); 6156 } 6157 } 6158 } 6159 } 6160 break; 6161 } 6162 }; 6163 6164 window.JCCatalogSectionSearch.prototype.SelectProp = function() { 6165 var i = 0, 6166 RowItems = null, 6167 ActiveItems = null, 6168 selPropValueArr = [], 6169 selPropValue = null, 6170 selDelayOnclick = null, 6171 selDelayOnclickArr = [], 6172 selDelayOnclickNew = null, 6173 target = BX.proxy_context; 6174 6175 if(!!target && target.hasAttribute('data-select-onevalue')) { 6176 RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false); 6177 if(!!RowItems && 0 < RowItems.length) { 6178 for(i = 0; i < RowItems.length; i++) { 6179 BX.removeClass(RowItems[i], 'active'); 6180 } 6181 } 6182 BX.addClass(target, 'active'); 6183 } 6184 6185 ActiveItems = BX.findChildren(this.obSelect, {tagName: 'li', className: 'active'}, true); 6186 if(!!ActiveItems && 0 < ActiveItems.length) { 6187 for(i = 0; i < ActiveItems.length; i++) { 6188 selPropValueArr[i] = ActiveItems[i].getAttribute('data-select-onevalue'); 6189 } 6190 } 6191 selPropValue = selPropValueArr.join('||'); 6192 6193 if(!!this.offers && 0 < this.offers.length) { 6194 for(i = 0; i < this.offers.length; i++) { 6195 /*CART*/ 6196 if(!!BX('select_props_'+this.visual.ID+'_'+this.offers[i].ID)) 6197 BX('select_props_'+this.visual.ID+'_'+this.offers[i].ID).value = selPropValue; 6198 /*DELAY*/ 6199 if(!!BX('catalog-item-delay-'+this.visual.ID+'-'+this.offers[i].ID)) { 6200 selDelayOnclick = BX('catalog-item-delay-'+this.visual.ID+'-'+this.offers[i].ID).getAttribute('onclick'); 6201 selDelayOnclickArr = selDelayOnclick.split("',"); 6202 selDelayOnclickArr[3] = " '"+selPropValue; 6203 selDelayOnclickNew = selDelayOnclickArr.join("',"); 6204 BX('catalog-item-delay-'+this.visual.ID+'-'+this.offers[i].ID).setAttribute('onclick', selDelayOnclickNew); 6205 } 6206 } 6207 } else { 6208 /*CART*/ 6209 if(!!BX('select_props_'+this.visual.ID)) 6210 BX('select_props_'+this.visual.ID).value = selPropValue; 6211 } 6212 } 6213 6214 window.JCCatalogSectionSearch.prototype.SelectOfferProp = function() { 6215 var i = 0, 6216 value = '', 6217 strTreeValue = '', 6218 arTreeItem = [], 6219 RowItems = null, 6220 target = BX.proxy_context; 6221 6222 if(!!target && target.hasAttribute('data-treevalue')) { 6223 strTreeValue = target.getAttribute('data-treevalue'); 6224 arTreeItem = strTreeValue.split('_'); 6225 if(this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1])) { 6226 RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false); 6227 if(!!RowItems && 0 < RowItems.length) { 6228 for(i = 0; i < RowItems.length; i++) { 6229 value = RowItems[i].getAttribute('data-onevalue'); 6230 if(value === arTreeItem[1]) { 6231 BX.addClass(RowItems[i], 'active'); 6232 } else { 6233 BX.removeClass(RowItems[i], 'active'); 6234 } 6235 } 6236 } 6237 } 6238 } 6239 }; 6240 6241 window.JCCatalogSectionSearch.prototype.SearchOfferPropIndex = function(strPropID, strPropValue) { 6242 var strName = '', 6243 arShowValues = false, 6244 i, j, 6245 arCanBuyValues = [], 6246 allValues = [], 6247 index = -1, 6248 arFilter = {}, 6249 tmpFilter = []; 6250 6251 for(i = 0; i < this.treeProps.length; i++) { 6252 if(this.treeProps[i].ID === strPropID) { 6253 index = i; 6254 break; 6255 } 6256 } 6257 6258 if(-1 < index) { 6259 for(i = 0; i < index; i++) { 6260 strName = 'PROP_'+this.treeProps[i].ID; 6261 arFilter[strName] = this.selectedValues[strName]; 6262 } 6263 strName = 'PROP_'+this.treeProps[index].ID; 6264 arShowValues = this.GetRowValues(arFilter, strName); 6265 if(!arShowValues) { 6266 return false;
6267 } 6268 if(!BX.util.in_array(strPropValue, arShowValues)) { 6269 return false; 6270 } 6271 arFilter[strName] = strPropValue; 6272 for(i = index+1; i < this.treeProps.length; i++) { 6273 strName = 'PROP_'+this.treeProps[i].ID; 6274 arShowValues = this.GetRowValues(arFilter, strName); 6275 if(!arShowValues) { 6276 return false; 6277 } 6278 allValues = []; 6279 arCanBuyValues = []; 6280 tmpFilter = []; 6281 tmpFilter = BX.clone(arFilter, true); 6282 for(j = 0; j < arShowValues.length; j++) { 6283 tmpFilter[strName] = arShowValues[j]; 6284 allValues[allValues.length] = arShowValues[j]; 6285 if(this.GetCanBuy(tmpFilter)) 6286 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 6287 } 6288 if(!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues)) { 6289 arFilter[strName] = this.selectedValues[strName]; 6290 } else { 6291 arFilter[strName] = (arCanBuyValues.length > 0 ? arCanBuyValues[0] : allValues[0]); 6292 } 6293 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 6294 } 6295 this.selectedValues = arFilter; 6296 this.ChangeInfo(); 6297 } 6298 return true; 6299 }; 6300 6301 window.JCCatalogSectionSearch.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID) { 6302 var i = 0, 6303 showI = 0, 6304 value = '', 6305 obData = {}, 6306 isCurrent = false, 6307 selectIndex = 0, 6308 RowItems = null; 6309 6310 if(-1 < intNumber && intNumber < this.obTreeRows.length) { 6311 RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false); 6312 if(!!RowItems && 0 < RowItems.length) { 6313 obData = { 6314 props: { className: '' }, 6315 style: {} 6316 }; 6317 for(i = 0; i < RowItems.length; i++) { 6318 value = RowItems[i].getAttribute('data-onevalue'); 6319 isCurrent = (value === activeID); 6320 if(BX.util.in_array(value, canBuyID)) { 6321 obData.props.className = (isCurrent ? 'active' : ''); 6322 } else { 6323 obData.props.className = (isCurrent ? 'active disabled' : 'disabled'); 6324 } 6325 obData.style.display = 'none'; 6326 if(BX.util.in_array(value, showID)) { 6327 obData.style.display = ''; 6328 if(isCurrent) { 6329 selectIndex = showI; 6330 } 6331 showI++; 6332 } 6333 BX.adjust(RowItems[i], obData); 6334 } 6335 6336 obData = { 6337 style: {} 6338 }; 6339 6340 BX.adjust(this.obTreeRows[intNumber].LIST, obData); 6341 } 6342 } 6343 }; 6344 6345 window.JCCatalogSectionSearch.prototype.GetRowValues = function(arFilter, index) { 6346 var i = 0, 6347 j, 6348 arValues = [], 6349 boolSearch = false, 6350 boolOneSearch = true; 6351 6352 if(0 === arFilter.length) { 6353 for(i = 0; i < this.offers.length; i++) { 6354 if(!BX.util.in_array(this.offers[i].TREE[index], arValues)) { 6355 arValues[arValues.length] = this.offers[i].TREE[index]; 6356 } 6357 } 6358 boolSearch = true; 6359 } else { 6360 for(i = 0; i < this.offers.length; i++) { 6361 boolOneSearch = true; 6362 for(j in arFilter) { 6363 if(arFilter[j] !== this.offers[i].TREE[j]) { 6364 boolOneSearch = false; 6365 break; 6366 } 6367 } 6368 if(boolOneSearch) { 6369 if(!BX.util.in_array(this.offers[i].TREE[index], arValues)) { 6370 arValues[arValues.length] = this.offers[i].TREE[index]; 6371 } 6372 boolSearch = true; 6373 } 6374 } 6375 } 6376 return (boolSearch ? arValues : false); 6377 }; 6378 6379 window.JCCatalogSectionSearch.prototype.GetCanBuy = function(arFilter) { 6380 var i = 0, 6381 j, 6382 boolSearch = false, 6383 boolOneSearch = true; 6384 6385 for(i = 0; i < this.offers.length; i++) { 6386 boolOneSearch = true; 6387 for(j in arFilter) { 6388 if(arFilter[j] !== this.offers[i].TREE[j]) { 6389 boolOneSearch = false; 6390 break; 6391 } 6392 } 6393 if(boolOneSearch) { 6394 if(this.offers[i].CAN_BUY) { 6395 boolSearch = true; 6396 break; 6397 } 6398 } 6399 } 6400 return boolSearch; 6401 }; 6402 6403 window.JCCatalogSectionSearch.prototype.SetSelectCurrent = function() { 6404 var i = 0, 6405 SelectItems = null, 6406 selPropValueArr = [], 6407 selPropValue = null, 6408 selDelayOnclick = null, 6409 selDelayOnclickArr = [], 6410 selDelayOnclickNew = null; 6411 6412 for(i = 0; i < this.obSelectRows.length; i++) { 6413 SelectItems = BX.findChildren(this.obSelectRows[i], {tagName: 'li'}, true); 6414 if(!!SelectItems && 0 < SelectItems.length) { 6415 BX.addClass(SelectItems[0], 'active'); 6416 selPropValueArr[i] = SelectItems[0].getAttribute('data-select-onevalue'); 6417 } 6418 } 6419 selPropValue = selPropValueArr.join('||'); 6420 6421 if(!!this.offers && 0 < this.offers.length) { 6422 for(i = 0; i < this.offers.length; i++) { 6423 /*CART*/ 6424 if(!!BX('select_props_'+this.visual.ID+'_'+this.offers[i].ID)) 6425 BX('select_props_'+this.visual.ID+'_'+this.offers[i].ID).value = selPropValue; 6426 /*DELAY*/ 6427 if(!!BX('catalog-item-delay-'+this.visual.ID+'-'+this.offers[i].ID)) { 6428 selDelayOnclick = BX('catalog-item-delay-'+this.visual.ID+'-'+this.offers[i].ID).getAttribute('onclick'); 6429 selDelayOnclickArr = selDelayOnclick.split("',"); 6430 selDelayOnclickArr[3] = " '"+selPropValue; 6431 selDelayOnclickNew = selDelayOnclickArr.join("',"); 6432 BX('catalog-item-delay-'+this.visual.ID+'-'+this.offers[i].ID).setAttribute('onclick', selDelayOnclickNew); 6433 } 6434 } 6435 } else { 6436 /*CART*/ 6437 if(!!BX('select_props_'+this.visual.ID)) 6438 BX('select_props_'+this.visual.ID).value = selPropValue; 6439 } 6440 } 6441 6442 window.JCCatalogSectionSearch.prototype.SetCurrent = function() { 6443 var i = 0, 6444 j = 0, 6445 arCanBuyValues = [], 6446 strName = '', 6447 arShowValues = false, 6448 arFilter = {}, 6449 tmpFilter = [], 6450 current = this.offers[this.offerNum].TREE; 6451 6452 for(i = 0; i < this.treeProps.length; i++) { 6453 strName = 'PROP_'+this.treeProps[i].ID; 6454 arShowValues = this.GetRowValues(arFilter, strName); 6455 if(!arShowValues) { 6456 break; 6457 } 6458 if(BX.util.in_array(current[strName], arShowValues)) { 6459 arFilter[strName] = current[strName]; 6460 } else { 6461 arFilter[strName] = arShowValues[0]; 6462 this.offerNum = 0; 6463 } 6464 arCanBuyValues = []; 6465 tmpFilter = []; 6466 tmpFilter = BX.clone(arFilter, true); 6467 for(j = 0; j < arShowValues.length; j++) { 6468 tmpFilter[strName] = arShowValues[j]; 6469 if(this.GetCanBuy(tmpFilter)) { 6470 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 6471 } 6472 } 6473 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 6474 } 6475 this.selectedValues = arFilter; 6476 this.ChangeInfo(); 6477 }; 6478 6479 window.JCCatalogSectionSearch.prototype.ChangeInfo = function() { 6480 var i = 0, 6481 j, 6482 index = -1, 6483 boolOneSearch = true; 6484 6485 for(i = 0; i < this.offers.length; i++) { 6486 boolOneSearch = true; 6487 for(j in this.selectedValues) { 6488 if(this.selectedValues[j] !== this.offers[i].TREE[j]) { 6489 boolOneSearch = false;
6490 break; 6491 } 6492 } 6493 if(boolOneSearch) { 6494 index = i; 6495 break; 6496 } 6497 } 6498 if(-1 < index) { 6499 this.setPict(this.visual.ID, this.offers[index].ID); 6500 this.setPrice(this.visual.ID, this.offers[index].ID); 6501 this.setBuy(this.visual.ID, this.offers[index].ID); 6502 this.offerNum = index; 6503 } 6504 }; 6505 6506 window.JCCatalogSectionSearch.prototype.setPict = function(visual_id, offer_id) { 6507 PictItems = BX.findChildren(this.obPict, {className: 'img'}, true); 6508 if(!!PictItems && 0 < PictItems.length) { 6509 for(i = 0; i < PictItems.length; i++) { 6510 BX.addClass(PictItems[i], 'hidden'); 6511 } 6512 } 6513 BX.removeClass(BX('img_'+visual_id+'_'+offer_id), 'hidden'); 6514 }; 6515 6516 window.JCCatalogSectionSearch.prototype.setPrice = function(visual_id, offer_id) { 6517 PriceItems = BX.findChildren(this.obPrice, {className: 'price'}, true); 6518 if(!!PriceItems && 0 < PriceItems.length) { 6519 for(i = 0; i < PriceItems.length; i++) { 6520 BX.addClass(PriceItems[i], 'hidden'); 6521 } 6522 } 6523 BX.removeClass(BX('price_'+visual_id+'_'+offer_id), 'hidden'); 6524 }; 6525 6526 window.JCCatalogSectionSearch.prototype.setBuy = function(visual_id, offer_id) { 6527 BuyItems = BX.findChildren(this.obBuy, {className: 'buy_more'}, true); 6528 if(!!BuyItems && 0 < BuyItems.length) { 6529 for(i = 0; i < BuyItems.length; i++) { 6530 BX.addClass(BuyItems[i], 'hidden'); 6531 } 6532 } 6533 BX.removeClass(BX('buy_more_'+visual_id+'_'+offer_id), 'hidden'); 6534 }; 6535 6536 window.JCCatalogSectionSearch.prototype.Add2Basket = function() { 6537 var target = BX.proxy_context, 6538 form = BX.findParent(target, {"tag" : "form"}), 6539 formInputs = BX.findChildren(form, {"tag" : "input"}, true); 6540 6541 if(!!formInputs && 0 < formInputs.length) { 6542 for(i = 0; i < formInputs.length; i++) { 6543 this.basketParams[formInputs[i].getAttribute("name")] = formInputs[i].value; 6544 } 6545 } 6546 6547 if("LIST" == this.offersView) { 6548 var offerItem = BX.findParent(target, {className: "catalog-item"}); 6549 if(!!offerItem) 6550 this.offerNum = offerItem.getAttribute("data-offer-num"); 6551 } 6552 6553 BX.ajax.post( 6554 form.getAttribute("action"), 6555 this.basketParams, 6556 BX.delegate(function(result) { 6557 if(location.pathname != BX.message("SEARCH_SITE_DIR") + "personal/cart/") { 6558 BX.ajax.post( 6559 BX.message("SEARCH_SITE_DIR") + "ajax/basket_line.php", 6560 "", 6561 BX.delegate(function(data) { 6562 refreshCartLine(data); 6563 }, this) 6564 ); 6565 BX.ajax.post( 6566 BX.message("SEARCH_SITE_DIR") + "ajax/delay_line.php", 6567 "", 6568 BX.delegate(function(data) { 6569 var delayLine = BX.findChildren(document.body, {className: "delay_line"}, true); 6570 if(!!delayLine && 0 < delayLine.length) { 6571 for(i = 0; i < delayLine.length; i++) { 6572 delayLine[i].innerHTML = data; 6573 } 6574 } 6575 }, this) 6576 ); 6577 } 6578 BX.adjust(target, { 6579 props: {disabled: true}, 6580 html: "<i class='fa fa-check'></i><span>" + BX.message("SEARCH_ADDITEMINCART_ADDED") + "</span>" 6581 }); 6582 if(location.pathname != BX.message("SEARCH_SITE_DIR") + "personal/cart/") { 6583 this.BasketResult(); 6584 } else { 6585 this.BasketRedirect(); 6586 } 6587 }, this) 6588 ); 6589 }; 6590 6591 window.JCCatalogSectionSearch.prototype.BasketResult = function() { 6592 var close, 6593 strContent, 6594 strPictSrc, 6595 strPictWidth, 6596 strPictHeight, 6597 buttons = []; 6598 6599 if(!!this.obPopupWin) { 6600 this.obPopupWin.close(); 6601 } 6602 6603 this.obPopupWin = BX.PopupWindowManager.create("addItemInCart", null, { 6604 autoHide: true, 6605 offsetLeft: 0, 6606 offsetTop: 0, 6607 overlay: { 6608 opacity: 100 6609 }, 6610 draggable: false, 6611 closeByEsc: false, 6612 closeIcon: {top: "-10px", right: "-10px"}, 6613 titleBar: {content: BX.create("span", {html: BX.message("SEARCH_POPUP_WINDOW_TITLE")})} 6614 }); 6615 6616 BX.addClass(BX("addItemInCart"), "pop-up modal"); 6617 close = BX.findChildren(BX("addItemInCart"), {className: "popup-window-close-icon"}, true); 6618 if(!!close && 0 < close.length) { 6619 for(i = 0; i < close.length; i++) { 6620 close[i].innerHTML = "<i class='fa fa-times'></i>"; 6621 } 6622 } 6623 6624 switch(this.productType) { 6625 case 1://product 6626 case 2://set 6627 strPictSrc = this.product.pict.SRC; 6628 strPictWidth = this.product.pict.WIDTH; 6629 strPictHeight = this.product.pict.HEIGHT; 6630 break; 6631 case 3://sku 6632 strPictSrc = (!!this.offers[this.offerNum].PREVIEW_PICTURE ? this.offers[this.offerNum].PREVIEW_PICTURE.SRC : this.product.pict.SRC); 6633 strPictWidth = (!!this.offers[this.offerNum].PREVIEW_PICTURE ? this.offers[this.offerNum].PREVIEW_PICTURE.WIDTH : this.product.pict.WIDTH); 6634 strPictHeight = (!!this.offers[this.offerNum].PREVIEW_PICTURE ? this.offers[this.offerNum].PREVIEW_PICTURE.HEIGHT : this.product.pict.HEIGHT); 6635 break; 6636 } 6637 6638 strContent = "<div class='cont'><div class='item_image_cont'><div class='item_image_full'><img src='" + strPictSrc + "' width='" + strPictWidth + "' height='" + strPictHeight + "' alt='"+ this.product.name +"' /></div></div><div class='item_title'>" + this.product.name + "</div></div>"; 6639 6640 buttons = [ 6641 new BasketButton({ 6642 text: BX.message("SEARCH_POPUP_WINDOW_BTN_CLOSE"),
6643 name: "close", 6644 className: "btn_buy ppp close", 6645 events: { 6646 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 6647 } 6648 }), 6649 new BasketButton({ 6650 text: BX.message("SEARCH_POPUP_WINDOW_BTN_ORDER"), 6651 name: "order", 6652 className: "btn_buy popdef order", 6653 events: { 6654 click: BX.delegate(this.BasketRedirect, this) 6655 } 6656 }) 6657 ]; 6658 6659 this.obPopupWin.setContent(strContent); 6660 this.obPopupWin.setButtons(buttons); 6661 this.obPopupWin.show(); 6662 }; 6663 6664 window.JCCatalogSectionSearch.prototype.BasketRedirect = function() { 6665 location.href = BX.message("SEARCH_SITE_DIR") + "personal/cart/"; 6666 }; 6667})(window); 6668/* End */ 6669; 6670; /* Start:"a:4:{s:4:"full";s:80:"/bitrix/components/altop/geolocation/templates/.default/script.js?15330357726732";s:6:"source";s:65:"/bitrix/components/altop/geolocation/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 6671//CITY_CHANGE// 6672BX.CityChange = function() { 6673 var close; 6674 6675 BX.CityChange.popup = BX.PopupWindowManager.create("cityChange", null, { 6676 autoHide: true, 6677 offsetLeft: 0, 6678 offsetTop: 0, 6679 overlay: { 6680 opacity: 100 6681 }, 6682 draggable: false, 6683 closeByEsc: false, 6684 closeIcon: { right : "-10px", top : "-10px"}, 6685 titleBar: {content: BX.create("span", {html: BX.message("GEOLOCATION_POPUP_WINDOW_TITLE")})}, 6686 content: "<div class='popup-window-wait'><i class='fa fa-spinner fa-pulse'></i></div>", 6687 events: { 6688 onAfterPopupShow: function() 6689 { 6690 if(!BX.findChild(BX("cityChange"), {className: "bx-sls"}, true, false)) { 6691 BX.ajax.post( 6692 BX.message("GEOLOCATION_COMPONENT_TEMPLATE") + "/popup.php", 6693 { 6694 arParams: BX.message("GEOLOCATION_PARAMS") 6695 }, 6696 BX.delegate(function(result) 6697 { 6698 this.setContent(result); 6699 var windowSize = BX.GetWindowInnerSize(), 6700 windowScroll = BX.GetWindowScrollPos(), 6701 popupHeight = BX("cityChange").offsetHeight; 6702 BX("cityChange").style.top = windowSize.innerHeight/2 - popupHeight/2 + windowScroll.scrollTop + "px"; 6703 }, 6704 this) 6705 ); 6706 } 6707 } 6708 } 6709 }); 6710 6711 BX.addClass(BX("cityChange"), "pop-up city-change"); 6712 close = BX.findChildren(BX("cityChange"), {className: "popup-window-close-icon"}, true); 6713 if(!!close && 0 < close.length) { 6714 for(i = 0; i < close.length; i++) { 6715 close[i].innerHTML = "<i class='fa fa-times'></i>"; 6716 } 6717 } 6718 6719 BX.CityChange.popup.show(); 6720}; 6721 6722//CITY_CONFIRM// 6723BX.CityConfirm = function(not_defined) { 6724 var not_defined = not_defined || false, 6725 close, 6726 strContent, 6727 buttons = []; 6728 6729 BX.CityConfirm.popup = BX.PopupWindowManager.create("cityConfirm", null, { 6730 autoHide: true, 6731 offsetLeft: 0, 6732 offsetTop: 0, 6733 overlay: { 6734 opacity: 100 6735 }, 6736 draggable: false, 6737 closeByEsc: false, 6738 closeIcon: { right : "-10px", top : "-10px"}, 6739 titleBar: false 6740 }); 6741 6742 BX.addClass(BX("cityConfirm"), "pop-up city-confirm"); 6743 close = BX.findChildren(BX("cityConfirm"), {className: "popup-window-close-icon"}, true); 6744 if(!!close && 0 < close.length) { 6745 for(i = 0; i < close.length; i++) { 6746 close[i].innerHTML = "<i class='fa fa-times'></i>"; 6747 } 6748 } 6749 6750 strContent = "<div class='your-city'><div class='your-city__label'>" + BX.message("GEOLOCATION_YOUR_CITY") + "</div><div class='your-city__val'>" + BX.message("GEOLOCATION_POSITIONING") + "</div></div>"; 6751 6752 var CityConfirmButton = function(params) { 6753 CityConfirmButton.superclass.constructor.apply(this, arguments); 6754 this.buttonNode = BX.create("button", { 6755 text: params.text, 6756 attrs: { 6757 name: params.name, 6758 className: params.className 6759 }, 6760 events : this.contextEvents 6761 }); 6762 }; 6763 BX.extend(CityConfirmButton, BX.PopupWindowButton); 6764 6765 if(!not_defined) { 6766 buttons = [ 6767 new CityConfirmButton({ 6768 text: BX.message("GEOLOCATION_YES"), 6769 name: "cityConfirmYes", 6770 className: "btn_buy popdef", 6771 events: { 6772 click: BX.delegate(BX.CityConfirm.popup.close, BX.CityConfirm.popup) 6773 } 6774 }), 6775 new CityConfirmButton({ 6776 text: BX.message("GEOLOCATION_CHANGE_CITY"), 6777 name: "cityConfirmChange", 6778 className: "btn_buy apuo", 6779 events: { 6780 click: BX.delegate(BX.CityChange, BX) 6781 } 6782 }) 6783 ]; 6784 } else { 6785 buttons = [ 6786 new CityConfirmButton({ 6787 text: BX.message("GEOLOCATION_CHANGE_CITY"), 6788 name: "cityConfirmChange", 6789 className: "btn_buy apuo", 6790 events: { 6791 click: BX.delegate(BX.CityChange, BX) 6792 } 6793 }) 6794 ]; 6795 } 6796 6797 BX.CityConfirm.popup.setContent(strContent); 6798 BX.CityConfirm.popup.setButtons(buttons); 6799 6800 BX("geolocation").appendChild(BX("popup-window-overlay-cityConfirm")); 6801 BX("geolocation").appendChild(BX("cityConfirm")); 6802 6803 BX.CityConfirm.popup.show(); 6804}; 6805 6806//GEOLOCATION_DELIVERY// 6807BX.GeolocationDelivery = function(elementId) { 6808 BX("geolocationDelivery-" + elementId).appendChild( 6809 BX.create("div", { 6810 attrs: { 6811 className: "geolocation-delivery__wait" 6812 }, 6813 children: [ 6814 BX.create("i", { 6815 attrs: { 6816 className: "fa fa-spinner fa-pulse" 6817 } 6818 }) 6819 ] 6820 }) 6821 );
6822 BX.ajax.post( 6823 "/bitrix/components/altop/geolocation.delivery/ajax.php", 6824 { 6825 sessid: BX.bitrix_sessid(), 6826 action: "geolocationDelivery", 6827 arParams: { 6828 "ELEMENT_ID": elementId, 6829 "ELEMENT_COUNT": BX("geolocationDelivery-" + elementId).getAttribute("data-element-count"), 6830 "CART_PRODUCTS": BX("geolocationDelivery-" + elementId).getAttribute("data-cart-products"), 6831 "CACHE_TYPE": BX("geolocationDelivery-" + elementId).getAttribute("data-cache-type"), 6832 "CACHE_TIME": BX("geolocationDelivery-" + elementId).getAttribute("data-cache-time") 6833 } 6834 }, 6835 function(result) { 6836 BX("geolocationDelivery-" + elementId).parentNode.innerHTML = result; 6837 } 6838 ); 6839}; 6840 6841//GEOLOCATION// 6842BX.Geolocation = function() { 6843 var geolocation = ymaps.geolocation; 6844 6845 if(geolocation.city) { 6846 BX.ajax.post( 6847 BX.message("GEOLOCATION_COMPONENT_PATH") + "/ajax.php", 6848 { 6849 arParams: BX.message("GEOLOCATION_PARAMS"), 6850 sessid: BX.bitrix_sessid(), 6851 action: "searchLocation", 6852 country: geolocation.country, 6853 region: geolocation.region, 6854 city: geolocation.city 6855 }, 6856 function(result) { 6857 var json = JSON.parse(result); 6858 $(".geolocation__value").html(json.city); 6859 if(BX.message("GEOLOCATION_SHOW_CONFIRM") == "Y") { 6860 BX.CityConfirm(); 6861 $(".your-city__val").html(json.city + "?"); 6862 } 6863 if(!!json.contacts && json.contacts.length > 0) 6864 $(".telephone").html(json.contacts); 6865 geolocationDeliveryItems = BX.findChildren(document.body, {className: "geolocation-delivery"}, true); 6866 if(!!geolocationDeliveryItems && 0 < geolocationDeliveryItems.length) { 6867 for(i = 0; i < geolocationDeliveryItems.length; i++) { 6868 elementId = geolocationDeliveryItems[i].getAttribute("data-element-id"); 6869 if(!!elementId) 6870 BX.GeolocationDelivery(elementId); 6871 } 6872 } 6873 } 6874 ); 6875 } else { 6876 $(".geolocation__value").html(BX.message("GEOLOCATION_NOT_DEFINED")); 6877 if(BX.message("GEOLOCATION_SHOW_CONFIRM") == "Y") { 6878 BX.CityConfirm(true); 6879 $(".your-city__val").html(BX.message("GEOLOCATION_NOT_DEFINED")); 6880 } 6881 geolocationDeliveryItems = BX.findChildren(document.body, {className: "geolocation-delivery"}, true); 6882 if(!!geolocationDeliveryItems && 0 < geolocationDeliveryItems.length) { 6883 for(i = 0; i < geolocationDeliveryItems.length; i++) { 6884 elementId = geolocationDeliveryItems[i].getAttribute("data-element-id"); 6885 if(!!elementId) 6886 BX.GeolocationDelivery(elementId); 6887 } 6888 } 6889 } 6890}; 6891/* End */ 6892; 6893; /* Start:"a:4:{s:4:"full";s:74:"/bitrix/components/altop/forms/templates/.default/script.js?15330357722086";s:6:"source";s:59:"/bitrix/components/altop/forms/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 6894if(!window.BX.PopupFormSubmit) { 6895 BX.PopupFormSubmit = function() { 6896 var target = BX.proxy_context, 6897 popup = BX.findParent(target, {"className" : "pop-up"}), 6898 form = BX.findParent(target, {"tag" : "form"}), 6899 alert = BX.findChild(form, {"className": "alert"}, true, false), 6900 // captchaWord = BX.findChild(form, {"attribute": {"name": "CAPTCHA_WORD"}}, true, false), 6901 // captchaImg = BX.findChild(form, {"tagName": "img"}, true, false), 6902 // captchaSid = BX.findChild(form, {"attribute": {"name": "CAPTCHA_SID"}}, true, false), 6903 formInput, 6904 formTextarea, 6905 data = []; 6906 6907 formInput = BX.findChildren(form, {"tag" : "input"}, true); 6908 if(!!formInput && 0 < formInput.length) { 6909 for(i = 0; i < formInput.length; i++) { 6910 data[formInput[i].getAttribute("name")] = formInput[i].value; 6911 } 6912 } 6913 formTextarea = BX.findChildren(form, {"tag": "textarea"}, true); 6914 if(!!formTextarea && 0 < formTextarea.length) { 6915 for(i = 0; i < formTextarea.length; i++) { 6916 data[formTextarea[i].getAttribute("name")] = formTextarea[i].value; 6917 } 6918 } 6919 6920 var wait = BX.showWait(popup); 6921 BX.ajax({ 6922 url: form.getAttribute("action"), 6923 data: data, 6924 method: "POST", 6925 dataType: "json", 6926 onsuccess: function(data) { 6927 if(!!data.success) { 6928 if(!!alert) 6929 BX.adjust(alert, {html: "<span class='alertMsg good'><i class='fa fa-check'></i><span class='text'>" + data.success.text + "</span></span>"}); 6930 BX.adjust(target, {props: {disabled: true}}); 6931 } else if(!!data.error) { 6932 if(!!alert) 6933 BX.adjust(alert, {html: "<span class='alertMsg bad'><i class='fa fa-times'></i><span class='text'>" + data.error.text + "</span></span>"}); 6934 // if(!!data.error.captcha_code && data.error.captcha_code != "") { 6935 // if(!!captchaWord) 6936 // captchaWord.value = ""; 6937 // if(!!captchaImg) 6938 // BX.adjust(captchaImg, {props: {"src": "/bitrix/tools/captcha.php?captcha_sid=" + data.error.captcha_code}}); 6939 // if(!!captchaSid) 6940 // captchaSid.value = data.error.captcha_code; 6941 // } 6942 } 6943 BX.closeWait(popup, wait); 6944 } 6945 }); 6946 } 6947} 6948/* End */ 6949; 6950; /* Start:"a:4:{s:4:"full";s:105:"/local/templates/elektro_flat/components/bitrix/sale.basket.basket.line/.default/script.js?15330357781604";s:6:"source";s:90:"/local/templates/elektro_flat/components/bitrix/sale.basket.basket.line/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 6951function BitrixSmallCart(){} 6952 6953BitrixSmallCart.prototype = { 6954 activate: function() { 6955 this.cartElement = BX(this.cartId); 6956 6957 this.setCartBodyClosure = this.closure("setCartBody"); 6958 BX.addCustomEvent(window, "OnBasketChange", this.closure("refreshCart", {})); 6959 }, 6960 6961 closure: function(fname, data) { 6962 var obj = this; 6963 return data 6964 ? function(){obj[fname](data)} 6965 : function(arg1){obj[fname](arg1)}; 6966 }, 6967 6968 refreshCart: function(data) { 6969 data.sessid = BX.bitrix_sessid(); 6970 data.siteId = this.siteId; 6971 data.templateName = this.templateName; 6972 data.arParams = this.arParams; 6973 BX.ajax({ 6974 url: this.ajaxPath, 6975 method: 'POST', 6976 dataType: 'html', 6977 data: data, 6978 onsuccess: this.setCartBodyClosure 6979 }); 6980 }, 6981 6982 setCartBody: function(result) { 6983 var basketCont, 6984 sumOld, 6985 sumCurr; 6986 6987 basketCont = $(this.cartElement); 6988 6989 basketCont.find(".qnt").text($(result).find(".qnt").text()); 6990 6991 basketCont.find(".sum").data("decimal", $(result).find(".sum").data("decimal")); 6992 6993 sumOld = basketCont.find(".sum").data("sum"); 6994 basketCont.find(".sum").data("sum", $(result).find(".sum").data("sum")); 6995 sumCurr = basketCont.find(".sum").data("sum"); 6996 6997 if(sumCurr != sumOld) { 6998 var options = { 6999 useEasing: false, 7000 useGrouping: true, 7001 separator: basketCont.find(".sum").data("separator"),
7002 decimal: basketCont.find(".sum").data("dec-point") 7003 } 7004 var counter = new countUp("cartCounter", sumOld, sumCurr, basketCont.find(".sum").data("decimal"), 0.5, options); 7005 counter.start(); 7006 } 7007 7008 basketCont.find(".oformit_cont").html($(result).find(".oformit_cont").html()); 7009 } 7010}; 7011/* End */ 7012; 7013; /* Start:"a:4:{s:4:"full";s:104:"/bitrix/components/bitrix/main.userconsent.request/templates/.default/user_consent.min.js?15330357737363";s:6:"source";s:85:"/bitrix/components/bitrix/main.userconsent.request/templates/.default/user_consent.js";s:3:"min";s:89:"/bitrix/components/bitrix/main.userconsent.request/templates/.default/user_consent.min.js";s:3:"map";s:89:"/bitrix/components/bitrix/main.userconsent.request/templates/.default/user_consent.map.js";}"*/ 7014(function(){function t(t){this.caller=t.caller;this.formNode=t.formNode;this.controlNode=t.controlNode;this.inputNode=t.inputNode;this.config=t.config}t.prototype={};BX.UserConsent={msg:{title:"MAIN_USER_CONSENT_REQUEST_TITLE",btnAccept:"MAIN_USER_CONSENT_REQUEST_BTN_ACCEPT",btnReject:"MAIN_USER_CONSENT_REQUEST_BTN_REJECT",loading:"MAIN_USER_CONSENT_REQUEST_LOADING",errTextLoad:"MAIN_USER_CONSENT_REQUEST_ERR_TEXT_LOAD"},events:{save:"main-user-consent-request-save",refused:"main-user-consent-request-refused",accepted:"main-user-consent-request-accepted"},current:null,autoSave:false,isFormSubmitted:false,isConsentSaved:false,attributeControl:"data-bx-user-consent",load:function(t){var e=this.find(t)[0];if(!e){return null}this.bind(e);return e},loadAll:function(t,e){this.find(t,e).forEach(this.bind,this)},loadFromForms:function(){var t=document.getElementsByTagName("FORM");t=BX.convert.nodeListToArray(t);t.forEach(this.loadAll,this)},find:function(t){if(!t){return[]}var e=t.querySelectorAll("["+this.attributeControl+"]");e=BX.convert.nodeListToArray(e);return e.map(this.createItem.bind(this,t)).filter(function(t){return!!t})},bind:function(t){if(t.config.submitEventName){BX.addCustomEvent(t.config.submitEventName,this.onSubmit.bind(this,t))}else if(t.formNode){BX.bind(t.formNode,"submit",this.onSubmit.bind(this,t))}BX.bind(t.controlNode,"click",this.onClick.bind(this,t))},createItem:function(e,n){var i=n.querySelector('input[type="checkbox"]');if(!i){return}try{var s=JSON.parse(n.getAttribute(this.attributeControl));var o={formNode:null,controlNode:n,inputNode:i,config:s};if(e.tagName=="FORM"){o.formNode=e}else{o.formNode=BX.findParent(i,{tagName:"FORM"})}o.caller=this;return new t(o)}catch(r){return null}},onClick:function(t,e){this.requestForItem(t);e.preventDefault()},onSubmit:function(t,e){this.isFormSubmitted=true;if(this.check(t)){return true}else{if(e){e.preventDefault()}return false}},check:function(t){if(t.inputNode.checked){this.saveConsent(t);return true}this.requestForItem(t);return false},requestForItem:function(t){this.setCurrent(t);this.requestConsent(t.config.id,{sec:t.config.sec,replace:t.config.replace},this.onAccepted,this.onRefused)},setCurrent:function(t){this.current=t;this.autoSave=t.config.autoSave;this.actionRequestUrl=t.config.actionUrl},onAccepted:function(){if(!this.current){return}var t=this.current;this.saveConsent(this.current,function(){BX.onCustomEvent(t,this.events.accepted,[]);BX.onCustomEvent(this,this.events.accepted,[t]);this.isConsentSaved=true;if(this.isFormSubmitted&&t.formNode&&!t.config.submitEventName){BX.submit(t.formNode)}});this.current.inputNode.checked=true;this.current=null},onRefused:function(){BX.onCustomEvent(this.current,this.events.refused,[]);BX.onCustomEvent(this,this.events.refused,[this.current]);this.current.inputNode.checked=false;this.current=null;this.isFormSubmitted=false},initPopup:function(){if(this.popup){return}this.popup={}},popup:{isInit:false,caller:null,nodes:{container:null,shadow:null,head:null,loader:null,content:null,textarea:null,buttonAccept:null,buttonReject:null},onAccept:function(){this.hide();BX.onCustomEvent(this,"accept",[])},onReject:function(){this.hide();BX.onCustomEvent(this,"reject",[])},init:function(){if(this.isInit){return true}var t=document.querySelector("script[data-bx-template]");if(!t){return false}var e=document.createElement("DIV");e.innerHTML=t.innerHTML;e=e.children[0];if(!e){return false}document.body.insertBefore(e,document.body.children[0]);this.isInit=true;this.nodes.container=e;this.nodes.shadow=this.nodes.container.querySelector("[data-bx-shadow]");this.nodes.head=this.nodes.container.querySelector("[data-bx-head]");this.nodes.loader=this.nodes.container.querySelector("[data-bx-loader]");this.nodes.content=this.nodes.container.querySelector("[data-bx-content]");this.nodes.textarea=this.nodes.container.querySelector("[data-bx-textarea]");this.nodes.buttonAccept=this.nodes.container.querySelector("[data-bx-btn-accept]");this.nodes.buttonReject=this.nodes.container.querySelector("[data-bx-btn-reject]");this.nodes.buttonAccept.textContent=BX.message(this.caller.msg.btnAccept);this.nodes.buttonReject.textContent=BX.message(this.caller.msg.btnReject);BX.bind(this.nodes.buttonAccept,"click",this.onAccept.bind(this));BX.bind(this.nodes.buttonReject,"click",this.onReject.bind(this));return true},setTitle:function(t){if(!this.nodes.head){return}this.nodes.head.textContent=t},setContent:function(t){if(!this.nodes.textarea){return}this.nodes.textarea.textContent=t},show:function(t){if(typeof t=="boolean"){this.nodes.loader.style.display=!t?"":"none";this.nodes.content.style.display=t?"":"none"}this.nodes.container.style.display=""},hide:function(){this.nodes.container.style.display="none"}},cache:{list:[],stringifyKey:function(t){return BX.type.isString(t)?t:JSON.stringify({key:t})},set:function(t,e){var n=this.get(t);if(n){n.data=e}else{this.list.push({key:this.stringifyKey(t),data:e})}},getData:function(t){var e=this.get(t);return e?e.data:null},get:function(t){t=this.stringifyKey(t);var e=this.list.filter(function(e){return e.key==t});return e.length>0?e[0]:null},has:function(t){return!!this.get(t)}},requestConsent:function(t,e,n,i){e=e||{};e.id=t;var s=this.cache.stringifyKey(e);if(!this.popup.isInit){this.popup.caller=this;if(!this.popup.init()){return}BX.addCustomEvent(this.popup,"accept",n.bind(this));BX.addCustomEvent(this.popup,"reject",i.bind(this))}if(this.current&&this.current.config.text){this.cache.set(s,this.current.config.text)}if(this.cache.has(s)){this.setTextToPopup(this.cache.getData(s))}else{this.popup.setTitle(BX.message(this.msg.loading));this.popup.show(false);this.sendActionRequest("getText",e,function(t){this.cache.set(s,t.text||"");this.setTextToPopup(this.cache.getData(s))},function(){this.popup.hide();alert(BX.message(this.msg.errTextLoad))})}},setTextToPopup:function(t){var e="";var n=t.indexOf("\n");var i=t.indexOf(".");n=n<i?n:i;if(n>=0&&n<=100){e=t.substr(0,n).trim();e=e.split(".").map(Function.prototype.call,String.prototype.trim).filter(String)[0]}this.popup.setTitle(e?e:BX.message(this.msg.title));this.popup.setContent(t);this.popup.show(true)},saveConsent:function(t,e){this.setCurrent(t);var n={id:t.config.id,sec:t.config.sec,url:window.location.href};if(t.config.originId){var i=t.config.originId;if(t.formNode&&i.indexOf("%")>=0){var s=t.formNode.querySelectorAll('input[type="text"], input[type="hidden"]');s=BX.convert.nodeListToArray(s);
7014s.forEach(function(t){if(!t.name){return}i=i.replace("%"+t.name+"%",t.value?t.value:"")})}n.originId=i}if(t.config.originatorId){n.originatorId=t.config.originatorId}BX.onCustomEvent(t,this.events.save,[n]);BX.onCustomEvent(this,this.events.save,[t,n]);if(this.isConsentSaved||!t.config.autoSave){if(e){e.apply(this,[])}}else{this.sendActionRequest("saveConsent",n,e,e)}},sendActionRequest:function(t,e,n,i){n=n||null;i=i||null;e.action=t;e.sessid=BX.bitrix_sessid();e.action=t;BX.ajax({url:this.actionRequestUrl,method:"POST",data:e,timeout:10,dataType:"json",processData:true,onsuccess:BX.proxy(function(t){t=t||{};if(t.error){i.apply(this,[t])}else if(n){n.apply(this,[t])}},this),onfailure:BX.proxy(function(){var t={error:true,text:""};if(i){i.apply(this,[t])}},this)})}};BX.ready(function(){BX.UserConsent.loadFromForms()})})(); 7015/* End */ 7016;; /* /local/templates/elektro_flat/js/jquery.cookie.js?15330357783095*/ 7017; /* /local/templates/elektro_flat/js/moremenu.js?15330357785011*/ 7018; /* /local/templates/elektro_flat/js/jquery.inputmask.bundle.min.js?153303577870473*/ 7019; /* /local/templates/elektro_flat/js/anythingslider/jquery.easing.1.2.js?15330357784757*/ 7020; /* /local/templates/elektro_flat/js/anythingslider/jquery.anythingslider.min.js?153303577818707*/ 7021; /* /local/templates/elektro_flat/js/custom-forms/jquery.custom-forms.js?15330357783042*/ 7022; /* /local/templates/elektro_flat/js/fancybox/jquery.fancybox-1.3.1.pack.js?153303577814386*/ 7023; /* /local/templates/elektro_flat/js/spectrum/spectrum.js?153303577879093*/ 7024; /* /local/templates/elektro_flat/js/countUp.min.js?15330357782608*/ 7025; /* /local/templates/elektro_flat/js/countdown/jquery.plugin.js?153303577811513*/ 7026; /* /local/templates/elektro_flat/js/countdown/jquery.countdown.js?153303577835864*/ 7027; /* /ds-comf/ds-form/js/dsforms.js?153304467738459*/ 7028; /* /ds-comf/ds-form/jsaction.js?1637742302209*/ 7029; /* /local/templates/elektro_flat/js/main.js?15943612045368*/ 7030; /* /local/templates/elektro_flat/js/addEventOnButton.js?16660956623007*/ 7031; /* /local/templates/elektro_flat/js/myJS.js?16636830722174*/ 7032; /* /local/templates/elektro_flat/js/jquery.maskedinput.min.js?15330357784324*/ 7033; /* /local/templates/elektro_flat/script.js?16984121266636*/ 7034; /* /bitrix/components/altop/search.title/script.js?15330357728506*/ 7035; /* /bitrix/components/altop/search.title/templates/.default/script.js?153303577221763*/ 7036; /* /bitrix/components/altop/geolocation/templates/.default/script.js?15330357726732*/ 7037; /* /bitrix/components/altop/forms/templates/.default/script.js?15330357722086*/ 7038; /* /local/templates/elektro_flat/components/bitrix/sale.basket.basket.line/.default/script.js?15330357781604*/ 7039; /* /bitrix/components/bitrix/main.userconsent.request/templates/.default/user_consent.min.js?15330357737363*/ 7040 7041//# sourceMappingURL=template_ef387f85e3036cb255adddf37625fdf9.map.js
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.