Prototype website for VPN service, Bitcoin payments via the Blockchain.info API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1779 lines
53 KiB

11 years ago
  1. /*! UIkit 1.1.0 | http://www.getuikit.com | (c) 2013 YOOtheme | MIT License */
  2. (function($, doc) {
  3. "use strict";
  4. var UI = $.UIkit || {};
  5. if (UI.fn) {
  6. return;
  7. }
  8. UI.fn = function(command, options) {
  9. var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
  10. if (!UI[component]) {
  11. $.error("UIkit component [" + component + "] does not exist.");
  12. return this;
  13. }
  14. return this.each(function() {
  15. var $this = $(this), data = $this.data(component);
  16. if (!data) $this.data(component, (data = new UI[component](this, method ? undefined : options)));
  17. if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
  18. });
  19. };
  20. UI.support = {};
  21. UI.support.transition = (function() {
  22. var transitionEnd = (function() {
  23. var element = doc.body || doc.documentElement,
  24. transEndEventNames = {
  25. WebkitTransition: 'webkitTransitionEnd',
  26. MozTransition: 'transitionend',
  27. OTransition: 'oTransitionEnd otransitionend',
  28. transition: 'transitionend'
  29. }, name;
  30. for (name in transEndEventNames) {
  31. if (element.style[name] !== undefined) {
  32. return transEndEventNames[name];
  33. }
  34. }
  35. }());
  36. return transitionEnd && { end: transitionEnd };
  37. })();
  38. UI.support.touch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
  39. UI.Utils = {};
  40. UI.Utils.debounce = function(func, wait, immediate) {
  41. var timeout;
  42. return function() {
  43. var context = this, args = arguments;
  44. var later = function() {
  45. timeout = null;
  46. if (!immediate) func.apply(context, args);
  47. };
  48. var callNow = immediate && !timeout;
  49. clearTimeout(timeout);
  50. timeout = setTimeout(later, wait);
  51. if (callNow) func.apply(context, args);
  52. };
  53. };
  54. UI.Utils.options = function(string) {
  55. if ($.isPlainObject(string)) return string;
  56. var start = string.indexOf("{"), options = {};
  57. if (start != -1) {
  58. try {
  59. options = (new Function("", "var json = " + string.substr(start) + "; return JSON.parse(JSON.stringify(json));"))();
  60. } catch (e) {}
  61. }
  62. return options;
  63. };
  64. $.UIkit = UI;
  65. $.fn.uk = UI.fn;
  66. $.UIkit.langdirection = $("html").attr("dir") == "rtl" ? "right" : "left";
  67. })(jQuery, document);
  68. ;(function($){
  69. var touch = {},
  70. touchTimeout, tapTimeout, swipeTimeout,
  71. longTapDelay = 750, longTapTimeout;
  72. function parentIfText(node) {
  73. return 'tagName' in node ? node : node.parentNode;
  74. }
  75. function swipeDirection(x1, x2, y1, y2) {
  76. var xDelta = Math.abs(x1 - x2), yDelta = Math.abs(y1 - y2);
  77. return xDelta >= yDelta ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
  78. }
  79. function longTap() {
  80. longTapTimeout = null;
  81. if (touch.last) {
  82. touch.el.trigger('longTap');
  83. touch = {};
  84. }
  85. }
  86. function cancelLongTap() {
  87. if (longTapTimeout) clearTimeout(longTapTimeout);
  88. longTapTimeout = null;
  89. }
  90. function cancelAll() {
  91. if (touchTimeout) clearTimeout(touchTimeout);
  92. if (tapTimeout) clearTimeout(tapTimeout);
  93. if (swipeTimeout) clearTimeout(swipeTimeout);
  94. if (longTapTimeout) clearTimeout(longTapTimeout);
  95. touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
  96. touch = {};
  97. }
  98. $(document).ready(function(){
  99. var now, delta;
  100. $(document.body)
  101. .bind('touchstart', function(e){
  102. now = Date.now();
  103. delta = now - (touch.last || now);
  104. touch.el = $(parentIfText(e.originalEvent.touches[0].target));
  105. if(touchTimeout) clearTimeout(touchTimeout);
  106. touch.x1 = e.originalEvent.touches[0].pageX;
  107. touch.y1 = e.originalEvent.touches[0].pageY;
  108. if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
  109. touch.last = now;
  110. longTapTimeout = setTimeout(longTap, longTapDelay);
  111. })
  112. .bind('touchmove', function(e){
  113. cancelLongTap();
  114. touch.x2 = e.originalEvent.touches[0].pageX;
  115. touch.y2 = e.originalEvent.touches[0].pageY;
  116. })
  117. .bind('touchend', function(e){
  118. cancelLongTap();
  119. // swipe
  120. if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30))
  121. swipeTimeout = setTimeout(function() {
  122. touch.el.trigger('swipe');
  123. touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
  124. touch = {};
  125. }, 0);
  126. // normal tap
  127. else if ('last' in touch)
  128. // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
  129. // ('tap' fires before 'scroll')
  130. tapTimeout = setTimeout(function() {
  131. // trigger universal 'tap' with the option to cancelTouch()
  132. // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
  133. var event = $.Event('tap');
  134. event.cancelTouch = cancelAll;
  135. touch.el.trigger(event);
  136. // trigger double tap immediately
  137. if (touch.isDoubleTap) {
  138. touch.el.trigger('doubleTap');
  139. touch = {};
  140. }
  141. // trigger single tap after 250ms of inactivity
  142. else {
  143. touchTimeout = setTimeout(function(){
  144. touchTimeout = null;
  145. touch.el.trigger('singleTap');
  146. touch = {};
  147. }, 250);
  148. }
  149. }, 0);
  150. })
  151. .bind('touchcancel', cancelAll);
  152. $(window).bind('scroll', cancelAll);
  153. });
  154. ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(m){
  155. $.fn[m] = function(callback){ return this.bind(m, callback); };
  156. });
  157. })(jQuery);
  158. (function($, UI) {
  159. "use strict";
  160. var Alert = function(element, options) {
  161. var $this = this;
  162. this.options = $.extend({}, this.options, options);
  163. this.element = $(element).on("click", this.options.trigger, function(e) {
  164. e.preventDefault();
  165. $this.close();
  166. });
  167. };
  168. $.extend(Alert.prototype, {
  169. options: {
  170. "fade": true,
  171. "duration": 200,
  172. "trigger": ".uk-alert-close"
  173. },
  174. close: function() {
  175. var element = this.element.trigger("close");
  176. if (this.options.fade) {
  177. element.css("overflow", "hidden").css("max-height", element.height()).animate({
  178. "height": 0,
  179. "opacity": 0,
  180. "padding-top": 0,
  181. "padding-bottom": 0,
  182. "margin-top": 0,
  183. "margin-bottom": 0
  184. }, this.options.duration, removeElement);
  185. } else {
  186. removeElement();
  187. }
  188. function removeElement() {
  189. element.trigger("closed").remove();
  190. }
  191. }
  192. });
  193. UI["alert"] = Alert;
  194. // init code
  195. $(document).on("click.alert.uikit", "[data-uk-alert]", function(e) {
  196. var ele = $(this);
  197. if (!ele.data("alert")) {
  198. ele.data("alert", new Alert(ele, UI.Utils.options(ele.data("uk-alert"))));
  199. if ($(e.target).is(ele.data("alert").options.trigger)) {
  200. e.preventDefault();
  201. ele.data("alert").close();
  202. }
  203. }
  204. });
  205. })(jQuery, jQuery.UIkit);
  206. (function($, UI) {
  207. "use strict";
  208. var ButtonRadio = function(element, options) {
  209. var $this = this, $element = $(element);
  210. this.options = $.extend({}, this.options, options);
  211. this.element = $element.on("click", this.options.target, function(e) {
  212. e.preventDefault();
  213. $element.find($this.options.target).not(this).removeClass("uk-active").blur();
  214. $element.trigger("change", [$(this).addClass("uk-active")]);
  215. });
  216. };
  217. $.extend(ButtonRadio.prototype, {
  218. options: {
  219. "target": ".uk-button"
  220. },
  221. getSelected: function() {
  222. this.element.find(".uk-active");
  223. }
  224. });
  225. var ButtonCheckbox = function(element, options) {
  226. var $element = $(element);
  227. this.options = $.extend({}, this.options, options);
  228. this.element = $element.on("click", this.options.target, function(e) {
  229. e.preventDefault();
  230. $element.trigger("change", [$(this).toggleClass("uk-active").blur()]);
  231. });
  232. };
  233. $.extend(ButtonCheckbox.prototype, {
  234. options: {
  235. "target": ".uk-button"
  236. },
  237. getSelected: function() {
  238. this.element.find(".uk-active");
  239. }
  240. });
  241. var Button = function(element) {
  242. var $this = this;
  243. this.element = $(element).on("click", function(e) {
  244. e.preventDefault();
  245. $this.toggle();
  246. $this.element.blur();
  247. });
  248. };
  249. $.extend(Button.prototype, {
  250. toggle: function() {
  251. this.element.toggleClass("uk-active");
  252. }
  253. });
  254. UI["button"] = Button;
  255. UI["button-checkbox"] = ButtonCheckbox;
  256. UI["button-radio"] = ButtonRadio;
  257. // init code
  258. $(document).on("click.button-radio.uikit", "[data-uk-button-radio]", function(e) {
  259. var ele = $(this);
  260. if (!ele.data("button-radio")) {
  261. ele.data("button-radio", new ButtonRadio(ele, UI.Utils.options(ele.data("uk-button-radio"))));
  262. if ($(e.target).is(ele.data("button-radio").options.target)) {
  263. $(e.target).trigger("click");
  264. }
  265. }
  266. });
  267. $(document).on("click.button-checkbox.uikit", "[data-uk-button-checkbox]", function(e) {
  268. var ele = $(this);
  269. if (!ele.data("button-checkbox")) {
  270. ele.data("button-checkbox", new ButtonCheckbox(ele, UI.Utils.options(ele.data("uk-button-checkbox"))));
  271. if ($(e.target).is(ele.data("button-checkbox").options.target)) {
  272. $(e.target).trigger("click");
  273. }
  274. }
  275. });
  276. $(document).on("click.button.uikit", "[data-uk-button]", function(e) {
  277. var ele = $(this);
  278. if (!ele.data("button")) {
  279. ele.data("button", new Button(ele, ele.data("uk-button"))).trigger("click");
  280. }
  281. });
  282. })(jQuery, jQuery.UIkit);
  283. (function($, UI) {
  284. "use strict";
  285. var active = false,
  286. Dropdown = function(element, options) {
  287. var $this = this;
  288. this.options = $.extend({}, this.options, options);
  289. this.element = $(element);
  290. this.dropdown = this.element.find(".uk-dropdown");
  291. this.centered = this.dropdown.hasClass("uk-dropdown-center");
  292. this.justified = this.options.justify ? $(this.options.justify) : false;
  293. this.boundary = $(this.options.boundary);
  294. if(!this.boundary.length) {
  295. this.boundary = $(window);
  296. }
  297. if (this.options.mode == "click") {
  298. this.element.on("click", function(e) {
  299. if (!$(e.target).parents(".uk-dropdown").length) {
  300. e.preventDefault();
  301. }
  302. if (active && active[0] != $this.element[0]) {
  303. active.removeClass("uk-open");
  304. }
  305. if (!$this.element.hasClass("uk-open")) {
  306. $this.checkDimensions();
  307. $this.element.addClass("uk-open");
  308. active = $this.element;
  309. $(document).off("click.outer.dropdown");
  310. setTimeout(function() {
  311. $(document).on("click.outer.dropdown", function(e) {
  312. if (active && active[0] == $this.element[0] && ($(e.target).is("a") || !$this.element.find(".uk-dropdown").find(e.target).length)) {
  313. active.removeClass("uk-open");
  314. $(document).off("click.outer.dropdown");
  315. }
  316. });
  317. }, 10);
  318. } else {
  319. if ($(e.target).is("a") || !$this.element.find(".uk-dropdown").find(e.target).length) {
  320. $this.element.removeClass("uk-open");
  321. active = false;
  322. }
  323. }
  324. });
  325. } else {
  326. this.element.on("mouseenter", function(e) {
  327. if ($this.remainIdle) {
  328. clearTimeout($this.remainIdle);
  329. }
  330. if (active && active[0] != $this.element[0]) {
  331. active.removeClass("uk-open");
  332. }
  333. $this.checkDimensions();
  334. $this.element.addClass("uk-open");
  335. active = $this.element;
  336. }).on("mouseleave", function() {
  337. $this.remainIdle = setTimeout(function() {
  338. $this.element.removeClass("uk-open");
  339. $this.remainIdle = false;
  340. if (active && active[0] == $this.element[0]) active = false;
  341. }, $this.options.remaintime);
  342. });
  343. }
  344. };
  345. $.extend(Dropdown.prototype, {
  346. remainIdle: false,
  347. options: {
  348. "mode": "hover",
  349. "remaintime": 800,
  350. "justify": false,
  351. "boundary": $(window)
  352. },
  353. checkDimensions: function() {
  354. if(!this.dropdown.length) return;
  355. var dropdown = this.dropdown.css("margin-" + $.UIkit.langdirection, "").css("min-width", ""),
  356. offset = dropdown.show().offset(),
  357. width = dropdown.outerWidth(),
  358. boundarywidth = this.boundary.width(),
  359. boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
  360. // centered dropdown
  361. if (this.centered) {
  362. dropdown.css("margin-" + $.UIkit.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
  363. offset = dropdown.offset();
  364. // reset dropdown
  365. if ((width + offset.left) > boundarywidth || offset.left < 0) {
  366. dropdown.css("margin-" + $.UIkit.langdirection, "");
  367. offset = dropdown.offset();
  368. }
  369. }
  370. // justify dropdown
  371. if (this.justified && this.justified.length) {
  372. var jwidth = this.justified.outerWidth();
  373. dropdown.css("min-width", jwidth);
  374. if ($.UIkit.langdirection == 'right') {
  375. var right1 = boundarywidth - (this.justified.offset().left + jwidth),
  376. right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
  377. dropdown.css("margin-right", right1 - right2);
  378. } else {
  379. dropdown.css("margin-left", this.justified.offset().left - offset.left);
  380. }
  381. offset = dropdown.offset();
  382. }
  383. if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
  384. dropdown.addClass("uk-dropdown-flip");
  385. offset = dropdown.offset();
  386. }
  387. if (offset.left < 0) {
  388. dropdown.addClass("uk-dropdown-stack");
  389. }
  390. dropdown.css("display", "");
  391. }
  392. });
  393. UI["dropdown"] = Dropdown;
  394. // init code
  395. $(document).on("mouseenter.dropdown.uikit", "[data-uk-dropdown]", function(e) {
  396. var ele = $(this);
  397. if (!ele.data("dropdown")) {
  398. ele.data("dropdown", new Dropdown(ele, UI.Utils.options(ele.data("uk-dropdown"))));
  399. if (ele.data("dropdown").options.mode == "hover") {
  400. ele.trigger("mouseenter");
  401. }
  402. }
  403. });
  404. })(jQuery, jQuery.UIkit);
  405. (function($, UI) {
  406. "use strict";
  407. var win = $(window),
  408. event = 'resize orientationchange',
  409. GridMatchHeight = function(element, options) {
  410. var $this = this;
  411. this.options = $.extend({}, this.options, options);
  412. this.element = $(element);
  413. this.columns = this.element.children();
  414. this.elements = this.options.target ? this.element.find(this.options.target) : this.columns;
  415. if (!this.columns.length) return;
  416. win.on(event, (function() {
  417. var fn = function() {
  418. $this.match();
  419. };
  420. $(function() {
  421. fn();
  422. win.on("load", fn);
  423. });
  424. return UI.Utils.debounce(fn, 150);
  425. })());
  426. };
  427. $.extend(GridMatchHeight.prototype, {
  428. options: {
  429. "target": false
  430. },
  431. match: function() {
  432. this.revert();
  433. var firstvisible = this.columns.filter(":visible:first");
  434. if (!firstvisible.length) return;
  435. var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100 ? true : false,
  436. max = 0,
  437. $this = this;
  438. if (stacked) return;
  439. this.elements.each(function() {
  440. max = Math.max(max, $(this).outerHeight());
  441. }).each(function(i) {
  442. var element = $(this),
  443. boxheight = element.css("box-sizing") == "border-box" ? "outerHeight" : "height",
  444. box = $this.columns.eq(i),
  445. height = (element.height() + (max - box[boxheight]()));
  446. element.css('min-height', height + 'px');
  447. });
  448. return this;
  449. },
  450. revert: function() {
  451. this.elements.css('min-height', '');
  452. return this;
  453. }
  454. });
  455. var GridMargin = function(element) {
  456. var $this = this;
  457. this.element = $(element);
  458. this.columns = this.element.children();
  459. if (!this.columns.length) return;
  460. win.on(event, (function() {
  461. var fn = function() {
  462. $this.process();
  463. };
  464. $(function() {
  465. fn();
  466. win.on("load", fn);
  467. });
  468. return UI.Utils.debounce(fn, 150);
  469. })());
  470. };
  471. $.extend(GridMargin.prototype, {
  472. process: function() {
  473. this.revert();
  474. var skip = false,
  475. firstvisible = this.columns.filter(":visible:first"),
  476. offset = firstvisible.length ? firstvisible.offset().top : false;
  477. if (offset === false) return;
  478. this.columns.each(function() {
  479. var column = $(this);
  480. if (column.is(":visible")) {
  481. if (skip) {
  482. column.addClass("uk-grid-margin");
  483. } else {
  484. if (column.offset().top != offset) {
  485. column.addClass("uk-grid-margin");
  486. skip = true;
  487. }
  488. }
  489. }
  490. });
  491. return this;
  492. },
  493. revert: function() {
  494. this.columns.removeClass('uk-grid-margin');
  495. return this;
  496. }
  497. });
  498. UI["grid-match"] = GridMatchHeight;
  499. UI["grid-margin"] = GridMargin;
  500. // init code
  501. $(function() {
  502. $("[data-uk-grid-match],[data-uk-grid-margin]").each(function() {
  503. var grid = $(this);
  504. if (grid.is("[data-uk-grid-match]") && !grid.data("grid-match")) {
  505. grid.data("grid-match", new GridMatchHeight(grid, UI.Utils.options(grid.data("uk-grid-match"))));
  506. }
  507. if (grid.is("[data-uk-grid-margin]") && !grid.data("grid-margin")) {
  508. grid.data("grid-margin", new GridMargin(grid, UI.Utils.options(grid.data("uk-grid-margin"))));
  509. }
  510. });
  511. });
  512. })(jQuery, jQuery.UIkit);
  513. (function($, UI, $win) {
  514. "use strict";
  515. var active = false,
  516. html = $("html"),
  517. Modal = function(element, options) {
  518. var $this = this;
  519. this.element = $(element);
  520. this.options = $.extend({
  521. keyboard: true,
  522. show: false,
  523. bgclose: true
  524. }, options);
  525. this.transition = UI.support.transition;
  526. this.dialog = this.element.find(".uk-modal-dialog");
  527. this.element.on("click", ".uk-modal-close", function(e) {
  528. e.preventDefault();
  529. $this.hide();
  530. }).on("click", function(e) {
  531. var target = $(e.target);
  532. if (target[0] == $this.element[0] && $this.options.bgclose) {
  533. $this.hide();
  534. }
  535. });
  536. if (this.options.keyboard) {
  537. $(document).on('keyup.ui.modal.escape', function(e) {
  538. if (active && e.which == 27 && $this.isActive()) $this.hide();
  539. });
  540. }
  541. };
  542. $.extend(Modal.prototype, {
  543. transition: false,
  544. toggle: function() {
  545. this[this.isActive() ? "hide" : "show"]();
  546. },
  547. show: function() {
  548. var $this = this;
  549. if (this.isActive()) return;
  550. if (active) active.hide(true);
  551. this.resize();
  552. this.element.removeClass("uk-open").show();
  553. active = this;
  554. html.addClass("uk-modal-page").height(); // force browser engine redraw
  555. this.element.addClass("uk-open").trigger("uk.modal.show");
  556. },
  557. hide: function(force) {
  558. if (!this.isActive()) return;
  559. if (!force && UI.support.transition) {
  560. var $this = this;
  561. this.element.one(UI.support.transition.end, function() {
  562. $this._hide();
  563. }).removeClass("uk-open");
  564. } else {
  565. this._hide();
  566. }
  567. },
  568. resize: function() {
  569. this.dialog.css("margin-left", "");
  570. var modalwidth = parseInt(this.dialog.css("width"), 10),
  571. inview = (modalwidth + parseInt(this.dialog.css("margin-left"),10) + parseInt(this.dialog.css("margin-right"),10)) < $win.width();
  572. this.dialog.css("margin-left", modalwidth && inview ? -1*Math.ceil(modalwidth/2) : "");
  573. },
  574. _hide: function() {
  575. this.element.hide().removeClass("uk-open");
  576. html.removeClass("uk-modal-page");
  577. if(active===this) active = false;
  578. this.element.trigger("uk.modal.hide");
  579. },
  580. isActive: function() {
  581. return (active == this);
  582. }
  583. });
  584. var ModalTrigger = function(element, options) {
  585. var $this = this,
  586. $element = $(element);
  587. this.options = $.extend({
  588. "target": $element.is("a") ? $element.attr("href") : false
  589. }, options);
  590. this.element = $element;
  591. this.modal = new Modal(this.options.target, options);
  592. $element.on("click", function(e) {
  593. e.preventDefault();
  594. $this.show();
  595. });
  596. //methods
  597. $.each(["show", "hide", "isActive"], function(index, method) {
  598. $this[method] = function() { return $this.modal[method](); };
  599. });
  600. };
  601. ModalTrigger.Modal = Modal;
  602. UI["modal"] = ModalTrigger;
  603. // init code
  604. $(document).on("click.modal.uikit", "[data-uk-modal]", function(e) {
  605. var ele = $(this);
  606. if (!ele.data("modal")) {
  607. ele.data("modal", new ModalTrigger(ele, UI.Utils.options(ele.data("uk-modal"))));
  608. ele.data("modal").show();
  609. }
  610. });
  611. $win.on("resize orientationchange", UI.Utils.debounce(function(){
  612. if(active) active.resize();
  613. }, 150));
  614. })(jQuery, jQuery.UIkit, jQuery(window));
  615. (function($, UI) {
  616. "use strict";
  617. if (UI.support.touch) {
  618. $("html").addClass("uk-touch");
  619. }
  620. var $win = $(window),
  621. $doc = $(document),
  622. Offcanvas = {
  623. show: function(element) {
  624. element = $(element);
  625. if (!element.length) return;
  626. var doc = $("html"),
  627. bar = element.find(".uk-offcanvas-bar:first"),
  628. dir = bar.hasClass("uk-offcanvas-bar-flip") ? -1 : 1,
  629. scrollbar = dir == -1 && $win.width() < window.innerWidth ? (window.innerWidth - $win.width()) : 0;
  630. scrollpos = {x: window.scrollX, y: window.scrollY};
  631. element.addClass("uk-active");
  632. doc.css({"width": window.innerWidth, "height": window.innerHeight}).addClass("uk-offcanvas-page");
  633. doc.css("margin-left", ((bar.outerWidth() - scrollbar) * dir)).width(); // .width() - force redraw
  634. bar.addClass("uk-offcanvas-bar-show").width();
  635. element.off(".ukoffcanvas").on("click.ukoffcanvas swipeRight.ukoffcanvas swipeLeft.ukoffcanvas", function(e) {
  636. var target = $(e.target);
  637. if (!e.type.match(/swipe/)) {
  638. if (target.hasClass("uk-offcanvas-bar")) return;
  639. if (target.parents(".uk-offcanvas-bar:first").length) return;
  640. }
  641. e.stopImmediatePropagation();
  642. Offcanvas.hide();
  643. });
  644. $doc.on('keydown.offcanvas', function(e) {
  645. if (e.keyCode === 27) { // ESC
  646. Offcanvas.hide();
  647. }
  648. });
  649. },
  650. hide: function(force) {
  651. var doc = $("html"),
  652. panel = $(".uk-offcanvas.uk-active"),
  653. bar = panel.find(".uk-offcanvas-bar:first");
  654. if (!panel.length) return;
  655. if ($.UIkit.support.transition && !force) {
  656. doc.one($.UIkit.support.transition.end, function() {
  657. doc.removeClass("uk-offcanvas-page").attr("style", "");
  658. panel.removeClass("uk-active");
  659. window.scrollTo(scrollpos.x, scrollpos.y);
  660. }).css("margin-left", "");
  661. setTimeout(function(){
  662. bar.removeClass("uk-offcanvas-bar-show");
  663. }, 50);
  664. } else {
  665. doc.removeClass("uk-offcanvas-page").attr("style", "");
  666. panel.removeClass("uk-active");
  667. bar.removeClass("uk-offcanvas-bar-show");
  668. window.scrollTo(scrollpos.x, scrollpos.y);
  669. }
  670. panel.off(".ukoffcanvas");
  671. $doc.off(".ukoffcanvas");
  672. }
  673. }, scrollpos;
  674. var OffcanvasTrigger = function(element, options) {
  675. var $this = this,
  676. $element = $(element);
  677. this.options = $.extend({
  678. "target": $element.is("a") ? $element.attr("href") : false
  679. }, options);
  680. this.element = $element;
  681. $element.on("click", function(e) {
  682. e.preventDefault();
  683. Offcanvas.show($this.options.target);
  684. });
  685. };
  686. OffcanvasTrigger.offcanvas = Offcanvas;
  687. UI["offcanvas"] = OffcanvasTrigger;
  688. // init code
  689. $doc.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
  690. e.preventDefault();
  691. var ele = $(this);
  692. if (!ele.data("offcanvas")) {
  693. ele.data("offcanvas", new OffcanvasTrigger(ele, UI.Utils.options(ele.data("uk-offcanvas"))));
  694. ele.trigger("click");
  695. }
  696. });
  697. })(jQuery, jQuery.UIkit);
  698. (function($, UI) {
  699. "use strict";
  700. var Nav = function(element, options) {
  701. var $this = this;
  702. this.options = $.extend({}, this.options, options);
  703. this.element = $(element).on("click", this.options.toggler, function(e) {
  704. e.preventDefault();
  705. var ele = $(this);
  706. $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
  707. });
  708. this.element.find(this.options.lists).each(function() {
  709. var $ele = $(this),
  710. parent = $ele.parent(),
  711. active = parent.hasClass("uk-active");
  712. $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
  713. parent.data("list-container", $ele.parent());
  714. if (active) $this.open(parent, true);
  715. });
  716. };
  717. $.extend(Nav.prototype, {
  718. options: {
  719. "toggler": ">li.uk-parent > a[href='#']",
  720. "lists": ">li.uk-parent > ul",
  721. "multiple": false
  722. },
  723. open: function(li, noanimation) {
  724. var element = this.element, $li = $(li);
  725. if (!this.options.multiple) {
  726. element.children(".uk-open").not(li).each(function() {
  727. if ($(this).data("list-container")) {
  728. $(this).data("list-container").stop().animate({height: 0}, function() {
  729. $(this).parent().removeClass("uk-open");
  730. });
  731. }
  732. });
  733. }
  734. $li.toggleClass("uk-open");
  735. if ($li.data("list-container")) {
  736. if (noanimation) {
  737. $li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
  738. } else {
  739. $li.data('list-container').stop().animate({
  740. height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
  741. });
  742. }
  743. }
  744. }
  745. });
  746. UI["nav"] = Nav;
  747. // helper
  748. function getHeight(ele) {
  749. var $ele = $(ele), height = "auto";
  750. if ($ele.is(":visible")) {
  751. height = $ele.outerHeight();
  752. } else {
  753. var tmp = {
  754. position: $ele.css("position"),
  755. visibility: $ele.css("visibility"),
  756. display: $ele.css("display")
  757. };
  758. height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
  759. $ele.css(tmp); // reset element
  760. }
  761. return height;
  762. }
  763. // init code
  764. $(function() {
  765. $("[data-uk-nav]").each(function() {
  766. var nav = $(this);
  767. if (!nav.data("nav")) {
  768. nav.data("nav", new Nav(nav, UI.Utils.options(nav.data("uk-nav"))));
  769. }
  770. });
  771. });
  772. })(jQuery, jQuery.UIkit);
  773. (function($, UI) {
  774. "use strict";
  775. var $tooltip; // tooltip container
  776. var Tooltip = function(element, options) {
  777. var $this = this;
  778. this.options = $.extend({}, this.options, options);
  779. this.element = $(element).on({
  780. "focus" : function(e) { $this.show(); },
  781. "blur" : function(e) { $this.hide(); },
  782. "mouseenter": function(e) { $this.show(); },
  783. "mouseleave": function(e) { $this.hide(); }
  784. });
  785. this.tip = typeof(this.options.src) === "function" ? this.options.src.call(this.element) : this.options.src;
  786. // disable title attribute
  787. this.element.attr("data-cached-title", this.element.attr("title")).attr("title", "");
  788. };
  789. $.extend(Tooltip.prototype, {
  790. tip: "",
  791. options: {
  792. "offset": 5,
  793. "pos": "top",
  794. "src": function() { return this.attr("title"); }
  795. },
  796. show: function() {
  797. if (!this.tip.length) return;
  798. $tooltip.css({"top": -2000, "visibility": "hidden"}).show();
  799. $tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
  800. var pos = $.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
  801. width = $tooltip[0].offsetWidth,
  802. height = $tooltip[0].offsetHeight,
  803. offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
  804. position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
  805. tcss = {
  806. "display": "none",
  807. "visibility": "visible",
  808. "top": (pos.top + pos.height + height),
  809. "left": pos.left
  810. },
  811. tmppos = position.split("-");
  812. if ((tmppos[0] == "left" || tmppos[0] == "right") && $.UIkit.langdirection == 'right') {
  813. tmppos[0] = tmppos[0] == "left" ? "right" : "left";
  814. }
  815. switch (tmppos[0]) {
  816. case 'bottom':
  817. $.extend(tcss, {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2});
  818. break;
  819. case 'top':
  820. $.extend(tcss, {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2});
  821. break;
  822. case 'left':
  823. $.extend(tcss, {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset});
  824. break;
  825. case 'right':
  826. $.extend(tcss, {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset});
  827. break;
  828. }
  829. if (tmppos.length == 2) {
  830. tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
  831. }
  832. $tooltip.css(tcss).attr("class", "uk-tooltip uk-tooltip-" + position).show();
  833. },
  834. hide: function() {
  835. if(this.element.is("input") && this.element[0]===document.activeElement) return;
  836. $tooltip.hide();
  837. },
  838. content: function() {
  839. return this.tip;
  840. }
  841. });
  842. UI["tooltip"] = Tooltip;
  843. $(function() {
  844. $tooltip = $('<div class="uk-tooltip"></div>').appendTo("body");
  845. });
  846. // init code
  847. $(document).on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
  848. var ele = $(this);
  849. if (!ele.data("tooltip")) {
  850. ele.data("tooltip", new Tooltip(ele, UI.Utils.options(ele.data("uk-tooltip")))).trigger("mouseenter");
  851. }
  852. });
  853. })(jQuery, jQuery.UIkit);
  854. (function($, UI) {
  855. "use strict";
  856. var Switcher = function(element, options) {
  857. var $this = this;
  858. this.options = $.extend({}, this.options, options);
  859. this.element = $(element).on("click", this.options.toggler, function(e) {
  860. e.preventDefault();
  861. $this.show(this);
  862. });
  863. if (this.options.connect) {
  864. this.connect = $(this.options.connect).find(".uk-active").removeClass(".uk-active").end();
  865. var active = this.element.find(this.options.toggler).filter(".uk-active");
  866. if (active.length) {
  867. this.show(active);
  868. }
  869. }
  870. };
  871. $.extend(Switcher.prototype, {
  872. options: {
  873. connect: false,
  874. toggler: ">*"
  875. },
  876. show: function(tab) {
  877. tab = isNaN(tab) ? $(tab) : this.element.find(this.options.toggler).eq(tab);
  878. var active = tab;
  879. if (active.hasClass("uk-disabled")) return;
  880. this.element.find(this.options.toggler).filter(".uk-active").removeClass("uk-active");
  881. active.addClass("uk-active");
  882. if (this.options.connect && this.connect.length) {
  883. var index = this.element.find(this.options.toggler).index(active);
  884. this.connect.children().removeClass("uk-active").eq(index).addClass("uk-active");
  885. }
  886. this.element.trigger("uk.switcher.show", [active]);
  887. }
  888. });
  889. UI["switcher"] = Switcher;
  890. // init code
  891. $(function() {
  892. $("[data-uk-switcher]").each(function() {
  893. var switcher = $(this);
  894. if (!switcher.data("switcher")) {
  895. switcher.data("switcher", new Switcher(switcher, UI.Utils.options(switcher.data("uk-switcher"))));
  896. }
  897. });
  898. });
  899. })(jQuery, jQuery.UIkit);
  900. (function($, UI) {
  901. "use strict";
  902. var Tab = function(element, options) {
  903. var $this = this;
  904. this.element = $(element);
  905. this.options = $.extend({
  906. connect: false
  907. }, this.options, options);
  908. if (this.options.connect) {
  909. this.connect = $(this.options.connect);
  910. }
  911. if (window.location.hash) {
  912. var active = this.element.children().filter(window.location.hash);
  913. if (active.length) {
  914. this.element.children().removeClass('uk-active').filter(active).addClass("uk-active");
  915. }
  916. }
  917. var mobiletab = $('<li class="uk-tab-responsive uk-active"><a href="javascript:void(0);"></a></li>'),
  918. caption = mobiletab.find("a:first"),
  919. dropdown = $('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>'),
  920. ul = dropdown.find("ul");
  921. caption.html(this.element.find("li.uk-active:first").find("a").text());
  922. if (this.element.hasClass("uk-tab-bottom")) dropdown.addClass("uk-dropdown-up");
  923. if (this.element.hasClass("uk-tab-flip")) dropdown.addClass("uk-dropdown-flip");
  924. this.element.find("a").each(function(i) {
  925. var tab = $(this).parent(),
  926. item = $('<li><a href="javascript:void(0);">' + tab.text() + '</a></li>').on("click", function(e) {
  927. $this.element.data("switcher").show(i);
  928. });
  929. if (!$(this).parents(".uk-disabled:first").length) ul.append(item);
  930. });
  931. this.element.uk("switcher", {"toggler": ">li:not(.uk-tab-responsive)", "connect": this.options.connect});
  932. mobiletab.append(dropdown).uk("dropdown", {"mode": "click"});
  933. this.element.append(mobiletab).data({
  934. "dropdown": mobiletab.data("dropdown"),
  935. "mobilecaption": caption
  936. }).on("uk.switcher.show", function(e, tab) {
  937. mobiletab.addClass("uk-active");
  938. caption.html(tab.find("a").text());
  939. });
  940. };
  941. UI["tab"] = Tab;
  942. // init code
  943. $(function() {
  944. $("[data-uk-tab]").each(function() {
  945. var tab = $(this);
  946. if (!tab.data("tab")) {
  947. tab.data("tab", new Tab(tab, UI.Utils.options(tab.data("uk-tab"))));
  948. }
  949. });
  950. });
  951. })(jQuery, jQuery.UIkit);
  952. (function($, UI) {
  953. "use strict";
  954. var Search = function(element, options) {
  955. var $this = this;
  956. this.options = $.extend({}, this.options, options);
  957. this.element = $(element);
  958. this.timer = null;
  959. this.value = null;
  960. this.input = this.element.find(".uk-search-field");
  961. this.form = this.input.length ? $(this.input.get(0).form) : $();
  962. this.input.attr('autocomplete', 'off');
  963. this.input.on({
  964. keydown: function(event) {
  965. $this.form[($this.input.val()) ? 'addClass' : 'removeClass']($this.options.filledClass);
  966. if (event && event.which && !event.shiftKey) {
  967. switch (event.which) {
  968. case 13: // enter
  969. $this.done($this.selected);
  970. event.preventDefault();
  971. break;
  972. case 38: // up
  973. $this.pick('prev');
  974. event.preventDefault();
  975. break;
  976. case 40: // down
  977. $this.pick('next');
  978. event.preventDefault();
  979. break;
  980. case 27:
  981. case 9: // esc, tab
  982. $this.hide();
  983. break;
  984. default:
  985. break;
  986. }
  987. }
  988. },
  989. keyup: function(event) {
  990. $this.trigger();
  991. },
  992. blur: function(event) {
  993. setTimeout(function() { $this.hide(event); }, 200);
  994. }
  995. });
  996. this.form.find('button[type=reset]').bind('click', function() {
  997. $this.form.removeClass("uk-open").removeClass("uk-loading").removeClass("uk-active");
  998. $this.value = null;
  999. $this.input.focus();
  1000. });
  1001. this.dropdown = $('<div class="uk-dropdown uk-dropdown-search"><ul class="uk-nav uk-nav-search"></ul></div>').appendTo(this.form).find('.uk-nav-search');
  1002. if (this.options.flipDropdown) {
  1003. this.dropdown.parent().addClass('uk-dropdown-flip');
  1004. }
  1005. };
  1006. $.extend(Search.prototype, {
  1007. options: {
  1008. source: false,
  1009. param: 'search',
  1010. method: 'post',
  1011. minLength: 3,
  1012. delay: 300,
  1013. flipDropdown: false,
  1014. match: ':not(.uk-skip)',
  1015. skipClass: 'uk-skip',
  1016. loadingClass: 'uk-loading',
  1017. filledClass: 'uk-active',
  1018. resultsHeaderClass: 'uk-nav-header',
  1019. moreResultsClass: '',
  1020. noResultsClass: '',
  1021. listClass: 'results',
  1022. hoverClass: 'uk-active',
  1023. msgResultsHeader: 'Search Results',
  1024. msgMoreResults: 'More Results',
  1025. msgNoResults: 'No results found',
  1026. onSelect: function(selected) { window.location = selected.data('choice').url; },
  1027. onLoadedResults: function(results) { return results; }
  1028. },
  1029. request: function(options) {
  1030. var $this = this;
  1031. this.form.addClass(this.options.loadingClass);
  1032. if (this.options.source) {
  1033. $.ajax($.extend({
  1034. url: this.options.source,
  1035. type: this.options.method,
  1036. dataType: 'json',
  1037. success: function(data) {
  1038. data = $this.options.onLoadedResults.apply(this, [data]);
  1039. $this.form.removeClass($this.options.loadingClass);
  1040. $this.suggest(data);
  1041. }
  1042. }, options));
  1043. } else {
  1044. this.form.removeClass($this.options.loadingClass);
  1045. }
  1046. },
  1047. pick: function(item) {
  1048. var selected = false;
  1049. if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
  1050. selected = item;
  1051. }
  1052. if (item == 'next' || item == 'prev') {
  1053. var items = this.dropdown.children().filter(this.options.match);
  1054. if (this.selected) {
  1055. var index = items.index(this.selected);
  1056. if (item == 'next') {
  1057. selected = items.eq(index + 1 < items.length ? index + 1 : 0);
  1058. } else {
  1059. selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
  1060. }
  1061. } else {
  1062. selected = items[(item == 'next') ? 'first' : 'last']();
  1063. }
  1064. }
  1065. if (selected && selected.length) {
  1066. this.selected = selected;
  1067. this.dropdown.children().removeClass(this.options.hoverClass);
  1068. this.selected.addClass(this.options.hoverClass);
  1069. }
  1070. },
  1071. done: function(selected) {
  1072. if (!selected) {
  1073. this.form.submit();
  1074. return;
  1075. }
  1076. if (selected.hasClass(this.options.moreResultsClass)) {
  1077. this.form.submit();
  1078. } else if (selected.data('choice')) {
  1079. this.options.onSelect.apply(this, [selected]);
  1080. }
  1081. this.hide();
  1082. },
  1083. trigger: function() {
  1084. var $this = this, old = this.value, data = {};
  1085. this.value = this.input.val();
  1086. if (this.value.length < this.options.minLength) {
  1087. return this.hide();
  1088. }
  1089. if (this.value != old) {
  1090. if (this.timer) window.clearTimeout(this.timer);
  1091. this.timer = window.setTimeout(function() {
  1092. data[$this.options.param] = $this.value;
  1093. $this.request({'data': data});
  1094. }, this.options.delay, this);
  1095. }
  1096. return this;
  1097. },
  1098. suggest: function(data) {
  1099. if (!data) return;
  1100. var $this = this,
  1101. events = {
  1102. 'mouseover': function() { $this.pick($(this).parent()); },
  1103. 'click': function(e) {
  1104. e.preventDefault();
  1105. $this.done($(this).parent());
  1106. }
  1107. };
  1108. if (data === false) {
  1109. this.hide();
  1110. } else {
  1111. this.selected = null;
  1112. this.dropdown.empty();
  1113. if (this.options.msgResultsHeader) {
  1114. $('<li>').addClass(this.options.resultsHeaderClass + ' ' + this.options.skipClass).html(this.options.msgResultsHeader).appendTo(this.dropdown);
  1115. }
  1116. if (data.results && data.results.length > 0) {
  1117. $(data.results).each(function(i) {
  1118. var item = $('<li><a href="#">' + this.title + '</a></li>').data('choice', this);
  1119. if (this["text"]) {
  1120. item.find("a").append('<div>' + this.text + '</div>');
  1121. }
  1122. $this.dropdown.append(item);
  1123. });
  1124. if (this.options.msgMoreResults) {
  1125. $('<li>').addClass('uk-nav-divider ' + $this.options.skipClass).appendTo($this.dropdown);
  1126. $('<li>').addClass($this.options.moreResultsClass).html('<a href="#">' + $this.options.msgMoreResults + '</a>').appendTo($this.dropdown).on(events);
  1127. }
  1128. $this.dropdown.find("li>a").on(events);
  1129. } else if (this.options.msgNoResults) {
  1130. $('<li>').addClass(this.options.noResultsClass + ' ' + this.options.skipClass).html('<a>' + this.options.msgNoResults + '</a>').appendTo(this.dropdown);
  1131. }
  1132. this.show();
  1133. }
  1134. },
  1135. show: function() {
  1136. if (this.visible) return;
  1137. this.visible = true;
  1138. this.form.addClass("uk-open");
  1139. },
  1140. hide: function() {
  1141. if (!this.visible)
  1142. return;
  1143. this.visible = false;
  1144. this.form.removeClass(this.options.loadingClass).removeClass("uk-open");
  1145. }
  1146. });
  1147. UI["search"] = Search;
  1148. // init code
  1149. $(document).on("focus.search.uikit", "[data-uk-search]", function(e) {
  1150. var ele = $(this);
  1151. if (!ele.data("search")) {
  1152. ele.data("search", new Search(ele, UI.Utils.options(ele.data("uk-search"))));
  1153. }
  1154. });
  1155. })(jQuery, jQuery.UIkit);
  1156. (function($, UI) {
  1157. "use strict";
  1158. var $win = $(window),
  1159. ScrollSpy = function(element, options) {
  1160. this.options = $.extend({}, this.options, options);
  1161. var $this = this, inviewstate, initinview,
  1162. fn = function(){
  1163. var inview = isInView($this);
  1164. if(inview && !inviewstate) {
  1165. if(!initinview) {
  1166. $this.element.addClass($this.options.initcls);
  1167. $this.offset = $this.element.offset();
  1168. initinview = true;
  1169. $this.element.trigger("uk-scrollspy-init");
  1170. }
  1171. $this.element.addClass("uk-scrollspy-inview").addClass($this.options.cls).width();
  1172. inviewstate = true;
  1173. $this.element.trigger("uk.scrollspy.inview");
  1174. }
  1175. if (!inview && inviewstate && $this.options.repeat) {
  1176. $this.element.removeClass("uk-scrollspy-inview").removeClass($this.options.cls);
  1177. inviewstate = false;
  1178. $this.element.trigger("uk.scrollspy.outview");
  1179. }
  1180. };
  1181. this.element = $(element);
  1182. $win.on("scroll", fn).on("resize orientationchange", UI.Utils.debounce(fn, 50));
  1183. fn();
  1184. };
  1185. $.extend(ScrollSpy.prototype, {
  1186. options: {
  1187. "cls": "uk-scrollspy-inview",
  1188. "initcls": "uk-scrollspy-init-inview",
  1189. "topoffset": 0,
  1190. "leftoffset": 0,
  1191. "repeat": false
  1192. }
  1193. });
  1194. UI["scrollspy"] = ScrollSpy;
  1195. function isInView(obj) {
  1196. var $element = obj.element, options = obj.options;
  1197. if (!$element.is(':visible')) {
  1198. return false;
  1199. }
  1200. var window_left = $win.scrollLeft(), window_top = $win.scrollTop(), offset = obj.offset || $element.offset(), left = offset.left, top = offset.top;
  1201. if (top + $element.height() >= window_top && top - options.topoffset <= window_top + $win.height() &&
  1202. left + $element.width() >= window_left && left - options.leftoffset <= window_left + $win.width()) {
  1203. return true;
  1204. } else {
  1205. return false;
  1206. }
  1207. }
  1208. // init code
  1209. $(function() {
  1210. $("[data-uk-scrollspy]").each(function() {
  1211. var element = $(this);
  1212. if (!element.data("scrollspy")) {
  1213. element.data("scrollspy", new ScrollSpy(element, UI.Utils.options(element.data("uk-scrollspy"))));
  1214. }
  1215. });
  1216. });
  1217. })(jQuery, jQuery.UIkit);
  1218. (function($, UI) {
  1219. "use strict";
  1220. var SmoothScroll = function(element, options) {
  1221. var $this = this;
  1222. this.options = $.extend({
  1223. duration: 1000,
  1224. transition: 'easeOutExpo'
  1225. }, options);
  1226. this.element = $(element).on("click", function(e) {
  1227. // get / set parameters
  1228. var target = ($(this.hash).length ? $(this.hash) : $("body")).offset().top,
  1229. docheight = $(document).height(),
  1230. winheight = $(window).height();
  1231. if ((target + winheight) > docheight) {
  1232. target = (target - winheight) + 50;
  1233. }
  1234. // animate to target and set the hash to the window.location after the animation
  1235. $("html,body").stop().animate({scrollTop: target}, $this.options.duration, $this.options.transition);
  1236. // cancel default click action
  1237. return false;
  1238. });
  1239. };
  1240. UI["smooth-scroll"] = SmoothScroll;
  1241. if (!$.easing['easeOutExpo']) {
  1242. $.easing['easeOutExpo'] = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
  1243. }
  1244. // init code
  1245. $(document).on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
  1246. var ele = $(this);
  1247. if (!ele.data("smooth-scroll")) {
  1248. ele.data("smooth-scroll", new SmoothScroll(ele, UI.Utils.options(ele.data("uk-smooth-scroll")))).trigger("click");
  1249. }
  1250. });
  1251. })(jQuery, jQuery.UIkit);