1/* 2 * =========================================================== 3 * MAIN SCRIPT- FRAMEWORK Y 4 * =========================================================== 5 * This script manage all the js functions and the 3r party plugins. 6 * Framework website: www.framework-y.com 7 * 8 * ANIMATIONS 9 * ------------------------------------------------------------- 10 * Manage all the animations on page scroll, on click, on hover 11 * Manage the timeline animations 12*/ 13 14"use strict"; 15function cssInit(delay, speed) { 16 delay += 'ms'; 17 speed += 'ms'; 18 return { 19 'animation-duration': speed, 20 'transition-timing-function': 'ease', 21 'transition-delay': delay 22 }; 23} 24function initAnima(obj) { 25 (function ($) { 26 var animaTimeout = $.fn.getGlobalVar("animaTimeout") || []; 27 var animaTimeout_2 = $.fn.getGlobalVar("animaTimeout_2") || []; 28 29 var da = $(obj).attr("data-anima") || ""; 30 var an = $(obj).find(".anima,*[data-anima]"); 31 var t = $(obj).attr("data-time"); 32 var ta = $(obj).attr("data-target"); 33 var tm = $(obj).attr("data-timeline"); 34 var tmt = $(obj).attr("data-timeline-time"); 35 var tr = $(obj).attr("data-trigger"); 36 var len = $(an).length; 37 var default_anima = $.fn.getGlobalVar("default_anima"); 38 if (da == "default" && !isEmpty(default_anima)) da = default_anima; 39 if (isEmpty(tmt)) tmt = 500; 40 if (isEmpty(an)) an = obj; 41 $(an).each(function (i) { 42 if (!isEmpty($(this).attr("data-anima")) && i === 0) { an = obj; return false; } 43 }); 44 if (!isEmpty(ta)) an = $(ta); 45 if (isEmpty(t)) t = 500; 46 var time = 0, p = 1; 47 if (!isEmpty(tm) && tm === "desc") { time = (len - 1) * tmt; p = -1 }; 48 var cont = null; 49 $(an).each(function (index) { 50 var time_now = time; 51 if (index === len - 1 && tm === "desc") time_now = 0; 52 if (!$(this).hasClass("anima") && an != obj && isEmpty(ta)) { 53 cont = this; 54 } else { 55 if (cont != null && !$.contains(cont, this) || cont === null) { 56 var tobj = this; 57 var pos = $(this).css("position"); 58 if (pos != 'absolute' && pos != 'fixed') $(this).css("position", "relative"); 59 var aid = Math.random(5) + ""; 60 $(tobj).attr("aid", aid); 61 if (animaTimeout.length > 30) { 62 animaTimeout.shift(); 63 animaTimeout_2.shift(); 64 } 65 animaTimeout.push([aid, setTimeout(function () { 66 $(tobj).css(cssInit(0, 0)); 67 var da_ = da; 68 if (!isEmpty($(tobj).attr('class')) && $(tobj).attr('class').indexOf("anima-") != -1) { 69 var arr_a = $(tobj).attr('class').split(" "); 70 for (var i = 0; i < arr_a.length; i++) { 71 if (arr_a[i].indexOf("anima-") != -1) da_ = arr_a[i].replace("anima-", ""); 72 } 73 } 74 if ($(window).width() < 768 && (isEmpty(tr) || tr === "scroll" || tr === "load")) da_ = "fade-in"; 75 animaTimeout_2.push([aid, setTimeout(function () { $(tobj).css(cssInit(0, t)).addClass(da_); $(tobj).css('opacity', '') }, 100)]); 76 }, time_now)]); 77 if (!isEmpty(tm)) time += tmt * p; 78 } 79 } 80 }); 81 $.fn.setGlobalVar(animaTimeout, "animaTimeout"); 82 $.fn.setGlobalVar(animaTimeout_2, "animaTimeout_2"); 83 }(jQuery)); 84} 85function outAnima(obj) { 86 (function ($) { 87 var animaTimeout = $.fn.getGlobalVar("animaTimeout"); 88 var animaTimeout_2 = $.fn.getGlobalVar("animaTimeout_2"); 89 var da = $(obj).attr("data-anima"); 90 var an = $(obj).find(".anima,*[data-anima]"); 91 var t = $(obj).attr("data-time"); 92 var o = $(obj).attr("data-anima-out"); 93 var ta = $(obj).attr("data-target"); 94 var default_anima = $.fn.getGlobalVar("default_anima"); 95 if (da == "default" && !isEmpty(default_anima)) da = default_anima; 96 if (isEmpty(an)) an = obj; 97 if (!isEmpty(ta)) an = $(ta); 98 if (isEmpty(t)) t = 500; 99 if (isEmpty(o)) o = "back"; 100 if ((o == "back") || (o == "hide")) { 101 var cont = null; 102 $(an).each(function () { 103 var aid = $(this).attr("aid"); 104 if (!isEmpty(aid)) { 105 for (var i = 0; i < animaTimeout.length; i++) { 106 if (animaTimeout[i][0] == aid) { 107 clearTimeout(animaTimeout[i][1]); 108 } 109 } 110 for (var i = 0; i < animaTimeout_2.length; i++) { 111 if (animaTimeout_2[i][0] == aid) { 112 clearTimeout(animaTimeout_2[i][1]); 113 } 114 } 115 } 116 if (!$(this).hasClass("anima") && an != obj) { 117 cont = this; 118 } else { 119 if (cont != null && !$.contains(cont, this) || cont == null) { 120 var pos = $(this).css("position"); 121 if (pos != 'absolute' && pos != 'fixed') $(this).css("position", "relative"); 122 var da_ = da; 123 try { 124 if ($(this).attr('class').indexOf("anima-") != -1) { 125 var arr_a = $(this).attr('class').split(" "); 126 for (var i = 0; i < arr_a.length; i++) { 127 if (arr_a[i].indexOf("anima-") != -1) da_ = arr_a[i].replace("anima-", ""); 128 } 129 } 130 } catch (e) { } 131 $(this).css(cssInit(0, t)).removeClass(da_); 132 var op = parseFloat($(this).css("opacity")); 133 if (op > 0 && op < 1) $(this).css("opacity", 1); 134 } 135 } 136 }); 137 if (o == "hide") { 138 $(an).css(cssInit(0, t)).css("opacity", 0); 139 setTimeout(function () { $(an).css("opacity", 0); }, 400); 140 } 141 } 142 $.fn.setGlobalVar(animaTimeout, "animaTimeout"); 143 $.fn.setGlobalVar(animaTimeout_2, "animaTimeout_2"); 144 }(jQuery)); 145} 146function setImgPos(n) { 147 var t = parseInt($(n).find(".maso img").css("height"), 10), 148 i = parseInt($(n).find(".maso").css("height"), 10); 149 i < t && $(n).find(".maso img").css("margin-top", "-" + (t - i) / 2 + "px"); 150} 151 152//OTHERS 153window.onload = function () { function a(a, b) { var c = /^(?:file):/, d = new XMLHttpRequest, e = 0; d.onreadystatechange = function () { 4 == d.readyState && (e = d.status), c.test(location.href) && d.responseText && (e = 200), 4 == d.readyState && 200 == e && (a.outerHTML = d.responseText) }; try { d.open("GET", b, !0), d.send() } catch (f) { } } var b, c = document.getElementsByTagName("*"); for (b in c) c[b].hasAttribute && c[b].hasAttribute("data-include") && a(c[b], c[b].getAttribute("data-include")) }; 154 155/* 156 * FUNCTIONS 157 * ------------------------------------------------------------- 158 * getURLParameter - Read the parameters of the url like www.site.com?paramter-name=value 159 * openWindow - Open a url in a new center window similar to a popup window 160 * onePageScroll - Scroll the page on target position with animations 161 * getOptionsString - Get a array of options from HTML, details: www.framework-y.com/components/components-base.html#base-javascript 162 * isEmpty - Perform multiple checks to determinate if a variable is null or empty 163 * correctValue - Convert strings to number or boolean 164 * isScrollView - Check if the target element is visible on the user's screen 165*/ 166function getURLParameter(name) { 167 return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20') || ""); 168} 169function openWindow(link, width, height) { 170 if (typeof width === 'undefined') width = 550; 171 if (typeof height === 'undefined') height = 350; 172 var left = (screen.width / 2) - (width / 2); 173 var top = (screen.height / 2) - (height / 2); 174 window.open(link, 'targetWindow', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + ', top='
174+ top + ', left=' + left); 175 return false; 176} 177function onePageScroll(t) { 178 if (!isEmpty(t)) { 179 jQuery(t).find('a[href ^= "#"]').on('click', function (e) { 180 e.preventDefault(); 181 var target = this.hash, 182 jtarget = jQuery(target); 183 if (jtarget.length > 0) { 184 if (target.indexOf('collapse') === -1) { 185 try { 186 jQuery('html, body').stop().animate({ 187 'scrollTop': (jtarget.offset().top - 150) 188 }, 900, 'swing', function () { 189 window.location.hash = target; 190 }); 191 } catch (e) { } 192 } 193 } else { 194 if (target != "#" && target.length > 2 && jQuery(this).closest("header").length) document.location = window.location.protocol + "//" + window.location.host; 195 } 196 }); 197 } 198} 199function getOptionsString(txt, mainArray) { 200 var optionsArr = txt.split(","); 201 for (var i = 0; i < optionsArr.length; i++) { 202 mainArray[optionsArr[i].split(":")[0]] = correctValue(optionsArr[i].split(":")[1]); 203 } 204 return mainArray; 205} 206function isEmpty(obj) { if (typeof (obj) !== "undefined" && obj !== null && (obj.length > 0 || typeof (obj) == 'number' || typeof (obj.length) == "undefined") && obj !== "undefined") return false; else return true; } 207function correctValue(n) { return typeof n == "number" ? parseFloat(n) : n == "true" ? !0 : n == "false" ? !1 : n } 208function isScrollView(t) { 209 var tp = jQuery(window).height() * 0.5 + jQuery(window).scrollTop(); 210 var e = jQuery(t).offset().top; 211 if ((e < (tp + 300) || ((jQuery(window).scrollTop() + jQuery(window).height() == jQuery(document).height())))) return true; 212 else return false; 213} 214 215//MAIN BLOCK 216(function ($) { 217 var arrFA = []; 218 var firstLoad = true; 219 var animaTimeout = []; 220 var animaTimeout_2 = []; 221 var default_anima; 222 223 /* 224 * FUNCTIONS 225 * ------------------------------------------------------------- 226 * toggleClick - Manage on click and on second click events 227 * showAnima - Start an animation 228 * titleFullScreen - Set fullscreen mode for the titles components 229 * sizeFullScreen - Set fullscreen sizes to the target element 230 * setMiddleBox - Center vertically an element into a container 231 * scrollTo - Scroll the page on target position with animations 232 * expandItem - Open a container with animation 233 * collapseItem - Close a container with animation 234 * setVideoBgSize - Set the background video sizes on mobile and desktop 235 * getHeight - Get the correct height of an item 236 * executeFunction - Check if a script is loaded and execute the gived function the script load has been completed 237 * getGlobalVar - Read a global variable 238 * setGlobalVar - Set a global variable 239 */ 240 (function (n) { if (typeof define == "function" && define.amd) define(n); else if (typeof exports == "object") module.exports = n(); else { var i = window.Cookies, t = window.Cookies = n(); t.noConflict = function () { return window.Cookies = i, t } } })(function () { function n() { for (var n = 0, r = {}, t, i; n < arguments.length; n++) { t = arguments[n]; for (i in t) r[i] = t[i] } return r } function t(i) { function r(t, u, f) { var o, s; if (arguments.length > 1) { f = n({ path: "/" }, r.defaults, f); typeof f.expires == "number" && (s = new Date, s.setMilliseconds(s.getMilliseconds() + f.expires * 864e5), f.expires = s); try { o = JSON.stringify(u); /^[\{\[]/.test(o) && (u = o) } catch (y) { } return u = encodeURIComponent(String(u)), u = u.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), t = encodeURIComponent(String(t)), t = t.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent), t = t.replace(/[\(\)]/g, escape), document.cookie = [t, "=", u, f.expires && "; expires=" + f.expires.toUTCString(), f.path && "; path=" + f.path, f.domain && "; domain=" + f.domain, f.secure ? "; secure" : ""].join("") } t || (o = {}); for (var l = document.cookie ? document.cookie.split("; ") : [], a = /(%[0-9A-Z]{2})+/g, h = 0; h < l.length; h++) { var v = l[h].split("="), c = v[0].replace(a, decodeURIComponent), e = v.slice(1).join("="); e.charAt(0) === '"' && (e = e.slice(1, -1)); try { if (e = i && i(e, c) || e.replace(a, decodeURIComponent), this.json) try { e = JSON.parse(e) } catch (y) { } if (t === c) { o = e; break } t || (o[c] = e) } catch (y) { } } return o } return r.get = r.set = r, r.getJSON = function () { return r.apply({ json: !0 }, [].slice.call(arguments)) }, r.defaults = {}, r.remove = function (t, i) { r(t, "", n(i, { expires: -1 })) }, r.withConverter = t, r } return t() }); 241 $.fn.toggleClick = function (n) { var t = arguments, r = n.guid || $.guid++, i = 0, u = function (r) { var u = ($._data(this, "lastToggle" + n.guid) || 0) % i; return $._data(this, "lastToggle" + n.guid, u + 1), r.preventDefault(), t[u].apply(this, arguments) || !1 }; for (u.guid = r; i < t.length;) t[i++].guid = r; return this.click(u) };
242 $.fn.showAnima = function (a, b) { 243 var t = this; 244 if (a === "default") a = $.fn.getGlobalVar("default_anima"); 245 $(t).removeClass(a); 246 if (!isEmpty(b) && b === "complete") { $(t).attr("data-anima", a).attr("data-trigger", "manual"); initAnima(t); } 247 else setTimeout(function () { $(t).css(cssInit(0, 300)).addClass(a); $(t).css('opacity', '') }, 100); 248 }; 249 $.fn.titleFullScreen = function (h) { 250 if (!isEmpty(this)) { 251 var o = $(this).find(".overlaybox"); 252 $(this).sizeFullScreen(h); 253 if (!($("header").css("position") === "absolute") && !($("header").css("position") === "fixed")) { 254 $(this).css("height", $(this).height() - $("header").height() + "px"); 255 } 256 if (!isEmpty(o)) $(o).css("margin-top", "-" + $(o).height() / 2 - 10 + "px"); 257 } 258 } 259 $.fn.sizeFullScreen = function (h) { 260 if (!isEmpty(this)) { 261 var h = $(window).outerHeight() - parseInt($(this).css("margin-top").replace("px", ""), 10) - parseInt($(this).css("margin-bottom").replace("px", ""), 10) - ((isEmpty(h)) ? 0 : parseInt(h, 10)); 262 if (h > $(this).height()) $(this).css("height", h + "px"); 263 } 264 } 265 $.fn.setMiddleBox = function (target) { 266 if (isEmpty(target)) target = ".box-middle"; 267 var t = $(this).find(target); 268 var a = parseInt($(this).outerHeight(), 10); 269 var b = parseInt($(t).outerHeight(true), 10); 270 if (b < a) $(t).css("margin-top", (a - b) / 2 + "px"); 271 } 272 $.fn.scrollTo = function () { 273 if (!isEmpty(this)) { 274 $('html, body').animate({ 275 scrollTop: $(this).offset().top - 50 276 }, 1000); 277 } 278 } 279 $.fn.expandItem = function () { 280 var t = this; 281 $(t).css("display", "block").css("height", ""); 282 var h = $(t).height(); 283 $(t).css("height", 0).css("opacity", 1); 284 $(t).animate({ 285 height: h 286 }, 300, function () { $(t).css("height", "") }); 287 } 288 $.fn.collapseItem = function () { 289 var t = this; 290 $(t).animate({ 291 height: 0 292 }, 300, function () { $(t).css("display", "none") }); 293 } 294 $.fn.setVideoBgSize = function (hh, wh) { 295 var obj = this; 296 var cH = hh; 297 var cW = wh; 298 var iframe = $(t).find("iframe").length; 299 var t = this; 300 setTimeout(function () { 301 if ($(t).hasClass("section-bg-video") || $(t).hasClass("header-video")) { 302 obj = $(t).find("video"); 303 cH = $(t).height(); 304 cW = $(t).width(); 305 } 306 if (wh > 992 && iframe) $(t).find(".videobox").css("height", "130%"); 307 var vidH = $(obj).height(); 308 var vidW = $(obj).width(); 309 310 var proportion = cH / vidH; 311 var newWidth = vidW * proportion; 312 if (newWidth / vidW > 1 && ($(window).width() < newWidth && vidH < cH || $(window).width() < 769)) { 313 if (wh < 992 && !iframe) newWidth = newWidth + 100; 314 $(obj).css("width", Math.ceil(newWidth) + "px"); 315 $(obj).css("margin-left", "-" + Math.floor(((newWidth - cW) / 2)) + "px"); 316 } 317 }, 300); 318 } 319 $.fn.getHeight = function () { 320 if (!isEmpty(this)) return $(this)[0].clientHeight; 321 else return 0; 322 } 323 $.fn.executeFunction = function (functionName, myfunction) { 324 var timer; 325 if ($(this).length > 0) { 326 if (typeof window["jQuery"]["fn"][functionName] === "function" || typeof window[functionName] === "function") { 327 myfunction(); 328 } else { 329 timer = setInterval(function () { 330 if (typeof window["jQuery"]["fn"][functionName] === "function" || typeof window[functionName] === "function") { 331 myfunction(); 332 clearInterval(timer); 333 } 334 }, 300); 335 } 336 } 337 } 338 $.fn.getGlobalVar = function (name) { 339 return window[name]; 340 }; 341 $.fn.setGlobalVar = function (value, name) { 342 window[name] = value; 343 }; 344 345 /* 346 * THIRD PARTS PLUGINS 347 * ------------------------------------------------------------- 348 * Functions and methods that menage the execution of external plugins 349 */ 350 351 //imagesloaded.min.js 352 $.fn.renderLoadedImgs = function () { 353 if ($.isFunction($.fn.imagesLoaded)) { 354 var isIsotope = false;
355 var $isotope; 356 var imgLoad = imagesLoaded($(this)); 357 if ($(this).hasClass("maso-box")) { isIsotope = true; $isotope = this; } 358 imgLoad.on('progress', function (instance, image) { 359 var result = image.isLoaded ? 'loaded' : 'broken'; 360 var target = "a" 361 if ($(image.img).closest("ul.slides").length) target = ".slides li"; 362 if ($(image.img).closest(".img-box").length) target = ".img-box"; 363 if ($(image.img).closest(".img-box.thumbnail span img").length) target = "span"; 364 if ($(image.img).closest("figure").length) target = "figure"; 365 var cont = $(image.img).closest(target); 366 var imgHeight = image.img.clientHeight; 367 var imgWidth = image.img.clientWidth; 368 var colWidth = 0; 369 var colHeight = 0; 370 if (!isEmpty(cont.get(0))) { 371 colWidth = cont.get(0).clientWidth; 372 colHeight = cont.get(0).clientHeight; 373 } 374 375 if (result == "loaded") { 376 if (isIsotope) { 377 $isotope.isotope('layout'); 378 var mi = $(image.img).closest('.maso-item'); 379 $(mi).css("visibility", "visible"); 380 $(mi).find("> *").animate({ "opacity": 1 }, 300); 381 } 382 if (imgHeight > colHeight) { 383 $(image.img).css("margin-top", "-" + Math.floor(((imgHeight - colHeight) / 2)) + "px"); 384 } else { 385 var proportion = colHeight / imgHeight; 386 var newWidth = imgWidth * proportion; 387 if (newWidth / imgWidth > 1) { 388 $(image.img).css("max-width", Math.ceil(newWidth) + "px").css("width", Math.ceil(newWidth) + "px"); 389 $(image.img).css("margin-left", "-" + Math.floor(((newWidth - colWidth) / 2)) + "px"); 390 } 391 } 392 } 393 }); 394 } 395 } 396 397 //isotope.min.js 398 $.fn.initPagination = function () { 399 var opt = $(this).attr("data-options"); 400 var a = $(this).attr("data-pagination-anima"); 401 var p = parseInt($(this).attr("data-page-items"), 10); 402 var c = $(this).closest(".maso-list"); 403 var t = $(c).find(".maso-box"); 404 var items = t.isotope('getItemElements'); 405 var n = $(items).length; 406 var type = ""; 407 if ($(this).hasClass('load-more-maso')) type = 'load-more'; 408 if ($(this).hasClass('pagination-maso')) type = 'pagination'; 409 410 for (var i = p; i < n; i++) { 411 t.isotope('remove', items[i]); 412 } 413 t.isotope('layout'); 414 415 if (type == 'pagination') { 416 var optionsArr; 417 var options = { 418 totalPages: Math.ceil(n / p), 419 visiblePages: 7, 420 first: "<i class='fa fa-angle-double-left'></i> <span>First</span>", 421 last: "<span>Last</span> <i class='fa fa-angle-double-right'></i>", 422 next: "<span>Next</span> <i class='fa fa-angle-right'></i>", 423 prev: " <i class='fa fa-angle-left'></i> <span>Previous</span>", 424 onPageClick: function (event, page) { 425 t.isotope('remove', t.isotope('getItemElements')); 426 for (var i = (p * (page - 1)) ; i < (p * (page)) ; i++) { 427 t.isotope('insert', items[i]); 428 } 429 t.isotope('layout'); 430 if (!isEmpty(opt) && opt.indexOf("scrollTop:true") != -1) $(c).scrollTo(); 431 } 432 } 433 if (!isEmpty(opt)) { 434 optionsArr = opt.split(","); 435 options = getOptionsString(opt, options); 436 } 437 $(this).twbsPagination(options); 438 } 439 if (type == 'load-more') { 440 var tl = this; 441 $(tl).on("click", function (index) {
442 loadMoreMaso(this); 443 }); 444 if (!isEmpty(opt) && opt.indexOf("lazyLoad:true") != -1) { 445 $(window).scroll(function () { 446 if ($(window).scrollTop() + $(window).height() == $(document).height()) { 447 if ($.fn.getGlobalVar("firstLoad")) setTimeout(function () { loadMoreMaso(tl) }, 800); 448 else loadMoreMaso(tl); 449 } 450 }); 451 } 452 } 453 454 function loadMoreMaso(obj) { 455 var page = $(obj).attr("data-current-page"); 456 if (isEmpty(page)) page = 1; 457 page++; 458 $(obj).attr("data-current-page", page); 459 var s = p * (page - 1); 460 var e = p * (page); 461 for (var i = s ; i < (p * (page)) ; i++) { 462 t.isotope('insert', items[i]); 463 } 464 t.isotope('layout'); 465 if ($.isFunction($.fn.renderLoadedImgs)) { 466 $(t).renderLoadedImgs(); 467 } 468 if (e >= n) $(obj).hide(300); 469 } 470 } 471 $.fn.initIsotope = function () { 472 var m = $(this).find('.maso-box'); 473 var menu = $(this).find(".maso-filters"); 474 var optionsString = $(this).attr("data-options"); 475 var optionsArr; 476 var options = { 477 itemSelector: '.maso-item', 478 percentPosition: true, 479 masonry: { 480 columnWidth: '.maso-item', 481 }, 482 getSortData: { 483 number: function (e) { 484 return parseInt(jQuery(e).attr('data-sort'), 10); 485 } 486 }, 487 sortBy: 'number' 488 } 489 if (!isEmpty(optionsString)) { 490 optionsArr = optionsString.split(","); 491 options = getOptionsString(optionsString, options); 492 } 493 if ($(menu).length) { 494 var len = $(m).find(".maso-item").length; 495 $(menu).find("li a:not(.maso-filter-auto)").each(function () { 496 var current_len = $(m).find("." + $(this).attr("data-filter")).length; 497 if (current_len == len || current_len == 0) { 498 $(this).closest("li").remove(); 499 } 500 }); 501 } 502 $(m).isotope(options); 503 if ($.isFunction($.fn.renderLoadedImgs)) { 504 var items = m.isotope('getItemElements'); 505 $(m).renderLoadedImgs(); 506 } 507 $(this).find(".pagination-maso,.load-more-maso").initPagination(); 508 }; 509 510 //jquery.magnific-popup.min.js 511 $.fn.showPopupBanner = function () { 512 var t = this; 513 var a = $(t).attr("data-popup-anima"); 514 if (isEmpty(a)) a = "fade-in"; 515 $(t).css("opacity", 0); 516 $(t).showAnima(a); 517 $(t).css("display", "block"); 518 }; 519 $.fn.initMagnificPopup = function () { 520 var obj = this; 521 var optionsString = $(obj).attr("data-options"); 522 var trigger = $(obj).attr("data-trigger"); 523 if (isEmpty(trigger)) trigger = ""; 524 var a = $(obj).attr("data-lightbox-anima"); 525 var href = $(obj).attr("href"); 526 if (isEmpty(href)) href = "" 527 var optionsArr; 528 var options = { 529 type: 'iframe' 530 } 531 if (!isEmpty(optionsString)) { 532 optionsArr = optionsString.split(","); 533 options = getOptionsString(optionsString, options); 534 } 535 if (isEmpty(options['mainClass'])) options['mainClass'] = ""; 536 if (trigger == "load" || trigger == "scroll") { 537 var l = $(obj).attr("data-link"); 538 var c = $(obj).attr("data-click"); 539 if (isEmpty(l)) { href = "#" + $(this).attr("id"); options['mainClass'] += ' custom-lightbox'; } 540 else href = l; 541 542 if (!isEmpty(c)) { 543 $("body").on("click", ".lightbox-on-load", function () { 544 if ($(obj).attr("data-click-target") == "_blank") window.open(c); 545 else document.location = c; 546 }); 547 } 548 } 549 550 if ($(obj).hasClass("grid-box") || $(obj).hasClass("maso-box")) { 551 options["type"] = "image"; 552 options["delegate"] = "a.img-box,.advs-box a:not(.img-box)"; 553 options["gallery"] = { enabled: 1 }; 554 } 555 if ((href.indexOf(".jpg") != -1) || (href.indexOf(".png") != -1)) options['type'] = 'image'; 556 if (href.indexOf("#") == 0) { 557 options['type'] = 'inline'; 558 options['mainClass'] += ' box-inline'; 559 options['closeBtnInside'] = 0; 560 } 561 options["callbacks"] = { 562 open: function () { 563 var mfp_cnt = $('.mfp-content'); 564 if (!isEmpty(a)) { 565 $(mfp_cnt).showAnima(a); 566 $(mfp_cnt).css("opacity", 0); 567 } else { 568 if ((!isEmpty(optionsString)) && optionsString.indexOf("anima:") != -1) { 569 $(mfp_cnt).showAnima(options['anima']); 570 $(mfp_cnt).css("opacity", 0); 571 } 572 } 573 if (href.indexOf("#") == 0) { 574 $(href).css("display", "block"); 575 } 576 if ($.isFunction($.fn.initFlexSlider)) { 577 var i = 0; 578 $(mfp_cnt).find(".flexslider").each(function () { 579 $(this).initFlexSlider(); 580 i++; 581 }); 582 if (i) $(window).trigger('resize').trigger('scroll'); 583 } 584 var gm = $(mfp_cnt).find(".google-map"); 585 if ($.isFunction($.fn.googleMap) && $(gm).length) $(gm).googleMap(); 586 }, 587 change: function (item) { 588 var h = this.content; 589 $('.mfp-container').removeClass("active"); 590 setTimeout(function () { $('.mfp-container').addClass("active"); }, 500); 591 if ($.isFunction($.fn.initFlexSlider)) { 592 setTimeout(function () { 593 var i = 0; 594 $(h).find(".flexslider").each(function () { 595 $(this).initFlexSlider(); 596 i++; 597 }); 598 if (i) $(window).trigger('resize').trigger('scroll'); 599 }, 100); 600 } 601 var gm = $(h).find(".google-map"); 602 if ($.isFunction($.fn.googleMap) && $(gm).length) $(gm).googleMap(); 603 }, 604 close: function () { 605 if ($.isFunction($.fn.fullpage) && $.isFunction($.fn.fullpage.setMouseWheelScrolling)) $.fn.fullpage.setMouseWheelScrolling(true); 606 } 607 }; 608 if (trigger != "load" && trigger != "scroll") $(obj).magnificPopup(options); 609 else { 610 if (href.indexOf("#") == 0) $(href).css("display", "block"); 611 options['items'] = { 'src': href } 612 options['mainClass'] += ' lightbox-on-load'; 613 $.magnificPopup.open(options); 614 } 615 }; 616 617 //jquery.slimscroll.min.js 618 $.fn.initSlimScroll = function () { 619 var width = $(window).width(); 620 function getHeightFullscreen(t, wh) { 621 var vh = $(t).attr("data-height"); 622 var lh = $(t).attr("data-height-remove"); 623 if (isEmpty(vh) || vh == "auto") { 624 var h = wh - $(t)[0].getBoundingClientRect().top - $("footer").outerHeight(), ch = $(t).outerHeight(); 625 if (!isEmpty(lh)) h = wh - lh; 626 vh = (ch < h) ? ch + 30 : h - 30; 627 } 628 if (vh == "fullscreen") { 629 var h = wh; 630 if (!isEmpty(lh) && ((wh - lh) > 150)) h = wh - lh; 631 else h = wh - 100; 632 vh = h; 633 } 634 return vh; 635 } 636 637 if (!$(this).hasClass("scroll-mobile-disabled") || width > 993) { 638 var optionsString = $(this).attr("data-options"); 639 var optionsArr; 640 var options = { 641 height: 0, 642 size: '4px' 643 } 644 if (!isEmpty(optionsString)) { 645 optionsArr = optionsString.split(","); 646 options = getOptionsString(optionsString, options); 647 } 648 if (width < 993) options['alwaysVisible'] = true; 649 650 var vh = getHeightFullscreen(this, $(window).height()); 651 var lh = $(this).attr("data-height-remove"); 652 if (isEmpty(lh)) lh = 0; 653 vh += ""; 654 655 if ((vh.indexOf("#") != -1) || (vh.indexOf(".") != -1)) vh = "" + ($(this).closest(vh).height() - lh); 656 657 options['height'] = vh + "px"; 658 $(this).slimScroll(options); 659 660 var gm = $(this).find(".google-map"); 661 if ($.isFunction($.fn.googleMap) && $(gm).length) $(gm).googleMap(); 662 663 if (!options['alwaysVisible']) $(".slimScrollBar").hide(); 664 } 665 } 666 667 //jquery.flexslider-min.js 668 $.fn.restartFlexSlider = function () { 669 var t = this; 670 setTimeout(function () { $(t).removeData('flexslider'); $(t).find('li.clone').remove(); $(t).find('.flex-control-nav').remove(); $(t).initFlexSlider(); }, 100); 671 } 672 $.fn.initFlexSlider = function () { 673 function animaSlider(obj) { 674 var anima_li = $(obj).find(".flex-active-slide");
675 var anima = $(anima_li).attr("data-slider-anima"); 676 if (!isEmpty(anima)) { 677 $(anima_li).attr("data-anima", anima); 678 initAnima(anima_li); 679 } 680 } 681 var obj = this; 682 var itemWidth = 250; 683 var optionsString = $(obj).attr("data-options"); 684 var optionsArr; 685 var options = { 686 animation: "slide", 687 slideshowSpeed: 6000, 688 controlNav: ($(obj).hasClass("thumb")) ? "thumbnails" : true, 689 start: function () { 690 if (!$(obj).hasClass("advanced-slider") && $.fn.renderLoadedImgs) $(obj).find(".slides").renderLoadedImgs(); 691 if ($(obj).hasClass("carousel")) { 692 $(obj).find(".slides > li").css("width", itemWidth + "px"); 693 } 694 if ($(obj).hasClass("thumb") || $(obj).hasClass("nav-middle")) $(obj).find(".flex-prev,.flex-next").css("top", $(obj).find(".slides > li img")[0].clientHeight / 2 + "px"); 695 $(obj).find(".background-page video,.section-bg-video").each(function () { 696 $(this).setVideoBgSize($(window).height(), $(window).width()); 697 }); 698 $(obj).find(".pos-slider.pos-center").each(function () { 699 $(this).css("margin-left", "-" + $(this).width() / 2 + "px"); 700 }); 701 $(obj).find(".pos-slider.pos-middle").each(function () { 702 $(this).css("margin-top", "-" + $(this).height() / 2 + "px"); 703 }); 704 animaSlider(obj); 705 }, 706 after: function () { 707 animaSlider(obj); 708 } 709 } 710 if (!isEmpty(optionsString)) { 711 optionsArr = optionsString.split(","); 712 options = getOptionsString(optionsString, options); 713 if (optionsString.indexOf("controlNav:false") != -1) $(this).addClass("no-navs"); 714 } 715 716 if ($(obj).hasClass("carousel")) { 717 var slides = $(obj).find(".slides > li"); 718 var minWidth = 110; 719 if ($(window).width() < 993) { 720 minWidth = 180; 721 } 722 var itemMargin = 5; 723 var numItems = 3; 724 var ow = $(obj).outerWidth(); 725 if (!isEmpty(optionsString)) { 726 for (var i = 0; i < optionsArr.length; i++) { 727 var val = optionsArr[i].split(":"); 728 if (val[0] == "minWidth") minWidth = val[1]; 729 if (val[0] == "itemWidth") itemWidth = val[1]; 730 if (val[0] == "itemMargin") itemMargin = val[1]; 731 if (val[0] == "numItems") numItems = parseInt(val[1], 10); 732 } 733 } 734 itemWidth = ow / numItems; 735 if (itemWidth < minWidth) { 736 numItems = 1; 737 if (ow / 2 > minWidth) numItems = 2; 738 if (ow / 3 > minWidth) numItems = 3; 739 itemWidth = ow / numItems; 740 } 741 if (numItems == 1) itemMargin = 0; 742 itemWidth = itemWidth + itemMargin / numItems; 743 itemWidth = itemWidth.toFixed(1); 744 minWidth = itemWidth; 745 746 options["itemWidth"] = itemWidth; 747 options["itemMargin"] = itemMargin; 748 var m = Math.ceil(slides.length / numItems); 749 options["move"] = (m > numItems) ? numItems : m; 750 if (slides.length < numItems) options["move"] = 0; 751 options["numItems"] = numItems; 752 if (itemMargin > 0) { 753 $(slides).css("padding-right", itemMargin + "px"); 754 } 755 } 756 var slider_anima = $("[data-slider-anima] .anima"); 757 $(slider_anima).each(function () { 758 $(this).css("opacity", 0); 759 }); 760 $(obj).flexslider(options); 761 } 762 763 //DOCUMENT READY 764 $(document).ready(function () { 765 //DEVICE SIZE 766 var wh = $(window).width(); 767 var hh = $(window).height(); 768 var device_screen_size; 769 var cache; 770 if (wh < 993) device_screen_size = "device-xs"; 771 if (wh > 992 && wh < 1200) device_screen_size = "device-m"; 772 if (wh > 1200) device_screen_size = "device-l"; 773 $("body").addClass(device_screen_size); 774 775 //VIDEO BG 776 cache = $(".background-page video,.section-bg-video,.header-video"); 777 $(cache).each(function () { 778 $(this).setVideoBgSize(hh, wh); 779 }); 780 if (wh < 992 && $(".section-bg-video,.header-video").length) { 781 setInterval(function () { 782 cache = $(".background-page video,.section-bg-video"); 783 $(cache).each(function () { 784 $(this).setVideoBgSize(); 785 }); 786 }, 600); 787 } 788 789 //SOCIAL 790 $("body").on("click", "[data-social]", function () { 791 var a = $(this).attr("data-social"); 792 var link = $(this).attr("data-social-url"); 793 var purl = link; 794 if (isEmpty(link)) purl = window.location.href; 795 796 var url = 'https://www.facebook.com/sharer/sharer.php?u=' + purl; 797 if (a == 'share-twitter') { 798 url = 'https://twitter.com/intent/tweet?text=' + $('meta[name=description]').attr("content"); 799 if (!isEmpty(link)) url = 'https://twitter.com/intent/tweet?url=' + link; 800 } 801 if (a == 'share-google') url = 'https://plus.google.com/share?url=' + purl; 802 if (a == 'share-linkedin') url = 'https://www.linkedin.com/shareArticle?url=' + purl; 803 openWindow(url); 804 }); 805 806 //MENU - MOBILE 807 $(".navbar-toggle").toggleClick(function () { 808 $(this).closest('.navbar').find('.navbar-collapse').expandItem(); 809 }, function () { 810 $(this).closest('.navbar').find('.navbar-collapse').collapseItem(); 811 $(".subline-bar ul").hide(); 812 }); 813 $("body").on("click", "[data-toggle='dropdown']", function () { 814 var href = $(this).attr("href"); 815 if (!isEmpty(href) && href.length > 5 && !href.startsWith("#")) document.location = href; 816 }); 817 818 //MENU - FIXED TOP 819 setTimeout(function () { 820 if (isEmpty($("header").attr("data-menu-height"))) $("header.fixed-top").css("height", $("header > div").height() + "px"); 821 else $("header").css("height", $("header").attr("data-menu-height") + "px"); 822 }, 150); 823 824 //COMPONENT - FIXED AREA 825 cache = $(".fixed-area"); 826 $(cache).each(function (i) { 827 $(this).css("width", $(this).outerWidth() + "px"); 828 var top = $(this).attr("data-topscroll"); 829 if (isEmpty(top)) top = $("header div").outerHeight(true); 830 arrFA[i] = [$(this).offset().top, $(this).offset().left, top];
831 $(this).closest(".section-item").css("z-index", "4").css("overflow", "visible"); 832 }); 833 834 //ANIMATIONS 835 cache = $("[data-anima]"); 836 $(cache).each(function () { 837 var tr = $(this).attr("data-trigger"); 838 if (isEmpty(tr) || tr == "scroll" || tr == "load") { 839 var an = $(this).find(".anima,*[data-anima]"); 840 if (isEmpty(an)) an = this; 841 var cont = null; 842 var x = 0; 843 $(an).each(function () { 844 if (!$(this).hasClass("anima") && an != this) { 845 cont = this; 846 } else { 847 if (cont != null && !$.contains(cont, this) || cont == null) { 848 $(this).css("opacity", 0); 849 x++; 850 } 851 } 852 }); 853 if (x == 0) $(this).css("opacity", 0); 854 } 855 if (!isEmpty(tr) && tr == "load") initAnima(this); 856 }); 857 858 $("body").on("click", '*[data-anima]*[data-trigger="click"]', function () { 859 outAnima(this); 860 initAnima(this); 861 }); 862 $('*[data-anima]*[data-trigger="hover"]').on("mouseenter", function () { 863 initAnima(this); 864 }).mouseleave(function () { 865 $(this).stop(true, false); 866 outAnima(this); 867 }); 868 869 //MENU 870 $("body").on("click", ".nav > li", function () { 871 var n = $(this).closest('.nav'); 872 $(n).find("li").removeClass("active").removeClass("current-active"); 873 $(this).addClass("active current-active"); 874 }); 875 876 //MENU ANIMATIONS 877 if (device_screen_size != "device-xs") { 878 cache = $("[data-menu-anima]"); 879 $(cache).each(function () { 880 var a = $(this).closest("[data-menu-anima]").attr("data-menu-anima"); 881 $(this).find("ul:not(.side-menu):first-child li").on("mouseenter", function () { 882 $(this).find(" > ul, > .mega-menu").css("opacity", 0).css("transition-duration", "0ms").showAnima(a); 883 }); 884 $(this).find(".side-menu li").on("mouseenter", function () { 885 $(this).find(".panel").css("opacity", 0).css("transition-duration", "0ms").showAnima(a); 886 }); 887 if ($(this).hasClass("side-menu-lateral")) { 888 $(this).find(".side-menu li").on("mouseenter", function () { 889 $(this).find("ul").css("opacity", 0).css("transition-duration", "0ms").showAnima(a); 890 }); 891 } 892 }); 893 894 $("body").on("mouseenter", ".nav > li", function () { 895 $(this).closest(".nav").find("li").removeClass("open"); 896 }); 897 } 898 899 //MENU - SIDE 900 function hide_mobile_menu(t) { 901 var a = $(t).attr("data-menu-anima"); 902 if (isEmpty(a)) a = "fade-in"; 903 $(".hamburger-menu,.side-menu-fixed").css("visibility", "hidden").css("opacity", "0").removeClass(a); 904 $(t).removeClass("active"); 905 $("body").css("overflow", ""); 906 } 907 function show_mobile_menu(t) { 908 var a = $(t).attr("data-menu-anima"); 909 if (isEmpty(a)) a = "fade-in"; 910 $(".hamburger-menu,.side-menu-fixed").css("visibility", "visible").showAnima(a); 911 $(t).addClass("active"); 912 if (device_screen_size == "device-xs") $("body").css("overflow", "hidden"); 913 } 914 if (device_screen_size == "device-xs") { 915 $("body").on("click", ".side-menu > li.panel-item", function (e) { 916 if ($(e.target).closest(".collapse").length == 0) $(this).toggleClass("active"); 917 }); 918 $("body").on("click", ".side-menu > li", function (e) { 919 var t = this; 920 cache = $(".side-menu > li"); 921 $(cache).each(function () { 922 if (t !== this) { 923 $(this).removeClass("active"); 924 $(this).find(".collapse").removeClass("in").removeClass("open"); 925 } 926 }); 927 var ul = $(t).find("ul"); 928 if ($(ul).length == 0) { 929 hide_mobile_menu($(".hamburger-button")); 930 } else { 931 if ($(t).hasClass("active")) { 932 $(t).removeClass("active"); 933 $(ul).removeClass("in").removeClass("open"); 934 } else { 935 $(t).addClass("active"); 936 $(ul).addClass("in").addClass("open"); 937 } 938 } 939 }); 940 $("header .dropdown-toggle").attr("href", "#"); 941 } 942 if ($(".side-menu-fixed").length) { 943 var mh = $(window).height() - ($('.side-menu-fixed .top-area').outerHeight(true) + $('.side-menu-fixed .bottom-area').outerHeight(true)); 944 $('.side-menu-fixed .sidebar').css('height', mh + "px"); 945 $(".side-menu-fixed .scroll-content").attr("data-height", mh); 946 947 if ($.isFunction($.fn.slimScroll)) { 948 $("body").on("click", ".side-menu li", function () { 949 $(".side-menu-fixed .scroll-content").slimScroll(); 950 }); 951 } 952 } 953 $("body").on("click", ".side-menu .panel-item", function () { 954 $(this).find(".panel").toggleClass("open"); 955 }); 956 $("body").on("click", ".side-menu .panel-item li", function () { 957 $(this).closest(".panel").toggleClass("open"); 958 }); 959 cache = $(".side-menu"); 960 $(cache).each(function () { 961 if ($.isFunction($.fn.metisMenu)) $(this).metisMenu(); 962 }); 963 cache = $(".one-page-menu,.navbar-nav.inner,.side-menu:not(#fullpage-menu)"); 964 $(cache).each(function () { 965 onePageScroll(this); 966 }); 967 if ($('.side-menu .panel-item').length) { 968 var width = $(".side-menu-fixed").css("width"); 969 $('.side-menu .panel-item .panel').css("left", width); 970 } 971 972 //HAMBURGER BUTTON 973 $(".hamburger-button").toggleClick(function () { 974 show_mobile_menu(this); 975 }, function () { 976 if ($(this).hasClass("active")) hide_mobile_menu(this); 977 else show_mobile_menu(this); 978 }); 979 980 //OTHERS 981 $('a[href="#"]').on('click', function (e) { 982 e.preventDefault(); 983 }); 984 985 $("body").on("click", ".img-box .caption", function () { 986 var a = $(this).closest(".img-box").find("a.img-box"); 987 var link = $(a).attr("href"); 988 $(a).click(); 989 if (!isEmpty(link) && link.indexOf("http") > -1) { 990 var t = a.attr("target"); 991 if (!isEmpty(t) && t == "_blank") window.open(link); 992 else document.location = link; 993 } 994 }); 995 cache = $(".grid-list[class^='row-'], .grid-list[class*=' row-'],.maso-list[class^='row-'], .maso-list[class*=' row-']"); 996 $(cache).each(function () { 997 var css = $.grep(this.className.split(" "), function (v, i) { 998 return v.indexOf('row') === 0; 999 }).join(); 1000 $(this).find(".grid-item > *,.grid-item .flexslider li > *").addClass(css); 1001 }); 1002 $(".header-slider,.header-video,.header-title").setMiddleBox(".container > div"); 1003 $(".full-screen-title .container > div").css("margin-top", ""); 1004 cache = $(".full-screen-size"); 1005 $(cache).each(function () { 1006 var h = $(this).attr("data-sub-height"); 1007 $(this).sizeFullScreen((isEmpty(h) ? null : h)); 1008 }); 1009 cache = $(".full-screen-title"); 1010 $(cache).each(function () { 1011 var h = $(this).attr("data-sub-height"); 1012 $(this).titleFullScreen((isEmpty(h) ? null : h)); 1013 }); 1014 cache = $(".box-middle-container"); 1015 $(cache).each(function () { 1016 $(this).setMiddleBox(); 1017 }); 1018 $(".social-group-button .social-button").toggleClick(function () { 1019 var t = $(this).closest(".social-group-button"); 1020 $(t).find(".social-group").css("display", "block"); 1021 $(t).find(".social-group i").showAnima("fade-left"); 1022 }, function () { 1023 var t = $(this).closest(".social-group-button"); 1024 $(t).find(".social-group").css("display", "none"); 1025 $(t).find(".social-group i").css("opacity", "0"); 1026 }); 1027 if (device_screen_size != "device-xs") { 1028 cache = $(".section-two-blocks .content"); 1029 $(cache).each(function () { 1030 var t = this; 1031 setTimeout(function () { 1032 var h = $(t).outerHeight(); 1033 var cnt = $(t).closest(".section-two-blocks"); 1034 if (isEmpty($(cnt).attr("data-parallax"))) $(cnt).css("height", h); 1035 $(cnt.find(".row > div:first-child")).renderLoadedImgs(); 1036 }, 300); 1037 }); 1038 } 1039 1040 //WORDPRESS 1041 if ($("#wpadminbar").length) { 1042 if ($("header").hasClass("fixed-top")) $("header > .navbar").css("margin-top", "32px"); 1043 if ($("header").hasClass("side-menu-header")) $("header .side-menu-fixed,header .navbar-fixed-top").css("margin-top", "32px"); 1044 } 1045 cache = $("header a"); 1046 $(cache).each(function () { 1047 if ($(this).attr("href") == window.location.href) { 1048 if ($(this).closest(".dropdown-menu").length) { 1049 $(this).closest(".dropdown.multi-level:not(.dropdown-submenu),.dropdown.mega-dropdown").addClass("active"); 1050 } else { 1051 $(this).closest("li").addClass("active"); 1052 } 1053 } 1054 }); 1055 1056 //BACKGROUND VIDEO YT
1057 cache = $("[data-video-youtube]"); 1058 $(cache).each(function () { 1059 var id = $(this).attr("data-video-youtube"); 1060 if (id.indexOf("http:") != -1 || id.indexOf("www.you") != -1 || id.indexOf("youtu.be") != -1) { 1061 if (id.indexOf("?v=") != -1) id = id.substring(id.indexOf("v=") + 2); 1062 if (id.indexOf("youtu.be") != -1) id = id.substring(id.lastIndexOf("/") + 1); 1063 } 1064 var vq = $(this).attr("data-video-quality"); 1065 var pars = ""; 1066 if (!isEmpty(vq)) { 1067 if (vq == "hc-hd") pars += "&vq=hd1080"; 1068 } 1069 $(this).html('<iframe frameborder="0" allowfullscreen="0" src="https://www.youtube.com/embed/' + id + '?playlist=' + id + '&vq=hd1080&loop=1&start=0&autoplay=1&controls=0&showinfo=0&wmode=transparent&iv_load_policy=3&modestbranding=1&rel=0&enablejsapi=1&volume=0' + pars + '"></iframe>'); 1070 }); 1071 if ($(".background-page iframe").length) { 1072 $(".background-page iframe").css("height", $(window).height() + 300 + "px").css("width", $(window).width() + 300 + "px").css("margin-left", "-150px"); 1073 } 1074 1075 //MENU - SEARCH C 1076 $(".btn-search").toggleClick(function () { 1077 $(this).closest(".search-box-menu").find(".search-box").css("opacity", 0).css("display", "block").showAnima("fade-bottom"); 1078 }, 1079 function () { 1080 $(this).closest(".search-box-menu").find(".search-box").css("display", "none"); 1081 }); 1082 1083 //MENU - SUBLINE 1084 function showSublineMenu(item) { 1085 var p = $(item).closest("header"); 1086 var t = $(p).find(".subline-bar ul:eq(" + $(item).index() + ")"); 1087 $(p).find(".subline-bar ul").css("display", "none"); 1088 $(t).css("opacity", "0").css("display", "block").animate({ "opacity": 1 }, 300); 1089 } 1090 $(".subline-menu > li").mouseover(function () { 1091 showSublineMenu(this); 1092 }); 1093 $(".subline-bar").on("mouseleave", function () { 1094 $(this).find("ul").css("display", "none"); 1095 }); 1096 if ($("header").hasClass("fixed-top")) $(".subline-bar").css("margin-top", $("header").height() + "px"); 1097 1098 //MENU - MINI TOP - SEARCH 1099 $(".navbar-mini .form-control").focusin(function () { 1100 $(this).toggleClass("focus"); 1101 }); 1102 $(".navbar-mini .form-control").focusout(function () { 1103 $(this).toggleClass("focus"); 1104 }); 1105 1106 //SCROLL METHODS 1107 setTimeout(function () { $(window).scroll(); }, 50); 1108 $("body").on("click", ".scroll-top", function () { 1109 $("html, body").stop().animate({ scrollTop: 0 }, '500', 'swing'); 1110 }); 1111 $("body").on("click", ".scroll-to", function (e) { 1112 var t = $(this).attr("data-scroll-to"); 1113 if (isEmpty(t)) t = $(this).attr("href"); 1114 try { 1115 $(t).scrollTo(); 1116 } catch (e) { } 1117 if (t.indexOf("#") == 0 && ($(this).hasClass("btn") || $(this).hasClass("btn-text"))) e.preventDefault(); 1118 }); 1119 1120 //LOADER 1121 $('#preloader').fadeOut(300); 1122 1123 //PAGE SCROLL 1124 var cnt_title = $(".header-slider .container,.header-video .container,.header-title .container,.header-animation .container"); 1125 var parallax_title = $(".header-parallax"); 1126 var fixed_area = $(".fixed-area"); 1127 var data_anima = $("*[data-anima]"); 1128 var old_scroll = 0; 1129 var scroll_1 = $(".scroll-hide"); 1130 var scroll_2 = $(".scroll-change"); 1131 var scroll_3 = $(".scroll-show"); 1132 var scroll_4 = $(".menu-transparent"); 1133 var scroll_5 = $(".scroll-top-mobile"); 1134 var scroll_6 = $(".scroll-show-mobile"); 1135 var scroll_7 = $(".footer-parallax"); 1136 var scroll_8 = $('header.scroll-change .navbar-brand'); 1137 var scroll_len = $(".fp-enabled").length; 1138 $(window).scroll(function () { 1139 var po = window.pageYOffset; 1140 $(cnt_title).css("margin-top", po / 2).css("opacity", (100 / po < 1) ? (100 / po) : 1); 1141 1142 var scroll = $(window).scrollTop(); 1143 var go = true; 1144 var dh = $(document).height(); 1145 1146 if ($(parallax_title).length) { 1147 if (po > $(window).outerHeight()) $(parallax_title).css("visibility", "hidden"); 1148 else $(parallax_title).css("visibility", "visible"); 1149 $(parallax_title).find(".layer-parallax").css("margin-top", -1 * po / 2); 1150 } 1151 1152 //COMPONENT - FIXED AREA 1153 $(fixed_area).each(function (i) { 1154 if (arrFA.length && scroll > arrFA[i][0]) { 1155 $(this).css("top", arrFA[i][2] + "px").css("left", arrFA[i][1] + "px").css("position", "fixed").addClass("active"); 1156 } else $(this).css("top", "").css("position", "").css("left", "").removeClass("active"); 1157 1158 var _bottom = $(this).attr("data-bottom"); 1159 if (!isEmpty(_bottom)) { 1160 if (scroll + hh > dh - _bottom) { 1161 if (old_scroll < scroll) { 1162 $(this).animate({ 1163 "margin-top": "-" + _bottom 1164 }, 200); 1165 } 1166 } else { 1167 if (old_scroll > scroll) { 1168 $(this).clearQueue(); 1169 $(this).css("margin-top", "") 1170 } 1171 } 1172 } 1173 }); 1174 1175 //SCROLL FUNCTIONS 1176 if (scroll > 100 && go) { 1177 go = false;
1178 $(scroll_1).addClass('hidden'); 1179 $(scroll_2).addClass("scroll-css"); 1180 $(scroll_3).addClass('showed'); 1181 $(scroll_4).removeClass("bg-transparent"); 1182 $(scroll_5).css("opacity", 1); 1183 if (device_screen_size == "device-xs") $(scroll_6).removeClass('hidden'); 1184 $(scroll_8).hide().show(0); 1185 1186 if (scroll + hh > (dh - hh)) { 1187 $(scroll_7).css("opacity", 1); 1188 } else $(scroll_7).css("opacity", 0); 1189 } 1190 if (scroll < 100) { 1191 go = true; 1192 $(scroll_1).removeClass("hidden"); 1193 if (!scroll_len) $(scroll_2).removeClass("scroll-css"); 1194 $(scroll_3).removeClass('showed'); 1195 $(scroll_4).addClass("bg-transparent"); 1196 $(scroll_5).css("opacity", 0); 1197 $(scroll_8).hide().show(0); 1198 } 1199 1200 //SCROLL INTO VIEWPORT 1201 $(data_anima).each(function () { 1202 var tr = $(this).attr("data-trigger"); 1203 if (isEmpty(tr) || tr == "scroll") { 1204 if (isScrollView(this)) { 1205 if (!isEmpty($(this).attr("data-anima"))) initAnima(this); 1206 $(this).attr("data-anima", ""); 1207 } 1208 } 1209 }); 1210 old_scroll = scroll; 1211 }); 1212 1213 //WOOCOMMERCE 1214 populateShoppingCart(); 1215 function populateShoppingCart() { 1216 if ($("meta[content='wordpress']").length && $(".shop-menu-cnt").length) { 1217 jQuery.ajax({ 1218 method: "POST", 1219 url: ajax_url, 1220 data: { 1221 action: 'hc_get_wc_cart_items' 1222 } 1223 }).done(function (response) { 1224 if (!isEmpty(response) && response.length > 10) { 1225 var arr = JSON.parse(response); 1226 if (arr.length > 0) { 1227 var shop_menu = $(".shop-menu-cnt"); 1228 var currency = $(shop_menu).find(".cart-total").attr("data-currency"); 1229 1230 var total = 0; 1231 var html = ""; 1232 for (var i = 0; i < arr.length; i++) { 1233 total += arr[i]["price"] * arr[i]["quantity"]; 1234 html += '<li onclick="document.location = \'' + arr[i]["link"] + '\'" class="cart-item"><img src="' + arr[i]["image"] + '" alt=""><div class="cart-content"><h5>' + arr[i]["title"] + '</h5><span class="cart-quantity">' + arr[i]["quantity"] + ' x ' + currency + "" + arr[i]["price"] + '</span></div></li>'; 1235 } 1236 $(shop_menu).find(".shop-cart").html(html); 1237 $(shop_menu).find(".cart-total span").html(currency + "" + total); 1238 $(shop_menu).removeClass("shop-menu-empty"); 1239 $(shop_menu).find("i").html('<span class="cart-count">' + arr.length + '</span>'); 1240 } 1241 } 1242 }); 1243 } 1244 } 1245 $("body").on("click", ".ajax_add_to_cart,.product-remove a", function () { 1246 setTimeout(function () { 1247 populateShoppingCart(); 1248 }, 2000); 1249 }); 1250 1251 1252 /* 1253 * THIRD PARTS PLUGINS 1254 * ------------------------------------------------------------- 1255 * Functions and methods that menage the execution of external plugins 1256 */ 1257 1258 //imagesloaded.min.js 1259 $(".img-box").executeFunction("imagesLoaded", function () { 1260 $(".img-box").each(function () { 1261 $(this).renderLoadedImgs(); 1262 }); 1263 }); 1264 1265 //isotope.min.js 1266 $(".maso-list").executeFunction("isotope", function () { 1267 setTimeout(function () { $.fn.setGlobalVar(false, "firstLoad"); }, 1000); 1268 $('.maso-list').each(function () { 1269 if ($(this).attr("data-trigger") != "manual") $(this).initIsotope(); 1270 }); 1271 }); 1272 $("body").on("click", ".maso-filters a", function () { 1273 var f = $(this).attr('data-filter'); 1274 var t = $(this).closest(".maso-list"); 1275 if (!isEmpty(f)) $(t).find('.maso-box').isotope({ filter: "." + $(this).attr('data-filter') }); 1276 var lm = $(t).find('.load-more-maso'); 1277 if (lm.length) { 1278 setTimeout(function () { 1279 var i = 0; 1280 $(t).find('.maso-box .maso-item').each(function () { 1281 if ($(this).attr("style").indexOf("display: none") == -1) i++; 1282 }); 1283 if (i < parseInt($(lm).attr("data-page-items")), 10) $(t).find('.load-more-maso').click(); 1284 }, 450); 1285 } 1286 if ($(t).find('.maso-box .maso-item').length < 3) $(t).find('.load-more-maso').click(); 1287 }); 1288 $("body").on("click", ".maso-order", function () { 1289 var t = $(this).closest(".maso-list").find('.maso-box'); 1290 var sort = $(this).attr("data-sort"); 1291 if (sort == "asc") { 1292 t.isotope({ sortAscending: false }); 1293 $(this).attr("data-sort", "desc"); 1294 $(this).html("<i class='fa fa-arrow-up'></i>"); 1295 } else { 1296 t.isotope({ sortAscending: true }); 1297 $(this).attr("data-sort", "asc"); 1298 $(this).html("data-sort"); 1299 $(this).html("<i class='fa fa-arrow-down'></i>"); 1300 } 1301 }); 1302 $(".maso-item .advs-box").each(function () { 1303 $(this).css("visibility", "visible").css("opacity", "1"); 1304 $(this).find("> *").animate({ "opacity": 1 }, 300); 1305 }); 1306 1307 //jquery.bootgrid.min.js 1308 $(".bootgrid-table").executeFunction("bootgrid", function () { 1309 $(".bootgrid-table").each(function () { 1310 var optionsString = $(this).attr("data-options"); 1311 var optionsArr; 1312 var options = { 1313 caseSensitive: false, 1314 formatters: { 1315 "image": function (column, row) { 1316 var val = row[column.id]; 1317 var img, thumb; 1318 if (val.split(",").length > 1) { 1319 img = val.split(",")[0]; 1320 thumb = val.split(",")[1]; 1321 } else img = thumb = val; 1322 return '<a class="lightbox" href="' + img + '"><img src="' + thumb + '"></a>'; 1323 }, 1324 "button": function (column, row) { 1325 var val = row[column.id]; 1326 return '<a href="' + val.split(",")[1] + '" class="btn btn-default btn-xs">' + val.split(",")[0] + '</a>'; 1327 }, 1328 "link": function (column, row) { 1329 var val = row[column.id]; 1330 return '<a href="' + val.split(",")[1] + '" class="link">' + val.split(",")[0] + '</a>'; 1331 }, 1332 "link-icon": function (column, row) { 1333 var val = row[column.id]; 1334 return '<a target="_blank" href="' + val.split(",")[1] + '" class="link"><i class="fa ' + val.split(",")[0] + '"></i></a>'; 1335 } 1336 } 1337 } 1338 if (!isEmpty(optionsString)) { 1339 optionsArr = optionsString.split(","); 1340 options = getOptionsString(optionsString, options); 1341 } 1342 $(this).bootgrid(options).on("loaded.rs.jquery.bootgrid", function (e) { 1343 if ($.isFunction($.fn.magnificPopup)) { 1344 $(this).find('a.lightbox').magnificPopup({ 1345 type: 'image' 1346 }); 1347 } 1348 }); 1349 }); 1350 }); 1351 1352 //jquery.flipster.min.js 1353 $(".coverflow-slider").executeFunction("flipster", function () { 1354 $(".coverflow-slider").each(function () { 1355 if ($(this).attr("data-trigger") != "manual") { 1356 var w = $(this).attr("data-width"); 1357 var wm = $(this).attr("data-mobile-width"); 1358 if ($(window).width() < 768 && !isEmpty(wm)) w = wm; 1359 var options = {}; 1360 var opt = $(this).attr("data-options"); 1361 if (!isEmpty(opt)) { 1362 options = getOptionsString(opt, options); 1363 } 1364 if (!isEmpty(w)) $(this).find("ul > li").css("width", w + "%"); 1365 $(this).flipster(options); 1366 } 1367 }); 1368 }); 1369 1370 $("body").on("click", ".coverflow-slider .coverflow-lightbox", function () { 1371 var p = $(this).closest(".flip-item"); 1372 if ($(p).hasClass("flip-current")) { 1373 $.magnificPopup.open({ 1374 items: { 1375 src: $(this).attr("href") 1376 }, 1377 type: ($(this).hasClass("mfp-iframe")) ? 'iframe' : 'image' 1378 }); 1379 e.preventDefault(); 1380 } 1381 }); 1382 1383 //jquery.magnific-popup.min.js 1384 $(".grid-list.gallery .grid-box,.maso-list.gallery .maso-box, .lightbox,.box-lightbox,.popup-banner,.popup-trigger,.lightbox-trigger,.woocommerce-product-gallery__image a").executeFunction("magnificPopup", function () { 1385 $('.grid-list.gallery .grid-box,.maso-list.gallery .maso-box,.lightbox,.woocommerce-product-gallery__image a').each(function () { 1386 $(this).initMagnificPopup(); 1387 }); 1388 $('*[data-trigger="load"].popup-banner').each(function () { 1389 var e = $(this).attr("data-expire"); 1390 if (!isEmpty(e) && e > 0) { 1391 var id = $(this).attr("id"); 1392 if (isEmpty(Cookies.get(id))) { 1393 $(this).showPopupBanner(); 1394 Cookies.set(id, 'expiration-cookie', { expire: e }); 1395 } 1396 } else $(this).showPopupBanner(); 1397 }); 1398 $('.popup-trigger').on("click", function () { 1399 $($(this).attr("href")).showPopupBanner(); 1400 }); 1401 $('.popup-banner [data-click]').each(function () { 1402 var t = this; 1403 var c = $(t).attr("data-click"); 1404 if (!isEmpty(c)) { 1405 $("body").on("click", $(t).attr("data-click-trigger"), function () { 1406 if ($(t).attr("data-click-target") == "_blank") window.open(c); 1407 else document.location = c; 1408 }); 1409 } 1410 }); 1411 $(window).scroll(function (event) { 1412 $('*[data-trigger="scroll"].popup-trigger').each(function () { 1413 if (isScrollView(this)) { 1414 var t = $(this).attr("href"); 1415 var a = $(t).attr("data-popup-anima"); 1416 if (!isEmpty(a)) { 1417 $(t).css("opacity", 0); 1418 $(t).showAnima(a); 1419 } 1420 $(t).css("display", "block"); 1421 $(this).removeClass("popup-trigger"); 1422 } 1423 }); 1424 $('*[data-trigger="scroll"].lightbox-trigger').each(function () { 1425 if (isScrollView(this)) { 1426 $($(this).attr("href")).initMagnificPopup(); 1427 $(this).attr("data-trigger", "null"); 1428 } 1429 }); 1430 }); 1431 1432 //Deep linking
1433 var url = getURLParameter("lightbox"); 1434 var id = getURLParameter("id"); 1435 if (!isEmpty(id)) id = "#" + id + " "; 1436 if (!isEmpty(url)) { 1437 if (url.indexOf("list") > -1) { 1438 $(id + ".grid-box .grid-item:nth-child(" + url.replace("list-", "") + ") .img-box").click(); 1439 $(id + ".maso-box .maso-item:nth-child(" + url.replace("list-", "") + ") .img-box").click(); 1440 } else { 1441 if (url.indexOf("slide") > -1) { 1442 $(id + ".slides > li:nth-child(" + url.replace("slide-", "") + ") .img-box").click(); 1443 } else { 1444 var t = $("#" + url); 1445 if ($(t).length) { 1446 if ($(t).hasClass(".img-box") || $(t).hasClass(".lightbox")) $(t).click(); 1447 else { 1448 var c = $(t).find(".img-box,.lightbox"); 1449 if (c.length) { 1450 $(c).click(); 1451 } else { 1452 if ($(t).hasClass("box-lightbox")) { 1453 $.magnificPopup.open({ 1454 type: 'inline', 1455 items: { 'src': '#' + url }, 1456 mainClass: 'lightbox-on-load' 1457 }); 1458 } 1459 } 1460 } 1461 } 1462 } 1463 1464 } 1465 } 1466 }); 1467 $("body").on("click", ".popup-close", function () { 1468 $(this).closest(".popup-banner").hide(); 1469 }); 1470 $('[data-trigger="load"].box-lightbox').each(function () { 1471 var e = $(this).attr("data-expire"); 1472 if (!isEmpty(e) && e > 0) { 1473 var id = $(this).attr("id"); 1474 if (isEmpty(Cookies.get(id))) { 1475 $(this).initMagnificPopup(); 1476 Cookies.set(id, 'expiration-cookie', { expire: e }); 1477 } 1478 } else $(this).initMagnificPopup(); 1479 }); 1480 1481 //jquery.slimscroll.min.js 1482 $(".scroll-content").executeFunction("slimScroll", function () { 1483 $(".scroll-content").each(function () { 1484 $(this).initSlimScroll(); 1485 if ($(window).width() < 993) $(".slimScrollBar").css("height", "50px"); 1486 }); 1487 $(".scroll-content").on("mousewheel DOMMouseScroll", function (n) { n.preventDefault() }); 1488 }); 1489 1490 //jquery.spritely.min.js 1491 $(".section-bg-animation,.header-animation").executeFunction("pan", function () { 1492 $(".header-animation .overlay.center").each(function () { 1493 $(this).css("margin-left", "-" + $(this).width() / 2 + "px"); 1494 }); 1495 var overlay = $(".section-bg-animation,.header-animation").find("img.overlay"); 1496 $('#anima-layer-a').pan({ fps: 30, speed: 0.7, dir: 'left', depth: 30 }); 1497 $('#anima-layer-b').pan({ fps: 30, speed: 1.2, dir: 'left', depth: 70 }); 1498 $(window).scroll(function () { 1499 var po = window.pageYOffset; 1500 $(overlay).css("opacity", (100 / po < 1) ? (100 / po) : 1); 1501 }); 1502 }); 1503 1504 //parallax.min.js 1505 $("[data-parallax]").executeFunction("parallax", function () { 1506 $("[data-parallax]").each(function () { 1507 var bleed_ = $(this).attr("data-bleed"); 1508 if (isEmpty(bleed_)) bleed_ = 70; 1509 $(this).parallax({ bleed: bleed_, positionY: "center" }); 1510 }); 1511 $(".section-bg-image,.section-bg-animation,[data-parallax].header-title").each(function (index) { 1512 var ken = ""; 1513 if ($(this).hasClass("ken-burn")) ken = "ken-burn"; 1514 if ($(this).hasClass("ken-burn-out")) ken = "ken-burn-out";
1515 if ($(this).hasClass("ken-burn-center")) ken = "ken-burn-center"; 1516 if ($(this).hasClass("parallax-side")) ken += " parallax-side-cnt"; 1517 if (ken.length > 0) { setTimeout(function () { $(".parallax-mirror:eq(" + (index - 1) + ")").addClass(ken); }, 100) } 1518 }); 1519 var timerVar; 1520 var times = 0; 1521 var isFP = $("html").hasClass("fp-enabled"); 1522 timerVar = self.setInterval(function () { 1523 if (times > 30) { 1524 clearInterval(timerVar); 1525 } else { 1526 if (!isFP) $(window).trigger('resize').trigger('scroll'); 1527 } 1528 times = times + 1; 1529 }, 100); 1530 if ($(".section-bg-animation,.header-animation").length) { 1531 var c = $(".section-bg-animation,.header-animation"); 1532 var lays = $(c).find(".anima-layer"); 1533 $(window).scroll(function () { 1534 var po = window.pageYOffset - (c.offset().top - c.getHeight() / 4); 1535 $(lays).css("margin-top", po / 1.5); 1536 }); 1537 } 1538 if ($("[data-parallax]").length) { 1539 setInterval(function () { 1540 $(window).trigger('resize').trigger('scroll'); 1541 }, 400); 1542 } 1543 }); 1544 1545 //jquery.flexslider-min.js 1546 $(".flexslider").executeFunction("flexslider", function () { 1547 $('.flexslider.slider,.flexslider.carousel').each(function () { 1548 if ($(this).attr("data-trigger") != "manual") $(this).initFlexSlider(); 1549 }); 1550 $('.list-full-screen li').css("height", $('.list-full-screen ').height() - 10); 1551 }); 1552 }); 1553}(jQuery));
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.