Advertisement
rdusnr

Untitled

May 22nd, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 160.65 KB | None | 0 0
  1. /**
  2. * Javascript logic
  3. *
  4. * SCRIPTS
  5. * SHORTCODES
  6. * THEME LOGIC
  7. */
  8.  
  9.  
  10.  
  11. /*--------------------------------------------------
  12.  
  13. LOADING SCRIPTS
  14. ---------------------------------------------------*/
  15.  
  16. /* matchmedia*/
  17. window.matchMedia = window.matchMedia || function (a) {
  18. "use strict";
  19. var c, d = a.documentElement, e = d.firstElementChild || d.firstChild, f = a.createElement("body"), g = a.createElement("div");
  20. return g.id = "mq-test-1", g.style.cssText = "position:absolute;top:-100em", f.style.background = "none", f.appendChild(g), function (a) {
  21. return g.innerHTML = '&shy;<style media="' + a + '"> #mq-test-1 { width: 42px; }</style>', d.insertBefore(f, e), c = 42 === g.offsetWidth, d.removeChild(f), {
  22. matches: c,
  23. media: a
  24. }
  25. }
  26. }(document);
  27.  
  28.  
  29. /* Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
  30. (function (a) {
  31. "use strict";
  32. function x() {
  33. u(!0)
  34. }
  35.  
  36. var b = {};
  37. if (a.respond = b, b.update = function () {
  38. }, b.mediaQueriesSupported = a.matchMedia && a.matchMedia("only all").matches, !b.mediaQueriesSupported) {
  39. var q, r, t, c = a.document, d = c.documentElement, e = [], f = [], g = [], h = {}, i = 30, j = c.getElementsByTagName("head")[0] || d, k = c.getElementsByTagName("base")[0], l = j.getElementsByTagName("link"), m = [], n = function () {
  40. for (var b = 0; l.length > b; b++) {
  41. var c = l[b], d = c.href, e = c.media, f = c.rel && "stylesheet" === c.rel.toLowerCase();
  42. d && f && !h[d] && (c.styleSheet && c.styleSheet.rawCssText ? (p(c.styleSheet.rawCssText, d, e), h[d] = !0) : (!/^([a-zA-Z:]*\/\/)/.test(d) && !k || d.replace(RegExp.$1, "").split("/")[0] === a.location.host) && m.push({
  43. href: d,
  44. media: e
  45. }))
  46. }
  47. o()
  48. }, o = function () {
  49. if (m.length) {
  50. var b = m.shift();
  51. v(b.href, function (c) {
  52. p(c, b.href, b.media), h[b.href] = !0, a.setTimeout(function () {
  53. o()
  54. }, 0)
  55. })
  56. }
  57. }, p = function (a, b, c) {
  58. var d = a.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi), g = d && d.length || 0;
  59. b = b.substring(0, b.lastIndexOf("/"));
  60. var h = function (a) {
  61. return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + b + "$2$3")
  62. }, i = !g && c;
  63. b.length && (b += "/"), i && (g = 1);
  64. for (var j = 0; g > j; j++) {
  65. var k, l, m, n;
  66. i ? (k = c, f.push(h(a))) : (k = d[j].match(/@media *([^\{]+)\{([\S\s]+?)$/) && RegExp.$1, f.push(RegExp.$2 && h(RegExp.$2))), m = k.split(","), n = m.length;
  67. for (var o = 0; n > o; o++)l = m[o], e.push({
  68. media: l.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/) && RegExp.$2 || "all",
  69. rules: f.length - 1,
  70. hasquery: l.indexOf("(") > -1,
  71. minw: l.match(/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/) && parseFloat(RegExp.$1) + (RegExp.$2 || ""),
  72. maxw: l.match(/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/) && parseFloat(RegExp.$1) + (RegExp.$2 || "")
  73. })
  74. }
  75. u()
  76. }, s = function () {
  77. var a, b = c.createElement("div"), e = c.body, f = !1;
  78. return b.style.cssText = "position:absolute;font-size:1em;width:1em", e || (e = f = c.createElement("body"), e.style.background = "none"), e.appendChild(b), d.insertBefore(e, d.firstChild), a = b.offsetWidth, f ? d.removeChild(e) : e.removeChild(b), a = t = parseFloat(a)
  79. }, u = function (b) {
  80. var h = "clientWidth", k = d[h], m = "CSS1Compat" === c.compatMode && k || c.body[h] || k, n = {}, o = l[l.length - 1], p = (new Date).getTime();
  81. if (b && q && i > p - q)return a.clearTimeout(r), r = a.setTimeout(u, i), void 0;
  82. q = p;
  83. for (var v in e)if (e.hasOwnProperty(v)) {
  84. var w = e[v], x = w.minw, y = w.maxw, z = null === x, A = null === y, B = "em";
  85. x && (x = parseFloat(x) * (x.indexOf(B) > -1 ? t || s() : 1)), y && (y = parseFloat(y) * (y.indexOf(B) > -1 ? t || s() : 1)), w.hasquery && (z && A || !(z || m >= x) || !(A || y >= m)) || (n[w.media] || (n[w.media] = []), n[w.media].push(f[w.rules]))
  86. }
  87. for (var C in g)g.hasOwnProperty(C) && g[C] && g[C].parentNode === j && j.removeChild(g[C]);
  88. for (var D in n)if (n.hasOwnProperty(D)) {
  89. var E = c.createElement("style"), F = n[D].join("\n");
  90. E.type = "text/css", E.media = D, j.insertBefore(E, o.nextSibling), E.styleSheet ? E.styleSheet.cssText = F : E.appendChild(c.createTextNode(F)), g.push(E)
  91. }
  92. }, v = function (a, b) {
  93. var c = w();
  94. c && (c.open("GET", a, !0), c.onreadystatechange = function () {
  95. 4 !== c.readyState || 200 !== c.status && 304 !== c.status || b(c.responseText)
  96. }, 4 !== c.readyState && c.send(null))
  97. }, w = function () {
  98. var b = !1;
  99. try {
  100. b = new a.XMLHttpRequest
  101. } catch (c) {
  102. b = new a.ActiveXObject("Microsoft.XMLHTTP")
  103. }
  104. return function () {
  105. return b
  106. }
  107. }();
  108. n(), b.update = n, a.addEventListener ? a.addEventListener("resize", x, !1) : a.attachEvent && a.attachEvent("onresize", x)
  109. }
  110. })(this);
  111.  
  112.  
  113. /*
  114. * Project: Twitter Bootstrap Hover Dropdown
  115. * Author: Cameron Spear
  116. * Contributors: Mattia Larentis
  117. * Dependencies: Twitter Bootstrap's Dropdown plugin
  118. * A simple plugin to enable twitter bootstrap dropdowns to active on hover and provide a nice user experience.
  119. * No license, do what you want. I'd love credit or a shoutout, though.
  120. * http://cameronspear.com/blog/twitter-bootstrap-dropdown-on-hover-plugin/
  121. */
  122. (function (b, a, c) {
  123. var d = b();
  124. b.fn.dropdownHover = function (e) {
  125. d = d.add(this.parent());
  126. return this.each(function () {
  127. var k = b(this), j = k.parent(), i = {
  128. delay: 200,
  129. instantlyCloseOthers: true
  130. }, h = {
  131. delay: b(this).data("delay"),
  132. instantlyCloseOthers: b(this).data("close-others")
  133. }, f = b.extend(true, {}, i, e, h), g;
  134. j.hover(function (l) {
  135. if (!j.hasClass("open") && !k.is(l.target)) {
  136. return true
  137. }
  138. if (f.instantlyCloseOthers === true) {
  139. d.removeClass("open")
  140. }
  141. a.clearTimeout(g);
  142. j.addClass("open")
  143. }, function () {
  144. g = a.setTimeout(function () {
  145. j.removeClass("open")
  146. }, f.delay)
  147. });
  148. k.hover(function () {
  149. if (f.instantlyCloseOthers === true) {
  150. d.removeClass("open")
  151. }
  152. a.clearTimeout(g);
  153. j.addClass("open")
  154. });
  155. j.find(".dropdown-submenu").each(function () {
  156. var m = b(this);
  157. var l;
  158. m.hover(function () {
  159. a.clearTimeout(l);
  160. m.children(".dropdown-menu").show();
  161. m.siblings().children(".dropdown-menu").hide()
  162. }, function () {
  163. var n = m.children(".dropdown-menu");
  164. l = a.setTimeout(function () {
  165. n.hide()
  166. }, f.delay)
  167. })
  168. })
  169. })
  170. };
  171. })(jQuery, this);
  172.  
  173.  
  174. /* =========================================================
  175. * bootstrap-tabdrop.js
  176. * http://www.eyecon.ro/bootstrap-tabdrop
  177. * =========================================================
  178. * Copyright 2012 Stefan Petre
  179. *
  180. * Licensed under the Apache License, Version 2.0 (the "License");
  181. * you may not use this file except in compliance with the License.
  182. * You may obtain a copy of the License at
  183. *
  184. * http://www.apache.org/licenses/LICENSE-2.0
  185. *
  186. * Unless required by applicable law or agreed to in writing, software
  187. * distributed under the License is distributed on an "AS IS" BASIS,
  188. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  189. * See the License for the specific language governing permissions and
  190. * limitations under the License.
  191. * ========================================================= */
  192.  
  193. !function (c) {
  194. var b = (function () {
  195. var h = [];
  196. var d = false;
  197. var g;
  198. var e = function (i) {
  199. clearTimeout(g);
  200. g = setTimeout(f, 100)
  201. };
  202. var f = function () {
  203. for (var k = 0, j = h.length; k < j; k++) {
  204. h[k].apply()
  205. }
  206. };
  207. return {
  208. register: function (i) {
  209. h.push(i);
  210. if (d === false) {
  211. c(window).bind("resize", e);
  212. d = true
  213. }
  214. }, unregister: function (l) {
  215. for (var k = 0, j = h.length; k < j; k++) {
  216. if (h[k] == l) {
  217. delete h[k];
  218. break
  219. }
  220. }
  221. }
  222. }
  223. }());
  224. var a = function (e, d) {
  225. this.element = c(e);
  226. this.dropdown = c('<li class="dropdown hide pull-right tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="#">' + d.text + '</a><ul class="dropdown-menu"></ul></li>').prependTo(this.element);
  227. if (this.element.parent().is(".tabs-below")) {
  228. this.dropdown.addClass("dropup")
  229. }
  230. b.register(c.proxy(this.layout, this));
  231. this.layout()
  232. };
  233. a.prototype = {
  234. constructor: a, layout: function () {
  235. var d = [];
  236. this.dropdown.removeClass("hide");
  237. this.element.append(this.dropdown.find("li")).find(">li").not(".tabdrop").each(function () {
  238. if (this.offsetTop > 0) {
  239. d.push(this)
  240. }
  241. });
  242. if (d.length > 0) {
  243. d = c(d);
  244. this.dropdown.find("ul").empty().append(d);
  245. if (this.dropdown.find(".active").length == 1) {
  246. this.dropdown.addClass("active")
  247. } else {
  248. this.dropdown.removeClass("active")
  249. }
  250. } else {
  251. this.dropdown.addClass("hide")
  252. }
  253. }
  254. };
  255. c.fn.tabdrop = function (d) {
  256. return this.each(function () {
  257. var g = c(this), f = g.data("tabdrop"), e = typeof d === "object" && d;
  258. if (!f) {
  259. g.data("tabdrop", (f = new a(this, c.extend({}, c.fn.tabdrop.defaults, e))))
  260. }
  261. if (typeof d == "string") {
  262. f[d]()
  263. }
  264. })
  265. };
  266. c.fn.tabdrop.defaults = {text: "&nbsp;"};
  267. c.fn.tabdrop.Constructor = a
  268. }(window.jQuery);
  269.  
  270.  
  271. /* ======================= Sticky Plugin =============================== */
  272. // // // Sticky Plugin v1.0.0 for jQuery
  273. // =============
  274. // Author: Anthony Garand
  275. // Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
  276. // Improvements by Leonardo C. Daronco (daronco)
  277. // Created: 2/14/2011
  278. // Date: 2/12/2012
  279. // Website: http://labs.anthonygarand.com/sticky
  280. // Description: Makes an element on the page stick on the screen as you scroll
  281. // It will only set the 'top' and 'position' of your element, you
  282. // might need to adjust the width in some cases.
  283. (function (f) {
  284. var e = {
  285. topSpacing: 0,
  286. bottomSpacing: 0,
  287. className: "is-sticky",
  288. wrapperClassName: "sticky-wrapper",
  289. center: false,
  290. getWidthFrom: ""
  291. }, b = f(window), d = f(document), i = [], a = b.height(), g = function () {
  292. var j = b.scrollTop(), q = d.height(), p = q - a, l = (j > p) ? p - j : 0;
  293. for (var m = 0; m < i.length; m++) {
  294. var r = i[m], k = r.stickyWrapper.offset().top, n = k - r.topSpacing - l;
  295. if (j <= n) {
  296. if (r.currentTop !== null) {
  297. r.stickyElement.css("position", "").css("top", "");
  298. r.stickyElement.parent().removeClass(r.className);
  299. r.currentTop = null
  300. }
  301. } else {
  302. var o = q - r.stickyElement.outerHeight() - r.topSpacing - r.bottomSpacing - j - l;
  303. if (o < 0) {
  304. o = o + r.topSpacing
  305. } else {
  306. o = r.topSpacing
  307. }
  308. if (r.currentTop != o) {
  309. r.stickyElement.css("position", "fixed").css("top", o);
  310. if (typeof r.getWidthFrom !== "undefined") {
  311. r.stickyElement.css("width", f(r.getWidthFrom).width())
  312. }
  313. r.stickyElement.parent().addClass(r.className);
  314. r.currentTop = o
  315. }
  316. }
  317. }
  318. }, h = function () {
  319. a = b.height()
  320. }, c = {
  321. init: function (j) {
  322. var k = f.extend(e, j);
  323. return this.each(function () {
  324. var l = f(this);
  325. var m = l.attr("id");
  326. var o = f("<div></div>").attr("id", m + "-sticky-wrapper").addClass(k.wrapperClassName);
  327. l.wrapAll(o);
  328. if (k.center) {
  329. l.parent().css({width: l.outerWidth(), marginLeft: "auto", marginRight: "auto"})
  330. }
  331. if (l.css("float") == "right") {
  332. l.css({"float": "none"}).parent().css({"float": "right"})
  333. }
  334. var n = l.parent();
  335. //if (f('body').hasClass('header-two-rows')) {
  336. n.css("height", l.height());
  337. //}
  338.  
  339. i.push({
  340. topSpacing: k.topSpacing,
  341. bottomSpacing: k.bottomSpacing,
  342. stickyElement: l,
  343. currentTop: null,
  344. stickyWrapper: n,
  345. className: k.className,
  346. getWidthFrom: k.getWidthFrom
  347. })
  348. })
  349. }, update: g
  350. };
  351. if (window.addEventListener) {
  352. window.addEventListener("scroll", g, false);
  353. window.addEventListener("resize", h, false)
  354. } else {
  355. if (window.attachEvent) {
  356. window.attachEvent("onscroll", g);
  357. window.attachEvent("onresize", h)
  358. }
  359. }
  360. f.fn.sticky = function (j) {
  361. if (c[j]) {
  362. return c[j].apply(this, Array.prototype.slice.call(arguments, 1))
  363. } else {
  364. if (typeof j === "object" || !j) {
  365. return c.init.apply(this, arguments)
  366. } else {
  367. f.error("Method " + j + " does not exist on jQuery.sticky")
  368. }
  369. }
  370. };
  371. f(function () {
  372. setTimeout(g, 0)
  373. })
  374. })(jQuery);
  375.  
  376.  
  377. /* ======================= fitVids Plugin =============================== */
  378. /**
  379. * FitVids 1.0.3
  380. *
  381. * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
  382. * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
  383. * Released under the WTFPL license - http://sam.zoy.org/wtfpl/
  384. */
  385. (function (a) {
  386. a.fn.fitVids = function (b) {
  387. var c = {customSelector: null};
  388. if (!document.getElementById("fit-vids-style")) {
  389. var f = document.createElement("div"), d = document.getElementsByTagName("base")[0] || document.getElementsByTagName("script")[0], e = "&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>";
  390. f.className = "fit-vids-style";
  391. f.id = "fit-vids-style";
  392. f.style.display = "none";
  393. f.innerHTML = e;
  394. d.parentNode.insertBefore(f, d)
  395. }
  396. if (b) {
  397. a.extend(c, b)
  398. }
  399. return this.each(function () {
  400. var g = ["iframe[src*='player.vimeo.com']", "iframe[src*='youtube.com']", "iframe[src*='youtube-nocookie.com']", "iframe[src*='kickstarter.com'][src*='video.html']", "iframe[src*='embed.spotify.com']", "object", "embed:not(.mejs-shim)"];
  401. if (c.customSelector) {
  402. g.push(c.customSelector)
  403. }
  404. var h = a(this).find(g.join(","));
  405. h = h.not("object object");
  406. h.each(function () {
  407. var m = a(this);
  408. if (this.tagName.toLowerCase() === "embed" && m.parent("object").length || m.parent(".fluid-width-video-wrapper").length) {
  409. return
  410. }
  411. var i = (this.tagName.toLowerCase() === "object" || (m.attr("height") && !isNaN(parseInt(m.attr("height"), 10)))) ? parseInt(m.attr("height"), 10) : m.height(), j = !isNaN(parseInt(m.attr("width"), 10)) ? parseInt(m.attr("width"), 10) : m.width(), k = i / j;
  412. if (!m.attr("id")) {
  413. var l = "fitvid" + Math.floor(Math.random() * 999999);
  414. m.attr("id", l)
  415. }
  416. m.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top", (k * 100) + "%");
  417. m.removeAttr("height").removeAttr("width")
  418. })
  419. })
  420. }
  421. })(window.jQuery);
  422.  
  423.  
  424. /* ======================= jQuery Easing Plugin =============================== */
  425. /* jQuery Easing Plugin, v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ */
  426. (function($, undefined) {
  427. $.easing.jswing = $.easing.swing;
  428. $.extend($.easing, {
  429. def: "easeOutQuad", swing: function (e, f, a, h, g) {
  430. return $.easing[$.easing.def](e, f, a, h, g)
  431. }, easeInQuad: function (e, f, a, h, g) {
  432. return h * (f /= g) * f + a
  433. }, easeOutQuad: function (e, f, a, h, g) {
  434. return -h * (f /= g) * (f - 2) + a
  435. }, easeInOutQuad: function (e, f, a, h, g) {
  436. if ((f /= g / 2) < 1) {
  437. return h / 2 * f * f + a
  438. }
  439. return -h / 2 * ((--f) * (f - 2) - 1) + a
  440. }, easeInCubic: function (e, f, a, h, g) {
  441. return h * (f /= g) * f * f + a
  442. }, easeOutCubic: function (e, f, a, h, g) {
  443. return h * ((f = f / g - 1) * f * f + 1) + a
  444. }, easeInOutCubic: function (e, f, a, h, g) {
  445. if ((f /= g / 2) < 1) {
  446. return h / 2 * f * f * f + a
  447. }
  448. return h / 2 * ((f -= 2) * f * f + 2) + a
  449. }, easeInQuart: function (e, f, a, h, g) {
  450. return h * (f /= g) * f * f * f + a
  451. }, easeOutQuart: function (e, f, a, h, g) {
  452. return -h * ((f = f / g - 1) * f * f * f - 1) + a
  453. }, easeInOutQuart: function (e, f, a, h, g) {
  454. if ((f /= g / 2) < 1) {
  455. return h / 2 * f * f * f * f + a
  456. }
  457. return -h / 2 * ((f -= 2) * f * f * f - 2) + a
  458. }, easeInQuint: function (e, f, a, h, g) {
  459. return h * (f /= g) * f * f * f * f + a
  460. }, easeOutQuint: function (e, f, a, h, g) {
  461. return h * ((f = f / g - 1) * f * f * f * f + 1) + a
  462. }, easeInOutQuint: function (e, f, a, h, g) {
  463. if ((f /= g / 2) < 1) {
  464. return h / 2 * f * f * f * f * f + a
  465. }
  466. return h / 2 * ((f -= 2) * f * f * f * f + 2) + a
  467. }, easeInSine: function (e, f, a, h, g) {
  468. return -h * Math.cos(f / g * (Math.PI / 2)) + h + a
  469. }, easeOutSine: function (e, f, a, h, g) {
  470. return h * Math.sin(f / g * (Math.PI / 2)) + a
  471. }, easeInOutSine: function (e, f, a, h, g) {
  472. return -h / 2 * (Math.cos(Math.PI * f / g) - 1) + a
  473. }, easeInExpo: function (e, f, a, h, g) {
  474. return (f == 0) ? a : h * Math.pow(2, 10 * (f / g - 1)) + a
  475. }, easeOutExpo: function (e, f, a, h, g) {
  476. return (f == g) ? a + h : h * (-Math.pow(2, -10 * f / g) + 1) + a
  477. }, easeInOutExpo: function (e, f, a, h, g) {
  478. if (f == 0) {
  479. return a
  480. }
  481. if (f == g) {
  482. return a + h
  483. }
  484. if ((f /= g / 2) < 1) {
  485. return h / 2 * Math.pow(2, 10 * (f - 1)) + a
  486. }
  487. return h / 2 * (-Math.pow(2, -10 * --f) + 2) + a
  488. }, easeInCirc: function (e, f, a, h, g) {
  489. return -h * (Math.sqrt(1 - (f /= g) * f) - 1) + a
  490. }, easeOutCirc: function (e, f, a, h, g) {
  491. return h * Math.sqrt(1 - (f = f / g - 1) * f) + a
  492. }, easeInOutCirc: function (e, f, a, h, g) {
  493. if ((f /= g / 2) < 1) {
  494. return -h / 2 * (Math.sqrt(1 - f * f) - 1) + a
  495. }
  496. return h / 2 * (Math.sqrt(1 - (f -= 2) * f) + 1) + a
  497. }, easeInElastic: function (f, h, e, l, k) {
  498. var i = 1.70158;
  499. var j = 0;
  500. var g = l;
  501. if (h == 0) {
  502. return e
  503. }
  504. if ((h /= k) == 1) {
  505. return e + l
  506. }
  507. if (!j) {
  508. j = k * 0.3
  509. }
  510. if (g < Math.abs(l)) {
  511. g = l;
  512. var i = j / 4
  513. } else {
  514. var i = j / (2 * Math.PI) * Math.asin(l / g)
  515. }
  516. return -(g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e
  517. }, easeOutElastic: function (f, h, e, l, k) {
  518. var i = 1.70158;
  519. var j = 0;
  520. var g = l;
  521. if (h == 0) {
  522. return e
  523. }
  524. if ((h /= k) == 1) {
  525. return e + l
  526. }
  527. if (!j) {
  528. j = k * 0.3
  529. }
  530. if (g < Math.abs(l)) {
  531. g = l;
  532. var i = j / 4
  533. } else {
  534. var i = j / (2 * Math.PI) * Math.asin(l / g)
  535. }
  536. return g * Math.pow(2, -10 * h) * Math.sin((h * k - i) * (2 * Math.PI) / j) + l + e
  537. }, easeInOutElastic: function (f, h, e, l, k) {
  538. var i = 1.70158;
  539. var j = 0;
  540. var g = l;
  541. if (h == 0) {
  542. return e
  543. }
  544. if ((h /= k / 2) == 2) {
  545. return e + l
  546. }
  547. if (!j) {
  548. j = k * (0.3 * 1.5)
  549. }
  550. if (g < Math.abs(l)) {
  551. g = l;
  552. var i = j / 4
  553. } else {
  554. var i = j / (2 * Math.PI) * Math.asin(l / g)
  555. }
  556. if (h < 1) {
  557. return -0.5 * (g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e
  558. }
  559. return g * Math.pow(2, -10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j) * 0.5 + l + e
  560. }, easeInBack: function (e, f, a, i, h, g) {
  561. if (g == undefined) {
  562. g = 1.70158
  563. }
  564. return i * (f /= h) * f * ((g + 1) * f - g) + a
  565. }, easeOutBack: function (e, f, a, i, h, g) {
  566. if (g == undefined) {
  567. g = 1.70158
  568. }
  569. return i * ((f = f / h - 1) * f * ((g + 1) * f + g) + 1) + a
  570. }, easeInOutBack: function (e, f, a, i, h, g) {
  571. if (g == undefined) {
  572. g = 1.70158
  573. }
  574. if ((f /= h / 2) < 1) {
  575. return i / 2 * (f * f * (((g *= (1.525)) + 1) * f - g)) + a
  576. }
  577. return i / 2 * ((f -= 2) * f * (((g *= (1.525)) + 1) * f + g) + 2) + a
  578. }, easeInBounce: function (e, f, a, h, g) {
  579. return h - $.easing.easeOutBounce(e, g - f, 0, h, g) + a
  580. }, easeOutBounce: function (e, f, a, h, g) {
  581. if ((f /= g) < (1 / 2.75)) {
  582. return h * (7.5625 * f * f) + a
  583. } else {
  584. if (f < (2 / 2.75)) {
  585. return h * (7.5625 * (f -= (1.5 / 2.75)) * f + 0.75) + a
  586. } else {
  587. if (f < (2.5 / 2.75)) {
  588. return h * (7.5625 * (f -= (2.25 / 2.75)) * f + 0.9375) + a
  589. } else {
  590. return h * (7.5625 * (f -= (2.625 / 2.75)) * f + 0.984375) + a
  591. }
  592. }
  593. }
  594. }, easeInOutBounce: function (e, f, a, h, g) {
  595. if (f < g / 2) {
  596. return $.easing.easeInBounce(e, f * 2, 0, h, g) * 0.5 + a
  597. }
  598. return $.easing.easeOutBounce(e, f * 2 - g, 0, h, g) * 0.5 + h * 0.5 + a
  599. }
  600. });
  601. }) (jQuery);
  602.  
  603.  
  604. /* ======================= debouncedresize Plugin =============================== */
  605. /*
  606. * debouncedresize: special jQuery event that happens once after a window resize
  607. *
  608. * latest version and complete README available on Github:
  609. * https://github.com/louisremi/jquery-smartresize/blob/master/jquery.debouncedresize.js
  610. *
  611. * Copyright 2011 @louis_remi
  612. * Licensed under the MIT license.
  613. */
  614. (function (d) {
  615. var b = d.event, a, c;
  616. a = b.special.debouncedresize = {
  617. setup: function () {
  618. d(this).on("resize", a.handler)
  619. }, teardown: function () {
  620. d(this).off("resize", a.handler)
  621. }, handler: function (i, e) {
  622. var h = this, g = arguments, f = function () {
  623. i.type = "debouncedresize";
  624. b.dispatch.apply(h, g)
  625. };
  626. if (c) {
  627. clearTimeout(c)
  628. }
  629. e ? f() : c = setTimeout(f, a.threshold)
  630. }, threshold: 150
  631. }
  632. })(jQuery);
  633.  
  634.  
  635. /* ======================= imagesLoaded Plugin =============================== */
  636. /**
  637. * imagesLoaded PACKAGED v3.1.8
  638. * JavaScript is all like "You images are done yet or what?"
  639. * MIT License
  640. */
  641.  
  642. (function () {
  643. function e() {
  644. }
  645.  
  646. function t(e, t) {
  647. for (var n = e.length; n--;)if (e[n].listener === t)return n;
  648. return -1
  649. }
  650.  
  651. function n(e) {
  652. return function () {
  653. return this[e].apply(this, arguments)
  654. }
  655. }
  656.  
  657. var i = e.prototype, r = this, o = r.EventEmitter;
  658. i.getListeners = function (e) {
  659. var t, n, i = this._getEvents();
  660. if ("object" == typeof e) {
  661. t = {};
  662. for (n in i)i.hasOwnProperty(n) && e.test(n) && (t[n] = i[n])
  663. } else t = i[e] || (i[e] = []);
  664. return t
  665. }, i.flattenListeners = function (e) {
  666. var t, n = [];
  667. for (t = 0; e.length > t; t += 1)n.push(e[t].listener);
  668. return n
  669. }, i.getListenersAsObject = function (e) {
  670. var t, n = this.getListeners(e);
  671. return n instanceof Array && (t = {}, t[e] = n), t || n
  672. }, i.addListener = function (e, n) {
  673. var i, r = this.getListenersAsObject(e), o = "object" == typeof n;
  674. for (i in r)r.hasOwnProperty(i) && -1 === t(r[i], n) && r[i].push(o ? n : {listener: n, once: !1});
  675. return this
  676. }, i.on = n("addListener"), i.addOnceListener = function (e, t) {
  677. return this.addListener(e, {listener: t, once: !0})
  678. }, i.once = n("addOnceListener"), i.defineEvent = function (e) {
  679. return this.getListeners(e), this
  680. }, i.defineEvents = function (e) {
  681. for (var t = 0; e.length > t; t += 1)this.defineEvent(e[t]);
  682. return this
  683. }, i.removeListener = function (e, n) {
  684. var i, r, o = this.getListenersAsObject(e);
  685. for (r in o)o.hasOwnProperty(r) && (i = t(o[r], n), -1 !== i && o[r].splice(i, 1));
  686. return this
  687. }, i.off = n("removeListener"), i.addListeners = function (e, t) {
  688. return this.manipulateListeners(!1, e, t)
  689. }, i.removeListeners = function (e, t) {
  690. return this.manipulateListeners(!0, e, t)
  691. }, i.manipulateListeners = function (e, t, n) {
  692. var i, r, o = e ? this.removeListener : this.addListener, s = e ? this.removeListeners : this.addListeners;
  693. if ("object" != typeof t || t instanceof RegExp)for (i = n.length; i--;)o.call(this, t, n[i]); else for (i in t)t.hasOwnProperty(i) && (r = t[i]) && ("function" == typeof r ? o.call(this, i, r) : s.call(this, i, r));
  694. return this
  695. }, i.removeEvent = function (e) {
  696. var t, n = typeof e, i = this._getEvents();
  697. if ("string" === n)delete i[e]; else if ("object" === n)for (t in i)i.hasOwnProperty(t) && e.test(t) && delete i[t]; else delete this._events;
  698. return this
  699. }, i.removeAllListeners = n("removeEvent"), i.emitEvent = function (e, t) {
  700. var n, i, r, o, s = this.getListenersAsObject(e);
  701. for (r in s)if (s.hasOwnProperty(r))for (i = s[r].length; i--;)n = s[r][i], n.once === !0 && this.removeListener(e, n.listener), o = n.listener.apply(this, t || []), o === this._getOnceReturnValue() && this.removeListener(e, n.listener);
  702. return this
  703. }, i.trigger = n("emitEvent"), i.emit = function (e) {
  704. var t = Array.prototype.slice.call(arguments, 1);
  705. return this.emitEvent(e, t)
  706. }, i.setOnceReturnValue = function (e) {
  707. return this._onceReturnValue = e, this
  708. }, i._getOnceReturnValue = function () {
  709. return this.hasOwnProperty("_onceReturnValue") ? this._onceReturnValue : !0
  710. }, i._getEvents = function () {
  711. return this._events || (this._events = {})
  712. }, e.noConflict = function () {
  713. return r.EventEmitter = o, e
  714. }, "function" == typeof define && define.amd ? define("eventEmitter/EventEmitter", [], function () {
  715. return e
  716. }) : "object" == typeof module && module.exports ? module.exports = e : this.EventEmitter = e
  717. }).call(this), function (e) {
  718. function t(t) {
  719. var n = e.event;
  720. return n.target = n.target || n.srcElement || t, n
  721. }
  722.  
  723. var n = document.documentElement, i = function () {
  724. };
  725. n.addEventListener ? i = function (e, t, n) {
  726. e.addEventListener(t, n, !1)
  727. } : n.attachEvent && (i = function (e, n, i) {
  728. e[n + i] = i.handleEvent ? function () {
  729. var n = t(e);
  730. i.handleEvent.call(i, n)
  731. } : function () {
  732. var n = t(e);
  733. i.call(e, n)
  734. }, e.attachEvent("on" + n, e[n + i])
  735. });
  736. var r = function () {
  737. };
  738. n.removeEventListener ? r = function (e, t, n) {
  739. e.removeEventListener(t, n, !1)
  740. } : n.detachEvent && (r = function (e, t, n) {
  741. e.detachEvent("on" + t, e[t + n]);
  742. try {
  743. delete e[t + n]
  744. } catch (i) {
  745. e[t + n] = void 0
  746. }
  747. });
  748. var o = {bind: i, unbind: r};
  749. "function" == typeof define && define.amd ? define("eventie/eventie", o) : e.eventie = o
  750. }(this), function (e, t) {
  751. "function" == typeof define && define.amd ? define(["eventEmitter/EventEmitter", "eventie/eventie"], function (n, i) {
  752. return t(e, n, i)
  753. }) : "object" == typeof exports ? module.exports = t(e, require("wolfy87-eventemitter"), require("eventie")) : e.imagesLoaded = t(e, e.EventEmitter, e.eventie)
  754. }(window, function (e, t, n) {
  755. function i(e, t) {
  756. for (var n in t)e[n] = t[n];
  757. return e
  758. }
  759.  
  760. function r(e) {
  761. return "[object Array]" === d.call(e)
  762. }
  763.  
  764. function o(e) {
  765. var t = [];
  766. if (r(e))t = e; else if ("number" == typeof e.length)for (var n = 0, i = e.length; i > n; n++)t.push(e[n]); else t.push(e);
  767. return t
  768. }
  769.  
  770. function s(e, t, n) {
  771. if (!(this instanceof s))return new s(e, t);
  772. "string" == typeof e && (e = document.querySelectorAll(e)), this.elements = o(e), this.options = i({}, this.options), "function" == typeof t ? n = t : i(this.options, t), n && this.on("always", n), this.getImages(), a && (this.jqDeferred = new a.Deferred);
  773. var r = this;
  774. setTimeout(function () {
  775. r.check()
  776. })
  777. }
  778.  
  779. function f(e) {
  780. this.img = e
  781. }
  782.  
  783. function c(e) {
  784. this.src = e, v[e] = this
  785. }
  786.  
  787. var a = e.jQuery, u = e.console, h = u !== void 0, d = Object.prototype.toString;
  788. s.prototype = new t, s.prototype.options = {}, s.prototype.getImages = function () {
  789. this.images = [];
  790. for (var e = 0, t = this.elements.length; t > e; e++) {
  791. var n = this.elements[e];
  792. "IMG" === n.nodeName && this.addImage(n);
  793. var i = n.nodeType;
  794. if (i && (1 === i || 9 === i || 11 === i))for (var r = n.querySelectorAll("img"), o = 0, s = r.length; s > o; o++) {
  795. var f = r[o];
  796. this.addImage(f)
  797. }
  798. }
  799. }, s.prototype.addImage = function (e) {
  800. var t = new f(e);
  801. this.images.push(t)
  802. }, s.prototype.check = function () {
  803. function e(e, r) {
  804. return t.options.debug && h && u.log("confirm", e, r), t.progress(e), n++, n === i && t.complete(), !0
  805. }
  806.  
  807. var t = this, n = 0, i = this.images.length;
  808. if (this.hasAnyBroken = !1, !i)return this.complete(), void 0;
  809. for (var r = 0; i > r; r++) {
  810. var o = this.images[r];
  811. o.on("confirm", e), o.check()
  812. }
  813. }, s.prototype.progress = function (e) {
  814. this.hasAnyBroken = this.hasAnyBroken || !e.isLoaded;
  815. var t = this;
  816. setTimeout(function () {
  817. t.emit("progress", t, e), t.jqDeferred && t.jqDeferred.notify && t.jqDeferred.notify(t, e)
  818. })
  819. }, s.prototype.complete = function () {
  820. var e = this.hasAnyBroken ? "fail" : "done";
  821. this.isComplete = !0;
  822. var t = this;
  823. setTimeout(function () {
  824. if (t.emit(e, t), t.emit("always", t), t.jqDeferred) {
  825. var n = t.hasAnyBroken ? "reject" : "resolve";
  826. t.jqDeferred[n](t)
  827. }
  828. })
  829. }, a && (a.fn.imagesLoaded = function (e, t) {
  830. var n = new s(this, e, t);
  831. return n.jqDeferred.promise(a(this))
  832. }), f.prototype = new t, f.prototype.check = function () {
  833. var e = v[this.img.src] || new c(this.img.src);
  834. if (e.isConfirmed)return this.confirm(e.isLoaded, "cached was confirmed"), void 0;
  835. if (this.img.complete && void 0 !== this.img.naturalWidth)return this.confirm(0 !== this.img.naturalWidth, "naturalWidth"), void 0;
  836. var t = this;
  837. e.on("confirm", function (e, n) {
  838. return t.confirm(e.isLoaded, n), !0
  839. }), e.check()
  840. }, f.prototype.confirm = function (e, t) {
  841. this.isLoaded = e, this.emit("confirm", this, t)
  842. };
  843. var v = {};
  844. return c.prototype = new t, c.prototype.check = function () {
  845. if (!this.isChecked) {
  846. var e = new Image;
  847. n.bind(e, "load", this), n.bind(e, "error", this), e.src = this.src, this.isChecked = !0
  848. }
  849. }, c.prototype.handleEvent = function (e) {
  850. var t = "on" + e.type;
  851. this[t] && this[t](e)
  852. }, c.prototype.onload = function (e) {
  853. this.confirm(!0, "onload"), this.unbindProxyEvents(e)
  854. }, c.prototype.onerror = function (e) {
  855. this.confirm(!1, "onerror"), this.unbindProxyEvents(e)
  856. }, c.prototype.confirm = function (e, t) {
  857. this.isConfirmed = !0, this.isLoaded = e, this.emit("confirm", this, t)
  858. }, c.prototype.unbindProxyEvents = function (e) {
  859. n.unbind(e.target, "load", this), n.unbind(e.target, "error", this)
  860. }, s
  861. });
  862.  
  863.  
  864. /* ======================= imgpreload Plugin =============================== */
  865. /**
  866. * jquery.imgpreload 1.6.2 <https://github.com/farinspace/jquery.imgpreload>
  867. * Copyright 2009-2014 Dimas Begunoff <http://farinspace.com>
  868. * License MIT <http://opensource.org/licenses/MIT>
  869. */
  870. "undefined" != typeof jQuery && !function (a) {
  871. "use strict";
  872. a.imgpreload = function (b, c) {
  873. c = a.extend({}, a.fn.imgpreload.defaults, c instanceof Function ? {all: c} : c), "string" == typeof b && (b = [b]);
  874. var d = [];
  875. a.each(b, function (e, f) {
  876. var g = new Image, h = f, i = g;
  877. "string" != typeof f && (h = a(f).attr("src") || a(f).css("background-image").replace(/^url\((?:"|')?(.*)(?:'|")?\)$/gm, "$1"), i = f), a(g).bind("load error", function (e) {
  878. d.push(i), a.data(i, "loaded", "error" == e.type ? !1 : !0), c.each instanceof Function && c.each.call(i, d.slice(0)), d.length >= b.length && c.all instanceof Function && c.all.call(d), a(this).unbind("load error")
  879. }), g.src = h
  880. })
  881. }, a.fn.imgpreload = function (b) {
  882. return a.imgpreload(this, b), this
  883. }, a.fn.imgpreload.defaults = {each: null, all: null}
  884. }(jQuery);
  885.  
  886.  
  887. /* jQuery.flexMenu 1.4
  888. https://github.com/352Media/flexMenu
  889. Description: If a list is too long for all items to fit on one line, display a popup menu instead.
  890. Dependencies: jQuery, Modernizr (optional). Without Modernizr, the menu can only be shown on click (not hover). */
  891.  
  892. (function (factory) {
  893. if (typeof define === 'function' && define.amd) {
  894. // AMD. Register as an anonymous module.
  895. define(['jquery'], factory);
  896. } else {
  897. // Browser globals
  898. factory(jQuery);
  899. }
  900. }(function ($) {
  901. var windowWidth = $(window).width(); // Store the window width
  902. var windowHeight = $(window).height(); // Store the window height
  903. var flexObjects = [], // Array of all flexMenu objects
  904. resizeTimeout;
  905. // When the page is resized, adjust the flexMenus.
  906. function adjustFlexMenu() {
  907.  
  908. if ($(window).width() !== windowWidth || $(window).height() !== windowHeight) {
  909. $(flexObjects).each(function () {
  910. $(this).flexMenu({
  911. 'undo': true
  912. }).flexMenu(this.options);
  913. });
  914. windowWidth = $(window).width(); // Store the window width if it changed
  915. windowHeight = $(window).height(); // Store the window height if it changed
  916. }
  917. }
  918.  
  919. function collapseAllExcept($menuToAvoid) {
  920. var $activeMenus,
  921. $menusToCollapse;
  922. $activeMenus = $('li.flexMenu-viewMore.active');
  923. $menusToCollapse = $activeMenus.not($menuToAvoid);
  924. $menusToCollapse.removeClass('active').find('> ul').hide();
  925. }
  926.  
  927. $(window).resize(function () {
  928. $('body').trigger('flexmenu-beforeResize');
  929. clearTimeout(resizeTimeout);
  930. resizeTimeout = setTimeout(function () {
  931. adjustFlexMenu();
  932. }, 200);
  933.  
  934. });
  935.  
  936. $('body').on('flexmenu-go', function () {
  937. $('body').trigger('flexmenu-beforeResize');
  938. clearTimeout(resizeTimeout);
  939. resizeTimeout = setTimeout(function () {
  940.  
  941. $(flexObjects).each(function () {
  942. $(this).flexMenu({
  943. 'undo': true
  944. }).flexMenu(this.options);
  945. });
  946.  
  947. }, 200);
  948.  
  949. });
  950.  
  951. $.fn.flexMenu = function (options) {
  952. var checkFlexObject,
  953. s = $.extend({
  954. 'threshold': 2, // [integer] If there are this many items or fewer in the list, we will not display a "View More" link and will instead let the list break to the next line. This is useful in cases where adding a "view more" link would actually cause more things to break to the next line.
  955. 'cutoff': 2, // [integer] If there is space for this many or fewer items outside our "more" popup, just move everything into the more menu. In that case, also use linkTextAll and linkTitleAll instead of linkText and linkTitle. To disable this feature, just set this value to 0.
  956. 'linkText': 'More', // [string] What text should we display on the "view more" link?
  957. 'linkTitle': 'View More', // [string] What should the title of the "view more" button be?
  958. 'linkTextAll': 'Menu', // [string] If we hit the cutoff, what text should we display on the "view more" link?
  959. 'linkTitleAll': 'Open/Close Menu', // [string] If we hit the cutoff, what should the title of the "view more" button be?
  960. 'showOnHover': true, // [boolean] Should we we show the menu on hover? If not, we'll require a click. If we're on a touch device - or if Modernizr is not available - we'll ignore this setting and only show the menu on click. The reason for this is that touch devices emulate hover events in unpredictable ways, causing some taps to do nothing.
  961. 'popupAbsolute': true, // [boolean] Should we absolutely position the popup? Usually this is a good idea. That way, the popup can appear over other content and spill outside a parent that has overflow: hidden set. If you want to do something different from this in CSS, just set this option to false.
  962. 'popupClass': '', // [string] If this is set, this class will be added to the popup
  963. 'undo': false // [boolean] Move the list items back to where they were before, and remove the "View More" link.
  964. }, options);
  965. this.options = s; // Set options on object
  966. checkFlexObject = $.inArray(this, flexObjects); // Checks if this object is already in the flexObjects array
  967. if (checkFlexObject >= 0) {
  968. flexObjects.splice(checkFlexObject, 1); // Remove this object if found
  969. } else {
  970. flexObjects.push(this); // Add this object to the flexObjects array
  971. }
  972. return this.each(function () {
  973. var $this = $(this),
  974. exceptItems = '.kleo-toggle-menu.shop-drop, .kleo-search-nav, #nav-menu-item-side',
  975. $items = $this.find('> li'),
  976. $firstItem = $items.first(),
  977. $lastItem = $items.not(exceptItems).last(),
  978. numItems = $this.find('li').length,
  979. firstItemTop = Math.floor($firstItem.offset().top),
  980. firstItemHeight = Math.floor($firstItem.outerHeight(true)),
  981. $lastChild,
  982. keepLooking,
  983. $moreItem,
  984. $moreLink,
  985. numToRemove,
  986. allInPopup = false,
  987. $menu,
  988. i;
  989.  
  990. function needsMenu($itemOfInterest) {
  991.  
  992. var excluded = $(exceptItems);
  993. var excludedReturn = false;
  994.  
  995. firstItemTop = Math.floor($firstItem.offset().top);
  996. firstItemHeight = Math.floor($firstItem.outerHeight(true));
  997.  
  998. excluded.each(function () {
  999. if (Math.ceil($(this).offset().top) >= ( firstItemTop + firstItemHeight )) {
  1000. excludedReturn = true;
  1001. }
  1002. });
  1003. if (excludedReturn) {
  1004. return true;
  1005. }
  1006. //var excludedResult = (Math.ceil(excluded.offset().top) >= (firstItemTop + firstItemHeight)) ? true : false;
  1007.  
  1008. //if (excludedResult == true) {
  1009. // return true;
  1010. //}
  1011.  
  1012. // Values may be calculated from em and give us something other than round numbers. Browsers may round these inconsistently. So, let's round numbers to make it easier to trigger flexMenu.
  1013. return (Math.ceil($itemOfInterest.offset().top) >= (firstItemTop + firstItemHeight));
  1014. }
  1015.  
  1016. if ($lastItem.length && needsMenu($lastItem) && numItems > s.threshold && !s.undo && $this.is(':visible') && !KLEO.isMobile.tabletLandscapeWidth()) {
  1017.  
  1018. var $popup = $('<ul class="flexMenu-popup" style="display:none;' + ((s.popupAbsolute) ? ' position: absolute;' : '') + '"></ul>');
  1019. // Add class if popupClass option is set
  1020. $popup.addClass(s.popupClass);
  1021. // Move all list items after the first to this new popup ul
  1022. for (i = numItems; i > 1; i--) {
  1023.  
  1024.  
  1025. // Find all of the list items that have been pushed below the first item. Put those items into the popup menu. Put one additional item into the popup menu to cover situations where the last item is shorter than the "more" text.
  1026. $lastChild = $this.find('> li').not(exceptItems).last();
  1027. keepLooking = (needsMenu($lastChild));
  1028. $lastChild.appendTo($popup);
  1029. // If there only a few items left in the navigation bar, move them all to the popup menu.
  1030. if ((i - 1) <= s.cutoff) { // We've removed the ith item, so i - 1 gives us the number of items remaining.
  1031. $($this.find("> li").not(exceptItems).get().reverse()).appendTo($popup);
  1032. allInPopup = true;
  1033. break;
  1034. }
  1035. if (!keepLooking) {
  1036. break;
  1037. }
  1038.  
  1039. }
  1040. if (allInPopup) {
  1041. $this.append('<li class="flexMenu-viewMore flexMenu-allInPopup"><a href="#" title="' + s.linkTitleAll + '">' + s.linkTextAll + '</a></li>');
  1042. } else {
  1043. $this.append('<li class="flexMenu-viewMore"><a class="js-activated" href="#" title="' + s.linkTitle + '">' + s.linkText + '</a></li>');
  1044. $('body').trigger('flexmenu-added');
  1045. }
  1046. $moreItem = $this.find('> li.flexMenu-viewMore');
  1047. /// Check to see whether the more link has been pushed down. This might happen if the link immediately before it is especially wide.
  1048.  
  1049. if (needsMenu($moreItem)) {
  1050. $this.find('> li').not(exceptItems).filter(':nth-last-child(2)').appendTo($popup);
  1051. }
  1052. // Our popup menu is currently in reverse order. Let's fix that.
  1053. $popup.children().each(function (i, li) {
  1054. $popup.prepend(li);
  1055. });
  1056. $moreItem.append($popup);
  1057. /*$moreLink = $this.find('> li.flexMenu-viewMore > a');
  1058. $moreLink.click(function (e) {
  1059. // Collapsing any other open flexMenu
  1060. collapseAllExcept($moreItem);
  1061. //Open and Set active the one being interacted with.
  1062. $popup.toggle();
  1063. $moreItem.toggleClass('active');
  1064. e.preventDefault();
  1065. });*/
  1066. if (s.showOnHover && (typeof Modernizr !== 'undefined') && !Modernizr.touch) { // If requireClick is false AND touch is unsupported, then show the menu on hover. If Modernizr is not available, assume that touch is unsupported. Through the magic of lazy evaluation, we can check for Modernizr and start using it in the same if statement. Reversing the order of these variables would produce an error.
  1067. $moreItem.hover(
  1068. function () {
  1069. $popup.show();
  1070. $(this).addClass('active');
  1071. },
  1072. function () {
  1073. $popup.hide();
  1074. $(this).removeClass('active');
  1075. });
  1076. }
  1077. } else if (s.undo && $this.find('ul.flexMenu-popup')) {
  1078. $menu = $this.find('ul.flexMenu-popup');
  1079. numToRemove = $menu.find('li').length;
  1080. for (i = 1; i <= numToRemove; i++) {
  1081. //$menu.find('> li:first-child').appendTo($this);
  1082. $menu.find('> li:first-child').insertAfter($this.find('> li').not(exceptItems + ', .flexMenu-viewMore').last());
  1083. }
  1084. $menu.remove();
  1085. $this.find('> li.flexMenu-viewMore').remove();
  1086. }
  1087. $('body').trigger('flexmenu-finished');
  1088.  
  1089. });
  1090.  
  1091.  
  1092. };
  1093. }));
  1094.  
  1095. /*--------------------------------------------------
  1096.  
  1097. SHORTCODES
  1098.  
  1099. Animations
  1100. Shortcodes
  1101. ---------------------------------------------------*/
  1102.  
  1103.  
  1104. function activate_waypoints(container) {
  1105. //activates simple css animations of the content once the user scrolls to an elements
  1106. if (jQuery.fn.kleo_waypoints) {
  1107. if (typeof container == 'undefined') {
  1108. container = 'body';
  1109. }
  1110.  
  1111. jQuery('.animate-when-visible', container).kleo_waypoints();
  1112. jQuery('.animate-when-almost-visible', container).kleo_waypoints({offset: '90%'});
  1113. }
  1114. }
  1115.  
  1116.  
  1117. function activate_shortcode_scripts(container) {
  1118. if (typeof container == 'undefined') {
  1119. container = 'body';
  1120. }
  1121.  
  1122. //activates behavior and animation for gallery
  1123. if (jQuery.fn.kleo_sc_gallery) {
  1124. jQuery('.kleo-gallery', container).kleo_sc_gallery();
  1125. }
  1126.  
  1127. //activates behavior and animation for one by one general
  1128. if (jQuery.fn.kleo_general_onebyone) {
  1129. jQuery('.one-by-one-general', container).kleo_general_onebyone();
  1130. }
  1131.  
  1132. if (jQuery.fn.kleo_animate_number) {
  1133. jQuery('.kleo-animate-number', container).kleo_animate_number();
  1134. }
  1135.  
  1136. //activates animation for elements
  1137. if (jQuery.fn.one_by_one_animated) {
  1138. jQuery('.one-by-one-animated', container).one_by_one_animated();
  1139. }
  1140.  
  1141. //activates animation for progress bar
  1142. if (jQuery.fn.kleo_sc_progressbar) {
  1143. jQuery('.progress-bar-container', container).kleo_sc_progressbar();
  1144. }
  1145.  
  1146. //activates animation for testimonial
  1147. if (jQuery.fn.kleo_sc_testimonial) {
  1148. jQuery('.kleo-testimonial-wrapper', container).kleo_sc_testimonial();
  1149. }
  1150.  
  1151. }
  1152.  
  1153.  
  1154. (function ($) {
  1155.  
  1156. "use strict";
  1157.  
  1158. // -------------------------------------------------------------------------------------------
  1159. // testimonial shortcode javascript
  1160. // -------------------------------------------------------------------------------------------
  1161.  
  1162. $.fn.kleo_sc_testimonial = function (options) {
  1163. return this.each(function () {
  1164. var container = $(this), elements = container.find('.kleo-testimonial');
  1165.  
  1166.  
  1167. //trigger displaying of thumbnails
  1168. container.on('kleo-start-animation', function () {
  1169. elements.each(function (i) {
  1170. var element = $(this);
  1171. setTimeout(function () {
  1172. element.addClass('kleo-start-animation')
  1173. }, (i * 150));
  1174. });
  1175. });
  1176. });
  1177. }
  1178.  
  1179.  
  1180. // -------------------------------------------------------------------------------------------
  1181. // Progress bar shortcode javascript
  1182. // -------------------------------------------------------------------------------------------
  1183.  
  1184. $.fn.kleo_sc_progressbar = function (options) {
  1185. return this.each(function () {
  1186. var container = $(this), elements = container.find('.progress');
  1187.  
  1188.  
  1189. //trigger displaying of thumbnails
  1190. container.on('start-animation', function () {
  1191. elements.each(function (i) {
  1192. var element = $(this);
  1193. setTimeout(function () {
  1194. $('.bar strong').css('opacity', 1);
  1195. //$('.bar strong').css('left', -30 + 'px');
  1196. element.addClass('start-animation')
  1197. }, (i * 250));
  1198. });
  1199. });
  1200. });
  1201. }
  1202.  
  1203.  
  1204. // -------------------------------------------------------------------------------------------
  1205. // Iconlist shortcode javascript
  1206. // -------------------------------------------------------------------------------------------
  1207.  
  1208. $.fn.one_by_one_animated = function (options) {
  1209. return this.each(function () {
  1210. var listicons = $(this), elements = listicons.find('.list-el-animated');
  1211.  
  1212. listicons.on('start-animation', function () {
  1213. elements.each(function (i) {
  1214. var element = $(this);
  1215. setTimeout(function () {
  1216. element.addClass('start-animation')
  1217. }, (i * 350));
  1218. });
  1219. });
  1220. });
  1221. }
  1222.  
  1223.  
  1224. // -------------------------------------------------------------------------------------------
  1225. // Big Number animation shortcode javascript
  1226. // -------------------------------------------------------------------------------------------
  1227.  
  1228. //http://codetheory.in/controlling-the-frame-rate-with-requestanimationframe/ (improve it with framerate in the future?)
  1229.  
  1230. $.fn.kleo_animate_number = function (options) {
  1231. var start_count = function (element, countTo, increment, current) {
  1232.  
  1233. //calculate the new number
  1234. var newCount = current + increment;
  1235.  
  1236. //if the number is bigger than our final number set the number and finish
  1237. if (newCount >= countTo) {
  1238. element.text(countTo);
  1239. //exit
  1240. }
  1241. else {
  1242. var prepend = "", addZeros = countTo.toString().length - newCount.toString().length
  1243.  
  1244. //if the number has less digits than the final number some zeros where omitted. add them to the front
  1245. for (var i = addZeros; i > 0; i--) {
  1246. prepend += "0";
  1247. }
  1248.  
  1249. element.text(prepend + newCount);
  1250. window.kleoAnimFrame(function () {
  1251. start_count(element, countTo, increment, newCount)
  1252. });
  1253. }
  1254. };
  1255.  
  1256. $(this).each(function (i) {
  1257. //prepare elements
  1258. var element = $(this), text = element.text();
  1259. element.text(text.replace(/./g, "0"));
  1260.  
  1261. var countTimer = element.data('timer') || 3000;
  1262.  
  1263. //trigger number animation
  1264. element.addClass('number_prepared').on('start-animation', function () {
  1265. var element = $(this), countTo = element.data('number'), current = parseInt(element.text(), 10), increment = Math.round(countTo * 30 / countTimer);
  1266. if (increment == 0 || increment % 10 == 0) increment += 1;
  1267.  
  1268. setTimeout(function () {
  1269. start_count(element, countTo, increment, current);
  1270. }, 300);
  1271. });
  1272.  
  1273. });
  1274.  
  1275. };
  1276.  
  1277. window.kleoAnimFrame = (function () {
  1278. return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) {
  1279. window.setTimeout(callback, 1000 / 60);
  1280. };
  1281. })();
  1282.  
  1283.  
  1284. // -------------------------------------------------------------------------------------------
  1285. // Gallery shortcode javascript
  1286. // -------------------------------------------------------------------------------------------
  1287.  
  1288. $.fn.kleo_sc_gallery = function (options) {
  1289. return this.each(function () {
  1290. var gallery = $(this), images = gallery.find('img'), big_prev = gallery.find('.kleo-gallery-big');
  1291.  
  1292.  
  1293. //trigger displaying of thumbnails
  1294. gallery.on('start-animation', function () {
  1295. images.each(function (i) {
  1296. var image = $(this);
  1297. setTimeout(function () {
  1298. image.addClass('start-animation')
  1299. }, (i * 150));
  1300. //alert('test');
  1301. });
  1302. });
  1303.  
  1304.  
  1305. });
  1306. };
  1307.  
  1308.  
  1309. // -------------------------------------------------------------------------------------------
  1310. // One by one general shortcode javascript
  1311. // -------------------------------------------------------------------------------------------
  1312.  
  1313. $.fn.kleo_general_onebyone = function (options) {
  1314. return this.each(function () {
  1315. var container = $(this), items = container.children();
  1316.  
  1317. //trigger displaying of items
  1318. container.on('start-animation', function () {
  1319. items.each(function (i) {
  1320. var item = $(this);
  1321. setTimeout(function () {
  1322. item.addClass('start-animation')
  1323. }, (i * 150));
  1324. });
  1325. });
  1326. });
  1327. };
  1328.  
  1329.  
  1330. // -------------------------------------------------------------------------------------------
  1331. // HELPER FUNCTIONS
  1332. // -------------------------------------------------------------------------------------------
  1333.  
  1334.  
  1335. //waipoint script when something comes into viewport
  1336. $.fn.kleo_waypoints = function (options_passed) {
  1337. if (!$('html').is('.kleo-transform')) return;
  1338.  
  1339. var defaults = {offset: 'bottom-in-view', triggerOnce: true},
  1340. options = $.extend({}, defaults, options_passed);
  1341.  
  1342. return this.each(function () {
  1343. var element = $(this);
  1344.  
  1345. setTimeout(function () {
  1346. element.waypoint(function (direction) {
  1347. $(this).addClass('start-animation').trigger('start-animation');
  1348.  
  1349. }, options);
  1350.  
  1351. }, 100)
  1352. });
  1353. };
  1354.  
  1355. })(jQuery);
  1356.  
  1357.  
  1358. /*--------------------------------------------------
  1359.  
  1360. THEME LOGIC
  1361.  
  1362. Page scripts
  1363. Header scripts
  1364. Isotope scripts
  1365. ---------------------------------------------------*/
  1366.  
  1367. var KLEO = KLEO || {};
  1368.  
  1369. (function ($) {
  1370.  
  1371. "use strict";
  1372.  
  1373. /***************************************************
  1374. Site functions
  1375. ***************************************************/
  1376. var kleoPage = {
  1377.  
  1378. init: function () {
  1379.  
  1380. //remove overflow hidden
  1381. kleoPage.removeOverflowHidden();
  1382.  
  1383. //image sliders
  1384. if ($.fn.carouFredSel) {
  1385. kleoPage.carouselItems();
  1386. kleoPage.bannerSlider();
  1387. kleoPage.rtMediaslider();
  1388. kleoPage.newsTicker();
  1389. $(document).on('click', '.news-focus .nav-tabs a', function () {
  1390. kleoPage.bannerSlider();
  1391. });
  1392. }
  1393.  
  1394. //activate magnificPopup
  1395. if ($.fn.magnificPopup) {
  1396. kleoPage.magnificPopupModals();
  1397. if (!kleoFramework.hasOwnProperty('DisableMagnificGallery') || kleoFramework.DisableMagnificGallery === '0') {
  1398. kleoPage.magnificPopupGallery();
  1399.  
  1400. /* Make it work with VC GRID */
  1401. $(window).on('grid:items:added', function() {
  1402. kleoPage.magnificPopupGallery();
  1403. });
  1404. }
  1405. }
  1406.  
  1407. //activate html5 video/audio player
  1408. if ($.fn.kleo_enable_media && $.fn.mediaelementplayer) {
  1409. $(".kleo-video, .kleo-audio, .video-wrap video", "body").kleo_enable_media();
  1410. }
  1411.  
  1412. //initialize Pins
  1413. kleoPage.initPins();
  1414.  
  1415. if (kleoFramework.goTop == 1) {
  1416. kleoPage.goTop();
  1417. }
  1418.  
  1419. kleoPage.likes();
  1420. kleoPage.progressBar();
  1421. kleoPage.kleoAjaxLogin();
  1422. kleoPage.kleoAjaxLostPass();
  1423.  
  1424. //Fit videos
  1425. $(".post-content, .activity-inner, .article-media, .kleo-video-embed, .wpb_video_widget").fitVids();
  1426.  
  1427. // Sidebar menu toggle
  1428. //if (!isMobile || kleoIsotope.viewport().width > 992) {
  1429. kleoPage.kleoMenuWidget();
  1430. //}
  1431.  
  1432. //Accordion/toggle icons
  1433. $('.panel-collapse').on('show.bs.collapse', function () {
  1434. $(".panel-heading a[href='#" + $(this).attr('id') + "'] span.icon-opened").removeClass("hide");
  1435. $(".panel-heading a[href='#" + $(this).attr('id') + "'] span.icon-closed").addClass("hide");
  1436. });
  1437. $('.panel-collapse').on('hide.bs.collapse', function () {
  1438. $(".panel-heading a[href='#" + $(this).attr('id') + "'] span.icon-opened").addClass("hide");
  1439. $(".panel-heading a[href='#" + $(this).attr('id') + "'] span.icon-closed").removeClass("hide");
  1440. });
  1441.  
  1442. //Tabs and accordions triggers
  1443. $('a[data-toggle="tab"]').on('shown.bs.tab', function () {
  1444. var contentEl = $(this).attr("href");
  1445. kleoPage.refreshContentTabs(contentEl);
  1446. });
  1447. $('.panel-collapse').on('shown.bs.collapse', function () {
  1448. kleoPage.refreshContentTabs(this);
  1449. });
  1450.  
  1451. /* for VC tabs */
  1452. $(document).on('show.vc.tab', function () {
  1453. kleoPage.refreshContentTabs(this);
  1454. });
  1455.  
  1456. /* Open tab or accordion by hash url */
  1457. kleoPage.openTabHash();
  1458.  
  1459. //tours
  1460. if ($('.wpb_tour').length) {
  1461. $('.tour_next_slide').click(function () {
  1462. var tabs = $(this).closest('.wpb_tour').find('li');
  1463. var active = tabs.filter('.active');
  1464. var next = active.next('li').length ? active.next('li').find('a') : tabs.filter(':first-child').find('a');
  1465. next.tab('show');
  1466. return false;
  1467. });
  1468. $('.tour_prev_slide').click(function () {
  1469. var tabs = $(this).closest('.wpb_tour').find('li');
  1470. var active = tabs.filter('.active');
  1471. var prev = active.prev('li').length ? active.prev('li').find('a') : tabs.filter(':last-child').find('a');
  1472. prev.tab('show');
  1473. return false;
  1474. });
  1475.  
  1476. $('.wpb_tour').each(function () {
  1477. var $this = $(this);
  1478. var tourChange = function () {
  1479. var tabs = $this.find('li');
  1480. var active = tabs.filter('.active');
  1481. var next = active.next('li').length ? active.next('li').find('a') : tabs.filter(':first-child').find('a');
  1482. next.tab('show');
  1483. };
  1484. if ($this.data("interval") != 0) {
  1485. var interval = $this.data("interval");
  1486. var tabCycle = setInterval(tourChange, interval * 1000)
  1487.  
  1488. $(this).find('li').hover(function () {
  1489. clearInterval(tabCycle);
  1490. });
  1491. }
  1492. });
  1493. }
  1494.  
  1495.  
  1496. // Popover profile
  1497. $('.click-pop').popover({
  1498. trigger: "click"
  1499. }).on('click', function (e) {
  1500. e.preventDefault;
  1501. return false;
  1502. });
  1503.  
  1504. $('.hover-pop').popover({
  1505. trigger: "hover focus",
  1506. html: true
  1507. });
  1508.  
  1509. // Tooltip
  1510. $('.hover-tip').tooltip({
  1511. trigger: "hover",
  1512. container: "body"
  1513. });
  1514. $('.click-tip').tooltip({
  1515. trigger: "click",
  1516. container: "body"
  1517. });
  1518.  
  1519. /* submit form using an anchor element */
  1520. $("a.form-submit").on("click", function () {
  1521. $(this).closest("form").submit();
  1522. return false;
  1523. });
  1524.  
  1525. /* Feature items open link */
  1526. $(document).on('click', '.kleo-open-href', function (e) {
  1527. if ($(this).attr('data-href') != '') {
  1528. window.location.href = $(this).attr('data-href');
  1529. }
  1530. });
  1531.  
  1532. /* Portfolio */
  1533. if (($(".porto-video").length || $(".porto-hosted_video").length)) {
  1534. $(".portfolio-items").imagesLoaded(function () {
  1535. kleoPage.portfolioVideo();
  1536. });
  1537. $window.on("debouncedresize", kleoPage.portfolioVideo);
  1538. }
  1539. /* remove embed video titles */
  1540. if ($(".porto-video").length) {
  1541. $('iframe').each(function () {
  1542. var video = $(this);
  1543. var vidSrc = "";
  1544. vidSrc = video.attr('src');
  1545. if (vidSrc.indexOf("//www.youtube.com/embed/") > -1) {
  1546. video.attr('src', vidSrc + '&autohide=1');
  1547. }
  1548. if (vidSrc.indexOf("//player.vimeo.com/") > -1) {
  1549. if (vidSrc.indexOf("?") > -1) {
  1550. video.attr('src', vidSrc + '&title=0&byline=0&portrait=0');
  1551. } else {
  1552. video.attr('src', vidSrc + '?title=0&byline=0&portrait=0');
  1553. }
  1554.  
  1555. }
  1556.  
  1557. });
  1558. }
  1559.  
  1560. var ajaxPortfolioWrap = $('.ajax-filter-wrap');
  1561. if ( ajaxPortfolioWrap.length ) {
  1562. ajaxPortfolioWrap.find('a').on('click', function() {
  1563. var wrap = $(this).closest('.ajax-filter-wrap');
  1564.  
  1565. if ($(this).parent('li').hasClass('all') && kleoPage.portfolioInitialContent != '') {
  1566. wrap.siblings('.portfolio-wrapper').html(kleoPage.portfolioInitialContent);
  1567. $(this).closest('ul').find('li').removeClass('selected');
  1568. $(this).parent('li').addClass('selected');
  1569. }
  1570. if ( $(this).attr('data-id')) {
  1571.  
  1572. var data = {
  1573. catId : $(this).data('id'),
  1574. pItem: wrap.find('input[name=pitem]').val(),
  1575. postId: wrap.find('input[name=post_id]').val(),
  1576. security: wrap.find('#portfolio-security').val(),
  1577. filterEl: this,
  1578. itemsWrap: wrap.siblings('.portfolio-wrapper'),
  1579. url: ''
  1580. };
  1581.  
  1582. kleoPage.ajaxPortfolio(data);
  1583.  
  1584. }
  1585. return false;
  1586. });
  1587. }
  1588.  
  1589. $('body').on('click', '.portfolio-wrapper .pagination-wrap a', function() {
  1590. var wrap = $(this).closest('.portfolio-wrapper');
  1591. var data = {};
  1592. if ( wrap.siblings('.ajax-filter-wrap').find('li.selected a').attr('data-id')) {
  1593. data.catId = wrap.siblings('.ajax-filter-wrap').find('li.selected a').data('id');
  1594. }
  1595.  
  1596. data.pItem = wrap.siblings('.ajax-filter-wrap').find('input[name=pitem]').val();
  1597. data.postId = wrap.siblings('.ajax-filter-wrap').find('input[name=post_id]').val();
  1598. data.security = wrap.siblings('.ajax-filter-wrap').find('#portfolio-security').val();
  1599. data.filterEl = this;
  1600. data.itemsWrap = wrap;
  1601. data.url = $(this).attr('href');
  1602.  
  1603.  
  1604. kleoPage.ajaxPortfolio(data);
  1605. return false;
  1606. });
  1607.  
  1608. $('a.kleo-login-switch').on('click', function () {
  1609. var thisParent = $(this).parent().parent().parent();
  1610. thisParent.find('.lostpass-form-inline').slideUp(100, function () {
  1611. thisParent.find('.login-form-inline').slideDown(400);
  1612. });
  1613. return false;
  1614. });
  1615.  
  1616. $('a.kleo-lostpass-switch').on('click', function () {
  1617. var thisParent = $(this).parent().parent().parent();
  1618. thisParent.find('.login-form-inline').slideUp(100, function () {
  1619. thisParent.find('.lostpass-form-inline').slideDown(400)
  1620. });
  1621. return false;
  1622. });
  1623.  
  1624. /* Equal column heights fallback */
  1625. kleoPage.flexFallback();
  1626.  
  1627. /* Bottom footer forcer */
  1628. if (body.hasClass('footer-bottom')) {
  1629. var htmlHeight,
  1630. adminBar = $('#wpadminbar');
  1631. if ( adminBar.length ) {
  1632. htmlHeight = 'calc( 100% - ' + adminBar.outerHeight() + 'px )'
  1633. } else {
  1634. htmlHeight = '100%';
  1635. }
  1636. $('html').css({height: htmlHeight})
  1637. }
  1638.  
  1639. /* Blog switch layout */
  1640. kleoPage.switchBlogLayout();
  1641. },
  1642.  
  1643. portfolioInitialContent : '',
  1644. ajaxPortfolio: function(data) {
  1645.  
  1646. $.ajax({
  1647. type: "POST",
  1648. url: kleoFramework.ajaxurl,
  1649. data: {
  1650. action: 'portfolio_items',
  1651. pid: data.catId,
  1652. pitem: data.pItem,
  1653. post_id: data.postId,
  1654. security: data.security,
  1655. url: data.url
  1656. },
  1657. success: function (response) {
  1658. if ( response.hasOwnProperty('data') && response.data.hasOwnProperty('message') ) {
  1659.  
  1660. if (data.hasOwnProperty('filterEl')) {
  1661. $(data.filterEl).closest('ul').find('li').removeClass('selected');
  1662. $(data.filterEl).parent('li').addClass('selected');
  1663. }
  1664.  
  1665. if ( kleoPage.portfolioInitialContent == '' ) {
  1666. kleoPage.portfolioInitialContent = data.itemsWrap.html();
  1667. }
  1668.  
  1669. data.itemsWrap.replaceWith(response.data.message);
  1670. kleoPage.bannerSlider();
  1671. $('.animate-when-almost-visible').kleo_waypoints({offset: '90%'});
  1672. $(".kleo-video-embed").fitVids();
  1673. kleoIsotope.applyGridIsotpe(".kleo-masonry");
  1674. }
  1675.  
  1676. },
  1677. error: function (errorThrown) {
  1678. console.log(errorThrown);
  1679. }
  1680. });
  1681.  
  1682. },
  1683. refreshContentTabs: function (el) {
  1684.  
  1685. //compatibility with multiple modules
  1686. $(window).trigger('resize');
  1687.  
  1688. //carousels
  1689. //$('.kleo-carousel, .kleo-banner-items').trigger('updateSizes');
  1690. //masonry
  1691. //kleoIsotope.init();
  1692.  
  1693. //google maps
  1694. /* var $google_maps = $(el).find(".wpb_gmaps_widget");
  1695. if ($google_maps.length && !$google_maps.is('.map_ready')) {
  1696. var $google_maps_frame = $google_maps.find('iframe');
  1697. $google_maps_frame.attr('src', $google_maps_frame.attr('src'));
  1698. $google_maps.addClass('map_ready');
  1699. }*/
  1700.  
  1701. //pie & line & round charts
  1702. var panel = $('.kleo-tabs, .panel-body');
  1703. var $pie_charts = panel.find(".vc_pie_chart:not(.vc_ready)"),
  1704. $round_charts = panel.find(".vc_round-chart"),
  1705. $line_charts = panel.find(".vc_line-chart");
  1706.  
  1707. if ($pie_charts.length && jQuery.fn.vcChat) {
  1708. $pie_charts.vcChat();
  1709. }
  1710. if ($round_charts.length && jQuery.fn.vcRoundChart) {
  1711. $round_charts.vcRoundChart({reload: !1});
  1712. }
  1713. if ($line_charts.length && jQuery.fn.vcLineChart) {
  1714. $line_charts.vcLineChart({reload: !1});
  1715. }
  1716.  
  1717.  
  1718. },
  1719. openTabHash: function () {
  1720. /* Open the tab or accordion */
  1721. var hash = location.hash,
  1722. hashPieces = hash.split('?'),
  1723. prefix = "link_";
  1724.  
  1725. if (hash && hash != '') {
  1726. var activeTab = $('.nav-tabs a[href="' + hashPieces[0].replace(prefix, "") + '"]');
  1727. var activeTour = $('.nav-tab a[href="' + hashPieces[0].replace(prefix, "") + '"]');
  1728. var activeToggle = $('.panel-group a[href="' + hashPieces[0].replace(prefix, "") + '"]');
  1729.  
  1730. if (activeTab.length) {
  1731. activeTab.tab('show');
  1732. }
  1733. if (activeTour.length) {
  1734. activeTour.tab('show');
  1735. }
  1736. if (activeToggle.length) {
  1737. if (!activeToggle.hasClass("collapsed")) {
  1738. activeToggle.trigger('click');
  1739. }
  1740. }
  1741. }
  1742.  
  1743. /* Change the hash on tab/accordion open */
  1744.  
  1745. var tabs = $('.nav-tabs a, .nav-tab a'),
  1746. panels = $('.panel-group .panel-collapse');
  1747.  
  1748. // for tabs
  1749. tabs.on('shown.bs.tab', function (e) {
  1750. window.location.hash = e.target.hash.replace("#", "#" + prefix);
  1751. });
  1752. tabs.on('hidden.bs.tab', function (e) {
  1753. history.pushState("", document.title, window.location.pathname + window.location.search);
  1754. });
  1755. // for accordion
  1756. panels.on('shown.bs.collapse', function (e) {
  1757. if ($(this).attr('id')) {
  1758. window.location.hash = "#" + prefix + $(this).attr('id');
  1759. }
  1760. });
  1761. panels.on('hidden.bs.collapse', function (e) {
  1762. history.pushState("", document.title, window.location.pathname + window.location.search);
  1763. });
  1764. },
  1765.  
  1766. portfolioVideo: function () {
  1767. var elements = $(".porto-video .kleo-video-embed");
  1768. elements.height(function () {
  1769. var elHeight = 160;
  1770. //console.log(kleoFramework.portfolioVideoHeight);
  1771. if (kleoFramework.hasOwnProperty('portfolioVideoHeight') && kleoFramework.portfolioVideoHeight != 0) {
  1772. elHeight = kleoFramework.portfolioVideoHeight;
  1773. }
  1774. var image = $(this).closest(".portfolio-items").find('.portfolio-image img, .kleo-banner-slider img').eq(0);
  1775. return image.length && image.height() > 50 ? image.height() : elHeight;
  1776. });
  1777. },
  1778.  
  1779. notReadyInit: function () {
  1780. //Preload logo
  1781. kleoHeader.loadLogoImg();
  1782.  
  1783. $('.responsive-tabs, .nav-pills, .top-menu > ul, #top-social > ul').tabdrop();
  1784.  
  1785. },
  1786.  
  1787. // Sidebar menu toggle
  1788. kleoMenuWidget: function () {
  1789. var submenuParent = jQuery(".widget_nav_menu ul.sub-menu").parent('li');
  1790. submenuParent.addClass('parent');
  1791. submenuParent.children("a").append('<span class="caret"></span>');
  1792. submenuParent.find(".caret").click(function () {
  1793. jQuery(this).closest(".parent").children('.sub-menu').stop(true, true).slideToggle('fast');
  1794. jQuery(this).toggleClass('active');
  1795. return false;
  1796. });
  1797. },
  1798.  
  1799. adjustHeights: function (elem) {
  1800. var fontstep = 2;
  1801. if ($(elem).height() > $(elem).parent().height() || $(elem).width() > $(elem).parent().width()) {
  1802. $(elem).css('font-size', (($(elem).css('font-size').substr(0, 2) - fontstep)) + 'px').css('line-height', (($(elem).css('font-size').substr(0, 2))) + 'px');
  1803. adjustHeights(elem);
  1804. }
  1805. },
  1806.  
  1807. removeOverflowHidden: function () {
  1808.  
  1809. $('body').on('click', function () {
  1810. if ($('#buddypress .tabdrop').hasClass('open')) {
  1811. $('#buddypress div#item-nav').css('overflow', 'hidden');
  1812. }
  1813. });
  1814.  
  1815. $('.item-list-tabs .dropdown-toggle').on('click', function () {
  1816. if ($('#buddypress .tabdrop').hasClass('open')) {
  1817. $('#buddypress div#item-nav').css('overflow', 'hidden');
  1818. }
  1819. else {
  1820. $('#buddypress div#item-nav').css('overflow', 'visible');
  1821. }
  1822. });
  1823.  
  1824. },
  1825.  
  1826. bannerSlider: function () {
  1827.  
  1828. $('.kleo-banner-slider').animate({"opacity": "1"}, 700);
  1829.  
  1830. $('.kleo-banner-slider').each(function () {
  1831. var thisSliderItems = $(this).find('.kleo-banner-items');
  1832. var $prev = $(this).find(".kleo-banner-prev");
  1833. var $next = $(this).find(".kleo-banner-next");
  1834. var $duration = 2000;
  1835.  
  1836. if (thisSliderItems.data("speed")) {
  1837. $duration = parseInt(thisSliderItems.data("speed"));
  1838. }
  1839.  
  1840. thisSliderItems.imagesLoaded(function () {
  1841. thisSliderItems.carouFredSel({
  1842. //auto: false,
  1843. responsive: true,
  1844. circular: false,
  1845. infinite: true,
  1846. auto: {
  1847. play: true,
  1848. pauseDuration: 0,
  1849. duration: $duration
  1850. },
  1851. scroll: {
  1852. items: 1,
  1853. duration: 600,
  1854. //fx: "crossfade",
  1855. easing: "easeInOutExpo",
  1856. wipe: true
  1857. },
  1858. //padding: 0,
  1859. prev: $prev,
  1860. next: $next,
  1861. items: {
  1862. height: 'variable',
  1863. visible: 1
  1864. }
  1865. });
  1866. thisSliderItems.swipe({
  1867. excludedElements: "",
  1868. threshold: 40,
  1869. swipeLeft: function () {
  1870. thisSliderItems.trigger('next', 1);
  1871. setTimeout(function () {
  1872. thisSliderItems.trigger('updateSizes');
  1873. }, 600);
  1874. },
  1875. swipeRight: function () {
  1876. thisSliderItems.trigger('prev', 1);
  1877. setTimeout(function () {
  1878. thisSliderItems.trigger('updateSizes');
  1879. }, 600);
  1880. }
  1881. });
  1882. });
  1883. });
  1884.  
  1885. },
  1886.  
  1887. carouselItems: function () {
  1888.  
  1889. $('.kleo-carousel-items').each(function () {
  1890. // Load Carousel options into variables
  1891. var $currentCrslPrnt = $(this);
  1892. var $currentCrsl = $currentCrslPrnt.children('.kleo-carousel');
  1893. var $prev = $currentCrslPrnt.closest('.kleo-carousel-container').find(".carousel-arrow .carousel-prev");
  1894. var $next = $currentCrslPrnt.closest('.kleo-carousel-container').find(".carousel-arrow .carousel-next");
  1895. var $pagination = $currentCrslPrnt.closest('.kleo-carousel-container').find(".kleo-carousel-pager");
  1896.  
  1897. var $visible,
  1898. $items_height = 'auto',
  1899. $items_width = null,
  1900. $auto_play = false,
  1901. $auto_pauseOnHover = 'resume',
  1902. $scroll_fx = 'scroll',
  1903. $duration = 2000;
  1904.  
  1905. if ($currentCrslPrnt.data("pager")) {
  1906. $pagination = $currentCrslPrnt.closest('.kleo-carousel-container').find($currentCrslPrnt.data("pager"));
  1907. }
  1908. if ($currentCrslPrnt.data("autoplay")) {
  1909. $auto_play = true;
  1910. }
  1911. if ($currentCrslPrnt.data("speed")) {
  1912. $duration = parseInt($currentCrslPrnt.data("speed"));
  1913. }
  1914. if ($currentCrslPrnt.data("items-height")) {
  1915. $items_height = $currentCrslPrnt.data("items-height");
  1916. }
  1917. if ($currentCrslPrnt.data("items-width")) {
  1918. $items_width = $currentCrslPrnt.data("items-width");
  1919. }
  1920. if ($currentCrslPrnt.data("scroll-fx")) {
  1921. $scroll_fx = $currentCrslPrnt.data("scroll-fx");
  1922. }
  1923.  
  1924. if ($currentCrslPrnt.data("min-items") && $currentCrslPrnt.data("max-items")) {
  1925. $visible = {
  1926. min: $currentCrslPrnt.data("min-items"),
  1927. max: $currentCrslPrnt.data("max-items")
  1928. };
  1929. }
  1930. // Apply common carousel options
  1931. $currentCrsl.imagesLoaded(function () {
  1932. $currentCrsl.carouFredSel({
  1933. responsive: true,
  1934. width: '100%',
  1935. pagination: $pagination,
  1936. prev: $prev,
  1937. next: $next,
  1938. auto: {
  1939. play: $auto_play,
  1940. pauseOnHover: $auto_pauseOnHover
  1941. },
  1942. scroll: {
  1943. items: 1,
  1944. duration: 600,
  1945. fx: $scroll_fx,
  1946. easing: "swing",
  1947. timeoutDuration: $duration,
  1948. wipe: true
  1949. },
  1950. items: {
  1951. width: $items_width,
  1952. height: $items_height,
  1953. visible: $visible
  1954. }
  1955. }).visible();
  1956. $currentCrsl.swipe({
  1957. excludedElements: "",
  1958. threshold: 40,
  1959. swipeLeft: function () {
  1960. $currentCrsl.trigger('next', 1);
  1961. setTimeout(function () {
  1962. $currentCrsl.trigger('updateSizes');
  1963. }, 600);
  1964. },
  1965. swipeRight: function () {
  1966. $currentCrsl.trigger('prev', 1);
  1967. setTimeout(function () {
  1968. $currentCrsl.trigger('updateSizes');
  1969. }, 600);
  1970.  
  1971. }
  1972. });
  1973. });
  1974. });
  1975.  
  1976. if ($(".kleo-thumbs-carousel").length) {
  1977. $(".kleo-thumbs-carousel").each(function () {
  1978. var $thumbsCarousel = $(this),
  1979. $thumbsVisible = 6,
  1980. $circular = false;
  1981.  
  1982. if ($thumbsCarousel.data("min-items") && $thumbsCarousel.data("max-items")) {
  1983. $thumbsVisible = {
  1984. min: $thumbsCarousel.data("min-items"),
  1985. max: $thumbsCarousel.data("max-items")
  1986. };
  1987. }
  1988. if ($thumbsCarousel.data("circular")) {
  1989. $circular = true;
  1990. }
  1991.  
  1992. $thumbsCarousel.imagesLoaded(function () {
  1993. $thumbsCarousel.carouFredSel({
  1994. responsive: true,
  1995. circular: $circular,
  1996. infinite: true,
  1997. auto: false,
  1998. prev: {
  1999. button: function () {
  2000. return $(this).parents('.kleo-gallery').find('.kleo-thumbs-prev');
  2001. }
  2002. },
  2003. next: {
  2004. button: function () {
  2005. return $(this).parents('.kleo-gallery').find('.kleo-thumbs-next');
  2006. }
  2007. },
  2008. scroll: {
  2009. items: 1
  2010. },
  2011. items: {
  2012. height: 'auto',
  2013. visible: $thumbsVisible
  2014. }
  2015. }).css('opacity', 1);
  2016. $thumbsCarousel.swipe({
  2017. excludedElements: "",
  2018. threshold: 40,
  2019. swipeLeft: function () {
  2020. $thumbsCarousel.trigger('next', 1);
  2021. setTimeout(function () {
  2022. $thumbsCarousel.trigger('updateSizes');
  2023. }, 600);
  2024. },
  2025. swipeRight: function () {
  2026. $thumbsCarousel.trigger('prev', 1);
  2027. setTimeout(function () {
  2028. $thumbsCarousel.trigger('updateSizes');
  2029. }, 600);
  2030. }
  2031. });
  2032. });
  2033. });
  2034. }
  2035.  
  2036. $('.kleo-thumbs-carousel a').click(function (e) {
  2037. $(this).closest('.kleo-gallery-container').find('.kleo-gallery-image').trigger('slideTo', '#' + this.href.split('#').pop());
  2038. $('.kleo-thumbs-carousel a').removeClass('selected');
  2039. $(this).addClass('selected');
  2040. e.preventDefault();
  2041. return false;
  2042. });
  2043.  
  2044. var kleoGalleryImage = $(".kleo-gallery-image");
  2045.  
  2046. if (kleoGalleryImage.length) {
  2047. kleoGalleryImage.imagesLoaded(function () {
  2048. kleoGalleryImage.carouFredSel({
  2049. responsive: true,
  2050. circular: false,
  2051. auto: false,
  2052. items: {
  2053. height: 'variable',
  2054. visible: 1
  2055. },
  2056. scroll: {
  2057. items: 1,
  2058. fx: 'crossfade'
  2059. }
  2060. });
  2061. kleoGalleryImage.swipe({
  2062. excludedElements: "",
  2063. threshold: 40,
  2064. swipeLeft: function () {
  2065. $('.kleo-gallery-image').trigger('next', 1);
  2066. setTimeout(function () {
  2067. $('.kleo-gallery-image').trigger('updateSizes');
  2068. }, 600);
  2069. },
  2070. swipeRight: function () {
  2071. $('.kleo-gallery-image').trigger('prev', 1);
  2072. setTimeout(function () {
  2073. $('.kleo-gallery-image').trigger('updateSizes');
  2074. }, 600);
  2075. }
  2076. });
  2077. });
  2078. }
  2079.  
  2080. },
  2081.  
  2082. rtMediaslider: function () {
  2083.  
  2084. //jQuery('.rtmedia-activity-container').animate({"opacity": "1"}, 700);
  2085. $('.rtmedia-activity-container').each(function () {
  2086.  
  2087. if ($(this).find(".rtmedia-list .media-type-photo").length < 1) {
  2088. return true;
  2089. }
  2090. $(this).append('<div class="activity-feed-prev">&nbsp;</div><div class="activity-feed-next">&nbsp;</div>');
  2091.  
  2092. var $prev = $(this).find(".activity-feed-prev");
  2093. var $next = $(this).find(".activity-feed-next");
  2094. var thisSliderItems = $(this).find('.rtmedia-list');
  2095.  
  2096. thisSliderItems.imagesLoaded(function () {
  2097. thisSliderItems.carouFredSel({
  2098. //auto: false,
  2099. responsive: true,
  2100. circular: false,
  2101. auto: {
  2102. play: true,
  2103. pauseDuration: 0,
  2104. duration: 2000
  2105. },
  2106. scroll: {
  2107. items: 1,
  2108. duration: 600,
  2109. //fx: "crossfade",
  2110. easing: "easeInOutExpo",
  2111. wipe: true
  2112. },
  2113. //padding: 0,
  2114. prev: $prev,
  2115. next: $next,
  2116. items: {
  2117. height: 'auto',
  2118. visible: {
  2119. min: 1,
  2120. max: 4
  2121. }
  2122. }
  2123. });
  2124. thisSliderItems.swipe({
  2125. excludedElements: "",
  2126. threshold: 40,
  2127. swipeLeft: function () {
  2128. thisSliderItems.trigger('next', 1);
  2129. setTimeout(function () {
  2130. thisSliderItems.trigger('updateSizes');
  2131. }, 600);
  2132. },
  2133. swipeRight: function () {
  2134. thisSliderItems.trigger('prev', 1);
  2135. setTimeout(function () {
  2136. thisSliderItems.trigger('updateSizes');
  2137. }, 600);
  2138. }
  2139. });
  2140. });
  2141. });
  2142.  
  2143. },
  2144.  
  2145. newsTicker: function () {
  2146.  
  2147. var _newsScroll = {
  2148. delay: 1000,
  2149. easing: 'linear',
  2150. items: 1,
  2151. duration: 0.07,
  2152. timeoutDuration: 0,
  2153. pauseOnHover: 'immediate'
  2154. };
  2155. $('.news-ticker').each(function () {
  2156. $(this).carouFredSel({
  2157. width: 1000,
  2158. align: false,
  2159. items: {
  2160. width: 'variable',
  2161. /*height: 35,*/
  2162. visible: 1
  2163. },
  2164. scroll: _newsScroll
  2165. });
  2166. $(this).closest('.caroufredsel_wrapper').css('width', '100%');
  2167. });
  2168.  
  2169. },
  2170.  
  2171. initPins: function () {
  2172.  
  2173. $(".kleo-pin-circle, .kleo-pin-poi, .kleo-pin-icon").each(function () {
  2174. var $length = "";
  2175.  
  2176. if ($(this).is('[data-top]')) {
  2177. $(this).css({"top": $(this).attr('data-top') + $length});
  2178. }
  2179. if ($(this).is('[data-left]')) {
  2180. $(this).css({"left": $(this).attr('data-left') + $length});
  2181. }
  2182. if ($(this).is('[data-right]')) {
  2183. $(this).css({"right": $(this).attr('data-right') + $length});
  2184. }
  2185. if ($(this).is('[data-bottom]')) {
  2186. $(this).css({"bottom": $(this).attr('data-bottom') + $length});
  2187. }
  2188.  
  2189. });
  2190.  
  2191. },
  2192.  
  2193. /***************************************************
  2194. Go To Top Link
  2195. ***************************************************/
  2196. goTop: function () {
  2197. $(window).scroll(function () {
  2198. if ($(this).scrollTop() > 500) {
  2199. $('.kleo-go-top, .kleo-quick-contact-wrapper').removeClass('off').addClass('on');
  2200. }
  2201. else {
  2202. $('.kleo-go-top, .kleo-quick-contact-wrapper').removeClass('on').addClass('off');
  2203. }
  2204. });
  2205.  
  2206. $('.kleo-go-top, .divider-go-top').click(function () {
  2207. $("html, body").animate({
  2208. scrollTop: 0
  2209. }, 800);
  2210. return false;
  2211. });
  2212.  
  2213. $('.kleo-classic-comments').click(function () {
  2214. $("html, body").animate({
  2215. scrollTop: $('#comments').offset().top
  2216. }, 800);
  2217.  
  2218. });
  2219. },
  2220.  
  2221.  
  2222. magnificPopupModals: function () {
  2223.  
  2224. /* Login modal */
  2225.  
  2226. /* On specific URL*/
  2227. if (window.location.hash) {
  2228. var myHash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
  2229. if (myHash == 'show-login' && !$("body").hasClass('logged-in')) {
  2230. $.magnificPopup.open({
  2231. items: {
  2232. src: '#kleo-login-modal',
  2233. type: 'inline',
  2234. focus: '#username'
  2235. },
  2236. preloader: false,
  2237. mainClass: 'kleo-mfp-zoom'
  2238.  
  2239. });
  2240. }
  2241. }
  2242.  
  2243.  
  2244. $('.kleo-show-login, .bp-menu.bp-login-nav a, .must-log-in > a').magnificPopup({
  2245. items: {
  2246. src: '#kleo-login-modal',
  2247. type: 'inline',
  2248. focus: '#username'
  2249. },
  2250. preloader: false,
  2251. mainClass: 'kleo-mfp-zoom',
  2252.  
  2253. // When element is focused, some mobile browsers in some cases zoom in
  2254. // It looks not nice, so we disable it:
  2255. callbacks: {
  2256. beforeOpen: function () {
  2257. if ($(window).width() < 700) {
  2258. this.st.focus = false;
  2259. } else {
  2260. this.st.focus = '#username';
  2261. }
  2262. }
  2263. }
  2264. });
  2265.  
  2266. kleoPage.lostPassMagnific();
  2267.  
  2268. /* Register modal */
  2269. $('.kleo-show-register').magnificPopup({
  2270. items: {
  2271. src: '#kleo-register-modal',
  2272. type: 'inline',
  2273. focus: '#reg-username'
  2274. },
  2275. preloader: false,
  2276. mainClass: 'kleo-mfp-zoom',
  2277.  
  2278. // When elemened is focused, some mobile browsers in some cases zoom in
  2279. // It looks not nice, so we disable it:
  2280. callbacks: {
  2281. beforeOpen: function () {
  2282. if ($(window).width() < 700) {
  2283. this.st.focus = false;
  2284. } else {
  2285. this.st.focus = '#reg-username';
  2286. }
  2287. }
  2288. }
  2289. });
  2290. },
  2291.  
  2292. lostPassMagnific: function() {
  2293. /* Lost Pass modal */
  2294. $('.kleo-show-lostpass').magnificPopup({
  2295. items: {
  2296. src: '#kleo-lostpass-modal',
  2297. type: 'inline',
  2298. focus: '#forgot-email'
  2299. },
  2300. preloader: false,
  2301. mainClass: 'kleo-mfp-zoom',
  2302.  
  2303. // When element is focused, some mobile browsers in some cases zoom in
  2304. // It looks not nice, so we disable it:
  2305. callbacks: {
  2306. beforeOpen: function () {
  2307. if ($(window).width() < 700) {
  2308. this.st.focus = false;
  2309. } else {
  2310. this.st.focus = '#forgot-email';
  2311. }
  2312. }
  2313. }
  2314. });
  2315. },
  2316.  
  2317. magnificPopupGallery: function () {
  2318.  
  2319. /* Regular popup images */
  2320. $("a[data-rel^='prettyPhoto'], a[rel^='prettyPhoto'], a[rel^='modalPhoto'], a[data-rel^='modalPhoto'], .article-content a[href$=jpg]:has(img), .article-content a[href$=JPG]:has(img), .article-content a[href$=jpeg]:has(img), .article-content a[href$=JPEG]:has(img), .article-content a[href$=gif]:has(img), .article-content a[href$=GIF]:has(img), .article-content a[href$=bmp]:has(img), .article-content a[href$=BMP]:has(img), .article-content a[href$=png]:has(img), .article-content a[href$=PNG]:has(img)").magnificPopup({
  2321. type: 'image',
  2322. mainClass: 'mfp-img-pop',
  2323. gallery: {
  2324. enabled: true
  2325. },
  2326. image: {
  2327. titleSrc: function(item) {
  2328. if($(item.el).next('figcaption').length){
  2329. return $(item.el).next('figcaption').html();
  2330. } else if($(item.el).attr('data-caption')) {
  2331. return $(item.el).data('caption');
  2332. } else {
  2333. return '';
  2334. }
  2335. }
  2336.  
  2337. // this tells the script which attribute has your caption
  2338. }
  2339. });
  2340.  
  2341. /* Galleries */
  2342.  
  2343. var modalElements = "a[href$=jpg], a[href$=JPG], a[href$=jpeg], a[href$=JPEG], a[href$=png], a[href$=PNG], a[href$=gif], a[href$=GIF], a[href$=bmp], a[href$=BMP]";
  2344.  
  2345. $('.gallery, .modal-gallery, .kleo-gallery:not(.kleo-no-popup), .kleo-gallery-grid').each(function () {
  2346. if ($(this).find(modalElements).length && $(this).find(modalElements).has('img')) {
  2347. $(this).magnificPopup({
  2348. delegate: modalElements,
  2349. type: 'image',
  2350. mainClass: 'mfp-gallery-pop',
  2351. navigateByImgClick: true,
  2352. gallery: {
  2353. enabled: true,
  2354. navigateByImgClick: true,
  2355. preload: [0, 1]
  2356. }
  2357. });
  2358. }
  2359. });
  2360. },
  2361.  
  2362. doingLikesRequest: false,
  2363. likes: function () {
  2364. $('#main-container').on('click', '.item-likes', function () {
  2365. var link = $(this);
  2366.  
  2367. if (link.hasClass('liked') || kleoPage.doingLikesRequest === true) {
  2368. return false;
  2369. }
  2370.  
  2371. var id = $(this).attr('id'),
  2372. postfix = link.find('.item-likes-postfix').text();
  2373.  
  2374. $.ajax({
  2375. type: 'POST',
  2376. url: kleoFramework.ajaxurl,
  2377. data: {
  2378. action: 'item-likes',
  2379. likes_id: id,
  2380. postfix: postfix
  2381. },
  2382. beforeSend: function () {
  2383. kleoPage.doingLikesRequest = true;
  2384. },
  2385. success: function (data) {
  2386. link.html(data).addClass('liked').attr('title', kleoFramework.alreadyLiked);
  2387. },
  2388. complete: function () {
  2389. kleoPage.doingLikesRequest = false;
  2390. }
  2391. });
  2392.  
  2393. return false;
  2394. });
  2395.  
  2396. if ($('body.ajax-item-likes').length) {
  2397. $('.item-likes').each(function () {
  2398. var id = $(this).attr('id');
  2399. $(this).load(kleoFramework.ajaxurl, {action: 'item-likes', post_id: id});
  2400. });
  2401. }
  2402. },
  2403. getURLParameters: function (url) {
  2404.  
  2405. var result = {};
  2406. var searchIndex = url.indexOf("?");
  2407. if (searchIndex == -1) return result;
  2408. var sPageURL = url.substring(searchIndex + 1);
  2409. var sURLVariables = sPageURL.split('&');
  2410. for (var i = 0; i < sURLVariables.length; i++) {
  2411. var sParameterName = sURLVariables[i].split('=');
  2412. result[sParameterName[0]] = sParameterName[1];
  2413. }
  2414. return result;
  2415. },
  2416.  
  2417. /* Progress bar */
  2418. progressBar: function () {
  2419.  
  2420. if (typeof jQuery.fn.waypoint !== 'undefined') {
  2421. $('.vc_progress_bar').waypoint(function () {
  2422. $(this).find('.vc_single_bar').each(function (index) {
  2423. var $this = $(this),
  2424. bar = $this.find('.vc_bar'),
  2425. val = bar.data('percentage-value');
  2426.  
  2427. setTimeout(function () {
  2428. bar.css({"width": val + '%'});
  2429. }, index * 200);
  2430. });
  2431. }, {offset: '85%'});
  2432. }
  2433. },
  2434. kleoAjaxLogin: function () {
  2435. $('form#login_form').on('submit', function (e) {
  2436. $('#kleo-login-result').show().html(kleoFramework.loadingmessage);
  2437. $.ajax({
  2438. type: 'POST',
  2439. dataType: 'json',
  2440. url: kleoFramework.loginUrl,
  2441. data: {
  2442. action: 'kleoajaxlogin',
  2443. log: $('form#login_form #username').val(),
  2444. pwd: $('form#login_form #password').val(),
  2445. rememberme: ($('form#login_form #rememberme').is(':checked') ? true : false),
  2446. security: $('form#login_form #security').val()
  2447. },
  2448. success: function (data) {
  2449. $('#kleo-login-result').html(data.message);
  2450. kleoPage.lostPassMagnific();
  2451. if (data.loggedin == true) {
  2452. if (data.redirecturl == null) {
  2453. document.location.reload();
  2454. }
  2455. else {
  2456. document.location.href = data.redirecturl;
  2457. }
  2458. }
  2459. },
  2460. complete: function () {
  2461.  
  2462. },
  2463. error: function () {
  2464. $('form#login_form, #login_panel').off('submit');
  2465. $("#login_form").submit();
  2466. }
  2467. });
  2468. e.preventDefault();
  2469. });
  2470. },
  2471.  
  2472. kleoAjaxLostPass: function () {
  2473. $("#forgot_form").on("submit", function () {
  2474. $('#kleo-lost-result').show().html(kleoFramework.loadingmessage);
  2475. $.ajax({
  2476. url: kleoFramework.ajaxurl,
  2477. type: 'POST',
  2478. data: {
  2479. action: 'kleo_lost_password',
  2480. user_login: $("#forgot-email").val()
  2481. },
  2482. success: function (data) {
  2483. $('#kleo-lost-result').html(data);
  2484. },
  2485. error: function () {
  2486. $('#kleo-lost-result').html('Sorry, an error occurred.').css('color', 'red');
  2487. }
  2488.  
  2489. });
  2490. return false;
  2491. });
  2492. },
  2493. flexFallback: function () {
  2494. var s = document.body || document.documentElement, s = s.style;
  2495. if (s.webkitFlexWrap == '' || s.msFlexWrap == '' || s.flexWrap == '') return true;
  2496.  
  2497. var $list = $('#main-container > .row'),
  2498. $items = $list.find('.template-page, .sidebar'),
  2499. setHeights = function () {
  2500. $items.css('height', 'auto');
  2501.  
  2502. var perRow = Math.floor($list.width() / $items.width());
  2503. if (perRow == null || perRow < 2) return true;
  2504.  
  2505. for (var i = 0, j = $items.length; i < j; i += perRow) {
  2506. var maxHeight = 0,
  2507. $row = $items.slice(i, i + perRow);
  2508.  
  2509. $row.each(function () {
  2510. var itemHeight = parseInt($(this).outerHeight());
  2511. if (itemHeight > maxHeight) maxHeight = itemHeight;
  2512. });
  2513. $row.css('height', maxHeight);
  2514. }
  2515. };
  2516.  
  2517. setHeights();
  2518. $(window).on('resize', setHeights);
  2519. $list.find('img').on('load', setHeights);
  2520. },
  2521.  
  2522. switchBlogLayout: function() {
  2523. $('.kleo-view-switch span').each(function() {
  2524. $(this).click(function () {
  2525. var parentEl = $(this).closest('.kleo-view-switch');
  2526. var extraString = '';
  2527.  
  2528. if ( parentEl.attr('data-identifier') ) {
  2529. extraString = parentEl.data('identifier');
  2530. }
  2531. kleoSetCookie('kleo-blog-layout' + extraString , jQuery(this).data('type'), '/', 30);
  2532.  
  2533. location.reload();
  2534. });
  2535. });
  2536.  
  2537. }
  2538.  
  2539.  
  2540. };
  2541.  
  2542. KLEO.isMobile = {
  2543. Android: function () {
  2544. return navigator.userAgent.match(/Android/i);
  2545. },
  2546. BlackBerry: function () {
  2547. return navigator.userAgent.match(/BlackBerry/i);
  2548. },
  2549. iOS: function () {
  2550. return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  2551. },
  2552. Opera: function () {
  2553. return navigator.userAgent.match(/Opera Mini/i);
  2554. },
  2555. Windows: function () {
  2556. return navigator.userAgent.match(/IEMobile/i);
  2557. },
  2558. mobileWidth: function () {
  2559. if (window.matchMedia) {
  2560. return window.matchMedia('(max-width: 480px)').matches;
  2561. } else {
  2562. return $(window).innerWidth() < 465;
  2563. }
  2564.  
  2565. },
  2566. tabletWidth: function () {
  2567. if (window.matchMedia) {
  2568. return window.matchMedia('(max-width: 768px)').matches;
  2569. } else {
  2570. return $(window).innerWidth() < 753;
  2571. }
  2572. },
  2573. tabletLandscapeWidth: function () {
  2574. if (window.matchMedia) {
  2575. return window.matchMedia('(max-width: 991px)').matches;
  2576. } else {
  2577. return $(window).innerWidth() < 976;
  2578. }
  2579. },
  2580. any: function () {
  2581. return (KLEO.isMobile.Android() || KLEO.isMobile.BlackBerry() || KLEO.isMobile.iOS() || KLEO.isMobile.Opera() || KLEO.isMobile.Windows());
  2582. }
  2583. };
  2584.  
  2585. KLEO.isHighDensity = function () {
  2586. return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3));
  2587. };
  2588.  
  2589. /***************************************************
  2590. Buddypress
  2591. ***************************************************/
  2592. var bP = {
  2593. rehreshID: null,
  2594.  
  2595. init: function () {
  2596. //$("#buddypress div#item-nav .responsive-tabs").css('visibility', 'visible');
  2597. $("#buddypress div#item-nav").css('background-image', 'none');
  2598.  
  2599. //Enable masonry isotope
  2600. $("body").on('gridloaded', function () {
  2601. kleoIsotope.applyGridIsotpe(".kleo-isotope");
  2602. $('.animate-when-almost-visible').kleo_waypoints({offset: '90%'});
  2603. });
  2604.  
  2605. //Activity on change events
  2606. $("body").on('bpActivityLoaded', function () {
  2607. //Init animation
  2608. $('.animate-when-almost-visible').kleo_waypoints({offset: '90%'});
  2609.  
  2610. //Init slider
  2611. kleoPage.rtMediaslider();
  2612.  
  2613. //Init fitVids
  2614. $(".activity-inner").fitVids();
  2615. });
  2616. if (typeof(rtMediaHook) != "undefined") {
  2617. rtMediaHook.register('rtmedia_after_gallery_load', function () {
  2618. $('.el-zero-fade').kleo_waypoints({offset: '90%'});
  2619. });
  2620. }
  2621.  
  2622. if ($(".kleo-notifications-nav").length) {
  2623. $(".navbar").on("click", ".kleo-notifications-nav a.mark-as-read", function (e) {
  2624. bP.notificationsRead($(this));
  2625. e.preventDefault();
  2626. });
  2627. if (kleoFramework.hasOwnProperty('bpNotificationsRefresh') && kleoFramework.bpNotificationsRefresh != '0') {
  2628. bP.notificationsRefresh();
  2629. }
  2630. }
  2631. },
  2632.  
  2633. notificationsRefresh: function () {
  2634.  
  2635. bP.rehreshID = setInterval(function () {
  2636.  
  2637. var values = {
  2638. action: "kleo_bp_notifications_refresh",
  2639. current: $(".kleo-notifications-nav .kleo-notifications").first().text()
  2640. };
  2641.  
  2642. $.ajax({
  2643. url: kleoFramework.ajaxurl,
  2644. type: "GET",
  2645. dataType: "json",
  2646. data: values,
  2647. success: function (response) {
  2648. if (response.status == 'success') {
  2649. if (response.count == '0') {
  2650. $('.kleo-notifications-nav .minicart-buttons').hide();
  2651. $(".kleo-notifications-nav .kleo-notifications").removeClass("new-alert").addClass("no-alert");
  2652. $(".kleo-notifications-nav .submenu-inner").removeClass("has-notif");
  2653. } else {
  2654. $(".kleo-notifications-nav").addClass("kleo-loading");
  2655. $(".kleo-notifications-nav .kleo-notifications").removeClass("no-alert").addClass("new-alert");
  2656. $(".kleo-notifications-nav .submenu-inner").addClass("has-notif");
  2657. $('.kleo-notifications-nav .minicart-buttons').show();
  2658. }
  2659.  
  2660. $(".kleo-notifications-nav .kleo-notifications").text(response.count);
  2661. $('.kleo-notifications-nav .submenu-inner').html(response.data);
  2662. } else {
  2663. //
  2664. }
  2665.  
  2666. },
  2667. complete: function () {
  2668. $(".kleo-notifications-nav").removeClass("kleo-loading");
  2669. }
  2670. });
  2671.  
  2672. }, kleoFramework.bpNotificationsRefresh);
  2673.  
  2674.  
  2675. },
  2676.  
  2677. notificationsRead: function (e) {
  2678.  
  2679. var values = {action: "kleo_bp_notification_mark_read"};
  2680.  
  2681. $.ajax({
  2682. url: kleoFramework.ajaxurl,
  2683. type: "GET",
  2684. dataType: "json",
  2685. data: values,
  2686. beforeSend: function () {
  2687. $(".kleo-notifications-nav").addClass("kleo-loading");
  2688. },
  2689. success: function (response) {
  2690. if (response.status == 'success') {
  2691. if (response.count == '0') {
  2692. $('.kleo-notifications-nav .submenu-inner').html(response.empty);
  2693. $('.kleo-notifications-nav .minicart-buttons').hide();
  2694. $(".kleo-notifications-nav .kleo-notifications").removeClass("new-alert").addClass("no-alert");
  2695. $(".kleo-notifications-nav .submenu-inner").removeClass("has-notif");
  2696. } else {
  2697. $(".kleo-notifications-nav .kleo-notifications").removeClass("no-alert").addClass("new-alert");
  2698. $(".kleo-notifications-nav .submenu-inner").addClass("has-notif");
  2699. $('.kleo-notifications-nav .minicart-buttons').show();
  2700. }
  2701. $(".kleo-notifications-nav .kleo-notifications").text(response.count);
  2702. } else {
  2703. //
  2704. }
  2705.  
  2706. },
  2707. complete: function () {
  2708. $(".kleo-notifications-nav").removeClass("kleo-loading");
  2709. }
  2710. });
  2711.  
  2712.  
  2713. }
  2714.  
  2715. };
  2716.  
  2717. /***************************************************
  2718. Woocommerce
  2719. ***************************************************/
  2720. var kleoShop = {
  2721.  
  2722. wooGalItems: [],
  2723. wooMainImg: $(".woocommerce-main-image"),
  2724. wooThumbs: $(".kleo-woo-gallery a.zoom"),
  2725. wooCarousel: $('.kleo-thumbs-carousel'),
  2726.  
  2727. init: function () {
  2728.  
  2729. kleoShop.productQuickView();
  2730. kleoShop.removeCartProduct();
  2731.  
  2732. if (kleoShop.wooThumbs.length < 2) {
  2733. $(".woo-main-image-nav").hide();
  2734. }
  2735.  
  2736. if (kleoShop.wooThumbs.length) {
  2737. kleoShop.startMultiGallery();
  2738.  
  2739. /* Main image left arrow nav */
  2740. $(".kleo-woo-next").on('click', function (e) {
  2741.  
  2742. e.preventDefault();
  2743. kleoShop.wooCarousel.trigger('next');
  2744.  
  2745. if (kleoShop.wooThumbs.filter('.selected').parent().nextAll(".woocommerce-product-gallery__image:eq(0)").length) {
  2746. var nextElem = kleoShop.wooThumbs.filter('.selected').parent().nextAll(".woocommerce-product-gallery__image:eq(0)").find('a');
  2747. kleoShop.setSelected(nextElem);
  2748. }
  2749. });
  2750.  
  2751. /* Main image right arrow nav */
  2752. $(".kleo-woo-prev").on('click', function (e) {
  2753.  
  2754. e.preventDefault();
  2755. kleoShop.wooCarousel.trigger('prev');
  2756.  
  2757. if (kleoShop.wooThumbs.filter('.selected').parent().prevAll(".woocommerce-product-gallery__image:eq(0)").length) {
  2758. var prevElem = kleoShop.wooThumbs.filter('.selected').parent().prevAll(".woocommerce-product-gallery__image:eq(0)").find('a');
  2759. kleoShop.setSelected(prevElem);
  2760. }
  2761. });
  2762.  
  2763. } else {
  2764. kleoShop.startSingleGallery();
  2765. }
  2766.  
  2767. },
  2768.  
  2769. setSelected: function (element) {
  2770. kleoShop.wooMainImg.find('img').attr('src', element.attr('href')).removeAttr('srcset').removeAttr('data-src').parent("a").attr("href", element.data('big-img'));
  2771. kleoShop.wooMainImg.siblings('img').attr('src', element.attr('href'));
  2772. $(".kleo-woo-gallery a.zoom").removeClass('selected');
  2773. element.addClass('selected');
  2774. kleoShop.updateGalleryItems(element);
  2775. },
  2776.  
  2777. startSingleGallery: function () {
  2778.  
  2779. kleoShop.wooMainImg.magnificPopup({
  2780. type: 'image',
  2781. mainClass: 'kleo-mfp-zoom',
  2782. removalDelay: 300,
  2783. closeOnContentClick: true,
  2784. image: {
  2785. verticalFit: false
  2786. }
  2787. });
  2788.  
  2789. },
  2790.  
  2791. startMultiGallery: function () {
  2792.  
  2793. //update images array
  2794. kleoShop.updateGalleryItems($(".kleo-woo-gallery a.zoom.selected"));
  2795. //disable click
  2796. kleoShop.wooMainImg.on('click', function (e) {
  2797. e.preventDefault();
  2798. });
  2799.  
  2800. //enable gallery lightbox
  2801. kleoShop.wooMainImg.magnificPopup({
  2802. items: kleoShop.wooGalItems,
  2803. type: 'image',
  2804. mainClass: 'kleo-mfp-zoom',
  2805. removalDelay: 300,
  2806. closeOnContentClick: true,
  2807. gallery: {
  2808. enabled: true
  2809. },
  2810. image: {
  2811. verticalFit: false
  2812. }
  2813. });
  2814. kleoShop.wooMainImg.on('mfpBeforeOpen', function () {
  2815. $.magnificPopup.instance.items = kleoShop.wooGalItems;
  2816. $.magnificPopup.instance.updateItemHTML();
  2817. });
  2818.  
  2819. $(".kleo-woo-gallery a.zoom").on('click', function (e) {
  2820. e.preventDefault();
  2821. kleoShop.setSelected($(this));
  2822.  
  2823. return false;
  2824. });
  2825.  
  2826. },
  2827.  
  2828. updateGalleryItems: function (elem) {
  2829.  
  2830. kleoShop.wooGalItems = [{src: elem.attr('href')}];
  2831. var tmp;
  2832. $(".kleo-woo-gallery a.zoom:not(.selected)").each(function () {
  2833. tmp = {
  2834. src: $(this).attr('href')
  2835. };
  2836. kleoShop.wooGalItems.push(tmp);
  2837. });
  2838.  
  2839. },
  2840.  
  2841. productQuickView: function () {
  2842. $('.navbar, #main').on('click', '.quick-view', function (e) {
  2843.  
  2844. var thiss = $(this);
  2845. var product_id = $(this).attr('data-prod');
  2846. var data = {action: 'woo_quickview', product: product_id};
  2847.  
  2848. $.ajax({
  2849. url: kleoFramework.ajaxurl,
  2850. type: "POST",
  2851. data: data,
  2852. beforeSend: function () {
  2853. thiss.addClass('kleo-loading');
  2854. },
  2855. success: function (response) {
  2856.  
  2857. $.magnificPopup.open({
  2858. mainClass: 'kleo-mfp-zoom',
  2859. items: {
  2860. src: '<div id="productModal" class="product-modal main-color">' + response + '</div>',
  2861. type: 'inline'
  2862. }
  2863. });
  2864.  
  2865. setTimeout(function () {
  2866. //init slider
  2867. kleoPage.carouselItems();
  2868.  
  2869. $('.product-modal form').wc_variation_form();
  2870. $('.product-modal form select').change();
  2871.  
  2872. }, 500);
  2873.  
  2874. },
  2875. complete: function () {
  2876. thiss.removeClass('kleo-loading');
  2877. }
  2878. });
  2879.  
  2880. e.preventDefault();
  2881. }); // productQuickView
  2882. },
  2883.  
  2884. removeCartProduct: function () {
  2885. $(".navbar").on("click", ".kleo-minicart a.remove", function (e) {
  2886.  
  2887. var thiss = $(this),
  2888. values = {action: "kleo_woo_rem_item"},
  2889. queryParams = kleoPage.getURLParameters(thiss.attr('href'));
  2890.  
  2891. $.extend(values, queryParams);
  2892. //rename product param name
  2893. var newVar = {kleo_item: values.remove_item};
  2894. delete values.remove_item;
  2895. $.extend(values, newVar);
  2896.  
  2897. $.ajax({
  2898. url: kleoFramework.ajaxurl,
  2899. type: "GET",
  2900. dataType: "json",
  2901. data: values,
  2902. beforeSend: function () {
  2903. $(".shop-drop").addClass('kleo-loading');
  2904. },
  2905. success: function (response) {
  2906. if (response.hasOwnProperty("cart") && response.hasOwnProperty("count")) {
  2907.  
  2908. $(".kleo-toggle-menu.shop-drop .kleo-toggle-submenu").html(response.cart);
  2909. $(".kleo-toggle-menu.shop-drop .cart-items > span, .mheader .cart-items > span").html(response.count);
  2910.  
  2911. if (response.count == '') {
  2912. $(".kleo-toggle-menu.shop-drop .cart-items").removeClass('has-products');
  2913. $(".kleo-toggle-menu.shop-drop .kleo-notifications").removeClass('new-alert');
  2914. $(".kleo-toggle-menu.shop-drop .kleo-notifications").addClass('no-alert');
  2915. } else {
  2916. $(".kleo-toggle-menu.shop-drop .cart-items").addClass('has-products');
  2917. $(".kleo-toggle-menu.shop-drop .kleo-notifications").addClass('new-alert');
  2918. $(".kleo-toggle-menu.shop-drop .kleo-notifications").removeClass('no-alert');
  2919. }
  2920. }
  2921.  
  2922. /* widget cart */
  2923. if ($('.widget_shopping_cart_content').length && response.hasOwnProperty('widget')) {
  2924. $('.widget_shopping_cart_content').replaceWith(response.widget)
  2925. }
  2926.  
  2927. },
  2928. complete: function () {
  2929. $(".shop-drop").removeClass('kleo-loading');
  2930. }
  2931. });
  2932. e.preventDefault();
  2933. });
  2934. }
  2935.  
  2936. };
  2937.  
  2938.  
  2939. /***************************************************
  2940. Isotope
  2941. ***************************************************/
  2942. var kleoIsotope = {
  2943.  
  2944. container: '.kleo-isotope, .kleo-masonry',
  2945. elContainer: $('.kleo-isotope, .kleo-masonry'),
  2946.  
  2947. init: function () {
  2948.  
  2949. if (kleoIsotope.elContainer.length > 0) {
  2950. kleoIsotope.applyGridIsotpe(kleoIsotope.container);
  2951. }
  2952.  
  2953. },
  2954.  
  2955. applyGridIsotpe: function (container, atts) {
  2956. var $container = $(container);
  2957. $container.each(function () {
  2958. var $isoItem = $(this);
  2959. var $isoAtts = {};
  2960. if ($isoItem.data('layout') == 'fitRows') {
  2961. $isoAtts = {layoutMode: 'fitRows'};
  2962. }
  2963.  
  2964. atts = typeof atts !== 'undefined' ? true : false;
  2965. if (atts == false) {
  2966. $isoAtts = {};
  2967. }
  2968.  
  2969. if ($('body').hasClass('rtl')) {
  2970. $isoAtts.transformsEnabled = false;
  2971. $isoAtts.isOriginLeft = false;
  2972. }
  2973.  
  2974. if (kleoIsotope.elContainer.length > 0 && kleoIsotope.viewport().width >= 480) {
  2975. $isoItem.imagesLoaded(function () {
  2976. $isoItem.isotope($isoAtts);
  2977. });
  2978. }
  2979.  
  2980. $(window).on("debouncedresize", function () {
  2981. // reinit isotope
  2982. $isoItem.isotope($isoAtts);
  2983. });
  2984.  
  2985. /* filter items on button click */
  2986. var filterButton = $isoItem.closest('.portfolio-wrapper').siblings(".filter-wrap");
  2987. if (filterButton.length) {
  2988. filterButton.on('click', "a", function () {
  2989. var filterValue = $(this).data('filter');
  2990. $(this).closest('ul').find('li').removeClass('selected');
  2991. $(this).parent('li').addClass('selected');
  2992. $isoItem.isotope({filter: filterValue});
  2993. $isoItem.find('li:visible').children('div.animate-when-almost-visible').addClass('start-animation');
  2994. return false;
  2995. });
  2996. }
  2997.  
  2998. });
  2999.  
  3000. },
  3001. getWidth: function (item) {
  3002. var $isoWidth;
  3003.  
  3004. if (kleoIsotope.viewport().width < 480) {
  3005. $isoWidth = item.width() / 1;
  3006.  
  3007. } else if (kleoIsotope.viewport().width < 768) {
  3008. $isoWidth = item.width() / 2;
  3009.  
  3010. } else if (kleoIsotope.viewport().width < 992) {
  3011. $isoWidth = item.width() / 2;
  3012.  
  3013. } else if (kleoIsotope.viewport().width < 1200) {
  3014. if (item.closest(".template-page").hasClass('col-sm-12')) {
  3015. $isoWidth = item.width() / 3;
  3016. } else {
  3017. $isoWidth = item.width() / 2;
  3018. }
  3019.  
  3020. } else if (kleoIsotope.viewport().width < 1440) {
  3021. if (item.closest(".template-page").hasClass('col-sm-12')) {
  3022.  
  3023. $isoWidth = item.width() / 4;
  3024.  
  3025. } else {
  3026. $isoWidth = item.width() / 3;
  3027. }
  3028. } else {
  3029. if (item.closest(".template-page").hasClass('col-sm-12')) {
  3030. if (item.closest(".section-container").hasClass('container-full')) {
  3031. $isoWidth = item.width() / 6;
  3032. } else {
  3033. $isoWidth = item.width() / 4;
  3034. }
  3035. } else {
  3036. $isoWidth = item.width() / 3;
  3037. }
  3038. }
  3039. return $isoWidth;
  3040. },
  3041.  
  3042. viewport: function () {
  3043. var e = window, a = 'inner';
  3044. if (!('innerWidth' in window )) {
  3045. a = 'client';
  3046. e = document.documentElement || document.body;
  3047. }
  3048. return {width: e[a + 'Width'], height: e[a + 'Height']};
  3049. }
  3050.  
  3051. };
  3052.  
  3053.  
  3054. /***************************************************
  3055. Site Header
  3056. ***************************************************/
  3057. var kleoHeader = {
  3058. spacing: 0,
  3059. initialPos: ($('.kleo-main-header').length && !$("body").hasClass('navbar-transparent')) ? $('.kleo-main-header').offset().top : 0,
  3060. initialSize: 88,
  3061. scrolledHeight: 44,
  3062. menuHeight: 88,
  3063. scrolledMenuHeight: 44,
  3064. isLogo: kleoFramework.logo == '' ? false : true,
  3065. logoSize: 88,
  3066. logoImg: null,
  3067. header: $('.kleo-main-header'),
  3068. logo: $('.navbar-header .logo img'),
  3069. elements: $('.navbar-header, .kleo-main-header .navbar-collapse > ul > li > a'),
  3070. resizeState: 'normal',
  3071. adminBar: '#wpadminbar',
  3072.  
  3073. init: function () {
  3074.  
  3075. //save logo size
  3076. if (kleoHeader.isLogo) {
  3077.  
  3078. kleoHeader.loadLogoImg();
  3079. $(kleoHeader.logoImg).imagesLoaded(function () {
  3080. kleoHeader.updateLogoSize(kleoHeader.logoImg.height);
  3081. }, false);
  3082. }
  3083.  
  3084.  
  3085. if ($(kleoHeader.adminBar).length > 0 && parseInt($window.width()) > 584) {
  3086. kleoHeader.spacing = $(kleoHeader.adminBar).height();
  3087. }
  3088.  
  3089. //check for custom header size set
  3090. if (!kleoFramework.headerHeight) {
  3091.  
  3092. //init based on logo
  3093. //kleoHeader.initialSize = kleoHeader.elements.filter(':first').height();
  3094. kleoHeader.initialSize = ($('.kleo-main-header #logo_img').length && $('.kleo-main-header #logo_img').height() > 10) ? $('.kleo-main-header #logo_img').height() : 88;
  3095.  
  3096. } else {
  3097. kleoHeader.initialSize = kleoFramework.headerHeight;
  3098. }
  3099.  
  3100. //set scrolled header height
  3101. if (kleoFramework.hasOwnProperty('headerHeightScrolled') && kleoFramework.headerHeightScrolled > 10) {
  3102. kleoHeader.scrolledHeight = kleoFramework.headerHeightScrolled
  3103. } else {
  3104. kleoHeader.scrolledHeight = kleoHeader.initialSize / 2;
  3105. }
  3106.  
  3107.  
  3108. //set menu height
  3109. kleoHeader.menuHeight = kleoHeader.initialSize;
  3110. kleoHeader.scrolledMenuHeight = kleoHeader.scrolledHeight;
  3111.  
  3112. if (kleoHeader.header.hasClass('header-centered') || kleoHeader.header.hasClass('header-left')) {
  3113.  
  3114. if (kleoFramework.hasOwnProperty('headerTwoRowHeight') && kleoFramework.headerTwoRowHeight > 10) {
  3115. kleoHeader.menuHeight = kleoFramework.headerTwoRowHeight;
  3116. }
  3117. if (kleoFramework.hasOwnProperty('headerTwoRowHeightScrolled') && kleoFramework.headerTwoRowHeightScrolled > 10) {
  3118. kleoHeader.scrolledMenuHeight = kleoFramework.headerTwoRowHeightScrolled;
  3119. }
  3120.  
  3121. }
  3122.  
  3123. //continue only if the header element exists in the page
  3124. if (kleoHeader.header.length) {
  3125.  
  3126. /* Set initial line height */
  3127. kleoHeader.initialLineHeight();
  3128.  
  3129. /* header left layout */
  3130. if (kleoHeader.header.hasClass("header-left")) {
  3131.  
  3132. if ($("body.kleo-navbar-fixed").length) {
  3133.  
  3134. var totalHeaderHeight = parseInt(kleoHeader.initialPos) + parseInt(kleoHeader.initialSize) + parseInt(kleoHeader.menuHeight);
  3135. var st = $window.scrollTop();
  3136.  
  3137. if ($("body.navbar-resize").length) {
  3138. //$(window).on("debouncedresize", kleoHeader.resizeLogo);
  3139. if (st > parseInt(kleoHeader.initialPos)) {
  3140. kleoHeader.resizeLogo('', true);
  3141. if (!$("body").hasClass("navbar-transparent")) {
  3142. kleoHeader.header.css({top: kleoHeader.spacing, position: 'fixed'});
  3143. if (!$(".sticky-wrapper").length) {
  3144. kleoHeader.header.wrap('<div id="undefined-sticky-wrapper" class="sticky-wrapper"></div>');
  3145. }
  3146. }
  3147. }
  3148. }
  3149.  
  3150. $window.scroll(function () {
  3151. var st = $window.scrollTop();
  3152. if (st > totalHeaderHeight) {
  3153. if ($("body.navbar-resize").length) {
  3154. kleoHeader.resizeLogo('', true);
  3155. if (!$("body").hasClass("navbar-transparent")) {
  3156. kleoHeader.header.css({top: kleoHeader.spacing, position: 'fixed'});
  3157. if (!$(".sticky-wrapper").length) {
  3158. kleoHeader.header.wrap('<div id="undefined-sticky-wrapper" class="sticky-wrapper"></div>');
  3159. }
  3160. }
  3161. }
  3162. } else {
  3163. kleoHeader.resizeLogo('', true);
  3164. kleoHeader.header.css({top: 'auto', position: 'static'});
  3165. }
  3166. });
  3167. }
  3168.  
  3169. } else { /* All other layouts */
  3170.  
  3171. /* Activate logo resizing */
  3172. if ($("body.kleo-navbar-fixed.navbar-resize").length) {
  3173. if (kleoHeader.isLogo) {
  3174. kleoHeader.loadLogoImg();
  3175. $(kleoHeader.logoImg).imagesLoaded(function () {
  3176. kleoHeader.resizeLogo();
  3177. }, false);
  3178. } else {
  3179. kleoHeader.resizeLogo();
  3180. }
  3181.  
  3182. $window.scroll(function() {
  3183. kleoHeader.resizeLogo();
  3184. });
  3185. $(window).on("debouncedresize", kleoHeader.resizeLogo);
  3186.  
  3187. } else if ($("body.kleo-navbar-fixed.navbar-transparent").length) {
  3188. /* when transparent is selected but not resizable */
  3189.  
  3190. /* apply header-scrolled class for transparent navbar too */
  3191.  
  3192. var st = $window.scrollTop();
  3193. var resizePoint = 50;
  3194. if (kleoFramework.hasOwnProperty('headerResizeOffset') && kleoFramework.headerResizeOffset != '') {
  3195. resizePoint = kleoFramework.headerResizeOffset;
  3196. }
  3197.  
  3198. if (st > resizePoint) {
  3199. kleoHeader.header.addClass('header-scrolled');
  3200. } else {
  3201. kleoHeader.header.removeClass('header-scrolled');
  3202. }
  3203.  
  3204. $window.scroll(function () {
  3205. var st = $window.scrollTop();
  3206. if (st > resizePoint) {
  3207. kleoHeader.header.addClass('header-scrolled');
  3208. } else {
  3209. kleoHeader.header.removeClass('header-scrolled');
  3210. }
  3211. });
  3212. }
  3213.  
  3214. }
  3215. }
  3216.  
  3217. //activate sticky main menu
  3218. if (body.hasClass("kleo-navbar-fixed") && !kleoHeader.header.hasClass("header-left")) {
  3219. kleoHeader.enable_sticky();
  3220. }
  3221.  
  3222. //activate retina logo
  3223. kleoHeader.enableRetinaLogo();
  3224.  
  3225. //activate social icons expand effect
  3226. kleoHeader.topSocialExpander();
  3227.  
  3228. //enable menu Ajax search button
  3229. if ($('.search-trigger').length) {
  3230. kleoHeader.toggleAjaxSearch();
  3231. }
  3232. kleoHeader.doAjaxSearch();
  3233.  
  3234. // Activate Hover menu
  3235. if (kleoIsotope.viewport().width > 992) {
  3236. $('#header .js-activated').dropdownHover({delay: 100}).dropdown();
  3237. }
  3238. $('.js-activated').off('click');
  3239.  
  3240. //Expand dropdown on caret click
  3241. $('#header .caret').on('click', function () {
  3242. var liItem = $(this).closest(".dropdown, .dropdown-submenu");
  3243. if (liItem.hasClass("open")) {
  3244. liItem.removeClass("open");
  3245. } else {
  3246. liItem.addClass("open");
  3247. }
  3248. return false;
  3249. });
  3250.  
  3251. kleoHeader.dropdownToggle();
  3252.  
  3253. kleoHeader.scrollTo();
  3254.  
  3255. kleoHeader.sideMenu();
  3256.  
  3257. /* Flexmenu logic */
  3258. if ( body.hasClass('header-flexmenu') ) {
  3259. body.on('flexmenu-added', function () {
  3260. kleoHeader.resizeLogo();
  3261. });
  3262. body.on('flexmenu-finished', function () {
  3263. body.removeClass('header-overflow');
  3264. });
  3265. body.on('flexmenu-beforeResize', function () {
  3266. body.addClass('header-overflow');
  3267. });
  3268.  
  3269. $('.primary-menu > ul').flexMenu({
  3270. linkText: '<i class="icon-menu19"></i>',
  3271. linkTextAll: '<i class="icon-menu19"></i>',
  3272. popupAbsolute: false,
  3273. popupClass: 'dropdown-menu sub-menu pull-right'
  3274. });
  3275. }
  3276.  
  3277. },
  3278.  
  3279. loadLogoImg: function () {
  3280. if (kleoHeader.isLogo && !kleoHeader.logoImg) {
  3281. kleoHeader.logoImg = new Image();
  3282. kleoHeader.logoImg.src = kleoFramework.logo;
  3283. }
  3284. },
  3285.  
  3286. initialLineHeight: function () {
  3287.  
  3288. kleoHeader.elements.css({
  3289. 'lineHeight': kleoHeader.menuHeight + 'px'
  3290. });
  3291.  
  3292. kleoHeader.elements.filter(':first').css({
  3293. 'height': kleoHeader.initialSize + 'px',
  3294. 'lineHeight': kleoHeader.initialSize + 'px'
  3295. });
  3296.  
  3297. kleoHeader.header.find("li.has-btn-see-through").css({
  3298. 'height': kleoHeader.menuHeight + 'px'
  3299. });
  3300.  
  3301.  
  3302. if (kleoFramework.retinaLogo != '') {
  3303. kleoHeader.loadLogoImg();
  3304. $(kleoHeader.logoImg).imagesLoaded(function () {
  3305. kleoHeader.logo.css({'maxHeight': kleoHeader.logoSize + 'px'});
  3306. }, false);
  3307. }
  3308. },
  3309.  
  3310. /* Decreases header size when user scrolls down */
  3311. resizeLogo: function (scrollPoint, disableInterScroll ) {
  3312.  
  3313. if (kleoIsotope.viewport().width < 992) {
  3314. kleoHeader.initialLineHeight();
  3315. return;
  3316. }
  3317.  
  3318. /* Get Scroll offset from Theme options */
  3319. if (typeof scrollPoint === 'undefined' || typeof scrollPoint === 'object' || scrollPoint == '') {
  3320. if (kleoFramework.hasOwnProperty('headerResizeOffset') && kleoFramework.headerResizeOffset != '') {
  3321. scrollPoint = kleoFramework.headerResizeOffset;
  3322. } else {
  3323. scrollPoint = kleoHeader.initialPos;
  3324. }
  3325. }
  3326.  
  3327. if (typeof disableInterScroll === 'undefined' || typeof disableInterScroll === 'object') {
  3328. disableInterScroll = false;
  3329. }
  3330.  
  3331. var st = $window.scrollTop(),
  3332. newH = 0,
  3333. newMenuH = 0,
  3334. headerFinishScrolling = parseInt(scrollPoint) + parseInt(kleoHeader.initialSize) - parseInt(kleoHeader.scrolledHeight),
  3335. headerIsScrolled = false,
  3336. resizeRatio = 1,
  3337. currentState = 'normal';
  3338.  
  3339. if (kleoHeader.header.hasClass('header-centered') ) {
  3340. headerFinishScrolling = parseInt(scrollPoint) + parseInt(kleoHeader.initialSize) + parseInt(kleoHeader.menuHeight) - parseInt(kleoHeader.scrolledHeight) - parseInt(kleoHeader.scrolledMenuHeight);
  3341. }
  3342.  
  3343. //reinit the elements
  3344. kleoHeader.elements = $('.navbar-header, .kleo-main-header .navbar-collapse > ul > li > a');
  3345.  
  3346. if (st > scrollPoint) { /* we can start the scroll */
  3347.  
  3348. if (st < headerFinishScrolling) { /* step by step resizing */
  3349.  
  3350. var scrollDiff = st - scrollPoint;
  3351.  
  3352. if (kleoHeader.header.hasClass('header-centered')) {
  3353. var totalH = parseInt(kleoHeader.menuHeight) + parseInt(kleoHeader.initialSize);
  3354. var logoDif = Math.round(scrollDiff * parseInt(kleoHeader.initialSize) / totalH);
  3355. var MenuDif = Math.round(scrollDiff * parseInt(kleoHeader.menuHeight) / totalH);
  3356.  
  3357. newH = kleoHeader.initialSize - logoDif;
  3358. newMenuH = kleoHeader.menuHeight - MenuDif;
  3359.  
  3360. }
  3361. else {
  3362. newH = kleoHeader.initialSize - scrollDiff;
  3363. newMenuH = kleoHeader.menuHeight - scrollDiff;
  3364. }
  3365.  
  3366. /* Disable intermediate scrolling if set so */
  3367. if(disableInterScroll === true) {
  3368. newH = kleoHeader.initialSize;
  3369. newMenuH = kleoHeader.menuHeight;
  3370. }
  3371.  
  3372. headerIsScrolled = false;
  3373.  
  3374. } else { /* finished resizing */
  3375.  
  3376. newH = kleoHeader.scrolledHeight;
  3377. newMenuH = kleoHeader.scrolledMenuHeight;
  3378. headerIsScrolled = true;
  3379.  
  3380. }
  3381.  
  3382. if (parseInt(newH) < parseInt(kleoHeader.scrolledHeight)) {
  3383. newH = kleoHeader.scrolledHeight;
  3384. }
  3385. if (parseInt(newMenuH) < parseInt(kleoHeader.scrolledMenuHeight)) {
  3386. newMenuH = kleoHeader.scrolledMenuHeight;
  3387. }
  3388.  
  3389. /* Used for retina logo resizing */
  3390. resizeRatio = newH / kleoHeader.initialSize;
  3391.  
  3392. } else { /* scroll haven't reached the header yet */
  3393.  
  3394. newH = kleoHeader.initialSize;
  3395. newMenuH = kleoHeader.menuHeight;
  3396. resizeRatio = 1;
  3397. headerIsScrolled = false;
  3398. }
  3399.  
  3400. /* Apply Line height to elements */
  3401. kleoHeader.elements.css({
  3402. 'lineHeight': newMenuH + 'px'
  3403. });
  3404.  
  3405. kleoHeader.elements.filter(':first').css({'height': newH + 'px', 'lineHeight': newH + 'px'});
  3406.  
  3407. kleoHeader.header.find("li:has(a.btn-see-through)").css({
  3408. 'height': newMenuH + 'px'
  3409. });
  3410.  
  3411. if (headerIsScrolled === true) {
  3412. $('.btn-buy').addClass('btn-default');
  3413. kleoHeader.header.addClass('header-scrolled');
  3414.  
  3415. currentState = 'scrolled';
  3416. } else {
  3417. $('.btn-buy').removeClass('btn-default');
  3418. kleoHeader.header.removeClass('header-scrolled');
  3419.  
  3420. currentState = 'normal';
  3421. }
  3422.  
  3423. if (currentState != kleoHeader.resizeState && kleoHeader.header.hasClass('header-left')) {
  3424. $('body').trigger('flexmenu-go');
  3425. }
  3426. kleoHeader.resizeState = currentState;
  3427.  
  3428. if (kleoFramework.retinaLogo != '') {
  3429. kleoHeader.logo.css({'maxHeight': ( resizeRatio * kleoHeader.logoSize) + 'px'});
  3430. }
  3431.  
  3432. },
  3433.  
  3434. enable_sticky: function () {
  3435. $(".kleo-main-header").sticky({topSpacing: kleoHeader.spacing});
  3436. },
  3437.  
  3438. updateLogoSize: function (size) {
  3439. if (size < kleoHeader.initialSize) {
  3440. kleoHeader.logoSize = size;
  3441. } else {
  3442. kleoHeader.logoSize = kleoHeader.initialSize;
  3443. }
  3444. },
  3445.  
  3446. enableRetinaLogo: function () {
  3447. if ($("#logo_img").length && window.devicePixelRatio > 1 && kleoFramework.retinaLogo != '') {
  3448. var image = $("#logo_img"),
  3449. imageName = kleoFramework.retinaLogo,
  3450. imageHeight;
  3451.  
  3452. kleoHeader.loadLogoImg();
  3453. $(kleoHeader.logoImg).imagesLoaded(function () {
  3454.  
  3455. //rename image
  3456. image.attr('src', imageName);
  3457.  
  3458. imageHeight = kleoHeader.logoSize;
  3459.  
  3460. if ($(".kleo-main-header").hasClass("header-scrolled")) {
  3461. imageHeight = imageHeight / 2;
  3462. }
  3463.  
  3464. image.css({"max-height": imageHeight + "px"});
  3465.  
  3466. //add specific class
  3467. image.closest('.logo').addClass('retina-logo');
  3468. }, false);
  3469.  
  3470. }
  3471. },
  3472.  
  3473. sideMenu: function () {
  3474. $('.open-sidebar').on('click', function () {
  3475. $('body').toggleClass('offcanvas-open');
  3476. $('.offcanvas-sidebar').toggleClass('is-open');
  3477. return false;
  3478. });
  3479.  
  3480. $(".kleo-page").on('click', function (e) {
  3481.  
  3482. if ($(e.target).hasClass("open-sidebar") || $(e.target).closest(".open-sidebar").length > 0) {
  3483. return;
  3484. }
  3485.  
  3486. $('body').removeClass('offcanvas-open');
  3487. $('.offcanvas-sidebar').removeClass('is-open');
  3488. });
  3489. },
  3490.  
  3491. scrollTo: function () {
  3492. /* Click event */
  3493. $('.kleo-main-header .nav > li a[href^="#"], .kleo-scroll-to').on('click', function (event) {
  3494.  
  3495. var target = '';
  3496. var speed = 1000;
  3497. if ($(this).attr('data-speed') && $(this).data('speed') != '') {
  3498. speed = $(this).data('speed');
  3499. }
  3500.  
  3501. if ($(this).is("a")) {
  3502. target = kleoHeader.getRelatedContent(this);
  3503. } else {
  3504. target = kleoHeader.getRelatedContent($(this).find('a[href^="#"]'));
  3505. }
  3506.  
  3507. if (target.length) {
  3508. event.preventDefault();
  3509. $('html, body').animate({
  3510. scrollTop: target.offset().top - kleoHeader.calcTopHeight()
  3511. }, speed);
  3512. }
  3513. });
  3514.  
  3515. /* On page load */
  3516. if (window.location.hash) {
  3517. scroll(0,0);
  3518. // void some browsers issue
  3519. setTimeout( function() { scroll(0,0); }, 1);
  3520.  
  3521. var myHash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
  3522. if (myHash !== 'show-login' && $(window.location.hash).length) {
  3523. $('html, body').animate({
  3524. scrollTop: $(window.location.hash).offset().top - kleoHeader.calcTopHeight()
  3525. }, 1000);
  3526. }
  3527. }
  3528.  
  3529. if (kleoHeader.getRelatedNavigation(this)) {
  3530. $('section')
  3531. .waypoint(function (direction) {
  3532. // Highlight element when related content
  3533. // is 10% percent from the bottom...
  3534. // remove if below
  3535. kleoHeader.getRelatedNavigation(this).parents('li').toggleClass('active', direction === 'down');
  3536. }, {
  3537. offset: 150 //
  3538. })
  3539. .waypoint(function (direction) {
  3540. // Highlight element when bottom of related content
  3541. // is 100px from the top - remove if less
  3542. kleoHeader.getRelatedNavigation(this).parents('li').toggleClass('active', direction === 'up');
  3543. }, {
  3544. offset: function () {
  3545. return -$(this).height() + 100;
  3546. }
  3547. });
  3548. }
  3549. },
  3550. calcTopHeight: function() {
  3551. var topHeight = 0;
  3552.  
  3553. if ($("body").hasClass("kleo-navbar-fixed")) {
  3554. topHeight += parseInt(kleoHeader.initialSize);
  3555.  
  3556. if ($("body").hasClass("navbar-resize")) {
  3557. topHeight = topHeight / 2;
  3558. }
  3559. }
  3560.  
  3561. if ($(kleoHeader.adminBar).length) {
  3562. topHeight += parseInt($(kleoHeader.adminBar).height());
  3563. }
  3564. return topHeight;
  3565. },
  3566. /* Get section or article by href */
  3567. getRelatedContent: function (el) {
  3568. return $($(el).attr('href'));
  3569. },
  3570. /* Get link by section or article id */
  3571. getRelatedNavigation: function (el) {
  3572. if ($(el).attr('id')) {
  3573. return $('.kleo-main-header .nav > li a[href=#' + $(el).attr('id') + ']');
  3574. } else {
  3575. return false;
  3576. }
  3577. },
  3578.  
  3579.  
  3580. /* Top Social Bar - Small slide effect for social icons */
  3581. topSocialExpander: function () {
  3582.  
  3583. $("#top-social li a").hover(function () {
  3584. if (!$("#top-social .tabdrop").length || $("#top-social .tabdrop").hasClass("hide")) {
  3585. var tsTextWidth = $(this).children('.ts-text').outerWidth() + 52;
  3586. $(this).stop().animate({width: tsTextWidth}, 250, '');
  3587. }
  3588. }, function () {
  3589. if ($("#top-social .tabdrop").length || $("#top-social .tabdrop").hasClass("hide")) {
  3590. $(this).stop().animate({width: 33}, 250, '');
  3591. }
  3592. });
  3593.  
  3594. },
  3595.  
  3596. toggleAjaxSearch: function () {
  3597. $('.search-trigger').click(function () {
  3598. if ($('#ajax_search_container').hasClass('searchHidden')) {
  3599. $('#ajax_search_container').removeClass('searchHidden').addClass('show_search_pop');
  3600. $(this).next().find(".ajax_s").focus();
  3601. }
  3602. return false;
  3603. });
  3604. },
  3605.  
  3606. doAjaxSearch: function (options) {
  3607. var defaults = {
  3608. delay: 350, //delay in ms for typing
  3609. minChars: 3, //no. of characters after we start the search
  3610. scope: 'body'
  3611. };
  3612.  
  3613. this.options = $.extend({}, defaults, options);
  3614. this.scope = $(this.options.scope);
  3615. this.body = $("body");
  3616. this.timer = false;
  3617. this.doingSearch = false;
  3618. this.lastVal = "";
  3619. this.request = "";
  3620. this.bind_ev = function () {
  3621. this.scope.on('keyup', '.ajax_s', $.proxy(this.test_search, this));
  3622. this.body.on('mousedown', $.proxy(this.hide_search, this));
  3623.  
  3624. /* Show the results on input click */
  3625. $(".ajax_s").on('click focus', function () {
  3626. var res = $(this).closest(".kleo-search-form").find(".kleo_ajax_results");
  3627.  
  3628. if (!res.is(":empty") && $.trim($(this).val()) != '') {
  3629. res.slideDown('slow');
  3630. }
  3631. res.css("opacity", "1");
  3632. $(this).css("opacity", "1");
  3633. });
  3634.  
  3635. /* Hide the results on outside click */
  3636. this.body.on('mousedown', function (e) {
  3637. var element = $(e.target);
  3638. if (!element.is('.kleo_ajax_results, .ajax_s') && element.closest('.kleo_ajax_results').length == 0) {
  3639. $(".kleo-search-form .kleo_ajax_results").css("opacity", "0.5").slideUp('slow');
  3640. $(".kleo-search-form .ajax_s").css("opacity", "0.5");
  3641. }
  3642. });
  3643.  
  3644. };
  3645. this.test_search = function (e) {
  3646. clearTimeout(this.timer);
  3647. if ($.trim(e.currentTarget.value) == '' || $.trim(e.currentTarget.value.length) >= this.options.minChars) {
  3648. this.timer = setTimeout($.proxy(this.search, this, e), this.options.delay);
  3649. }
  3650. };
  3651. this.hide_search = function (e) {
  3652. var element = $(e.target);
  3653. if (!element.is('#ajax_search_container') && element.parents('#ajax_search_container').length == 0) {
  3654. $('#ajax_search_container').addClass('searchHidden').removeClass('show_search_pop');
  3655. }
  3656. };
  3657. this.search = function (e) {
  3658. var element = e.currentTarget;
  3659.  
  3660. var $this = this,
  3661. form = $(element).closest("form"),
  3662. wrap = $(element).closest(".kleo-search-wrap"),
  3663. results = wrap.find(".kleo_ajax_results"),
  3664. loading = wrap.find(".kleo-ajax-search-loading"),
  3665. values = form.serialize();
  3666.  
  3667. values += "&action=kleo_ajax_search";
  3668.  
  3669. if (form.data('context')) {
  3670. values += "&context=" + form.data('context');
  3671. }
  3672.  
  3673. //if it is not ajax search, bail out
  3674. if (!results.length) {
  3675. return;
  3676. }
  3677.  
  3678. //if it is another search in place
  3679. if ($this.doingSearch === true) {
  3680. //return;
  3681. this.request.abort();
  3682. }
  3683.  
  3684. //if current valuer matches last search value
  3685. if (this.lastVal == $.trim(element.value)) {
  3686. results.slideDown();
  3687. return;
  3688. }
  3689.  
  3690. //if current value is blank
  3691. if ($.trim(element.value) == '') {
  3692. results.slideUp('fast');
  3693. return;
  3694. }
  3695.  
  3696.  
  3697. this.lastVal = $.trim(element.value);
  3698.  
  3699. this.request = $.ajax({
  3700. url: kleoFramework.ajaxurl,
  3701. type: "POST",
  3702. data: values,
  3703. beforeSend: function () {
  3704. loading.css('display', 'inline-block');
  3705. //results.slideUp();
  3706. $this.doingSearch = true;
  3707. },
  3708. success: function (response) {
  3709. if (response == 0) {
  3710. response = "";
  3711. }
  3712. ;
  3713. if (results.is(":empty")) {
  3714. results.hide().html(response).slideDown('slow');
  3715. } else {
  3716. results.html(response).slideDown('slow');
  3717. }
  3718. },
  3719. complete: function () {
  3720. /*$("#kleo_ajaxsearch").html(icon);*/
  3721. loading.css('display', 'none');
  3722. $this.doingSearch = false;
  3723. clearTimeout($this.timer);
  3724. }
  3725. });
  3726. };
  3727.  
  3728. //do search...
  3729. this.bind_ev();
  3730. },
  3731.  
  3732. dropdownToggle: function () {
  3733.  
  3734. $(".navbar").on("mouseenter", ".kleo-toggle-menu", function () {
  3735. clearTimeout($(this).data('timeout'));
  3736. $('.kleo-toggle-submenu').fadeOut(50);
  3737.  
  3738. $(this).find('.kleo-toggle-submenu').fadeIn(50);
  3739.  
  3740. });
  3741. $(".navbar").on("mouseleave", ".kleo-toggle-menu", function () {
  3742. var $this = $(this);
  3743. var t = setTimeout(function () {
  3744. $this.find('.kleo-toggle-submenu').fadeOut(50);
  3745. }, 400);
  3746. $(this).attr('data-timeout', t);
  3747. });
  3748.  
  3749. }
  3750. };
  3751.  
  3752.  
  3753. /***************************************************
  3754. Parallax
  3755. ***************************************************/
  3756. var parallax = {
  3757. init: function () {
  3758.  
  3759. if ($window.width() > 1024) {
  3760.  
  3761. $('.bg-parallax').each(function () {
  3762. // assigning the object
  3763. var $bgobj = $(this);
  3764.  
  3765. $window.scroll(function () {
  3766. // Scroll the background at var speed
  3767. // the yPos is a negative value because we're scrolling it UP!
  3768. var yPos = -(($window.scrollTop() - $bgobj.offset().top) / ($bgobj.data('prlx-speed') * 100 ) );
  3769.  
  3770. // Put together our final background position
  3771. var coords = '50% ' + yPos + 'px';
  3772.  
  3773. // Move the background
  3774. $bgobj.css({backgroundPosition: coords});
  3775. });
  3776. // window scroll Ends
  3777. });
  3778.  
  3779. parallax.changeSizes();
  3780. }
  3781. },
  3782.  
  3783. changeSizes: function () {
  3784.  
  3785. // Wait until the video meta data has loaded
  3786. $('.bg-full-video video').on('loadedmetadata', function () {
  3787.  
  3788. var adjSize, $width, $height, // Width and height of screen
  3789. $this = $(this),
  3790. $content = $this.closest(".bg-full-video").find(".section-container"),
  3791. $vidwidth = this.videoWidth, // Width of video (actual width)
  3792. $vidheight = this.videoHeight, // Height of video (actual height)
  3793. $aspectRatio = $vidwidth / $vidheight; // The ratio the video's height and width are in
  3794.  
  3795. (adjSize = function () { // Create function called adjSize
  3796.  
  3797. var $width = $content.width(); // Width of the screen
  3798. var $height = $content.height(); // Height of the screen
  3799.  
  3800. var $boxRatio = $width / $height; // The ratio the screen is in
  3801.  
  3802. var $adjRatio = $aspectRatio / $boxRatio; // The ratio of the video divided by the screen size
  3803.  
  3804. if ($boxRatio < $aspectRatio) { // If the screen ratio is less than the aspect ratio..
  3805. // Set the width of the video to the screen size multiplied by $adjRatio
  3806. $this.css({'width': $width * $adjRatio + 'px'});
  3807. } else {
  3808. // Else just set the video to the width of the screen/container
  3809. $this.css({'width': $width + 'px'});
  3810. }
  3811.  
  3812. })(); // Run function immediately
  3813.  
  3814. // Run function also on window resize.
  3815. $window.on("debouncedresize", adjSize);
  3816.  
  3817. });
  3818.  
  3819.  
  3820. }
  3821. };
  3822.  
  3823.  
  3824. /***************************************************
  3825. Quick Contact Form
  3826. ***************************************************/
  3827. $(".kleo-quick-contact-wrapper").click(function (event) {
  3828. if (event.stopPropagation) {
  3829. event.stopPropagation();
  3830. }
  3831. else if (window.event) {
  3832. window.event.cancelBubble = true;
  3833. }
  3834. });
  3835. $("html").click(function () {
  3836. $(this).find("#kleo-quick-contact").fadeOut(300);
  3837. $('.kleo-quick-contact-link').removeClass('quick-contact-active');
  3838. });
  3839.  
  3840. $('.kleo-quick-contact-link').on('click', function () {
  3841. if (!$(this).hasClass('quick-contact-active')) {
  3842. $('#kleo-quick-contact').fadeIn(300);
  3843. $(this).addClass('quick-contact-active');
  3844. } else {
  3845. $('#kleo-quick-contact').fadeOut(300);
  3846. $(this).removeClass('quick-contact-active');
  3847. }
  3848. return false;
  3849. });
  3850.  
  3851. $('.kleo-contact-form').submit(ajaxSubmit);
  3852. function ajaxSubmit() {
  3853. var thiss = $(this);
  3854. var customerForm = thiss.serialize();
  3855. thiss.find(".kleo-contact-success").html('');
  3856. thiss.find(".kleo-contact-loading").show();
  3857.  
  3858. $.ajax({
  3859. type: "POST",
  3860. url: kleoFramework.ajaxurl,
  3861. data: customerForm,
  3862. success: function (data) {
  3863. thiss.find(".kleo-contact-loading").hide();
  3864. thiss.find(".kleo-contact-success").html(data);
  3865. if (thiss.find(".mail-success").length) {
  3866. thiss.find("input[type=text], input[type=email], textarea").val('');
  3867. }
  3868. },
  3869. error: function (errorThrown) {
  3870. alert(errorThrown);
  3871. }
  3872. });
  3873. return false;
  3874.  
  3875. }
  3876.  
  3877.  
  3878. $.fn.kleo_enable_media = function (options) {
  3879. var defaults = {};
  3880. var options = $.extend(defaults, options);
  3881.  
  3882. return this.each(function () {
  3883. var el = $(this);
  3884.  
  3885. el.mediaelementplayer({
  3886. // if the <video width> is not specified, this is the default
  3887. defaultVideoWidth: 480,
  3888. // if the <video height> is not specified, this is the default
  3889. defaultVideoHeight: 270,
  3890. // if set, overrides <video width>
  3891. videoWidth: -1,
  3892. // if set, overrides <video height>
  3893. videoHeight: -1,
  3894. // width of audio player
  3895. audioWidth: "100%",
  3896. // height of audio player
  3897. audioHeight: 30,
  3898. // initial volume when the player starts
  3899. startVolume: 0.8,
  3900. // useful for <audio> player loops
  3901. loop: false,
  3902. // enables Flash and Silverlight to resize to content size
  3903. enableAutosize: true,
  3904. // the order of controls you want on the control bar (and other plugins below)
  3905. features: ['playpause', 'progress', 'duration', 'volume', 'fullscreen'],
  3906. // Hide controls when playing and mouse is not over the video
  3907. alwaysShowControls: false,
  3908. // force iPad's native controls
  3909. iPadUseNativeControls: false,
  3910. // force iPhone's native controls
  3911. iPhoneUseNativeControls: false,
  3912. // force Android's native controls
  3913. AndroidUseNativeControls: false,
  3914. // forces the hour marker (##:00:00)
  3915. alwaysShowHours: false,
  3916. // show framecount in timecode (##:00:00:00)
  3917. showTimecodeFrameCount: false,
  3918. // used when showTimecodeFrameCount is set to true
  3919. framesPerSecond: 25,
  3920. // turns keyboard support on and off for this instance
  3921. enableKeyboard: true,
  3922. // when this player starts, it will pause other players
  3923. pauseOtherPlayers: true,
  3924. // array of keyboard commands
  3925. keyActions: [],
  3926. /*mode: 'shim'*/
  3927. success: function (mediaElement, domObject) {
  3928.  
  3929. // add event listener
  3930. mediaElement.addEventListener('loadedmetadata', function (e) {
  3931.  
  3932. if ($(domObject).closest(".kleo-masonry").length) {
  3933. kleoIsotope.applyGridIsotpe(kleoIsotope.container);
  3934. }
  3935. }, false);
  3936.  
  3937. }
  3938.  
  3939.  
  3940. });
  3941. });
  3942. };
  3943.  
  3944. $.fn.visible = function () {
  3945. return this.css('visibility', 'visible');
  3946. };
  3947.  
  3948. $.fn.invisible = function () {
  3949. return this.css('visibility', 'hidden');
  3950. };
  3951.  
  3952. $.fn.visibilityToggle = function () {
  3953. return this.css('visibility', function (i, visibility) {
  3954. return (visibility == 'visible') ? 'hidden' : 'visible';
  3955. });
  3956. };
  3957.  
  3958. /***************************************************
  3959. GLOBAL VARIABLES
  3960. ***************************************************/
  3961. var $window = $(window),
  3962. body = $('body'),
  3963. deviceAgent = navigator.userAgent.toLowerCase(),
  3964. isMobile = deviceAgent.match(/(iphone|ipod|ipad|android|iemobile)/);
  3965.  
  3966.  
  3967. /***************************************************
  3968. LOAD AND READY FUNCTION
  3969. ***************************************************/
  3970. var onReady = {
  3971. init: function () {
  3972. kleoPage.init();
  3973. kleoHeader.init();
  3974.  
  3975. parallax.init();
  3976.  
  3977. kleoIsotope.init();
  3978. bP.init();
  3979. kleoShop.init();
  3980.  
  3981. activate_waypoints();
  3982. activate_shortcode_scripts();
  3983.  
  3984.  
  3985. /* Focus search Bp directory*/
  3986.  
  3987. $("#buddypress div#group-dir-search input[type=text], #buddypress div#members-dir-search input[type=text]")
  3988. .focusin(function () {
  3989. $(this).closest("form").css("min-width", "90%");
  3990. });
  3991. $("#buddypress div#group-dir-search input[type=text], #buddypress div#members-dir-search input[type=text]")
  3992. .focusout(function () {
  3993. $(this).closest("form").css("min-width", "60%");
  3994. });
  3995.  
  3996.  
  3997. }
  3998. };
  3999.  
  4000. var onLoad = {
  4001. init: function () {
  4002.  
  4003. }
  4004. };
  4005.  
  4006. kleoPage.notReadyInit();
  4007. jQuery(document).ready(onReady.init);
  4008. jQuery(window).load(onLoad.init);
  4009.  
  4010.  
  4011.  
  4012.  
  4013. })(jQuery);
  4014.  
  4015. function kleoSetCookie(cname, cvalue, path, exdays) {
  4016. if (typeof path === 'undefined') {
  4017. path = '/';
  4018. }
  4019. var d = new Date();
  4020. d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  4021. var expires = "expires=" + d.toUTCString();
  4022. document.cookie = cname + "=" + cvalue + "; " + expires + "; path=" + path;
  4023. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement