Advertisement
rdusnr

Untitled

Feb 27th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 156.04 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. $('a.kleo-login-switch').on('click', function () {
  1561. var thisParent = $(this).parent().parent().parent();
  1562. thisParent.find('.lostpass-form-inline').slideUp(100, function () {
  1563. thisParent.find('.login-form-inline').slideDown(400);
  1564. });
  1565. return false;
  1566. });
  1567.  
  1568. $('a.kleo-lostpass-switch').on('click', function () {
  1569. var thisParent = $(this).parent().parent().parent();
  1570. thisParent.find('.login-form-inline').slideUp(100, function () {
  1571. thisParent.find('.lostpass-form-inline').slideDown(400)
  1572. });
  1573. return false;
  1574. });
  1575.  
  1576. /* Equal column heights fallback */
  1577. kleoPage.flexFallback();
  1578.  
  1579. /* Blog switch layout */
  1580. kleoPage.switchBlogLayout();
  1581.  
  1582.  
  1583. },
  1584. refreshContentTabs: function (el) {
  1585.  
  1586. //compatibility with multiple modules
  1587. $(window).trigger('resize');
  1588.  
  1589. //carousels
  1590. //$('.kleo-carousel, .kleo-banner-items').trigger('updateSizes');
  1591. //masonry
  1592. //kleoIsotope.init();
  1593.  
  1594. //google maps
  1595. /* var $google_maps = $(el).find(".wpb_gmaps_widget");
  1596. if ($google_maps.length && !$google_maps.is('.map_ready')) {
  1597. var $google_maps_frame = $google_maps.find('iframe');
  1598. $google_maps_frame.attr('src', $google_maps_frame.attr('src'));
  1599. $google_maps.addClass('map_ready');
  1600. }*/
  1601.  
  1602. //pie & line & round charts
  1603. var panel = $('.kleo-tabs, .panel-body');
  1604. var $pie_charts = panel.find(".vc_pie_chart:not(.vc_ready)"),
  1605. $round_charts = panel.find(".vc_round-chart"),
  1606. $line_charts = panel.find(".vc_line-chart");
  1607.  
  1608. if ($pie_charts.length && jQuery.fn.vcChat) {
  1609. $pie_charts.vcChat();
  1610. }
  1611. if ($round_charts.length && jQuery.fn.vcRoundChart) {
  1612. $round_charts.vcRoundChart({reload: !1});
  1613. }
  1614. if ($line_charts.length && jQuery.fn.vcLineChart) {
  1615. $line_charts.vcLineChart({reload: !1});
  1616. }
  1617.  
  1618.  
  1619. },
  1620. openTabHash: function () {
  1621. /* Open the tab or accordion */
  1622. var hash = location.hash,
  1623. hashPieces = hash.split('?'),
  1624. prefix = "link_";
  1625.  
  1626. if (hash && hash != '') {
  1627. var activeTab = $('.nav-tabs a[href="' + hashPieces[0].replace(prefix, "") + '"]');
  1628. var activeTour = $('.nav-tab a[href="' + hashPieces[0].replace(prefix, "") + '"]');
  1629. var activeToggle = $('.panel-group a[href="' + hashPieces[0].replace(prefix, "") + '"]');
  1630.  
  1631. if (activeTab.length) {
  1632. activeTab.tab('show');
  1633. }
  1634. if (activeTour.length) {
  1635. activeTour.tab('show');
  1636. }
  1637. if (activeToggle.length) {
  1638. if (!activeToggle.hasClass("collapsed")) {
  1639. activeToggle.trigger('click');
  1640. }
  1641. }
  1642. }
  1643.  
  1644. /* Change the hash on tab/accordion open */
  1645.  
  1646. var tabs = $('.nav-tabs a, .nav-tab a'),
  1647. panels = $('.panel-group .panel-collapse');
  1648.  
  1649. // for tabs
  1650. tabs.on('shown.bs.tab', function (e) {
  1651. window.location.hash = e.target.hash.replace("#", "#" + prefix);
  1652. });
  1653. tabs.on('hidden.bs.tab', function (e) {
  1654. history.pushState("", document.title, window.location.pathname + window.location.search);
  1655. });
  1656. // for accordion
  1657. panels.on('shown.bs.collapse', function (e) {
  1658. if ($(this).attr('id')) {
  1659. window.location.hash = "#" + prefix + $(this).attr('id');
  1660. }
  1661. });
  1662. panels.on('hidden.bs.collapse', function (e) {
  1663. history.pushState("", document.title, window.location.pathname + window.location.search);
  1664. });
  1665. },
  1666.  
  1667. portfolioVideo: function () {
  1668. var elements = $(".porto-video .kleo-video-embed");
  1669. elements.height(function () {
  1670. var elHeight = 160;
  1671. //console.log(kleoFramework.portfolioVideoHeight);
  1672. if (kleoFramework.hasOwnProperty('portfolioVideoHeight') && kleoFramework.portfolioVideoHeight != 0) {
  1673. elHeight = kleoFramework.portfolioVideoHeight;
  1674. }
  1675. var image = $(this).closest(".portfolio-items").find('.portfolio-image img, .kleo-banner-slider img').eq(0);
  1676. return image.length && image.height() > 50 ? image.height() : elHeight;
  1677. });
  1678. },
  1679.  
  1680. notReadyInit: function () {
  1681. //Preload logo
  1682. kleoHeader.loadLogoImg();
  1683.  
  1684. $('.responsive-tabs, .nav-pills, .top-menu > ul, #top-social > ul').tabdrop();
  1685.  
  1686. },
  1687.  
  1688. // Sidebar menu toggle
  1689. kleoMenuWidget: function () {
  1690. var submenuParent = jQuery(".widget_nav_menu ul.sub-menu").parent('li');
  1691. submenuParent.addClass('parent');
  1692. submenuParent.children("a").append('<span class="caret"></span>');
  1693. submenuParent.find(".caret").click(function () {
  1694. jQuery(this).closest(".parent").children('.sub-menu').stop(true, true).slideToggle('fast');
  1695. jQuery(this).toggleClass('active');
  1696. return false;
  1697. });
  1698. },
  1699.  
  1700. adjustHeights: function (elem) {
  1701. var fontstep = 2;
  1702. if ($(elem).height() > $(elem).parent().height() || $(elem).width() > $(elem).parent().width()) {
  1703. $(elem).css('font-size', (($(elem).css('font-size').substr(0, 2) - fontstep)) + 'px').css('line-height', (($(elem).css('font-size').substr(0, 2))) + 'px');
  1704. adjustHeights(elem);
  1705. }
  1706. },
  1707.  
  1708. removeOverflowHidden: function () {
  1709.  
  1710. $('body').on('click', function () {
  1711. if ($('#buddypress .tabdrop').hasClass('open')) {
  1712. $('#buddypress div#item-nav').css('overflow', 'hidden');
  1713. }
  1714. });
  1715.  
  1716. $('.item-list-tabs .dropdown-toggle').on('click', function () {
  1717. if ($('#buddypress .tabdrop').hasClass('open')) {
  1718. $('#buddypress div#item-nav').css('overflow', 'hidden');
  1719. }
  1720. else {
  1721. $('#buddypress div#item-nav').css('overflow', 'visible');
  1722. }
  1723. });
  1724.  
  1725. },
  1726.  
  1727. bannerSlider: function () {
  1728.  
  1729. $('.kleo-banner-slider').animate({"opacity": "1"}, 700);
  1730.  
  1731. $('.kleo-banner-slider').each(function () {
  1732. var thisSliderItems = $(this).find('.kleo-banner-items');
  1733. var $prev = $(this).find(".kleo-banner-prev");
  1734. var $next = $(this).find(".kleo-banner-next");
  1735. var $duration = 2000;
  1736.  
  1737. if (thisSliderItems.data("speed")) {
  1738. $duration = parseInt(thisSliderItems.data("speed"));
  1739. }
  1740.  
  1741. thisSliderItems.imagesLoaded(function () {
  1742. thisSliderItems.carouFredSel({
  1743. //auto: false,
  1744. responsive: true,
  1745. circular: false,
  1746. infinite: true,
  1747. auto: {
  1748. play: true,
  1749. pauseDuration: 0,
  1750. duration: $duration
  1751. },
  1752. scroll: {
  1753. items: 1,
  1754. duration: 600,
  1755. //fx: "crossfade",
  1756. easing: "easeInOutExpo",
  1757. wipe: true
  1758. },
  1759. //padding: 0,
  1760. prev: $prev,
  1761. next: $next,
  1762. items: {
  1763. height: 'variable',
  1764. visible: 1
  1765. }
  1766. });
  1767. thisSliderItems.swipe({
  1768. excludedElements: "",
  1769. threshold: 40,
  1770. swipeLeft: function () {
  1771. thisSliderItems.trigger('next', 1);
  1772. setTimeout(function () {
  1773. thisSliderItems.trigger('updateSizes');
  1774. }, 600);
  1775. },
  1776. swipeRight: function () {
  1777. thisSliderItems.trigger('prev', 1);
  1778. setTimeout(function () {
  1779. thisSliderItems.trigger('updateSizes');
  1780. }, 600);
  1781. },
  1782. });
  1783. });
  1784. });
  1785.  
  1786. },
  1787.  
  1788. carouselItems: function () {
  1789.  
  1790. $('.kleo-carousel-items').each(function () {
  1791. // Load Carousel options into variables
  1792. var $currentCrslPrnt = $(this);
  1793. var $currentCrsl = $currentCrslPrnt.children('.kleo-carousel');
  1794. var $prev = $currentCrslPrnt.closest('.kleo-carousel-container').find(".carousel-arrow .carousel-prev");
  1795. var $next = $currentCrslPrnt.closest('.kleo-carousel-container').find(".carousel-arrow .carousel-next");
  1796. var $pagination = $currentCrslPrnt.closest('.kleo-carousel-container').find(".kleo-carousel-pager");
  1797.  
  1798. var $visible,
  1799. $items_height = 'auto',
  1800. $items_width = null,
  1801. $auto_play = false,
  1802. $auto_pauseOnHover = 'resume',
  1803. $scroll_fx = 'scroll',
  1804. $duration = 2000;
  1805.  
  1806. if ($currentCrslPrnt.data("pager")) {
  1807. $pagination = $currentCrslPrnt.closest('.kleo-carousel-container').find($currentCrslPrnt.data("pager"));
  1808. }
  1809. if ($currentCrslPrnt.data("autoplay")) {
  1810. $auto_play = true;
  1811. }
  1812. if ($currentCrslPrnt.data("speed")) {
  1813. $duration = parseInt($currentCrslPrnt.data("speed"));
  1814. }
  1815. if ($currentCrslPrnt.data("items-height")) {
  1816. $items_height = $currentCrslPrnt.data("items-height");
  1817. }
  1818. if ($currentCrslPrnt.data("items-width")) {
  1819. $items_width = $currentCrslPrnt.data("items-width");
  1820. }
  1821. if ($currentCrslPrnt.data("scroll-fx")) {
  1822. $scroll_fx = $currentCrslPrnt.data("scroll-fx");
  1823. }
  1824.  
  1825. if ($currentCrslPrnt.data("min-items") && $currentCrslPrnt.data("max-items")) {
  1826. $visible = {
  1827. min: $currentCrslPrnt.data("min-items"),
  1828. max: $currentCrslPrnt.data("max-items")
  1829. };
  1830. }
  1831. // Apply common carousel options
  1832. $currentCrsl.imagesLoaded(function () {
  1833. $currentCrsl.carouFredSel({
  1834. responsive: true,
  1835. width: '100%',
  1836. pagination: $pagination,
  1837. prev: $prev,
  1838. next: $next,
  1839. auto: {
  1840. play: $auto_play,
  1841. pauseOnHover: $auto_pauseOnHover
  1842. },
  1843. scroll: {
  1844. items: 1,
  1845. duration: 600,
  1846. fx: $scroll_fx,
  1847. easing: "swing",
  1848. timeoutDuration: $duration,
  1849. wipe: true
  1850. },
  1851. items: {
  1852. width: $items_width,
  1853. height: $items_height,
  1854. visible: $visible
  1855. }
  1856. }).visible();
  1857. $currentCrsl.swipe({
  1858. excludedElements: "",
  1859. threshold: 40,
  1860. swipeLeft: function () {
  1861. $currentCrsl.trigger('next', 1);
  1862. setTimeout(function () {
  1863. $currentCrsl.trigger('updateSizes');
  1864. }, 600);
  1865. },
  1866. swipeRight: function () {
  1867. $currentCrsl.trigger('prev', 1);
  1868. setTimeout(function () {
  1869. $currentCrsl.trigger('updateSizes');
  1870. }, 600);
  1871.  
  1872. },
  1873. });
  1874. });
  1875. });
  1876.  
  1877. if ($(".kleo-thumbs-carousel").length) {
  1878. $(".kleo-thumbs-carousel").each(function () {
  1879. var $thumbsCarousel = $(this),
  1880. $thumbsVisible = 6,
  1881. $circular = false;
  1882.  
  1883. if ($thumbsCarousel.data("min-items") && $thumbsCarousel.data("max-items")) {
  1884. $thumbsVisible = {
  1885. min: $thumbsCarousel.data("min-items"),
  1886. max: $thumbsCarousel.data("max-items")
  1887. };
  1888. }
  1889. if ($thumbsCarousel.data("circular")) {
  1890. $circular = true;
  1891. }
  1892.  
  1893. $thumbsCarousel.imagesLoaded(function () {
  1894. $thumbsCarousel.carouFredSel({
  1895. responsive: true,
  1896. circular: $circular,
  1897. infinite: true,
  1898. auto: false,
  1899. prev: {
  1900. button: function () {
  1901. return $(this).parents('.kleo-gallery').find('.kleo-thumbs-prev');
  1902. }
  1903. },
  1904. next: {
  1905. button: function () {
  1906. return $(this).parents('.kleo-gallery').find('.kleo-thumbs-next');
  1907. }
  1908. },
  1909. scroll: {
  1910. items: 1
  1911. },
  1912. items: {
  1913. height: 'auto',
  1914. visible: $thumbsVisible
  1915. }
  1916. });
  1917. $thumbsCarousel.swipe({
  1918. excludedElements: "",
  1919. threshold: 40,
  1920. swipeLeft: function () {
  1921. $thumbsCarousel.trigger('next', 1);
  1922. setTimeout(function () {
  1923. $thumbsCarousel.trigger('updateSizes');
  1924. }, 600);
  1925. },
  1926. swipeRight: function () {
  1927. $thumbsCarousel.trigger('prev', 1);
  1928. setTimeout(function () {
  1929. $thumbsCarousel.trigger('updateSizes');
  1930. }, 600);
  1931. }
  1932. });
  1933. });
  1934. });
  1935. }
  1936.  
  1937. $('.kleo-thumbs-carousel a').click(function (e) {
  1938. $(this).closest('.kleo-gallery-container').find('.kleo-gallery-image').trigger('slideTo', '#' + this.href.split('#').pop());
  1939. $('.kleo-thumbs-carousel a').removeClass('selected');
  1940. $(this).addClass('selected');
  1941. e.preventDefault();
  1942. return false;
  1943. });
  1944.  
  1945. var kleoGalleryImage = $(".kleo-gallery-image");
  1946.  
  1947. if (kleoGalleryImage.length) {
  1948. kleoGalleryImage.imagesLoaded(function () {
  1949. kleoGalleryImage.carouFredSel({
  1950. responsive: true,
  1951. circular: false,
  1952. auto: false,
  1953. items: {
  1954. height: 'variable',
  1955. visible: 1
  1956. },
  1957. scroll: {
  1958. items: 1,
  1959. fx: 'crossfade'
  1960. }
  1961. });
  1962. kleoGalleryImage.swipe({
  1963. excludedElements: "",
  1964. threshold: 40,
  1965. swipeLeft: function () {
  1966. $('.kleo-gallery-image').trigger('next', 1);
  1967. setTimeout(function () {
  1968. $('.kleo-gallery-image').trigger('updateSizes');
  1969. }, 600);
  1970. },
  1971. swipeRight: function () {
  1972. $('.kleo-gallery-image').trigger('prev', 1);
  1973. setTimeout(function () {
  1974. $('.kleo-gallery-image').trigger('updateSizes');
  1975. }, 600);
  1976. }
  1977. });
  1978. });
  1979. }
  1980.  
  1981. },
  1982.  
  1983. rtMediaslider: function () {
  1984.  
  1985. //jQuery('.rtmedia-activity-container').animate({"opacity": "1"}, 700);
  1986. $('.rtmedia-activity-container').each(function () {
  1987.  
  1988. if ($(this).find(".rtmedia-list .media-type-photo").length < 1) {
  1989. return true;
  1990. }
  1991. $(this).append('<div class="activity-feed-prev">&nbsp;</div><div class="activity-feed-next">&nbsp;</div>');
  1992.  
  1993. var $prev = $(this).find(".activity-feed-prev");
  1994. var $next = $(this).find(".activity-feed-next");
  1995. var thisSliderItems = $(this).find('.rtmedia-list');
  1996.  
  1997. thisSliderItems.imagesLoaded(function () {
  1998. thisSliderItems.carouFredSel({
  1999. //auto: false,
  2000. responsive: true,
  2001. circular: false,
  2002. auto: {
  2003. play: true,
  2004. pauseDuration: 0,
  2005. duration: 2000
  2006. },
  2007. scroll: {
  2008. items: 1,
  2009. duration: 600,
  2010. //fx: "crossfade",
  2011. easing: "easeInOutExpo",
  2012. wipe: true
  2013. },
  2014. //padding: 0,
  2015. prev: $prev,
  2016. next: $next,
  2017. items: {
  2018. height: 'auto',
  2019. visible: {
  2020. min: 1,
  2021. max: 4
  2022. }
  2023. }
  2024. });
  2025. thisSliderItems.swipe({
  2026. excludedElements: "",
  2027. threshold: 40,
  2028. swipeLeft: function () {
  2029. thisSliderItems.trigger('next', 1);
  2030. setTimeout(function () {
  2031. thisSliderItems.trigger('updateSizes');
  2032. }, 600);
  2033. },
  2034. swipeRight: function () {
  2035. thisSliderItems.trigger('prev', 1);
  2036. setTimeout(function () {
  2037. thisSliderItems.trigger('updateSizes');
  2038. }, 600);
  2039. },
  2040. });
  2041. });
  2042. });
  2043.  
  2044. },
  2045.  
  2046. newsTicker: function () {
  2047.  
  2048. var _newsScroll = {
  2049. delay: 1000,
  2050. easing: 'linear',
  2051. items: 1,
  2052. duration: 0.07,
  2053. timeoutDuration: 0,
  2054. pauseOnHover: 'immediate'
  2055. };
  2056. $('.news-ticker').each(function () {
  2057. $(this).carouFredSel({
  2058. width: 1000,
  2059. align: false,
  2060. items: {
  2061. width: 'variable',
  2062. /*height: 35,*/
  2063. visible: 1
  2064. },
  2065. scroll: _newsScroll
  2066. });
  2067. $(this).closest('.caroufredsel_wrapper').css('width', '100%');
  2068. });
  2069.  
  2070. },
  2071.  
  2072. initPins: function () {
  2073.  
  2074. $(".kleo-pin-circle, .kleo-pin-poi, .kleo-pin-icon").each(function () {
  2075. var $length = "";
  2076.  
  2077. if ($(this).is('[data-top]')) {
  2078. $(this).css({"top": $(this).attr('data-top') + $length});
  2079. }
  2080. if ($(this).is('[data-left]')) {
  2081. $(this).css({"left": $(this).attr('data-left') + $length});
  2082. }
  2083. if ($(this).is('[data-right]')) {
  2084. $(this).css({"right": $(this).attr('data-right') + $length});
  2085. }
  2086. if ($(this).is('[data-bottom]')) {
  2087. $(this).css({"bottom": $(this).attr('data-bottom') + $length});
  2088. }
  2089.  
  2090. });
  2091.  
  2092. },
  2093.  
  2094. /***************************************************
  2095. Go To Top Link
  2096. ***************************************************/
  2097. goTop: function () {
  2098. $(window).scroll(function () {
  2099. if ($(this).scrollTop() > 500) {
  2100. $('.kleo-go-top, .kleo-quick-contact-wrapper').removeClass('off').addClass('on');
  2101. }
  2102. else {
  2103. $('.kleo-go-top, .kleo-quick-contact-wrapper').removeClass('on').addClass('off');
  2104. }
  2105. });
  2106.  
  2107. $('.kleo-go-top, .divider-go-top').click(function () {
  2108. $("html, body").animate({
  2109. scrollTop: 0
  2110. }, 800);
  2111. return false;
  2112. });
  2113.  
  2114. $('.kleo-classic-comments').click(function () {
  2115. $("html, body").animate({
  2116. scrollTop: $('#comments').offset().top
  2117. }, 800);
  2118.  
  2119. });
  2120. },
  2121.  
  2122.  
  2123. magnificPopupModals: function () {
  2124.  
  2125. /* Login modal */
  2126.  
  2127. /* On specific URL*/
  2128. if (window.location.hash) {
  2129. var myHash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
  2130. if (myHash == 'show-login' && !$("body").hasClass('logged-in')) {
  2131. $.magnificPopup.open({
  2132. items: {
  2133. src: '#kleo-login-modal',
  2134. type: 'inline',
  2135. focus: '#username'
  2136. },
  2137. preloader: false,
  2138. mainClass: 'kleo-mfp-zoom'
  2139.  
  2140. });
  2141. }
  2142. }
  2143.  
  2144.  
  2145. $('.kleo-show-login, .bp-menu.bp-login-nav a, .must-log-in > a').magnificPopup({
  2146. items: {
  2147. src: '#kleo-login-modal',
  2148. type: 'inline',
  2149. focus: '#username'
  2150. },
  2151. preloader: false,
  2152. mainClass: 'kleo-mfp-zoom',
  2153.  
  2154. // When element is focused, some mobile browsers in some cases zoom in
  2155. // It looks not nice, so we disable it:
  2156. callbacks: {
  2157. beforeOpen: function () {
  2158. if ($(window).width() < 700) {
  2159. this.st.focus = false;
  2160. } else {
  2161. this.st.focus = '#username';
  2162. }
  2163. }
  2164. }
  2165. });
  2166.  
  2167. /* Lost Pass modal */
  2168. $('.kleo-show-lostpass').magnificPopup({
  2169. items: {
  2170. src: '#kleo-lostpass-modal',
  2171. type: 'inline',
  2172. focus: '#forgot-email'
  2173. },
  2174. preloader: false,
  2175. mainClass: 'kleo-mfp-zoom',
  2176.  
  2177. // When elemened is focused, some mobile browsers in some cases zoom in
  2178. // It looks not nice, so we disable it:
  2179. callbacks: {
  2180. beforeOpen: function () {
  2181. if ($(window).width() < 700) {
  2182. this.st.focus = false;
  2183. } else {
  2184. this.st.focus = '#forgot-email';
  2185. }
  2186. }
  2187. }
  2188. });
  2189.  
  2190. /* Register modal */
  2191. $('.kleo-show-register').magnificPopup({
  2192. items: {
  2193. src: '#kleo-register-modal',
  2194. type: 'inline',
  2195. focus: '#reg-username'
  2196. },
  2197. preloader: false,
  2198. mainClass: 'kleo-mfp-zoom',
  2199.  
  2200. // When elemened is focused, some mobile browsers in some cases zoom in
  2201. // It looks not nice, so we disable it:
  2202. callbacks: {
  2203. beforeOpen: function () {
  2204. if ($(window).width() < 700) {
  2205. this.st.focus = false;
  2206. } else {
  2207. this.st.focus = '#reg-username';
  2208. }
  2209. }
  2210. }
  2211. });
  2212. },
  2213. magnificPopupGallery: function () {
  2214.  
  2215. /* Regular popup images */
  2216. $("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({
  2217. type: 'image',
  2218. mainClass: 'mfp-img-pop',
  2219. gallery: {
  2220. enabled: true
  2221. },
  2222. image: {
  2223. titleSrc: function(item) {
  2224. if($(item.el).next('figcaption').length){
  2225. return $(item.el).next('figcaption').html();
  2226. } else if($(item.el).attr('data-caption')) {
  2227. return $(item.el).data('caption');
  2228. } else {
  2229. return '';
  2230. }
  2231. }
  2232.  
  2233. // this tells the script which attribute has your caption
  2234. }
  2235. });
  2236.  
  2237. /* Galleries */
  2238.  
  2239. 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]";
  2240.  
  2241. $('.gallery, .modal-gallery, .kleo-gallery:not(.kleo-no-popup), .kleo-gallery-grid').each(function () {
  2242. if ($(this).find(modalElements).length && $(this).find(modalElements).has('img')) {
  2243. $(this).magnificPopup({
  2244. delegate: modalElements,
  2245. type: 'image',
  2246. mainClass: 'mfp-gallery-pop',
  2247. navigateByImgClick: true,
  2248. gallery: {
  2249. enabled: true,
  2250. navigateByImgClick: true,
  2251. preload: [0, 1]
  2252. }
  2253. });
  2254. }
  2255. });
  2256. },
  2257.  
  2258. doingLikesRequest: false,
  2259. likes: function () {
  2260. $('#main-container').on('click', '.item-likes', function () {
  2261. var link = $(this);
  2262.  
  2263. if (link.hasClass('liked') || kleoPage.doingLikesRequest === true) {
  2264. return false;
  2265. }
  2266.  
  2267. var id = $(this).attr('id'),
  2268. postfix = link.find('.item-likes-postfix').text();
  2269.  
  2270. $.ajax({
  2271. type: 'POST',
  2272. url: kleoFramework.ajaxurl,
  2273. data: {
  2274. action: 'item-likes',
  2275. likes_id: id,
  2276. postfix: postfix
  2277. },
  2278. beforeSend: function () {
  2279. kleoPage.doingLikesRequest = true;
  2280. },
  2281. success: function (data) {
  2282. link.html(data).addClass('liked').attr('title', kleoFramework.alreadyLiked);
  2283. },
  2284. complete: function () {
  2285. kleoPage.doingLikesRequest = false;
  2286. }
  2287. });
  2288.  
  2289. return false;
  2290. });
  2291.  
  2292. if ($('body.ajax-item-likes').length) {
  2293. $('.item-likes').each(function () {
  2294. var id = $(this).attr('id');
  2295. $(this).load(kleoFramework.ajaxurl, {action: 'item-likes', post_id: id});
  2296. });
  2297. }
  2298. },
  2299. getURLParameters: function (url) {
  2300.  
  2301. var result = {};
  2302. var searchIndex = url.indexOf("?");
  2303. if (searchIndex == -1) return result;
  2304. var sPageURL = url.substring(searchIndex + 1);
  2305. var sURLVariables = sPageURL.split('&');
  2306. for (var i = 0; i < sURLVariables.length; i++) {
  2307. var sParameterName = sURLVariables[i].split('=');
  2308. result[sParameterName[0]] = sParameterName[1];
  2309. }
  2310. return result;
  2311. },
  2312.  
  2313. /* Progress bar */
  2314. progressBar: function () {
  2315.  
  2316. if (typeof jQuery.fn.waypoint !== 'undefined') {
  2317. $('.vc_progress_bar').waypoint(function () {
  2318. $(this).find('.vc_single_bar').each(function (index) {
  2319. var $this = $(this),
  2320. bar = $this.find('.vc_bar'),
  2321. val = bar.data('percentage-value');
  2322.  
  2323. setTimeout(function () {
  2324. bar.css({"width": val + '%'});
  2325. }, index * 200);
  2326. });
  2327. }, {offset: '85%'});
  2328. }
  2329. },
  2330. kleoAjaxLogin: function () {
  2331. $('form#login_form').on('submit', function (e) {
  2332. $('#kleo-login-result').show().html(kleoFramework.loadingmessage);
  2333. $.ajax({
  2334. type: 'POST',
  2335. dataType: 'json',
  2336. url: kleoFramework.loginUrl,
  2337. data: {
  2338. action: 'kleoajaxlogin',
  2339. log: $('form#login_form #username').val(),
  2340. pwd: $('form#login_form #password').val(),
  2341. rememberme: ($('form#login_form #rememberme').is(':checked') ? true : false),
  2342. security: $('form#login_form #security').val()
  2343. },
  2344. success: function (data) {
  2345. $('#kleo-login-result').html(data.message);
  2346. if (data.loggedin == true) {
  2347. if (data.redirecturl == null) {
  2348. document.location.reload();
  2349. }
  2350. else {
  2351. document.location.href = data.redirecturl;
  2352. }
  2353. }
  2354. },
  2355. complete: function () {
  2356.  
  2357. },
  2358. error: function () {
  2359. $('form#login_form, #login_panel').off('submit');
  2360. $("#login_form").submit();
  2361. }
  2362. });
  2363. e.preventDefault();
  2364. });
  2365. },
  2366.  
  2367. kleoAjaxLostPass: function () {
  2368. $("#forgot_form").on("submit", function () {
  2369. $('#kleo-lost-result').show().html(kleoFramework.loadingmessage);
  2370. $.ajax({
  2371. url: kleoFramework.ajaxurl,
  2372. type: 'POST',
  2373. data: {
  2374. action: 'kleo_lost_password',
  2375. user_login: $("#forgot-email").val()
  2376. },
  2377. success: function (data) {
  2378. $('#kleo-lost-result').html(data);
  2379. },
  2380. error: function () {
  2381. $('#kleo-lost-result').html('Sorry, an error occurred.').css('color', 'red');
  2382. }
  2383.  
  2384. });
  2385. return false;
  2386. });
  2387. },
  2388. flexFallback: function () {
  2389. var s = document.body || document.documentElement, s = s.style;
  2390. if (s.webkitFlexWrap == '' || s.msFlexWrap == '' || s.flexWrap == '') return true;
  2391.  
  2392. var $list = $('#main-container > .row'),
  2393. $items = $list.find('.template-page, .sidebar'),
  2394. setHeights = function () {
  2395. $items.css('height', 'auto');
  2396.  
  2397. var perRow = Math.floor($list.width() / $items.width());
  2398. if (perRow == null || perRow < 2) return true;
  2399.  
  2400. for (var i = 0, j = $items.length; i < j; i += perRow) {
  2401. var maxHeight = 0,
  2402. $row = $items.slice(i, i + perRow);
  2403.  
  2404. $row.each(function () {
  2405. var itemHeight = parseInt($(this).outerHeight());
  2406. if (itemHeight > maxHeight) maxHeight = itemHeight;
  2407. });
  2408. $row.css('height', maxHeight);
  2409. }
  2410. };
  2411.  
  2412. setHeights();
  2413. $(window).on('resize', setHeights);
  2414. $list.find('img').on('load', setHeights);
  2415. },
  2416.  
  2417. switchBlogLayout: function() {
  2418. $('.kleo-view-switch span').each(function() {
  2419. $(this).click(function () {
  2420. var parentEl = $(this).closest('.kleo-view-switch');
  2421. var extraString = '';
  2422.  
  2423. if ( parentEl.attr('data-identifier') ) {
  2424. extraString = parentEl.data('identifier');
  2425. }
  2426. kleoSetCookie('kleo-blog-layout' + extraString , jQuery(this).data('type'), '/', 30);
  2427.  
  2428. location.reload();
  2429. });
  2430. });
  2431.  
  2432. }
  2433.  
  2434.  
  2435. };
  2436.  
  2437. KLEO.isMobile = {
  2438. Android: function () {
  2439. return navigator.userAgent.match(/Android/i);
  2440. },
  2441. BlackBerry: function () {
  2442. return navigator.userAgent.match(/BlackBerry/i);
  2443. },
  2444. iOS: function () {
  2445. return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  2446. },
  2447. Opera: function () {
  2448. return navigator.userAgent.match(/Opera Mini/i);
  2449. },
  2450. Windows: function () {
  2451. return navigator.userAgent.match(/IEMobile/i);
  2452. },
  2453. mobileWidth: function () {
  2454. if (window.matchMedia) {
  2455. return window.matchMedia('(max-width: 480px)').matches;
  2456. } else {
  2457. return $(window).innerWidth() < 465;
  2458. }
  2459.  
  2460. },
  2461. tabletWidth: function () {
  2462. if (window.matchMedia) {
  2463. return window.matchMedia('(max-width: 768px)').matches;
  2464. } else {
  2465. return $(window).innerWidth() < 753;
  2466. }
  2467. },
  2468. tabletLandscapeWidth: function () {
  2469. if (window.matchMedia) {
  2470. return window.matchMedia('(max-width: 991px)').matches;
  2471. } else {
  2472. return $(window).innerWidth() < 976;
  2473. }
  2474. },
  2475. any: function () {
  2476. return (KLEO.isMobile.Android() || KLEO.isMobile.BlackBerry() || KLEO.isMobile.iOS() || KLEO.isMobile.Opera() || KLEO.isMobile.Windows());
  2477. }
  2478. };
  2479.  
  2480. KLEO.isHighDensity = function () {
  2481. 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));
  2482. };
  2483.  
  2484. /***************************************************
  2485. Buddypress
  2486. ***************************************************/
  2487. var bP = {
  2488. rehreshID: null,
  2489.  
  2490. init: function () {
  2491. //$("#buddypress div#item-nav .responsive-tabs").css('visibility', 'visible');
  2492. $("#buddypress div#item-nav").css('background-image', 'none');
  2493.  
  2494. //Enable masonry isotope
  2495. $("body").on('gridloaded', function () {
  2496. kleoIsotope.applyGridIsotpe(".kleo-isotope");
  2497. $('.animate-when-almost-visible').kleo_waypoints({offset: '90%'});
  2498. });
  2499.  
  2500. //Activity on change events
  2501. $("body").on('bpActivityLoaded', function () {
  2502. //Init animation
  2503. $('.animate-when-almost-visible').kleo_waypoints({offset: '90%'});
  2504.  
  2505. //Init slider
  2506. kleoPage.rtMediaslider();
  2507.  
  2508. //Init fitVids
  2509. $(".activity-inner").fitVids();
  2510. });
  2511. if (typeof(rtMediaHook) != "undefined") {
  2512. rtMediaHook.register('rtmedia_after_gallery_load', function () {
  2513. $('.el-zero-fade').kleo_waypoints({offset: '90%'});
  2514. });
  2515. }
  2516.  
  2517. if ($(".kleo-notifications-nav").length) {
  2518. $(".navbar").on("click", ".kleo-notifications-nav a.mark-as-read", function (e) {
  2519. bP.notificationsRead($(this));
  2520. e.preventDefault();
  2521. });
  2522. if (kleoFramework.hasOwnProperty('bpNotificationsRefresh') && kleoFramework.bpNotificationsRefresh != '0') {
  2523. bP.notificationsRefresh();
  2524. }
  2525. }
  2526.  
  2527. },
  2528.  
  2529. notificationsRefresh: function () {
  2530.  
  2531. bP.rehreshID = setInterval(function () {
  2532.  
  2533. var values = {
  2534. action: "kleo_bp_notifications_refresh",
  2535. current: $(".kleo-notifications-nav .kleo-notifications").first().text()
  2536. };
  2537.  
  2538. $.ajax({
  2539. url: kleoFramework.ajaxurl,
  2540. type: "GET",
  2541. dataType: "json",
  2542. data: values,
  2543. success: function (response) {
  2544. if (response.status == 'success') {
  2545. if (response.count == '0') {
  2546. $('.kleo-notifications-nav .minicart-buttons').hide();
  2547. $(".kleo-notifications-nav .kleo-notifications").removeClass("new-alert").addClass("no-alert");
  2548. $(".kleo-notifications-nav .submenu-inner").removeClass("has-notif");
  2549. } else {
  2550. $(".kleo-notifications-nav").addClass("kleo-loading");
  2551. $(".kleo-notifications-nav .kleo-notifications").removeClass("no-alert").addClass("new-alert");
  2552. $(".kleo-notifications-nav .submenu-inner").addClass("has-notif");
  2553. $('.kleo-notifications-nav .minicart-buttons').show();
  2554. }
  2555.  
  2556. $(".kleo-notifications-nav .kleo-notifications").text(response.count);
  2557. $('.kleo-notifications-nav .submenu-inner').html(response.data);
  2558. } else {
  2559. //
  2560. }
  2561.  
  2562. },
  2563. complete: function () {
  2564. $(".kleo-notifications-nav").removeClass("kleo-loading");
  2565. }
  2566. });
  2567.  
  2568. }, kleoFramework.bpNotificationsRefresh);
  2569.  
  2570.  
  2571. },
  2572.  
  2573. notificationsRead: function (e) {
  2574.  
  2575. var values = {action: "kleo_bp_notification_mark_read"};
  2576.  
  2577. $.ajax({
  2578. url: kleoFramework.ajaxurl,
  2579. type: "GET",
  2580. dataType: "json",
  2581. data: values,
  2582. beforeSend: function () {
  2583. $(".kleo-notifications-nav").addClass("kleo-loading");
  2584. },
  2585. success: function (response) {
  2586. if (response.status == 'success') {
  2587. if (response.count == '0') {
  2588. $('.kleo-notifications-nav .submenu-inner').html(response.empty);
  2589. $('.kleo-notifications-nav .minicart-buttons').hide();
  2590. $(".kleo-notifications-nav .kleo-notifications").removeClass("new-alert").addClass("no-alert");
  2591. $(".kleo-notifications-nav .submenu-inner").removeClass("has-notif");
  2592. } else {
  2593. $(".kleo-notifications-nav .kleo-notifications").removeClass("no-alert").addClass("new-alert");
  2594. $(".kleo-notifications-nav .submenu-inner").addClass("has-notif");
  2595. $('.kleo-notifications-nav .minicart-buttons').show();
  2596. }
  2597. $(".kleo-notifications-nav .kleo-notifications").text(response.count);
  2598. } else {
  2599. //
  2600. }
  2601.  
  2602. },
  2603. complete: function () {
  2604. $(".kleo-notifications-nav").removeClass("kleo-loading");
  2605. }
  2606. });
  2607.  
  2608.  
  2609. }
  2610.  
  2611. };
  2612.  
  2613. /***************************************************
  2614. Woocommerce
  2615. ***************************************************/
  2616. var kleoShop = {
  2617.  
  2618. wooGalItems: [],
  2619. wooMainImg: $(".woocommerce-main-image"),
  2620.  
  2621. init: function () {
  2622.  
  2623. kleoShop.productQuickView();
  2624. kleoShop.removeCartProduct();
  2625.  
  2626. if ($(".kleo-woo-gallery a.zoom").length < 2) {
  2627. $(".woo-main-image-nav").hide();
  2628. }
  2629.  
  2630. if ($(".kleo-woo-gallery a.zoom").length) {
  2631. kleoShop.startMultiGallery();
  2632.  
  2633. $(".kleo-woo-next").on('click', function (e) {
  2634.  
  2635. e.preventDefault();
  2636. $('.kleo-thumbs-carousel').trigger('next');
  2637.  
  2638. if ($(".kleo-woo-gallery a.zoom.selected").nextAll("a.zoom:eq(0)").length) {
  2639.  
  2640. var nextElem = $(".kleo-woo-gallery a.zoom.selected").nextAll("a.zoom:eq(0)");
  2641. kleoShop.setSelected(nextElem);
  2642.  
  2643. }
  2644. });
  2645.  
  2646. $(".kleo-woo-prev").on('click', function (e) {
  2647.  
  2648. e.preventDefault();
  2649. $('.kleo-thumbs-carousel').trigger('prev');
  2650.  
  2651. if ($(".kleo-woo-gallery a.zoom.selected").prevAll("a.zoom:eq(0)").length) {
  2652.  
  2653. var prevElem = $(".kleo-woo-gallery a.zoom.selected").prevAll("a.zoom:eq(0)");
  2654. kleoShop.setSelected(prevElem);
  2655.  
  2656. }
  2657. });
  2658.  
  2659. } else {
  2660. kleoShop.startSingleGallery();
  2661. }
  2662.  
  2663. },
  2664.  
  2665. setSelected: function (element) {
  2666. $(".woocommerce-main-image img").attr('src', element.attr('href')).parent("a").attr("href", element.attr('data-big-img'));
  2667. $(".kleo-woo-gallery a.zoom").removeClass('selected');
  2668. element.addClass('selected');
  2669. kleoShop.updateGalleryItems(element);
  2670. },
  2671.  
  2672. startSingleGallery: function () {
  2673.  
  2674. kleoShop.wooMainImg.magnificPopup({
  2675. type: 'image',
  2676. mainClass: 'kleo-mfp-zoom',
  2677. removalDelay: 300,
  2678. closeOnContentClick: true,
  2679. image: {
  2680. verticalFit: false
  2681. }
  2682. });
  2683.  
  2684. },
  2685.  
  2686. startMultiGallery: function () {
  2687.  
  2688. //update images array
  2689. kleoShop.updateGalleryItems($(".kleo-woo-gallery a.zoom.selected"));
  2690. //disable click
  2691. kleoShop.wooMainImg.on('click', function (e) {
  2692. e.preventDefault();
  2693. });
  2694.  
  2695. //enable gallery lightbox
  2696. kleoShop.wooMainImg.magnificPopup({
  2697. items: kleoShop.wooGalItems,
  2698. type: 'image',
  2699. mainClass: 'kleo-mfp-zoom',
  2700. removalDelay: 300,
  2701. closeOnContentClick: true,
  2702. gallery: {
  2703. enabled: true
  2704. },
  2705. image: {
  2706. verticalFit: false
  2707. }
  2708. });
  2709. kleoShop.wooMainImg.on('mfpBeforeOpen', function () {
  2710. $.magnificPopup.instance.items = kleoShop.wooGalItems;
  2711. $.magnificPopup.instance.updateItemHTML();
  2712. });
  2713.  
  2714. $(".kleo-woo-gallery a.zoom").on('click', function (e) {
  2715. e.preventDefault();
  2716. kleoShop.setSelected($(this));
  2717.  
  2718. return false;
  2719. });
  2720.  
  2721. },
  2722.  
  2723. updateGalleryItems: function (elem) {
  2724.  
  2725. kleoShop.wooGalItems = [{src: elem.attr('href')}];
  2726. var tmp;
  2727. $(".kleo-woo-gallery a.zoom:not(.selected)").each(function () {
  2728. tmp = {
  2729. src: $(this).attr('href')
  2730. };
  2731. kleoShop.wooGalItems.push(tmp);
  2732. });
  2733.  
  2734. },
  2735.  
  2736. productQuickView: function () {
  2737. $('.navbar, #main').on('click', '.quick-view', function (e) {
  2738.  
  2739. var thiss = $(this);
  2740. var product_id = $(this).attr('data-prod');
  2741. var data = {action: 'woo_quickview', product: product_id};
  2742.  
  2743. $.ajax({
  2744. url: kleoFramework.ajaxurl,
  2745. type: "POST",
  2746. data: data,
  2747. beforeSend: function () {
  2748. thiss.addClass('kleo-loading');
  2749. },
  2750. success: function (response) {
  2751.  
  2752. $.magnificPopup.open({
  2753. mainClass: 'kleo-mfp-zoom',
  2754. items: {
  2755. src: '<div id="productModal" class="product-modal main-color">' + response + '</div>',
  2756. type: 'inline'
  2757. }
  2758. });
  2759.  
  2760. setTimeout(function () {
  2761. //init slider
  2762. kleoPage.carouselItems();
  2763.  
  2764. $('.product-modal form').wc_variation_form();
  2765. $('.product-modal form select').change();
  2766.  
  2767. }, 500);
  2768.  
  2769. },
  2770. complete: function () {
  2771. thiss.removeClass('kleo-loading');
  2772. }
  2773. });
  2774.  
  2775. e.preventDefault();
  2776. }); // productQuickView
  2777. },
  2778.  
  2779. removeCartProduct: function () {
  2780. $(".navbar").on("click", ".kleo-minicart a.remove", function (e) {
  2781.  
  2782. var thiss = $(this),
  2783. values = {action: "kleo_woo_rem_item"},
  2784. queryParams = kleoPage.getURLParameters(thiss.attr('href'));
  2785.  
  2786. $.extend(values, queryParams);
  2787. //rename product param name
  2788. var newVar = {kleo_item: values.remove_item};
  2789. delete values.remove_item;
  2790. $.extend(values, newVar);
  2791.  
  2792. $.ajax({
  2793. url: kleoFramework.ajaxurl,
  2794. type: "GET",
  2795. dataType: "json",
  2796. data: values,
  2797. beforeSend: function () {
  2798. $(".shop-drop").addClass('kleo-loading');
  2799. },
  2800. success: function (response) {
  2801. if (response.hasOwnProperty("cart") && response.hasOwnProperty("count")) {
  2802.  
  2803. $(".kleo-toggle-menu.shop-drop .kleo-toggle-submenu").html(response.cart);
  2804. $(".kleo-toggle-menu.shop-drop .cart-items > span, .mheader .cart-items > span").html(response.count);
  2805.  
  2806. if (response.count == '') {
  2807. $(".kleo-toggle-menu.shop-drop .cart-items").removeClass('has-products');
  2808. $(".kleo-toggle-menu.shop-drop .kleo-notifications").removeClass('new-alert');
  2809. $(".kleo-toggle-menu.shop-drop .kleo-notifications").addClass('no-alert');
  2810. } else {
  2811. $(".kleo-toggle-menu.shop-drop .cart-items").addClass('has-products');
  2812. $(".kleo-toggle-menu.shop-drop .kleo-notifications").addClass('new-alert');
  2813. $(".kleo-toggle-menu.shop-drop .kleo-notifications").removeClass('no-alert');
  2814. }
  2815. }
  2816.  
  2817. /* widget cart */
  2818. if ($('.widget_shopping_cart_content').length && response.hasOwnProperty('widget')) {
  2819. $('.widget_shopping_cart_content').replaceWith(response.widget)
  2820. }
  2821.  
  2822. },
  2823. complete: function () {
  2824. $(".shop-drop").removeClass('kleo-loading');
  2825. }
  2826. });
  2827. e.preventDefault();
  2828. });
  2829. }
  2830.  
  2831. };
  2832.  
  2833.  
  2834. /***************************************************
  2835. Isotope
  2836. ***************************************************/
  2837. var kleoIsotope = {
  2838.  
  2839. container: '.kleo-isotope, .kleo-masonry',
  2840. elContainer: $('.kleo-isotope, .kleo-masonry'),
  2841.  
  2842. init: function () {
  2843.  
  2844. if (kleoIsotope.elContainer.length > 0) {
  2845. kleoIsotope.applyGridIsotpe(kleoIsotope.container);
  2846. }
  2847.  
  2848. },
  2849.  
  2850. applyGridIsotpe: function (container, atts) {
  2851. var $container = $(container);
  2852. $container.each(function () {
  2853. var $isoItem = $(this);
  2854. var $isoAtts = {};
  2855. if ($isoItem.data('layout') == 'fitRows') {
  2856. $isoAtts = {layoutMode: 'fitRows'};
  2857. }
  2858.  
  2859. atts = typeof atts !== 'undefined' ? true : false;
  2860. if (atts == false) {
  2861. $isoAtts = {};
  2862. }
  2863.  
  2864. if ($('body').hasClass('rtl')) {
  2865. $isoAtts.transformsEnabled = false;
  2866. $isoAtts.isOriginLeft = false;
  2867. }
  2868.  
  2869. if (kleoIsotope.elContainer.length > 0 && kleoIsotope.viewport().width >= 480) {
  2870. $isoItem.imagesLoaded(function () {
  2871. $isoItem.isotope($isoAtts);
  2872. });
  2873. }
  2874.  
  2875. $(window).on("debouncedresize", function () {
  2876. // reinit isotope
  2877. $isoItem.isotope($isoAtts);
  2878. });
  2879.  
  2880. /* filter items on button click */
  2881. if ($isoItem.prev(".filter-wrap").length) {
  2882. var filterButton = $isoItem.prev(".filter-wrap");
  2883. filterButton.on('click', "a", function () {
  2884. var filterValue = $(this).data('filter');
  2885. $(this).closest('ul').find('li').removeClass('selected');
  2886. $(this).parent('li').addClass('selected');
  2887. $isoItem.isotope({filter: filterValue});
  2888. $isoItem.find('li:visible').children('div.animate-when-almost-visible').addClass('start-animation');
  2889. return false;
  2890. });
  2891. }
  2892.  
  2893. });
  2894.  
  2895. },
  2896. getWidth: function (item) {
  2897. var $isoWidth;
  2898.  
  2899. if (kleoIsotope.viewport().width < 480) {
  2900. $isoWidth = item.width() / 1;
  2901.  
  2902. } else if (kleoIsotope.viewport().width < 768) {
  2903. $isoWidth = item.width() / 2;
  2904.  
  2905. } else if (kleoIsotope.viewport().width < 992) {
  2906. $isoWidth = item.width() / 2;
  2907.  
  2908. } else if (kleoIsotope.viewport().width < 1200) {
  2909. if (item.closest(".template-page").hasClass('col-sm-12')) {
  2910. $isoWidth = item.width() / 3;
  2911. } else {
  2912. $isoWidth = item.width() / 2;
  2913. }
  2914.  
  2915. } else if (kleoIsotope.viewport().width < 1440) {
  2916. if (item.closest(".template-page").hasClass('col-sm-12')) {
  2917.  
  2918. $isoWidth = item.width() / 4;
  2919.  
  2920. } else {
  2921. $isoWidth = item.width() / 3;
  2922. }
  2923. } else {
  2924. if (item.closest(".template-page").hasClass('col-sm-12')) {
  2925. if (item.closest(".section-container").hasClass('container-full')) {
  2926. $isoWidth = item.width() / 6;
  2927. } else {
  2928. $isoWidth = item.width() / 4;
  2929. }
  2930. } else {
  2931. $isoWidth = item.width() / 3;
  2932. }
  2933. }
  2934. return $isoWidth;
  2935. },
  2936.  
  2937. viewport: function () {
  2938. var e = window, a = 'inner';
  2939. if (!('innerWidth' in window )) {
  2940. a = 'client';
  2941. e = document.documentElement || document.body;
  2942. }
  2943. return {width: e[a + 'Width'], height: e[a + 'Height']};
  2944. }
  2945.  
  2946. };
  2947.  
  2948.  
  2949. /***************************************************
  2950. Site Header
  2951. ***************************************************/
  2952. var kleoHeader = {
  2953. spacing: 0,
  2954. initialPos: ($('.kleo-main-header').length && !$("body").hasClass('navbar-transparent')) ? $('.kleo-main-header').offset().top : 0,
  2955. initialSize: 88,
  2956. scrolledHeight: 44,
  2957. menuHeight: 88,
  2958. scrolledMenuHeight: 44,
  2959. isLogo: kleoFramework.logo == '' ? false : true,
  2960. logoSize: 88,
  2961. logoImg: null,
  2962. header: $('.kleo-main-header'),
  2963. logo: $('.navbar-header .logo img'),
  2964. elements: $('.navbar-header, .kleo-main-header .navbar-collapse > ul > li > a'),
  2965. resizeState: 'normal',
  2966. adminBar: '#wpadminbar',
  2967.  
  2968. init: function () {
  2969.  
  2970. //save logo size
  2971. if (kleoHeader.isLogo) {
  2972.  
  2973. kleoHeader.loadLogoImg();
  2974. $(kleoHeader.logoImg).imagesLoaded(function () {
  2975. kleoHeader.updateLogoSize(kleoHeader.logoImg.height);
  2976. }, false);
  2977. }
  2978.  
  2979.  
  2980. if ($(kleoHeader.adminBar).length > 0 && parseInt($window.width()) > 584) {
  2981. kleoHeader.spacing = $(kleoHeader.adminBar).height();
  2982. }
  2983.  
  2984. //check for custom header size set
  2985. if (!kleoFramework.headerHeight) {
  2986.  
  2987. //init based on logo
  2988. //kleoHeader.initialSize = kleoHeader.elements.filter(':first').height();
  2989. kleoHeader.initialSize = ($('.kleo-main-header #logo_img').length && $('.kleo-main-header #logo_img').height() > 10) ? $('.kleo-main-header #logo_img').height() : 88;
  2990.  
  2991. } else {
  2992. kleoHeader.initialSize = kleoFramework.headerHeight;
  2993. }
  2994.  
  2995. //set scrolled header height
  2996. if (kleoFramework.hasOwnProperty('headerHeightScrolled') && kleoFramework.headerHeightScrolled > 10) {
  2997. kleoHeader.scrolledHeight = kleoFramework.headerHeightScrolled
  2998. } else {
  2999. kleoHeader.scrolledHeight = kleoHeader.initialSize / 2;
  3000. }
  3001.  
  3002.  
  3003. //set menu height
  3004. kleoHeader.menuHeight = kleoHeader.initialSize;
  3005. kleoHeader.scrolledMenuHeight = kleoHeader.scrolledHeight;
  3006.  
  3007. if (kleoHeader.header.hasClass('header-centered') || kleoHeader.header.hasClass('header-left')) {
  3008.  
  3009. if (kleoFramework.hasOwnProperty('headerTwoRowHeight') && kleoFramework.headerTwoRowHeight > 10) {
  3010. kleoHeader.menuHeight = kleoFramework.headerTwoRowHeight;
  3011. }
  3012. if (kleoFramework.hasOwnProperty('headerTwoRowHeightScrolled') && kleoFramework.headerTwoRowHeightScrolled > 10) {
  3013. kleoHeader.scrolledMenuHeight = kleoFramework.headerTwoRowHeightScrolled;
  3014. }
  3015.  
  3016. }
  3017.  
  3018. //continue only if the header element exists in the page
  3019. if (kleoHeader.header.length) {
  3020.  
  3021. /* Set initial line height */
  3022. kleoHeader.initialLineHeight();
  3023.  
  3024. /* header left layout */
  3025. if (kleoHeader.header.hasClass("header-left")) {
  3026.  
  3027. if ($("body.kleo-navbar-fixed").length) {
  3028.  
  3029. var totalHeaderHeight = parseInt(kleoHeader.initialPos) + parseInt(kleoHeader.initialSize) + parseInt(kleoHeader.menuHeight);
  3030. var st = $window.scrollTop();
  3031.  
  3032. if ($("body.navbar-resize").length) {
  3033. //$(window).on("debouncedresize", kleoHeader.resizeLogo);
  3034. if (st > parseInt(kleoHeader.initialPos)) {
  3035. kleoHeader.resizeLogo('', true);
  3036. if (!$("body").hasClass("navbar-transparent")) {
  3037. kleoHeader.header.css({top: kleoHeader.spacing, position: 'fixed'});
  3038. if (!$(".sticky-wrapper").length) {
  3039. kleoHeader.header.wrap('<div id="undefined-sticky-wrapper" class="sticky-wrapper"></div>');
  3040. }
  3041. }
  3042. }
  3043. }
  3044.  
  3045. $window.scroll(function () {
  3046. var st = $window.scrollTop();
  3047. if (st > totalHeaderHeight) {
  3048. if ($("body.navbar-resize").length) {
  3049. kleoHeader.resizeLogo('', true);
  3050. if (!$("body").hasClass("navbar-transparent")) {
  3051. kleoHeader.header.css({top: kleoHeader.spacing, position: 'fixed'});
  3052. if (!$(".sticky-wrapper").length) {
  3053. kleoHeader.header.wrap('<div id="undefined-sticky-wrapper" class="sticky-wrapper"></div>');
  3054. }
  3055. }
  3056. }
  3057. } else {
  3058. kleoHeader.resizeLogo('', true);
  3059. kleoHeader.header.css({top: 'auto', position: 'static'});
  3060. }
  3061. });
  3062. }
  3063.  
  3064. } else { /* All other layouts */
  3065.  
  3066. /* Activate logo resizing */
  3067. if ($("body.kleo-navbar-fixed.navbar-resize:not(.navbar-transparent)").length) {
  3068. if (kleoHeader.isLogo) {
  3069. kleoHeader.loadLogoImg();
  3070. $(kleoHeader.logoImg).imagesLoaded(function () {
  3071. kleoHeader.resizeLogo();
  3072. }, false);
  3073. } else {
  3074. kleoHeader.resizeLogo();
  3075. }
  3076.  
  3077. $window.scroll(function() {
  3078. kleoHeader.resizeLogo();
  3079. });
  3080. $(window).on("debouncedresize", kleoHeader.resizeLogo);
  3081.  
  3082. } else if ($("body.kleo-navbar-fixed.navbar-transparent").length) {
  3083.  
  3084. /* apply header-scrolled class for transparent navbar too */
  3085.  
  3086. var st = $window.scrollTop();
  3087. var resizePoint = 50;
  3088. if (kleoFramework.hasOwnProperty('headerResizeOffset') && kleoFramework.headerResizeOffset != '') {
  3089. resizePoint = kleoFramework.headerResizeOffset;
  3090. }
  3091.  
  3092. if (st > resizePoint) {
  3093. kleoHeader.header.addClass('header-scrolled');
  3094. } else {
  3095. kleoHeader.header.removeClass('header-scrolled');
  3096. }
  3097.  
  3098. $window.scroll(function () {
  3099. var st = $window.scrollTop();
  3100. if (st > resizePoint) {
  3101. kleoHeader.header.addClass('header-scrolled');
  3102. } else {
  3103. kleoHeader.header.removeClass('header-scrolled');
  3104. }
  3105. });
  3106. }
  3107.  
  3108. }
  3109. }
  3110.  
  3111. //activate sticky main menu
  3112. if (body.hasClass("kleo-navbar-fixed") && !kleoHeader.header.hasClass("header-left")) {
  3113. kleoHeader.enable_sticky();
  3114. }
  3115.  
  3116. //activate retina logo
  3117. kleoHeader.enableRetinaLogo();
  3118.  
  3119. //activate social icons expand effect
  3120. kleoHeader.topSocialExpander();
  3121.  
  3122. //enable menu Ajax search button
  3123. if ($('.kleo_ajax_results').length) {
  3124. kleoHeader.toggleAjaxSearch();
  3125. kleoHeader.doAjaxSearch();
  3126. }
  3127.  
  3128. // Activate Hover menu
  3129. if (kleoIsotope.viewport().width > 992) {
  3130. $('#header .js-activated').dropdownHover({delay: 100}).dropdown();
  3131. }
  3132. $('.js-activated').off('click');
  3133.  
  3134. //Expand dropdown on caret click
  3135. $('#header .caret').on('click', function () {
  3136. var liItem = $(this).closest(".dropdown, .dropdown-submenu");
  3137. if (liItem.hasClass("open")) {
  3138. liItem.removeClass("open");
  3139. } else {
  3140. liItem.addClass("open");
  3141. }
  3142. return false;
  3143. });
  3144.  
  3145. kleoHeader.dropdownToggle();
  3146.  
  3147. kleoHeader.scrollTo();
  3148.  
  3149. kleoHeader.sideMenu();
  3150.  
  3151. /* Flexmenu logic */
  3152. if ( body.hasClass('header-flexmenu') ) {
  3153. body.on('flexmenu-added', function () {
  3154. kleoHeader.resizeLogo();
  3155. });
  3156. body.on('flexmenu-finished', function () {
  3157. body.removeClass('header-overflow');
  3158. });
  3159. body.on('flexmenu-beforeResize', function () {
  3160. body.addClass('header-overflow');
  3161. });
  3162.  
  3163. $('.primary-menu > ul').flexMenu({
  3164. linkText: '<i class="icon-menu19"></i>',
  3165. linkTextAll: '<i class="icon-menu19"></i>',
  3166. popupAbsolute: false,
  3167. popupClass: 'dropdown-menu sub-menu pull-right'
  3168. });
  3169. }
  3170.  
  3171. },
  3172.  
  3173. loadLogoImg: function () {
  3174. if (kleoHeader.isLogo && !kleoHeader.logoImg) {
  3175. kleoHeader.logoImg = new Image();
  3176. kleoHeader.logoImg.src = kleoFramework.logo;
  3177. }
  3178. },
  3179.  
  3180. initialLineHeight: function () {
  3181.  
  3182. kleoHeader.elements.css({
  3183. 'lineHeight': kleoHeader.menuHeight + 'px'
  3184. });
  3185.  
  3186. kleoHeader.elements.filter(':first').css({
  3187. 'height': kleoHeader.initialSize + 'px',
  3188. 'lineHeight': kleoHeader.initialSize + 'px'
  3189. });
  3190.  
  3191. kleoHeader.header.find("li.has-btn-see-through").css({
  3192. 'height': kleoHeader.menuHeight + 'px'
  3193. });
  3194.  
  3195.  
  3196. if (kleoFramework.retinaLogo != '') {
  3197. kleoHeader.loadLogoImg();
  3198. $(kleoHeader.logoImg).imagesLoaded(function () {
  3199. kleoHeader.logo.css({'maxHeight': kleoHeader.logoSize + 'px'});
  3200. }, false);
  3201. }
  3202. },
  3203.  
  3204. /* Decreases header size when user scrolls down */
  3205. resizeLogo: function (scrollPoint, disableInterScroll ) {
  3206.  
  3207. if (kleoIsotope.viewport().width < 992) {
  3208. kleoHeader.initialLineHeight();
  3209. return;
  3210. }
  3211.  
  3212. /* Get Scroll offset from Theme options */
  3213. if (typeof scrollPoint === 'undefined' || typeof scrollPoint === 'object' || scrollPoint == '') {
  3214. if (kleoFramework.hasOwnProperty('headerResizeOffset') && kleoFramework.headerResizeOffset != '') {
  3215. scrollPoint = kleoFramework.headerResizeOffset;
  3216. } else {
  3217. scrollPoint = kleoHeader.initialPos;
  3218. }
  3219. }
  3220.  
  3221. if (typeof disableInterScroll === 'undefined' || typeof disableInterScroll === 'object') {
  3222. disableInterScroll = false;
  3223. }
  3224.  
  3225. var st = $window.scrollTop(),
  3226. newH = 0,
  3227. newMenuH = 0,
  3228. headerFinishScrolling = parseInt(scrollPoint) + parseInt(kleoHeader.initialSize) - parseInt(kleoHeader.scrolledHeight),
  3229. headerIsScrolled = false,
  3230. resizeRatio = 1,
  3231. currentState = 'normal';
  3232.  
  3233. if (kleoHeader.header.hasClass('header-centered') ) {
  3234. headerFinishScrolling = parseInt(scrollPoint) + parseInt(kleoHeader.initialSize) + parseInt(kleoHeader.menuHeight) - parseInt(kleoHeader.scrolledHeight) - parseInt(kleoHeader.scrolledMenuHeight);
  3235. }
  3236.  
  3237. //reinit the elements
  3238. kleoHeader.elements = $('.navbar-header, .kleo-main-header .navbar-collapse > ul > li > a');
  3239.  
  3240. if (st > scrollPoint) { /* we can start the scroll */
  3241.  
  3242. if (st < headerFinishScrolling) { /* step by step resizing */
  3243.  
  3244. var scrollDiff = st - scrollPoint;
  3245.  
  3246. if (kleoHeader.header.hasClass('header-centered')) {
  3247. var totalH = parseInt(kleoHeader.menuHeight) + parseInt(kleoHeader.initialSize);
  3248. var logoDif = Math.round(scrollDiff * parseInt(kleoHeader.initialSize) / totalH);
  3249. var MenuDif = Math.round(scrollDiff * parseInt(kleoHeader.menuHeight) / totalH);
  3250.  
  3251. newH = kleoHeader.initialSize - logoDif;
  3252. newMenuH = kleoHeader.menuHeight - MenuDif;
  3253.  
  3254. }
  3255. else {
  3256. newH = kleoHeader.initialSize - scrollDiff;
  3257. newMenuH = kleoHeader.menuHeight - scrollDiff;
  3258. }
  3259.  
  3260. /* Disable intermediate scrolling if set so */
  3261. if(disableInterScroll === true) {
  3262. newH = kleoHeader.initialSize;
  3263. newMenuH = kleoHeader.menuHeight;
  3264. }
  3265.  
  3266. headerIsScrolled = false;
  3267.  
  3268. } else { /* finished resizing */
  3269.  
  3270. newH = kleoHeader.scrolledHeight;
  3271. newMenuH = kleoHeader.scrolledMenuHeight;
  3272. headerIsScrolled = true;
  3273.  
  3274. }
  3275.  
  3276. if (parseInt(newH) < parseInt(kleoHeader.scrolledHeight)) {
  3277. newH = kleoHeader.scrolledHeight;
  3278. }
  3279. if (parseInt(newMenuH) < parseInt(kleoHeader.scrolledMenuHeight)) {
  3280. newMenuH = kleoHeader.scrolledMenuHeight;
  3281. }
  3282.  
  3283. /* Used for retina logo resizing */
  3284. resizeRatio = newH / kleoHeader.initialSize;
  3285.  
  3286. } else { /* scroll haven't reached the header yet */
  3287.  
  3288. newH = kleoHeader.initialSize;
  3289. newMenuH = kleoHeader.menuHeight;
  3290. resizeRatio = 1;
  3291. headerIsScrolled = false;
  3292. }
  3293.  
  3294. /* Apply Line height to elements */
  3295. kleoHeader.elements.css({
  3296. 'lineHeight': newMenuH + 'px'
  3297. });
  3298.  
  3299. kleoHeader.elements.filter(':first').css({'height': newH + 'px', 'lineHeight': newH + 'px'});
  3300.  
  3301. kleoHeader.header.find("li:has(a.btn-see-through)").css({
  3302. 'height': newMenuH + 'px'
  3303. });
  3304.  
  3305. if (headerIsScrolled === true) {
  3306. $('.btn-buy').addClass('btn-default');
  3307. kleoHeader.header.addClass('header-scrolled');
  3308.  
  3309. currentState = 'scrolled';
  3310. } else {
  3311. $('.btn-buy').removeClass('btn-default');
  3312. kleoHeader.header.removeClass('header-scrolled');
  3313.  
  3314. currentState = 'normal';
  3315. }
  3316.  
  3317. if (currentState != kleoHeader.resizeState && kleoHeader.header.hasClass('header-left')) {
  3318. $('body').trigger('flexmenu-go');
  3319. }
  3320. kleoHeader.resizeState = currentState;
  3321.  
  3322. if (kleoFramework.retinaLogo != '') {
  3323. kleoHeader.logo.css({'maxHeight': ( resizeRatio * kleoHeader.logoSize) + 'px'});
  3324. }
  3325.  
  3326. },
  3327.  
  3328. enable_sticky: function () {
  3329. $(".kleo-main-header").sticky({topSpacing: kleoHeader.spacing});
  3330. },
  3331.  
  3332. updateLogoSize: function (size) {
  3333. if (size < kleoHeader.initialSize) {
  3334. kleoHeader.logoSize = size;
  3335. } else {
  3336. kleoHeader.logoSize = kleoHeader.initialSize;
  3337. }
  3338. },
  3339.  
  3340. enableRetinaLogo: function () {
  3341. if ($("#logo_img").length && window.devicePixelRatio > 1 && kleoFramework.retinaLogo != '') {
  3342. var image = $("#logo_img"),
  3343. imageName = kleoFramework.retinaLogo,
  3344. imageHeight;
  3345.  
  3346. kleoHeader.loadLogoImg();
  3347. $(kleoHeader.logoImg).imagesLoaded(function () {
  3348.  
  3349. //rename image
  3350. image.attr('src', imageName);
  3351.  
  3352. imageHeight = kleoHeader.logoSize;
  3353.  
  3354. if ($(".kleo-main-header").hasClass("header-scrolled")) {
  3355. imageHeight = imageHeight / 2;
  3356. }
  3357.  
  3358. image.css({"max-height": imageHeight + "px"});
  3359.  
  3360. //add specific class
  3361. image.closest('.logo').addClass('retina-logo');
  3362. }, false);
  3363.  
  3364. }
  3365. },
  3366.  
  3367. sideMenu: function () {
  3368. $('.open-sidebar').on('click', function () {
  3369. $('body').toggleClass('offcanvas-open');
  3370. $('.offcanvas-sidebar').toggleClass('is-open');
  3371. return false;
  3372. });
  3373.  
  3374. $(".kleo-page").on('click', function (e) {
  3375.  
  3376. if ($(e.target).hasClass("open-sidebar") || $(e.target).closest(".open-sidebar").length > 0) {
  3377. return;
  3378. }
  3379.  
  3380. $('body').removeClass('offcanvas-open');
  3381. $('.offcanvas-sidebar').removeClass('is-open');
  3382. });
  3383. },
  3384.  
  3385. scrollTo: function () {
  3386. $('.kleo-main-header .nav > li a[href^="#"], .kleo-scroll-to').on('click', function (event) {
  3387.  
  3388. var target = '';
  3389. var speed = 1000;
  3390. if ($(this).attr('data-speed') && $(this).data('speed') != '') {
  3391. speed = $(this).data('speed');
  3392. }
  3393.  
  3394. if ($(this).is("a")) {
  3395. target = kleoHeader.getRelatedContent(this);
  3396. } else {
  3397. target = kleoHeader.getRelatedContent($(this).find('a[href^="#"]'));
  3398. }
  3399.  
  3400. var topHeight = 0;
  3401.  
  3402. if ($("body").hasClass("kleo-navbar-fixed")) {
  3403. topHeight += parseInt(kleoHeader.initialSize);
  3404.  
  3405. if ($("body").hasClass("navbar-resize")) {
  3406. topHeight = topHeight / 2;
  3407. }
  3408. }
  3409.  
  3410. if ($(kleoHeader.adminBar).length) {
  3411. topHeight += parseInt($(kleoHeader.adminBar).height());
  3412. }
  3413.  
  3414. if (target.length) {
  3415. event.preventDefault();
  3416. $('html, body').animate({
  3417. scrollTop: target.offset().top - topHeight
  3418. }, speed);
  3419. }
  3420. });
  3421. if (kleoHeader.getRelatedNavigation(this)) {
  3422. $('section')
  3423. .waypoint(function (direction) {
  3424. // Highlight element when related content
  3425. // is 10% percent from the bottom...
  3426. // remove if below
  3427. kleoHeader.getRelatedNavigation(this).parents('li').toggleClass('active', direction === 'down');
  3428. }, {
  3429. offset: 150 //
  3430. })
  3431. .waypoint(function (direction) {
  3432. // Highlight element when bottom of related content
  3433. // is 100px from the top - remove if less
  3434. kleoHeader.getRelatedNavigation(this).parents('li').toggleClass('active', direction === 'up');
  3435. }, {
  3436. offset: function () {
  3437. return -$(this).height() + 100;
  3438. }
  3439. });
  3440. }
  3441. },
  3442. /* Get section or article by href */
  3443. getRelatedContent: function (el) {
  3444. return $($(el).attr('href'));
  3445. },
  3446. /* Get link by section or article id */
  3447. getRelatedNavigation: function (el) {
  3448. if ($(el).attr('id')) {
  3449. return $('.kleo-main-header .nav > li a[href=#' + $(el).attr('id') + ']');
  3450. } else {
  3451. return false;
  3452. }
  3453. },
  3454.  
  3455.  
  3456. /* Top Social Bar - Small slide effect for social icons */
  3457. topSocialExpander: function () {
  3458.  
  3459. $("#top-social li a").hover(function () {
  3460. if (!$("#top-social .tabdrop").length || $("#top-social .tabdrop").hasClass("hide")) {
  3461. var tsTextWidth = $(this).children('.ts-text').outerWidth() + 52;
  3462. $(this).stop().animate({width: tsTextWidth}, 250, '');
  3463. }
  3464. }, function () {
  3465. if ($("#top-social .tabdrop").length || $("#top-social .tabdrop").hasClass("hide")) {
  3466. $(this).stop().animate({width: 33}, 250, '');
  3467. }
  3468. });
  3469.  
  3470. },
  3471.  
  3472. toggleAjaxSearch: function () {
  3473. $('.search-trigger').click(function () {
  3474. if ($('#ajax_search_container').hasClass('searchHidden')) {
  3475. $('#ajax_search_container').removeClass('searchHidden').addClass('show_search_pop');
  3476. $(this).next().find(".ajax_s").focus();
  3477. }
  3478. return false;
  3479. });
  3480. },
  3481.  
  3482. doAjaxSearch: function (options) {
  3483. var defaults = {
  3484. delay: 350, //delay in ms for typing
  3485. minChars: 3, //no. of characters after we start the search
  3486. scope: 'body'
  3487. };
  3488.  
  3489. this.options = $.extend({}, defaults, options);
  3490. this.scope = $(this.options.scope);
  3491. this.body = $("body");
  3492. this.timer = false;
  3493. this.doingSearch = false;
  3494. this.lastVal = "";
  3495. this.request = "";
  3496. this.bind_ev = function () {
  3497. this.scope.on('keyup', '.ajax_s', $.proxy(this.test_search, this));
  3498. this.body.on('mousedown', $.proxy(this.hide_search, this));
  3499.  
  3500. /* Show the results on input click */
  3501. $(".ajax_s").on('click focus', function () {
  3502. var res = $(this).closest(".kleo-search-form").find(".kleo_ajax_results");
  3503.  
  3504. if (!res.is(":empty") && $.trim($(this).val()) != '') {
  3505. res.slideDown('slow');
  3506. }
  3507. res.css("opacity", "1");
  3508. $(this).css("opacity", "1");
  3509. });
  3510.  
  3511. /* Hide the results on outside click */
  3512. this.body.on('mousedown', function (e) {
  3513. var element = $(e.target);
  3514. if (!element.is('.kleo_ajax_results, .ajax_s') && element.closest('.kleo_ajax_results').length == 0) {
  3515. $(".kleo-search-form .kleo_ajax_results").css("opacity", "0.5").slideUp('slow');
  3516. $(".kleo-search-form .ajax_s").css("opacity", "0.5");
  3517. }
  3518. });
  3519.  
  3520. };
  3521. this.test_search = function (e) {
  3522. clearTimeout(this.timer);
  3523. if ($.trim(e.currentTarget.value) == '' || $.trim(e.currentTarget.value.length) >= this.options.minChars) {
  3524. this.timer = setTimeout($.proxy(this.search, this, e), this.options.delay);
  3525. }
  3526. };
  3527. this.hide_search = function (e) {
  3528. var element = $(e.target);
  3529. if (!element.is('#ajax_search_container') && element.parents('#ajax_search_container').length == 0) {
  3530. $('#ajax_search_container').addClass('searchHidden').removeClass('show_search_pop');
  3531. }
  3532. };
  3533. this.search = function (e) {
  3534. var element = e.currentTarget;
  3535.  
  3536. var $this = this,
  3537. form = $(element).closest("form"),
  3538. wrap = $(element).closest(".kleo-search-wrap"),
  3539. results = wrap.find(".kleo_ajax_results"),
  3540. loading = wrap.find(".kleo-ajax-search-loading"),
  3541. values = form.serialize();
  3542.  
  3543. values += "&action=kleo_ajax_search";
  3544.  
  3545. if (form.data('context')) {
  3546. values += "&context=" + form.data('context');
  3547. }
  3548.  
  3549. //if it is not ajax search, bail out
  3550. if (!results.length) {
  3551. return;
  3552. }
  3553.  
  3554. //if it is another search in place
  3555. if ($this.doingSearch === true) {
  3556. //return;
  3557. this.request.abort();
  3558. }
  3559.  
  3560. //if current valuer matches last search value
  3561. if (this.lastVal == $.trim(element.value)) {
  3562. results.slideDown();
  3563. return;
  3564. }
  3565.  
  3566. //if current value is blank
  3567. if ($.trim(element.value) == '') {
  3568. results.slideUp('fast');
  3569. return;
  3570. }
  3571.  
  3572.  
  3573. this.lastVal = $.trim(element.value);
  3574.  
  3575. this.request = $.ajax({
  3576. url: kleoFramework.ajaxurl,
  3577. type: "POST",
  3578. data: values,
  3579. beforeSend: function () {
  3580. loading.css('display', 'inline-block');
  3581. //results.slideUp();
  3582. $this.doingSearch = true;
  3583. },
  3584. success: function (response) {
  3585. if (response == 0) {
  3586. response = "";
  3587. }
  3588. ;
  3589. if (results.is(":empty")) {
  3590. results.hide().html(response).slideDown('slow');
  3591. } else {
  3592. results.html(response).slideDown('slow');
  3593. }
  3594. },
  3595. complete: function () {
  3596. /*$("#kleo_ajaxsearch").html(icon);*/
  3597. loading.css('display', 'none');
  3598. $this.doingSearch = false;
  3599. clearTimeout($this.timer);
  3600. }
  3601. });
  3602. };
  3603.  
  3604. //do search...
  3605. this.bind_ev();
  3606. },
  3607.  
  3608. dropdownToggle: function () {
  3609.  
  3610. $(".navbar").on("mouseenter", ".kleo-toggle-menu", function () {
  3611. clearTimeout($(this).data('timeout'));
  3612. $('.kleo-toggle-submenu').fadeOut(50);
  3613.  
  3614. $(this).find('.kleo-toggle-submenu').fadeIn(50);
  3615.  
  3616. });
  3617. $(".navbar").on("mouseleave", ".kleo-toggle-menu", function () {
  3618. var $this = $(this);
  3619. var t = setTimeout(function () {
  3620. $this.find('.kleo-toggle-submenu').fadeOut(50);
  3621. }, 400);
  3622. $(this).attr('data-timeout', t);
  3623. });
  3624.  
  3625. }
  3626. };
  3627.  
  3628.  
  3629. /***************************************************
  3630. Parallax
  3631. ***************************************************/
  3632. var parallax = {
  3633. init: function () {
  3634.  
  3635. if ($window.width() > 1024) {
  3636.  
  3637. $('.bg-parallax').each(function () {
  3638. // assigning the object
  3639. var $bgobj = $(this);
  3640.  
  3641. $window.scroll(function () {
  3642. // Scroll the background at var speed
  3643. // the yPos is a negative value because we're scrolling it UP!
  3644. var yPos = -(($window.scrollTop() - $bgobj.offset().top) / ($bgobj.data('prlx-speed') * 100 ) );
  3645.  
  3646. // Put together our final background position
  3647. var coords = '50% ' + yPos + 'px';
  3648.  
  3649. // Move the background
  3650. $bgobj.css({backgroundPosition: coords});
  3651. });
  3652. // window scroll Ends
  3653. });
  3654.  
  3655. parallax.changeSizes();
  3656. }
  3657. },
  3658.  
  3659. changeSizes: function () {
  3660.  
  3661. // Wait until the video meta data has loaded
  3662. $('.bg-full-video video').on('loadedmetadata', function () {
  3663.  
  3664. var adjSize, $width, $height, // Width and height of screen
  3665. $this = $(this),
  3666. $content = $this.closest(".bg-full-video").find(".section-container"),
  3667. $vidwidth = this.videoWidth, // Width of video (actual width)
  3668. $vidheight = this.videoHeight, // Height of video (actual height)
  3669. $aspectRatio = $vidwidth / $vidheight; // The ratio the video's height and width are in
  3670.  
  3671. (adjSize = function () { // Create function called adjSize
  3672.  
  3673. var $width = $content.width(); // Width of the screen
  3674. var $height = $content.height(); // Height of the screen
  3675.  
  3676. var $boxRatio = $width / $height; // The ratio the screen is in
  3677.  
  3678. var $adjRatio = $aspectRatio / $boxRatio; // The ratio of the video divided by the screen size
  3679.  
  3680. if ($boxRatio < $aspectRatio) { // If the screen ratio is less than the aspect ratio..
  3681. // Set the width of the video to the screen size multiplied by $adjRatio
  3682. $this.css({'width': $width * $adjRatio + 'px'});
  3683. } else {
  3684. // Else just set the video to the width of the screen/container
  3685. $this.css({'width': $width + 'px'});
  3686. }
  3687.  
  3688. })(); // Run function immediately
  3689.  
  3690. // Run function also on window resize.
  3691. $window.on("debouncedresize", adjSize);
  3692.  
  3693. });
  3694.  
  3695.  
  3696. }
  3697. };
  3698.  
  3699.  
  3700. /***************************************************
  3701. Quick Contact Form
  3702. ***************************************************/
  3703. $(".kleo-quick-contact-wrapper").click(function (event) {
  3704. if (event.stopPropagation) {
  3705. event.stopPropagation();
  3706. }
  3707. else if (window.event) {
  3708. window.event.cancelBubble = true;
  3709. }
  3710. });
  3711. $("html").click(function () {
  3712. $(this).find("#kleo-quick-contact").fadeOut(300);
  3713. $('.kleo-quick-contact-link').removeClass('quick-contact-active');
  3714. });
  3715.  
  3716. $('.kleo-quick-contact-link').on('click', function () {
  3717. if (!$(this).hasClass('quick-contact-active')) {
  3718. $('#kleo-quick-contact').fadeIn(300);
  3719. $(this).addClass('quick-contact-active');
  3720. } else {
  3721. $('#kleo-quick-contact').fadeOut(300);
  3722. $(this).removeClass('quick-contact-active');
  3723. }
  3724. return false;
  3725. });
  3726.  
  3727. $('.kleo-contact-form').submit(ajaxSubmit);
  3728. function ajaxSubmit() {
  3729. var thiss = $(this);
  3730. var customerForm = thiss.serialize();
  3731. thiss.find(".kleo-contact-success").html('');
  3732. thiss.find(".kleo-contact-loading").show();
  3733.  
  3734. $.ajax({
  3735. type: "POST",
  3736. url: kleoFramework.ajaxurl,
  3737. data: customerForm,
  3738. success: function (data) {
  3739. thiss.find(".kleo-contact-loading").hide();
  3740. thiss.find(".kleo-contact-success").html(data);
  3741. if (thiss.find(".mail-success").length) {
  3742. thiss.find("input[type=text], input[type=email], textarea").val('');
  3743. }
  3744. },
  3745. error: function (errorThrown) {
  3746. alert(errorThrown);
  3747. }
  3748. });
  3749. return false;
  3750.  
  3751. }
  3752.  
  3753.  
  3754. $.fn.kleo_enable_media = function (options) {
  3755. var defaults = {};
  3756. var options = $.extend(defaults, options);
  3757.  
  3758. return this.each(function () {
  3759. var el = $(this);
  3760.  
  3761. el.mediaelementplayer({
  3762. // if the <video width> is not specified, this is the default
  3763. defaultVideoWidth: 480,
  3764. // if the <video height> is not specified, this is the default
  3765. defaultVideoHeight: 270,
  3766. // if set, overrides <video width>
  3767. videoWidth: -1,
  3768. // if set, overrides <video height>
  3769. videoHeight: -1,
  3770. // width of audio player
  3771. audioWidth: "100%",
  3772. // height of audio player
  3773. audioHeight: 30,
  3774. // initial volume when the player starts
  3775. startVolume: 0.8,
  3776. // useful for <audio> player loops
  3777. loop: false,
  3778. // enables Flash and Silverlight to resize to content size
  3779. enableAutosize: true,
  3780. // the order of controls you want on the control bar (and other plugins below)
  3781. features: ['playpause', 'progress', 'duration', 'volume', 'fullscreen'],
  3782. // Hide controls when playing and mouse is not over the video
  3783. alwaysShowControls: false,
  3784. // force iPad's native controls
  3785. iPadUseNativeControls: false,
  3786. // force iPhone's native controls
  3787. iPhoneUseNativeControls: false,
  3788. // force Android's native controls
  3789. AndroidUseNativeControls: false,
  3790. // forces the hour marker (##:00:00)
  3791. alwaysShowHours: false,
  3792. // show framecount in timecode (##:00:00:00)
  3793. showTimecodeFrameCount: false,
  3794. // used when showTimecodeFrameCount is set to true
  3795. framesPerSecond: 25,
  3796. // turns keyboard support on and off for this instance
  3797. enableKeyboard: true,
  3798. // when this player starts, it will pause other players
  3799. pauseOtherPlayers: true,
  3800. // array of keyboard commands
  3801. keyActions: [],
  3802. /*mode: 'shim'*/
  3803. success: function (mediaElement, domObject) {
  3804.  
  3805. // add event listener
  3806. mediaElement.addEventListener('loadedmetadata', function (e) {
  3807.  
  3808. if ($(domObject).closest(".kleo-masonry").length) {
  3809. kleoIsotope.applyGridIsotpe(kleoIsotope.container);
  3810. }
  3811. }, false);
  3812.  
  3813. }
  3814.  
  3815.  
  3816. });
  3817. });
  3818. };
  3819.  
  3820. $.fn.visible = function () {
  3821. return this.css('visibility', 'visible');
  3822. };
  3823.  
  3824. $.fn.invisible = function () {
  3825. return this.css('visibility', 'hidden');
  3826. };
  3827.  
  3828. $.fn.visibilityToggle = function () {
  3829. return this.css('visibility', function (i, visibility) {
  3830. return (visibility == 'visible') ? 'hidden' : 'visible';
  3831. });
  3832. };
  3833.  
  3834. /***************************************************
  3835. GLOBAL VARIABLES
  3836. ***************************************************/
  3837. var $window = $(window),
  3838. body = $('body'),
  3839. deviceAgent = navigator.userAgent.toLowerCase(),
  3840. isMobile = deviceAgent.match(/(iphone|ipod|ipad|android|iemobile)/);
  3841.  
  3842.  
  3843. /***************************************************
  3844. LOAD AND READY FUNCTION
  3845. ***************************************************/
  3846. var onReady = {
  3847. init: function () {
  3848. kleoPage.init();
  3849. kleoHeader.init();
  3850.  
  3851. parallax.init();
  3852.  
  3853. kleoIsotope.init();
  3854. bP.init();
  3855. kleoShop.init();
  3856.  
  3857. activate_waypoints();
  3858. activate_shortcode_scripts();
  3859.  
  3860.  
  3861. /* Focus search Bp directory*/
  3862.  
  3863. $("#buddypress div#group-dir-search input[type=text], #buddypress div#members-dir-search input[type=text]")
  3864. .focusin(function () {
  3865. $(this).closest("form").css("min-width", "90%");
  3866. });
  3867. $("#buddypress div#group-dir-search input[type=text], #buddypress div#members-dir-search input[type=text]")
  3868. .focusout(function () {
  3869. $(this).closest("form").css("min-width", "60%");
  3870. });
  3871.  
  3872.  
  3873. }
  3874. };
  3875.  
  3876. var onLoad = {
  3877. init: function () {
  3878.  
  3879. }
  3880. };
  3881.  
  3882. kleoPage.notReadyInit();
  3883. jQuery(document).ready(onReady.init);
  3884. jQuery(window).load(onLoad.init);
  3885.  
  3886.  
  3887.  
  3888.  
  3889. })(jQuery);
  3890.  
  3891. function kleoSetCookie(cname, cvalue, path, exdays) {
  3892. if (typeof path === 'undefined') {
  3893. path = '/';
  3894. }
  3895. var d = new Date();
  3896. d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  3897. var expires = "expires=" + d.toUTCString();
  3898. document.cookie = cname + "=" + cvalue + "; " + expires + "; path=" + path;
  3899. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement