1 2 3 4 5 6 7 8/** 9 * Copyright (c) 2005 - 2010, James Auldridge 10 * All rights reserved. 11 * 12 * Licensed under the BSD, MIT, and GPL (your choice!) Licenses: 13 * http://code.google.com/p/cookies/wiki/License 14 * 15 */ 16var jaaulde = window.jaaulde || {}; 17jaaulde.utils = jaaulde.utils || {}; 18jaaulde.utils.cookies = (function() { 19 var resolveOptions, assembleOptionsString, parseCookies, constructor, defaultOptions = { 20 expiresAt: null, 21 path: '/', 22 domain: null, 23 secure: false 24 }; 25 resolveOptions = function(options) { 26 var returnValue, expireDate; 27 if (typeof options !== 'object' || options === null) { 28 returnValue = defaultOptions; 29 } else { 30 returnValue = { 31 expiresAt: defaultOptions.expiresAt, 32 path: defaultOptions.path, 33 domain: defaultOptions.domain, 34 secure: defaultOptions.secure 35 }; 36 if (typeof options.expiresAt === 'object' && options.expiresAt instanceof Date) { 37 returnValue.expiresAt = options.expiresAt; 38 } else if (typeof options.hoursToLive === 'number' && options.hoursToLive !== 0) { 39 expireDate = new Date(); 40 expireDate.setTime(expireDate.getTime() + (options.hoursToLive * 60 * 60 * 1000)); 41 returnValue.expiresAt = expireDate; 42 } 43 if (typeof options.path === 'string' && options.path !== '') { 44 returnValue.path = options.path; 45 } 46 if (typeof options.domain === 'string' && options.domain !== '') { 47 returnValue.domain = options.domain; 48 } 49 if (options.secure === true) { 50 returnValue.secure = options.secure; 51 } 52 } 53 return returnValue; 54 }; 55 assembleOptionsString = function(options) { 56 options = resolveOptions(options); 57 return ((typeof options.expiresAt === 'object' && options.expiresAt instanceof Date ? '; expires=' + options.expiresAt.toGMTString() : '') + '; path=' + options.path + (typeof options.domain === 'string' ? '; domain=' + options.domain : '') + (options.secure === true ? '; secure' : '')); 58 }; 59 parseCookies = function() { 60 var cookies = {}, 61 i, pair, name, value, separated = document.cookie.split(';'), 62 unparsedValue; 63 for (i = 0; i < separated.length; i = i + 1) { 64 pair = separated[i].split('='); 65 name = pair[0].replace(/^\s*/, '').replace(/\s*$/, ''); 66 try { 67 value = decodeURIComponent(pair[1]); 68 } catch (e1) { 69 value = pair[1]; 70 } 71 if (typeof JSON === 'object' && JSON !== null && typeof JSON.parse === 'function') { 72 try { 73 unparsedValue = value; 74 value = JSON.parse(value); 75 } catch (e2) { 76 value = unparsedValue; 77 } 78 } 79 cookies[name] = value; 80 } 81 return cookies; 82 }; 83 constructor = function() {}; 84 constructor.prototype.get = function(cookieName) { 85 var returnValue, item, cookies = parseCookies(); 86 if (typeof cookieName === 'string') { 87 returnValue = (typeof cookies[cookieName] !== 'undefined') ? cookies[cookieName] : null; 88 } else if (typeof cookieName === 'object' && cookieName !== null) { 89 returnValue = {}; 90 for (item in cookieName) { 91 if (typeof cookies[cookieName[item]] !== 'undefined') { 92 returnValue[cookieName[item]] = cookies[cookieName[item]]; 93 } else { 94 returnValue[cookieName[item]] = null; 95 } 96 } 97 } else { 98 returnValue = cookies; 99 } 100 return returnValue; 101 }; 102 constructor.prototype.filter = function(cookieNameRegExp) { 103 var cookieName, returnValue = {}, 104 cookies = parseCookies(); 105 if (typeof cookieNameRegExp === 'string') { 106 cookieNameRegExp = new RegExp(cookieNameRegExp); 107 } 108 for (cookieName in cookies) { 109 if (cookieName.match(cookieNameRegExp)) { 110 returnValue[cookieName] = cookies[cookieName]; 111 } 112 } 113 return returnValue; 114 }; 115 constructor.prototype.set = function(cookieName, value, options) { 116 if (typeof options !== 'object' || options === null) { 117 options = {}; 118 } 119 if (typeof value === 'undefined' || value === null) { 120 value = ''; 121 options.hoursToLive = -8760; 122 } else if (typeof value !== 'string') { 123 if (typeof JSON === 'object' && JSON !== null && typeof JSON.stringify === 'function') { 124 value = JSON.stringify(value); 125 } else { 126 throw new Error('cookies.set() received non-string value and could not serialize.'); 127 } 128 } 129 var optionsString = assembleOptionsString(options); 130 document.cookie = cookieName + '=' + encodeURIComponent(value) + optionsString; 131 }; 132 constructor.prototype.del = function(cookieName, options) { 133 var allCookies = {}, 134 name; 135 if (typeof options !== 'object' || options === null) { 136 options = {}; 137 } 138 if (typeof cookieName === 'boolean' && cookieName === true) { 139 allCookies = this.get(); 140 } else if (typeof cookieName === 'string') { 141 allCookies[cookieName] = true; 142 } 143 for (name in allCookies) { 144 if (typeof name === 'string' && name !== '') { 145 this.set(name, null, options); 146 } 147 } 148 }; 149 constructor.prototype.test = function() { 150 var returnValue = false, 151 testName = 'cT', 152 testValue = 'data'; 153 this.set(testName, testValue); 154 if (this.get(testName) === testValue) { 155 this.del(testName); 156 returnValue = true; 157 } 158 return returnValue; 159 }; 160 constructor.prototype.setOptions = function(options) { 161 if (typeof options !== 'object') { 162 options = null; 163 } 164 defaultOptions = resolveOptions(options); 165 }; 166 return new constructor(); 167})(); 168(function() { 169 if (window.jQuery) { 170 (function($) { 171 $.cookies = jaaulde.utils.cookies; 172 var extensions = { 173 cookify: function(options) { 174 return this.each(function() { 175 var i, nameAttrs = ['name', 'id'],
176 name, $this = $(this), 177 value; 178 for (i in nameAttrs) { 179 if (!isNaN(i)) { 180 name = $this.attr(nameAttrs[i]); 181 if (typeof name === 'string' && name !== '') { 182 if ($this.is(':checkbox, :radio')) { 183 if ($this.attr('checked')) { 184 value = $this.val(); 185 } 186 } else if ($this.is(':input')) { 187 value = $this.val(); 188 } else { 189 value = $this.html(); 190 } if (typeof value !== 'string' || value === '') { 191 value = null; 192 } 193 $.cookies.set(name, value, options); 194 break; 195 } 196 } 197 } 198 }); 199 }, 200 cookieFill: function() { 201 return this.each(function() { 202 var n, getN, nameAttrs = ['name', 'id'], 203 name, $this = $(this), 204 value; 205 getN = function() { 206 n = nameAttrs.pop(); 207 return !!n; 208 }; 209 while (getN()) { 210 name = $this.attr(n); 211 if (typeof name === 'string' && name !== '') { 212 value = $.cookies.get(name); 213 if (value !== null) { 214 if ($this.is(':checkbox, :radio')) { 215 if ($this.val() === value) { 216 $this.attr('checked', 'checked'); 217 } else { 218 $this.removeAttr('checked'); 219 } 220 } else if ($this.is(':input')) { 221 $this.val(value); 222 } else { 223 $this.html(value); 224 } 225 } 226 break; 227 } 228 } 229 }); 230 }, 231 cookieBind: function(options) { 232 return this.each(function() { 233 var $this = $(this); 234 $this.cookieFill().change(function() { 235 $this.cookify(options); 236 }); 237 }); 238 } 239 }; 240 $.each(extensions, function(i) { 241 $.fn[i] = this; 242 }); 243 })(window.jQuery); 244 } 245})(); 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268/*! 269 * jquery fontsize æä»¶ 270 * author: xiaolong 271 * 20170530 272 */ 273 /* 274 275(function ($) { 276 277 function FontSize(dom, options) { 278 var defaultSettings = { 279 startsize: 1, 280 iapFontSizeCounter: 1, 281 iapFontSizeMaxCounter: 5, 282 step: 1, 283 increaseTimes: 5, // æ¾å¤§æ¬¡æ° 284 reduceTimes: 1, // ç¼©å°æ¬¡æ° 285 increaseBtn: '.iap-wcag-plugin-plus', 286 reduceBtn: '.iap-wcag-plugin-minus' 287 }; 288 289 this.settings = $.extend({}, defaultSettings, options); 290 this.container = dom; 291 // ä¸éè¦è®¾ç½®fontsizeçæ ç¾ 292 this.noFontTags = ['svg', 'IMG', 'use', 'BR', 'VIDEO', 'AUDIO', 'STYLE', 'SCRIPT', 'form', 'textarea', 'select', 'input', 'i', 'button']; 293 //this.noFontClasses = ['iap-wcag--excluded']; 294 this._init(); 295 this.$increaseBtn = $(this.settings.increaseBtn); 296 this.$reduceBtn = $(this.settings.reduceBtn); 297 298 299 300 //iap-wcag-font-size-counter 301 302 var that = this; 303 this.$increaseBtn.on('click', function () { 304 if (that.fontIncrease() === false) { 305 that.$increaseBtn.addClass('disable'); 306 } 307 that.$reduceBtn.removeClass('disable'); 308 }); 309 310 this.$reduceBtn.on('click', function () { 311 if (that.fontReduce() === false) { 312 that.$reduceBtn.addClass('disable'); 313 } 314 that.$increaseBtn.removeClass('disable'); 315 }); 316 317 } 318 319 // 为ææå ç´ èç¹ åä¸å èæ ·å¼ font-sizeã 320 FontSize.prototype._init = function () { 321 this._loopNode(this.container, function () { 322 //if ( !$(this).hasClass('iap-wcag--excluded') ){ 323 $(this).css('font-size', $(this).css('font-size'));
324 //$(this).css('font-size', $(this).css('font-size').slice(0, -2) - 0 + + 'px'); 325 //} 326 }); 327 328 this.zoom = 0; 329 this.maxZoom = this.settings.step * this.settings.increaseTimes; 330 this.minZoom = -this.settings.step * this.settings.reduceTimes; 331 }; 332 333 // éåå ç´ èç¹ 334 FontSize.prototype._loopNode = function (node, fn) { 335 var type = node.nodeType, 336 childNodes, 337 noFontTags = this.noFontTags; 338 339 // å ç´ èç¹ 340 if (type === 1) { 341 childNodes = node.childNodes; 342 if (noFontTags.indexOf(node.nodeName) === -1) { 343 fn && fn.call(node); 344 } 345 346 for (var i = 0, l = childNodes.length; i < l; i++) { 347 this._loopNode(childNodes[i], fn); 348 } 349 } 350 }; 351 352 // æ¾å¤§åä½ 353 FontSize.prototype.fontIncrease = function (step) { 354 step = step ? step : this.settings.step; 355 356 //alert(this.zoom); 357 358 if ( this.settings.iapFontSizeCounter < 5 ){ 359 this.settings.iapFontSizeCounter++; 360 361 $('#iap-wcag-font-size-counter').html(this.settings.iapFontSizeCounter); 362 363 if (this.zoom >= this.maxZoom) { 364 return false; 365 } 366 if (this.zoom + step > this.maxZoom) { 367 step = this.maxZoom - this.zoom; 368 } 369 //alert(step); 370 this._loopNode(this.container, function () { 371 if ( !$(this).hasClass('iap-wcag--excluded') ){ 372 $(this).css('font-size', $(this).css('font-size').slice(0, -2) - 0 + step + 'px'); 373 } 374 }); 375 this.zoom += step; 376 } 377 }; 378 379 // 缩å°åä½ 380 FontSize.prototype.fontReduce = function (step) { 381 step = step ? step : this.settings.step; 382 383 if ( this.settings.iapFontSizeCounter > 1 ){ 384 this.settings.iapFontSizeCounter--; 385 386 $('#iap-wcag-font-size-counter').html(this.settings.iapFontSizeCounter); 387 388 if (this.zoom <= this.minZoom) { 389 return false; 390 } 391 if (this.zoom - step < this.minZoom) { 392 step = Math.abs(this.zoom - this.minZoom); 393 } 394 this._loopNode(this.container, function () { 395 if ( !$(this).hasClass('iap-wcag--excluded') ){ 396 $(this).css('font-size', $(this).css('font-size').slice(0, -2) - 0 - step + 'px'); 397 } 398 }); 399 this.zoom -= step; 400 } 401 }; 402 403 // åä½å¤§å°æ¢å¤åå§ç¶æ 404 FontSize.prototype.clearZoom = function () { 405 var zoom = this.zoom; 406 console.log(this.zoom); 407 this._loopNode(this.container, function () { 408 $(this).css('font-size', $(this).css('font-size').slice(0, -2) - 0 - zoom + 'px'); 409 }); 410 this.zoom = 0; 411 412 this.settings.iapFontSizeCounter=1; 413 $('#iap-wcag-font-size-counter').html(1); 414 }; 415 416 $.fn.FontSize = function (options, param) { 417 if (typeof options == 'string') { 418 var method = $.fn.FontSize.methods[options]; 419 if (method) { 420 return method(this, param); 421 } 422 } 423 return this.each(function () { 424 if (!$.data(this, 'FontSize')) { 425 $.data(this, 'FontSize', new FontSize(this, options)); 426 } 427 }); 428 }; 429 430 $.fn.FontSize.methods = { 431 fontIncrease: function (jq, step) { 432 return jq.each(function () { 433 $.data(this, 'FontSize').fontIncrease(step); 434 }); 435 }, 436 fontReduce: function (jq, step) { 437 return jq.each(function () { 438 $.data(this, 'FontSize').fontReduce(step); 439 }); 440 }, 441 clearZoom: function (jq) { 442 return jq.each(function () { 443 $.data(this, 'FontSize').clearZoom(); 444 }); 445 } 446 }; 447 448})(jQuery); 449 450 451 452 453 454*/ 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485/*! 486 hey, [be]Lazy.js - v1.8.2 - 2016.10.25 487 A fast, small and dependency free lazy load script (https://github.com/dinbror/blazy) 488 (c) Bjoern Klinggaard - @bklinggaard - http://dinbror.dk/blazy 489*/ 490 (function(q,m){"function"===typeof define&&define.amd?define(m):"object"===typeof exports?module.exports=m():q.Blazy=m()})(this,function(){function q(b){var c=b._util;c.elements=E(b.options);c.count=c.elements.length;c.destroyed&&(c.destroyed=!1,b.options.container&&l(b.options.container,function(a){n(a,"scroll",c.validateT)}),n(window,"resize",c.saveViewportOffsetT),n(window,"resize",c.validateT),n(window,"scroll",c.validateT));m(b)}function m(b){for(var c=b._util,a=0;a<c.count;a++){var d=c.elements[a],e;a:{var g=d;e=b.options;var p=g.getBoundingClientRect();if(e.container&&y&&(g=g.closest(e.containerClass))){g=g.getBoundingClientRect();e=r(g,f)?r(p,{top:g.top-e.offset,right:g.right+e.offset,bottom:g.bottom+e.offset,left:g.left-e.offset}):!1;break a}e=r(p,f)}if(e||t(d,b.options.successClass))b.load(d),c.elements.splice(a,1),c.count--,a--}0===c.count&&b.destroy()}function r(b,c){return b.right>=c.left&&b.bottom>=c.top&&b.left<=c.right&&b.top<=c.bottom}function z(b,c,a){if(!t(b,a.successClass)&&(c||a.loadInvisible||0<b.offsetWidth&&0<b.offsetHeight))if(c=b.getAttribute(u)||b.getAttribute(a.src)){c=c.split(a.separator);var d=c[A&&1<c.length?1:0],e=b.getAttribute(a.srcset),g="img"===b.nodeName.toLowerCase(),p=(c=b.parentNode)&&"picture"===c.nodeName.toLowerCase();if(g||void 0===b.src){var h=new Image,w=function(){a.error&&a.error(b,"invali
490d");v(b,a.errorClass);k(h,"error",w);k(h,"load",f)},f=function(){g?p||B(b,d,e):b.style.backgroundImage='url("'+d+'")';x(b,a);k(h,"load",f);k(h,"error",w)};p&&(h=b,l(c.getElementsByTagName("source"),function(b){var c=a.srcset,e=b.getAttribute(c);e&&(b.setAttribute("srcset",e),b.removeAttribute(c))}));n(h,"error",w);n(h,"load",f);B(h,d,e)}else b.src=d,x(b,a)}else"video"===b.nodeName.toLowerCase()?(l(b.getElementsByTagName("source"),function(b){var c=a.src,e=b.getAttribute(c);e&&(b.setAttribute("src",e),b.removeAttribute(c))}),b.load(),x(b,a)):(a.error&&a.error(b,"missing"),v(b,a.errorClass))}function x(b,c){v(b,c.successClass);c.success&&c.success(b);b.removeAttribute(c.src);b.removeAttribute(c.srcset);l(c.breakpoints,function(a){b.removeAttribute(a.src)})}function B(b,c,a){a&&b.setAttribute("srcset",a);b.src=c}function t(b,c){return-1!==(" "+b.className+" ").indexOf(" "+c+" ")}function v(b,c){t(b,c)||(b.className+=" "+c)}function E(b){var c=[];b=b.root.querySelectorAll(b.selector);for(var a=b.length;a--;c.unshift(b[a]));return c}function C(b){f.bottom=(window.innerHeight||document.documentElement.clientHeight)+b;f.right=(window.innerWidth||document.documentElement.clientWidth)+b}function n(b,c,a){b.attachEvent?b.attachEvent&&b.attachEvent("on"+c,a):b.addEventListener(c,a,{capture:!1,passive:!0})}function k(b,c,a){b.detachEvent?b.detachEvent&&b.detachEvent("on"+c,a):b.removeEventListener(c,a,{capture:!1,passive:!0})}function l(b,c){if(b&&c)for(var a=b.length,d=0;d<a&&!1!==c(b[d],d);d++);}function D(b,c,a){var d=0;return function(){var e=+new Date;e-d<c||(d=e,b.apply(a,arguments))}}var u,f,A,y;return function(b){if(!document.querySelectorAll){var c=document.createStyleSheet();document.querySelectorAll=function(a,b,d,h,f){f=document.all;b=[];a=a.replace(/\[for\b/gi,"[htmlFor").split(",");for(d=a.length;d--;){c.addRule(a[d],"k:v");for(h=f.length;h--;)f[h].currentStyle.k&&b.push(f[h]);c.removeRule(0)}return b}}var a=this,d=a._util={};d.elements=[];d.destroyed=!0;a.options=b||{};a.options.error=a.options.error||!1;a.options.offset=a.options.offset||100;a.options.root=a.options.root||document;a.options.success=a.options.success||!1;a.options.selector=a.options.selector||".b-lazy";a.options.separator=a.options.separator||"|";a.options.containerClass=a.options.container;a.options.container=a.options.containerClass?document.querySelectorAll(a.options.containerClass):!1;a.options.errorClass=a.options.errorClass||"b-error";a.options.breakpoints=a.options.breakpoints||!1;a.options.loadInvisible=a.options.loadInvisible||!1;a.options.successClass=a.options.successClass||"b-loaded";a.options.validateDelay=a.options.validateDelay||25;a.options.saveViewportOffsetDelay=a.options.saveViewportOffsetDelay||50;a.options.srcset=a.options.srcset||"data-srcset";a.options.src=u=a.options.src||"data-src";y=Element.prototype.closest;A=1<window.devicePixelRatio;f={};f.top=0-a.options.offset;f.left=0-a.options.offset;a.revalidate=function(){q(a)};a.load=function(a,b){var c=this.options;void 0===a.length?z(a,b,c):l(a,function(a){z(a,b,c)})};a.destroy=function(){var a=this._util;this.options.container&&l(this.options.container,function(b){k(b,"scroll",a.validateT)});k(window,"scroll",a.validateT);k(window,"resize",a.validateT);k(window,"resize",a.saveViewportOffsetT);a.count=0;a.elements.length=0;a.destroyed=!0};d.validateT=D(function(){m(a)},a.options.validateDelay,a);d.saveViewportOffsetT=D(function(){C(a.options.offset)},a.options.saveViewportOffsetDelay,a);C(a.options.offset);l(a.options.breakpoints,function(a){if(a.width>=window.screen.width)return u=a.src,!1});setTimeout(function(){q(a)})}}); 491/** 492 * Applies the :focus-visible polyfill at the given scope. 493 * A scope in this case is either the top-level Document or a Shadow Root. 494 * 495 * @param {(Document|ShadowRoot)} scope 496 * @see https://github.com/WICG/focus-visible 497 */ 498function applyFocusVisiblePolyfill(scope) { 499 var hadKeyboardEvent = true; 500 var hadFocusVisibleRecently = false; 501 var hadFocusVisibleRecentlyTimeout = null; 502 503 var inputTypesWhitelist = { 504 text: true, 505 search: true, 506 url: true, 507 tel: true, 508 email: true, 509 password: true, 510 number: true, 511 date: true, 512 month: true, 513 week: true, 514 time: true, 515 datetime: true, 516 'datetime-local': true 517 }; 518 519 /** 520 * Helper function for legacy browsers and iframes which sometimes focus 521 * elements like document, body, and non-interactive SVG. 522 * @param {Element} el 523 */ 524 function isValidFocusTarget(el) { 525 if ( 526 el && 527 el !== document && 528 el.nodeName !== 'HTML' && 529 el.nodeName !== 'BODY' && 530 'classList' in el && 531 'contains' in el.classList 532 ) { 533 return true; 534 } 535 return false; 536 } 537 538 /** 539 * Computes whether the given element should automatically trigger the 540 * `focus-visible` class being added, i.e. whether it should always match
vendor: 9,863 bytes, lines 541-835
541 * `:focus-visible` when focused. 542 * @param {Element} el 543 * @return {boolean} 544 */ 545 function focusTriggersKeyboardModality(el) { 546 var type = el.type; 547 var tagName = el.tagName; 548 549 if (tagName === 'INPUT' && inputTypesWhitelist[type] && !el.readOnly) { 550 return true; 551 } 552 553 if (tagName === 'TEXTAREA' && !el.readOnly) { 554 return true; 555 } 556 557 if (el.isContentEditable) { 558 return true; 559 } 560 561 return false; 562 } 563 564 /** 565 * Add the `focus-visible` class to the given element if it was not added by 566 * the author. 567 * @param {Element} el 568 */ 569 function addFocusVisibleClass(el) { 570 if (el.classList.contains('focus-visible')) { 571 return; 572 } 573 el.classList.add('focus-visible'); 574 el.setAttribute('data-focus-visible-added', ''); 575 } 576 577 /** 578 * Remove the `focus-visible` class from the given element if it was not 579 * originally added by the author. 580 * @param {Element} el 581 */ 582 function removeFocusVisibleClass(el) { 583 if (!el.hasAttribute('data-focus-visible-added')) { 584 return; 585 } 586 el.classList.remove('focus-visible'); 587 el.removeAttribute('data-focus-visible-added'); 588 } 589 590 /** 591 * If the most recent user interaction was via the keyboard; 592 * and the key press did not include a meta, alt/option, or control key; 593 * then the modality is keyboard. Otherwise, the modality is not keyboard. 594 * Apply `focus-visible` to any current active element and keep track 595 * of our keyboard modality state with `hadKeyboardEvent`. 596 * @param {KeyboardEvent} e 597 */ 598 function onKeyDown(e) { 599 if (e.metaKey || e.altKey || e.ctrlKey) { 600 return; 601 } 602 603 if (isValidFocusTarget(scope.activeElement)) { 604 addFocusVisibleClass(scope.activeElement); 605 } 606 607 hadKeyboardEvent = true; 608 } 609 610 /** 611 * If at any point a user clicks with a pointing device, ensure that we change 612 * the modality away from keyboard. 613 * This avoids the situation where a user presses a key on an already focused 614 * element, and then clicks on a different element, focusing it with a 615 * pointing device, while we still think we're in keyboard modality. 616 * @param {Event} e 617 */ 618 function onPointerDown(e) { 619 hadKeyboardEvent = false; 620 } 621 622 /** 623 * On `focus`, add the `focus-visible` class to the target if: 624 * - the target received focus as a result of keyboard navigation, or 625 * - the event target is an element that will likely require interaction 626 * via the keyboard (e.g. a text box) 627 * @param {Event} e 628 */ 629 function onFocus(e) { 630 // Prevent IE from focusing the document or HTML element. 631 if (!isValidFocusTarget(e.target)) { 632 return; 633 } 634 635 if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) { 636 addFocusVisibleClass(e.target); 637 } 638 } 639 640 /** 641 * On `blur`, remove the `focus-visible` class from the target. 642 * @param {Event} e 643 */ 644 function onBlur(e) { 645 if (!isValidFocusTarget(e.target)) { 646 return; 647 } 648 649 if ( 650 e.target.classList.contains('focus-visible') || 651 e.target.hasAttribute('data-focus-visible-added') 652 ) { 653 // To detect a tab/window switch, we look for a blur event followed 654 // rapidly by a visibility change. 655 // If we don't see a visibility change within 100ms, it's probably a 656 // regular focus change. 657 hadFocusVisibleRecently = true; 658 window.clearTimeout(hadFocusVisibleRecentlyTimeout); 659 hadFocusVisibleRecentlyTimeout = window.setTimeout(function() { 660 hadFocusVisibleRecently = false; 661 window.clearTimeout(hadFocusVisibleRecentlyTimeout); 662 }, 100); 663 removeFocusVisibleClass(e.target); 664 } 665 } 666 667 /** 668 * If the user changes tabs, keep track of whether or not the previously 669 * focused element had .focus-visible. 670 * @param {Event} e 671 */ 672 function onVisibilityChange(e) { 673 if (document.visibilityState === 'hidden') { 674 // If the tab becomes active again, the browser will handle calling focus 675 // on the element (Safari actually calls it twice). 676 // If this tab change caused a blur on an element with focus-visible, 677 // re-apply the class when the user switches back to the tab. 678 if (hadFocusVisibleRecently) { 679 hadKeyboardEvent = true; 680 } 681 addInitialPointerMoveListeners(); 682 } 683 } 684 685 /** 686 * Add a group of listeners to detect usage of any pointing devices. 687 * These listeners will be added when the polyfill first loads, and anytime 688 * the window is blurred, so that they are active when the window regains 689 * focus. 690 */ 691 function addInitialPointerMoveListeners() { 692 document.addEventListener('mousemove', onInitialPointerMove); 693 document.addEventListener('mousedown', onInitialPointerMove); 694 document.addEventListener('mouseup', onInitialPointerMove); 695 document.addEventListener('pointermove', onInitialPointerMove); 696 document.addEventListener('pointerdown', onInitialPointerMove); 697 document.addEventListener('pointerup', onInitialPointerMove); 698 document.addEventListener('touchmove', onInitialPointerMove); 699 document.addEventListener('touchstart', onInitialPointerMove); 700 document.addEventListener('touchend', onInitialPointerMove); 701 } 702 703 function removeInitialPointerMoveListeners() { 704 document.removeEventListener('mousemove', onInitialPointerMove); 705 document.removeEventListener('mousedown', onInitialPointerMove); 706 document.removeEventListener('mouseup', onInitialPointerMove); 707 document.removeEventListener('pointermove', onInitialPointerMove); 708 document.removeEventListener('pointerdown', onInitialPointerMove); 709 document.removeEventListener('pointerup', onInitialPointerMove); 710 document.removeEventListener('touchmove', onInitialPointerMove); 711 document.removeEventListener('touchstart', onInitialPointerMove); 712 document.removeEventListener('touchend', onInitialPointerMove); 713 } 714 715 /** 716 * When the polfyill first loads, assume the user is in keyboard modality. 717 * If any event is received from a pointing device (e.g. mouse, pointer, 718 * touch), turn off keyboard modality. 719 * This accounts for situations where focus enters the page from the URL bar. 720 * @param {Event} e 721 */ 722 function onInitialPointerMove(e) { 723 // Work around a Safari quirk that fires a mousemove on <html> whenever the 724 // window blurs, even if you're tabbing out of the page. ¯\_(ã)_/¯ 725 if (e.target.nodeName && e.target.nodeName.toLowerCase() === 'html') { 726 return; 727 } 728 729 hadKeyboardEvent = false; 730 removeInitialPointerMoveListeners(); 731 } 732 733 // For some kinds of state, we are interested in changes at the global scope 734 // only. For example, global pointer input, global key presses and global 735 // visibility change should affect the state at every scope: 736 document.addEventListener('keydown', onKeyDown, true); 737 document.addEventListener('mousedown', onPointerDown, true); 738 document.addEventListener('pointerdown', onPointerDown, true); 739 document.addEventListener('touchstart', onPointerDown, true); 740 document.addEventListener('visibilitychange', onVisibilityChange, true); 741 742 addInitialPointerMoveListeners(); 743 744 // For focus and blur, we specifically care about state changes in the local 745 // scope. This is because focus / blur events that originate from within a 746 // shadow root are not re-dispatched from the host element if it was already 747 // the active element in its own scope: 748 scope.addEventListener('focus', onFocus, true); 749 scope.addEventListener('blur', onBlur, true); 750 751 // We detect that a node is a ShadowRoot by ensuring that it is a 752 // DocumentFragment and also has a host property. This check covers native 753 // implementation and polyfill implementation transparently. If we only cared 754 // about the native implementation, we could just check if the scope was 755 // an instance of a ShadowRoot. 756 if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) { 757 // Since a ShadowRoot is a special kind of DocumentFragment, it does not 758 // have a root element to add a class to. So, we add this attribute to the 759 // host element instead: 760 scope.host.setAttribute('data-js-focus-visible', ''); 761 } else if (scope.nodeType === Node.DOCUMENT_NODE) { 762 document.documentElement.classList.add('js-focus-visible'); 763 } 764} 765 766// It is important to wrap all references to global window and document in 767// these checks to support server-side rendering use cases 768// @see https://github.com/WICG/focus-visible/issues/199 769if (typeof window !== 'undefined' && typeof document !== 'undefined') { 770 // Make the polyfill helper globally available. This can be used as a signal 771 // to interested libraries that wish to coordinate with the polyfill for e.g., 772 // applying the polyfill to a shadow root: 773 window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill; 774 775 // Notify interested libraries of the polyfill's presence, in case the 776 // polyfill was loaded lazily: 777 var event; 778 779 try { 780 event = new CustomEvent('focus-visible-polyfill-ready'); 781 } catch (error) { 782 // IE11 does not support using CustomEvent as a constructor directly: 783 event = document.createEvent('CustomEvent'); 784 event.initCustomEvent('focus-visible-polyfill-ready', false, false, {}); 785 } 786 787 window.dispatchEvent(event); 788} 789 790if (typeof document !== 'undefined') { 791 // Apply the polyfill to the global document, so that no JavaScript 792 // coordination is required to use the polyfill in the top-level document: 793 applyFocusVisiblePolyfill(document); 794} 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834/*! jQuery UI - v1.12.1 - 2019-05-03 835* http://jqueryui.com
vendor: 4,512 bytes, lines 836-839
836* Includes: widget.js, position.js, keycode.js, unique-id.js, widgets/autocomplete.js, widgets/menu.js 837* Copyright jQuery Foundation and other contributors; Licensed MIT */ 838 839(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){t.ui=t.ui||{},t.ui.version="1.12.1";var e=0,i=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var s,n,o=i.call(arguments,1),a=0,r=o.length;r>a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;
vendor: 16,969 bytes, line 839
839for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,l=t(this),h=l.outerWidth(),c=l.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=h+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),T=e(k.my,l.outerWidth(),l.outerHeight());"right"===n.my[0]?D.left-=h:"center"===n.my[0]&&(D.left-=h/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=T[0],D.top+=T[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:h,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+T[0],u[1]+T[1]],my:n.my,at:n.at,within:b,elem:l})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-h,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:l,left:D.left,top:D.top,width:h,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,l=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=l.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=l.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","fal
839se")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
vendor: 7,906 bytes, line 839
839this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete
839}); 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903/*! jQuery UI Virtual Keyboard v1.30.2 *//* 904Author: Jeremy Satterfield 905Maintained: Rob Garrison (Mottie on github) 906Licensed under the MIT License 907 908An on-screen virtual keyboard embedded within the browser window which 909will popup when a specified entry field is focused. The user can then 910type and preview their input before Accepting or Canceling. 911 912This plugin adds default class names to match jQuery UI theme styling. 913Bootstrap & custom themes may also be applied - See 914https://github.com/Mottie/Keyboard#themes 915 916Requires: 917 jQuery v1.4.3+ 918 Caret plugin (included) 919Optional: 920 jQuery UI (position utility only) & CSS theme 921 jQuery mousewheel 922 923Setup/Usage: 924 Please refer to https://github.com/Mottie/Keyboard/wiki 925 926----------------------------------------- 927Caret code modified from jquery.caret.1.02.js 928Licensed under the MIT License: 929http://www.opensource.org/licenses/mit-license.php 930----------------------------------------- 931*/ 932/*jshint browser:true, jquery:true, unused:false */ 933/*global require:false, define:false, module:false */ 934;(function (factory) { 935 if (typeof define === 'function' && define.amd) { 936 define(['jquery'], factory); 937 } else if (typeof module === 'object' && typeof module.exports === 'object') { 938 module.exports = factory(require('jquery')); 939 } else { 940 factory(jQuery); 941 } 942}(function ($) { 943 'use strict'; 944 var $keyboard = $.keyboard = function (el, options) { 945 var o, base = this; 946 947 base.version = '1.30.2'; 948 949 // Access to jQuery and DOM versions of element 950 base.$el = $(el); 951 base.el = el; 952 953 // Add a reverse reference to the DOM object 954 base.$el.data('keyboard', base); 955 956 base.init = function () { 957 base.initialized = false; 958 base.isTextArea = base.el.nodeName.toLowerCase() === 'textarea'; 959 base.isInput = base.el.nodeName.toLowerCase() === 'input'; 960 // detect contenteditable 961 base.isContentEditable = !base.isTextArea && 962 !base.isInput && 963 base.el.isContentEditable; 964 965 var k, position, tmp, 966 kbcss = $keyboard.css, 967 kbevents = $keyboard.events; 968 if ( 969 base.isInput && 970 $.inArray((base.el.type || '').toLowerCase(), $keyboard.supportedInputTypes) < 0 971 ) { 972 throw new TypeError('Input of type "' + base.el.type + '" is not supported; use type text, search, URL, tel or password'); 973 } 974 975 base.settings = options || {}; 976 // shallow copy position to prevent performance issues; see #357 977 if (options && options.position) { 978 position = $.extend({}, options.position); 979 options.position = null; 980 } 981 base.options = o = $.extend(true, {}, $keyboard.defaultOptions, options); 982 if (position) { 983 o.position = position; 984 options.position = position; 985 } 986 987 // keyboard is active (not destroyed); 988 base.el.active = true; 989 // unique keyboard namespace 990 base.namespace = '.keyboard' + Math.random().toString(16).slice(2); 991 // extension namespaces added here (to unbind listeners on base.$el upon destroy) 992 base.extensionNamespace = []; 993 // Shift and Alt key toggles, sets is true if a layout has more than one keyset 994 // used for mousewheel message 995 base.shiftActive = base.altActive = base.metaActive = base.sets = base.capsLock = false; 996 // Class names of the basic key set - meta keysets are handled by the keyname 997 base.rows = ['', '-shift', '-alt', '-alt-shift']; 998 999 base.inPlaceholder = base.$el.attr('placeholder') || ''; 1000 // html 5 placeholder/watermark 1001 base.watermark = $keyboard.watermark && base.inPlaceholder !== ''; 1002 // convert mouse repeater rate (characters per second) into a time in milliseconds. 1003 base.repeatTime = 1000 / (o.repeatRate || 20); 1004 // delay in ms to prevent mousedown & touchstart from both firing events at the same time 1005 o.preventDoubleEventTime = o.preventDoubleEventTime || 100; 1006 // flag indication that a keyboard is open 1007 base.isOpen = false; 1008 // is mousewheel plugin loaded? 1009 base.wheel = typeof $.fn.mousewheel === 'function'; 1010 // special character in regex that need to be escaped 1011 base.escapeRegex = /[-\/\\^$*+?.()|[\]{}]/g; 1012 1013 // keyCode of keys always allowed to be typed 1014 k = $keyboard.keyCodes; 1015 // base.alwaysAllowed = [20,33,34,35,36,37,38,39,40,45,46]; 1016 base.alwaysAllowed = [ 1017 k.capsLock, 1018 k.pageUp, 1019 k.pageDown, 1020 k.end, 1021 k.home, 1022 k.left, 1023 k.up, 1024 k.right, 1025 k.down, 1026 k.insert, 1027 k.delete 1028 ]; 1029 base.$keyboard = []; 1030 // keyboard enabled; set to false on destroy 1031 base.enabled = true; 1032 1033 base.checkCaret = (o.lockInput || $keyboard.checkCaretSupport()); 1034 1035 // disable problematic usePreview for contenteditable 1036 if (base.isContentEditable) { 1037 o.usePreview = false; 1038 } 1039 1040 base.last = { 1041 start: 0, 1042 end: 0, 1043 key: '', 1044 val: '', 1045 preVal: '', 1046 layout: '', 1047 virtual: true, 1048 keyset: [false, false, false], // [shift, alt, meta] 1049 wheel_$Keys: [], 1050 wheelIndex: 0, 1051 wheelLayers: [] 1052 }; 1053 // used when building the keyboard - [keyset element, row, index] 1054 base.temp = ['', 0, 0]; 1055 1056 // Callbacks 1057 $.each([ 1058 kbevents.kbInit, 1059 kbevents.kbBeforeVisible, 1060 kbevents.kbVisible, 1061 kbevents.kbHidden, 1062 kbevents.inputCanceled, 1063 kbevents.inputAccepted, 1064 kbevents.kbBeforeClose, 1065 kbevents.inputRestricted 1066 ], function (i, callback) { 1067 if (typeof o[callback] === 'function') { 1068 // bind callback functions within options to triggered events 1069 base.$el.bind(callback + base.namespace + 'callbacks', o[callback]); 1070 } 1071 }); 1072 1073 // Close with esc key & clicking outside 1074 if (o.alwaysOpen) { 1075 o.stayOpen = true; 1076 } 1077 1078 tmp = $(document); 1079 if (base.el.ownerDocument !== document) { 1080 tmp = tmp.add(base.el.ownerDocument); 1081 } 1082 1083 var bindings = 'keyup checkkeyboard mousedown touchstart '; 1084 if (o.closeByClickEvent) { 1085 bindings += 'click '; 1086 } 1087 // debounce bindings... see #542 1088 tmp.bind(bindings.split(' ').join(base.namespace + ' '), function(e) { 1089 clearTimeout(base.timer3); 1090 base.timer3 = setTimeout(function() { 1091 base.checkClose(e); 1092 }, 1); 1093 }); 1094 1095 // Display keyboard on focus 1096 base.$el 1097 .addClass(kbcss.input + ' ' + o.css.input) 1098 .attr({ 1099 'aria-haspopup': 'true', 1100 'role': 'textbox' 1101 }); 1102 1103 // set lockInput if the element is readonly; or make the element readonly if lockInput is set 1104 if (o.lockInput || base.el.readOnly) { 1105 o.lockInput = true; 1106 base.$el 1107 .addClass(kbcss.locked) 1108 .attr({ 1109 'readonly': 'readonly' 1110 }); 1111 } 1112 // add disabled/readonly class - dynamically updated on reveal 1113 if (base.isUnavailable()) { 1114 base.$el.addClass(kbcss.noKeyboard); 1115 } 1116 if (o.openOn) { 1117 base.bindFocus(); 1118 } 1119 1120 // Add placeholder if not supported by the browser 1121 if ( 1122 !base.watermark && 1123 base.getValue(base.$el) === '' && 1124 base.inPlaceholder !== '' && 1125 base.$el.attr('placeholder') !== '' 1126 ) { 1127 // css watermark style (darker text) 1128 base.$el.addClass(kbcss.placeholder); 1129 base.setValue(base.inPlaceholder, base.$el); 1130 } 1131 1132 base.$el.trigger(kbevents.kbInit, [base, base.el]); 1133 1134 // initialized with keyboard open 1135 if (o.alwaysOpen) { 1136 base.reveal(); 1137 } 1138 base.initialized = true; 1139 }; 1140 1141 base.toggle = function () { 1142 if (!base.hasKeyboard()) { return; } 1143 var $toggle = base.$keyboard.find('.' + $keyboard.css.keyToggle), 1144 locked = !base.enabled; 1145 // prevent physical keyboard from working 1146 base.preview.readonly = locked || base.options.lockInput; 1147 // disable all buttons 1148 base.$keyboard 1149 .toggleClass($keyboard.css.keyDisabled, locked) 1150 .find('.' + $keyboard.css.keyButton) 1151 .not($toggle) 1152 .attr('aria-disabled', locked) 1153 .each(function() { 1154 this.disabled = locked; 1155 }); 1156 $toggle.toggleClass($keyboard.css.keyDisabled, locked); 1157 // stop auto typing 1158 if (locked && base.typing_options) { 1159 base.typing_options.text = ''; 1160 } 1161 // allow chaining 1162 return base; 1163 }; 1164 1165 base.setCurrent = function () { 1166 var kbcss = $keyboard.css, 1167 // close any "isCurrent" keyboard (just in case they are always open) 1168 $current = $('.' + kbcss.isCurrent), 1169 kb = $current.data('keyboard'); 1170 // close keyboard, if not self 1171 if (!$.isEmptyObject(kb) && kb.el !== base.el) { 1172 kb.close(kb.options.autoAccept ? 'true' : false); 1173 } 1174 $current.removeClass(kbcss.isCurrent); 1175 // ui-keyboard-has-focus is applied in case multiple keyboards have 1176 // alwaysOpen = true and are stacked 1177 $('.' + kbcss.hasFocus).removeClass(kbcss.hasFocus); 1178 1179 base.$el.addClass(kbcss.isCurrent); 1180 base.$preview.focus(); 1181 base.$keyboard.addClass(kbcss.hasFocus); 1182 base.isCurrent(true); 1183 base.isOpen = true; 1184 }; 1185 1186 base.isUnavailable = function() { 1187 return ( 1188 base.$el.is(':disabled') || ( 1189 !base.options.activeOnReadonly && 1190 base.$el.attr('readonly') && 1191 !base.$el.hasClass($keyboard.css.locked) 1192 ) 1193 ); 1194 }; 1195 1196 base.isCurrent = function (set) { 1197 var cur = $keyboard.currentKeyboard || false; 1198 if (set) { 1199 cur = $keyboard.currentKeyboard = base.el; 1200 } else if (set === false && cur === base.el) { 1201 cur = $keyboard.currentKeyboard = ''; 1202 } 1203 return cur === base.el; 1204 }; 1205 1206 base.hasKeyboard = function () { 1207 return base.$keyboard && base.$keyboard.length > 0;
1208 }; 1209 1210 base.isVisible = function () { 1211 return base.hasKeyboard() ? base.$keyboard.is(':visible') : false; 1212 }; 1213 1214 base.setFocus = function () { 1215 var $el = base.$preview || base.$el; 1216 if (!o.noFocus) { 1217 $el.focus(); 1218 } 1219 if (base.isContentEditable) { 1220 $keyboard.setEditableCaret($el, base.last.start, base.last.end); 1221 } else { 1222 $keyboard.caret($el, base.last); 1223 } 1224 }; 1225 1226 base.focusOn = function () { 1227 if (!base || !base.el.active) { 1228 // keyboard was destroyed 1229 return; 1230 } 1231 if (!base.isVisible()) { 1232 clearTimeout(base.timer); 1233 base.reveal(); 1234 } else { 1235 // keyboard already open, make it the current keyboard 1236 base.setCurrent(); 1237 } 1238 }; 1239 1240 // add redraw method to make API more clear 1241 base.redraw = function (layout) { 1242 if (layout) { 1243 // allow updating the layout by calling redraw 1244 base.options.layout = layout; 1245 } 1246 // update keyboard after a layout change 1247 if (base.$keyboard.length) { 1248 1249 base.last.preVal = '' + base.last.val; 1250 base.saveLastChange(); 1251 base.setValue(base.last.val, base.$el); 1252 1253 base.removeKeyboard(); 1254 base.shiftActive = base.altActive = base.metaActive = false; 1255 } 1256 base.isOpen = o.alwaysOpen; 1257 base.reveal(true); 1258 return base; 1259 }; 1260 1261 base.reveal = function (redraw) { 1262 var temp, 1263 alreadyOpen = base.isOpen, 1264 kbcss = $keyboard.css; 1265 base.opening = !alreadyOpen; 1266 // remove all 'extra' keyboards by calling close function 1267 $('.' + kbcss.keyboard).not('.' + kbcss.alwaysOpen).each(function(){ 1268 var kb = $(this).data('keyboard'); 1269 if (!$.isEmptyObject(kb)) { 1270 // this closes previous keyboard when clicking another input - see #515 1271 kb.close(kb.options.autoAccept ? 'true' : false); 1272 } 1273 }); 1274 1275 // Don't open if disabled 1276 if (base.isUnavailable()) { 1277 return; 1278 } 1279 base.$el.removeClass(kbcss.noKeyboard); 1280 1281 // Unbind focus to prevent recursion - openOn may be empty if keyboard is opened externally 1282 if (o.openOn) { 1283 base.$el.unbind($.trim((o.openOn + ' ').split(/\s+/).join(base.namespace + ' '))); 1284 } 1285 1286 // build keyboard if it doesn't exist; or attach keyboard if it was removed, but not cleared 1287 if (!base.$keyboard || base.$keyboard && 1288 (!base.$keyboard.length || $.contains(base.el.ownerDocument.body, base.$keyboard[0]))) { 1289 base.startup(); 1290 } 1291 1292 // clear watermark 1293 if (!base.watermark && base.getValue() === base.inPlaceholder) { 1294 base.$el.removeClass(kbcss.placeholder); 1295 base.setValue('', base.$el); 1296 } 1297 // save starting content, in case we cancel 1298 base.originalContent = base.isContentEditable ? 1299 base.$el.html() : 1300 base.getValue(base.$el); 1301 if (base.el !== base.preview && !base.isContentEditable) { 1302 base.setValue(base.originalContent); 1303 } 1304 1305 // disable/enable accept button 1306 if (o.acceptValid && o.checkValidOnInit) { 1307 base.checkValid(); 1308 } 1309 1310 if (o.resetDefault) { 1311 base.shiftActive = base.altActive = base.metaActive = false; 1312 } 1313 base.showSet(); 1314 1315 // beforeVisible event 1316 if (!base.isVisible()) { 1317 base.$el.trigger($keyboard.events.kbBeforeVisible, [base, base.el]); 1318 } 1319 if ( 1320 base.initialized || 1321 o.initialFocus || 1322 ( !o.initialFocus && base.$el.hasClass($keyboard.css.initialFocus) ) 1323 ) { 1324 base.setCurrent(); 1325 } 1326 // update keyboard - enabled or disabled?
1327 base.toggle(); 1328 1329 // show keyboard 1330 base.$keyboard.show(); 1331 1332 // adjust keyboard preview window width - save width so IE won't keep expanding (fix issue #6) 1333 if (o.usePreview && $keyboard.msie) { 1334 if (typeof base.width === 'undefined') { 1335 base.$preview.hide(); // preview is 100% browser width in IE7, so hide the damn thing 1336 base.width = Math.ceil(base.$keyboard.width()); // set input width to match the widest keyboard row 1337 base.$preview.show(); 1338 } 1339 base.$preview.width(base.width); 1340 } 1341 1342 base.reposition(); 1343 1344 base.checkDecimal(); 1345 1346 // get preview area line height 1347 // add roughly 4px to get line height from font height, works well for font-sizes from 14-36px 1348 // needed for textareas 1349 base.lineHeight = parseInt(base.$preview.css('lineHeight'), 10) || 1350 parseInt(base.$preview.css('font-size'), 10) + 4; 1351 1352 if (o.caretToEnd) { 1353 temp = base.isContentEditable ? $keyboard.getEditableLength(base.el) : base.originalContent.length; 1354 base.saveCaret(temp, temp); 1355 } 1356 1357 // IE caret haxx0rs 1358 if ($keyboard.allie) { 1359 // sometimes end = 0 while start is > 0 1360 if (base.last.end === 0 && base.last.start > 0) { 1361 base.last.end = base.last.start; 1362 } 1363 // IE will have start -1, end of 0 when not focused (see demo: https://jsfiddle.net/Mottie/fgryQ/3/) 1364 if (base.last.start < 0) { 1365 // ensure caret is at the end of the text (needed for IE) 1366 base.last.start = base.last.end = base.originalContent.length; 1367 } 1368 } 1369 1370 if (alreadyOpen || redraw) { 1371 // restore caret position (userClosed) 1372 $keyboard.caret(base.$preview, base.last); 1373 base.opening = false; 1374 return base; 1375 } 1376 1377 // opening keyboard flag; delay allows switching between keyboards without immediately closing 1378 // the keyboard 1379 base.timer2 = setTimeout(function () { 1380 var undef; 1381 base.opening = false; 1382 // Number inputs don't support selectionStart and selectionEnd 1383 // Number/email inputs don't support selectionStart and selectionEnd 1384 if (!/(number|email)/i.test(base.el.type) && !o.caretToEnd) { 1385 // caret position is always 0,0 in webkit; and nothing is focused at this point... odd 1386 // save caret position in the input to transfer it to the preview 1387 // inside delay to get correct caret position 1388 base.saveCaret(undef, undef, base.$el); 1389 } 1390 if (o.initialFocus || base.$el.hasClass($keyboard.css.initialFocus)) { 1391 $keyboard.caret(base.$preview, base.last); 1392 } 1393 // save event time for keyboards with stayOpen: true 1394 base.last.eventTime = new Date().getTime(); 1395 base.$el.trigger($keyboard.events.kbVisible, [base, base.el]); 1396 base.timer = setTimeout(function () { 1397 // get updated caret information after visible event - fixes #331 1398 if (base) { // Check if base exists, this is a case when destroy is called, before timers fire 1399 base.saveCaret(); 1400 } 1401 }, 200); 1402 }, 10); 1403 // return base to allow chaining in typing extension 1404 return base; 1405 }; 1406 1407 base.updateLanguage = function () { 1408 // change language if layout is named something like 'french-azerty-1' 1409 var layouts = $keyboard.layouts, 1410 lang = o.language || layouts[o.layout] && layouts[o.layout].lang && 1411 layouts[o.layout].lang || [o.language || 'en'], 1412 kblang = $keyboard.language; 1413 1414 // some languages include a dash, e.g. 'en-gb' or 'fr-ca' 1415 // allow o.language to be a string or array... 1416 // array is for future expansion where a layout can be set for multiple languages 1417 lang = (Object.prototype.toString.call(lang) === '[object Array]' ? lang[0] : lang); 1418 base.language = lang; 1419 lang = lang.split('-')[0]; 1420 1421 // set keyboard language 1422 o.display = $.extend(true, {}, 1423 kblang.en.display, 1424 kblang[lang] && kblang[lang].display || {}, 1425 base.settings.display 1426 ); 1427 o.combos = $.extend(true, {}, 1428 kblang.en.combos, 1429 kblang[lang] && kblang[lang].combos || {}, 1430 base.settings.combos 1431 ); 1432 o.wheelMessage = kblang[lang] && kblang[lang].wheelMessage ||
1432kblang.en.wheelMessage; 1433 // rtl can be in the layout or in the language definition; defaults to false 1434 o.rtl = layouts[o.layout] && layouts[o.layout].rtl || kblang[lang] && kblang[lang].rtl || false; 1435 1436 // save default regex (in case loading another layout changes it) 1437 if (kblang[lang] && kblang[lang].comboRegex) { 1438 base.regex = kblang[lang].comboRegex; 1439 } 1440 // determine if US '.' or European ',' system being used 1441 base.decimal = /^\./.test(o.display.dec); 1442 base.$el 1443 .toggleClass('rtl', o.rtl) 1444 .css('direction', o.rtl ? 'rtl' : ''); 1445 }; 1446 1447 base.startup = function () { 1448 var kbcss = $keyboard.css; 1449 // ensure base.$preview is defined; but don't overwrite it if keyboard is always visible 1450 if (!((o.alwaysOpen || o.userClosed) && base.$preview)) { 1451 base.makePreview(); 1452 } 1453 if (!base.hasKeyboard()) { 1454 // custom layout - create a unique layout name based on the hash 1455 if (o.layout === 'custom') { 1456 o.layoutHash = 'custom' + base.customHash(); 1457 } 1458 base.layout = o.layout === 'custom' ? o.layoutHash : o.layout; 1459 base.last.layout = base.layout; 1460 1461 base.updateLanguage(); 1462 if (typeof $keyboard.builtLayouts[base.layout] === 'undefined') { 1463 if (typeof o.create === 'function') { 1464 // create must call buildKeyboard() function; or create it's own keyboard 1465 base.$keyboard = o.create(base); 1466 } else if (!base.$keyboard.length) { 1467 base.buildKeyboard(base.layout, true); 1468 } 1469 } 1470 base.$keyboard = $keyboard.builtLayouts[base.layout].$keyboard.clone(); 1471 base.$keyboard.data('keyboard', base); 1472 if ((base.el.id || '') !== '') { 1473 // add ID to keyboard for styling purposes 1474 base.$keyboard.attr('id', base.el.id + $keyboard.css.idSuffix); 1475 } 1476 1477 base.makePreview(); 1478 } 1479 1480 // Add layout and laguage data-attibutes 1481 base.$keyboard 1482 .attr('data-' + kbcss.keyboard + '-layout', o.layout) 1483 .attr('data-' + kbcss.keyboard + '-language', base.language); 1484 1485 base.$decBtn = base.$keyboard.find('.' + kbcss.keyPrefix + 'dec'); 1486 // add enter to allowed keys; fixes #190 1487 if (o.enterNavigation || base.isTextArea) { 1488 base.alwaysAllowed.push($keyboard.keyCodes.enter); 1489 } 1490 1491 base.bindKeyboard(); 1492 1493 base.$keyboard.appendTo(o.appendLocally ? base.$el.parent() : o.appendTo || 'body'); 1494 1495 base.bindKeys(); 1496 1497 // reposition keyboard on window resize 1498 if (o.reposition && $.ui && $.ui.position && o.appendTo === 'body') { 1499 $(window).bind('resize' + base.namespace, function () { 1500 base.reposition(); 1501 }); 1502 } 1503 1504 }; 1505 1506 base.reposition = function () { 1507 base.position = $.isEmptyObject(o.position) ? false : o.position; 1508 // position after keyboard is visible (required for UI position utility) 1509 // and appropriately sized 1510 if ($.ui && $.ui.position && base.position) { 1511 base.position.of = 1512 // get single target position 1513 base.position.of || 1514 // OR target stored in element data (multiple targets) 1515 base.$el.data('keyboardPosition') || 1516 // OR default @ element 1517 base.$el; 1518 base.position.collision = base.position.collision || 'flipfit flipfit'; 1519 base.position.at = o.usePreview ? o.position.at : o.position.at2; 1520 if (base.isVisible()) { 1521 base.$keyboard.position(base.position); 1522 } 1523 } 1524 // make chainable 1525 return base; 1526 }; 1527 1528 base.makePreview = function () { 1529 if (o.usePreview) { 1530 var indx, attrs, attr, removedAttr, 1531 kbcss = $keyboard.css; 1532 base.$preview = base.$el.clone(false) 1533 .data('keyboard', base) 1534 .removeClass(kbcss.placeholder + ' ' + kbcss.input) 1535 .addClass(kbcss.preview + ' ' + o.css.input) 1536 .attr('tabindex', '-1') 1537 .show();
1537 // for hidden inputs 1538 base.preview = base.$preview[0]; 1539 1540 // remove extraneous attributes. 1541 removedAttr = /^(data-|id|aria-haspopup)/i; 1542 attrs = base.$preview.get(0).attributes; 1543 for (indx = attrs.length - 1; indx >= 0; indx--) { 1544 attr = attrs[indx] && attrs[indx].name; 1545 if (removedAttr.test(attr)) { 1546 // remove data-attributes - see #351 1547 base.preview.removeAttribute(attr); 1548 } 1549 } 1550 // build preview container and append preview display 1551 $('<div />') 1552 .addClass(kbcss.wrapper) 1553 .append(base.$preview) 1554 .prependTo(base.$keyboard); 1555 } else { 1556 base.$preview = base.$el; 1557 base.preview = base.el; 1558 } 1559 }; 1560 1561 // Added in v1.26.8 to allow chaining of the caret function, e.g. 1562 // keyboard.reveal().caret(4,5).insertText('test').caret('end'); 1563 base.caret = function(param1, param2) { 1564 var result = $keyboard.caret(base.$preview, param1, param2), 1565 wasSetCaret = result instanceof $; 1566 // Caret was set, save last position & make chainable 1567 if (wasSetCaret) { 1568 base.saveCaret(result.start, result.end); 1569 return base; 1570 } 1571 // return caret position if using .caret() 1572 return result; 1573 }; 1574 1575 base.saveCaret = function (start, end, $el) { 1576 if (base.isCurrent()) { 1577 var p; 1578 if (typeof start === 'undefined') { 1579 // grab & save current caret position 1580 p = $keyboard.caret($el || base.$preview); 1581 } else { 1582 p = $keyboard.caret($el || base.$preview, start, end); 1583 } 1584 base.last.start = typeof start === 'undefined' ? p.start : start; 1585 base.last.end = typeof end === 'undefined' ? p.end : end; 1586 } 1587 }; 1588 1589 base.saveLastChange = function (val) { 1590 base.last.val = val || base.getValue(base.$preview || base.$el); 1591 if (base.isContentEditable) { 1592 base.last.elms = base.el.cloneNode(true); 1593 } 1594 }; 1595 1596 base.setScroll = function () { 1597 // Set scroll so caret & current text is in view 1598 // needed for virtual keyboard typing, NOT manual typing - fixes #23 1599 if (!base.isContentEditable && base.last.virtual) { 1600 1601 var scrollWidth, clientWidth, adjustment, direction, 1602 value = base.last.val.substring(0, Math.max(base.last.start, base.last.end)); 1603 1604 if (!base.$previewCopy) { 1605 // clone preview 1606 base.$previewCopy = base.$preview.clone() 1607 .removeAttr('id') // fixes #334 1608 .css({ 1609 position: 'absolute', 1610 left: 0, 1611 zIndex: -10, 1612 visibility: 'hidden' 1613 }) 1614 .addClass($keyboard.css.inputClone); 1615 // prevent submitting content on form submission 1616 base.$previewCopy[0].disabled = true; 1617 if (!base.isTextArea) { 1618 // make input zero-width because we need an accurate scrollWidth 1619 base.$previewCopy.css({ 1620 'white-space': 'pre', 1621 'width': 0 1622 }); 1623 } 1624 if (o.usePreview) { 1625 // add clone inside of preview wrapper 1626 base.$preview.after(base.$previewCopy); 1627 } else { 1628 // just slap that thing in there somewhere 1629 base.$keyboard.prepend(base.$previewCopy); 1630 } 1631 } 1632 1633 if (base.isTextArea) { 1634 // need the textarea scrollHeight, so set the clone textarea height to be the line height 1635 base.$previewCopy 1636 .height(base.lineHeight) 1637 .val(value); 1638 // set scrollTop for Textarea 1639 base.preview.scrollTop = base.lineHeight * 1640 (Math.floor(base.$previewCopy[0].scrollHeight / base.lineHeight) - 1); 1641 } else {
1642 // add non-breaking spaces 1643 base.$previewCopy.val(value.replace(/\s/g, '\xa0')); 1644 1645 // if scrollAdjustment option is set to "c" or "center" then center the caret 1646 adjustment = /c/i.test(o.scrollAdjustment) ? base.preview.clientWidth / 2 : o.scrollAdjustment; 1647 scrollWidth = base.$previewCopy[0].scrollWidth - 1; 1648 1649 // set initial state as moving right 1650 if (typeof base.last.scrollWidth === 'undefined') { 1651 base.last.scrollWidth = scrollWidth; 1652 base.last.direction = true; 1653 } 1654 // if direction = true; we're scrolling to the right 1655 direction = base.last.scrollWidth === scrollWidth ? 1656 base.last.direction : 1657 base.last.scrollWidth < scrollWidth; 1658 clientWidth = base.preview.clientWidth - adjustment; 1659 1660 // set scrollLeft for inputs; try to mimic the inherit caret positioning + scrolling: 1661 // hug right while scrolling right... 1662 if (direction) { 1663 if (scrollWidth < clientWidth) { 1664 base.preview.scrollLeft = 0; 1665 } else { 1666 base.preview.scrollLeft = scrollWidth - clientWidth; 1667 } 1668 } else { 1669 // hug left while scrolling left... 1670 if (scrollWidth >= base.preview.scrollWidth - clientWidth) { 1671 base.preview.scrollLeft = base.preview.scrollWidth - adjustment; 1672 } else if (scrollWidth - adjustment > 0) { 1673 base.preview.scrollLeft = scrollWidth - adjustment; 1674 } else { 1675 base.preview.scrollLeft = 0; 1676 } 1677 } 1678 1679 base.last.scrollWidth = scrollWidth; 1680 base.last.direction = direction; 1681 } 1682 } 1683 }; 1684 1685 base.bindFocus = function () { 1686 if (o.openOn) { 1687 // make sure keyboard isn't destroyed 1688 // Check if base exists, this is a case when destroy is called, before timers have fired 1689 if (base && base.el.active) { 1690 base.$el.bind(o.openOn + base.namespace, function () { 1691 base.focusOn(); 1692 }); 1693 // remove focus from element (needed for IE since blur doesn't seem to work) 1694 if ($(':focus')[0] === base.el) { 1695 base.$el.blur(); 1696 } 1697 } 1698 } 1699 }; 1700 1701 base.bindKeyboard = function () { 1702 var evt, 1703 keyCodes = $keyboard.keyCodes, 1704 layout = $keyboard.builtLayouts[base.layout], 1705 namespace = base.namespace + 'keybindings'; 1706 base.$preview 1707 .unbind(base.namespace) 1708 .bind('click' + namespace + ' touchstart' + namespace, function () { 1709 if (o.alwaysOpen && !base.isCurrent()) { 1710 base.reveal(); 1711 } 1712 // update last caret position after user click, use at least 150ms or it doesn't work in IE 1713 base.timer2 = setTimeout(function () { 1714 if (base){ 1715 base.saveCaret(); 1716 } 1717 }, 150); 1718 1719 }) 1720 .bind('keypress' + namespace, function (e) { 1721 if (o.lockInput) { 1722 return false; 1723 } 1724 if (!base.isCurrent()) { 1725 return; 1726 } 1727 1728 var k = e.charCode || e.which, 1729 // capsLock can only be checked while typing a-z 1730 k1 = k >= keyCodes.A && k <= keyCodes.Z, 1731 k2 = k >= keyCodes.a && k <= keyCodes.z, 1732 str = base.last.key = String.fromCharCode(k); 1733 // check, that keypress wasn't rise by functional key 1734 // space is first typing symbol in UTF8 table 1735 if (k < keyCodes.space) { //see #549 1736 return; 1737 } 1738 base.last.virtual = false; 1739 base.last.event = e; 1740 base.last.$key = []; // not a virtual keyboard key 1741 if (base.checkCaret) { 1742 base.saveCaret(); 1743 } 1744 1745 // update capsLock 1746 if (k !== keyCodes.capsLock && (k1 || k2)) { 1747 base.capsLock = (k1 && !e.shiftKey) || (k2 && e.shiftKey); 1748 // if shifted keyset not visible, then show it 1749 if (base.capsLock && !base.shiftActive) { 1750 base.shiftActive = true; 1751 base.showSet(); 1752 } 1753 } 1754 1755 // restrict input - keyCode in keypress special keys: 1756 // see http://www.asquare.net/javascript/tests/KeyCode.html 1757 if (o.restrictInput) { 1758 // allow navigation keys to work - Chrome doesn't fire a keypress event (8 = bksp) 1759 if ((e.which === keyCodes.backSpace || e.which === 0) && 1760 $.inArray(e.keyCode, base.alwaysAllowed)) { 1761 return; 1762 } 1763 // quick key check 1764 if ($.inArray(str, layout.acceptedKeys) === -1) { 1765 e.preventDefault(); 1766 // copy event object in case e.preventDefault() breaks when changing the type 1767 evt = $.extend({}, e); 1768 evt.type = $keyboard.events.inputRestricted; 1769 base.$el.trigger(evt, [base, base.el]); 1770 } 1771 } else if ((e.ctrlKey || e.metaKey) && 1772 (e.which === keyCodes.A || e.which === keyCodes.C || e.which === keyCodes.V || 1773 (e.which >= keyCodes.X && e.which <= keyCodes.Z))) {
1774 // Allow select all (ctrl-a), copy (ctrl-c), paste (ctrl-v) & cut (ctrl-x) & 1775 // redo (ctrl-y)& undo (ctrl-z); meta key for mac 1776 return; 1777 } 1778 // Mapped Keys - allows typing on a regular keyboard and the mapped key is entered 1779 // Set up a key in the layout as follows: 'm(a):label'; m = key to map, (a) = actual keyboard key 1780 // to map to (optional), ':label' = title/tooltip (optional) 1781 // example: \u0391 or \u0391(A) or \u0391:alpha or \u0391(A):alpha 1782 if (layout.hasMappedKeys && layout.mappedKeys.hasOwnProperty(str)) { 1783 base.last.key = layout.mappedKeys[str]; 1784 base.insertText(base.last.key); 1785 e.preventDefault(); 1786 } 1787 if (typeof o.beforeInsert === 'function') { 1788 base.insertText(base.last.key); 1789 e.preventDefault(); 1790 } 1791 base.checkMaxLength(); 1792 1793 }) 1794 .bind('keyup' + namespace, function (e) { 1795 if (!base.isCurrent()) { return; } 1796 base.last.virtual = false; 1797 switch (e.which) { 1798 // Insert tab key 1799 case keyCodes.tab: 1800 // Added a flag to prevent from tabbing into an input, keyboard opening, then adding the tab 1801 // to the keyboard preview area on keyup. Sadly it still happens if you don't release the tab 1802 // key immediately because keydown event auto-repeats 1803 if (base.tab && !o.lockInput) { 1804 base.shiftActive = e.shiftKey; 1805 // when switching inputs, the tab keyaction returns false 1806 var notSwitching = $keyboard.keyaction.tab(base); 1807 base.tab = false; 1808 if (!notSwitching) { 1809 return false; 1810 } 1811 } else { 1812 e.preventDefault(); 1813 } 1814 break; 1815 1816 // Escape will hide the keyboard 1817 case keyCodes.escape: 1818 if (!o.ignoreEsc) { 1819 base.close(o.autoAccept && o.autoAcceptOnEsc ? 'true' : false); 1820 } 1821 return false; 1822 } 1823 1824 // throttle the check combo function because fast typers will have an incorrectly positioned caret 1825 clearTimeout(base.throttled); 1826 base.throttled = setTimeout(function () { 1827 // fix error in OSX? see issue #102 1828 if (base && base.isVisible()) { 1829 base.checkCombos(); 1830 } 1831 }, 100); 1832 1833 base.checkMaxLength(); 1834 1835 base.last.preVal = '' + base.last.val; 1836 base.saveLastChange(); 1837 1838 // don't alter "e" or the "keyup" event never finishes processing; fixes #552 1839 var event = $.Event( $keyboard.events.kbChange ); 1840 // base.last.key may be empty string (shift, enter, tab, etc) when keyboard is first visible 1841 // use e.key instead, if browser supports it 1842 event.action = base.last.key; 1843 base.$el.trigger(event, [base, base.el]); 1844 1845 // change callback is no longer bound to the input element as the callback could be 1846 // called during an external change event with all the necessary parameters (issue #157) 1847 if (typeof o.change === 'function') { 1848 event.type = $keyboard.events.inputChange; 1849 o.change(event, base, base.el); 1850 return false; 1851 } 1852 if (o.acceptValid && o.autoAcceptOnValid) { 1853 if ( 1854 typeof o.validate === 'function' && 1855 o.validate(base, base.getValue(base.$preview)) 1856 ) { 1857 base.$preview.blur(); 1858 base.accept(); 1859 } 1860 } 1861 }) 1862 .bind('keydown' + namespace, function (e) { 1863 base.last.keyPress = e.which; 1864 // ensure alwaysOpen keyboards are made active 1865 if (o.alwaysOpen && !base.isCurrent()) { 1866 base.reveal(); 1867 } 1868 // prevent tab key from leaving the preview window 1869 if (e.which === keyCodes.tab) { 1870 // allow tab to pass through - tab to next input/shift
1870-tab for prev 1871 base.tab = true; 1872 return false; 1873 } 1874 if (o.lockInput || e.timeStamp === base.last.timeStamp) { 1875 return !o.lockInput; 1876 } 1877 1878 base.last.timeStamp = e.timeStamp; // fixes #659 1879 base.last.virtual = false; 1880 switch (e.which) { 1881 1882 case keyCodes.backSpace: 1883 $keyboard.keyaction.bksp(base, null, e); 1884 e.preventDefault(); 1885 break; 1886 1887 case keyCodes.enter: 1888 $keyboard.keyaction.enter(base, null, e); 1889 break; 1890 1891 // Show capsLock 1892 case keyCodes.capsLock: 1893 base.shiftActive = base.capsLock = !base.capsLock; 1894 base.showSet(); 1895 break; 1896 1897 case keyCodes.V: 1898 // prevent ctrl-v/cmd-v 1899 if (e.ctrlKey || e.metaKey) { 1900 if (o.preventPaste) { 1901 e.preventDefault(); 1902 return; 1903 } 1904 base.checkCombos(); // check pasted content 1905 } 1906 break; 1907 } 1908 }) 1909 .bind('mouseup touchend '.split(' ').join(namespace + ' '), function () { 1910 base.last.virtual = true; 1911 base.saveCaret(); 1912 }); 1913 1914 // prevent keyboard event bubbling 1915 base.$keyboard.bind('mousedown click touchstart '.split(' ').join(base.namespace + ' '), function (e) { 1916 e.stopPropagation(); 1917 if (!base.isCurrent()) { 1918 base.reveal(); 1919 $(base.el.ownerDocument).trigger('checkkeyboard' + base.namespace); 1920 } 1921 base.setFocus(); 1922 }); 1923 1924 // If preventing paste, block context menu (right click) 1925 if (o.preventPaste) { 1926 base.$preview.bind('contextmenu' + base.namespace, function (e) { 1927 e.preventDefault(); 1928 }); 1929 base.$el.bind('contextmenu' + base.namespace, function (e) { 1930 e.preventDefault(); 1931 }); 1932 } 1933 1934 }; 1935 1936 base.bindButton = function(events, handler) { 1937 var button = '.' + $keyboard.css.keyButton, 1938 callback = function(e) { 1939 e.stopPropagation(); 1940 // save closest keyboard wrapper/input to check in checkClose function 1941 e.$target = $(this).closest('.' + $keyboard.css.keyboard + ', .' + $keyboard.css.input); 1942 handler.call(this, e); 1943 }; 1944 if ($.fn.on) { 1945 // jQuery v1.7+ 1946 base.$keyboard.on(events, button, callback); 1947 } else if ($.fn.delegate) { 1948 // jQuery v1.4.2 - 3.0.0 1949 base.$keyboard.delegate(button, events, callback); 1950 } 1951 return base; 1952 }; 1953 1954 base.unbindButton = function(namespace) { 1955 if ($.fn.off) { 1956 // jQuery v1.7+ 1957 base.$keyboard.off(namespace); 1958 } else if ($.fn.undelegate) { 1959 // jQuery v1.4.2 - 3.0.0 (namespace only added in v1.6) 1960 base.$keyboard.undelegate('.' + $keyboard.css.keyButton, namespace); 1961 } 1962 return base; 1963 }; 1964 1965 base.bindKeys = function () { 1966 var kbcss = $keyboard.css; 1967 base 1968 .unbindButton(base.namespace + ' ' + base.namespace + 'kb') 1969 // Change hover class and tooltip - moved this touchstart before option.keyBinding touchstart 1970 // to prevent mousewheel lag/duplication - Fixes #379 & #411 1971 .bindButton('mouseenter mouseleave touchstart '.split(' ').join(base.namespace + ' '), function (e) { 1972 if ((o.alwaysOpen || o.userClosed) && e.type !== 'mouseleave' && !base.isCurrent()) { 1973 base.reveal(); 1974 base.setFocus(); 1975 } 1976 if (!base.isCurrent() || this.disabled) { 1977 return; 1978 } 1979 var $keys, txt, 1980 last = base.last, 1981 $this = $(this), 1982 type = e.type; 1983 1984 if (o.useWheel && base.wheel) { 1985 $keys = base.getLayers($this); 1986 txt = ($keys.length ? $keys.map(function () { 1987 return $(this).attr('data-value') || ''; 1988 }) 1989 .get() : '') || [$this.text()]; 1990 last.wheel_$Keys = $keys; 1991 last.wheelLayers = txt; 1992 last.wheelIndex = $.inArray($this.attr('data-value'), txt); 1993 } 1994 1995 if ((type === 'mouseenter' || type === 'touchstart') && base.el.type !== 'password' && 1996 !$this.hasClass(o.css.buttonDisabled)) { 1997 $this.addClass(o.css.buttonHover); 1998 if (o.useWheel && base.wheel) { 1999 $this.attr('title', function (i, t) { 2000 // show mouse wheel message 2001 return (base.wheel && t === '' && base.sets && txt.length > 1 && type !== 'touchstart') ? 2002 o.wheelMessage : t; 2003 }); 2004 } 2005 } 2006 if (type === 'mouseleave') { 2007 // needed or IE flickers really bad 2008 $this.removeClass((base.el.type === 'password') ? '' : o.css.buttonHover); 2009 if (o.useWheel && base.wheel) { 2010 last.wheelIndex = 0; 2011 last.wheelLayers = []; 2012 last.wheel_$Keys = []; 2013 $this 2014 .attr('title', function (i, t) { 2015 return (t === o.wheelMessage) ? '' : t; 2016 }) 2017 .html($this.attr('data-html')); // restore original button text 2018 } 2019 } 2020 }) 2021 // keyBinding = 'mousedown touchstart' by default 2022 .bindButton(o.keyBinding.split(' ').join(base.namespace + ' ') + base.namespace + ' ' + 2023 $keyboard.events.kbRepeater, function (e) { 2024 e.preventDefault(); 2025 // prevent errors when external triggers attempt to 'type' - see issue #158 2026 if (!base.$keyboard.is(':visible') || this.disabled) { 2027 return false; 2028 } 2029 var action, 2030 last = base.last, 2031 $key = $(this), 2032 // prevent mousedown & touchstart from both firing events at the same time - see #184 2033 timer = new Date().getTime(); 2034 2035 if (o.useWheel && base.wheel) { 2036 // get keys from other layers/keysets (shift, alt, meta, etc) that line up by data-position 2037 // target mousewheel selected key 2038 $key = last.wheel_$Keys.length && last.wheelIndex > -1 ? last.wheel_$Keys.eq(last.wheelIndex) : $key; 2039 } 2040 action = $key.attr('data-action'); 2041 if (timer - (last.eventTime || 0) < o.preventDoubleEventTime) { 2042 return; 2043 } 2044 last.eventTime = timer; 2045 last.event = e; 2046 last.virtual = true; 2047 last.$key = $key; 2048 last.key = $key.attr('data-value'); 2049 last.keyPress = ''; 2050 // Start caret in IE when not focused (happens with each virtual keyboard button click 2051 base.setFocus(); 2052 if (/^meta/.test(action)) { 2053 action = 'meta'; 2054 } 2055 // keyaction is added as a string, override original action & text 2056 if (action === last.key && typeof $keyboard.keyaction[action] === 'string') { 2057 last.key = action = $keyboard.keyaction[action]; 2058 } else if (action in $keyboard.keyaction && typeof $keyboard.keyaction[action] === 'function') { 2059 // stop processing if action returns false (close & cancel) 2060 if ($keyboard.keyaction[action](base, this, e) === false) { 2061 return false; 2062 } 2063 action = null; // prevent inserting action name 2064 } 2065 // stop processing if keyboard closed and keyaction did not return false - see #536 2066 if (!base.hasKeyboard()) { 2067 return false; 2068 } 2069 if (typeof action !== 'undefined' && action !== null) { 2070 last.key = $(this).hasClass(kbcss.keyAction) ? action : last.key; 2071 base.insertText(last.key); 2072 if (!base.capsLock && !o.stickyShift && !e.shiftKey) { 2073 base.shiftActive = false; 2074 base.showSet($key.attr('data-name')); 2075 } 2076 } 2077 // set caret if caret moved by action function; also, attempt to fix issue #131 2078 $keyboard.caret(base.$preview, last); 2079 base.checkCombos(); 2080 e = $.extend({}, e, $.Event($keyboard.events.kbChange)); 2081 e.target = base.el; 2082 e.action = last.key; 2083 base.$el.trigger(e, [base, base.el]);
2084 last.preVal = '' + last.val; 2085 base.saveLastChange(); 2086 2087 if (typeof o.change === 'function') { 2088 e.type = $keyboard.events.inputChange; 2089 o.change(e, base, base.el); 2090 // return false to prevent reopening keyboard if base.accept() was called 2091 return false; 2092 } 2093 2094 }) 2095 // using 'kb' namespace for mouse repeat functionality to keep it separate 2096 // I need to trigger a 'repeater.keyboard' to make it work 2097 .bindButton('mouseup' + base.namespace + ' ' + 'mouseleave touchend touchmove touchcancel '.split(' ') 2098 .join(base.namespace + 'kb '), function (e) { 2099 base.last.virtual = true; 2100 var offset, 2101 $this = $(this); 2102 if (e.type === 'touchmove') { 2103 // if moving within the same key, don't stop repeating 2104 offset = $this.offset(); 2105 offset.right = offset.left + $this.outerWidth(); 2106 offset.bottom = offset.top + $this.outerHeight(); 2107 if (e.originalEvent.touches[0].pageX >= offset.left && 2108 e.originalEvent.touches[0].pageX < offset.right && 2109 e.originalEvent.touches[0].pageY >= offset.top && 2110 e.originalEvent.touches[0].pageY < offset.bottom) { 2111 return true; 2112 } 2113 } else if (/(mouseleave|touchend|touchcancel)/i.test(e.type)) { 2114 $this.removeClass(o.css.buttonHover); // needed for touch devices 2115 } else { 2116 if (!o.noFocus && base.isCurrent() && base.isVisible()) { 2117 base.$preview.focus(); 2118 } 2119 if (base.checkCaret) { 2120 $keyboard.caret(base.$preview, base.last); 2121 } 2122 } 2123 base.mouseRepeat = [false, '']; 2124 clearTimeout(base.repeater); // make sure key repeat stops! 2125 if (o.acceptValid && o.autoAcceptOnValid) { 2126 if ( 2127 typeof o.validate === 'function' && 2128 o.validate(base, base.getValue()) 2129 ) { 2130 base.$preview.blur(); 2131 base.accept(); 2132 } 2133 } 2134 return false; 2135 }) 2136 // prevent form submits when keyboard is bound locally - issue #64 2137 .bindButton('click' + base.namespace, function () { 2138 return false; 2139 }) 2140 // Allow mousewheel to scroll through other keysets of the same (non-action) key 2141 .bindButton('mousewheel' + base.namespace, base.throttleEvent(function (e, delta) { 2142 var $btn = $(this); 2143 // no mouse repeat for action keys (shift, ctrl, alt, meta, etc) 2144 if (!$btn || $btn.hasClass(kbcss.keyAction) || base.last.wheel_$Keys[0] !== this) { 2145 return; 2146 } 2147 if (o.useWheel && base.wheel) { 2148 // deltaY used by newer versions of mousewheel plugin 2149 delta = delta || e.deltaY; 2150 var n, 2151 txt = base.last.wheelLayers || []; 2152 if (txt.length > 1) { 2153 n = base.last.wheelIndex + (delta > 0 ? -1 : 1); 2154 if (n > txt.length - 1) { 2155 n = 0; 2156 } 2157 if (n < 0) { 2158 n = txt.length - 1; 2159 } 2160 } else { 2161 n = 0; 2162 } 2163 base.last.wheelIndex = n; 2164 $btn.html(txt[n]); 2165 return false; 2166 } 2167 }, 30)) 2168 .bindButton('mousedown touchstart '.split(' ').join(base.namespace + 'kb '), function () { 2169 var $btn = $(this); 2170 // no mouse repeat for action keys (shift, ctrl, alt, meta, etc) 2171 if ( 2172 !$btn || ( 2173 $btn.hasClass(kbcss.keyAction) && 2174 // mouse repeated action key exceptions 2175 !$btn.is('.' + kbcss.keyPrefix + ('tab bksp space enter'.split(' ').join(',.' + kbcss.keyPrefix))) 2176 ) 2177 ) { 2178 return; 2179 } 2180 if (o.repeatRate !== 0) { 2181 // save the key, make sure we are repeating the right one (fast typers) 2182 base.mouseRepeat = [true, $btn]; 2183 setTimeout(function () { 2184 // don't repeat keys if it is disabled - see #431 2185 if (base && base.mouseRepeat[0] && base.mouseRepeat[1] === $btn && !$btn[0].disabled) { 2186 base.repeatKey($btn); 2187 } 2188 }, o.repeatDelay); 2189 } 2190 return false; 2191 }); 2192 }; 2193 2194 // No call on tailing event 2195 base.throttleEvent = function(cb, time) { 2196 var interm; 2197 return function() { 2198 if (!interm) { 2199 cb.apply(this, arguments); 2200 interm = true; 2201 setTimeout(function() { 2202 interm = false; 2203 }, time); 2204 } 2205 }; 2206 }; 2207 2208 base.execCommand = function(cmd, str) { 2209 base.el.ownerDocument.execCommand(cmd, false, str); 2210 base.el.normalize(); 2211 if (o.reposition) { 2212 base.reposition(); 2213 } 2214 }; 2215 2216 base.getValue = function ($el) { 2217 $el = $el || base.$preview; 2218 return $el[base.isContentEditable ? 'text' : 'val'](); 2219 }; 2220 2221 base.setValue = function (txt, $el) { 2222 $el = $el || base.$preview; 2223 if (base.isContentEditable) { 2224 if (txt !== $el.text()) { 2225 $keyboard.replaceContent($el, txt); 2226 base.saveCaret(); 2227 } 2228 } else { 2229 $el.val(txt); 2230 } 2231 return base; 2232 }; 2233 2234 // Insert text at caret/selection - thanks to Derek Wickwire for fixing this up! 2235 base.insertText = function (txt) { 2236 if (!base.$preview) { return base; } 2237 if (typeof o.beforeInsert === 'function') { 2238 txt = o.beforeInsert(base.last.event, base, base.el, txt); 2239 } 2240 if (typeof txt === 'undefined' || txt === false) { 2241 base.last.key = ''; 2242 return base; 2243 } 2244 if (base.isContentEditable) { 2245 return base.insertContentEditable(txt); 2246 } 2247 var t, 2248 bksp = false, 2249 isBksp = txt === '\b', 2250 // use base.$preview.val() instead of base.preview.value (val.length includes carriage returns in IE). 2251 val = base.getValue(), 2252 pos = $keyboard.caret(base.$preview), 2253 len = val.length; // save original content length 2254 2255 // silly IE caret hacks... it should work correctly, but navigating using arrow keys in a textarea 2256 // is still difficult 2257 // in IE, pos.end can be zero after input loses focus 2258 if (pos.end < pos.start) { 2259 pos.end = pos.start; 2260 } 2261 if (pos.start > len) { 2262 pos.end = pos.start = len; 2263 } 2264 2265 if (base.isTextArea) { 2266 // This makes sure the caret moves to the next line after clicking on enter (manual typing works fine) 2267 if ($keyboard.msie && val.substring(pos.start, pos.start + 1) === '\n') { 2268 pos.start += 1; 2269 pos.end += 1; 2270 } 2271 } 2272 2273 t = pos.start; 2274 if (txt === '{d}') { 2275 txt = ''; 2276 pos.end += 1; 2277 } 2278 2279 if (isBksp) { 2280 txt = ''; 2281 bksp = isBksp && t === pos.end && t > 0; 2282 } 2283 val = val.substring(0, t - (bksp ? 1 : 0)) + txt + val.substring(pos.end); 2284 t += bksp ? -1 : txt.length; 2285 2286 base.setValue(val); 2287 base.saveCaret(t, t); // save caret in case of bksp 2288 base.setScroll(); 2289 // see #506.. allow chaining of insertText 2290 return base; 2291 }; 2292 2293 base.insertContentEditable = function (txt) { 2294 base.$preview.focus(); 2295 base.execCommand('insertText', txt); 2296 base.saveCaret(); 2297 return base; 2298 }; 2299 2300 // check max length 2301 base.checkMaxLength = function () { 2302 if (!base.$preview) { return; } 2303 var start, caret, 2304 val = base.getValue(), 2305 len = base.isContentEditable ? $keyboard.getEditableLength(base.el) : val.length; 2306 if (o.maxLength !== false && len > o.maxLength) { 2307 start = $keyboard.caret(base.$preview).start; 2308 caret = Math.min(start, o.maxLength); 2309 2310 // prevent inserting new characters when maxed #289 2311 if (!o.maxInsert) { 2312 val = base.last.val; 2313 caret = start - 1; // move caret back one 2314 } 2315 base.setValue(val.substring(0, o.maxLength)); 2316 // restore caret on change, otherwise it ends up at the end. 2317 base.saveCaret(caret, caret); 2318 } 2319 if (base.$decBtn.length) { 2320 base.checkDecimal(); 2321 } 2322 // allow chaining 2323 return base; 2324 }; 2325 2326 // mousedown repeater 2327 base.repeatKey = function (key) { 2328 key.trigger($keyboard.events.kbRepeater); 2329 if (base.mouseRepeat[0]) { 2330 base.repeater = setTimeout(function () { 2331 if (base){ 2332 base.repeatKey(key); 2333 } 2334 }, base.repeatTime); 2335 } 2336 }; 2337 2338 base.getKeySet = function () { 2339 var sets = []; 2340 if (base.altActive) { 2341 sets.push('alt'); 2342 } 2343 if (base.shiftActive) { 2344 sets.push('shift'); 2345 } 2346 if (base.metaActive) { 2347 // base.metaActive contains the string name of the 2348 // current meta keyset 2349 sets.push(base.metaActive); 2350 } 2351 return sets.length ? sets.join('+') : 'normal'; 2352 }; 2353 2354 // make it easier to switch keysets via API 2355 // showKeySet('shift+alt+meta1') 2356 base.showKeySet = function (str) { 2357 if (typeof str === 'string') { 2358 base.last.keyset = [base.shiftActive, base.altActive, base.metaActive]; 2359 base.shiftActive = /shift/i.test(str); 2360 base.altActive = /alt/i.test(str); 2361 if (/\bmeta/.test(str)) { 2362 base.metaActive = true; 2363 base.showSet(str.match(/\bmeta[\w-]+/i)[0]); 2364 } else { 2365 base.metaActive = false; 2366 base.showSet(); 2367 } 2368 } else { 2369 base.showSet(str); 2370 } 2371 // allow chaining 2372 return base; 2373 }; 2374 2375 base.showSet = function (name) { 2376 if (!base.hasKeyboard()) { return; } 2377 o = base.options; // refresh options 2378 var kbcss = $keyboard.css, 2379 prefix = '.' + kbcss.keyPrefix, 2380 active = o.css.buttonActive, 2381 key = '', 2382 toShow = (base.shiftActive ? 1 : 0) + (base.altActive ? 2 : 0); 2383 if (!base.shiftActive) { 2384 base.capsLock = false; 2385 } 2386 // check meta key set 2387 if (base.metaActive) { 2388 // remove "-shift" and "-alt" from meta name if it exists 2389 if (base.shiftActive) { 2390 name = (name || '').replace('-shift', ''); 2391 } 2392 if (base.altActive) { 2393 name = (name || '').replace('-alt', ''); 2394 } 2395 // the name attribute contains the meta set name 'meta99' 2396 key = (/^meta/i.test(name)) ? name : ''; 2397 // save active meta keyset name 2398 if (key === '') { 2399 key = (base.metaActive === true) ? '' : base.metaActive; 2400 } else { 2401 base.metaActive = key; 2402 } 2403 // if meta keyset doesn't have a shift or alt keyset, then show just the meta key set 2404 if ((!o.stickyShift && base.last.keyset[2] !== base.metaActive) || 2405 ((base.shiftActive || base.altActive) && 2406 !base.$keyboard.find('.' + kbcss.keySet + '-' + key + base.rows[toShow]).length)) { 2407 base.shiftActive = base.altActive = false; 2408 } 2409 } else if (!o.stickyShift && base.last.keyset[2] !== base.metaActive && base.shiftActive) { 2410 // switching from meta key set back to default, reset shift & alt if using stickyShift 2411 base.shiftActive = base.altActive = false; 2412 } 2413 toShow = (base.shiftActive ? 1 : 0) + (base.altActive ? 2 : 0); 2414 key = (toShow === 0 && !base.metaActive) ? '-normal' : (key === '') ? '' : '-' + key; 2415 if (!base.$keyboard.find('.' + kbcss.keySet + key + base.rows[toShow]).length) { 2416 // keyset doesn't exist, so restore last keyset settings 2417 base.shiftActive = base.last.keyset[0]; 2418 base.altActive = base.last.keyset[1]; 2419 base.metaActive = base.last.keyset[2]; 2420 return; 2421 } 2422 base.$keyboard 2423 .find(prefix + 'alt,' + prefix + 'shift,.' + kbcss.keyAction + '[class*=meta]') 2424 .removeClass(active) 2425 .end() 2426 .find(prefix + 'alt') 2427 .toggleClass(active, base.altActive) 2428 .end() 2429 .find(prefix + 'shift') 2430 .toggleClass(active, base.shiftActive) 2431 .end() 2432 .find(prefix + 'lock') 2433 .toggleClass(active, base.capsLock) 2434 .end() 2435 .find('.' + kbcss.keySet) 2436 .hide() 2437 .end() 2438 .find('.' + (kbcss.keyAction + prefix + key).replace('--', '-')) 2439 .addClass(active); 2440 2441 // show keyset using inline-block ( extender layout will then line up ) 2442 base.$keyboard.find('.' + kbcss.keySet + key + base.rows[toShow])[0].style.display = 'inline-block'; 2443 if (base.metaActive) { 2444 base.$keyboard.find(prefix + base.metaActive) 2445 // base.metaActive contains the string "meta#" or false 2446 // without the !== false, jQuery UI tries to transition the classes 2447 .toggleClass(active, base.metaActive !== false); 2448 } 2449 base.last.keyset = [base.shiftActive, base.altActive, base.metaActive]; 2450 base.$el.trigger($keyboard.events.kbKeysetChange, [base, base.el]); 2451 if (o.reposition) { 2452 base.reposition(); 2453 } 2454 }; 2455 2456 // check for key combos (dead keys) 2457 base.checkCombos = function () { 2458 // return val for close function 2459 if ( !( 2460 base.isVisible() || ( 2461 base.hasKeyboard() && 2462 base.$keyboard.hasClass( $keyboard.css.hasFocus ) 2463 ) 2464 ) ) { 2465 return base.getValue(base.$preview || base.$el); 2466 } 2467 var r, t, t2, repl, 2468 // use base.$preview.val() instead of base.preview.value 2469 // (val.length includes carriage returns in IE). 2470 val = base.getValue(), 2471 pos = $keyboard.caret(base.$preview), 2472 layout = $keyboard.builtLayouts[base.layout], 2473 max = base.isContentEditable ? $keyboard.getEditableLength(base.el) : val.length, 2474 // save original content length 2475 len = max; 2476 // return if val is empty; fixes #352 2477 if (val === '') { 2478 // check valid on empty string - see #429 2479 if (o.acceptValid) { 2480 base.checkValid(); 2481 } 2482 return val; 2483 } 2484 2485 // silly IE caret hacks... it should work correctly, but navigating using arrow keys in a textarea 2486 // is still difficult 2487 // in IE, pos.end can be zero after input loses focus 2488 if (pos.end < pos.start) { 2489 pos.end = po
2489s.start; 2490 } 2491 if (pos.start > len) { 2492 pos.end = pos.start = len; 2493 } 2494 // This makes sure the caret moves to the next line after clicking on enter (manual typing works fine) 2495 if ($keyboard.msie && val.substring(pos.start, pos.start + 1) === '\n') { 2496 pos.start += 1; 2497 pos.end += 1; 2498 } 2499 2500 if (o.useCombos) { 2501 // keep 'a' and 'o' in the regex for ae and oe ligature (æ,Å) 2502 // thanks to KennyTM: http://stackoverflow.com/q/4275077 2503 // original regex /([`\'~\^\"ao])([a-z])/mig moved to $.keyboard.comboRegex 2504 if ($keyboard.msie) { 2505 // old IE may not have the caret positioned correctly, so just check the whole thing 2506 val = val.replace(base.regex, function (s, accent, letter) { 2507 return (o.combos.hasOwnProperty(accent)) ? o.combos[accent][letter] || s : s; 2508 }); 2509 // prevent combo replace error, in case the keyboard closes - see issue #116 2510 } else if (base.$preview.length) {
2511 // Modern browsers - check for combos from last two characters left of the caret 2512 t = pos.start - (pos.start - 2 >= 0 ? 2 : 0); 2513 // target last two characters 2514 $keyboard.caret(base.$preview, t, pos.end); 2515 // do combo replace 2516 t = $keyboard.caret(base.$preview); 2517 repl = function (txt) { 2518 return (txt || '').replace(base.regex, function (s, accent, letter) { 2519 return (o.combos.hasOwnProperty(accent)) ? o.combos[accent][letter] || s : s; 2520 }); 2521 }; 2522 t2 = repl(t.text); 2523 // add combo back 2524 // prevent error if caret doesn't return a function 2525 if (t && t.replaceStr && t2 !== t.text) { 2526 if (base.isContentEditable) { 2527 $keyboard.replaceContent(el, repl); 2528 } else { 2529 base.setValue(t.replaceStr(t2)); 2530 } 2531 } 2532 val = base.getValue(); 2533 } 2534 } 2535 2536 // check input restrictions - in case content was pasted 2537 if (o.restrictInput && val !== '') { 2538 t = layout.acceptedKeys.length; 2539 2540 r = layout.acceptedKeysRegex; 2541 if (!r) { 2542 t2 = $.map(layout.acceptedKeys, function (v) { 2543 // escape any special characters 2544 return v.replace(base.escapeRegex, '\\$&'); 2545 }); 2546 if (base.alwaysAllowed.indexOf($keyboard.keyCodes.enter) > -1) { 2547 t2.push('\\n'); // Fixes #686 2548 } 2549 r = layout.acceptedKeysRegex = new RegExp('(' + t2.join('|') + ')', 'g'); 2550 } 2551 // only save matching keys 2552 t2 = val.match(r); 2553 if (t2) { 2554 val = t2.join(''); 2555 } else { 2556 // no valid characters 2557 val = ''; 2558 len = 0; 2559 } 2560 } 2561 2562 // save changes, then reposition caret 2563 pos.start += max - len; 2564 pos.end += max - len; 2565 2566 base.setValue(val); 2567 base.saveCaret(pos.start, pos.end); 2568 // set scroll to keep caret in view 2569 base.setScroll(); 2570 base.checkMaxLength(); 2571 2572 if (o.acceptValid) { 2573 base.checkValid(); 2574 } 2575 return val; // return text, used for keyboard closing section 2576 }; 2577 2578 // Toggle accept button classes, if validating 2579 base.checkValid = function () { 2580 var kbcss = $keyboard.css, 2581 $accept = base.$keyboard.find('.' + kbcss.keyPrefix + 'accept'), 2582 valid = true; 2583 if (typeof o.validate === 'function') { 2584 valid = o.validate(base, base.getValue(), false); 2585 } 2586 // toggle accept button classes; defined in the css 2587 $accept 2588 .toggleClass(kbcss.inputInvalid, !valid) 2589 .toggleClass(kbcss.inputValid, valid) 2590 // update title to indicate that the entry is valid or invalid 2591 .attr('title', $accept.attr('data-title') + ' (' + o.display[valid ? 'valid' : 'invalid'] + ')'); 2592 }; 2593 2594 // Decimal button for num pad - only allow one (not used by default) 2595 base.checkDecimal = function () { 2596 // Check US '.' or European ',' format 2597 if ((base.decimal && /\./g.test(base.preview.value)) || 2598 (!base.decimal && /\,/g.test(base.preview.value))) { 2599 base.$decBtn 2600 .attr({ 2601 'disabled': 'disabled', 2602 'aria-disabled': 'true' 2603 }) 2604 .removeClass(o.css.buttonHover) 2605 .addClass(o.css.buttonDisabled); 2606 } else { 2607 base.$decBtn 2608 .removeAttr('disabled') 2609 .attr({ 2610 'aria-disabled': 'false' 2611 }) 2612 .addClass(o.css.buttonDefault) 2613 .removeClass(o.css.buttonDisabled); 2614 } 2615 }; 2616 2617 // get other layer values for a specific key 2618 base.getLayers = function ($el) { 2619 var kbcss = $keyboard.css, 2620 key = $el.attr('data-pos'), 2621 $keys = $el.closest('.' + kbcss.keyboard) 2622 .find('button[data-pos="' + key + '"]'); 2623 return $keys.filter(function () { 2624 return $(this) 2625 .find('.' + kbcss.keyText) 2626 .text() !== ''; 2627 }) 2628 .add($el); 2629 }; 2630 2631 // Go to next or prev inputs
2632 // goToNext = true, then go to next input; if false go to prev 2633 // isAccepted is from autoAccept option or true if user presses shift+enter 2634 base.switchInput = function (goToNext, isAccepted) { 2635 if (typeof o.switchInput === 'function') { 2636 o.switchInput(base, goToNext, isAccepted); 2637 } else { 2638 // base.$keyboard may be an empty array - see #275 (apod42) 2639 if (base.$keyboard.length) { 2640 base.$keyboard.hide(); 2641 } 2642 var kb, 2643 stopped = false, 2644 all = $('button, input, select, textarea, a, [contenteditable]') 2645 .filter(':visible') 2646 .not(':disabled'), 2647 indx = all.index(base.$el) + (goToNext ? 1 : -1); 2648 if (base.$keyboard.length) { 2649 base.$keyboard.show(); 2650 } 2651 if (indx > all.length - 1) { 2652 stopped = o.stopAtEnd; 2653 indx = 0; // go to first input 2654 } 2655 if (indx < 0) { 2656 stopped = o.stopAtEnd; 2657 indx = all.length - 1; // stop or go to last 2658 } 2659 if (!stopped) { 2660 isAccepted = base.close(isAccepted); 2661 if (!isAccepted) { 2662 return; 2663 } 2664 kb = all.eq(indx).data('keyboard'); 2665 if (kb && kb.options.openOn.length) { 2666 kb.focusOn(); 2667 } else { 2668 all.eq(indx).focus(); 2669 } 2670 } 2671 } 2672 return false; 2673 }; 2674 2675 // Close the keyboard, if visible. Pass a status of true, if the content was accepted 2676 // (for the event trigger). 2677 base.close = function (accepted) { 2678 if (base.isOpen && base.$keyboard.length) { 2679 clearTimeout(base.throttled); 2680 var kbcss = $keyboard.css, 2681 kbevents = $keyboard.events, 2682 val = accepted ? base.checkCombos() : base.originalContent; 2683 // validate input if accepted 2684 if (accepted && typeof o.validate === 'function' && !o.validate(base, val, true)) { 2685 val = base.originalContent; 2686 accepted = false; 2687 if (o.cancelClose) { 2688 return; 2689 } 2690 } 2691 base.isCurrent(false); 2692 base.isOpen = o.alwaysOpen || o.userClosed; 2693 if (base.isContentEditable && !accepted) { 2694 // base.originalContent stores the HTML 2695 base.$el.html(val); 2696 } else { 2697 base.setValue(val, base.$el); 2698 } 2699 base.$el 2700 .removeClass(kbcss.isCurrent + ' ' + kbcss.inputAutoAccepted) 2701 // add 'ui-keyboard-autoaccepted' to inputs - see issue #66 2702 .addClass((accepted || false) ? accepted === true ? '' : kbcss.inputAutoAccepted : '') 2703 // trigger default change event - see issue #146 2704 .trigger(kbevents.inputChange); 2705 // don't trigger an empty event - see issue #463 2706 if (!o.alwaysOpen) { 2707 // don't trigger beforeClose if keyboard is always open 2708 base.$el.trigger(kbevents.kbBeforeClose, [base, base.el, (accepted || false)]); 2709 } 2710 // save caret after updating value (fixes userClosed issue with changing focus) 2711 $keyboard.caret(base.$preview, base.last); 2712 2713 base.$el 2714 .trigger(((accepted || false) ? kbevents.inputAccepted : kbevents.inputCanceled), [base, base.el]) 2715 .trigger((o.alwaysOpen) ? kbevents.kbInactive : kbevents.kbHidden, [base, base.el]) 2716 .blur(); 2717 2718 // base is undefined if keyboard was destroyed - fixes #358 2719 if (base) { 2720 // add close event time 2721 base.last.eventTime = new Date().getTime(); 2722 if (!(o.alwaysOpen || o.userClosed && accepted === 'true') && base.$keyboard.length) { 2723 // free up memory 2724 base.removeKeyboard(); 2725 // rebind input focus - delayed to fix IE issue #72 2726 base.timer = setTimeout(function () { 2727 if (base) { 2728 base.bindFocus(); 2729 } 2730 }, 200); 2731 } 2732 if (!base.watermark && base.el.value === '' && base.inPlaceholder !== '') { 2733 base.$el.addClass(kbcss.placeholder); 2734 base.setValue(base.inPlaceholder, base.$el); 2735 } 2736 } 2737 } 2738 return !!accepted; 2739 }; 2740 2741 base.accept = function () { 2742 return base.close(true); 2743 }; 2744 2745 base.checkClose = function (e) { 2746 if (base.opening) { 2747 return; 2748 } 2749 var kbcss = $.keyboard.css, 2750 $target = e.$target || $(e.target).closest('.' + $keyboard.css.keyboard + ', .' + $keyboard.css.input); 2751 if (!$target.length) { 2752 $target = $(e.target); 2753 } 2754 // needed for IE to allow switching between keyboards smoothly 2755 if ($target.length && $target.hasClass(kbcss.keyboard)) { 2756 var kb = $target.data('keyboard'); 2757 // only trigger on self 2758 if ( 2759 kb !== base && 2760 !kb.$el.hasClass(kbcss.isCurrent) && 2761 kb.options.openOn && 2762 e.type === o.openOn 2763 ) { 2764 kb.focusOn();
2765 } 2766 } else { 2767 base.escClose(e, $target); 2768 } 2769 }; 2770 2771 // callback functions called to check if the keyboard needs to be closed 2772 // e.g. on escape or clicking outside the keyboard 2773 base.escCloseCallback = { 2774 // keep keyboard open if alwaysOpen or stayOpen is true - fixes mutliple 2775 // always open keyboards or single stay open keyboard 2776 keepOpen: function() { 2777 return !base.isOpen; 2778 } 2779 }; 2780 2781 base.escClose = function (e, $el) { 2782 if (!base.isOpen) { 2783 return; 2784 } 2785 if (e && e.type === 'keyup') { 2786 return (e.which === $keyboard.keyCodes.escape && !o.ignoreEsc) ? 2787 base.close(o.autoAccept && o.autoAcceptOnEsc ? 'true' : false) : 2788 ''; 2789 } 2790 var shouldStayOpen = false, 2791 $target = $el.length && $el || $(e.target); 2792 $.each(base.escCloseCallback, function(i, callback) { 2793 if (typeof callback === 'function') { 2794 shouldStayOpen = shouldStayOpen || callback($target); 2795 } 2796 }); 2797 if (shouldStayOpen) { 2798 return; 2799 } 2800 // ignore autoaccept if using escape - good idea? 2801 if (!base.isCurrent() && base.isOpen || base.isOpen && $target[0] !== base.el) { 2802 // don't close if stayOpen is set; but close if a different keyboard is being opened 2803 if ((o.stayOpen || o.userClosed) && !$target.hasClass($keyboard.css.input)) { 2804 return; 2805 } 2806 // stop propogation in IE - an input getting focus doesn't open a keyboard if one is already open 2807 if ($keyboard.allie) { 2808 e.preventDefault(); 2809 } 2810 if (o.closeByClickEvent) { 2811 // only close the keyboard if the user is clicking on an input or if they cause a click 2812 // event (touchstart/mousedown will not force the close with this setting) 2813 var name = $target[0] && $target[0].nodeName.toLowerCase(); 2814 if (name === 'input' || name === 'textarea' || e.type === 'click') { 2815 base.close(o.autoAccept ? 'true' : false); 2816 } 2817 } else { 2818 // send 'true' instead of a true (boolean), the input won't get a 'ui-keyboard-autoaccepted' 2819 // class name - see issue #66 2820 base.close(o.autoAccept ? 'true' : false); 2821 } 2822 } 2823 }; 2824 2825 // Build default button 2826 base.keyBtn = $('<button />') 2827 .attr({ 2828 'role': 'button', 2829 'type': 'button', 2830 'aria-disabled': 'false', 2831 'tabindex': '-1' 2832 }) 2833 .addClass($keyboard.css.keyButton); 2834 2835 // convert key names into a class name 2836 base.processName = function (name) { 2837 var index, n, 2838 process = (name || '').replace(/[^a-z0-9-_]/gi, ''), 2839 len = process.length, 2840 newName = []; 2841 if (len > 1 && name === process) { 2842 // return name if basic text 2843 return name; 2844 } 2845 // return character code sequence 2846 len = name.length; 2847 if (len) { 2848 for (index = 0; index < len; index++) { 2849 n = name[index]; 2850 // keep '-' and '_'... so for dash, we get two dashes in a row 2851 newName.push(/[a-z0-9-_]/i.test(n) ? 2852 (/[-_]/.test(n) && index !== 0 ? '' : n) : 2853 (index === 0 ? '' : '-') + n.charCodeAt(0) 2854 ); 2855 } 2856 return newName.join(''); 2857 } 2858 return name; 2859 }; 2860 2861 base.processKeys = function (name) { 2862 var tmp, parts, 2863 htmlIndex = name.indexOf('</'), 2864 data = { 2865 name: name, 2866 map: '', 2867 title: '' 2868 }; 2869 if (htmlIndex > -1) { 2870 // If it looks like HTML, skip processing; see #743 2871 // html may include colons; see #701 2872 return data; 2873 } 2874 // Don't split colons followed by //, e.g. https://; Fixes #555 2875 parts = name.split(/:(?!\/\/)/); 2876 2877 /* map defined keys 2878 format 'key(A):Label_for_key_(ignore_parentheses_here)' 2879 'key' = key that is seen (can any character(s); but it might need to be escaped using '\' 2880 or entered as unicode '\u####' 2881 '(A)' = the actual key on the real keyboard to remap 2882 ':Label_for_key' ends up in the title/tooltip 2883 Examples: 2884 '\u0391(A):alpha', 'x(y):this_(might)_cause_problems 2885 or edge cases of ':(x)', 'x(:)', 'x(()' or 'x())' 2886 Enhancement (if I can get alt keys to work): 2887 A mapped key will include the mod key, e.g. 'x(alt-x)' or 'x(alt-shift-x)' 2888 */ 2889 if (/\(.+\)/.test(parts[0]) || /^:\(.+\)/.test(name) || /\([(:)]\)/.test(name)) { 2890 // edge cases 'x(:)', 'x(()' or 'x())' 2891 if (/\([(:)]\)/.test(name)) { 2892 tmp = parts[0].match(/([^(]+)\((.+)\)/); 2893 if (tmp && tmp.length) { 2894 data.name = tmp[1]; 2895 data.map = tmp[2]; 2896 data.title = parts.length > 1 ? parts.slice(1).join(':') : ''; 2897 } else { 2898 // edge cases 'x(:)', ':(x)' or ':(:)' 2899 data.name = name.match(/([^(]+)/)[0]; 2900 if (data.name === ':') { 2901 // ':(:):test' => parts = [ '', '(', ')', 'title' ] need to slice 1 2902 parts = parts.slice(1); 2903 } 2904 if (tmp === null) { 2905 // 'x(:):test' => parts = [ 'x(', ')', 'title' ] need to slice 2 2906 data.map = ':'; 2907 parts = parts.slice(2); 2908 } 2909 data.title = parts.length ? parts.join(':') : ''; 2910 } 2911 } else { 2912 // example: \u0391(A):alpha; extract 'A' from '(A)'
2913 data.map = name.match(/\(([^()]+?)\)/)[1]; 2914 // remove '(A)', left with '\u0391:alpha' 2915 name = name.replace(/\(([^()]+)\)/, ''); 2916 tmp = name.split(':'); 2917 // get '\u0391' from '\u0391:alpha' 2918 if (tmp[0] === '') { 2919 data.name = ':'; 2920 parts = parts.slice(1); 2921 } else { 2922 data.name = tmp[0]; 2923 } 2924 data.title = parts.length > 1 ? parts.slice(1).join(':') : ''; 2925 } 2926 } else { 2927 // find key label 2928 // corner case of '::;' reduced to ':;', split as ['', ';'] 2929 if (name !== '' && parts[0] === '') { 2930 data.name = ':'; 2931 parts = parts.slice(1); 2932 } else { 2933 data.name = parts[0]; 2934 } 2935 data.title = parts.length > 1 ? parts.slice(1).join(':') : ''; 2936 } 2937 data.title = $.trim(data.title).replace(/_/g, ' '); 2938 return data; 2939 }; 2940 2941 // Add key function 2942 // keyName = the name of the function called in $.keyboard.keyaction when the button is clicked 2943 // name = name added to key, or cross-referenced in the display options 2944 // base.temp[0] = keyset to attach the new button 2945 // regKey = true when it is not an action key 2946 base.addKey = function (keyName, action, regKey) { 2947 var keyClass, tmp, keys, 2948 data = {}, 2949 txt = base.processKeys(regKey ? keyName : action), 2950 kbcss = $keyboard.css; 2951 2952 if (!regKey && o.display[txt.name]) { 2953 keys = base.processKeys(o.display[txt.name]); 2954 // action contained in "keyName" (e.g. keyName = "accept", 2955 // action = "a" (use checkmark instead of text)) 2956 keys.action = base.processKeys(keyName).name; 2957 } else { 2958 // when regKey is true, keyName is the same as action 2959 keys = txt; 2960 keys.action = txt.name; 2961 } 2962 2963 data.name = base.processName(txt.name); 2964 if (keys.name !== '') { 2965 if (keys.map !== '') { 2966 $keyboard.builtLayouts[base.layout].mappedKeys[keys.map] = keys.name; 2967 $keyboard.builtLayouts[base.layout].acceptedKeys.push(keys.name); 2968 } else if (regKey) { 2969 $keyboard.builtLayouts[base.layout].acceptedKeys.push(keys.name); 2970 } 2971 } 2972 2973 if (regKey) { 2974 keyClass = data.name === '' ? '' : kbcss.keyPrefix + data.name; 2975 } else { 2976 // Action keys will have the 'ui-keyboard-actionkey' class 2977 keyClass = kbcss.keyAction + ' ' + kbcss.keyPrefix + keys.action; 2978 } 2979 // '\u2190'.length = 1 because the unicode is converted, so if more than one character, 2980 // add the wide class 2981 keyClass += (keys.name.length > 2 ? ' ' + kbcss.keyWide : '') + ' ' + o.css.buttonDefault; 2982 2983 // Allow HTML in the key.name 2984 data.html = '<span class="' + kbcss.keyText + '">' + keys.name + '</span>'; 2985 2986 data.$key = base.keyBtn 2987 .clone() 2988 .attr({ 2989 'data-value': regKey ? keys.name : keys.action, // value 2990 'data-name': keys.action, 2991 'data-pos': base.temp[1] + ',' + base.temp[2], 2992 'data-action': keys.action, 2993 'data-html': data.html 2994 }) 2995 // add 'ui-keyboard-' + data.name for all keys 2996 // (e.g. 'Bksp' will have 'ui-keyboard-bskp' class) 2997 // any non-alphanumeric characters will be replaced with 2998 // their decimal unicode value 2999 // (e.g. '~' is a regular key, class = 'ui-keyboard-126' 3000 // (126 is the unicode decimal value - same as ~) 3001 // See https://en.wikipedia.org/wiki/List_of_Unicode_characters#Control_codes 3002 .addClass(keyClass) 3003 .html(data.html) 3004 .appendTo(base.temp[0]); 3005 3006 if (keys.map) { 3007 data.$key.attr('data-mapped', keys.map); 3008 } 3009 if (keys.title || txt.title) { 3010 data.$key.attr({ 3011 'data-title': txt.title || keys.title, // used to allow adding content to title 3012 'title': txt.title || keys.title 3013 }); 3014 } 3015 3016 if (typeof o.buildKey === 'function') { 3017 data = o.buildKey(base, data); 3018 // copy html back to attributes 3019 tmp = data.$key.html(); 3020 data.$key.attr('data-html', tmp); 3021 } 3022 return data.$key; 3023 }; 3024 3025 base.customHash = function (layout) { 3026 /*jshint bitwise:false */ 3027 var i, array, hash, character, len, 3028 arrays = [], 3029 merged = []; 3030 // pass layout to allow for testing 3031 layout = typeof layout === 'undefined' ? o.customLayout : layout; 3032 // get all layout arrays 3033 for (array in layout) { 3034 if (layout.hasOwnProperty(array)) { 3035 arrays.push(layout[array]); 3036 } 3037 } 3038 // flatten array 3039 merged = merged.concat.apply(merged, arrays).join(' '); 3040 // produce hash name - http://stackoverflow.com/a/7616484/145346 3041 hash = 0; 3042 len = merged.length; 3043 if (len === 0) { 3044 return hash; 3045 } 3046 for (i = 0; i < len; i++) { 3047 character = merged.charCodeAt(i); 3048 hash = ((hash << 5) - hash) + character; 3049 hash = hash & hash; // Convert to 32bit integer 3050 } 3051 return hash; 3052 }; 3053 3054 base.buildKeyboard = function (name, internal) { 3055 // o.display is empty when this is called from the scramble extension (when alwaysOpen:true) 3056 if ($.isEmptyObject(o.display)) { 3057 // set keyboard language 3058 base.updateLanguage(); 3059 } 3060 var index, row, $row, currentSet, 3061 kbcss = $keyboard.css, 3062 sets = 0, 3063 layout = $keyboard.builtLayouts[name || base.layout || o.layout] = { 3064 mappedKeys: {}, 3065 acceptedKeys: [] 3066 }, 3067 acceptedKeys = layout.acceptedKeys = o.restrictInclude ? 3068 ('' + o.restrictInclude).split(/\s+/) || [] : 3069 [], 3070 // using $layout temporarily to hold keyboard popup classnames 3071 $layout = kbcss.keyboard + ' ' + o.css.popup + ' ' + o.css.
3071container + 3072 (o.alwaysOpen || o.userClosed ? ' ' + kbcss.alwaysOpen : ''), 3073 3074 container = $('<div />') 3075 .addClass($layout) 3076 .attr({ 3077 'role': 'textbox' 3078 }) 3079 .hide(); 3080 3081 // allow adding "{space}" as an accepted key - Fixes #627 3082 index = $.inArray('{space}', acceptedKeys); 3083 if (index > -1) { 3084 acceptedKeys[index] = ' '; 3085 } 3086 3087 // verify layout or setup custom keyboard 3088 if ((internal && o.layout === 'custom') || !$keyboard.layouts.hasOwnProperty(o.layout)) { 3089 o.layout = 'custom'; 3090 $layout = $keyboard.layouts.custom = o.customLayout || { 3091 'normal': ['{cancel}'] 3092 }; 3093 } else { 3094 $layout = $keyboard.layouts[internal ? o.layout : name || base.layout || o.layout]; 3095 } 3096 3097 // Main keyboard building loop 3098 $.each($layout, function (set, keySet) { 3099 // skip layout name & lang settings 3100 if (set !== '' && !/^(name|lang|rtl)$/i.test(set)) { 3101 // keep backwards compatibility for change from default to normal naming 3102 if (set === 'default') { 3103 set = 'normal'; 3104 } 3105 sets++; 3106 $row = $('<div />') 3107 .attr('name', set) // added for typing extension 3108 .addClass(kbcss.keySet + ' ' + kbcss.keySet + '-' + set) 3109 .appendTo(container) 3110 .toggle(set === 'normal'); 3111 3112 for (row = 0; row < keySet.length; row++) { 3113 // remove extra spaces before spliting (regex probably could be improved) 3114 currentSet = $.trim(keySet[row]).replace(/\{(\.?)[\s+]?:[\s+]?(\.?)\}/g, '{$1:$2}'); 3115 base.buildRow($row, row, currentSet.split(/\s+/), acceptedKeys); 3116 $row.find('.' + kbcss.keyButton + ',.' + kbcss.keySpacer) 3117 .filter(':last') 3118 .after('<br class="' + kbcss.endRow + '"/>'); 3119 } 3120 } 3121 }); 3122 3123 if (sets > 1) { 3124 base.sets = true; 3125 } 3126 layout.hasMappedKeys = !($.isEmptyObject(layout.mappedKeys)); 3127 layout.$keyboard = container; 3128 return container; 3129 }; 3130 3131 base.buildRow = function ($row, row, keys, acceptedKeys) { 3132 var t, txt, key, isAction, action, margin, 3133 kbcss = $keyboard.css; 3134 for (key = 0; key < keys.length; key++) { 3135 // used by addKey function 3136 base.temp = [$row, row, key]; 3137 isAction = false; 3138 3139 // ignore empty keys 3140 if (keys[key].length === 0) { 3141 continue; 3142 } 3143 3144 // process here if it's an action key 3145 if (/^\{\S+\}$/.test(keys[key])) { 3146 action = keys[key].match(/^\{(\S+)\}$/)[1]; 3147 // add active class if there are double exclamation points in the name 3148 if (/\!\!/.test(action)) { 3149 action = action.replace('!!', ''); 3150 isAction = true; 3151 } 3152 3153 // add empty space 3154 if (/^sp:((\d+)?([\.|,]\d+)?)(em|px)?$/i.test(action)) { 3155 // not perfect globalization, but allows you to use {sp:1,1em}, {sp:1.2em} or {sp:15px} 3156 margin = parseFloat(action 3157 .replace(/,/, '.') 3158 .match(/^sp:((\d+)?([\.|,]\d+)?)(em|px)?$/i)[1] || 0 3159 ); 3160 $('<span class="' + kbcss.keyText + '"></span>') 3161 // previously {sp:1} would add 1em margin to each side of a 0 width span 3162 // now Firefox doesn't seem to render 0px dimensions, so now we set the 3163 // 1em margin x 2 for the width 3164 .width((action.match(/px/i) ? margin + 'px' : (margin * 2) + 'em')) 3165 .addClass(kbcss.keySpacer) 3166 .appendTo($row); 3167 } 3168 3169 // add empty button 3170 if (/^empty(:((\d+)?([\.|,]\d+)?)(em|px)?)?$/i.test(action)) { 3171 margin = (/:/.test(action)) ? parseFloat(action 3172 .replace(/,/, '.') 3173 .match(/^empty:((\d+)?([\.|,]\d+)?)(em|px)?$/i)[1] || 0 3174 ) : ''; 3175 base 3176 .addKey('', ' ', true) 3177 .addClass(o.css.buttonDisabled + ' ' + o.css.buttonEmpty) 3178 .attr('aria-disabled', true) 3179 .width(margin ? (action.match('px') ? margin + 'px' : (margin * 2) + 'em') : ''); 3180 continue; 3181 } 3182 3183 // meta keys 3184 if (/^meta[\w-]+\:?(\w+)?/i.test(action)) { 3185 base 3186 .addKey(action.split(':')[0], action) 3187 .addClass(kbcss.keyHasActive); 3188 continue; 3189 } 3190 3191 // switch needed for action keys with multiple names/shortcuts or 3192 // default will catch all others 3193 txt = action.split(':'); 3194 switch (txt[0].toLowerCase()) { 3195 3196 case 'a': 3197 case 'accept': 3198 base 3199 .addKey('accept', action) 3200 .addClass(o.css.buttonAction + ' ' + kbcss.keyAction); 3201 break; 3202 3203 case 'alt': 3204 case 'altgr': 3205 base 3206 .addKey('alt', action) 3207 .addClass(kbcss.keyHasActive); 3208 break; 3209 3210 case 'b': 3211 case 'bksp': 3212 base.addKey('bksp', action); 3213 break; 3214 3215 case 'c': 3216 case 'cancel': 3217 base 3218 .addKey('cancel', action) 3219 .addClass(o.css.buttonAction + ' ' + kbcss.keyAction); 3220 break; 3221 3222 // toggle combo/diacritic key 3223 /*jshint -W083 */ 3224 case 'combo': 3225 base 3226 .addKey('combo', action) 3227 .addClass(kbcss.keyHasActive) 3228 .attr('title', function (indx, title) { 3229 // add combo key state to title 3230 return title + ' ' + o.display[o.useCombos ? 'active' : 'disabled']; 3231 }) 3232 .toggleClass(o.css.buttonActive, o.useCombos); 3233 break; 3234 3235 // Decimal - unique decimal point (num pad layout) 3236 case 'dec': 3237 acceptedKeys.push((base.decimal) ? '.' : ','); 3238 base.addKey('dec', action); 3239 break; 3240 3241 case 'e': 3242 case 'enter': 3243 base 3244 .addKey('enter', action) 3245 .addClass(o.css.buttonAction + ' ' + kbcss.keyAction); 3246 break; 3247 3248 case 'lock': 3249 base 3250 .addKey('lock', action) 3251 .addClass(kbcss.keyHasActive); 3252 break; 3253 3254 case 's': 3255 case 'shift': 3256 base 3257 .addKey('shift', action) 3258 .addClass(kbcss.keyHasActive); 3259 break; 3260 3261 // Change sign (for num pad layout) 3262 case 'sign': 3263 acceptedKeys.push('-'); 3264 base.addKey('sign', action); 3265 break; 3266 3267 case 'space': 3268 acceptedKeys.push(' '); 3269 base.addKey('space', action); 3270 break; 3271 3272 case 't': 3273 case 'tab': 3274 base.addKey('tab', action); 3275 break; 3276 3277 default: 3278 if ($keyboard.keyaction.hasOwnProperty(txt[0])) { 3279 base 3280 .addKey(txt[0], action) 3281 .toggleClass(o.css.buttonAction + ' ' + kbcss.keyAction, isAction); 3282 } 3283 3284 } 3285 3286 } else { 3287 3288 // regular button (not an action key) 3289 t = keys[key]; 3290 base.addKey(t, t, true); 3291 } 3292 } 3293 }; 3294 3295 base.removeBindings = function (namespace) { 3296 $(document).unbind(namespace); 3297 if (base.el.ownerDocument !== document) { 3298 $(base.el.ownerDocument).unbind(namespace); 3299 } 3300 $(window).unbind(namespace); 3301 base.$el.unbind(namespace); 3302 }; 3303 3304 base.removeKeyboard = function () { 3305 base.$decBtn = []; 3306 // base.$preview === base.$el when o.usePreview is false - fixes #442 3307 if (o.usePreview) { 3308 base.$preview.removeData('keyboard'); 3309 } 3310 base.$preview.unbind(base.namespace + 'keybindings'); 3311 base.preview = null; 3312 base.$preview = null; 3313 base.$previewCopy = null; 3314 base.$keyboard.removeData('keyboard'); 3315 base.$keyboard.remove(); 3316 base.$keyboard = []; 3317 base.isOpen = false; 3318 base.isCurrent(false); 3319 }; 3320 3321 base.destroy = function (callback) { 3322 var index, 3323 kbcss = $keyboard.css, 3324 len = base.extensionNamespace.length, 3325 tmp = [ 3326 kbcss.input, 3327 kbcss.locked, 3328 kbcss.placeholder, 3329 kbcss.noKeyboard, 3330 kbcss.alwaysOpen, 3331 o.css.input, 3332 kbcss.isCurrent 3333 ].join(' '); 3334 clearTimeout(base.timer); 3335 clearTimeout(base.timer2); 3336 clearTimeout(base.timer3); 3337 if (base.$keyboard.length) { 3338 base.removeKeyboard(); 3339 } 3340 if (base.options.openOn) { 3341 base.removeBindings(base.options.openOn); 3342 } 3343 base.removeBindings(base.namespace); 3344 base.removeBindings(base.namespace + 'callbacks'); 3345 for (index = 0; index < len; index++) { 3346 base.removeBindings(base.extensionNamespace[index]); 3347 } 3348 base.el.active = false; 3349 3350 base.$el 3351 .removeClass(tmp) 3352 .removeAttr('aria-haspopup') 3353 .removeAttr('role') 3354 .removeData('keyboard'); 3355 base = null; 3356 3357 if (typeof callback === 'function') { 3358 callback(); 3359 } 3360 }; 3361 3362 // Run initializer 3363 base.init(); 3364 3365 }; // end $.keyboard definition 3366 3367 // event.which & ASCII values 3368 $keyboard.keyCodes = { 3369 backSpace: 8, 3370 tab: 9, 3371 enter: 13, 3372 capsLock: 20, 3373 escape: 27, 3374 space: 32, 3375 pageUp: 33, 3376 pageDown: 34, 3377 end: 35, 3378 home: 36, 3379 left: 37, 3380 up: 38, 3381 right: 39, 3382 down: 40, 3383 insert: 45, 3384 delete: 46, 3385 // event.which keyCodes (uppercase letters) 3386 A: 65, 3387 Z: 90, 3388 V: 86, 3389 C: 67, 3390 X: 88, 3391 3392 // ASCII lowercase a & z 3393 a: 97, 3394 z: 122
3395 }; 3396 3397 $keyboard.css = { 3398 // keyboard id suffix 3399 idSuffix: '_keyboard', 3400 // class name to set initial focus 3401 initialFocus: 'keyboard-init-focus', 3402 // element class names 3403 input: 'ui-keyboard-input', 3404 inputClone: 'ui-keyboard-preview-clone', 3405 wrapper: 'ui-keyboard-preview-wrapper', 3406 preview: 'ui-keyboard-preview', 3407 keyboard: 'ui-keyboard', 3408 keySet: 'ui-keyboard-keyset', 3409 keyButton: 'ui-keyboard-button', 3410 keyWide: 'ui-keyboard-widekey', 3411 keyPrefix: 'ui-keyboard-', 3412 keyText: 'ui-keyboard-text', // span with button text 3413 keyHasActive: 'ui-keyboard-hasactivestate', 3414 keyAction: 'ui-keyboard-actionkey', 3415 keySpacer: 'ui-keyboard-spacer', // empty keys 3416 keyToggle: 'ui-keyboard-toggle', 3417 keyDisabled: 'ui-keyboard-disabled', 3418 // Class for BRs with a div wrapper inside of contenteditable 3419 divWrapperCE: 'ui-keyboard-div-wrapper', 3420 // states 3421 locked: 'ui-keyboard-lockedinput', 3422 alwaysOpen: 'ui-keyboard-always-open', 3423 noKeyboard: 'ui-keyboard-nokeyboard', 3424 placeholder: 'ui-keyboard-placeholder', 3425 hasFocus: 'ui-keyboard-has-focus', 3426 isCurrent: 'ui-keyboard-input-current', 3427 // validation & autoaccept 3428 inputValid: 'ui-keyboard-valid-input', 3429 inputInvalid: 'ui-keyboard-invalid-input', 3430 inputAutoAccepted: 'ui-keyboard-autoaccepted', 3431 endRow: 'ui-keyboard-button-endrow' // class added to <br> 3432 }; 3433 3434 $keyboard.events = { 3435 // keyboard events 3436 kbChange: 'keyboardChange', 3437 kbBeforeClose: 'beforeClose', 3438 kbBeforeVisible: 'beforeVisible', 3439 kbVisible: 'visible', 3440 kbInit: 'initialized', 3441 kbInactive: 'inactive', 3442 kbHidden: 'hidden', 3443 kbRepeater: 'repeater', 3444 kbKeysetChange: 'keysetChange', 3445 // input events 3446 inputAccepted: 'accepted', 3447 inputCanceled: 'canceled', 3448 inputChange: 'change', 3449 inputRestricted: 'restricted' 3450 }; 3451 3452 // Action key function list 3453 $keyboard.keyaction = { 3454 accept: function (base) { 3455 base.close(true); // same as base.accept(); 3456 return false; // return false prevents further processing 3457 }, 3458 alt: function (base) { 3459 base.altActive = !base.altActive; 3460 base.showSet(); 3461 }, 3462 bksp: function (base) { 3463 if (base.isContentEditable) { 3464 base.execCommand('delete'); 3465 // save new caret position 3466 base.saveCaret(); 3467 } else { 3468 // the script looks for the '\b' string and initiates a backspace 3469 base.insertText('\b'); 3470 } 3471 }, 3472 cancel: function (base) { 3473 base.close(); 3474 return false; // return false prevents further processing 3475 }, 3476 clear: function (base) { 3477 base.$preview[base.isContentEditable ? 'text' : 'val'](''); 3478 if (base.$decBtn.length) { 3479 base.checkDecimal(); 3480 } 3481 }, 3482 combo: function (base) { 3483 var o = base.options, 3484 c = !o.useCombos, 3485 $combo = base.$keyboard.find('.' + $keyboard.css.keyPrefix + 'combo'); 3486 o.useCombos = c; 3487 $combo 3488 .toggleClass(o.css.buttonActive, c) 3489 // update combo key state 3490 .attr('title', $combo.attr('data-title') + ' (' + o.display[c ? 'active' : 'disabled'] + ')'); 3491 if (c) { 3492 base.checkCombos(); 3493 } 3494 return false; 3495 }, 3496 dec: function (base) { 3497 base.insertText((base.decimal) ? '.' : ','); 3498 }, 3499 del: function (base) { 3500 if (base.isContentEditable) { 3501 base.execCommand('forwardDelete'); 3502 } else { 3503 // the script looks for the '{d}' string and initiates a delete 3504 base.insertText('{d}'); 3505 } 3506 }, 3507 // resets to base keyset (deprecated because "default" is a reserved word) 3508 'default': function (base) { 3509 base.shiftActive = base.altActive = base.metaActive = false; 3510 base.showSet(); 3511 }, 3512 // el is the pressed key (button) object; it is null when the real keyboard enter is pressed 3513 enter: function (base, el, e) { 3514 var o = base.options; 3515 // shift+enter in textareas 3516 if (e.shiftKey) { 3517 // textarea, input & contenteditable - enterMod + shift + enter = accept, 3518 // then go to prev; base.switchInput(goToNext, autoAccept) 3519 // textarea & input - shift + enter = accept (no navigation) 3520 return (o.enterNavigation) ? base.switchInput(!e[o.enterMod], true) : base.close(true); 3521 } 3522 // input only - enterMod + enter to navigate 3523 if (o.enterNavigation && (!base.isTextArea || e[o.enterMod])) { 3524 return base.switchInput(!e[o.enterMod], o.autoAccept ? 'true' : false); 3525 } 3526 // pressing virtual enter button inside of a textarea - add a carriage return 3527 // e.target is span when clicking on text and button at other times 3528 if (base.isTextArea && $(e.target).closest('button').length) { 3529 // IE8 fix (space + \n) - fixes #71 thanks Blookie! 3530 base.insertText(($keyboard.msie ? ' ' : '') + '\n'); 3531 } 3532 if (base.isContentEditable && !o.enterNavigation) { 3533 base.execCommand('insertHTML', '<div><br class="' + $keyboard.css.divWrapperCE + '"></div>'); 3534 // Using backspace on wrapped BRs will now shift the textnode inside of the wrapped BR 3535 // Although not ideal, the caret is moved after the block - see the wiki page for 3536 // more details: https://github.com/Mottie/Keyboard/wiki/Contenteditable#limitations 3537 // move caret after a delay to allow rendering of HTML 3538 setTimeout(function() { 3539 $keyboard.keyaction.right(base); 3540 base.saveCaret(); 3541 }, 0); 3542 } 3543 }, 3544 // caps lock key 3545 lock: function (base) { 3546 base.last.keyset[0] = base.shiftActive = base.capsLock = !base.capsLock; 3547 base.showSet(); 3548 }, 3549 left: function (base) { 3550 var p = $keyboard.caret(base.$preview); 3551 if (p.start - 1 >= 0) { 3552 // move both start and end of caret (prevents text selection) & save caret position 3553 base.last.start = base.last.end = p.start - 1; 3554 $keyboard.caret(base.$preview, base.last); 3555 base.setScroll(); 3556 } 3557 }, 3558 meta: function (base, el) { 3559 var $el = $(el); 3560 base.metaActive = !$el.hasClass(base.options.css.buttonActive); 3561 base.showSet($el.attr('data-name')); 3562 }, 3563 next: function (base) { 3564 base.switchInput(true, base.options.autoAccept); 3565 return false; 3566 }, 3567 // same as 'default' - resets to base keyset 3568 normal: function (base) { 3569 base.shiftActive = base.altActive = base.metaActive = false; 3570 base.showSet(); 3571 }, 3572 prev: function (base) { 3573 base.switchInput(false, base.options.autoAccept); 3574 return false; 3575 }, 3576 right: function (base) { 3577 var p = $keyboard.caret(base.$preview), 3578 len = base.isContentEditable ? $keyboard.getEditableLength(base.el) : base.getValue().length; 3579 if (p.end + 1 <= len) { 3580 // move both start and end of caret to end position 3581 // (prevents text selection) && save caret position 3582 base.last.start = base.last.end = p.end + 1; 3583 $keyboard.caret(base.$preview, base.last); 3584 base.setScroll(); 3585 } 3586 }, 3587 shift: function (base) { 3588 base.last.keyset[0] = base.shiftActive = !base.shiftActive; 3589 base.showSet(); 3590 }, 3591 sign: function (base) { 3592 var signRegex = base.decimal ? /^[+-]?\d*\.?\d*$/ : /^[+-]?\d*,?\d*$/; 3593 if (signRegex.test(base.getValue())) { 3594 var caret, 3595 p = $keyboard.caret(base.$preview), 3596 val = base.getValue(), 3597 len = base.isContentEditable ? $keyboard.getEditableLength(base.el) : val.length; 3598 base.setValue(val * -1); 3599 caret = len - val.length; 3600 base.last.start = p.start + caret; 3601 base.last.end = p.end + caret; 3602 $keyboard.caret(base.$preview, base.last); 3603 base.setScroll(); 3604 } 3605 }, 3606 space: function (base) { 3607 base.insertText(' '); 3608 }, 3609 tab: function (base) { 3610 var o = base.options; 3611 if (!base.isTextArea) { 3612 if (o.tabNavigation) { 3613 return base.switchInput(!base.shiftActive, true); 3614 } else if (base.isInput) { 3615 // ignore tab key in input 3616 return false; 3617 } 3618 } 3619 base.insertText('\t'); 3620 }, 3621 toggle: function (base) { 3622 base.enabled = !base.enabled;
3623 base.toggle(); 3624 }, 3625 // *** Special action keys: NBSP & zero-width characters *** 3626 // Non-breaking space 3627 NBSP: '\u00a0', 3628 // zero width space 3629 ZWSP: '\u200b', 3630 // Zero width non-joiner 3631 ZWNJ: '\u200c', 3632 // Zero width joiner 3633 ZWJ: '\u200d', 3634 // Left-to-right Mark 3635 LRM: '\u200e', 3636 // Right-to-left Mark 3637 RLM: '\u200f' 3638 }; 3639 3640 // Default keyboard layouts 3641 $keyboard.builtLayouts = {}; 3642 $keyboard.layouts = { 3643 'alpha': { 3644 'normal': [ 3645 '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}', 3646 '{tab} a b c d e f g h i j [ ] \\', 3647 'k l m n o p q r s ; \' {enter}', 3648 '{shift} t u v w x y z , . / {shift}', 3649 '{accept} {space} {cancel}' 3650 ], 3651 'shift': [ 3652 '~ ! @ # $ % ^ & * ( ) _ + {bksp}', 3653 '{tab} A B C D E F G H I J { } |', 3654 'K L M N O P Q R S : " {enter}', 3655 '{shift} T U V W X Y Z < > ? {shift}', 3656 '{accept} {space} {cancel}' 3657 ] 3658 }, 3659 'qwerty': { 3660 'normal': [ 3661 '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}', 3662 '{tab} q w e r t y u i o p [ ] \\', 3663 'a s d f g h j k l ; \' {enter}', 3664 '{shift} z x c v b n m , . / {shift}', 3665 '{accept} {space} {cancel}' 3666 ], 3667 'shift': [ 3668 '~ ! @ # $ % ^ & * ( ) _ + {bksp}', 3669 '{tab} Q W E R T Y U I O P { } |', 3670 'A S D F G H J K L : " {enter}', 3671 '{shift} Z X C V B N M < > ? {shift}', 3672 '{accept} {space} {cancel}' 3673 ] 3674 }, 3675 'international': { 3676 'normal': [ 3677 '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}', 3678 '{tab} q w e r t y u i o p [ ] \\', 3679 'a s d f g h j k l ; \' {enter}', 3680 '{shift} z x c v b n m , . / {shift}', 3681 '{accept} {alt} {space} {alt} {cancel}' 3682 ], 3683 'shift': [ 3684 '~ ! @ # $ % ^ & * ( ) _ + {bksp}', 3685 '{tab} Q W E R T Y U I O P { } |', 3686 'A S D F G H J K L : " {enter}', 3687 '{shift} Z X C V B N M < > ? {shift}', 3688 '{accept} {alt} {space} {alt} {cancel}' 3689 ], 3690 'alt': [ 3691 '~ \u00a1 \u00b2 \u00b3 \u00a4 \u20ac \u00bc \u00bd \u00be \u2018 \u2019 \u00a5 \u00d7 {bksp}', 3692 '{tab} \u00e4 \u00e5 \u00e9 \u00ae \u00fe \u00fc \u00fa \u00ed \u00f3 \u00f6 \u00ab \u00bb \u00ac', 3693 '\u00e1 \u00df \u00f0 f g h j k \u00f8 \u00b6 \u00b4 {enter}', 3694 '{shift} \u00e6 x \u00a9 v b \u00f1 \u00b5 \u00e7 > \u00bf {shift}', 3695 '{accept} {alt} {space} {alt} {cancel}' 3696 ], 3697 'alt-shift': [ 3698 '~ \u00b9 \u00b2 \u00b3 \u00a3 \u20ac \u00bc \u00bd \u00be \u2018 \u2019 \u00a5 \u00f7 {bksp}', 3699 '{tab} \u00c4 \u00c5 \u00c9 \u00ae \u00de \u00dc \u00da \u00cd \u00d3 \u00d6 \u00ab \u00bb \u00a6', 3700 '\u00c4 \u00a7 \u00d0 F G H J K \u00d8 \u00b0 \u00a8 {enter}', 3701 '{shift} \u00c6 X \u00a2 V B \u00d1 \u00b5 \u00c7 . \u00bf {shift}', 3702 '{accept} {alt} {space} {alt} {cancel}' 3703 ] 3704 }, 3705 'colemak': { 3706 'normal': [ 3707 '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}', 3708 '{tab} q w f p g j l u y ; [ ] \\', 3709 '{bksp} a r s t d h n e i o \' {enter}', 3710 '{shift} z x c v b k m , . / {shift}', 3711 '{accept} {space} {cancel}' 3712 ], 3713 'shift': [ 3714 '~ ! @ # $ % ^ & * ( ) _ + {bksp}', 3715 '{tab} Q W F P G J L U Y : { } |', 3716 '{bksp} A R S T D H N E I O " {enter}', 3717 '{shift} Z X C V B K M < > ? {shift}', 3718 '{accept} {space} {cancel}' 3719 ] 3720 }, 3721 'dvorak': { 3722 'normal': [ 3723 '` 1 2 3 4 5 6 7 8 9 0 [ ] {bksp}', 3724 '{tab} \' , . p y f g c r l / = \\', 3725 'a o e u i d h t n s - {enter}', 3726 '{shift} ; q j k x b m w v z {shift}', 3727 '{accept} {space} {cancel}' 3728 ], 3729 'shift': [ 3730 '~ ! @ # $ % ^ & * ( ) { } {bksp}', 3731 '{tab} " < > P Y F G C R L ? + |', 3732 'A O E U I D H T N S _ {enter}', 3733 '{shift} : Q J K X B M W V Z {shift}', 3734 '{accept} {space} {cancel}' 3735 ] 3736 }, 3737 'num': { 3738 'normal': [ 3739 '= ( ) {b}', 3740 '{clear} / * -', 3741 '7 8 9 +', 3742 '4 5 6 {sign}', 3743 '1 2 3 %', 3744 '0 {dec} {a} {c}' 3745 ] 3746 } 3747 }; 3748 3749 $keyboard.language = { 3750 en: { 3751 display: { 3752 // check mark - same action as accept 3753 'a': '\u2714:Accept (Shift+Enter)', 3754 'accept': 'Accept:Accept (Shift+Enter)', 3755 // other alternatives \u2311 3756 'alt': 'Alt:\u2325 AltGr', 3757 // Left arrow (same as ←) 3758 'b': '\u232b:Backspace', 3759 'bksp': 'Bksp:Backspace', 3760 // big X, close - same action as cancel 3761 'c': '\u2716:Cancel (Esc)', 3762 'cancel': 'Cancel:Cancel (Esc)', 3763 // clear num pad 3764 'clear': 'C:Clear', 3765 'combo': '\u00f6:Toggle Combo Keys', 3766 // decimal point for num pad (optional), change '.' to ',' for European format 3767 'dec': '.:Decimal', 3768 // down, then left arrow - enter symbol 3769 'e': '\u23ce:Enter', 3770 'empty': '\u00a0', 3771 'enter': 'Enter:Enter \u23ce', 3772 // left arrow (move caret) 3773 'left': '\u2190', 3774 // caps lock 3775 'lock': 'Lock:\u21ea Caps Lock', 3776 'next': 'Next \u21e8', 3777 'prev': '\u21e6 Prev', 3778 // right arrow (move caret) 3779 'right': '\u2192', 3780 // thick hollow up arrow 3781 's': '\u21e7:Shift', 3782 'shift': 'Shift:Shift', 3783 // +/- sign for num pad 3784 'sign': '\u00b1:Change Sign', 3785 'space': '\u00a0:Space', 3786 // right arrow to bar (used since this virtual keyboard works with one directional tabs) 3787 't': '\u21e5:Tab', 3788 // \u21b9 is the true tab symbol (left & right arrows) 3789 'tab': '\u21e5 Tab:Tab', 3790 // replaced by an image 3791 'toggle': ' ', 3792 3793 // added to titles of keys 3794 // accept key status when acceptValid:true 3795 'valid': 'valid',
3796 'invalid': 'invalid', 3797 // combo key states 3798 'active': 'active', 3799 'disabled': 'disabled' 3800 }, 3801 3802 // Message added to the key title while hovering, if the mousewheel plugin exists 3803 wheelMessage: 'Use mousewheel to see other keys', 3804 3805 comboRegex: /([`\'~\^\"ao])([a-z])/mig, 3806 combos: { 3807 // grave 3808 '`': { a: '\u00e0', A: '\u00c0', e: '\u00e8', E: '\u00c8', i: '\u00ec', I: '\u00cc', o: '\u00f2', 3809 O: '\u00d2', u: '\u00f9', U: '\u00d9', y: '\u1ef3', Y: '\u1ef2' }, 3810 // acute & cedilla 3811 "'": { a: '\u00e1', A: '\u00c1', e: '\u00e9', E: '\u00c9', i: '\u00ed', I: '\u00cd', o: '\u00f3', 3812 O: '\u00d3', u: '\u00fa', U: '\u00da', y: '\u00fd', Y: '\u00dd' }, 3813 // umlaut/trema 3814 '"': { a: '\u00e4', A: '\u00c4', e: '\u00eb', E: '\u00cb', i: '\u00ef', I: '\u00cf', o: '\u00f6', 3815 O: '\u00d6', u: '\u00fc', U: '\u00dc', y: '\u00ff', Y: '\u0178' }, 3816 // circumflex 3817 '^': { a: '\u00e2', A: '\u00c2', e: '\u00ea', E: '\u00ca', i: '\u00ee', I: '\u00ce', o: '\u00f4', 3818 O: '\u00d4', u: '\u00fb', U: '\u00db', y: '\u0177', Y: '\u0176' }, 3819 // tilde 3820 '~': { a: '\u00e3', A: '\u00c3', e: '\u1ebd', E: '\u1ebc', i: '\u0129', I: '\u0128', o: '\u00f5', 3821 O: '\u00d5', u: '\u0169', U: '\u0168', y: '\u1ef9', Y: '\u1ef8', n: '\u00f1', N: '\u00d1' } 3822 } 3823 } 3824 }; 3825 3826 $keyboard.defaultOptions = { 3827 // set this to ISO 639-1 language code to override language set by the layout 3828 // http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 3829 // language defaults to 'en' if not found 3830 language: null, 3831 rtl: false, 3832 3833 // *** choose layout & positioning *** 3834 layout: 'qwerty', 3835 customLayout: null, 3836 3837 position: { 3838 // optional - null (attach to input/textarea) or a jQuery object (attach elsewhere) 3839 of: null, 3840 my: 'center top', 3841 at: 'center top', 3842 // used when 'usePreview' is false (centers the keyboard at the bottom of the input/textarea) 3843 at2: 'center bottom' 3844 }, 3845 3846 // allow jQuery position utility to reposition the keyboard on window resize 3847 reposition: true, 3848 3849 // preview added above keyboard if true, original input/textarea used if false 3850 usePreview: true, 3851 3852 // if true, the keyboard will always be visible 3853 alwaysOpen: false, 3854 3855 // give the preview initial focus when the keyboard becomes visible 3856 initialFocus: true, 3857 3858 // avoid changing the focus (hardware keyboard probably won't work) 3859 noFocus: false, 3860 3861 // if true, keyboard will remain open even if the input loses focus, but closes on escape 3862 // or when another keyboard opens. 3863 stayOpen: false, 3864 3865 // Prevents the keyboard from closing when the user clicks or presses outside the keyboard 3866 // the `autoAccept` option must also be set to true when this option is true or changes are lost 3867 userClosed: false, 3868 3869 // if true, keyboard will not close if you press escape. 3870 ignoreEsc: false, 3871 3872 // if true, keyboard will only closed on click event instead of mousedown and touchstart 3873 closeByClickEvent: false, 3874 3875 css: { 3876 // input & preview 3877 input: 'ui-widget-content ui-corner-all', 3878 // keyboard container 3879 container: 'ui-widget-content ui-widget ui-corner-all ui-helper-clearfix', 3880 // keyboard container extra class (same as container, but separate) 3881 popup: '', 3882 // default state 3883 buttonDefault: 'ui-state-default ui-corner-all', 3884 // hovered button 3885 buttonHover: 'ui-state-hover', 3886 // Action keys (e.g. Accept, Cancel, Tab, etc); this replaces 'actionClass' option 3887 buttonAction: 'ui-state-active', 3888 // Active keys (e.g. shift down, meta keyset active, combo keys active) 3889 buttonActive: 'ui-state-active', 3890 // used when disabling the decimal button {dec} when a decimal exists in the input area 3891 buttonDisabled: 'ui-state-disabled', 3892 buttonEmpty: 'ui-keyboard-empty' 3893 }, 3894 3895 // *** Useability *** 3896 // Auto-accept content when clicking outside the keyboard (popup will close) 3897 autoAccept: false, 3898 // Auto-accept content even if the user presses escape (only works if `autoAccept` is `true`) 3899 autoAcceptOnEsc: false, 3900 3901 // Prevents direct input in the preview window when true
3902 lockInput: false, 3903 3904 // Prevent keys not in the displayed keyboard from being typed in 3905 restrictInput: false, 3906 // Additional allowed characters while restrictInput is true 3907 restrictInclude: '', // e.g. 'a b foo \ud83d\ude38' 3908 3909 // Check input against validate function, if valid the accept button gets a class name of 3910 // 'ui-keyboard-valid-input'. If invalid, the accept button gets a class name of 3911 // 'ui-keyboard-invalid-input' 3912 acceptValid: false, 3913 // Auto-accept when input is valid; requires `acceptValid` set `true` & validate callback 3914 autoAcceptOnValid: false, 3915 // Check validation on keyboard initialization. If false, the "Accept" key state (color) 3916 // will not change to show if the content is valid, or not 3917 checkValidOnInit: true, 3918 3919 // if acceptValid is true & the validate function returns a false, this option will cancel 3920 // a keyboard close only after the accept button is pressed 3921 cancelClose: true, 3922 3923 // tab to go to next, shift-tab for previous (default behavior) 3924 tabNavigation: false, 3925 3926 // enter for next input; shift+enter accepts content & goes to next 3927 // shift + 'enterMod' + enter ('enterMod' is the alt as set below) will accept content and go 3928 // to previous in a textarea 3929 enterNavigation: false, 3930 // mod key options: 'ctrlKey', 'shiftKey', 'altKey', 'metaKey' (MAC only) 3931 enterMod: 'altKey', // alt-enter to go to previous; shift-alt-enter to accept & go to previous 3932 3933 // if true, the next button will stop on the last keyboard input/textarea; prev button stops at first 3934 // if false, the next button will wrap to target the first input/textarea; prev will go to the last 3935 stopAtEnd: true, 3936 3937 // Set this to append the keyboard after the input/textarea (appended to the input/textarea parent). 3938 // This option works best when the input container doesn't have a set width & when the 'tabNavigation' 3939 // option is true. 3940 appendLocally: false, 3941 // When appendLocally is false, the keyboard will be appended to this object 3942 appendTo: 'body', 3943 3944 // Wrap all <br>s inside of a contenteditable in a div; without wrapping, the caret 3945 // position will not be accurate 3946 wrapBRs: true, 3947 3948 // If false, the shift key will remain active until the next key is (mouse) clicked on; if true it will 3949 // stay active until pressed again 3950 stickyShift: true, 3951 3952 // Prevent pasting content into the area 3953 preventPaste: false, 3954 3955 // caret placed at the end of any text when keyboard becomes visible 3956 caretToEnd: false, 3957 3958 // caret stays this many pixels from the edge of the input while scrolling left/right; 3959 // use "c" or "center" to center the caret while scrolling 3960 scrollAdjustment: 10, 3961 3962 // Set the max number of characters allowed in the input, setting it to false disables this option 3963 maxLength: false, 3964 // allow inserting characters @ caret when maxLength is set 3965 maxInsert: true, 3966 3967 // Mouse repeat delay - when clicking/touching a virtual keyboard key, after this delay the key will 3968 // start repeating 3969 repeatDelay: 500, 3970 3971 // Mouse repeat rate - after the repeatDelay, this is the rate (characters per second) at which the 3972 // key is repeated Added to simulate holding down a real keyboard key and having it repeat. I haven't 3973 // calculated the upper limit of this rate, but it is limited to how fast the javascript can process 3974 // the keys. And for me, in Firefox, it's around 20. 3975 repeatRate: 20, 3976 3977 // resets the keyboard to the default keyset when visible 3978 resetDefault: true, 3979 3980 // Event (namespaced) on the input to reveal the keyboard. To disable it, just set it to ''. 3981 openOn: 'focus', 3982 3983 // enable the keyboard on readonly inputs 3984 activeOnReadonly: false, 3985 3986 // Event (namepaced) for when the character is added to the input (clicking on the keyboard) 3987 keyBinding: 'mousedown touchstart', 3988 3989 // enable/disable mousewheel functionality 3990 // enabling still depends on the mousewheel plugin 3991 useWheel: true, 3992 3993 // combos (emulate dead keys : http://en.wikipedia.org/wiki/Keyboard_layout#US-International) 3994 // if user inputs `a the script converts it to à , ^o becomes ô, etc. 3995 useCombos: true, 3996 3997 /* 3998 // *** Methods *** 3999 // commenting these out to reduce the size of the minified version 4000 // Callbacks - attach a function to any of these callbacks as desired 4001 initialized : function(e, keyboard, el) {}, 4002 beforeVisible : function(e, keyboard, el) {}, 4003 visible : function(e, keyboard, el) {}, 4004 beforeInsert : function(e, keyboard, el, textToAdd) { return textToAdd; }, 4005 change : function(e, keyboard, el) {}, 4006 beforeClose : function(e, keyboard, el, accepted) {}, 4007 accepted : function(e, keyboard, el) {}, 4008 canceled : function(e, keyboard, el) {}, 4009 restricted : function(e, keyboard, el) {}, 4010 hidden : function(e, keyboard, el) {},
4011 // called instead of base.switchInput 4012 switchInput : function(keyboard, goToNext, isAccepted) {}, 4013 // used if you want to create a custom layout or modify the built-in keyboard 4014 create : function(keyboard) { return keyboard.buildKeyboard(); }, 4015 4016 // build key callback 4017 buildKey : function( keyboard, data ) { 4018 / * 4019 data = { 4020 // READ ONLY 4021 isAction : [boolean] true if key is an action key 4022 name : [string] key class name suffix ( prefix = 'ui-keyboard-' ); 4023 may include decimal ascii value of character 4024 value : [string] text inserted (non-action keys) 4025 title : [string] title attribute of key 4026 action : [string] keyaction name 4027 html : [string] HTML of the key; it includes a <span> wrapping the text 4028 // use to modify key HTML 4029 $key : [object] jQuery selector of key which is already appended to keyboard 4030 } 4031 * / 4032 return data; 4033 }, 4034 */ 4035 4036 // this callback is called, if the acceptValid is true, and just before the 'beforeClose' to check 4037 // the value if the value is valid, return true and the keyboard will continue as it should 4038 // (close if not always open, etc). If the value is not valid, return false and clear the keyboard 4039 // value ( like this "keyboard.$preview.val('');" ), if desired. The validate function is called after 4040 // each input, the 'isClosing' value will be false; when the accept button is clicked, 4041 // 'isClosing' is true 4042 validate: function (/* keyboard, value, isClosing */) { 4043 return true; 4044 } 4045 4046 }; 4047 4048 $keyboard.supportedInputTypes = [ 4049 'text', 4050 'search', 4051 'url', 4052 'tel', 4053 'password' 4054 ]; 4055 4056 // for checking combos 4057 $keyboard.comboRegex = /([`\'~\^\"ao])([a-z])/mig; 4058 4059 // store current keyboard element; used by base.isCurrent() 4060 $keyboard.currentKeyboard = ''; 4061 4062 $('<!--[if lte IE 8]><script>jQuery("body").addClass("oldie");</script><![endif]--><!--[if IE]>' + 4063 '<script>jQuery("body").addClass("ie");</script><![endif]-->') 4064 .appendTo('body') 4065 .remove(); 4066 $keyboard.msie = $('body').hasClass('oldie'); // Old IE flag, used for caret positioning 4067 $keyboard.allie = $('body').hasClass('ie'); 4068 4069 $keyboard.watermark = (typeof (document.createElement('input').placeholder) !== 'undefined'); 4070 4071 $keyboard.checkCaretSupport = function () { 4072 if (typeof $keyboard.checkCaret !== 'boolean') { 4073 // Check if caret position is saved when input is hidden or loses focus 4074 // (*cough* all versions of IE and I think Opera has/had an issue as well 4075 var $temp = $('<div style="height:0px;width:0px;overflow:hidden;position:fixed;top:0;left:-100px;">' + 4076 '<input type="text" value="testing"/></div>').prependTo('body'); // stop page scrolling 4077 $keyboard.caret($temp.find('input'), 3, 3); 4078 // Also save caret position of the input if it is locked 4079 $keyboard.checkCaret = $keyboard.caret($temp.find('input').hide().show()).start !== 3; 4080 $temp.remove(); 4081 } 4082 return $keyboard.checkCaret; 4083 }; 4084 4085 $keyboard.caret = function($el, param1, param2) { 4086 if (!$el || !$el.length || $el.is(':hidden') || $el.css('visibility') === 'hidden') { 4087 return {}; 4088 } 4089 var start, end, txt, pos, 4090 kb = $el.data( 'keyboard' ), 4091 noFocus = kb && kb.options.noFocus, 4092 formEl = /(textarea|input)/i.test($el[0].nodeName); 4093 if (!noFocus) { $el.focus(); } 4094 // set caret position 4095 if (typeof param1 !== 'undefined') { 4096 // allow setting caret using ( $el, { start: x, end: y } ) 4097 if (typeof param1 === 'object' && 'start' in param1 && 'end' in param1) { 4098 start = param1.start; 4099 end = param1.end; 4100 } else if (typeof param2 === 'undefined') { 4101 param2 = param1; // set caret using start position 4102 } 4103 // set caret using ( $el, start, end ); 4104 if (typeof param1 === 'number' && typeof param2 === 'number') { 4105 start = param1; 4106 end = param2; 4107 } else if ( param1 === 'start' ) { 4108 start = end = 0; 4109 } else if ( typeof param1 === 'string' ) { 4110 // unknown string setting, move caret to end 4111 start = end = 'end'; 4112 } 4113 4114 // *** SET CARET POSITION *** 4115 // modify the line below to adapt to other caret plugins 4116 return formEl ? 4117 $el.caret( start, end, noFocus ) : 4118 $keyboard.setEditableCaret( $el, start, end ); 4119 } 4120 // *** GET CARET POSITION *** 4121 // modify the line below to adapt to other caret plugins 4122 if (formEl) { 4123 // modify the line below to adapt to other caret plugins 4124 pos = $el.caret(); 4125 } else { 4126 // contenteditable 4127 pos = $keyboard.getEditableCaret($el[0]); 4128 } 4129 start = pos.start; 4130 end = pos.end; 4131 4132 // *** utilities *** 4133 txt = formEl && $el[0].value || $el.text() || ''; 4134 return { 4135 start : start, 4136 end : end, 4137 // return selected text 4138 text : txt.substring( start, end ), 4139 // return a replace selected string method 4140 replaceStr : function( str ) { 4141 return txt.substring( 0, start ) + str + txt.substring( end, txt.length ); 4142 } 4143 }; 4144 }; 4145 4146 $keyboard.isTextNode = function(el) { 4147 return el && el.nodeType === 3; 4148 }; 4149 4150 $keyboard.isBlock = function(el, node) { 4151 var win = el.ownerDocument.defaultView; 4152 if ( 4153 node && node.nodeType === 1 && node !== el && 4154 win.getComputedStyle(node).display === 'block' 4155 ) { 4156 return 1; 4157 } 4158 return 0; 4159 }; 4160 4161 // Wrap all BR's inside of contenteditable 4162 $keyboard.wrapBRs = function(container) { 4163 var $el = $(container).find('br:not(.' + $keyboard.css.divWrapperCE + ')'); 4164 if ($el.length) { 4165 $.each($el, function(i, el) { 4166 var len = el.parentNode.childNodes.length; 4167 if ( 4168 // wrap BRs if not solo child 4169 len !== 1 || 4170 // Or if BR is wrapped by a span 4171 len === 1 && !$keyboard.isBlock(container, el.parentNode) 4172 ) { 4173 $(el).addClass($keyboard.css.divWrapperCE).wrap('<div>'); 4174 } 4175 }); 4176 } 4177 }; 4178 4179 $keyboard.getEditableCaret = function(container) { 4180 container = $(container)[0]; 4181 if (!container.isContentEditable) { return {}; } 4182 var end, text, 4183 options = ($(container).data('keyboard') || {}).options, 4184 doc = container.ownerDocument, 4185 range = doc.getSelection().getRangeAt(0), 4186 result = pathToNode(range.startContainer, range.startOffset), 4187 start = result.position; 4188 if (options.wrapBRs !== false) { 4189 $keyboard.wrapBRs(container); 4190 } 4191 function pathToNode(endNode, offset) { 4192 var node, adjust, 4193 txt = '', 4194 done = false, 4195 position = 0, 4196 nodes = $.makeArray(container.childNodes); 4197 4198 function checkBlock(val) { 4199 if (val) { 4200 position += val; 4201 txt += options && options.replaceCR || '\n'; 4202 } 4203 } 4204 4205 while (!done && nodes.length) { 4206 node = nodes.shift(); 4207 if (node === endNode) { 4208 done = true; 4209 } 4210 4211 // Add one if previous sibling was a block node (
4211div, p, etc) 4212 adjust = $keyboard.isBlock(container, node.previousSibling); 4213 checkBlock(adjust); 4214 4215 if ($keyboard.isTextNode(node)) { 4216 position += done ? offset : node.length; 4217 txt += node.textContent; 4218 if (done) { 4219 return {position: position, text: txt}; 4220 } 4221 } else if (!done && node.childNodes) { 4222 nodes = $.makeArray(node.childNodes).concat(nodes); 4223 } 4224 // Add one if we're inside a block node (div, p, etc) 4225 // and previous sibling was a text node 4226 adjust = $keyboard.isTextNode(node.previousSibling) && $keyboard.isBlock(container, node); 4227 checkBlock(adjust); 4228 } 4229 return {position: position, text: txt}; 4230 } 4231 // check of start and end are the same 4232 if (range.endContainer === range.startContainer && range.endOffset === range.startOffset) { 4233 end = start; 4234 text = ''; 4235 } else { 4236 result = pathToNode(range.endContainer, range.endOffset); 4237 end = result.position; 4238 text = result.text.substring(start, end); 4239 } 4240 return { 4241 start: start, 4242 end: end, 4243 text: text 4244 }; 4245 }; 4246 4247 $keyboard.getEditableLength = function(container) { 4248 var result = $keyboard.setEditableCaret(container, 'getMax'); 4249 // if not a number, the container is not a contenteditable element 4250 return typeof result === 'number' ? result : null; 4251 }; 4252 4253 $keyboard.setEditableCaret = function(container, start, end) { 4254 container = $(container)[0]; 4255 if (!container.isContentEditable) { return {}; } 4256 var doc = container.ownerDocument, 4257 range = doc.createRange(), 4258 sel = doc.getSelection(), 4259 options = ($(container).data('keyboard') || {}).options, 4260 s = start, 4261 e = end, 4262 text = '', 4263 result = findNode(start === 'getMax' ? 'end' : start); 4264 function findNode(offset) { 4265 if (offset === 'end') { 4266 // Set some value > content length; but return max 4267 offset = container.innerHTML.length; 4268 } else if (offset < 0) { 4269 offset = 0; 4270 } 4271 var node, check, 4272 txt = '', 4273 done = false, 4274 position = 0, 4275 last = 0, 4276 max = 0, 4277 nodes = $.makeArray(container.childNodes); 4278 function updateText(val) { 4279 txt += val ? options && options.replaceCR || '\n' : ''; 4280 return val > 0; 4281 } 4282 function checkDone(adj) { 4283 var val = position + adj; 4284 last = max; 4285 max += adj; 4286 if (offset - val >= 0) { 4287 position = val; 4288 return offset - position <= 0; 4289 } 4290 return offset - val <= 0; 4291 } 4292 while (!done && nodes.length) { 4293 node = nodes.shift(); 4294 // Add one if the previous sibling was a block node (div, p, etc) 4295 check = $keyboard.isBlock(container, node.previousSibling); 4296 if (updateText(check) && checkDone(check)) { 4297 done = true; 4298 } 4299 // Add one if we're inside a block node (div, p, etc) 4300 check = $keyboard.isTextNode(node.previousSibling) && $keyboard.isBlock(container, node); 4301 if (updateText(check) && checkDone(check)) { 4302 done = true; 4303 } 4304 if ($keyboard.isTextNode(node)) { 4305 txt += node.textContent; 4306 if (checkDone(node.length)) { 4307 check = offset - position === 0 && position - last >= 1 ? node.length : offset - position; 4308 return { 4309 node: node, 4310 offset: check, 4311 position: offset, 4312 text: txt 4313 }; 4314 } 4315 } else if (!done && node.childNodes) { 4316 nodes = $.makeArray(node.childNodes).concat(nodes); 4317 } 4318 } 4319 return nodes.length ? 4320 {node: node, offset: offset - position, position: offset, text: txt} : 4321 // Offset is larger than content, return max 4322 {node: node, offset: node && node.length || 0, position: max, text: txt}; 4323 } 4324 if (result.node) { 4325 s = result.position; // Adjust if start > content length 4326 if (start === 'getMax') { 4327 return s; 4328 } 4329 range.setStart(result.node, result.offset); 4330 // Only find end if > start and is defined... this allows passing
4331 // setEditableCaret(el, 'end') or setEditableCaret(el, 10, 'end'); 4332 if (typeof end !== 'undefined' && end !== start) { 4333 result = findNode(end); 4334 } 4335 if (result.node) { 4336 e = result.position; // Adjust if end > content length 4337 range.setEnd(result.node, result.offset); 4338 text = s === e ? '' : result.text.substring(s, e); 4339 } 4340 sel.removeAllRanges(); 4341 sel.addRange(range); 4342 } 4343 return { 4344 start: s, 4345 end: e, 4346 text: text 4347 }; 4348 }; 4349 4350 $keyboard.replaceContent = function (el, param) { 4351 el = $(el)[0]; 4352 var node, i, str, 4353 type = typeof param, 4354 caret = $keyboard.getEditableCaret(el).start, 4355 charIndex = 0, 4356 nodeStack = [el]; 4357 while ((node = nodeStack.pop())) { 4358 if ($keyboard.isTextNode(node)) { 4359 if (type === 'function') { 4360 if (caret >= charIndex && caret <= charIndex + node.length) { 4361 node.textContent = param(node.textContent); 4362 } 4363 } else if (type === 'string') { 4364 // maybe not the best method, but it works for simple changes 4365 str = param.substring(charIndex, charIndex + node.length); 4366 if (str !== node.textContent) { 4367 node.textContent = str; 4368 } 4369 } 4370 charIndex += node.length; 4371 } else if (node && node.childNodes) { 4372 i = node.childNodes.length; 4373 while (i--) { 4374 nodeStack.push(node.childNodes[i]); 4375 } 4376 } 4377 } 4378 i = $keyboard.getEditableCaret(el); 4379 $keyboard.setEditableCaret(el, i.start, i.start); 4380 }; 4381 4382 $.fn.keyboard = function (options) { 4383 return this.each(function () { 4384 if (!$(this).data('keyboard')) { 4385 /*jshint nonew:false */ 4386 (new $.keyboard(this, options)); 4387 } 4388 }); 4389 }; 4390 4391 $.fn.getkeyboard = function () { 4392 return this.data('keyboard'); 4393 }; 4394 4395 /* Copyright (c) 2010 C. F., Wong (<a href="http://cloudgen.w0ng.hk">Cloudgen Examplet Store</a>) 4396 * Licensed under the MIT License: 4397 * http://www.opensource.org/licenses/mit-license.php 4398 * Highly modified from the original 4399 */ 4400 4401 $.fn.caret = function (start, end, noFocus) { 4402 if ( 4403 typeof this[0] === 'undefined' || 4404 this.is(':hidden') || 4405 this.css('visibility') === 'hidden' || 4406 !/(INPUT|TEXTAREA)/i.test(this[0].nodeName) 4407 ) { 4408 return this; 4409 } 4410 var selRange, range, stored_range, txt, val, 4411 $el = this, 4412 el = $el[0], 4413 selection = el.ownerDocument.selection, 4414 sTop = el.scrollTop, 4415 ss = false, 4416 supportCaret = true; 4417 try { 4418 ss = 'selectionStart' in el; 4419 } catch (err) { 4420 supportCaret = false; 4421 } 4422 if (supportCaret && typeof start !== 'undefined') { 4423 if (!/(email|number)/i.test(el.type)) { 4424 if (ss) { 4425 el.selectionStart = start; 4426 el.selectionEnd = end; 4427 } else { 4428 selRange = el.createTextRange(); 4429 selRange.collapse(true); 4430 selRange.moveStart('character', start); 4431 selRange.moveEnd('character', end - start); 4432 selRange.select(); 4433 } 4434 } 4435 // must be visible or IE8 crashes; IE9 in compatibility mode works fine - issue #56 4436 if (!noFocus && ($el.is(':visible') || $el.css('visibility') !== 'hidden')) { 4437 el.focus(); 4438 } 4439 el.scrollTop = sTop; 4440 return this; 4441 } 4442 if (/(email|number)/i.test(el.type)) { 4443 // fix suggested by raduanastase (https://github.com/Mottie/Keyboard/issues/105#issuecomment-40456535) 4444 start = end = $el.val().length; 4445 } else if (ss) { 4446 start = el.selectionStart; 4447 end = el.selectionEnd; 4448 } else if (selection) {
4449 if (el.nodeName.toUpperCase() === 'TEXTAREA') { 4450 val = $el.val(); 4451 range = selection.createRange(); 4452 stored_range = range.duplicate(); 4453 stored_range.moveToElementText(el); 4454 stored_range.setEndPoint('EndToEnd', range); 4455 // thanks to the awesome comments in the rangy plugin 4456 start = stored_range.text.replace(/\r/g, '\n').length; 4457 end = start + range.text.replace(/\r/g, '\n').length; 4458 } else { 4459 val = $el.val().replace(/\r/g, '\n'); 4460 range = selection.createRange().duplicate(); 4461 range.moveEnd('character', val.length); 4462 start = (range.text === '' ? val.length : val.lastIndexOf(range.text)); 4463 range = selection.createRange().duplicate(); 4464 range.moveStart('character', -val.length); 4465 end = range.text.length; 4466 } 4467 } else { 4468 // caret positioning not supported 4469 start = end = (el.value || '').length; 4470 } 4471 txt = (el.value || ''); 4472 return { 4473 start: start, 4474 end: end, 4475 text: txt.substring(start, end), 4476 replace: function (str) { 4477 return txt.substring(0, start) + str + txt.substring(end, txt.length); 4478 } 4479 }; 4480 }; 4481 4482 return $keyboard; 4483 4484})); 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540/*! jQuery UI Virtual Keyboard Typing Simulator v1.12.0 *//* 4541 * for Keyboard v1.18+ only (2019-05-02) 4542 * 4543 * By Rob Garrison (aka Mottie) 4544 * Licensed under the MIT License 4545 * 4546 * Use this extension with the Virtual Keyboard to simulate 4547 * typing for tutorials or whatever else use you can find 4548 * 4549 * Requires: 4550 * jQuery 4551 * Keyboard plugin : https://github.com/Mottie/Keyboard 4552 * 4553 * Setup: 4554 * $('.ui-keyboard-input') 4555 * .keyboard(options) 4556 * .addTyping(typing-options); 4557 * 4558 * // or if targeting a specific keyboard 4559 * $('#keyboard1') 4560 * .keyboard(options) 4561 * .addTyping(typing-options); 4562 * 4563 * Basic Usage: 4564 * // To disable manual typing on the virtual keyboard, just set "showTyping" 4565 * // option to false 4566 * $('#keyboard-input').keyboard(options).addTyping({ showTyping: false }); 4567 * 4568 * // Change the default typing delay (time the virtual keyboard highlights the 4569 * // manually typed key) - default = 250 milliseconds 4570 * $('#keyboard-input').keyboard(options).addTyping({ delay: 500 }); 4571 * 4572 * // get keyboard object, open it, then start typing simulation 4573 * $('#keyboard-input').getkeyboard().reveal().typeIn('Hello World', 700); 4574 * 4575 * // get keyboard object, open it, type in "This is a test" with 700ms delay 4576 * // between types, then accept & close the keyboard 4577 * $('#keyboard-input') 4578 * .getkeyboard() 4579 * .reveal() 4580 * .typeIn('This is a test', 700, function(keyboard) { 4581 * keyboard.accept(); 4582 * }); 4583 */ 4584/* More Examples: 4585 * $('#inter').getkeyboard().reveal().typeIn('\tHello \b\n\tWorld', 500); 4586 * $('#meta') 4587 * .getkeyboard().reveal() 4588 * .typeIn('abCDd11123\u2648\u2649\u264A\u264B', 700, function() { 4589 * alert('all done!'); 4590 * }); 4591*/ 4592/* jshint browser:true, jquery:true, unused:false */ 4593/* global require:false, define:false, module:false */ 4594/* 4595;( function( factory ) { 4596 if ( typeof define === 'function' && define.amd ) { 4597 define( ['jquery'], factory ); 4598 } else if ( 4599 typeof module === 'object' && 4600 typeof module.exports === 'object' 4601 ) { 4602 module.exports = factory( require( 'jquery' ) ); 4603 } else { 4604 factory( jQuery ); 4605 } 4606}( function( $ ) { 4607 $.fn.addTyping = function( options ) { 4608 //Set the default values, use comma to separate the settings, example: 4609 var defaults = { 4610 showTyping : true, 4611 lockTypeIn : false, 4612 delay : 250, 4613 hoverDelay : 250 4614 }, 4615 $keyboard = $.keyboard; 4616 return this.each( function() { 4617 // make sure a keyboard is attached 4618 var o, base = $( this ).data( 'keyboard' ); 4619 if ( !base ) { 4620 return; 4621 } 4622 4623 // variables 4624 o = base.typing_options = $.extend( {}, defaults, options ); 4625 base.typing_keymap = { 4626 ' ' : 'space', 4627 '"' : '34', 4628 "'" : '39', 4629 ' ' : 'space', 4630 '\b' : 'bksp', // delete character to the left 4631 '{b}' : 'bksp', 4632 '{d}' : 'del', // delete character to the right 4633 '{l}' : 'left', // move caret left 4634 '{r}' : 'right', // move caret right 4635 '\n' : 'enter', 4636 '\r' : 'enter', 4637 '{e}' : 'enter', 4638 '\t' : 'tab', 4639 '{t}' : 'tab' 4640 }; 4641 base.typing_xref = { 4642 8 : 'bksp', 4643 9 : 'tab', 4644 13 : 'enter', 4645 32 : 'space', 4646 37 : 'left', 4647 39 : 'right', 4648 46 : 'del' 4649 }; 4650 base.typing_event = false; 4651 base.typing_namespace = base.namespace + 'typing'; 4652 base.extensionNamespace.push( base.typing_namespace ); 4653 // save lockInput setting 4654 o.savedLockInput = base.options.lockInput; 4655 4656 base.typing_setup_reset = function() { 4657 var kbevents = $keyboard.events, 4658 namespace = base.typing_namespace, 4659 events = [ kbevents.kbHidden, kbevents.kbInactive, '' ] 4660 .join( namespace + ' ' ); 4661 // reset "typeIn" when keyboard is closed 4662 base.$el 4663 .unbind( namespace ) 4664 .bind( events, function() { 4665 base.typing_reset(); 4666 }); 4667 base 4668 .unbindButton( namespace ) 4669 .bindButton( 'mousedown' + namespace, function() { 4670 base.typing_reset(); 4671 }); 4672 }; 4673 4674 base.typing_setup = function() { 4675 var namespace = base.typing_namespace; 4676 base.typing_setup_reset(); 4677 base.$el 4678 .bind( $keyboard.events.kbBeforeVisible + namespace, function() { 4679 base.typing_setup(); 4680 }); 4681 base.$preview 4682 .unbind( namespace ) 4683 .bind( 'keyup' + namespace, function( e ) { 4684 if ( o.init && o.lockTypeIn || !o.showTyping ) { 4685 return false; 4686 } 4687 if ( e.which >= 37 && e.which <=40 ) { 4688 return; // ignore arrow keys 4689 } 4690 if ( e.which === 16 ) { 4691 base.shiftActive = false; 4692 } 4693 if ( e.which === 18 ) { 4694 base.altActive = false; 4695 }
4696 if ( e.which === 16 || e.which === 18 ) { 4697 base.showSet(); 4698 // Alt key will shift focus to the menu - doesn't work in Windows 4699 setTimeout( function() { 4700 if (base.$preview) { 4701 base.$preview.focus(); 4702 } 4703 }, 200 ); 4704 return; 4705 } 4706 }) 4707 // change keyset when either shift or alt is held down 4708 .bind( 'keydown' + namespace, function( e ) { 4709 if ( o.init && o.lockTypeIn || !o.showTyping ) { 4710 return false; 4711 } 4712 e.temp = false; // prevent repetitive calls while keydown repeats. 4713 if ( e.which === 16 ) { 4714 e.temp = !base.shiftActive; base.shiftActive = true; 4715 } 4716 // it should be ok to reset e.temp, since both alt and shift will 4717 // call this function separately 4718 if ( e.which === 18 ) { 4719 e.temp = !base.altActive; base.altActive = true; 4720 } 4721 if ( e.temp ) { 4722 base.showSet(); 4723 base.$preview.focus(); // Alt shift focus to the menu 4724 } 4725 base.typing_event = true; 4726 // Simulate key press for tab and backspace since they don't fire 4727 // the keypress event 4728 if ( base.typing_xref[ e.which ] ) { 4729 base.typing_findKey( '', e ); // pass event object 4730 } 4731 4732 }) 4733 .bind( 'keypress' + namespace, function( e ) { 4734 if ( o.init && o.lockTypeIn ) { 4735 return false; 4736 } 4737 // Simulate key press on virtual keyboard 4738 if ( base.typing_event && !base.options.lockInput ) { 4739 base.typing_reset(); 4740 base.typing_event = true; 4741 base.typing_findKey( '', e ); // pass event object 4742 } 4743 }); 4744 }; 4745 4746 base.typing_reset = function() { 4747 base.typing_event = o.init = false; 4748 o.text = ''; 4749 o.len = o.current = 0; 4750 base.options.lockInput = o.savedLockInput; 4751 // clearTimeout( base.typing_timer ); 4752 }; 4753 4754 // Store typing text 4755 base.typeIn = function( txt, delay, callback, e ) { 4756 if ( !base.isVisible() ) { 4757 // keyboard was closed 4758 clearTimeout( base.typing_timer ); 4759 base.typing_reset(); 4760 return; 4761 } 4762 if ( !base.typing_event ) { 4763 4764 if ( o.init !== true ) { 4765 o.init = true; 4766 base.options.lockInput = o.lockTypeIn; 4767 o.text = txt || o.text || ''; 4768 o.len = o.text.length; 4769 o.delay = delay || o.delay; 4770 o.current = 0; // position in text string 4771 if ( callback ) { 4772 o.callback = callback; 4773 } 4774 } 4775 // function that loops through and types each character 4776 txt = o.text.substring( o.current, ++o.current ); 4777 // add support for curly-wrapped single character: {l}, {r}, {d}, etc. 4778 if ( 4779 txt === '{' && 4780 o.text.substring( o.current + 1, o.current + 2 ) === '}' 4781 ) { 4782 txt += o.text.substring( o.current, o.current += 2 ); 4783 } 4784 base.typing_findKey( txt, e ); 4785 } else if ( typeof txt === 'undefined' ) { 4786 // typeIn called by user input 4787 base.typing_event = false; 4788 base.options.lockInput = o.savedLockInput; 4789 return; 4790 } 4791 4792 }; 4793 4794 base.typing_findKey = function( txt, e ) { 4795 var tar, m, n, k, key, ks, meta, set, 4796 kbcss = $keyboard.css, 4797 mappedKeys = $keyboard.builtLayouts[base.layout].mappedKeys; 4798 // stop if keyboard is closed 4799 if ( !base.isOpen || !base.$keyboard.length ) { 4800 return; 4801 } 4802 ks = base.$keyboard.find( '.' + kbcss.keySet ); 4803 k = txt in base.typing_keymap ? base.typing_keymap[ txt ] : txt; 4804 // typing_event is true when typing on the actual keyboard - look for 4805 // actual key; All of this breaks when the CapLock is on... unable to 4806 // find a cross-browser method that works. 4807 tar = '.' + kbcss.keyButton + '[data-action="' + k + '"]'; 4808 if ( base.typing_event && e ) { 4809 // xref used for keydown 4810 // ( 46 = delete in keypress & period on keydown ) 4811 if ( 4812 e.type !== 'keypress' && 4813 base.typing_xref.hasOwnProperty( e.keyCode || e.which ) 4814 ) { 4815 // special named keys: bksp, tab and enter 4816 tar = '.' + 4817 kbcss.keyPrefix + 4818 base.processName( base.typing_xref[ e.keyCode || e.which ] ); 4819 } else { 4820 m = String.fromCharCode( e.charCode || e.which ); 4821 tar = ( mappedKeys.hasOwnProperty( m ) ) ? 4822 '.' + kbcss.keyButton + '[data-value="' + 4823 mappedKeys[ m ].replace(/"/g, '\\"') + '"]' : 4824 '.' + kbcss.keyPrefix + base.processName( m ); 4825 } 4826 } 4827 // find key 4828 key = ks.filter( ':visible' ).find( tar ); 4829 if ( key.length ) { 4830 // key is visible, simulate typing 4831 base.typing_simulateKey( key, txt, e ); 4832 } else { 4833 // key not found, check if it is in the keymap 4834 // (tab, space, enter, etc) 4835 if ( base.typing_event ) { 4836 key = ks.find( tar ); 4837 } else { 4838 // key not found, check if it is in the keymap 4839 // (tab, space, enter, etc) 4840 n = txt in base.typing_keymap ? 4841 base.typing_keymap[ txt ] : 4842 base.processName( txt ); 4843 // find actual key on keyboard 4844 key = ks.find( '.' + kbcss.keyPrefix + n ); 4845 } 4846 // find the keyset 4847 set = key.closest( '.' + kbcss.keySet ); 4848 // figure out which keyset the key is in then simulate clicking on 4849 // that meta key, then on the key 4850 if ( set.attr('name' ) ) { 4851 if ( o.showTyping ) { 4852 // get meta key name 4853 meta = set.attr( 'name' ); 4854 // show correct key set 4855 base.shiftActive = /shift/.test( meta ); 4856 base.altActive = /alt/.test( meta ); 4857 base.metaActive = base.last.keyset[ 2 ] = /\bmeta/.test(meta) ? 4858 ( meta ).match(/meta[\w-]+/)[0] : false; 4859 base.showSet( base.metaActive ); 4860 } 4861 // Add the key 4862 base.typing_simulateKey( key, txt, e ); 4863 } else { 4864 if ( !base.typing_event ) { 4865 // Key doesn't exist on the keyboard, so just enter it 4866 if ( 4867 txt in base.typing_keymap && 4868 base.typing_keymap[txt] in $keyboard.keyaction 4869 ) { 4870 $keyboard.keyaction[ base.typing_keymap[ txt ] ]( base, key, e ); 4871 } else { 4872 base.insertText( txt ); 4873 } 4874 base.checkCombos(); 4875 base.$el.trigger( $keyboard.events.kbChange, [ base, base.el ] ); 4876 } 4877 } 4878 } 4879 4880 if ( o.current <= o.len && o.len !== 0 ) { 4881 if ( !base.isVisible() ) { 4882 return; // keyboard was closed, abort!! 4883 } 4884 base.typing_timer = setTimeout( function() { 4885 base.typeIn(); 4886 }, o.delay ); 4887 } else if ( o.len !== 0 ) { 4888 // o.len is zero when the user typed on the actual keyboard during 4889 // simulation 4890 base.typing_reset(); 4891 if ( typeof o.callback === 'function' ) { 4892 // ensure all typing animation is done before the callback 4893 base.typing_timer = setTimeout( function() { 4894 // if the user typed during the key simulation, the "o" variable
4895 // may sometimes be undefined 4896 if ( typeof o.callback === 'function' ) { 4897 o.callback( base ); 4898 } 4899 }, o.delay ); 4900 } 4901 return; 4902 } else { 4903 base.typing_reset(); 4904 } 4905 }; 4906 4907 // mouseover the key, add the text directly, then mouseout on the key 4908 base.typing_simulateKey = function( el, txt, e ) { 4909 var len = el.length; 4910 if ( !base.isVisible() ) { 4911 return; 4912 } 4913 if ( o.showTyping && len ) { 4914 el.filter( ':visible' ).trigger( 'mouseenter' + base.namespace ); 4915 if ( o.showTyping && len ) { 4916 setTimeout( function() { 4917 el.trigger( 'mouseleave' + base.namespace ); 4918 }, Math.min( o.hoverDelay, o.delay ) ); 4919 } 4920 } 4921 if ( !base.typing_event ) { 4922 // delay required or initial tab does not get added 4923 // in the main demo (international keyboard) 4924 setTimeout( function() { 4925 if ( 4926 txt in base.typing_keymap && 4927 base.typing_keymap[ txt ] in $keyboard.keyaction 4928 ) { 4929 e = e || $.Event( 'keypress' ); 4930 e.target = el; // "Enter" checks for the e.target 4931 $keyboard.keyaction[ base.typing_keymap[ txt ] ]( base, el, e ); 4932 } else { 4933 base.insertText( txt ); 4934 } 4935 base.checkCombos(); 4936 base.$el.trigger( $keyboard.events.kbChange, [ base, base.el ] ); 4937 }, o.delay/3 ); 4938 } 4939 }; 4940 4941 // visible event is fired before this extension is initialized, so check! 4942 if ( o.showTyping && base.options.alwaysOpen && base.isVisible() ) { 4943 base.typing_setup(); 4944 } else { 4945 // capture and simulate typing 4946 base.$el 4947 .unbind( $keyboard.events.kbBeforeVisible + base.typing_namespace ) 4948 .bind( $keyboard.events.kbBeforeVisible + base.typing_namespace, function() { 4949 if ( o.showTyping ) { 4950 base.typing_setup(); 4951 } else { 4952 base.typing_setup_reset(); 4953 } 4954 }); 4955 } 4956 }); 4957 }; 4958 4959})); 4960 4961 4962 4963*/ 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989/*! jQuery UI Virtual Keyboard Virtual Caret v1.1.5 (beta) *//* 4990 * for Keyboard v1.18+ only (2/20/2016) 4991 * modified from https://github.com/component/textarea-caret-position 4992 * 4993 * By Rob Garrison (aka Mottie) 4994 * Licensed under the MIT License 4995 * 4996 * CSS changes 4997 * NOTE: caret margin-top => is added to the caret height (top & bottom) 4998 * .ui-keyboard-preview-wrapper { position: relative; overflow: hidden; } 4999 * .ui-keyboard-caret { background: red; width: 1px; margin-top: 3px; } 5000 */ 5001/*jshint browser:true, jquery:true, unused:false */ 5002/*global require:false, define:false, module:false */ 5003;( function( factory ) { 5004 if ( typeof define === 'function' && define.amd ) { 5005 define( [ 'jquery' ], factory ); 5006 } else if ( typeof module === 'object' && typeof module.exports === 'object' ) { 5007 module.exports = factory( require( 'jquery' ) ); 5008 } else { 5009 factory( jQuery ); 5010 } 5011}( function( $ ) { 5012'use strict'; 5013 var $keyboard = $.keyboard; 5014 5015 $keyboard.firefox = typeof window.mozInnerScreenX !== 'undefined'; 5016 5017 $.extend( $keyboard.css, { 5018 caret : 'ui-keyboard-caret', 5019 caretMirror : 'ui-keyboard-mirror-div' 5020 });
5021 5022 $.fn.addCaret = function( options ) { 5023 var defaults = { 5024 caretClass : '', 5025 // *** for future use *** 5026 // data-attribute containing the character(s) next to the caret 5027 charAttr : 'data-character', 5028 // # character(s) next to the caret (can be negative for RTL) 5029 charIndex : 1, 5030 offsetX : 0, 5031 offsetY : 0, 5032 adjustHt : 0 5033 }; 5034 return this.each( function() { 5035 // make sure a keyboard is attached 5036 var o, namespace, 5037 kbevents = $keyboard.events, 5038 base = $( this ).data( 'keyboard' ); 5039 if ( !base ) { return; } 5040 5041 // variables 5042 o = base.caret_options = $.extend( {}, defaults, options ); 5043 namespace = base.caret_namespace = base.namespace + 'caret'; 5044 base.extensionNamespace.push( namespace ); 5045 5046 // modified from https://github.com/component/textarea-caret-position 5047 // The properties that we copy into a mirrored div. 5048 // Note that some browsers, such as Firefox, 5049 // do not concatenate properties, i.e. padding-top, bottom etc. -> padding, 5050 // so we have to do every single property specifically. 5051 base.textareaCaretProperties = [ 5052 'direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', 5053 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', 'borderStyle', 5054 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 5055 'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', 5056 'lineHeight', 'fontFamily', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 5057 'letterSpacing', 'wordSpacing', 'tabSize', 'MozTabSize' 5058 ]; 5059 5060 base.caret_setup = function() { 5061 var kbcss = $keyboard.css, 5062 events = 'keyup keypress mouseup mouseleave '.split( ' ' ).join( namespace + ' ' ), 5063 style = 'position:absolute;visibility:hidden;top:-9999em;left:-9999em;' + 5064 'white-space:pre-wrap;z-index:-10;' + 5065 ( base.preview.nodeName === 'INPUT' ? '' : 'word-wrap:break-word;' ); 5066 // add mirrored div 5067 base.$keyboard.find( '.' + kbcss.caretMirror ).remove(); 5068 base.caret_$div = $( '<div class="' + kbcss.caretMirror + '" style="' + style + '">' ) 5069 .appendTo( base.$keyboard ); 5070 5071 // remove caret, just-in-case 5072 if (base.$caret) { base.$caret.remove(); } 5073 base.$caret = $( '<div class="' + kbcss.caret + ' ' + o.caretClass + '" style="position:absolute;">' ) 5074 .insertAfter( base.$preview ); 5075 5076 base.$el 5077 .unbind( kbevents.kbChange + namespace ) 5078 .bind( kbevents.kbChange + namespace, function() { 5079 base.findCaretPos(); 5080 }); 5081 base.$preview 5082 .unbind( events ) 5083 .bind( events, function() { 5084 base.findCaretPos(); 5085 }); 5086 }; 5087 5088 // getCaretCoordinatesFn = function (element, position, recalculate) { 5089 base.findCaretPos = function() { 5090 if ( !base.caret_$div ) { return; } 5091 var style, computed, margin, pos, position, txt, span, offset, 5092 element = base.preview, 5093 fontWidth = parseFloat( base.$preview.css('fontSize') ), 5094 isInput = element.nodeName === 'INPUT', 5095 div = base.caret_$div[0]; 5096 5097 style = div.style; 5098 // getComputedStyle with null - fixes #384 5099 computed = window.getComputedStyle ? getComputedStyle( element, null ) : element.currentStyle; 5100 // get caret position based on text-direction 5101 pos = $keyboard.caret( base.$preview ); 5102 position = Math[ computed.direction === 'ltr' ? 'max' : 'min' ]( pos.start, pos.end ); 5103 5104 // transfer the element's properties to the div
5105 base.textareaCaretProperties.forEach(function ( prop ) { 5106 style[ prop ] = computed[ prop ]; 5107 }); 5108 5109 if ( $keyboard.firefox ) { 5110 // Firefox adds 2 pixels to the padding - https://bugzilla.mozilla.org/show_bug.cgi?id=753662 5111 style.width = parseInt( computed.width, 10 ) - 2 + 'px'; 5112 // Firefox lies about the overflow property for textareas: 5113 // https://bugzilla.mozilla.org/show_bug.cgi?id=984275 5114 if ( element.scrollHeight > parseInt( computed.height, 10 ) ) { 5115 style.overflowY = 'scroll'; 5116 } 5117 } 5118 5119 // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll' 5120 // style.overflow = 'hidden'; 5121 style.width = parseInt( isInput ? element.scrollWidth : computed.width, 10 ) + 5122 // add 2em extra width if it's an input to prevent wrap 5123 ( isInput ? fontWidth * 2 : 0 ) + 'px'; 5124 5125 div.textContent = element.value.substring( 0, position ); 5126 // the second special handling for input type="text" vs textarea: 5127 // spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037 5128 if ( element.nodeName === 'INPUT' ) { 5129 div.textContent = div.textContent.replace( /\x20/g, '\xa0' ); 5130 } 5131 5132 span = document.createElement( 'span' ); 5133 // Wrapping must be replicated *exactly*, including when a long word gets 5134 // onto the next line, with whitespace at the end of the line before (#7). 5135 // The *only* reliable way to do that is to copy the *entire* rest of the 5136 // textarea's content into the <span> created at the caret position. 5137 // for inputs, just '.' would be enough, but why bother? 5138 // || because a completely empty faux span doesn't render at all 5139 // changed to zero-width space due to inaccuracy when textAlign = center; see #436 5140 span.textContent = element.value.substring( position ) || '\u200b'; 5141 div.appendChild( span ); 5142 5143 offset = $(span).position(); 5144 5145 // adjust for 2em added to width moves caret, use half; see #436 5146 pos = style.textAlign === 'center' ? fontWidth : 0; 5147 5148 base.caretPos = { 5149 top: offset.top + parseInt( computed.borderTopWidth, 10 ) + o.offsetY, 5150 left: offset.left + parseInt( computed.borderLeftWidth, 10 ) + o.offsetX - pos 5151 }; 5152 5153 // make caret height = font-size + any margin-top x2 added by the css 5154 margin = parseInt( base.$caret.css( 'margin-top' ), 10 ); 5155 style = Math.round( fontWidth + margin * 2 ) + o.adjustHt; 5156 offset = base.$preview.position(); 5157 5158 base.$caret.css({ 5159 top: offset.top - element.scrollTop + base.caretPos.top - margin, 5160 left: offset.left - element.scrollLeft + base.caretPos.left, 5161 height: style 5162 }); 5163 txt = element.value.substring( position, position + o.charIndex ).replace(/\s/, '\xa0' ) || '\xa0'; 5164 base.$caret.attr( o.charAttr, txt ); 5165 }; 5166 5167 // setup caret when keyboard is visible 5168 base.$el 5169 .unbind( namespace ) 5170 .bind( kbevents.kbBeforeVisible + namespace, function() { 5171 base.caret_setup(); 5172 }) 5173 .bind( kbevents.kbVisible + namespace, function() { 5174 base.findCaretPos(); 5175 }) 5176 .bind( kbevents.kbHidden + namespace, function() { 5177 // unbind events in case usePreview: false; see #376 5178 var events = 'keyup keypress mouseup mouseleave '.split( ' ' ).join( namespace + ' ' ); 5179 base.$preview.unbind( events ); 5180 base.$caret.remove(); 5181 base.$caret = null; 5182 base.caret_$div = null; 5183 }); 5184 5185 // visible event is fired before this extension is initialized, so check! 5186 if ( base.options.alwaysOpen && base.isVisible() ) { 5187 base.caret_setup(); 5188 base.findCaretPos(); 5189 } 5190 5191 }); 5192 }; 5193 5194})); 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219/** 5220 * @popperjs/core v2.5.2 - MIT License 5221 */ 5222 5223"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Popper={})}(this,(function(e){function t(e){return{width:(e=e.getBoundingClientRect()).width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function n(e){return"[object Window]"!==e.toString()?(e=e.ownerDocument)&&e.defaultView||window:e}function r(e){return{scrollLeft:(e=n(e)).pageXOffset,scrollTop:e.pageYOffset}}function o(e){return e instanceof n(e).Element||e instanceof Element}function i(e){return e instanceof n(e).HTMLElement||e instanceof HTMLElement}function a(e){return e?(e.nodeName||"").toLowerCase():null}function s(e){return((o(e)?e.ownerDocument:e.document)||window.document).documentElement}function f(e){return t(s(e)).left+r(e).scrollLeft}function c(e){return n(e).getComputedStyle(e)}function p(e){return e=c(e),/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function l(e,o,c){void 0===c&&(c=!1);var l=s(o);e=t(e);var u=i(o),d={scrollLeft:0,scrollTop:0},m={x:0,y:0};return(u||!u&&!c)&&(("body"!==a(o)||p(l))&&(d=o!==n(o)&&i(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:r(o)),i(o)?((m=t(o)).x+=o.clientLeft,m.y+=o.clientTop):l&&(m.x=f(l))),{x:e.left+d.scrollLeft-m.x,y:e.top+d.scrollTop-m.y,width:e.width,height:e.height}}function u(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function d(e){return"html"===a(e)?e:e.assignedSlot||e.parentNode||e.host||s(e)}function m(e,t){void 0===t&&(t=[]);var r=function e(t){return 0<=["html","body","#document"].indexOf(a(t))?t.ownerDocument.body:i(t)&&p(t)?t:e(d(t))}(e);e="body"===a(r);var o=n(r);
5223return r=e?[o].concat(o.visualViewport||[],p(r)?r:[]):r,t=t.concat(r),e?t:t.concat(m(d(r)))}function h(e){if(!i(e)||"fixed"===c(e).position)return null;if(e=e.offsetParent){var t=s(e);if("body"===a(e)&&"static"===c(e).position&&"static"!==c(t).position)return t}return e}function g(e){for(var t=n(e),r=h(e);r&&0<=["table","td","th"].indexOf(a(r))&&"static"===c(r).position;)r=h(r);if(r&&"body"===a(r)&&"static"===c(r).position)return t;if(!r)e:{for(e=d(e);i(e)&&0>["html","body"].indexOf(a(e));){if("none"!==(r=c(e)).transform||"none"!==r.perspective||r.willChange&&"auto"!==r.willChange){r=e;break e}e=e.parentNode}r=null}return r||t}function v(e){var t=new Map,n=new Set,r=[];return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||function e(o){n.add(o.name),[].concat(o.requires||[],o.requiresIfExists||[]).forEach((function(r){n.has(r)||(r=t.get(r))&&e(r)})),r.push(o)}(e)})),r}function b(e){var t;return function(){return t||(t=new Promise((function(n){Promise.resolve().then((function(){t=void 0,n(e())}))}))),t}}function y(e){return e.split("-")[0]}function O(e,t){var n=t.getRootNode&&t.getRootNode();if(n=!(!n||!n.host),e.contains(t))return!0;if(n)do{if(t&&e.isSameNode(t))return!0;t=t.parentNode||t.host}while(t);return!1}function w(e){return Object.assign(Object.assign({},e),{},{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function x(e,o){if("viewport"===o){o=n(e);var a=s(e);o=o.visualViewport;var p=a.clientWidth;a=a.clientHeight;var l=0,u=0;o&&(p=o.width,a=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(l=o.offsetLeft,u=o.offsetTop)),e=w(e={width:p,height:a,x:l+f(e),y:u})}else i(o)?((e=t(o)).top+=o.clientTop,e.left+=o.clientLeft,e.bottom=e.top+o.clientHeight,e.right=e.left+o.clientWidth,e.width=o.clientWidth,e.height=o.clientHeight,e.x=e.left,e.y=e.top):(u=s(e),e=s(u),l=r(u),o=u.ownerDocument.body,p=Math.max(e.scrollWidth,e.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Math.max(e.scrollHeight,e.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),u=-l.scrollLeft+f(u),l=-l.scrollTop,"rtl"===c(o||e).direction&&(u+=Math.max(e.clientWidth,o?o.clientWidth:0)-p),e=w({width:p,height:a,x:u,y:l}));return e}function j(e,t,n){return t="clippingParents"===t?function(e){var t=m(d(e)),n=0<=["absolute","fixed"].indexOf(c(e).position)&&i(e)?g(e):e;return o(n)?t.filter((function(e){return o(e)&&O(e,n)&&"body"!==a(e)})):[]}(e):[].concat(t),(n=(n=[].concat(t,[n])).reduce((function(t,n){return n=x(e,n),t.top=Math.max(n.top,t.top),t.right=Math.min(n.right,t.right),t.bottom=Math.min(n.bottom,t.bottom),t.left=Math.max(n.left,t.left),t}),x(e,n[0]))).width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}function M(e){return 0<=["top","bottom"].indexOf(e)?"x":"y"}function E(e){var t=e.reference,n=e.element,r=(e=e.placement)?y(e):null;e=e?e.split("-")[1]:null;var o=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2;switch(r){case"top":o={x:o,y:t.y-n.height};break;case"bottom":o={x:o,y:t.y+t.height};break;case"right":o={x:t.x+t.width,y:i};break;case"left":o={x:t.x-n.width,y:i};break;default:o={x:t.x,y:t.y}}if(null!=(r=r?M(r):null))switch(i="y"===r?"height":"width",e){case"start":o[r]=Math.floor(o[r])-Math.floor(t[i]/2-n[i]/2);break;case"end":o[r]=Math.floor(o[r])+Math.ceil(t[i]/2-n[i]/2)}return o}function D(e){return Object.assign(Object.assign({},{top:0,right:0,bottom:0,left:0}),e)}function P(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function L(e,n){void 0===n&&(n={});var r=n;n=void 0===(n=r.placement)?e.placement:n;var i=r.boundary,a=void 0===i?"clippingParents":i,f=void 0===(i=r.rootBoundary)?"viewport":i;i=void 0===(i=r.elementContext)?"popper":i;var c=r.altBoundary,p=void 0!==c&&c;r=D("number"!=typeof(r=void 0===(r=r.padding)?0:r)?r:P(r,S));var l=e.elements.reference;c=e.rects.popper,a=j(o(p=e.elements[p?"popper"===i?"reference":"popper":i])?p:p.contextElement||s(e.elements.popper),a,f),p=E({reference:f=t(l),element:c,strategy:"absolute",placement:n}),c=w(Object.assign(Object.assign({},c),p)),f="popper"===i?c:f;
vendor: 9,672 bytes, line 5223
5223var u={top:a.top-f.top+r.top,bottom:f.bottom-a.bottom+r.bottom,left:a.left-f.left+r.left,right:f.right-a.right+r.right};if(e=e.modifiersData.offset,"popper"===i&&e){var d=e[n];Object.keys(u).forEach((function(e){var t=0<=["right","bottom"].indexOf(e)?1:-1,n=0<=["top","bottom"].indexOf(e)?"y":"x";u[e]+=d[n]*t}))}return u}function k(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function B(e){void 0===e&&(e={});var t=e.defaultModifiers,n=void 0===t?[]:t,r=void 0===(e=e.defaultOptions)?V:e;return function(e,t,i){function a(){f.forEach((function(e){return e()})),f=[]}void 0===i&&(i=r);var s={placement:"bottom",orderedModifiers:[],options:Object.assign(Object.assign({},V),r),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},f=[],c=!1,p={state:s,setOptions:function(i){return a(),s.options=Object.assign(Object.assign(Object.assign({},r),s.options),i),s.scrollParents={reference:o(e)?m(e):e.contextElement?m(e.contextElement):[],popper:m(t)},i=function(e){var t=v(e);return N.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}(function(e){var t=e.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign(Object.assign(Object.assign({},n),t),{},{options:Object.assign(Object.assign({},n.options),t.options),data:Object.assign(Object.assign({},n.data),t.data)}):t,e}),{});return Object.keys(t).map((function(e){return t[e]}))}([].concat(n,s.options.modifiers))),s.orderedModifiers=i.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,n=e.options;n=void 0===n?{}:n,"function"==typeof(e=e.effect)&&(t=e({state:s,name:t,instance:p,options:n}),f.push(t||function(){}))})),p.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference;if(k(t,e=e.popper))for(s.rects={reference:l(t,g(e),"fixed"===s.options.strategy),popper:u(e)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(e){return s.modifiersData[e.name]=Object.assign({},e.data)})),t=0;t<s.orderedModifiers.length;t++)if(!0===s.reset)s.reset=!1,t=-1;else{var n=s.orderedModifiers[t];e=n.fn;var r=n.options;r=void 0===r?{}:r,n=n.name,"function"==typeof e&&(s=e({state:s,options:r,name:n,instance:p})||s)}}},update:b((function(){return new Promise((function(e){p.forceUpdate(),e(s)}))})),destroy:function(){a(),c=!0}};return k(e,t)?(p.setOptions(i).then((function(e){!c&&i.onFirstUpdate&&i.onFirstUpdate(e)})),p):p}}function W(e){var t,r=e.popper,o=e.popperRect,i=e.placement,a=e.offsets,f=e.position,c=e.gpuAcceleration,p=e.adaptive,l=window.devicePixelRatio||1;e=Math.round(a.x*l)/l||0,l=Math.round(a.y*l)/l||0;var u=a.hasOwnProperty("x");a=a.hasOwnProperty("y");var d,m="left",h="top",v=window;if(p){var b=g(r);b===n(r)&&(b=s(r)),"top"===i&&(h="bottom",l-=b.clientHeight-o.height,l*=c?1:-1),"left"===i&&(m="right",e-=b.clientWidth-o.width,e*=c?1:-1)}return r=Object.assign({position:f},p&&z),c?Object.assign(Object.assign({},r),{},((d={})[h]=a?"0":"",d[m]=u?"0":"",d.transform=2>(v.devicePixelRatio||1)?"translate("+e+"px, "+l+"px)":"translate3d("+e+"px, "+l+"px, 0)",d)):Object.assign(Object.assign({},r),{},((t={})[h]=a?l+"px":"",t[m]=u?e+"px":"",t.transform="",t))}function A(e){return e.replace(/left|right|bottom|top/g,(function(e){return G[e]}))}function H(e){return e.replace(/start|end/g,(function(e){return J[e]}))}function T(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function R(e){return["top","right","bottom","left"].some((function(t){return 0<=e[t]}))}var S=["top","bottom","right","left"],q=S.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),C=[].concat(S,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),N="beforeRead read afterRead beforeMain main afterMain beforeWrite write afterWrite".split(" "),V={placement:"bottom",modifiers:[],strategy:"absolute"},I={passive:!0},_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,r=e.instance,o=(e=e.options).scroll,i=void 0===o||o,a=void 0===(e=e.resize)||e,s=n(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&f.forEach((function(e){e.addEventListener("scroll",r.update,I)})),a&&s.addEventListener("resize",r.update,I),function(){i&&f.forEach((function(e){e.removeEventListener("scroll",r.update,I)})),a&&s.removeEventListener("resize",r.update,I)}},data:{}},U={name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state;t.modifiersData[e.name]=E({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},z={top:"auto",right:"auto",bottom:"auto",left:"auto"},F={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options;e=void 0===(e=n.gpuAcceleration)||e,n=void 0===(n=n.adaptive)||n,e={placement:y(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:e},null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign(Object.assign({},t.styles.popper),W(Object.assign(Object.assign({},e),{},{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:n})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign(Object.assign({},t.styles.arrow),W(Object.assign(Object.assign({},e),{},{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1})))),t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-placement":t.placement})},data:{}},X={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];i(o)&&a(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{};e=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{}),i(r)&&a(r)&&(Object.assign(r.style,e),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},Y={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.name,r=void 0===(e=e.options.offset)?[0,0]:e,o=(e=C.reduce((function(e,n){var o=t.rects,i=y(n),a=0<=["left","top"].indexOf(i)?-1:1,s="function"==typeof r?r(Object.assign(Object.assign({},o),{},{placement:n})):r;return o=(o=s[0])||0,s=((s=s[1])||0)*a,i=0<=["left","right"].indexOf(i)?{x:s,y:o}:{x:o,y:s},e[n]=i,e}),{}))[t.placement],i=o.x;o=o.y,null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=i,t.modifiersData.popperOffsets.y+=o),t.modifiersData[n]=e}},G={left:"right",right:"left",bottom:"top",top:"bottom"},J={start:"end",end:"start"},K={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options;if(e=e.name,!t.modifiersData[e]._skip){var r=n.mainAxis;r=void 0===r||r;var o=n.altAxis;o=void 0===o||o;var i=n.fallbackPlacements,a=n.padding,s=n.boundary,f=n.rootBoundary,c=n.altBoundary,p=n.flipVariations,l=void 0===p||p,u=n.allowedAutoPlacements;p=y(n=t.options.placement),i=i||(p!==n&&l?function(e){if("auto"===y(e))return[];var t=A(e);return[H(e),t,H(t)]}(n):[A(n)]);var d=[n].concat(i).reduce((function(e,n){return e.concat("auto"===y(n)?function(e,t){void 0===t&&(t={});var n=t.boundary,r=t.rootBoundary,o=t.padding,i=t.flipVariations,a=t.allowedAutoPlacements,s=void 0===a?C:a,f=t.placement.split("-")[1];0===(i=(t=f?i?q:q.filter((function(e){return e.split("-")[1]===f})):S).filter((function(e){return 0<=s.indexOf(e)}))).length&&(i=t);var c=i.reduce((function(t,i){return t[i]=L(e,{placement:i,boundary:n,rootBoundary:r,padding:o})[y(i)],t}),{});return Object.keys(c).sort((function(e,t){return c[e]-c[t]}))}(t,{placement:n,boundary:s,rootBoundary:f,padding:a,flipVariations:l,allowedAutoPlacements:u}):n)}),[]);n=t.rects.reference,i=t.rects.popper;var m=new Map;p=!0;for(var h=d[0],g=0;g<d.length;g++){var v=d[g],b=y(v),O="start"===v.split("-")[1],w=0<=["top","bottom"].indexOf(b),x=w?"width":"height",j=L(t,{placement:v,boundary:s,rootBoundary:f,altBoundary:c,padding:a});if(O=w?O?"right":"left":O?"bottom":"top",n[x]>i[x]&&(O=A(O)),x=A(O),w=[],r&&w.push(0>=j[b]),o&&w.push(0>=j[O],0>=j[x]),w.every((function(e){return e}))){h=v,p=!1;break}m.set(v,w)}if(p)for(r=function(e){var t=d.find((function(t){if(t=m.get(t))return t.slice(0,e).every((function(e){return e}))}));if(t)return h=t,"break"},o=l?3:1;0<o&&"break"!==r(o);o--);t.placement!==h&&(t.modifiersData[e]._skip=!0,t.placement=h,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},Q={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options;e=e.name;var r=n.mainAxis,o=void 0===r||r;r=void 0!==(r=n.altAxis)&&r;var i=n.tether;i=void 0===i||i;var a=n.tetherOffset,s=void 0===a?0:a;n=L(t,{boundary:n.boundary,rootBoundary:n.rootBoundary,padding:n.padding,altBoundary:n.altBoundary}),a=y(t.placement);var f=t.placement.split("-")[1],c=!f,p=M(a);a="x"===p?"y":"x";var l=t.modifiersData.popperOffsets,d=t.rects.reference,m=t.rects.popper,h="function"==typeof s?s(Object.assign(Object.assign({},t.rects),{},{placement:t.placement})):s;if(s={x:0,y:0}
5223,l){if(o){var v="y"===p?"top":"left",b="y"===p?"bottom":"right",O="y"===p?"height":"width";o=l[p];var w=l[p]+n[v],x=l[p]-n[b],j=i?-m[O]/2:0,E="start"===f?d[O]:m[O];f="start"===f?-m[O]:-d[O],m=t.elements.arrow,m=i&&m?u(m):{width:0,height:0};var D=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0};v=D[v],b=D[b],m=Math.max(0,Math.min(d[O],m[O])),E=c?d[O]/2-j-m-v-h:E-m-v-h,c=c?-d[O]/2+j+m+b+h:f+m+b+h,h=t.elements.arrow&&g(t.elements.arrow),d=t.modifiersData.offset?t.modifiersData.offset[t.placement][p]:0,h=l[p]+E-d-(h?"y"===p?h.clientTop||0:h.clientLeft||0:0),c=l[p]+c-d,i=Math.max(i?Math.min(w,h):w,Math.min(o,i?Math.max(x,c):x)),l[p]=i,s[p]=i-o}r&&(r=l[a],i=Math.max(r+n["x"===p?"top":"left"],Math.min(r,r-n["x"===p?"bottom":"right"])),l[a]=i,s[a]=i-r),t.modifiersData[e]=s}},requiresIfExists:["offset"]},Z={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state;e=e.name;var r=n.elements.arrow,o=n.modifiersData.popperOffsets,i=y(n.placement),a=M(i);if(i=0<=["left","right"].indexOf(i)?"height":"width",r&&o){var s=n.modifiersData[e+"#persistent"].padding,f
5223=u(r),c="y"===a?"top":"left",p="y"===a?"bottom":"right",l=n.rects.reference[i]+n.rects.reference[a]-o[a]-n.rects.popper[i];o=o[a]-n.rects.reference[a],l=(r=(r=g(r))?"y"===a?r.clientHeight||0:r.clientWidth||0:0)/2-f[i]/2+(l/2-o/2),i=Math.max(s[c],Math.min(l,r-f[i]-s[p])),n.modifiersData[e]=((t={})[a]=i,t.centerOffset=i-l,t)}},effect:function(e){var t=e.state,n=e.options;e=e.name;var r=n.element;if(r=void 0===r?"[data-popper-arrow]":r,n=void 0===(n=n.padding)?0:n,null!=r){if("string"==typeof r&&!(r=t.elements.popper.querySelector(r)))return;O(t.elements.popper,r)&&(t.elements.arrow=r,t.modifiersData[e+"#persistent"]={padding:D("number"!=typeof n?n:P(n,S))})}},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},$={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state;e=e.name;var n=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,i=L(t,{elementContext:"reference"}),a=L(t,{altBoundary:!0});n=T(i,n),r=T(a,r,o),o=R(n),a=R(r),t.modifiersData[e]={referenceClippingOffsets:n,popperEscapeOffsets:r,isReferenceHidden:o,hasPopperEscaped:a},t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-reference-hidden":o,"data-popper-escaped":a})}},ee=B({defaultModifiers:[_,U,F,X]}),te=[_,U,F,X,Y,K,Q,Z,$],ne=B({defaultModifiers:te});e.applyStyles=X,e.arrow=Z,e.computeStyles=F,e.createPopper=ne,e.createPopperLite=ee,e.defaultModifiers=te,e.detectOverflow=L,e.eventListeners=_,e.flip=K,e.hide=$,e.offset=Y,e.popperGenerator=B,e.popperOffsets=U,e.preventOverflow=Q,Object.defineProperty(e,"__esModule",{value:!0})}));
5224//# sourceMappingURL=popper.min.js.map 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258/*! 5259 * Bootstrap v4.1.3 (https://getbootstrap.com/) 5260 * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 5261 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5262 */ 5263(function (global, factory) { 5264 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) : 5265 typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) : 5266 (factory((global.bootstrap = {}),global.jQuery)); 5267}(this, (function (exports,$) { 'use strict'; 5268 5269 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 5270 5271 function _defineProperties(target, props) { 5272 for (var i = 0; i < props.length; i++) { 5273 var descriptor = props[i]; 5274 descriptor.enumerable = descriptor.enumerable || false; 5275 descriptor.configurable = true; 5276 if ("value" in descriptor) descriptor.writable = true; 5277 Object.defineProperty(target, descriptor.key, descriptor); 5278 } 5279 } 5280 5281 function _createClass(Constructor, protoProps, staticProps) { 5282 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 5283 if (staticProps) _defineProperties(Constructor, staticProps); 5284 return Constructor; 5285 } 5286 5287 function _defineProperty(obj, key, value) { 5288 if (key in obj) { 5289 Object.defineProperty(obj, key, { 5290 value: value, 5291 enumerable: true, 5292 configurable: true, 5293 writable: true 5294 }); 5295 } else { 5296 obj[key] = value; 5297 } 5298 5299 return obj; 5300 } 5301 5302 function _objectSpread(target) { 5303 for (var i = 1; i < arguments.length; i++) { 5304 var source = arguments[i] != null ? arguments[i] : {}; 5305 var ownKeys = Object.keys(source); 5306 5307 if (typeof Object.getOwnPropertySymbols === 'function') { 5308 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 5309 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 5310 })); 5311 } 5312 5313 ownKeys.forEach(function (key) { 5314 _defineProperty(target, key, source[key]); 5315 }); 5316 } 5317 5318 return target; 5319 } 5320 5321 function _inheritsLoose(subClass, superClass) { 5322 subClass.prototype = Object.create(superClass.prototype); 5323 subClass.prototype.constructor = subClass; 5324 subClass.__proto__ = superClass; 5325 } 5326 5327 /** 5328 * -------------------------------------------------------------------------- 5329 * Bootstrap (v4.1.3): util.js 5330 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5331 * -------------------------------------------------------------------------- 5332 */ 5333 5334 var Util = function ($$$1) { 5335 /** 5336 * ------------------------------------------------------------------------ 5337 * Private TransitionEnd Helpers 5338 * ------------------------------------------------------------------------ 5339 */ 5340 var TRANSITION_END = 'transitionend'; 5341 var MAX_UID = 1000000; 5342 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 5343 5344 function toType(obj) { 5345 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 5346 } 5347 5348 function getSpecialTransitionEndEvent() { 5349 return { 5350 bindType: TRANSITION_END, 5351 delegateType: TRANSITION_END, 5352 handle: function handle(event) { 5353 if ($$$1(event.target).is(this)) { 5354 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 5355 } 5356 5357 return undefined; // eslint-disable-line no-undefined 5358 } 5359 }; 5360 } 5361 5362 function transitionEndEmulator(duration) { 5363 var _this = this; 5364 5365 var called = false; 5366 $$$1(this).one(Util.TRANSITION_END, function () { 5367 called = true; 5368 }); 5369 setTimeout(function () { 5370 if (!called) { 5371 Util.triggerTransitionEnd(_this); 5372 } 5373 }, duration); 5374 return this; 5375 } 5376 5377 function setTransitionEndSupport() { 5378 $$$1.fn.emulateTransitionEnd = transitionEndEmulator; 5379 $$$1.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 5380 } 5381 /** 5382 * -------------------------------------------------------------------------- 5383 * Public Util Api 5384 * -------------------------------------------------------------------------- 5385 */ 5386 5387 5388 var Util = { 5389 TRANSITION_END: 'bsTransitionEnd', 5390 getUID: function getUID(prefix) { 5391 do { 5392 // eslint-disable-next-line no-bitwise 5393 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 5394 } while (document.getElementById(prefix)); 5395 5396 return prefix; 5397 }, 5398 getSelectorFromElement: function getSelectorFromElement(element) { 5399 var selector = element.getAttribute('data-target'); 5400 5401 if (!selector || selector === '#') { 5402 selector = element.getAttribute('href') || ''; 5403 } 5404 5405 try { 5406 return document.querySelector(selector) ? selector : null; 5407 } catch (err) { 5408 return null; 5409 } 5410 }, 5411 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 5412 if (!element) { 5413 return 0; 5414 } // Get transition-duration of the element 5415 5416 5417 var transitionDuration = $$$1(element).css('transition-duration'); 5418 var floatTransitionDuration = parseFloat(transitionDuration); // Return 0 if element or transition duration is not found 5419 5420 if (!floatTransitionDuration) { 5421 return 0; 5422 } // If multiple durations are defined, take the first 5423 5424 5425 transitionDuration = transitionDuration.split(',')[0]; 5426 return parseFloat(transitionDuration) * MILLISECONDS_MULTIPLIER; 5427 }, 5428 reflow: function reflow(element) { 5429 return element.offsetHeight; 5430 }, 5431 triggerTransitionEnd: function triggerTransitionEnd(element) { 5432 $$$1(element).trigger(TRANSITION_END); 5433 }, 5434 // TODO: Remove in v5 5435 supportsTransitionEnd: function supportsTransitionEnd() { 5436 return Boolean(TRANSITION_END); 5437 }, 5438 isElement: function isElement(obj) { 5439 return (obj[0] || obj).nodeType; 5440 }, 5441 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 5442 for (var property in configTypes) { 5443 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 5444 var expectedTypes = configTypes[property]; 5445 var value = config[property]; 5446 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 5447 5448 if (!new RegExp(expectedTypes).test(valueType)) { 5449 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 5450 } 5451 } 5452 } 5453 } 5454 }; 5455 setTransitionEndSupport(); 5456 return Util; 5457 }($); 5458 5459 /** 5460 * -------------------------------------------------------------------------- 5461 * Bootstrap (v4.1.3): alert.js 5462 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5463 * -------------------------------------------------------------------------- 5464 */ 5465 5466 var Alert = function ($$$1) { 5467 /** 5468 * ------------------------------------------------------------------------ 5469 * Constants 5470 * ------------------------------------------------------------------------ 5471 */ 5472 var NAME = 'alert'; 5473 var VERSION = '4.1.3'; 5474 var DATA_KEY = 'bs.alert'; 5475 var EVENT_KEY = "." + DATA_KEY; 5476 var DATA_API_KEY = '.data-api'; 5477 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 5478 var Selector = { 5479 DISMISS: '[data-dismiss="alert"]' 5480 }; 5481 var Event = { 5482 CLOSE: "close" + EVENT_KEY, 5483 CLOSED: "closed" + EVENT_KEY, 5484 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 5485 }; 5486 var ClassName = { 5487 ALERT: 'alert', 5488 FADE: 'fade', 5489 SHOW: 'show' 5490 /** 5491 * ------------------------------------------------------------------------ 5492 * Class Definition 5493 * ------------------------------------------------------------------------ 5494 */ 5495 5496 }; 5497 5498 var Alert = 5499 /*#__PURE__*/ 5500 function () { 5501 function Alert(element) { 5502 this._element = element; 5503 } // Getters 5504 5505 5506 var _proto = Alert.prototype; 5507 5508 // Public 5509 _proto.close = function close(element) { 5510 var rootElement = this._element; 5511 5512 if (element) { 5513 rootElement = this._getRootElement(element); 5514 } 5515 5516 var customEvent = this._triggerCloseEvent(rootElement); 5517 5518 if (customEvent.isDefaultPrevented()) { 5519 return; 5520 } 5521 5522 this._removeElement(rootElement); 5523 }; 5524 5525 _proto.dispose = function dispose() { 5526 $$$1.removeData(this._element, DATA_KEY); 5527 this._element = null; 5528 }; // Private 5529 5530 5531 _proto._getRootElement = function _getRootElement(element) { 5532 var selector = Util.getSelectorFromElement(element); 5533 var parent = false; 5534 5535 if (selector) { 5536 parent = document.querySelector(selector); 5537 } 5538 5539 if (!parent) { 5540 parent = $$$1(element).closest("." + ClassName.ALERT)[0]; 5541 } 5542 5543 return parent; 5544 }; 5545 5546 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 5547 var closeEvent = $$$1.Event(Event.CLOSE); 5548 $$$1(element).trigger(closeEvent); 5549 return closeEvent; 5550 }; 5551 5552 _proto._removeElement = function _removeElement(element) { 5553 var _this = this; 5554 5555 $$$1(element).removeClass(ClassName.SHOW); 5556 5557 if (!$$$1(element).hasClass(ClassName.FADE)) { 5558 this._destroyElement(element); 5559 5560 return; 5561 } 5562 5563 var transitionDuration = Util.getTransitionDurationFromElement(element); 5564 $$$1(element).one(Util.TRANSITION_END, function (event) { 5565 return _this._destroyElement(element, event); 5566 }).emulateTransitionEnd(transitionDuration); 5567 }; 5568 5569 _proto._destroyElement = function _destroyElement(element) { 5570 $$$1(element).detach().trigger(Event.CLOSED).remove(); 5571 }; // Static 5572 5573 5574 Alert._jQueryInterface = function _jQueryInterface(config) { 5575 return this.each(function () { 5576 var $element = $$$1(this); 5577 var data = $element.data(DATA_KEY); 5578 5579 if (!data) { 5580 data = new Alert(this); 5581 $element.data(DATA_KEY, data); 5582 } 5583 5584 if (config === 'close') { 5585 data[config](this); 5586 } 5587 }); 5588 }; 5589 5590 Alert._handleDismiss = function _handleDismiss(alertInstance) { 5591 return function (event) { 5592 if (event) { 5593 event.preventDefault(); 5594 } 5595 5596 alertInstance.close(this); 5597 }; 5598 }; 5599 5600 _createClass(Alert, null, [{ 5601 key: "VERSION", 5602 get: function get() { 5603 return VERSION; 5604 } 5605 }]); 5606 5607 return Alert; 5608 }(); 5609 /** 5610 * ------------------------------------------------------------------------ 5611 * Data Api implementation 5612 * ------------------------------------------------------------------------ 5613 */ 5614 5615 5616 $$$1(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); 5617 /** 5618 * ------------------------------------------------------------------------ 5619 * jQuery 5620 * ------------------------------------------------------------------------ 5621 */ 5622 5623 $$$1.fn[NAME] = Alert._jQueryInterface; 5624 $$$1.fn[NAME].Constructor = Alert; 5625 5626 $$$1.fn[NAME].noConflict = function () { 5627 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 5628 return Alert._jQueryInterface; 5629 }; 5630 5631 return Alert; 5632 }($); 5633 5634 /** 5635 * -------------------------------------------------------------------------- 5636 * Bootstrap (v4.1.3): button.js 5637 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5638 * -------------------------------------------------------------------------- 5639 */ 5640 5641 var Button = function ($$$1) { 5642 /** 5643 * ------------------------------------------------------------------------ 5644 * Constants 5645 * ------------------------------------------------------------------------ 5646 */ 5647 var NAME = 'button'; 5648 var VERSION = '4.1.3'; 5649 var DATA_KEY = 'bs.button'; 5650 var EVENT_KEY = "." + DATA_KEY; 5651 var DATA_API_KEY = '.data-api'; 5652 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 5653 var ClassName = { 5654 ACTIVE: 'active', 5655 BUTTON: 'btn', 5656 FOCUS: 'focus' 5657 }; 5658 var Selector = { 5659 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 5660 DATA_TOGGLE: '[data-toggle="buttons"]', 5661 INPUT: 'input', 5662 ACTIVE: '.active', 5663 BUTTON: '.btn' 5664 }; 5665 var Event = { 5666 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY, 5667 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY) 5668 /** 5669 * ------------------------------------------------------------------------ 5670 * Class Definition 5671 * ------------------------------------------------------------------------ 5672 */ 5673 5674 }; 5675 5676 var Button = 5677 /*#__PURE__*/ 5678 function () { 5679 function Button(element) { 5680 this._element = element; 5681 } // Getters 5682 5683 5684 var _proto = Button.prototype; 5685 5686 // Public
vendor: 5,853 bytes, lines 5687-5868
5687 _proto.toggle = function toggle() { 5688 var triggerChangeEvent = true; 5689 var addAriaPressed = true; 5690 var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0]; 5691 5692 if (rootElement) { 5693 var input = this._element.querySelector(Selector.INPUT); 5694 5695 if (input) { 5696 if (input.type === 'radio') { 5697 if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) { 5698 triggerChangeEvent = false; 5699 } else { 5700 var activeElement = rootElement.querySelector(Selector.ACTIVE); 5701 5702 if (activeElement) { 5703 $$$1(activeElement).removeClass(ClassName.ACTIVE); 5704 } 5705 } 5706 } 5707 5708 if (triggerChangeEvent) { 5709 if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { 5710 return; 5711 } 5712 5713 input.checked = !this._element.classList.contains(ClassName.ACTIVE); 5714 $$$1(input).trigger('change'); 5715 } 5716 5717 input.focus(); 5718 addAriaPressed = false; 5719 } 5720 } 5721 5722 if (addAriaPressed) { 5723 this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName.ACTIVE)); 5724 } 5725 5726 if (triggerChangeEvent) { 5727 $$$1(this._element).toggleClass(ClassName.ACTIVE); 5728 } 5729 }; 5730 5731 _proto.dispose = function dispose() { 5732 $$$1.removeData(this._element, DATA_KEY); 5733 this._element = null; 5734 }; // Static 5735 5736 5737 Button._jQueryInterface = function _jQueryInterface(config) { 5738 return this.each(function () { 5739 var data = $$$1(this).data(DATA_KEY); 5740 5741 if (!data) { 5742 data = new Button(this); 5743 $$$1(this).data(DATA_KEY, data); 5744 } 5745 5746 if (config === 'toggle') { 5747 data[config](); 5748 } 5749 }); 5750 }; 5751 5752 _createClass(Button, null, [{ 5753 key: "VERSION", 5754 get: function get() { 5755 return VERSION; 5756 } 5757 }]); 5758 5759 return Button; 5760 }(); 5761 /** 5762 * ------------------------------------------------------------------------ 5763 * Data Api implementation 5764 * ------------------------------------------------------------------------ 5765 */ 5766 5767 5768 $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { 5769 event.preventDefault(); 5770 var button = event.target; 5771 5772 if (!$$$1(button).hasClass(ClassName.BUTTON)) { 5773 button = $$$1(button).closest(Selector.BUTTON); 5774 } 5775 5776 Button._jQueryInterface.call($$$1(button), 'toggle'); 5777 }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { 5778 var button = $$$1(event.target).closest(Selector.BUTTON)[0]; 5779 $$$1(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)); 5780 }); 5781 /** 5782 * ------------------------------------------------------------------------ 5783 * jQuery 5784 * ------------------------------------------------------------------------ 5785 */ 5786 5787 $$$1.fn[NAME] = Button._jQueryInterface; 5788 $$$1.fn[NAME].Constructor = Button; 5789 5790 $$$1.fn[NAME].noConflict = function () { 5791 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 5792 return Button._jQueryInterface; 5793 }; 5794 5795 return Button; 5796 }($); 5797 5798 /** 5799 * -------------------------------------------------------------------------- 5800 * Bootstrap (v4.1.3): carousel.js 5801 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5802 * -------------------------------------------------------------------------- 5803 */ 5804 5805 var Carousel = function ($$$1) { 5806 /** 5807 * ------------------------------------------------------------------------ 5808 * Constants 5809 * ------------------------------------------------------------------------ 5810 */ 5811 var NAME = 'carousel'; 5812 var VERSION = '4.1.3'; 5813 var DATA_KEY = 'bs.carousel'; 5814 var EVENT_KEY = "." + DATA_KEY; 5815 var DATA_API_KEY = '.data-api'; 5816 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 5817 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 5818 5819 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 5820 5821 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 5822 5823 var Default = { 5824 interval: 5000, 5825 keyboard: true, 5826 slide: false, 5827 pause: 'hover', 5828 wrap: true 5829 }; 5830 var DefaultType = { 5831 interval: '(number|boolean)', 5832 keyboard: 'boolean', 5833 slide: '(boolean|string)', 5834 pause: '(string|boolean)', 5835 wrap: 'boolean' 5836 }; 5837 var Direction = { 5838 NEXT: 'next', 5839 PREV: 'prev', 5840 LEFT: 'left', 5841 RIGHT: 'right' 5842 }; 5843 var Event = { 5844 SLIDE: "slide" + EVENT_KEY, 5845 SLID: "slid" + EVENT_KEY, 5846 KEYDOWN: "keydown" + EVENT_KEY, 5847 MOUSEENTER: "mouseenter" + EVENT_KEY, 5848 MOUSELEAVE: "mouseleave" + EVENT_KEY, 5849 TOUCHEND: "touchend" + EVENT_KEY, 5850 LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY, 5851 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 5852 }; 5853 var ClassName = { 5854 CAROUSEL: 'carousel', 5855 ACTIVE: 'active', 5856 SLIDE: 'slide', 5857 RIGHT: 'carousel-item-right', 5858 LEFT: 'carousel-item-left', 5859 NEXT: 'carousel-item-next', 5860 PREV: 'carousel-item-prev', 5861 ITEM: 'carousel-item' 5862 }; 5863 var Selector = { 5864 ACTIVE: '.active', 5865 ACTIVE_ITEM: '.active.carousel-item', 5866 ITEM: '.carousel-item', 5867 NEXT_PREV: '.carousel-item-next, .carousel-item-prev', 5868 INDICATORS: '.carousel-indicators',
5869 DATA_SLIDE: '[data-slide], [data-slide-to]', 5870 DATA_RIDE: '[data-ride="carousel"]' 5871 /** 5872 * ------------------------------------------------------------------------ 5873 * Class Definition 5874 * ------------------------------------------------------------------------ 5875 */ 5876 5877 }; 5878 5879 var Carousel = 5880 /*#__PURE__*/ 5881 function () { 5882 function Carousel(element, config) { 5883 this._items = null; 5884 this._interval = null; 5885 this._activeElement = null; 5886 this._isPaused = false; 5887 this._isSliding = false; 5888 this.touchTimeout = null; 5889 this._config = this._getConfig(config); 5890 this._element = $$$1(element)[0]; 5891 this._indicatorsElement = this._element.querySelector(Selector.INDICATORS); 5892 5893 this._addEventListeners(); 5894 } // Getters 5895 5896 5897 var _proto = Carousel.prototype; 5898 5899 // Public 5900 _proto.next = function next() { 5901 if (!this._isSliding) { 5902 this._slide(Direction.NEXT); 5903 } 5904 }; 5905 5906 _proto.nextWhenVisible = function nextWhenVisible() { 5907 // Don't call next when the page isn't visible 5908 // or the carousel or its parent isn't visible 5909 if (!document.hidden && $$$1(this._element).is(':visible') && $$$1(this._element).css('visibility') !== 'hidden') { 5910 this.next(); 5911 } 5912 }; 5913 5914 _proto.prev = function prev() { 5915 if (!this._isSliding) { 5916 this._slide(Direction.PREV); 5917 } 5918 }; 5919 5920 _proto.pause = function pause(event) { 5921 if (!event) { 5922 this._isPaused = true; 5923 } 5924 5925 if (this._element.querySelector(Selector.NEXT_PREV)) { 5926 Util.triggerTransitionEnd(this._element); 5927 this.cycle(true); 5928 } 5929 5930 clearInterval(this._interval); 5931 this._interval = null; 5932 }; 5933 5934 _proto.cycle = function cycle(event) { 5935 if (!event) { 5936 this._isPaused = false; 5937 } 5938 5939 if (this._interval) { 5940 clearInterval(this._interval); 5941 this._interval = null; 5942 } 5943 5944 if (this._config.interval && !this._isPaused) { 5945 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 5946 } 5947 }; 5948 5949 _proto.to = function to(index) { 5950 var _this = this; 5951 5952 this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM); 5953 5954 var activeIndex = this._getItemIndex(this._activeElement); 5955 5956 if (index > this._items.length - 1 || index < 0) { 5957 return; 5958 } 5959 5960 if (this._isSliding) { 5961 $$$1(this._element).one(Event.SLID, function () { 5962 return _this.to(index); 5963 }); 5964 return; 5965 } 5966 5967 if (activeIndex === index) { 5968 this.pause(); 5969 this.cycle(); 5970 return; 5971 } 5972 5973 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 5974 5975 this._slide(direction, this._items[index]); 5976 }; 5977 5978 _proto.dispose = function dispose() { 5979 $$$1(this._element).off(EVENT_KEY); 5980 $$$1.removeData(this._element, DATA_KEY); 5981 this._items = null; 5982 this._config = null; 5983 this._element = null; 5984 this._interval = null; 5985 this._isPaused = null; 5986 this._isSliding = null; 5987 this._activeElement = null; 5988 this._indicatorsElement = null; 5989 }; // Private 5990 5991 5992 _proto._getConfig = function _getConfig(config) { 5993 config = _objectSpread({}, Default, config); 5994 Util.typeCheckConfig(NAME, config, DefaultType); 5995 return config; 5996 }; 5997 5998 _proto._addEventListeners = function _addEventListeners() { 5999 var _this2 = this; 6000 6001 if (this._config.keyboard) { 6002 $$$1(this._element).on(Event.KEYDOWN, function (event) { 6003 return _this2._keydown(event); 6004 }); 6005 } 6006 6007 if (this._config.pause === 'hover') { 6008 $$$1(this._element).on(Event.MOUSEENTER, function (event) { 6009 return _this2.pause(event); 6010 }).on(Event.MOUSELEAVE, function (event) { 6011 return _this2.cycle(event); 6012 }); 6013 6014 if ('ontouchstart' in document.documentElement) {
6015 // If it's a touch-enabled device, mouseenter/leave are fired as 6016 // part of the mouse compatibility events on first tap - the carousel 6017 // would stop cycling until user tapped out of it; 6018 // here, we listen for touchend, explicitly pause the carousel 6019 // (as if it's the second time we tap on it, mouseenter compat event 6020 // is NOT fired) and after a timeout (to allow for mouse compatibility 6021 // events to fire) we explicitly restart cycling 6022 $$$1(this._element).on(Event.TOUCHEND, function () { 6023 _this2.pause(); 6024 6025 if (_this2.touchTimeout) { 6026 clearTimeout(_this2.touchTimeout); 6027 } 6028 6029 _this2.touchTimeout = setTimeout(function (event) { 6030 return _this2.cycle(event); 6031 }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval); 6032 }); 6033 } 6034 } 6035 }; 6036 6037 _proto._keydown = function _keydown(event) { 6038 if (/input|textarea/i.test(event.target.tagName)) { 6039 return; 6040 } 6041 6042 switch (event.which) { 6043 case ARROW_LEFT_KEYCODE: 6044 event.preventDefault(); 6045 this.prev(); 6046 break; 6047 6048 case ARROW_RIGHT_KEYCODE: 6049 event.preventDefault(); 6050 this.next(); 6051 break; 6052 6053 default: 6054 } 6055 }; 6056 6057 _proto._getItemIndex = function _getItemIndex(element) { 6058 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : []; 6059 return this._items.indexOf(element); 6060 }; 6061 6062 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 6063 var isNextDirection = direction === Direction.NEXT; 6064 var isPrevDirection = direction === Direction.PREV; 6065 6066 var activeIndex = this._getItemIndex(activeElement); 6067 6068 var lastItemIndex = this._items.length - 1; 6069 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 6070 6071 if (isGoingToWrap && !this._config.wrap) { 6072 return activeElement; 6073 } 6074 6075 var delta = direction === Direction.PREV ? -1 : 1; 6076 var itemIndex = (activeIndex + delta) % this._items.length; 6077 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 6078 }; 6079 6080 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 6081 var targetIndex = this._getItemIndex(relatedTarget); 6082 6083 var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM)); 6084 6085 var slideEvent = $$$1.Event(Event.SLIDE, { 6086 relatedTarget: relatedTarget, 6087 direction: eventDirectionName, 6088 from: fromIndex, 6089 to: targetIndex 6090 }); 6091 $$$1(this._element).trigger(slideEvent); 6092 return slideEvent; 6093 }; 6094 6095 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 6096 if (this._indicatorsElement) { 6097 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE)); 6098 $$$1(indicators).removeClass(ClassName.ACTIVE); 6099 6100 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 6101 6102 if (nextIndicator) { 6103 $$$1(nextIndicator).addClass(ClassName.ACTIVE); 6104 } 6105 } 6106 }; 6107 6108 _proto._slide = function _slide(direction, element) { 6109 var _this3 = this; 6110 6111 var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM); 6112 6113 var activeElementIndex = this._getItemIndex(activeElement); 6114 6115 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 6116 6117 var nextElementIndex = this._getItemIndex(nextElement); 6118 6119 var isCycling = Boolean(this._interval); 6120 var directionalClassName; 6121 var orderClassName; 6122 var eventDirectionName; 6123 6124 if (direction === Direction.NEXT) { 6125 directionalClassName = ClassName.LEFT; 6126 orderClassName = ClassName.NEXT; 6127 eventDirectionName = Direction.LEFT; 6128 } else { 6129 directionalClassName = ClassName.RIGHT; 6130 orderClassName = ClassName.PREV; 6131 eventDirectionName = Direction.RIGHT; 6132 } 6133 6134 if (nextElement && $$$1(nextElement).hasClass(ClassName.ACTIVE)) { 6135 this._isSliding = false; 6136 return; 6137 } 6138 6139 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 6140 6141 if (slideEvent.isDefaultPrevented()) { 6142 return; 6143 } 6144 6145 if (!activeElement || !nextElement) { 6146 // Some weirdness is happening, so we bail 6147 return; 6148 } 6149 6150 this._isSliding = true; 6151 6152 if (isCycling) { 6153 this.pause(); 6154 } 6155 6156 this._setActiveIndicatorElement(nextElement); 6157 6158 var slidEvent = $$$1.Event(Event.SLID, { 6159 relatedTarget: nextElement, 6160 direction: eventDirectionName, 6161 from: activeElementIndex, 6162 to: nextElementIndex 6163 }); 6164 6165 if ($$$1(this._element).hasClass(ClassName.SLIDE)) { 6166 $$$1(nextElement).addClass(orderClassName); 6167 Util.reflow(nextElement); 6168 $$$1(activeElement).addClass(directionalClassName); 6169 $$$1(nextElement).addClass(directionalClassName); 6170 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 6171 $$$1(activeElement).one(Util.TRANSITION_END, function () { 6172 $$$1(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE); 6173 $$$1(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName); 6174 _this3._isSliding = false; 6175 setTimeout(function () { 6176 return $$$1(_this3._element).trigger(slidEvent); 6177 }, 0); 6178 }).emulateTransitionEnd(transitionDuration); 6179 } else { 6180 $$$1(activeElement).removeClass(ClassName.ACTIVE); 6181 $$$1(nextElement).addClass(ClassName.ACTIVE); 6182 this._isSliding = false; 6183 $$$1(this._element).trigger(slidEvent); 6184 } 6185 6186 if (isCycling) { 6187 this.cycle(); 6188 } 6189 }; // Static 6190 6191 6192 Carousel._jQueryInterface = function _jQueryInterface(config) { 6193 return this.each(function () { 6194 var data = $$$1(this).data(DATA_KEY); 6195 6196 var _config = _objectSpread({}, Default, $$$1(this).data()); 6197 6198 if (typeof config === 'object') { 6199 _config = _objectSpread({}, _config, config); 6200 } 6201 6202 var action = typeof config === 'string' ? config : _config.slide; 6203 6204 if (!data) { 6205 data = new Carousel(this, _config); 6206 $$$1(this).data(DATA_KEY, data); 6207 } 6208 6209 if (typeof config === 'number') { 6210 data.to(config); 6211 } else if (typeof action === 'string') { 6212 if (typeof data[action] === 'undefined') {
6213 throw new TypeError("No method named \"" + action + "\""); 6214 } 6215 6216 data[action](); 6217 } else if (_config.interval) { 6218 data.pause(); 6219 data.cycle(); 6220 } 6221 }); 6222 }; 6223 6224 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 6225 var selector = Util.getSelectorFromElement(this); 6226 6227 if (!selector) { 6228 return; 6229 } 6230 6231 var target = $$$1(selector)[0]; 6232 6233 if (!target || !$$$1(target).hasClass(ClassName.CAROUSEL)) { 6234 return; 6235 } 6236 6237 var config = _objectSpread({}, $$$1(target).data(), $$$1(this).data()); 6238 6239 var slideIndex = this.getAttribute('data-slide-to'); 6240 6241 if (slideIndex) { 6242 config.interval = false; 6243 } 6244 6245 Carousel._jQueryInterface.call($$$1(target), config); 6246 6247 if (slideIndex) { 6248 $$$1(target).data(DATA_KEY).to(slideIndex); 6249 } 6250 6251 event.preventDefault(); 6252 }; 6253 6254 _createClass(Carousel, null, [{ 6255 key: "VERSION", 6256 get: function get() { 6257 return VERSION; 6258 } 6259 }, { 6260 key: "Default", 6261 get: function get() { 6262 return Default; 6263 } 6264 }]); 6265 6266 return Carousel; 6267 }(); 6268 /** 6269 * ------------------------------------------------------------------------ 6270 * Data Api implementation 6271 * ------------------------------------------------------------------------ 6272 */ 6273 6274 6275 $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); 6276 $$$1(window).on(Event.LOAD_DATA_API, function () { 6277 var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE)); 6278 6279 for (var i = 0, len = carousels.length; i < len; i++) { 6280 var $carousel = $$$1(carousels[i]); 6281 6282 Carousel._jQueryInterface.call($carousel, $carousel.data()); 6283 } 6284 }); 6285 /** 6286 * ------------------------------------------------------------------------ 6287 * jQuery 6288 * ------------------------------------------------------------------------ 6289 */ 6290 6291 $$$1.fn[NAME] = Carousel._jQueryInterface; 6292 $$$1.fn[NAME].Constructor = Carousel; 6293 6294 $$$1.fn[NAME].noConflict = function () { 6295 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 6296 return Carousel._jQueryInterface; 6297 }; 6298 6299 return Carousel; 6300 }($); 6301 6302 /** 6303 * -------------------------------------------------------------------------- 6304 * Bootstrap (v4.1.3): collapse.js 6305 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6306 * -------------------------------------------------------------------------- 6307 */ 6308 6309 var Collapse = function ($$$1) { 6310 /** 6311 * ------------------------------------------------------------------------ 6312 * Constants 6313 * ------------------------------------------------------------------------ 6314 */ 6315 var NAME = 'collapse'; 6316 var VERSION = '4.1.3'; 6317 var DATA_KEY = 'bs.collapse'; 6318 var EVENT_KEY = "." + DATA_KEY; 6319 var DATA_API_KEY = '.data-api'; 6320 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 6321 var Default = { 6322 toggle: true, 6323 parent: '' 6324 }; 6325 var DefaultType = { 6326 toggle: 'boolean', 6327 parent: '(string|element)' 6328 }; 6329 var Event = { 6330 SHOW: "show" + EVENT_KEY, 6331 SHOWN: "shown" + EVENT_KEY, 6332 HIDE: "hide" + EVENT_KEY, 6333 HIDDEN: "hidden" + EVENT_KEY, 6334 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 6335 }; 6336 var ClassName = { 6337 SHOW: 'show', 6338 COLLAPSE: 'collapse', 6339 COLLAPSING: 'collapsing', 6340 COLLAPSED: 'collapsed' 6341 }; 6342 var Dimension = { 6343 WIDTH: 'width', 6344 HEIGHT: 'height' 6345 }; 6346 var Selector = { 6347 ACTIVES: '.show, .collapsing', 6348 DATA_TOGGLE: '[data-toggle="collapse"]' 6349 /** 6350 * ------------------------------------------------------------------------ 6351 * Class Definition 6352 * ------------------------------------------------------------------------ 6353 */ 6354 6355 }; 6356 6357 var Collapse = 6358 /*#__PURE__*/ 6359 function () { 6360 function Collapse(element, config) { 6361 this._isTransitioning = false; 6362 this._element = element; 6363 this._config = this._getConfig(config); 6364 this._triggerArray = $$$1.makeArray(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.i
6364d + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 6365 var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE)); 6366 6367 for (var i = 0, len = toggleList.length; i < len; i++) { 6368 var elem = toggleList[i]; 6369 var selector = Util.getSelectorFromElement(elem); 6370 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 6371 return foundElem === element; 6372 }); 6373 6374 if (selector !== null && filterElement.length > 0) { 6375 this._selector = selector; 6376 6377 this._triggerArray.push(elem); 6378 } 6379 } 6380 6381 this._parent = this._config.parent ? this._getParent() : null; 6382 6383 if (!this._config.parent) { 6384 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 6385 } 6386 6387 if (this._config.toggle) { 6388 this.toggle(); 6389 } 6390 } // Getters 6391 6392 6393 var _proto = Collapse.prototype; 6394 6395 // Public 6396 _proto.toggle = function toggle() { 6397 if ($$$1(this._element).hasClass(ClassName.SHOW)) { 6398 this.hide(); 6399 } else { 6400 this.show(); 6401 } 6402 }; 6403 6404 _proto.show = function show() { 6405 var _this = this; 6406 6407 if (this._isTransitioning || $$$1(this._element).hasClass(ClassName.SHOW)) { 6408 return; 6409 } 6410 6411 var actives; 6412 var activesData; 6413 6414 if (this._parent) { 6415 actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) { 6416 return elem.getAttribute('data-parent') === _this._config.parent; 6417 }); 6418 6419 if (actives.length === 0) { 6420 actives = null; 6421 } 6422 } 6423 6424 if (actives) { 6425 activesData = $$$1(actives).not(this._selector).data(DATA_KEY); 6426 6427 if (activesData && activesData._isTransitioning) { 6428 return; 6429 } 6430 } 6431 6432 var startEvent = $$$1.Event(Event.SHOW); 6433 $$$1(this._element).trigger(startEvent); 6434 6435 if (startEvent.isDefaultPrevented()) { 6436 return; 6437 } 6438 6439 if (actives) { 6440 Collapse._jQueryInterface.call($$$1(actives).not(this._selector), 'hide'); 6441 6442 if (!activesData) { 6443 $$$1(actives).data(DATA_KEY, null); 6444 } 6445 } 6446 6447 var dimension = this._getDimension(); 6448 6449 $$$1(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); 6450 this._element.style[dimension] = 0; 6451 6452 if (this._triggerArray.length) { 6453 $$$1(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); 6454 } 6455 6456 this.setTransitioning(true); 6457 6458 var complete = function complete() { 6459 $$$1(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW); 6460 _this._element.style[dimension] = ''; 6461 6462 _this.setTransitioning(false); 6463 6464 $$$1(_this._element).trigger(Event.SHOWN); 6465 }; 6466 6467 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 6468 var scrollSize = "scroll" + capitalizedDimension; 6469 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6470 $$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6471 this._element.style[dimension] = this._element[scrollSize] + "px"; 6472 }; 6473 6474 _proto.hide = function hide() { 6475 var _this2 = this; 6476 6477 if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) { 6478 return; 6479 } 6480 6481 var startEvent = $$$1.Event(Event.HIDE); 6482 $$$1(this._element).trigger(startEvent); 6483 6484 if (startEvent.isDefaultPrevented()) { 6485 return; 6486 } 6487 6488 var dimension = this._getDimension(); 6489 6490 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 6491 Util.reflow(this._element); 6492 $$$1(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); 6493 var triggerArrayLength = this._triggerArray.length; 6494 6495 if (triggerArrayLength > 0) { 6496 for (var i = 0; i < triggerArrayLength; i++) { 6497 var trigger = this._triggerArray[i]; 6498 var selector = Util.getSelectorFromElement(trigger); 6499 6500 if (selector !== null) { 6501 var $elem = $$$1([].slice.call(document.querySelectorAll(selector))); 6502 6503 if (!$elem.hasClass(ClassName.SHOW)) { 6504 $$$1(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); 6505 } 6506 } 6507 } 6508 } 6509 6510 this.setTransitioning(true); 6511 6512 var complete = function complete() { 6513 _this2.setTransitioning(false); 6514 6515 $$$1(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); 6516 }; 6517 6518 this._element.style[dimension] = ''; 6519 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6520 $$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6521 }; 6522 6523 _proto.setTransitioning = function setTransitioning(isTransitioning) { 6524 this._isTransitioning = isTransitioning; 6525 }; 6526 6527 _proto.dispose = function dispose() { 6528 $$$1.removeData(this._element, DATA_KEY); 6529 this._config = null; 6530 this._parent = null; 6531 this._element = null; 6532 this._triggerArray = null; 6533 this._isTransitioning = null; 6534 }; // Private 6535 6536 6537 _proto._getConfig = function _getConfig(config) { 6538 config = _objectSpread({}, Default, config); 6539 config.toggle = Boolean(config.toggle); // Coerce string values 6540 6541 Util.typeCheckConfig(NAME, config, DefaultType); 6542 return config; 6543 }; 6544 6545 _proto._getDimension = function _getDimension() { 6546 var hasWidth = $$$1(this._element).hasClass(Dimension.WIDTH); 6547 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 6548 }; 6549 6550 _proto._getParent = function _getParent() { 6551 var _this3 = this; 6552 6553 var parent = null; 6554 6555 if (Util.isElement(this._config.parent)) { 6556 parent = this._config.parent; // It's a jQuery object 6557 6558 if (typeof this._config.parent.jquery !== 'undefined') { 6559 parent = this._config.parent[0]; 6560 } 6561 } else { 6562 parent = document.querySelector(this._config.parent); 6563 } 6564 6565 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 6566 var children = [].slice.call(parent.querySelectorAll(selector)); 6567 $$$1(children).each(function (i, element) { 6568 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
6569 }); 6570 return parent; 6571 }; 6572 6573 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 6574 if (element) { 6575 var isOpen = $$$1(element).hasClass(ClassName.SHOW); 6576 6577 if (triggerArray.length) { 6578 $$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 6579 } 6580 } 6581 }; // Static 6582 6583 6584 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 6585 var selector = Util.getSelectorFromElement(element); 6586 return selector ? document.querySelector(selector) : null; 6587 }; 6588 6589 Collapse._jQueryInterface = function _jQueryInterface(config) { 6590 return this.each(function () { 6591 var $this = $$$1(this); 6592 var data = $this.data(DATA_KEY); 6593 6594 var _config = _objectSpread({}, Default, $this.data(), typeof config === 'object' && config ? config : {}); 6595 6596 if (!data && _config.toggle && /show|hide/.test(config)) { 6597 _config.toggle = false; 6598 } 6599 6600 if (!data) { 6601 data = new Collapse(this, _config); 6602 $this.data(DATA_KEY, data); 6603 } 6604 6605 if (typeof config === 'string') { 6606 if (typeof data[config] === 'undefined') { 6607 throw new TypeError("No method named \"" + config + "\""); 6608 } 6609 6610 data[config](); 6611 } 6612 }); 6613 }; 6614 6615 _createClass(Collapse, null, [{ 6616 key: "VERSION", 6617 get: function get() { 6618 return VERSION; 6619 } 6620 }, { 6621 key: "Default", 6622 get: function get() { 6623 return Default; 6624 } 6625 }]); 6626 6627 return Collapse; 6628 }(); 6629 /** 6630 * ------------------------------------------------------------------------ 6631 * Data Api implementation 6632 * ------------------------------------------------------------------------ 6633 */ 6634 6635 6636 $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 6637 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 6638 if (event.currentTarget.tagName === 'A') { 6639 event.preventDefault(); 6640 } 6641 6642 var $trigger = $$$1(this); 6643 var selector = Util.getSelectorFromElement(this); 6644 var selectors = [].slice.call(document.querySelectorAll(selector)); 6645 $$$1(selectors).each(function () { 6646 var $target = $$$1(this); 6647 var data = $target.data(DATA_KEY); 6648 var config = data ? 'toggle' : $trigger.data(); 6649 6650 Collapse._jQueryInterface.call($target, config); 6651 }); 6652 }); 6653 /** 6654 * ------------------------------------------------------------------------ 6655 * jQuery 6656 * ------------------------------------------------------------------------ 6657 */ 6658 6659 $$$1.fn[NAME] = Collapse._jQueryInterface; 6660 $$$1.fn[NAME].Constructor = Collapse; 6661 6662 $$$1.fn[NAME].noConflict = function () { 6663 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 6664 return Collapse._jQueryInterface; 6665 }; 6666 6667 return Collapse; 6668 }($); 6669 6670 /**! 6671 * @fileOverview Kickass library to create and place poppers near their reference elements. 6672 * @version 1.14.3 6673 * @license 6674 * Copyright (c) 2016 Federico Zivolo and contributors 6675 * 6676 * Permission is hereby granted, free of charge, to any person obtaining a copy 6677 * of this software and associated documentation files (the "Software"), to deal 6678 * in the Software without restriction, including without limitation the rights 6679 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6680 * copies of the Software, and to permit persons to whom the Software is 6681 * furnished to do so, subject to the following conditions: 6682 * 6683 * The above copyright notice and this permission notice shall be included in all 6684 * copies or substantial portions of the Software. 6685 * 6686 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6687 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6688 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6689 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 6690 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 6691 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 6692 * SOFTWARE. 6693 */ 6694 var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; 6695 6696 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 6697 var timeoutDuration = 0; 6698 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 6699 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 6700 timeoutDuration = 1; 6701 break; 6702 } 6703 } 6704 6705 function microtaskDebounce(fn) { 6706 var called = false; 6707 return function () { 6708 if (called) { 6709 return; 6710 } 6711 called = true; 6712 window.Promise.resolve().then(function () { 6713 called = false; 6714 fn(); 6715 }); 6716 }; 6717 } 6718 6719 function taskDebounce(fn) { 6720 var scheduled = false; 6721 return function () { 6722 if (!scheduled) { 6723 scheduled = true; 6724 setTimeout(function () { 6725 scheduled = false; 6726 fn(); 6727 }, timeoutDuration); 6728 } 6729 }; 6730 } 6731 6732 var supportsMicroTasks = isBrowser && window.Promise; 6733 6734 /** 6735 * Create a debounced version of a method, that's asynchronously deferred 6736 * but called in the minimum time possible. 6737 * 6738 * @method 6739 * @memberof Popper.Utils 6740 * @argument {Function} fn 6741 * @returns {Function} 6742 */ 6743 var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 6744 6745 /** 6746 * Check if the given variable is a function 6747 * @method 6748 * @memberof Popper.Utils 6749 * @argument {Any} functionToCheck - variable to check 6750 * @returns {Boolean} answer to: is a function? 6751 */ 6752 function isFunction(functionToCheck) { 6753 var getType = {}; 6754 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 6755 } 6756 6757 /** 6758 * Get CSS computed property of the given element 6759 * @method 6760 * @memberof Popper.Utils 6761 * @argument {Eement} element 6762 * @argument {String} property 6763 */ 6764 function getStyleComputedProperty(element, property) { 6765 if (element.nodeType !== 1) { 6766 return []; 6767 } 6768 // NOTE: 1 DOM access here 6769 var css = getComputedStyle(element, null); 6770 return property ? css[property] : css; 6771 } 6772 6773 /** 6774 * Returns the parentNode or the host of the element 6775 * @method 6776 * @memberof Popper.Utils 6777 * @argument {Element} element 6778 * @returns {Element} parent 6779 */ 6780 function getParentNode(element) { 6781 if (element.nodeName === 'HTML') { 6782 return element; 6783 } 6784 return element.parentNode || element.host; 6785 } 6786 6787 /** 6788 * Returns the scrolling parent of the given element 6789 * @method 6790 * @memberof Popper.Utils 6791 * @argument {Element} element 6792 * @returns {Element} scroll parent 6793 */ 6794 function getScrollParent(element) { 6795 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 6796 if (!element) { 6797 return document.body; 6798 } 6799 6800 switch (element.nodeName) { 6801 case 'HTML': 6802 case 'BODY': 6803 return element.ownerDocument.body; 6804 case '#document': 6805 return element.body; 6806 } 6807 6808 // Firefox want us to check `-x` and `-y` variations as well 6809 6810 var _getStyleComputedProp = getStyleComputedProperty(element), 6811 overflow = _getStyleComputedProp.overflow, 6812 overflowX = _getStyleComputedProp.overflowX, 6813 overflowY = _getStyleComputedProp.overflowY; 6814 6815 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 6816 return element; 6817 } 6818 6819 return getScrollParent(getParentNode(element)); 6820 } 6821 6822 var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 6823 var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 6824 6825 /** 6826 * Determines if the browser is Internet Explorer 6827 * @method 6828 * @memberof Popper.Utils 6829 * @param {Number} version to check 6830 * @returns {Boolean} isIE 6831 */ 6832 function isIE(version) { 6833 if (version === 11) { 6834 return isIE11; 6835 } 6836 if (version === 10) { 6837 return isIE10; 6838 } 6839 return isIE11 || isIE10; 6840 } 6841 6842 /** 6843 * Returns the offset parent of the given element 6844 * @method 6845 * @memberof Popper.Utils 6846 * @argument {Element} element 6847 * @returns {Element} offset parent 6848 */ 6849 function getOffsetParent(element) { 6850 if (!element) { 6851 return document.documentElement; 6852 } 6853 6854 var noOffsetParent = isIE(10) ? document.body : null; 6855 6856 // NOTE: 1 DOM access here 6857 var offsetParent = element.offsetParent; 6858 // Skip hidden elements which don't have an offsetParent 6859 while (offsetParent === noOffsetParent && element.nextElementSibling) { 6860 offsetParent = (element = element.nextElementSibling).offsetParent; 6861 } 6862
vendor: 12,168 bytes, lines 6863-7208
6863 var nodeName = offsetParent && offsetParent.nodeName; 6864 6865 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 6866 return element ? element.ownerDocument.documentElement : document.documentElement; 6867 } 6868 6869 // .offsetParent will return the closest TD or TABLE in case 6870 // no offsetParent is present, I hate this job... 6871 if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 6872 return getOffsetParent(offsetParent); 6873 } 6874 6875 return offsetParent; 6876 } 6877 6878 function isOffsetContainer(element) { 6879 var nodeName = element.nodeName; 6880 6881 if (nodeName === 'BODY') { 6882 return false; 6883 } 6884 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 6885 } 6886 6887 /** 6888 * Finds the root node (document, shadowDOM root) of the given element 6889 * @method 6890 * @memberof Popper.Utils 6891 * @argument {Element} node 6892 * @returns {Element} root node 6893 */ 6894 function getRoot(node) { 6895 if (node.parentNode !== null) { 6896 return getRoot(node.parentNode); 6897 } 6898 6899 return node; 6900 } 6901 6902 /** 6903 * Finds the offset parent common to the two provided nodes 6904 * @method 6905 * @memberof Popper.Utils 6906 * @argument {Element} element1 6907 * @argument {Element} element2 6908 * @returns {Element} common offset parent 6909 */ 6910 function findCommonOffsetParent(element1, element2) { 6911 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 6912 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 6913 return document.documentElement; 6914 } 6915 6916 // Here we make sure to give as "start" the element that comes first in the DOM 6917 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 6918 var start = order ? element1 : element2; 6919 var end = order ? element2 : element1; 6920 6921 // Get common ancestor container 6922 var range = document.createRange(); 6923 range.setStart(start, 0); 6924 range.setEnd(end, 0); 6925 var commonAncestorContainer = range.commonAncestorContainer; 6926 6927 // Both nodes are inside #document 6928 6929 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 6930 if (isOffsetContainer(commonAncestorContainer)) { 6931 return commonAncestorContainer; 6932 } 6933 6934 return getOffsetParent(commonAncestorContainer); 6935 } 6936 6937 // one of the nodes is inside shadowDOM, find which one 6938 var element1root = getRoot(element1); 6939 if (element1root.host) { 6940 return findCommonOffsetParent(element1root.host, element2); 6941 } else { 6942 return findCommonOffsetParent(element1, getRoot(element2).host); 6943 } 6944 } 6945 6946 /** 6947 * Gets the scroll value of the given element in the given side (top and left) 6948 * @method 6949 * @memberof Popper.Utils 6950 * @argument {Element} element 6951 * @argument {String} side `top` or `left` 6952 * @returns {number} amount of scrolled pixels 6953 */ 6954 function getScroll(element) { 6955 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 6956 6957 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 6958 var nodeName = element.nodeName; 6959 6960 if (nodeName === 'BODY' || nodeName === 'HTML') { 6961 var html = element.ownerDocument.documentElement; 6962 var scrollingElement = element.ownerDocument.scrollingElement || html; 6963 return scrollingElement[upperSide]; 6964 } 6965 6966 return element[upperSide]; 6967 } 6968 6969 /* 6970 * Sum or subtract the element scroll values (left and top) from a given rect object 6971 * @method 6972 * @memberof Popper.Utils 6973 * @param {Object} rect - Rect object you want to change 6974 * @param {HTMLElement} element - The element from the function reads the scroll values 6975 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 6976 * @return {Object} rect - The modifier rect object 6977 */ 6978 function includeScroll(rect, element) { 6979 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 6980 6981 var scrollTop = getScroll(element, 'top'); 6982 var scrollLeft = getScroll(element, 'left'); 6983 var modifier = subtract ? -1 : 1; 6984 rect.top += scrollTop * modifier; 6985 rect.bottom += scrollTop * modifier; 6986 rect.left += scrollLeft * modifier; 6987 rect.right += scrollLeft * modifier; 6988 return rect; 6989 } 6990 6991 /* 6992 * Helper to detect borders of a given element 6993 * @method 6994 * @memberof Popper.Utils 6995 * @param {CSSStyleDeclaration} styles 6996 * Result of `getStyleComputedProperty` on the given element 6997 * @param {String} axis - `x` or `y` 6998 * @return {number} borders - The borders size of the given axis 6999 */ 7000 7001 function getBordersSize(styles, axis) { 7002 var sideA = axis === 'x' ? 'Left' : 'Top'; 7003 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 7004 7005 return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); 7006 } 7007 7008 function getSize(axis, body, html, computedStyle) { 7009 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0); 7010 } 7011 7012 function getWindowSizes() { 7013 var body = document.body; 7014 var html = document.documentElement; 7015 var computedStyle = isIE(10) && getComputedStyle(html); 7016 7017 return { 7018 height: getSize('Height', body, html, computedStyle), 7019 width: getSize('Width', body, html, computedStyle) 7020 }; 7021 } 7022 7023 var classCallCheck = function (instance, Constructor) { 7024 if (!(instance instanceof Constructor)) { 7025 throw new TypeError("Cannot call a class as a function"); 7026 } 7027 }; 7028 7029 var createClass = function () { 7030 function defineProperties(target, props) { 7031 for (var i = 0; i < props.length; i++) { 7032 var descriptor = props[i]; 7033 descriptor.enumerable = descriptor.enumerable || false; 7034 descriptor.configurable = true; 7035 if ("value" in descriptor) descriptor.writable = true; 7036 Object.defineProperty(target, descriptor.key, descriptor); 7037 } 7038 } 7039 7040 return function (Constructor, protoProps, staticProps) { 7041 if (protoProps) defineProperties(Constructor.prototype, protoProps); 7042 if (staticProps) defineProperties(Constructor, staticProps); 7043 return Constructor; 7044 }; 7045 }(); 7046 7047 7048 7049 7050 7051 var defineProperty = function (obj, key, value) { 7052 if (key in obj) { 7053 Object.defineProperty(obj, key, { 7054 value: value, 7055 enumerable: true, 7056 configurable: true, 7057 writable: true 7058 }); 7059 } else { 7060 obj[key] = value; 7061 } 7062 7063 return obj; 7064 }; 7065 7066 var _extends = Object.assign || function (target) { 7067 for (var i = 1; i < arguments.length; i++) { 7068 var source = arguments[i]; 7069 7070 for (var key in source) { 7071 if (Object.prototype.hasOwnProperty.call(source, key)) { 7072 target[key] = source[key]; 7073 } 7074 } 7075 } 7076 7077 return target; 7078 }; 7079 7080 /** 7081 * Given element offsets, generate an output similar to getBoundingClientRect 7082 * @method 7083 * @memberof Popper.Utils 7084 * @argument {Object} offsets 7085 * @returns {Object} ClientRect like output 7086 */ 7087 function getClientRect(offsets) { 7088 return _extends({}, offsets, { 7089 right: offsets.left + offsets.width, 7090 bottom: offsets.top + offsets.height 7091 }); 7092 } 7093 7094 /** 7095 * Get bounding client rect of given element 7096 * @method 7097 * @memberof Popper.Utils 7098 * @param {HTMLElement} element 7099 * @return {Object} client rect 7100 */ 7101 function getBoundingClientRect(element) { 7102 var rect = {}; 7103 7104 // IE10 10 FIX: Please, don't ask, the element isn't 7105 // considered in DOM in some circumstances... 7106 // This isn't reproducible in IE10 compatibility mode of IE11 7107 try { 7108 if (isIE(10)) { 7109 rect = element.getBoundingClientRect(); 7110 var scrollTop = getScroll(element, 'top'); 7111 var scrollLeft = getScroll(element, 'left'); 7112 rect.top += scrollTop; 7113 rect.left += scrollLeft; 7114 rect.bottom += scrollTop; 7115 rect.right += scrollLeft; 7116 } else { 7117 rect = element.getBoundingClientRect(); 7118 } 7119 } catch (e) {} 7120 7121 var result = { 7122 left: rect.left, 7123 top: rect.top, 7124 width: rect.right - rect.left, 7125 height: rect.bottom - rect.top 7126 }; 7127 7128 // subtract scrollbar size from sizes 7129 var sizes = element.nodeName === 'HTML' ? getWindowSizes() : {}; 7130 var width = sizes.width || element.clientWidth || result.right - result.left; 7131 var height = sizes.height || element.clientHeight || result.bottom - result.top; 7132 7133 var horizScrollbar = element.offsetWidth - width; 7134 var vertScrollbar = element.offsetHeight - height; 7135 7136 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 7137 // we make this check conditional for performance reasons 7138 if (horizScrollbar || vertScrollbar) { 7139 var styles = getStyleComputedProperty(element); 7140 horizScrollbar -= getBordersSize(styles, 'x'); 7141 vertScrollbar -= getBordersSize(styles, 'y'); 7142 7143 result.width -= horizScrollbar; 7144 result.height -= vertScrollbar; 7145 } 7146 7147 return getClientRect(result); 7148 } 7149 7150 function getOffsetRectRelativeToArbitraryNode(children, parent) { 7151 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 7152 7153 var isIE10 = isIE(10); 7154 var isHTML = parent.nodeName === 'HTML'; 7155 var childrenRect = getBoundingClientRect(children); 7156 var parentRect = getBoundingClientRect(parent); 7157 var scrollParent = getScrollParent(children); 7158 7159 var styles = getStyleComputedProperty(parent); 7160 var borderTopWidth = parseFloat(styles.borderTopWidth, 10); 7161 var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); 7162 7163 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 7164 if (fixedPosition && parent.nodeName === 'HTML') { 7165 parentRect.top = Math.max(parentRect.top, 0); 7166 parentRect.left = Math.max(parentRect.left, 0); 7167 } 7168 var offsets = getClientRect({ 7169 top: childrenRect.top - parentRect.top - borderTopWidth, 7170 left: childrenRect.left - parentRect.left - borderLeftWidth, 7171 width: childrenRect.width, 7172 height: childrenRect.height 7173 }); 7174 offsets.marginTop = 0; 7175 offsets.marginLeft = 0; 7176 7177 // Subtract margins of documentElement in case it's being used as parent 7178 // we do this only on HTML because it's the only element that behaves 7179 // differently when margins are applied to it. The margins are included in 7180 // the box of the documentElement, in the other cases not. 7181 if (!isIE10 && isHTML) { 7182 var marginTop = parseFloat(styles.marginTop, 10); 7183 var marginLeft = parseFloat(styles.marginLeft, 10); 7184 7185 offsets.top -= borderTopWidth - marginTop; 7186 offsets.bottom -= borderTopWidth - marginTop; 7187 offsets.left -= borderLeftWidth - marginLeft; 7188 offsets.right -= borderLeftWidth - marginLeft; 7189 7190 // Attach marginTop and marginLeft because in some circumstances we may need them 7191 offsets.marginTop = marginTop; 7192 offsets.marginLeft = marginLeft; 7193 } 7194 7195 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 7196 offsets = includeScroll(offsets, parent); 7197 } 7198 7199 return offsets; 7200 } 7201 7202 function getViewportOffsetRectRelativeToArtbitraryNode(element) { 7203 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 7204 7205 var html = element.ownerDocument.documentElement; 7206 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 7207 var width = Math.max(html.clientWidth, window.innerWidth || 0); 7208 var height = Math.max(html.clientHeight, window.innerHeight || 0
vendor: 5,636 bytes, lines 7208-7377
7208); 7209 7210 var scrollTop = !excludeScroll ? getScroll(html) : 0; 7211 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 7212 7213 var offset = { 7214 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 7215 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 7216 width: width, 7217 height: height 7218 }; 7219 7220 return getClientRect(offset); 7221 } 7222 7223 /** 7224 * Check if the given element is fixed or is inside a fixed parent 7225 * @method 7226 * @memberof Popper.Utils 7227 * @argument {Element} element 7228 * @argument {Element} customContainer 7229 * @returns {Boolean} answer to "isFixed?" 7230 */ 7231 function isFixed(element) { 7232 var nodeName = element.nodeName; 7233 if (nodeName === 'BODY' || nodeName === 'HTML') { 7234 return false; 7235 } 7236 if (getStyleComputedProperty(element, 'position') === 'fixed') { 7237 return true; 7238 } 7239 return isFixed(getParentNode(element)); 7240 } 7241 7242 /** 7243 * Finds the first parent of an element that has a transformed property defined 7244 * @method 7245 * @memberof Popper.Utils 7246 * @argument {Element} element 7247 * @returns {Element} first transformed parent or documentElement 7248 */ 7249 7250 function getFixedPositionOffsetParent(element) { 7251 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 7252 if (!element || !element.parentElement || isIE()) { 7253 return document.documentElement; 7254 } 7255 var el = element.parentElement; 7256 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 7257 el = el.parentElement; 7258 } 7259 return el || document.documentElement; 7260 } 7261 7262 /** 7263 * Computed the boundaries limits and return them 7264 * @method 7265 * @memberof Popper.Utils 7266 * @param {HTMLElement} popper 7267 * @param {HTMLElement} reference 7268 * @param {number} padding 7269 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 7270 * @param {Boolean} fixedPosition - Is in fixed position mode 7271 * @returns {Object} Coordinates of the boundaries 7272 */ 7273 function getBoundaries(popper, reference, padding, boundariesElement) { 7274 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 7275 7276 // NOTE: 1 DOM access here 7277 7278 var boundaries = { top: 0, left: 0 }; 7279 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 7280 7281 // Handle viewport case 7282 if (boundariesElement === 'viewport') { 7283 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 7284 } else { 7285 // Handle other cases based on DOM element used as boundaries 7286 var boundariesNode = void 0; 7287 if (boundariesElement === 'scrollParent') { 7288 boundariesNode = getScrollParent(getParentNode(reference)); 7289 if (boundariesNode.nodeName === 'BODY') { 7290 boundariesNode = popper.ownerDocument.documentElement; 7291 } 7292 } else if (boundariesElement === 'window') { 7293 boundariesNode = popper.ownerDocument.documentElement; 7294 } else { 7295 boundariesNode = boundariesElement; 7296 } 7297 7298 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 7299 7300 // In case of HTML, we need a different computation 7301 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 7302 var _getWindowSizes = getWindowSizes(), 7303 height = _getWindowSizes.height, 7304 width = _getWindowSizes.width; 7305 7306 boundaries.top += offsets.top - offsets.marginTop; 7307 boundaries.bottom = height + offsets.top; 7308 boundaries.left += offsets.left - offsets.marginLeft; 7309 boundaries.right = width + offsets.left; 7310 } else { 7311 // for all the other DOM elements, this one is good 7312 boundaries = offsets; 7313 } 7314 } 7315 7316 // Add paddings 7317 boundaries.left += padding; 7318 boundaries.top += padding; 7319 boundaries.right -= padding; 7320 boundaries.bottom -= padding; 7321 7322 return boundaries; 7323 } 7324 7325 function getArea(_ref) { 7326 var width = _ref.width, 7327 height = _ref.height; 7328 7329 return width * height; 7330 } 7331 7332 /** 7333 * Utility used to transform the `auto` placement to the placement with more 7334 * available space. 7335 * @method 7336 * @memberof Popper.Utils 7337 * @argument {Object} data - The data object generated by update method 7338 * @argument {Object} options - Modifiers configuration and options 7339 * @returns {Object} The data object, properly modified 7340 */ 7341 function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 7342 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 7343 7344 if (placement.indexOf('auto') === -1) { 7345 return placement; 7346 } 7347 7348 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 7349 7350 var rects = { 7351 top: { 7352 width: boundaries.width, 7353 height: refRect.top - boundaries.top 7354 }, 7355 right: { 7356 width: boundaries.right - refRect.right, 7357 height: boundaries.height 7358 }, 7359 bottom: { 7360 width: boundaries.width, 7361 height: boundaries.bottom - refRect.bottom 7362 }, 7363 left: { 7364 width: refRect.left - boundaries.left, 7365 height: boundaries.height 7366 } 7367 }; 7368 7369 var sortedAreas = Object.keys(rects).map(function (key) { 7370 return _extends({ 7371 key: key 7372 }, rects[key], { 7373 area: getArea(rects[key]) 7374 }); 7375 }).sort(function (a, b) { 7376 return b.area - a.area; 7377 });
7378 7379 var filteredAreas = sortedAreas.filter(function (_ref2) { 7380 var width = _ref2.width, 7381 height = _ref2.height; 7382 return width >= popper.clientWidth && height >= popper.clientHeight; 7383 }); 7384 7385 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 7386 7387 var variation = placement.split('-')[1]; 7388 7389 return computedPlacement + (variation ? '-' + variation : ''); 7390 } 7391 7392 /** 7393 * Get offsets to the reference element 7394 * @method 7395 * @memberof Popper.Utils 7396 * @param {Object} state 7397 * @param {Element} popper - the popper element 7398 * @param {Element} reference - the reference element (the popper will be relative to this) 7399 * @param {Element} fixedPosition - is in fixed position mode 7400 * @returns {Object} An object containing the offsets which will be applied to the popper 7401 */ 7402 function getReferenceOffsets(state, popper, reference) { 7403 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 7404 7405 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 7406 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 7407 } 7408 7409 /** 7410 * Get the outer sizes of the given element (offset size + margins) 7411 * @method 7412 * @memberof Popper.Utils 7413 * @argument {Element} element 7414 * @returns {Object}
vendor: 4,796 bytes, lines 7414-7551
7414 object containing width and height properties 7415 */ 7416 function getOuterSizes(element) { 7417 var styles = getComputedStyle(element); 7418 var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom); 7419 var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight); 7420 var result = { 7421 width: element.offsetWidth + y, 7422 height: element.offsetHeight + x 7423 }; 7424 return result; 7425 } 7426 7427 /** 7428 * Get the opposite placement of the given one 7429 * @method 7430 * @memberof Popper.Utils 7431 * @argument {String} placement 7432 * @returns {String} flipped placement 7433 */ 7434 function getOppositePlacement(placement) { 7435 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 7436 return placement.replace(/left|right|bottom|top/g, function (matched) { 7437 return hash[matched]; 7438 }); 7439 } 7440 7441 /** 7442 * Get offsets to the popper 7443 * @method 7444 * @memberof Popper.Utils 7445 * @param {Object} position - CSS position the Popper will get applied 7446 * @param {HTMLElement} popper - the popper element 7447 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 7448 * @param {String} placement - one of the valid placement options 7449 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 7450 */ 7451 function getPopperOffsets(popper, referenceOffsets, placement) { 7452 placement = placement.split('-')[0]; 7453 7454 // Get popper node sizes 7455 var popperRect = getOuterSizes(popper); 7456 7457 // Add position, width and height to our offsets object 7458 var popperOffsets = { 7459 width: popperRect.width, 7460 height: popperRect.height 7461 }; 7462 7463 // depending by the popper placement we have to compute its offsets slightly differently 7464 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 7465 var mainSide = isHoriz ? 'top' : 'left'; 7466 var secondarySide = isHoriz ? 'left' : 'top'; 7467 var measurement = isHoriz ? 'height' : 'width'; 7468 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 7469 7470 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 7471 if (placement === secondarySide) { 7472 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 7473 } else { 7474 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 7475 } 7476 7477 return popperOffsets; 7478 } 7479 7480 /** 7481 * Mimics the `find` method of Array 7482 * @method 7483 * @memberof Popper.Utils 7484 * @argument {Array} arr 7485 * @argument prop 7486 * @argument value 7487 * @returns index or -1 7488 */ 7489 function find(arr, check) { 7490 // use native find if supported 7491 if (Array.prototype.find) { 7492 return arr.find(check); 7493 } 7494 7495 // use `filter` to obtain the same behavior of `find` 7496 return arr.filter(check)[0]; 7497 } 7498 7499 /** 7500 * Return the index of the matching object 7501 * @method 7502 * @memberof Popper.Utils 7503 * @argument {Array} arr 7504 * @argument prop 7505 * @argument value 7506 * @returns index or -1 7507 */ 7508 function findIndex(arr, prop, value) { 7509 // use native findIndex if supported 7510 if (Array.prototype.findIndex) { 7511 return arr.findIndex(function (cur) { 7512 return cur[prop] === value; 7513 }); 7514 } 7515 7516 // use `find` + `indexOf` if `findIndex` isn't supported 7517 var match = find(arr, function (obj) { 7518 return obj[prop] === value; 7519 }); 7520 return arr.indexOf(match); 7521 } 7522 7523 /** 7524 * Loop trough the list of modifiers and run them in order, 7525 * each of them will then edit the data object. 7526 * @method 7527 * @memberof Popper.Utils 7528 * @param {dataObject} data 7529 * @param {Array} modifiers 7530 * @param {String} ends - Optional modifier name used as stopper 7531 * @returns {dataObject} 7532 */ 7533 function runModifiers(modifiers, data, ends) { 7534 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 7535 7536 modifiersToRun.forEach(function (modifier) { 7537 if (modifier['function']) { 7538 // eslint-disable-line dot-notation 7539 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 7540 } 7541 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 7542 if (modifier.enabled && isFunction(fn)) { 7543 // Add properties to offsets to make them a complete clientRect object 7544 // we do this before each modifier to make sure the previous one doesn't 7545 // mess with these values 7546 data.offsets.popper = getClientRect(data.offsets.popper); 7547 data.offsets.reference = getClientRect(data.offsets.reference); 7548 7549 data = fn(data, modifier); 7550 } 7551 });
vendor: 9,419 bytes, lines 7552-7833
7552 7553 return data; 7554 } 7555 7556 /** 7557 * Updates the position of the popper, computing the new offsets and applying 7558 * the new style.<br /> 7559 * Prefer `scheduleUpdate` over `update` because of performance reasons. 7560 * @method 7561 * @memberof Popper 7562 */ 7563 function update() { 7564 // if popper is destroyed, don't perform any further update 7565 if (this.state.isDestroyed) { 7566 return; 7567 } 7568 7569 var data = { 7570 instance: this, 7571 styles: {}, 7572 arrowStyles: {}, 7573 attributes: {}, 7574 flipped: false, 7575 offsets: {} 7576 }; 7577 7578 // compute reference element offsets 7579 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 7580 7581 // compute auto placement, store placement inside the data object, 7582 // modifiers will be able to edit `placement` if needed 7583 // and refer to originalPlacement to know the original value 7584 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 7585 7586 // store the computed placement inside `originalPlacement` 7587 data.originalPlacement = data.placement; 7588 7589 data.positionFixed = this.options.positionFixed; 7590 7591 // compute the popper offsets 7592 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 7593 7594 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 7595 7596 // run the modifiers 7597 data = runModifiers(this.modifiers, data); 7598 7599 // the first `update` will call `onCreate` callback 7600 // the other ones will call `onUpdate` callback 7601 if (!this.state.isCreated) { 7602 this.state.isCreated = true; 7603 this.options.onCreate(data); 7604 } else { 7605 this.options.onUpdate(data); 7606 } 7607 } 7608 7609 /** 7610 * Helper used to know if the given modifier is enabled. 7611 * @method 7612 * @memberof Popper.Utils 7613 * @returns {Boolean} 7614 */ 7615 function isModifierEnabled(modifiers, modifierName) { 7616 return modifiers.some(function (_ref) { 7617 var name = _ref.name, 7618 enabled = _ref.enabled; 7619 return enabled && name === modifierName; 7620 }); 7621 } 7622 7623 /** 7624 * Get the prefixed supported property name 7625 * @method 7626 * @memberof Popper.Utils 7627 * @argument {String} property (camelCase) 7628 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 7629 */ 7630 function getSupportedPropertyName(property) { 7631 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 7632 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 7633 7634 for (var i = 0; i < prefixes.length; i++) { 7635 var prefix = prefixes[i]; 7636 var toCheck = prefix ? '' + prefix + upperProp : property; 7637 if (typeof document.body.style[toCheck] !== 'undefined') { 7638 return toCheck; 7639 } 7640 } 7641 return null; 7642 } 7643 7644 /** 7645 * Destroy the popper 7646 * @method 7647 * @memberof Popper 7648 */ 7649 function destroy() { 7650 this.state.isDestroyed = true; 7651 7652 // touch DOM only if `applyStyle` modifier is enabled 7653 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 7654 this.popper.removeAttribute('x-placement'); 7655 this.popper.style.position = ''; 7656 this.popper.style.top = ''; 7657 this.popper.style.left = ''; 7658 this.popper.style.right = ''; 7659 this.popper.style.bottom = ''; 7660 this.popper.style.willChange = ''; 7661 this.popper.style[getSupportedPropertyName('transform')] = ''; 7662 } 7663 7664 this.disableEventListeners(); 7665 7666 // remove the popper if user explicity asked for the deletion on destroy 7667 // do not use `remove` because IE11 doesn't support it 7668 if (this.options.removeOnDestroy) { 7669 this.popper.parentNode.removeChild(this.popper); 7670 } 7671 return this; 7672 } 7673 7674 /** 7675 * Get the window associated with the element 7676 * @argument {Element} element 7677 * @returns {Window} 7678 */ 7679 function getWindow(element) { 7680 var ownerDocument = element.ownerDocument; 7681 return ownerDocument ? ownerDocument.defaultView : window; 7682 } 7683 7684 function attachToScrollParents(scrollParent, event, callback, scrollParents) { 7685 var isBody = scrollParent.nodeName === 'BODY'; 7686 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 7687 target.addEventListener(event, callback, { passive: true }); 7688 7689 if (!isBody) { 7690 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 7691 } 7692 scrollParents.push(target); 7693 } 7694 7695 /** 7696 * Setup needed event listeners used to update the popper position 7697 * @method 7698 * @memberof Popper.Utils 7699 * @private 7700 */ 7701 function setupEventListeners(reference, options, state, updateBound) { 7702 // Resize event listener on window 7703 state.updateBound = updateBound; 7704 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 7705 7706 // Scroll event listener on scroll parents 7707 var scrollElement = getScrollParent(reference); 7708 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 7709 state.scrollElement = scrollElement; 7710 state.eventsEnabled = true; 7711 7712 return state; 7713 } 7714 7715 /** 7716 * It will add resize/scroll events and start recalculating 7717 * position of the popper element when they are triggered. 7718 * @method 7719 * @memberof Popper 7720 */ 7721 function enableEventListeners() { 7722 if (!this.state.eventsEnabled) { 7723 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 7724 } 7725 } 7726 7727 /** 7728 * Remove event listeners used to update the popper position 7729 * @method 7730 * @memberof Popper.Utils 7731 * @private 7732 */ 7733 function removeEventListeners(reference, state) { 7734 // Remove resize event listener on window 7735 getWindow(reference).removeEventListener('resize', state.updateBound); 7736 7737 // Remove scroll event listener on scroll parents 7738 state.scrollParents.forEach(function (target) { 7739 target.removeEventListener('scroll', state.updateBound); 7740 }); 7741 7742 // Reset state 7743 state.updateBound = null; 7744 state.scrollParents = []; 7745 state.scrollElement = null; 7746 state.eventsEnabled = false; 7747 return state; 7748 } 7749 7750 /** 7751 * It will remove resize/scroll events and won't recalculate popper position 7752 * when they are triggered. It also won't trigger onUpdate callback anymore, 7753 * unless you call `update` method manually. 7754 * @method 7755 * @memberof Popper 7756 */ 7757 function disableEventListeners() { 7758 if (this.state.eventsEnabled) { 7759 cancelAnimationFrame(this.scheduleUpdate); 7760 this.state = removeEventListeners(this.reference, this.state); 7761 } 7762 } 7763 7764 /** 7765 * Tells if a given input is a number 7766 * @method 7767 * @memberof Popper.Utils 7768 * @param {*} input to check 7769 * @return {Boolean} 7770 */ 7771 function isNumeric(n) { 7772 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 7773 } 7774 7775 /** 7776 * Set the style to the given popper 7777 * @method 7778 * @memberof Popper.Utils 7779 * @argument {Element} element - Element to apply the style to 7780 * @argument {Object} styles 7781 * Object with a list of properties and values which will be applied to the element 7782 */ 7783 function setStyles(element, styles) { 7784 Object.keys(styles).forEach(function (prop) { 7785 var unit = ''; 7786 // add unit if the value is numeric and is one of the following 7787 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 7788 unit = 'px'; 7789 } 7790 element.style[prop] = styles[prop] + unit; 7791 }); 7792 } 7793 7794 /** 7795 * Set the attributes to the given popper 7796 * @method 7797 * @memberof Popper.Utils 7798 * @argument {Element} element - Element to apply the attributes to 7799 * @argument {Object} styles 7800 * Object with a list of properties and values which will be applied to the element 7801 */ 7802 function setAttributes(element, attributes) { 7803 Object.keys(attributes).forEach(function (prop) { 7804 var value = attributes[prop]; 7805 if (value !== false) { 7806 element.setAttribute(prop, attributes[prop]); 7807 } else { 7808 element.removeAttribute(prop); 7809 } 7810 }); 7811 } 7812 7813 /** 7814 * @function 7815 * @memberof Modifiers 7816 * @argument {Object} data - The data object generated by `update` method 7817 * @argument {Object} data.styles - List of style properties - values to apply to popper element 7818 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 7819 * @argument {Object} options - Modifiers configuration and options 7820 * @returns {Object} The same data object 7821 */ 7822 function applyStyle(data) { 7823 // any property present in `data.styles` will be applied to the popper, 7824 // in this way we can make the 3rd party modifiers add custom styles to it 7825 // Be aware, modifiers could override the properties defined in the previous 7826 // lines of this modifier! 7827 setStyles(data.instance.popper, data.styles); 7828 7829 // any property present in `data.attributes` will be applied to the popper, 7830 // they will be set as HTML attributes of the element 7831 setAttributes(data.instance.popper, data.attributes); 7832 7833 // if arrowElement is defined and arrowStyles has some properties
7834 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 7835 setStyles(data.arrowElement, data.arrowStyles); 7836 } 7837 7838 return data; 7839 } 7840 7841 /** 7842 * Set the x-placement attribute before everything else because it could be used 7843 * to add margins to the popper margins needs to be calculated to get the 7844 * correct popper offsets. 7845 * @method 7846 * @memberof Popper.modifiers 7847 * @param {HTMLElement} reference - The reference element used to position the popper 7848 * @param {HTMLElement} popper - The HTML element used as popper 7849 * @param {Object} options - Popper.js options 7850 */ 7851 function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 7852 // compute reference element offsets 7853 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 7854 7855 // compute auto placement, store placement inside the data object, 7856 // modifiers will be able to edit `placement` if needed 7857 // and refer to originalPlacement to know the original value 7858 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 7859 7860 popper.setAttribute('x-placement', placement); 7861 7862 // Apply `position` to popper before anything else because 7863 // without the position applied we can't guarantee correct computations 7864 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 7865 7866 return options; 7867 } 7868 7869 /** 7870 * @function 7871 * @memberof Modifiers 7872 * @argument {Object} data - The data object generated by `update` method 7873 * @argument {Object} options - Modifiers configuration and options 7874 * @returns {Object} The data object, properly modified 7875 */ 7876 function computeStyle(data, options) { 7877 var x = options.x, 7878 y = options.y;
vendor: 4,167 bytes, lines 7879-7983
7879 var popper = data.offsets.popper; 7880 7881 // Remove this legacy support in Popper.js v2 7882 7883 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 7884 return modifier.name === 'applyStyle'; 7885 }).gpuAcceleration; 7886 if (legacyGpuAccelerationOption !== undefined) { 7887 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 7888 } 7889 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 7890 7891 var offsetParent = getOffsetParent(data.instance.popper); 7892 var offsetParentRect = getBoundingClientRect(offsetParent); 7893 7894 // Styles 7895 var styles = { 7896 position: popper.position 7897 }; 7898 7899 // Avoid blurry text by using full pixel integers. 7900 // For pixel-perfect positioning, top/bottom prefers rounded 7901 // values, while left/right prefers floored values. 7902 var offsets = { 7903 left: Math.floor(popper.left), 7904 top: Math.round(popper.top), 7905 bottom: Math.round(popper.bottom), 7906 right: Math.floor(popper.right) 7907 }; 7908 7909 var sideA = x === 'bottom' ? 'top' : 'bottom'; 7910 var sideB = y === 'right' ? 'left' : 'right'; 7911 7912 // if gpuAcceleration is set to `true` and transform is supported, 7913 // we use `translate3d` to apply the position to the popper we 7914 // automatically use the supported prefixed version if needed 7915 var prefixedProperty = getSupportedPropertyName('transform'); 7916 7917 // now, let's make a step back and look at this code closely (wtf?) 7918 // If the content of the popper grows once it's been positioned, it 7919 // may happen that the popper gets misplaced because of the new content 7920 // overflowing its reference element 7921 // To avoid this problem, we provide two options (x and y), which allow 7922 // the consumer to define the offset origin. 7923 // If we position a popper on top of a reference element, we can set 7924 // `x` to `top` to make the popper grow towards its top instead of 7925 // its bottom. 7926 var left = void 0, 7927 top = void 0; 7928 if (sideA === 'bottom') { 7929 top = -offsetParentRect.height + offsets.bottom; 7930 } else { 7931 top = offsets.top; 7932 } 7933 if (sideB === 'right') { 7934 left = -offsetParentRect.width + offsets.right; 7935 } else { 7936 left = offsets.left; 7937 } 7938 if (gpuAcceleration && prefixedProperty) { 7939 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 7940 styles[sideA] = 0; 7941 styles[sideB] = 0; 7942 styles.willChange = 'transform'; 7943 } else { 7944 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 7945 var invertTop = sideA === 'bottom' ? -1 : 1; 7946 var invertLeft = sideB === 'right' ? -1 : 1; 7947 styles[sideA] = top * invertTop; 7948 styles[sideB] = left * invertLeft; 7949 styles.willChange = sideA + ', ' + sideB; 7950 } 7951 7952 // Attributes 7953 var attributes = { 7954 'x-placement': data.placement 7955 }; 7956 7957 // Update `data` attributes, styles and arrowStyles 7958 data.attributes = _extends({}, attributes, data.attributes); 7959 data.styles = _extends({}, styles, data.styles); 7960 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 7961 7962 return data; 7963 } 7964 7965 /** 7966 * Helper used to know if the given modifier depends from another one.<br /> 7967 * It checks if the needed modifier is listed and enabled. 7968 * @method 7969 * @memberof Popper.Utils 7970 * @param {Array} modifiers - list of modifiers 7971 * @param {String} requestingName - name of requesting modifier 7972 * @param {String} requestedName - name of requested modifier 7973 * @returns {Boolean} 7974 */ 7975 function isModifierRequired(modifiers, requestingName, requestedName) { 7976 var requesting = find(modifiers, function (_ref) { 7977 var name = _ref.name; 7978 return name === requestingName; 7979 }); 7980 7981 var isRequired = !!requesting && modifiers.some(function (modifier) { 7982 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 7983 });
vendor: 5,284 bytes, lines 7984-8124
7984 7985 if (!isRequired) { 7986 var _requesting = '`' + requestingName + '`'; 7987 var requested = '`' + requestedName + '`'; 7988 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 7989 } 7990 return isRequired; 7991 } 7992 7993 /** 7994 * @function 7995 * @memberof Modifiers 7996 * @argument {Object} data - The data object generated by update method 7997 * @argument {Object} options - Modifiers configuration and options 7998 * @returns {Object} The data object, properly modified 7999 */ 8000 function arrow(data, options) { 8001 var _data$offsets$arrow; 8002 8003 // arrow depends on keepTogether in order to work 8004 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 8005 return data; 8006 } 8007 8008 var arrowElement = options.element; 8009 8010 // if arrowElement is a string, suppose it's a CSS selector 8011 if (typeof arrowElement === 'string') { 8012 arrowElement = data.instance.popper.querySelector(arrowElement); 8013 8014 // if arrowElement is not found, don't run the modifier 8015 if (!arrowElement) { 8016 return data; 8017 } 8018 } else { 8019 // if the arrowElement isn't a query selector we must check that the 8020 // provided DOM node is child of its popper node 8021 if (!data.instance.popper.contains(arrowElement)) { 8022 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 8023 return data; 8024 } 8025 } 8026 8027 var placement = data.placement.split('-')[0]; 8028 var _data$offsets = data.offsets, 8029 popper = _data$offsets.popper, 8030 reference = _data$offsets.reference; 8031 8032 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 8033 8034 var len = isVertical ? 'height' : 'width'; 8035 var sideCapitalized = isVertical ? 'Top' : 'Left'; 8036 var side = sideCapitalized.toLowerCase(); 8037 var altSide = isVertical ? 'left' : 'top'; 8038 var opSide = isVertical ? 'bottom' : 'right'; 8039 var arrowElementSize = getOuterSizes(arrowElement)[len]; 8040 8041 // 8042 // extends keepTogether behavior making sure the popper and its 8043 // reference have enough pixels in conjuction 8044 // 8045 8046 // top/left side 8047 if (reference[opSide] - arrowElementSize < popper[side]) { 8048 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 8049 } 8050 // bottom/right side 8051 if (reference[side] + arrowElementSize > popper[opSide]) { 8052 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 8053 } 8054 data.offsets.popper = getClientRect(data.offsets.popper); 8055 8056 // compute center of the popper 8057 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 8058 8059 // Compute the sideValue using the updated popper offsets 8060 // take popper margin in account because we don't have this info available 8061 var css = getStyleComputedProperty(data.instance.popper); 8062 var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10); 8063 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); 8064 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 8065 8066 // prevent arrowElement from being placed not contiguously to its popper 8067 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 8068 8069 data.arrowElement = arrowElement; 8070 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 8071 8072 return data; 8073 } 8074 8075 /** 8076 * Get the opposite placement variation of the given one 8077 * @method 8078 * @memberof Popper.Utils 8079 * @argument {String} placement variation 8080 * @returns {String} flipped placement variation 8081 */ 8082 function getOppositeVariation(variation) { 8083 if (variation === 'end') { 8084 return 'start'; 8085 } else if (variation === 'start') { 8086 return 'end'; 8087 } 8088 return variation; 8089 } 8090 8091 /** 8092 * List of accepted placements to use as values of the `placement` option.<br /> 8093 * Valid placements are: 8094 * - `auto` 8095 * - `top` 8096 * - `right` 8097 * - `bottom` 8098 * - `left` 8099 * 8100 * Each placement can have a variation from this list: 8101 * - `-start` 8102 * - `-end` 8103 * 8104 * Variations are interpreted easily if you think of them as the left to right 8105 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 8106 * is right.<br /> 8107 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 8108 * 8109 * Some valid examples are: 8110 * - `top-end` (on top of reference, right aligned) 8111 * - `right-start` (on right of reference, top aligned) 8112 * - `bottom` (on bottom, centered) 8113 * - `auto-right` (on the side with more space available, alignment depends by placement) 8114 * 8115 * @static 8116 * @type {Array} 8117 * @enum {String} 8118 * @readonly 8119 * @method placements 8120 * @memberof Popper 8121 */ 8122 var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; 8123 8124 // Get rid of `auto` `auto-start` and `auto-end`
vendor: 4,496 bytes, lines 8125-8230
8125 var validPlacements = placements.slice(3); 8126 8127 /** 8128 * Given an initial placement, returns all the subsequent placements 8129 * clockwise (or counter-clockwise). 8130 * 8131 * @method 8132 * @memberof Popper.Utils 8133 * @argument {String} placement - A valid placement (it accepts variations) 8134 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 8135 * @returns {Array} placements including their variations 8136 */ 8137 function clockwise(placement) { 8138 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 8139 8140 var index = validPlacements.indexOf(placement); 8141 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 8142 return counter ? arr.reverse() : arr; 8143 } 8144 8145 var BEHAVIORS = { 8146 FLIP: 'flip', 8147 CLOCKWISE: 'clockwise', 8148 COUNTERCLOCKWISE: 'counterclockwise' 8149 }; 8150 8151 /** 8152 * @function 8153 * @memberof Modifiers 8154 * @argument {Object} data - The data object generated by update method 8155 * @argument {Object} options - Modifiers configuration and options 8156 * @returns {Object} The data object, properly modified 8157 */ 8158 function flip(data, options) { 8159 // if `inner` modifier is enabled, we can't use the `flip` modifier 8160 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 8161 return data; 8162 } 8163 8164 if (data.flipped && data.placement === data.originalPlacement) { 8165 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 8166 return data; 8167 } 8168 8169 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 8170 8171 var placement = data.placement.split('-')[0]; 8172 var placementOpposite = getOppositePlacement(placement); 8173 var variation = data.placement.split('-')[1] || ''; 8174 8175 var flipOrder = []; 8176 8177 switch (options.behavior) { 8178 case BEHAVIORS.FLIP: 8179 flipOrder = [placement, placementOpposite]; 8180 break; 8181 case BEHAVIORS.CLOCKWISE: 8182 flipOrder = clockwise(placement); 8183 break; 8184 case BEHAVIORS.COUNTERCLOCKWISE: 8185 flipOrder = clockwise(placement, true); 8186 break; 8187 default: 8188 flipOrder = options.behavior; 8189 } 8190 8191 flipOrder.forEach(function (step, index) { 8192 if (placement !== step || flipOrder.length === index + 1) { 8193 return data; 8194 } 8195 8196 placement = data.placement.split('-')[0]; 8197 placementOpposite = getOppositePlacement(placement); 8198 8199 var popperOffsets = data.offsets.popper; 8200 var refOffsets = data.offsets.reference; 8201 8202 // using floor because the reference offsets may contain decimals we are not going to consider here 8203 var floor = Math.floor; 8204 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); 8205 8206 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 8207 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 8208 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 8209 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 8210 8211 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 8212 8213 // flip the variation if required 8214 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 8215 var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 8216 8217 if (overlapsRef || overflowsBoundaries || flippedVariation) { 8218 // this boolean to detect any flip loop 8219 data.flipped = true; 8220 8221 if (overlapsRef || overflowsBoundaries) { 8222 placement = flipOrder[index + 1]; 8223 } 8224 8225 if (flippedVariation) { 8226 variation = getOppositeVariation(variation); 8227 } 8228 8229 data.placement = placement + (variation ? '-' + variation : ''); 8230
vendor: 16,069 bytes, lines 8231-8666
8231 // this object contains `position`, we want to preserve it along with 8232 // any additional property we may add in the future 8233 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 8234 8235 data = runModifiers(data.instance.modifiers, data, 'flip'); 8236 } 8237 }); 8238 return data; 8239 } 8240 8241 /** 8242 * @function 8243 * @memberof Modifiers 8244 * @argument {Object} data - The data object generated by update method 8245 * @argument {Object} options - Modifiers configuration and options 8246 * @returns {Object} The data object, properly modified 8247 */ 8248 function keepTogether(data) { 8249 var _data$offsets = data.offsets, 8250 popper = _data$offsets.popper, 8251 reference = _data$offsets.reference; 8252 8253 var placement = data.placement.split('-')[0]; 8254 var floor = Math.floor; 8255 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 8256 var side = isVertical ? 'right' : 'bottom'; 8257 var opSide = isVertical ? 'left' : 'top'; 8258 var measurement = isVertical ? 'width' : 'height'; 8259 8260 if (popper[side] < floor(reference[opSide])) { 8261 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 8262 } 8263 if (popper[opSide] > floor(reference[side])) { 8264 data.offsets.popper[opSide] = floor(reference[side]); 8265 } 8266 8267 return data; 8268 } 8269 8270 /** 8271 * Converts a string containing value + unit into a px value number 8272 * @function 8273 * @memberof {modifiers~offset} 8274 * @private 8275 * @argument {String} str - Value + unit string 8276 * @argument {String} measurement - `height` or `width` 8277 * @argument {Object} popperOffsets 8278 * @argument {Object} referenceOffsets 8279 * @returns {Number|String} 8280 * Value in pixels, or original string if no values were extracted 8281 */ 8282 function toValue(str, measurement, popperOffsets, referenceOffsets) { 8283 // separate value from unit 8284 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 8285 var value = +split[1]; 8286 var unit = split[2]; 8287 8288 // If it's not a number it's an operator, I guess 8289 if (!value) { 8290 return str; 8291 } 8292 8293 if (unit.indexOf('%') === 0) { 8294 var element = void 0; 8295 switch (unit) { 8296 case '%p': 8297 element = popperOffsets; 8298 break; 8299 case '%': 8300 case '%r': 8301 default: 8302 element = referenceOffsets; 8303 } 8304 8305 var rect = getClientRect(element); 8306 return rect[measurement] / 100 * value; 8307 } else if (unit === 'vh' || unit === 'vw') { 8308 // if is a vh or vw, we calculate the size based on the viewport 8309 var size = void 0; 8310 if (unit === 'vh') { 8311 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 8312 } else { 8313 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 8314 } 8315 return size / 100 * value; 8316 } else { 8317 // if is an explicit pixel unit, we get rid of the unit and keep the value 8318 // if is an implicit unit, it's px, and we return just the value 8319 return value; 8320 } 8321 } 8322 8323 /** 8324 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 8325 * @function 8326 * @memberof {modifiers~offset} 8327 * @private 8328 * @argument {String} offset 8329 * @argument {Object} popperOffsets 8330 * @argument {Object} referenceOffsets 8331 * @argument {String} basePlacement 8332 * @returns {Array} a two cells array with x and y offsets in numbers 8333 */ 8334 function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 8335 var offsets = [0, 0]; 8336 8337 // Use height if placement is left or right and index is 0 otherwise use width 8338 // in this way the first offset will use an axis and the second one 8339 // will use the other one 8340 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 8341 8342 // Split the offset string to obtain a list of values and operands 8343 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 8344 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 8345 return frag.trim(); 8346 }); 8347 8348 // Detect if the offset string contains a pair of values or a single one 8349 // they could be separated by comma or space 8350 var divider = fragments.indexOf(find(fragments, function (frag) { 8351 return frag.search(/,|\s/) !== -1; 8352 })); 8353 8354 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 8355 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 8356 } 8357 8358 // If divider is found, we divide the list of values and operands to divide 8359 // them by ofset X and Y. 8360 var splitRegex = /\s*,\s*|\s+/; 8361 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 8362 8363 // Convert the values with units to absolute pixels to allow our computations 8364 ops = ops.map(function (op, index) { 8365 // Most of the units rely on the orientation of the popper 8366 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 8367 var mergeWithPrevious = false; 8368 return op 8369 // This aggregates any `+` or `-` sign that aren't considered operators 8370 // e.g.: 10 + +5 => [10, +, +5] 8371 .reduce(function (a, b) { 8372 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 8373 a[a.length - 1] = b; 8374 mergeWithPrevious = true; 8375 return a; 8376 } else if (mergeWithPrevious) { 8377 a[a.length - 1] += b; 8378 mergeWithPrevious = false; 8379 return a; 8380 } else { 8381 return a.concat(b); 8382 } 8383 }, []) 8384 // Here we convert the string values into number values (in px) 8385 .map(function (str) { 8386 return toValue(str, measurement, popperOffsets, referenceOffsets); 8387 }); 8388 }); 8389 8390 // Loop trough the offsets arrays and execute the operations 8391 ops.forEach(function (op, index) { 8392 op.forEach(function (frag, index2) { 8393 if (isNumeric(frag)) { 8394 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 8395 } 8396 }); 8397 }); 8398 return offsets; 8399 } 8400 8401 /** 8402 * @function 8403 * @memberof Modifiers 8404 * @argument {Object} data - The data object generated by update method 8405 * @argument {Object} options - Modifiers configuration and options 8406 * @argument {Number|String} options.offset=0 8407 * The offset value as described in the modifier description 8408 * @returns {Object} The data object, properly modified 8409 */ 8410 function offset(data, _ref) { 8411 var offset = _ref.offset; 8412 var placement = data.placement, 8413 _data$offsets = data.offsets, 8414 popper = _data$offsets.popper, 8415 reference = _data$offsets.reference; 8416 8417 var basePlacement = placement.split('-')[0]; 8418 8419 var offsets = void 0; 8420 if (isNumeric(+offset)) { 8421 offsets = [+offset, 0]; 8422 } else { 8423 offsets = parseOffset(offset, popper, reference, basePlacement); 8424 } 8425 8426 if (basePlacement === 'left') { 8427 popper.top += offsets[0]; 8428 popper.left -= offsets[1]; 8429 } else if (basePlacement === 'right') { 8430 popper.top += offsets[0]; 8431 popper.left += offsets[1]; 8432 } else if (basePlacement === 'top') { 8433 popper.left += offsets[0]; 8434 popper.top -= offsets[1]; 8435 } else if (basePlacement === 'bottom') { 8436 popper.left += offsets[0]; 8437 popper.top += offsets[1]; 8438 } 8439 8440 data.popper = popper; 8441 return data; 8442 } 8443 8444 /** 8445 * @function 8446 * @memberof Modifiers 8447 * @argument {Object} data - The data object generated by `update` method 8448 * @argument {Object} options - Modifiers configuration and options 8449 * @returns {Object} The data object, properly modified 8450 */ 8451 function preventOverflow(data, options) { 8452 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 8453 8454 // If offsetParent is the reference element, we really want to 8455 // go one step up and use the next offsetParent as reference to 8456 // avoid to make this modifier completely useless and look like broken 8457 if (data.instance.reference === boundariesElement) { 8458 boundariesElement = getOffsetParent(boundariesElement); 8459 } 8460 8461 // NOTE: DOM access here 8462 // resets the popper's position so that the document size can be calculated excluding 8463 // the size of the popper element itself 8464 var transformProp = getSupportedPropertyName('transform'); 8465 var popperStyles = data.instance.popper.style; // assignment to help minification 8466 var top = popperStyles.top, 8467 left = popperStyles.left, 8468 transform = popperStyles[transformProp]; 8469 8470 popperStyles.top = ''; 8471 popperStyles.left = ''; 8472 popperStyles[transformProp] = ''; 8473 8474 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 8475 8476 // NOTE: DOM access here 8477 // restores the original style properties after the offsets have been computed 8478 popperStyles.top = top; 8479 popperStyles.left = left; 8480 popperStyles[transformProp] = transform; 8481 8482 options.boundaries = boundaries; 8483 8484 var order = options.priority; 8485 var popper = data.offsets.popper; 8486 8487 var check = { 8488 primary: function primary(placement) { 8489 var value = popper[placement]; 8490 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 8491 value = Math.max(popper[placement], boundaries[placement]); 8492 } 8493 return defineProperty({}, placement, value); 8494 }, 8495 secondary: function secondary(placement) { 8496 var mainSide = placement === 'right' ? 'left' : 'top'; 8497 var value = popper[mainSide]; 8498 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 8499 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 8500 } 8501 return defineProperty({}, mainSide, value); 8502 } 8503 }; 8504 8505 order.forEach(function (placement) { 8506 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 8507 popper = _extends({}, popper, check[side](placement)); 8508 }); 8509 8510 data.offsets.popper = popper; 8511 8512 return data; 8513 } 8514 8515 /** 8516 * @function 8517 * @memberof Modifiers 8518 * @argument {Object} data - The data object generated by `update` method 8519 * @argument {Object} options - Modifiers configuration and options 8520 * @returns {Object} The data object, properly modified 8521 */ 8522 function shift(data) { 8523 var placement = data.placement; 8524 var basePlacement = placement.split('-')[0]; 8525 var shiftvariation = placement.split('-')[1]; 8526 8527 // if shift shiftvariation is specified, run the modifier 8528 if (shiftvariation) { 8529 var _data$offsets = data.offsets, 8530 reference = _data$offsets.reference, 8531 popper = _data$offsets.popper; 8532 8533 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 8534 var side = isVertical ? 'left' : 'top'; 8535 var measurement = isVertical ? 'width' : 'height'; 8536 8537 var shiftOffsets = { 8538 start: defineProperty({}, side, reference[side]), 8539 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 8540 }; 8541 8542 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 8543 } 8544 8545 return data; 8546 } 8547 8548 /** 8549 * @function 8550 * @memberof Modifiers 8551 * @argument {Object} data - The data object generated by update method 8552 * @argument {Object} options - Modifiers configuration and options 8553 * @returns {Object} The data object, properly modified 8554 */ 8555 function hide(data) { 8556 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 8557 return data; 8558 } 8559 8560 var refRect = data.offsets.reference; 8561 var bound = find(data.instance.modifiers, function (modifier) { 8562 return modifier.name === 'preventOverflow'; 8563 }).boundaries; 8564 8565 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 8566 // Avoid unnecessary DOM access if visibility hasn't changed 8567 if (data.hide === true) { 8568 return data; 8569 } 8570 8571 data.hide = true; 8572 data.attributes['x-out-of-boundaries'] = ''; 8573 } else { 8574 // Avoid unnecessary DOM access if visibility hasn't changed 8575 if (data.hide === false) { 8576 return data; 8577 } 8578 8579 data.hide = false; 8580 data.attributes['x-out-of-boundaries'] = false; 8581 } 8582 8583 return data; 8584 } 8585 8586 /** 8587 * @function 8588 * @memberof Modifiers 8589 * @argument {Object} data - The data object generated by `update` method 8590 * @argument {Object} options - Modifiers configuration and options 8591 * @returns {Object} The data object, properly modified 8592 */ 8593 function inner(data) { 8594 var placement = data.placement; 8595 var basePlacement = placement.split('-')[0]; 8596 var _data$offsets = data.offsets, 8597 popper = _data$offsets.popper, 8598 reference = _data$offsets.reference; 8599 8600 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 8601 8602 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 8603 8604 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 8605 8606 data.placement = getOppositePlacement(placement); 8607 data.offsets.popper = getClientRect(popper); 8608 8609 return data; 8610 } 8611 8612 /** 8613 * Modifier function, each modifier can have a function of this type assigned 8614 * to its `fn` property.<br /> 8615 * These functions will be called on each update, this means that you must 8616 * make sure they are performant enough to avoid performance bottlenecks. 8617 * 8618 * @function ModifierFn 8619 * @argument {dataObject} data - The data object generated by `update` method 8620 * @argument {Object} options - Modifiers configuration and options 8621 * @returns {dataObject} The data object, properly modified 8622 */ 8623 8624 /** 8625 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 8626 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 8627 * needed by the library. 8628 * 8629 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 8630 * All the other properties are configurations that could be tweaked. 8631 * @namespace modifiers 8632 */ 8633 var modifiers = { 8634 /** 8635 * Modifier used to shift the popper on the start or end of its reference 8636 * element.<br /> 8637 * It will read the variation of the `placement` property.<br /> 8638 * It can be one either `-end` or `-start`. 8639 * @memberof modifiers 8640 * @inner 8641 */ 8642 shift: { 8643 /** @prop {number} order=100 - Index used to define the order of execution */ 8644 order: 100, 8645 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8646 enabled: true, 8647 /** @prop {ModifierFn} */ 8648 fn: shift 8649 }, 8650 8651 /** 8652 * The `offset` modifier can shift your popper on both its axis. 8653 * 8654 * It accepts the following units: 8655 * - `px` or unitless, interpreted as pixels 8656 * - `%` or `%r`, percentage relative to the length of the reference element 8657 * - `%p`, percentage relative to the length of the popper element 8658 * - `vw`, CSS viewport width unit 8659 * - `vh`, CSS viewport height unit 8660 * 8661 * For length is intended the main axis relative to the placement of the popper.<br /> 8662 * This means that if the placement is `top` or `bottom`, the length will be the 8663 * `width`. In case of `left` or `right`, it will be the height. 8664 * 8665 * You can provide a single value (as `Number` or `String`), or a pair of values 8666 * as `String` divided by a comma or one (or more) white space
8666s.<br /> 8667 * The latter is a deprecated method because it leads to confusion and will be 8668 * removed in v2.<br /> 8669 * Additionally, it accepts additions and subtractions between different units. 8670 * Note that multiplications and divisions aren't supported. 8671 * 8672 * Valid examples are: 8673 * ``` 8674 * 10 8675 * '10%' 8676 * '10, 10' 8677 * '10%, 10' 8678 * '10 + 10%' 8679 * '10 - 5vh + 3%' 8680 * '-10px + 5vh, 5px - 6%' 8681 * ``` 8682 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 8683 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 8684 * > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373) 8685 * 8686 * @memberof modifiers 8687 * @inner 8688 */ 8689 offset: { 8690 /** @prop {number} order=200 - Index used to define the order of execution */ 8691 order: 200, 8692 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8693 enabled: true, 8694 /** @prop {ModifierFn} */ 8695 fn: offset, 8696 /** @prop {Number|String} offset=0 8697 * The offset value as described in the modifier description 8698 */ 8699 offset: 0 8700 }, 8701 8702 /** 8703 * Modifier used to prevent the popper from being positioned outside the boundary. 8704 * 8705 * An scenario exists where the reference itself is not within the boundaries.<br /> 8706 * We can say it has "escaped the boundaries" â or just "escaped".<br /> 8707 * In this case we need to decide whether the popper should either: 8708 * 8709 * - detach from the reference and remain "trapped" in the boundaries, or 8710 * - if it should ignore the boundary and "escape with its reference" 8711 * 8712 * When `escapeWithReference` is set to`true` and reference is completely 8713 * outside its boundaries, the popper will overflow (or completely leave) 8714 * the boundaries in order to remain attached to the edge of the reference. 8715 * 8716 * @memberof modifiers 8717 * @inner 8718 */ 8719 preventOverflow: { 8720 /** @prop {number} order=300 - Index used to define the order of execution */ 8721 order: 300, 8722 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8723 enabled: true, 8724 /** @prop {ModifierFn} */ 8725 fn: preventOverflow, 8726 /** 8727 * @prop {Array} [priority=['left','right','top','bottom']] 8728 * Popper will try to prevent overflow following these priorities by default, 8729 * then, it could overflow on the left and on top of the `boundariesElement` 8730 */ 8731 priority: ['left', 'right', 'top', 'bottom'], 8732 /** 8733 * @prop {number} padding=5 8734 * Amount of pixel used to define a minimum distance between the boundaries 8735 * and the popper this makes sure the popper has always a little padding 8736 * between the edges of its container 8737 */ 8738 padding: 5, 8739 /** 8740 * @prop {String|HTMLElement} boundariesElement='scrollParent' 8741 * Boundaries used by the modifier, can be `scrollParent`, `window`, 8742 * `viewport` or any DOM element. 8743 */ 8744 boundariesElement: 'scrollParent' 8745 }, 8746 8747 /** 8748 * Modifier used to make sure the reference and its popper stay near eachothers 8749 * without leaving any gap between the two. Expecially useful when the arrow is 8750 * enabled and you want to assure it to point to its reference element. 8751 * It cares only about the first axis, you can still have poppers with margin 8752 * between the popper and its reference element. 8753 * @memberof modifiers 8754 * @inner 8755 */ 8756 keepTogether: { 8757 /** @prop {number} order=400 - Index used to define the order of execution */ 8758 order: 400, 8759 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8760 enabled: true, 8761 /** @prop {ModifierFn} */ 8762 fn: keepTogether 8763 }, 8764 8765 /** 8766 * This modifier is used to move the `arrowElement` of the popper to make 8767 * sure it is positioned between the reference element and its popper element. 8768 * It will read the outer size of the `arrowElement` node to detect how many 8769 * pixels of conjuction are needed. 8770 * 8771 * It has no effect if no `arrowElement` is provided. 8772 * @memberof modifiers 8773 * @inner 8774 */ 8775 arrow: { 8776 /** @prop {number} order=500 - Index used to define the order of execution */ 8777 order: 500, 8778 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8779 enabled: true, 8780 /** @prop {ModifierFn} */ 8781 fn: arrow, 8782 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 8783 element: '[x-arrow]' 8784 }, 8785 8786 /** 8787 * Modifier used to flip the popper's placement when it starts to overlap its 8788 * reference element. 8789 * 8790 * Requires the `preventOverflow` modifier before it in order to work. 8791 * 8792 * **NOTE:** this modifier will interrupt the current update cycle and will 8793 * restart it if it detects the need to flip the placement. 8794 * @memberof modifiers 8795 * @inner 8796 */ 8797 flip: { 8798 /** @prop {number} order=600 - Index used to define the order of execution */ 8799 order: 600, 8800 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8801 enabled: true, 8802 /** @prop {ModifierFn} */ 8803 fn: flip, 8804 /** 8805 * @prop {String|Array} behavior='flip' 8806 * The behavior used to change the popper's placement. It can be one of 8807 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 8808 * placements (with optional variations). 8809 */ 8810 behavior: 'flip', 8811 /** 8812 * @prop {number} padding=5 8813 * The popper will flip if it hits the edges of the `boundariesElement` 8814 */ 8815 padding: 5, 8816 /** 8817 * @prop {String|HTMLElement} boundariesElement='viewport' 8818 * The element which will define the boundaries of the popper position, 8819 * the popper will never be placed outside of the defined boundaries 8820 * (except if keepTogether is enabled) 8821 */ 8822 boundariesElement: 'viewport' 8823 }, 8824 8825 /** 8826 * Modifier used to make the popper flow toward the inner of the reference element. 8827 * By default, when this modifier is disabled, the popper will be placed outside 8828 * the reference element. 8829 * @memberof modifiers 8830 * @inner 8831 */ 8832 inner: { 8833 /** @prop {number} order=700 - Index used to define the order of execution */ 8834 order: 700, 8835 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 8836 enabled: false, 8837 /** @prop {ModifierFn} */ 8838 fn: inner 8839 }, 8840 8841 /** 8842 * Modifier used to hide the popper when its reference element is outside of the 8843 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 8844 * be used to hide with a CSS selector the popper when its reference is 8845 * out of boundaries. 8846 * 8847 * Requires the `preventOverflow` modifier before it in order to work. 8848 * @memberof modifiers 8849 * @inner 8850 */ 8851 hide: { 8852 /** @prop {number} order=800 - Index used to define the order of execution */ 8853 order: 800, 8854 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8855 enabled: true, 8856 /** @prop {ModifierFn} */ 8857 fn: hide 8858 }, 8859 8860 /** 8861 * Computes the style that will be applied to the popper element to gets 8862 * properly positioned. 8863 * 8864 * Note that this modifier will not touch the DOM, it just prepares the styles 8865 * so that `applyStyle` modifier can apply it. This separation is useful 8866 * in case you need to replace `applyStyle` with a custom implementation. 8867 * 8868 * This modifier has `850` as `order` value to maintain backward compatibility 8869 * with previous versions of Popper.js. Expect the modifiers ordering method 8870 * to change in future major versions of the library. 8871 * 8872 * @memberof modifiers 8873 * @inner 8874 */ 8875 computeStyle: { 8876 /** @prop {number} order=850 - Index used to define the order of execution */ 8877 order: 850, 8878 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8879 enabled: true, 8880 /** @prop {ModifierFn} */ 8881 fn: computeStyle, 8882 /** 8883 * @prop {Boolean} gpuAcceleration=true 8884 * If true, it uses the CSS 3d transformation to position the popper. 8885 * Otherwise, it will use the `top` and `left` properties. 8886 */ 8887 gpuAcceleration: true, 8888 /** 8889 * @prop {string} [x='bottom'] 8890 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 8891 * Change this if your popper should grow in a direction different from `bottom` 8892 */ 8893 x: 'bottom', 8894 /** 8895 * @prop {string} [x='left'] 8896 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 8897 * Change this if your popper should grow in a direction different from `right` 8898 */ 8899 y: 'right' 8900 }, 8901 8902 /** 8903 * Applies the computed styles to the popper element. 8904 * 8905 * All the DOM manipulations are limited to this modifier. This is useful in case 8906 * you want to integrate Popper.js inside a framework or view library and you 8907 * want to delegate all the DOM manipulations to it. 8908 * 8909 * Note that if you disable this modifier, you must make sure the popper element 8910 * has its position set to `absolute` before Popper.js can do its work! 8911 * 8912 * Just disable this modifier and define you own to achieve the desired effect. 8913 * 8914 * @memberof modifiers 8915 * @inner 8916 */ 8917 applyStyle: { 8918 /** @prop {number} order=900 - Index used to define the order of execution */ 8919 order: 900, 8920 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 8921 enabled: true, 8922 /** @prop {ModifierFn} */
vendor: 5,186 bytes, lines 8923-9061
8923 fn: applyStyle, 8924 /** @prop {Function} */ 8925 onLoad: applyStyleOnLoad, 8926 /** 8927 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 8928 * @prop {Boolean} gpuAcceleration=true 8929 * If true, it uses the CSS 3d transformation to position the popper. 8930 * Otherwise, it will use the `top` and `left` properties. 8931 */ 8932 gpuAcceleration: undefined 8933 } 8934 }; 8935 8936 /** 8937 * The `dataObject` is an object containing all the informations used by Popper.js 8938 * this object get passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 8939 * @name dataObject 8940 * @property {Object} data.instance The Popper.js instance 8941 * @property {String} data.placement Placement applied to popper 8942 * @property {String} data.originalPlacement Placement originally defined on init 8943 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 8944 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper. 8945 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 8946 * @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`) 8947 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`) 8948 * @property {Object} data.boundaries Offsets of the popper boundaries 8949 * @property {Object} data.offsets The measurements of popper, reference and arrow elements. 8950 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 8951 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 8952 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 8953 */ 8954 8955 /** 8956 * Default options provided to Popper.js constructor.<br /> 8957 * These can be overriden using the `options` argument of Popper.js.<br /> 8958 * To override an option, simply pass as 3rd argument an object with the same 8959 * structure of this object, example: 8960 * ``` 8961 * new Popper(ref, pop, { 8962 * modifiers: { 8963 * preventOverflow: { enabled: false } 8964 * } 8965 * }) 8966 * ``` 8967 * @type {Object} 8968 * @static 8969 * @memberof Popper 8970 */ 8971 var Defaults = { 8972 /** 8973 * Popper's placement 8974 * @prop {Popper.placements} placement='bottom' 8975 */ 8976 placement: 'bottom', 8977 8978 /** 8979 * Set this to true if you want popper to position it self in 'fixed' mode 8980 * @prop {Boolean} positionFixed=false 8981 */ 8982 positionFixed: false, 8983 8984 /** 8985 * Whether events (resize, scroll) are initially enabled 8986 * @prop {Boolean} eventsEnabled=true 8987 */ 8988 eventsEnabled: true, 8989 8990 /** 8991 * Set to true if you want to automatically remove the popper when 8992 * you call the `destroy` method. 8993 * @prop {Boolean} removeOnDestroy=false 8994 */ 8995 removeOnDestroy: false, 8996 8997 /** 8998 * Callback called when the popper is created.<br /> 8999 * By default, is set to no-op.<br /> 9000 * Access Popper.js instance with `data.instance`. 9001 * @prop {onCreate} 9002 */ 9003 onCreate: function onCreate() {}, 9004 9005 /** 9006 * Callback called when the popper is updated, this callback is not called 9007 * on the initialization/creation of the popper, but only on subsequent 9008 * updates.<br /> 9009 * By default, is set to no-op.<br /> 9010 * Access Popper.js instance with `data.instance`. 9011 * @prop {onUpdate} 9012 */ 9013 onUpdate: function onUpdate() {}, 9014 9015 /** 9016 * List of modifiers used to modify the offsets before they are applied to the popper. 9017 * They provide most of the functionalities of Popper.js 9018 * @prop {modifiers} 9019 */ 9020 modifiers: modifiers 9021 }; 9022 9023 /** 9024 * @callback onCreate 9025 * @param {dataObject} data 9026 */ 9027 9028 /** 9029 * @callback onUpdate 9030 * @param {dataObject} data 9031 */ 9032 9033 // Utils 9034 // Methods 9035 var Popper = function () { 9036 /** 9037 * Create a new Popper.js instance 9038 * @class Popper 9039 * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper 9040 * @param {HTMLElement} popper - The HTML element used as popper. 9041 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 9042 * @return {Object} instance - The generated Popper.js instance 9043 */ 9044 function Popper(reference, popper) { 9045 var _this = this; 9046 9047 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 9048 classCallCheck(this, Popper); 9049 9050 this.scheduleUpdate = function () { 9051 return requestAnimationFrame(_this.update); 9052 }; 9053 9054 // make update() debounced, so that it only runs at most once-per-tick 9055 this.update = debounce(this.update.bind(this)); 9056 9057 // with {} we create a new object with the options inside it 9058 this.options = _extends({}, Popper.Defaults, options); 9059 9060 // init state 9061 this.state = {
vendor: 5,994 bytes, lines 9062-9219
9062 isDestroyed: false, 9063 isCreated: false, 9064 scrollParents: [] 9065 }; 9066 9067 // get reference and popper elements (allow jQuery wrappers) 9068 this.reference = reference && reference.jquery ? reference[0] : reference; 9069 this.popper = popper && popper.jquery ? popper[0] : popper; 9070 9071 // Deep merge modifiers options 9072 this.options.modifiers = {}; 9073 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 9074 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 9075 }); 9076 9077 // Refactoring modifiers' list (Object => Array) 9078 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 9079 return _extends({ 9080 name: name 9081 }, _this.options.modifiers[name]); 9082 }) 9083 // sort the modifiers by order 9084 .sort(function (a, b) { 9085 return a.order - b.order; 9086 }); 9087 9088 // modifiers have the ability to execute arbitrary code when Popper.js get inited 9089 // such code is executed in the same order of its modifier 9090 // they could add new properties to their options configuration 9091 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 9092 this.modifiers.forEach(function (modifierOptions) { 9093 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 9094 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 9095 } 9096 }); 9097 9098 // fire the first update to position the popper in the right place 9099 this.update(); 9100 9101 var eventsEnabled = this.options.eventsEnabled; 9102 if (eventsEnabled) { 9103 // setup event listeners, they will take care of update the position in specific situations 9104 this.enableEventListeners(); 9105 } 9106 9107 this.state.eventsEnabled = eventsEnabled; 9108 } 9109 9110 // We can't use class properties because they don't get listed in the 9111 // class prototype and break stuff like Sinon stubs 9112 9113 9114 createClass(Popper, [{ 9115 key: 'update', 9116 value: function update$$1() { 9117 return update.call(this); 9118 } 9119 }, { 9120 key: 'destroy', 9121 value: function destroy$$1() { 9122 return destroy.call(this); 9123 } 9124 }, { 9125 key: 'enableEventListeners', 9126 value: function enableEventListeners$$1() { 9127 return enableEventListeners.call(this); 9128 } 9129 }, { 9130 key: 'disableEventListeners', 9131 value: function disableEventListeners$$1() { 9132 return disableEventListeners.call(this); 9133 } 9134 9135 /** 9136 * Schedule an update, it will run on the next UI update available 9137 * @method scheduleUpdate 9138 * @memberof Popper 9139 */ 9140 9141 9142 /** 9143 * Collection of utilities useful when writing custom modifiers. 9144 * Starting from version 1.7, this method is available only if you 9145 * include `popper-utils.js` before `popper.js`. 9146 * 9147 * **DEPRECATION**: This way to access PopperUtils is deprecated 9148 * and will be removed in v2! Use the PopperUtils module directly instead. 9149 * Due to the high instability of the methods contained in Utils, we can't 9150 * guarantee them to follow semver. Use them at your own risk! 9151 * @static 9152 * @private 9153 * @type {Object} 9154 * @deprecated since version 1.8 9155 * @member Utils 9156 * @memberof Popper 9157 */ 9158 9159 }]); 9160 return Popper; 9161 }(); 9162 9163 /** 9164 * The `referenceObject` is an object that provides an interface compatible with Popper.js 9165 * and lets you use it as replacement of a real DOM node.<br /> 9166 * You can use this method to position a popper relatively to a set of coordinates 9167 * in case you don't have a DOM node to use as reference. 9168 * 9169 * ``` 9170 * new Popper(referenceObject, popperNode); 9171 * ``` 9172 * 9173 * NB: This feature isn't supported in Internet Explorer 10 9174 * @name referenceObject 9175 * @property {Function} data.getBoundingClientRect 9176 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 9177 * @property {number} data.clientWidth 9178 * An ES6 getter that will return the width of the virtual reference element. 9179 * @property {number} data.clientHeight 9180 * An ES6 getter that will return the height of the virtual reference element. 9181 */ 9182 9183 9184 Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 9185 Popper.placements = placements; 9186 Popper.Defaults = Defaults; 9187 9188 /** 9189 * -------------------------------------------------------------------------- 9190 * Bootstrap (v4.1.3): dropdown.js 9191 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 9192 * -------------------------------------------------------------------------- 9193 */ 9194 9195 var Dropdown = function ($$$1) { 9196 /** 9197 * ------------------------------------------------------------------------ 9198 * Constants 9199 * ------------------------------------------------------------------------ 9200 */ 9201 var NAME = 'dropdown'; 9202 var VERSION = '4.1.3'; 9203 var DATA_KEY = 'bs.dropdown'; 9204 var EVENT_KEY = "." + DATA_KEY; 9205 var DATA_API_KEY = '.data-api'; 9206 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 9207 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 9208 9209 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 9210 9211 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 9212 9213 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 9214 9215 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 9216 9217 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 9218 9219 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
9220 var Event = { 9221 HIDE: "hide" + EVENT_KEY, 9222 HIDDEN: "hidden" + EVENT_KEY, 9223 SHOW: "show" + EVENT_KEY, 9224 SHOWN: "shown" + EVENT_KEY, 9225 CLICK: "click" + EVENT_KEY, 9226 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY, 9227 KEYDOWN_DATA_API: "keydown" + EVENT_KEY + DATA_API_KEY, 9228 KEYUP_DATA_API: "keyup" + EVENT_KEY + DATA_API_KEY 9229 }; 9230 var ClassName = { 9231 DISABLED: 'disabled', 9232 SHOW: 'show', 9233 DROPUP: 'dropup', 9234 DROPRIGHT: 'dropright', 9235 DROPLEFT: 'dropleft', 9236 MENURIGHT: 'dropdown-menu-right', 9237 MENULEFT: 'dropdown-menu-left', 9238 POSITION_STATIC: 'position-static' 9239 }; 9240 var Selector = { 9241 DATA_TOGGLE: '[data-toggle="dropdown"]', 9242 FORM_CHILD: '.dropdown form', 9243 MENU: '.dropdown-menu', 9244 NAVBAR_NAV: '.navbar-nav', 9245 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' 9246 }; 9247 var AttachmentMap = { 9248 TOP: 'top-start', 9249 TOPEND: 'top-end', 9250 BOTTOM: 'bottom-start', 9251 BOTTOMEND: 'bottom-end', 9252 RIGHT: 'right-start', 9253 RIGHTEND: 'right-end', 9254 LEFT: 'left-start', 9255 LEFTEND: 'left-end' 9256 }; 9257 var Default = { 9258 offset: 0, 9259 flip: true, 9260 boundary: 'scrollParent', 9261 reference: 'toggle', 9262 display: 'dynamic' 9263 }; 9264 var DefaultType = { 9265 offset: '(number|string|function)', 9266 flip: 'boolean', 9267 boundary: '(string|element)', 9268 reference: '(string|element)', 9269 display: 'string' 9270 /** 9271 * ------------------------------------------------------------------------ 9272 * Class Definition 9273 * ------------------------------------------------------------------------ 9274 */ 9275 9276 }; 9277 9278 var Dropdown = 9279 /*#__PURE__*/ 9280 function () { 9281 function Dropdown(element, config) { 9282 this._element = element; 9283 this._popper = null; 9284 this._config = this._getConfig(config); 9285 this._menu = this._getMenuElement(); 9286 this._inNavbar = this._detectNavbar(); 9287 9288 this._addEventListeners(); 9289 } // Getters 9290 9291 9292 var _proto = Dropdown.prototype; 9293 9294 // Public 9295 _proto.toggle = function toggle() { 9296 if (this._element.disabled || $$$1(this._element).hasClass(ClassName.DISABLED)) { 9297 return; 9298 } 9299 9300 var parent = Dropdown._getParentFromElement(this._element); 9301 9302 var isActive = $$$1(this._menu).hasClass(ClassName.SHOW); 9303 9304 Dropdown._clearMenus(); 9305 9306 if (isActive) { 9307 return; 9308 } 9309 9310 var relatedTarget = { 9311 relatedTarget: this._element 9312 }; 9313 var showEvent = $$$1.Event(Event.SHOW, relatedTarget); 9314 $$$1(parent).trigger(showEvent); 9315 9316 if (showEvent.isDefaultPrevented()) { 9317 return; 9318 } // Disable totally Popper.js for Dropdown in Navbar 9319 9320 9321 if (!this._inNavbar) { 9322 /** 9323 * Check for Popper dependency 9324 * Popper - https://popper.js.org 9325 */ 9326 if (typeof Popper === 'undefined') { 9327 throw new TypeError('Bootstrap dropdown require Popper.js (https://popper.js.org)'); 9328 } 9329 9330 var referenceElement = this._element; 9331 9332 if (this._config.reference === 'parent') { 9333 referenceElement = parent; 9334 } else if (Util.isElement(this._config.reference)) { 9335 referenceElement = this._config.reference; // Check if it's jQuery element 9336 9337 if (typeof this._config.reference.jquery !== 'undefined') { 9338 referenceElement = this._config.reference[0]; 9339 } 9340 } // If boundary is not `scrollParent`, then set position to `static` 9341 // to allow the menu to "escape" the scroll parent's boundaries 9342 // https://github.com/twbs/bootstrap/issues/24251 9343 9344 9345 if (this._config.boundary !== 'scrollParent') { 9346 $$$1(parent).addClass(ClassName.POSITION_STATIC); 9347 } 9348 9349 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 9350 } // If this is a touch-enabled device we add extra 9351 // empty mouseover listeners to the body's immediate children; 9352 // only needed because of broken event delegation on iOS 9353 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 9354 9355 9356 if ('ontouchstart' in document.documentElement && $$$1(parent).closest(Selector.NAVBAR_NAV).length === 0) { 9357 $$$1(document.body).children().on('mouseover', null, $$$1.noop); 9358 } 9359 9360 this._element.focus(); 9361 9362 this._element.setAttribute('aria-expanded', true); 9363 9364 $$$1(this._menu).toggleClass(ClassName.SHOW); 9365 $$$1(parent).toggleClass(ClassName.SHOW).trigger($$$1.Event(Event.SHOWN, relatedTarget)); 9366 }; 9367 9368 _proto.dispose = function dispose() { 9369 $$$1.removeData(this._element, DATA_KEY); 9370 $$$1(this._element).off(EVENT_KEY); 9371 this._element = null; 9372 this._menu = null; 9373 9374 if (this._popper !== null) { 9375 this._popper.destroy(); 9376 9377 this._popper = null; 9378 } 9379 }; 9380
9381 _proto.update = function update() { 9382 this._inNavbar = this._detectNavbar(); 9383 9384 if (this._popper !== null) { 9385 this._popper.scheduleUpdate(); 9386 } 9387 }; // Private 9388 9389 9390 _proto._addEventListeners = function _addEventListeners() { 9391 var _this = this; 9392 9393 $$$1(this._element).on(Event.CLICK, function (event) { 9394 event.preventDefault(); 9395 event.stopPropagation(); 9396 9397 _this.toggle(); 9398 }); 9399 }; 9400 9401 _proto._getConfig = function _getConfig(config) { 9402 config = _objectSpread({}, this.constructor.Default, $$$1(this._element).data(), config); 9403 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 9404 return config; 9405 }; 9406 9407 _proto._getMenuElement = function _getMenuElement() { 9408 if (!this._menu) { 9409 var parent = Dropdown._getParentFromElement(this._element); 9410 9411 if (parent) { 9412 this._menu = parent.querySelector(Selector.MENU); 9413 } 9414 } 9415 9416 return this._menu; 9417 }; 9418 9419 _proto._getPlacement = function _getPlacement() { 9420 var $parentDropdown = $$$1(this._element.parentNode); 9421 var placement = AttachmentMap.BOTTOM; // Handle dropup 9422 9423 if ($parentDropdown.hasClass(ClassName.DROPUP)) { 9424 placement = AttachmentMap.TOP; 9425 9426 if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) { 9427 placement = AttachmentMap.TOPEND; 9428 } 9429 } else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) { 9430 placement = AttachmentMap.RIGHT; 9431 } else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) { 9432 placement = AttachmentMap.LEFT; 9433 } else if ($$$1(this._menu).hasClass(ClassName.MENURIGHT)) { 9434 placement = AttachmentMap.BOTTOMEND; 9435 } 9436 9437 return placement; 9438 }; 9439 9440 _proto._detectNavbar = function _detectNavbar() { 9441 return $$$1(this._element).closest('.navbar').length > 0; 9442 }; 9443 9444 _proto._getPopperConfig = function _getPopperConfig() { 9445 var _this2 = this; 9446 9447 var offsetConf = {}; 9448 9449 if (typeof this._config.offset === 'function') { 9450 offsetConf.fn = function (data) { 9451 data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets) || {}); 9452 return data; 9453 }; 9454 } else { 9455 offsetConf.offset = this._config.offset; 9456 } 9457 9458 var popperConfig = { 9459 placement: this._getPlacement(), 9460 modifiers: { 9461 offset: offsetConf, 9462 flip: { 9463 enabled: this._config.flip 9464 }, 9465 preventOverflow: { 9466 boundariesElement: this._config.boundary 9467 } 9468 } // Disable Popper.js if we have a static display 9469 9470 }; 9471 9472 if (this._config.display === 'static') { 9473 popperConfig.modifiers.applyStyle = { 9474 enabled: false 9475 }; 9476 } 9477 9478 return popperConfig; 9479 }; // Static 9480 9481 9482 Dropdown._jQueryInterface = function _jQueryInterface(config) { 9483 return this.each(function () { 9484 var data = $$$1(this).data(DATA_KEY); 9485 9486 var _config = typeof config === 'object' ? config : null; 9487 9488 if (!data) { 9489 data = new Dropdown(this, _config); 9490 $$$1(this).data(DATA_KEY, data); 9491 } 9492 9493 if (typeof config === 'string') { 9494 if (typeof data[config] === 'undefined') { 9495 throw new TypeError("No method named \"" + config + "\""); 9496 } 9497 9498 data[config](); 9499 } 9500 }); 9501 }; 9502 9503 Dropdown._clearMenus = function _clearMenus(event) { 9504 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 9505 return; 9506 } 9507 9508 var toggles = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE)); 9509 9510 for (var i = 0, len = toggles.length; i < len; i++) { 9511 var parent = Dropdown._getParentFromElement(toggles[i]); 9512 9513 var context = $$$1(toggles[i]).data(DATA_KEY); 9514 var relatedTarget = { 9515 relatedTarget: toggles[i] 9516 }; 9517 9518 if (event && event.type === 'click') { 9519 relatedTarget.clickEvent = event; 9520 } 9521 9522 if (!context) { 9523 continue; 9524 } 9525 9526 var dropdownMenu = context._menu; 9527 9528 if (!$$$1(parent).hasClass(ClassName.SHOW)) { 9529 continue; 9530 } 9531 9532 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $$$1.contains(parent, event.target)) { 9533 continue; 9534 } 9535 9536 var hideEvent = $$$1.Event(Event.HIDE, relatedTarget); 9537 $$$1(parent).trigger(hideEvent); 9538 9539 if (hideEvent.isDefaultPrevented()) { 9540 continue; 9541 } // If this is a touch-enabled device we remove the extra 9542 // empty mouseover listeners we added for iOS support 9543 9544 9545 if ('ontouchstart' in document.documentElement) { 9546 $$$1(document.body).children().off('mouseover', null, $$$1.noop); 9547 } 9548 9549 toggles[i].setAttribute('aria-expanded', 'false'); 9550 $$$1(dropdownMenu).removeClass(ClassName.SHOW); 9551 $$$1(parent).removeClass(ClassName.SHOW).trigger($$$1.Event(Event.HIDDEN, relatedTarget)); 9552 } 9553 }; 9554 9555 Dropdown._getParentFromElement = function _getParentFromElement(element) { 9556 var parent; 9557 var selector = Util.getSelectorFromElement(element); 9558 9559 if (selector) { 9560 parent = document.querySelector(selector); 9561 } 9562 9563 return parent || element.parentNode; 9564 }; // eslint-disable-next-line complexity 9565 9566 9567 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 9568 // If not input/textarea: 9569 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 9570 // If input/textarea: 9571 // - If space key => not a dropdown command 9572 // - If key is other than escape 9573 // - If key is not up or down => not a dropdown command 9574 // - If trigger inside the menu =>
vendor: 4,879 bytes, lines 9574-9722
9574 not a dropdown command 9575 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $$$1(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 9576 return; 9577 } 9578 9579 event.preventDefault(); 9580 event.stopPropagation(); 9581 9582 if (this.disabled || $$$1(this).hasClass(ClassName.DISABLED)) { 9583 return; 9584 } 9585 9586 var parent = Dropdown._getParentFromElement(this); 9587 9588 var isActive = $$$1(parent).hasClass(ClassName.SHOW); 9589 9590 if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 9591 if (event.which === ESCAPE_KEYCODE) { 9592 var toggle = parent.querySelector(Selector.DATA_TOGGLE); 9593 $$$1(toggle).trigger('focus'); 9594 } 9595 9596 $$$1(this).trigger('click'); 9597 return; 9598 } 9599 9600 var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS)); 9601 9602 if (items.length === 0) { 9603 return; 9604 } 9605 9606 var index = items.indexOf(event.target); 9607 9608 if (event.which === ARROW_UP_KEYCODE && index > 0) { 9609 // Up 9610 index--; 9611 } 9612 9613 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 9614 // Down 9615 index++; 9616 } 9617 9618 if (index < 0) { 9619 index = 0; 9620 } 9621 9622 items[index].focus(); 9623 }; 9624 9625 _createClass(Dropdown, null, [{ 9626 key: "VERSION", 9627 get: function get() { 9628 return VERSION; 9629 } 9630 }, { 9631 key: "Default", 9632 get: function get() { 9633 return Default; 9634 } 9635 }, { 9636 key: "DefaultType", 9637 get: function get() { 9638 return DefaultType; 9639 } 9640 }]); 9641 9642 return Dropdown; 9643 }(); 9644 /** 9645 * ------------------------------------------------------------------------ 9646 * Data Api implementation 9647 * ------------------------------------------------------------------------ 9648 */ 9649 9650 9651 $$$1(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + " " + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 9652 event.preventDefault(); 9653 event.stopPropagation(); 9654 9655 Dropdown._jQueryInterface.call($$$1(this), 'toggle'); 9656 }).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) { 9657 e.stopPropagation(); 9658 }); 9659 /** 9660 * ------------------------------------------------------------------------ 9661 * jQuery 9662 * ------------------------------------------------------------------------ 9663 */ 9664 9665 $$$1.fn[NAME] = Dropdown._jQueryInterface; 9666 $$$1.fn[NAME].Constructor = Dropdown; 9667 9668 $$$1.fn[NAME].noConflict = function () { 9669 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 9670 return Dropdown._jQueryInterface; 9671 }; 9672 9673 return Dropdown; 9674 }($, Popper); 9675 9676 /** 9677 * -------------------------------------------------------------------------- 9678 * Bootstrap (v4.1.3): modal.js 9679 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 9680 * -------------------------------------------------------------------------- 9681 */ 9682 9683 var Modal = function ($$$1) { 9684 /** 9685 * ------------------------------------------------------------------------ 9686 * Constants 9687 * ------------------------------------------------------------------------ 9688 */ 9689 var NAME = 'modal'; 9690 var VERSION = '4.1.3'; 9691 var DATA_KEY = 'bs.modal'; 9692 var EVENT_KEY = "." + DATA_KEY; 9693 var DATA_API_KEY = '.data-api'; 9694 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 9695 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 9696 9697 var Default = { 9698 backdrop: true, 9699 keyboard: true, 9700 focus: true, 9701 show: true 9702 }; 9703 var DefaultType = { 9704 backdrop: '(boolean|string)', 9705 keyboard: 'boolean', 9706 focus: 'boolean', 9707 show: 'boolean' 9708 }; 9709 var Event = { 9710 HIDE: "hide" + EVENT_KEY, 9711 HIDDEN: "hidden" + EVENT_KEY, 9712 SHOW: "show" + EVENT_KEY, 9713 SHOWN: "shown" + EVENT_KEY, 9714 FOCUSIN: "focusin" + EVENT_KEY, 9715 RESIZE: "resize" + EVENT_KEY, 9716 CLICK_DISMISS: "click.dismiss" + EVENT_KEY, 9717 KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY, 9718 MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY, 9719 MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY, 9720 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 9721 }; 9722 var ClassName = {
9723 SCROLLBAR_MEASURER: 'modal-scrollbar-measure', 9724 BACKDROP: 'modal-backdrop', 9725 OPEN: 'modal-open', 9726 FADE: 'fade', 9727 SHOW: 'show' 9728 }; 9729 var Selector = { 9730 DIALOG: '.modal-dialog', 9731 DATA_TOGGLE: '[data-toggle="modal"]', 9732 DATA_DISMISS: '[data-dismiss="modal"]', 9733 FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 9734 STICKY_CONTENT: '.sticky-top' 9735 /** 9736 * ------------------------------------------------------------------------ 9737 * Class Definition 9738 * ------------------------------------------------------------------------ 9739 */ 9740 9741 }; 9742 9743 var Modal = 9744 /*#__PURE__*/ 9745 function () { 9746 function Modal(element, config) { 9747 this._config = this._getConfig(config); 9748 this._element = element; 9749 this._dialog = element.querySelector(Selector.DIALOG); 9750 this._backdrop = null; 9751 this._isShown = false; 9752 this._isBodyOverflowing = false; 9753 this._ignoreBackdropClick = false; 9754 this._scrollbarWidth = 0; 9755 } // Getters 9756 9757 9758 var _proto = Modal.prototype; 9759 9760 // Public 9761 _proto.toggle = function toggle(relatedTarget) { 9762 return this._isShown ? this.hide() : this.show(relatedTarget); 9763 }; 9764 9765 _proto.show = function show(relatedTarget) { 9766 var _this = this; 9767 9768 if (this._isTransitioning || this._isShown) { 9769 return; 9770 } 9771 9772 if ($$$1(this._element).hasClass(ClassName.FADE)) { 9773 this._isTransitioning = true; 9774 } 9775 9776 var showEvent = $$$1.Event(Event.SHOW, { 9777 relatedTarget: relatedTarget 9778 }); 9779 $$$1(this._element).trigger(showEvent); 9780 9781 if (this._isShown || showEvent.isDefaultPrevented()) { 9782 return; 9783 } 9784 9785 this._isShown = true; 9786 9787 this._checkScrollbar(); 9788 9789 this._setScrollbar(); 9790 9791 this._adjustDialog(); 9792 9793 $$$1(document.body).addClass(ClassName.OPEN); 9794 9795 this._setEscapeEvent(); 9796 9797 this._setResizeEvent(); 9798 9799 $$$1(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) { 9800 return _this.hide(event); 9801 }); 9802 $$$1(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { 9803 $$$1(_this._element).one(Event.MOUSEUP_DISMISS, function (event) { 9804 if ($$$1(event.target).is(_this._element)) { 9805 _this._ignoreBackdropClick = true; 9806 } 9807 }); 9808 }); 9809 9810 this._showBackdrop(function () { 9811 return _this._showElement(relatedTarget); 9812 }); 9813 }; 9814 9815 _proto.hide = function hide(event) { 9816 var _this2 = this; 9817 9818 if (event) { 9819 event.preventDefault(); 9820 } 9821 9822 if (this._isTransitioning || !this._isShown) { 9823 return; 9824 } 9825 9826 var hideEvent = $$$1.Event(Event.HIDE); 9827 $$$1(this._element).trigger(hideEvent); 9828 9829 if (!this._isShown || hideEvent.isDefaultPrevented()) { 9830 return; 9831 } 9832 9833 this._isShown = false; 9834 var transition = $$$1(this._element).hasClass(ClassName.FADE); 9835 9836 if (transition) { 9837 this._isTransitioning = true; 9838 } 9839 9840 this._setEscapeEvent(); 9841 9842 this._setResizeEvent(); 9843 9844 $$$1(document).off(Event.FOCUSIN); 9845 $$$1(this._element).removeClass(ClassName.SHOW); 9846 $$$1(this._element).off(Event.CLICK_DISMISS); 9847 $$$1(this._dialog).off(Event.MOUSEDOWN_DISMISS); 9848 9849 if (transition) { 9850 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 9851 $$$1(this._element).one(Util.TRANSITION_END, function (event) { 9852 return _this2._hideModal(event); 9853 }).emulateTransitionEnd(transitionDuration); 9854 } else { 9855 this._hideModal(); 9856 } 9857 }; 9858 9859 _proto.dispose = function dispose() { 9860 $$$1.removeData(this._element, DATA_KEY); 9861 $$$1(window, document, this._element, this._backdrop).off(EVENT_KEY); 9862 this._config = null; 9863 this._element = null; 9864 this._dialog = null; 9865 this._backdrop = null; 9866 this._isShown = null; 9867 this._isBodyOverflowing = null; 9868 this._ignoreBackdropClick = null; 9869 this._scrollbarWidth = null; 9870 }; 9871 9872 _proto.handleUpdate = function handleUpdate() { 9873 this._adjustDialog(); 9874 }; // Private 9875 9876 9877 _proto._getConfig = function _getConfig(config) { 9878 config = _objectSpread({}, Default, config); 9879 Util.typeCheckConfig(NAME, config, DefaultType); 9880 return config; 9881 }; 9882 9883 _proto._showElement = function _showElement(relatedTarget) { 9884 var _this3 = this; 9885 9886 var transition = $$$1(this._element).hasClass(ClassName.FADE); 9887 9888 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 9889 // Don't move modal's DOM position 9890 document.body.appendChild(this._element); 9891 } 9892 9893 this._element.style.display = 'block'; 9894 9895 this._element.removeAttribute('aria-hidden'); 9896 9897 this._element.scrollTop = 0; 9898 9899 if (transition) { 9900 Util.reflow(this._element); 9901 } 9902 9903 $$$1(this._element).addClass(ClassName.SHOW); 9904 9905 if (this._config.focus) { 9906 this._enforceFocus(); 9907 } 9908 9909 var shownEvent = $$$1.Event(Event.SHOWN, { 9910 relatedTarget: relatedTarget 9911 }); 9912 9913 var transitionComplete = function transitionComplete() { 9914 if (_this3._config.focus) { 9915 _this3._element.focus(); 9916 } 9917 9918 _this3._isTransitioning = false; 9919 $$$1(_this3._element).trigger(shownEvent); 9920 }; 9921 9922 if (transition) { 9923 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 9924 $$$1(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 9925 } else { 9926 transitionComplete(); 9927 } 9928 }; 9929 9930 _proto._enforceFocus = function _enforceFocus() { 9931 var _this4 = this; 9932 9933 $$$1(document).off(Event.FOCUSIN) // Guard against infinite focus loop 9934 .on(Event.FOCUSIN, function (event) { 9935 if (document !== event.target && _this4._element !== event.target && $$$1(_this4._element).has(event.target).length === 0) { 9936 _this4._element.focus(); 9937 } 9938 }); 9939 }; 9940 9941 _proto._setEscapeEvent = function _setEscapeEvent() { 9942 var _this5 = this; 9943 9944 if (this._isShown && this._config.keyboard) { 9945 $$$1(this._element).on(Event.KEYDOWN_DISMISS, function (event) { 9946 if (event.which === ESCAPE_KEYCODE) { 9947 event.preventDefault(); 9948 9949 _this5.hide(); 9950 } 9951 }); 9952 } else if (!this._isShown) { 9953 $$$1(this._element).off(Event.KEYDOWN_DISMISS); 9954 } 9955 }; 9956 9957 _proto._setResizeEvent = function _setResizeEvent() { 9958 var _this6 = this; 9959 9960 if (this._isShown) { 9961 $$$1(window).on(Event.RESIZE, function (event) { 9962 return _this6.handleUpdate(event); 9963 }); 9964 } else { 9965 $$$1(window).off(Event.RESIZE); 9966 } 9967 }; 9968 9969 _proto._hideModal = function _hideModal() { 9970 var _this7 = this; 9971 9972 this._element.style.display = 'none'; 9973 9974 this._element.setAttribute('aria-hidden', true); 9975 9976 this._isTransitioning = false; 9977 9978 this._showBackdrop(function () { 9979 $$$1(document.body).removeClass(ClassName.OPEN); 9980 9981 _this7._resetAdjustments(); 9982 9983 _this7._resetScrollbar(); 9984 9985 $$$1(_this7._element).trigger(Event.HIDDEN); 9986 }); 9987 }; 9988 9989 _proto._removeBackdrop = function _removeBackdrop() { 9990 if (this._backdrop) { 9991 $$$1(this._backdrop).remove(); 9992 this._backdrop = null; 9993 } 9994 }; 9995 9996 _proto._showBackdrop = function _showBackdrop(callback) { 9997 var _this8 = this; 9998 9999 var animate = $$$1(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; 10000 10001 if (this._isShown && this._config.backdrop) { 10002 this._backdrop = document.createElement('div'); 10003 this._backdrop.className = ClassName.BACKDROP; 10004 10005 if (animate) { 10006 this._backdrop.classList.add(animate); 10007 } 10008 10009 $$$1(this._backdrop).appendTo(document.body); 10010 $$$1(this._element).on(Event.CLICK_DISMISS, function (event) { 10011 if (_this8._ignoreBackdropClick) { 10012 _this8._ignoreBackdropClick = false; 10013 return; 10014 } 10015 10016 if (event.target !== event.currentTarget) { 10017 return; 10018 } 10019 10020 if (_this8._config.backdrop === 'static') { 10021 _this8._element.focus(); 10022 } else { 10023 _this8.hide(); 10024 } 10025 }); 10026 10027 if (animate) { 10028 Util.reflow(this._backdrop); 10029 } 10030 10031 $$$1(this._backdrop).addClass(ClassName.SHOW); 10032 10033 if (!callback) { 10034 return; 10035 } 10036 10037 if (!animate) { 10038 callback(); 10039 return; 10040 } 10041 10042 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 10043 $$$1(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 10044 } else if (!this._isShown && this._backdrop) { 10045 $$$1(this._backdrop).removeClass(ClassName.SHOW); 10046 10047 var callbackRemove = function callbackRemove() { 10048 _this8._removeBackdrop(); 10049 10050 if (callback) { 10051 callback(); 10052 } 10053 }; 10054 10055 if ($$$1(this._element).hasClass(ClassName.FADE)) { 10056 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 10057 10058 $$$1(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 10059 } else { 10060 callbackRemove(); 10061 } 10062 } else if (callback) { 10063 callback(); 10064 } 10065 }; // ---------------------------------------------------------------------- 10066 // the following methods are used to handle overflowing modals 10067 // todo (fat): these should probably be refactored out of modal.js 10068 // ---------------------------------------------------------------------- 10069 10070
10071 _proto._adjustDialog = function _adjustDialog() { 10072 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 10073 10074 if (!this._isBodyOverflowing && isModalOverflowing) { 10075 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 10076 } 10077 10078 if (this._isBodyOverflowing && !isModalOverflowing) { 10079 this._element.style.paddingRight = this._scrollbarWidth + "px"; 10080 } 10081 }; 10082 10083 _proto._resetAdjustments = function _resetAdjustments() { 10084 this._element.style.paddingLeft = ''; 10085 this._element.style.paddingRight = ''; 10086 }; 10087 10088 _proto._checkScrollbar = function _checkScrollbar() { 10089 var rect = document.body.getBoundingClientRect(); 10090 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; 10091 this._scrollbarWidth = this._getScrollbarWidth(); 10092 }; 10093 10094 _proto._setScrollbar = function _setScrollbar() { 10095 var _this9 = this; 10096 10097 if (this._isBodyOverflowing) { 10098 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 10099 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 10100 var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT)); 10101 var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT)); // Adjust fixed content padding 10102 10103 $$$1(fixedContent).each(function (index, element) { 10104 var actualPadding = element.style.paddingRight; 10105 var calculatedPadding = $$$1(element).css('padding-right'); 10106 $$$1(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); 10107 }); // Adjust sticky content margin 10108 10109 $$$1(stickyContent).each(function (index, element) { 10110 var actualMargin = element.style.marginRight; 10111 var calculatedMargin = $$$1(element).css('margin-right'); 10112 $$$1(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); 10113 }); // Adjust body padding 10114 10115 var actualPadding = document.body.style.paddingRight; 10116 var calculatedPadding = $$$1(document.body).css('padding-right'); 10117 $$$1(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 10118 } 10119 }; 10120 10121 _proto._resetScrollbar = function _resetScrollbar() { 10122 // Restore fixed content padding 10123 var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT)); 10124 $$$1(fixedContent).each(function (index, element) { 10125 var padding = $$$1(element).data('padding-right'); 10126 $$$1(element).removeData('padding-right'); 10127 element.style.paddingRight = padding ? padding : ''; 10128 }); // Restore sticky content 10129 10130 var elements = [].slice.call(document.querySelectorAll("" + Selector.STICKY_CONTENT)); 10131 $$$1(elements).each(function (index, element) { 10132 var margin = $$$1(element).data('margin-right'); 10133 10134 if (typeof margin !== 'undefined') { 10135 $$$1(element).css('margin-right', margin).removeData('margin-right'); 10136 } 10137 }); // Restore body padding 10138 10139 var padding = $$$1(document.body).data('padding-right'); 10140 $$$1(document.body).removeData('padding-right'); 10141 document.body.style.paddingRight = padding ? padding : ''; 10142 }; 10143 10144 _proto._getScrollbarWidth = function _getScrollbarWidth() { 10145 // thx d.walsh 10146 var scrollDiv = document.createElement('div'); 10147 scrollDiv.className = ClassName.SCROLLBAR_MEASURER; 10148 document.body.appendChild(scrollDiv); 10149 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 10150 document.body.removeChild(scrollDiv); 10151 return scrollbarWidth; 10152 }; // Static 10153 10154 10155 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 10156 return this.each(function () { 10157 var data = $$$1(this).data(DATA_KEY); 10158 10159 var _config = _objectSpread({}, Default, $$$1(this).data(), typeof config === 'object' && config ? config : {}); 10160 10161 if (!data) { 10162 data = new Modal(this, _config); 10163 $$$1(this).data(DATA_KEY, data); 10164 } 10165 10166 if (typeof config === 'string') { 10167 if (typeof data[config] === 'undefined') {
10168 throw new TypeError("No method named \"" + config + "\""); 10169 } 10170 10171 data[config](relatedTarget); 10172 } else if (_config.show) { 10173 data.show(relatedTarget); 10174 } 10175 }); 10176 }; 10177 10178 _createClass(Modal, null, [{ 10179 key: "VERSION", 10180 get: function get() { 10181 return VERSION; 10182 } 10183 }, { 10184 key: "Default", 10185 get: function get() { 10186 return Default; 10187 } 10188 }]); 10189 10190 return Modal; 10191 }(); 10192 /** 10193 * ------------------------------------------------------------------------ 10194 * Data Api implementation 10195 * ------------------------------------------------------------------------ 10196 */ 10197 10198 10199 $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 10200 var _this10 = this; 10201 10202 var target; 10203 var selector = Util.getSelectorFromElement(this); 10204 10205 if (selector) { 10206 target = document.querySelector(selector); 10207 } 10208 10209 var config = $$$1(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $$$1(target).data(), $$$1(this).data()); 10210 10211 if (this.tagName === 'A' || this.tagName === 'AREA') { 10212 event.preventDefault(); 10213 } 10214 10215 var $target = $$$1(target).one(Event.SHOW, function (showEvent) { 10216 if (showEvent.isDefaultPrevented()) { 10217 // Only register focus restorer if modal will actually get shown 10218 return; 10219 } 10220 10221 $target.one(Event.HIDDEN, function () { 10222 if ($$$1(_this10).is(':visible')) { 10223 _this10.focus(); 10224 } 10225 }); 10226 }); 10227 10228 Modal._jQueryInterface.call($$$1(target), config, this); 10229 }); 10230 /** 10231 * ------------------------------------------------------------------------ 10232 * jQuery 10233 * ------------------------------------------------------------------------ 10234 */ 10235 10236 $$$1.fn[NAME] = Modal._jQueryInterface; 10237 $$$1.fn[NAME].Constructor = Modal; 10238 10239 $$$1.fn[NAME].noConflict = function () { 10240 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 10241 return Modal._jQueryInterface; 10242 }; 10243 10244 return Modal; 10245 }($); 10246 10247 /** 10248 * -------------------------------------------------------------------------- 10249 * Bootstrap (v4.1.3): tooltip.js 10250 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 10251 * -------------------------------------------------------------------------- 10252 */ 10253 10254 var Tooltip = function ($$$1) { 10255 /** 10256 * ------------------------------------------------------------------------ 10257 * Constants 10258 * ------------------------------------------------------------------------ 10259 */ 10260 var NAME = 'tooltip'; 10261 var VERSION = '4.1.3'; 10262 var DATA_KEY = 'bs.tooltip'; 10263 var EVENT_KEY = "." + DATA_KEY; 10264 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 10265 var CLASS_PREFIX = 'bs-tooltip'; 10266 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 10267 var DefaultType = { 10268 animation: 'boolean', 10269 template: 'string', 10270 title: '(string|element|function)', 10271 trigger: 'string', 10272 delay: '(number|object)', 10273 html: 'boolean', 10274 selector: '(string|boolean)', 10275 placement: '(string|function)', 10276 offset: '(number|string)', 10277 container: '(string|element|boolean)', 10278 fallbackPlacement: '(string|array)', 10279 boundary: '(string|element)' 10280 }; 10281 var AttachmentMap = { 10282 AUTO: 'auto', 10283 TOP: 'top', 10284 RIGHT: 'right', 10285 BOTTOM: 'bottom', 10286 LEFT: 'left' 10287 }; 10288 var Default = { 10289 animation: true, 10290 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 10291 trigger: 'hover focus', 10292 title: '', 10293 delay: 0, 10294 html: false, 10295 selector: false, 10296 placement: 'top', 10297 offset: 0, 10298 container: false, 10299 fallbackPlacement: 'flip', 10300 boundary: 'scrollParent' 10301 }; 10302 var HoverState = { 10303 SHOW: 'show', 10304 OUT: 'out' 10305 }; 10306 var Event = { 10307 HIDE: "hide" + EVENT_KEY, 10308 HIDDEN: "hidden" + EVENT_KEY, 10309 SHOW: "show" + EVENT_KEY, 10310 SHOWN: "shown" + EVENT_KEY, 10311 INSERTED: "inserted" + EVENT_KEY, 10312 CLICK: "click" + EVENT_KEY, 10313 FOCUSIN: "focusin" + EVENT_KEY, 10314 FOCUSOUT: "focusout" + EVENT_KEY, 10315 MOUSEENTER: "mouseenter" + EVENT_KEY, 10316 MOUSELEAVE: "mouseleave" + EVENT_KEY 10317 }; 10318 var ClassName = { 10319 FADE: 'fade', 10320 SHOW: 'show' 10321 }; 10322 var Selector = { 10323 TOOLTIP: '.tooltip', 10324 TOOLTIP_INNER: '.tooltip-inner', 10325 ARROW: '.arrow' 10326 }; 10327 var Trigger = {
10328 HOVER: 'hover', 10329 FOCUS: 'focus', 10330 CLICK: 'click', 10331 MANUAL: 'manual' 10332 /** 10333 * ------------------------------------------------------------------------ 10334 * Class Definition 10335 * ------------------------------------------------------------------------ 10336 */ 10337 10338 }; 10339 10340 var Tooltip = 10341 /*#__PURE__*/ 10342 function () { 10343 function Tooltip(element, config) { 10344 /** 10345 * Check for Popper dependency 10346 * Popper - https://popper.js.org 10347 */ 10348 if (typeof Popper === 'undefined') { 10349 throw new TypeError('Bootstrap tooltips require Popper.js (https://popper.js.org)'); 10350 } // private 10351 10352 10353 this._isEnabled = true; 10354 this._timeout = 0; 10355 this._hoverState = ''; 10356 this._activeTrigger = {}; 10357 this._popper = null; // Protected 10358 10359 this.element = element; 10360 this.config = this._getConfig(config); 10361 this.tip = null; 10362 10363 this._setListeners(); 10364 } // Getters 10365 10366 10367 var _proto = Tooltip.prototype; 10368 10369 // Public 10370 _proto.enable = function enable() { 10371 this._isEnabled = true; 10372 }; 10373 10374 _proto.disable = function disable() { 10375 this._isEnabled = false; 10376 }; 10377 10378 _proto.toggleEnabled = function toggleEnabled() { 10379 this._isEnabled = !this._isEnabled; 10380 }; 10381 10382 _proto.toggle = function toggle(event) { 10383 if (!this._isEnabled) { 10384 return; 10385 } 10386 10387 if (event) { 10388 var dataKey = this.constructor.DATA_KEY; 10389 var context = $$$1(event.currentTarget).data(dataKey); 10390 10391 if (!context) { 10392 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 10393 $$$1(event.currentTarget).data(dataKey, context); 10394 } 10395 10396 context._activeTrigger.click = !context._activeTrigger.click; 10397 10398 if (context._isWithActiveTrigger()) { 10399 context._enter(null, context); 10400 } else { 10401 context._leave(null, context); 10402 } 10403 } else { 10404 if ($$$1(this.getTipElement()).hasClass(ClassName.SHOW)) { 10405 this._leave(null, this); 10406 10407 return; 10408 } 10409 10410 this._enter(null, this); 10411 } 10412 }; 10413 10414 _proto.dispose = function dispose() { 10415 clearTimeout(this._timeout); 10416 $$$1.removeData(this.element, this.constructor.DATA_KEY); 10417 $$$1(this.element).off(this.constructor.EVENT_KEY); 10418 $$$1(this.element).closest('.modal').off('hide.bs.modal'); 10419 10420 if (this.tip) { 10421 $$$1(this.tip).remove(); 10422 } 10423 10424 this._isEnabled = null; 10425 this._timeout = null; 10426 this._hoverState = null; 10427 this._activeTrigger = null; 10428 10429 if (this._popper !== null) { 10430 this._popper.destroy(); 10431 } 10432 10433 this._popper = null; 10434 this.element = null; 10435 this.config = null; 10436 this.tip = null; 10437 }; 10438 10439 _proto.show = function show() { 10440 var _this = this; 10441 10442 if ($$$1(this.element).css('display') === 'none') { 10443 throw new Error('Please use show on visible elements'); 10444 } 10445 10446 var showEvent = $$$1.Event(this.constructor.Event.SHOW); 10447 10448 if (this.isWithContent() && this._isEnabled) { 10449 $$$1(this.element).trigger(showEvent); 10450 var isInTheDom = $$$1.contains(this.element.ownerDocument.documentElement, this.element); 10451 10452 if (showEvent.isDefaultPrevented() || !isInTheDom) { 10453 return; 10454 } 10455 10456 var tip = this.getTipElement(); 10457 var tipId = Util.getUID(this.constructor.NAME);
10458 tip.setAttribute('id', tipId); 10459 this.element.setAttribute('aria-describedby', tipId); 10460 this.setContent(); 10461 10462 if (this.config.animation) { 10463 $$$1(tip).addClass(ClassName.FADE); 10464 } 10465 10466 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 10467 10468 var attachment = this._getAttachment(placement); 10469 10470 this.addAttachmentClass(attachment); 10471 var container = this.config.container === false ? document.body : $$$1(document).find(this.config.container); 10472 $$$1(tip).data(this.constructor.DATA_KEY, this); 10473 10474 if (!$$$1.contains(this.element.ownerDocument.documentElement, this.tip)) { 10475 $$$1(tip).appendTo(container); 10476 } 10477 10478 $$$1(this.element).trigger(this.constructor.Event.INSERTED); 10479 this._popper = new Popper(this.element, tip, { 10480 placement: attachment, 10481 modifiers: { 10482 offset: { 10483 offset: this.config.offset 10484 }, 10485 flip: { 10486 behavior: this.config.fallbackPlacement 10487 }, 10488 arrow: { 10489 element: Selector.ARROW 10490 }, 10491 preventOverflow: { 10492 boundariesElement: this.config.boundary 10493 } 10494 }, 10495 onCreate: function onCreate(data) { 10496 if (data.originalPlacement !== data.placement) { 10497 _this._handlePopperPlacementChange(data); 10498 } 10499 }, 10500 onUpdate: function onUpdate(data) { 10501 _this._handlePopperPlacementChange(data); 10502 } 10503 }); 10504 $$$1(tip).addClass(ClassName.SHOW); // If this is a touch-enabled device we add extra 10505 // empty mouseover listeners to the body's immediate children; 10506 // only needed because of broken event delegation on iOS 10507 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 10508 10509 if ('ontouchstart' in document.documentElement) { 10510 $$$1(document.body).children().on('mouseover', null, $$$1.noop); 10511 } 10512 10513 var complete = function complete() { 10514 if (_this.config.animation) { 10515 _this._fixTransition(); 10516 } 10517 10518 var prevHoverState = _this._hoverState; 10519 _this._hoverState = null; 10520 $$$1(_this.element).trigger(_this.constructor.Event.SHOWN); 10521 10522 if (prevHoverState === HoverState.OUT) { 10523 _this._leave(null, _this); 10524 } 10525 }; 10526 10527 if ($$$1(this.tip).hasClass(ClassName.FADE)) { 10528 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 10529 $$$1(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 10530 } else { 10531 complete(); 10532 } 10533 } 10534 }; 10535 10536 _proto.hide = function hide(callback) { 10537 var _this2 = this; 10538 10539 var tip = this.getTipElement(); 10540 var hideEvent = $$$1.Event(this.constructor.Event.HIDE); 10541 10542 var complete = function complete() { 10543 if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { 10544 tip.parentNode.removeChild(tip); 10545 } 10546 10547 _this2._cleanTipClass(); 10548 10549 _this2.element.removeAttribute('aria-describedby'); 10550 10551 $$$1(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 10552 10553 if (_this2._popper !== null) { 10554 _this2._popper.destroy(); 10555 } 10556 10557 if (callback) { 10558 callback(); 10559 } 10560 }; 10561 10562 $$$1(this.element).trigger(hideEvent); 10563 10564 if (hideEvent.isDefaultPrevented()) { 10565 return; 10566 } 10567 10568 $$$1(tip).removeClass(ClassName.SHOW); // If this is a touch-enabled device we remove the extra 10569 // empty mouseover listeners we added for iOS support 10570 10571 if ('ontouchstart' in document.documentElement) { 10572 $$$1(document.body).children().off('mouseover', null, $$$1.noop); 10573 } 10574 10575 this._activeTrigger[Trigger.CLICK] = false; 10576 this._activeTrigger[Trigger.FOCUS] = false; 10577 this._activeTrigger[Trigger.HOVER] = false; 10578 10579 if ($$$1(this.tip).hasClass(ClassName.FADE)) { 10580 var transitionDuration = Util.getTransitionDurationFromElement(tip); 10581 $$$1(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 10582 } else { 10583 complete(); 10584 } 10585 10586 this._hoverState = ''; 10587 }; 10588
10589 _proto.update = function update() { 10590 if (this._popper !== null) { 10591 this._popper.scheduleUpdate(); 10592 } 10593 }; // Protected 10594 10595 10596 _proto.isWithContent = function isWithContent() { 10597 return Boolean(this.getTitle()); 10598 }; 10599 10600 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 10601 $$$1(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 10602 }; 10603 10604 _proto.getTipElement = function getTipElement() { 10605 this.tip = this.tip || $$$1(this.config.template)[0]; 10606 return this.tip; 10607 }; 10608 10609 _proto.setContent = function setContent() { 10610 var tip = this.getTipElement(); 10611 this.setElementContent($$$1(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle()); 10612 $$$1(tip).removeClass(ClassName.FADE + " " + ClassName.SHOW); 10613 }; 10614 10615 _proto.setElementContent = function setElementContent($element, content) { 10616 var html = this.config.html; 10617 10618 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 10619 // Content is a DOM node or a jQuery 10620 if (html) { 10621 if (!$$$1(content).parent().is($element)) { 10622 $element.empty().append(content); 10623 } 10624 } else { 10625 $element.text($$$1(content).text()); 10626 } 10627 } else { 10628 $element[html ? 'html' : 'text'](content); 10629 } 10630 }; 10631 10632 _proto.getTitle = function getTitle() { 10633 var title = this.element.getAttribute('data-original-title'); 10634 10635 if (!title) { 10636 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 10637 } 10638 10639 return title; 10640 }; // Private 10641 10642 10643 _proto._getAttachment = function _getAttachment(placement) { 10644 return AttachmentMap[placement.toUpperCase()]; 10645 }; 10646 10647 _proto._setListeners = function _setListeners() { 10648 var _this3 = this; 10649 10650 var triggers = this.config.trigger.split(' '); 10651 triggers.forEach(function (trigger) { 10652 if (trigger === 'click') { 10653 $$$1(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) { 10654 return _this3.toggle(event); 10655 }); 10656 } else if (trigger !== Trigger.MANUAL) { 10657 var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; 10658 var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; 10659 $$$1(_this3.element).on(eventIn, _this3.config.selector, function (event) { 10660 return _this3._enter(event); 10661 }).on(eventOut, _this3.config.selector, function (event) { 10662 return _this3._leave(event); 10663 }); 10664 } 10665 10666 $$$1(_this3.element).closest('.modal').on('hide.bs.modal', function () { 10667 return _this3.hide(); 10668 }); 10669 }); 10670 10671 if (this.config.selector) { 10672 this.config = _objectSpread({}, this.config, { 10673 trigger: 'manual', 10674 selector: '' 10675 }); 10676 } else { 10677 this._fixTitle(); 10678 } 10679 }; 10680 10681 _proto._fixTitle = function _fixTitle() { 10682 var titleType = typeof this.element.getAttribute('data-original-title'); 10683 10684 if (this.element.getAttribute('title') || titleType !== 'string') { 10685 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 10686 this.element.setAttribute('title', ''); 10687 } 10688 }; 10689 10690 _proto._enter = function _enter(event, context) { 10691 var dataKey = this.constructor.DATA_KEY; 10692 context = context || $$$1(event.currentTarget).data(dataKey); 10693 10694 if (!context) { 10695 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 10696 $$$1(event.currentTarget).data(dataKey, context); 10697 } 10698 10699 if (event) { 10700 context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; 10701 } 10702 10703 if ($$$1(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) { 10704 context._hoverState = HoverState.SHOW; 10705 return; 10706 } 10707 10708 clearTimeout(context._timeout); 10709 context._hoverState = HoverState.SHOW; 10710 10711 if (!context.config.delay || !context.config.delay.show) { 10712 context.show(); 10713 return; 10714 } 10715 10716 context._timeout = setTimeout(function () { 10717 if (context._hoverState === HoverState.SHOW) { 10718 context.show(); 10719 } 10720 }, context.config.delay.show); 10721 }; 10722 10723 _proto._leave = function _leave(event, context) { 10724 var dataKey = this.constructor.DATA_KEY; 10725 context = context || $$$1(event.currentTarget).data(dataKey); 10726 10727 if (!context) { 10728 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 10729 $$$1(event.currentTarget).data(dataKey, context); 10730 } 10731 10732 if (event) { 10733 context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; 10734 } 10735 10736 if (context._isWithActiveTrigger()) { 10737 return; 10738 } 10739 10740 clearTimeout(context._timeout); 10741 context._hoverState = HoverState.OUT; 10742 10743 if (!context.config.delay || !context.config.delay.hide) { 10744 context.hide(); 10745 return; 10746 } 10747 10748 context._timeout = setTimeout(function () { 10749 if (context._hoverState === HoverState.OUT) { 10750 context.hide(); 10751 } 10752 }, context.config.delay.hide); 10753 }; 10754 10755 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 10756 for (var trigger in this._activeTrigger) { 10757 if (this._activeTrigger[trigger]) { 10758 return true; 10759 } 10760 } 10761 10762 return false; 10763 }; 10764 10765 _proto._getConfig = function _getConfig(config) { 10766 config = _objectSpread({}, this.constructor.Default, $$$1(this.element).data(), typeof config === 'object' && config ? config : {}); 10767 10768 if (typeof config.delay === 'number') { 10769 config.delay = { 10770 show: config.delay, 10771 hide: config.delay 10772 }; 10773 } 10774 10775 if (typeof config.title === 'number') { 10776 config.title = config.title.toString(); 10777 } 10778 10779 if (typeof config.content === 'number') { 10780 config.content = config.content.toString(); 10781 } 10782 10783 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 10784 return config; 10785 }; 10786 10787 _proto._getDelegateConfig = function _getDelegateConfig() { 10788 var config = {}; 10789 10790 if (this.config) { 10791 for (var key in this.config) { 10792 if (this.constructor.Default[key] !== this.config[key]) { 10793 config[key] = this.config[key]; 10794 } 10795 } 10796 } 10797 10798 return config; 10799 }; 10800 10801 _proto._cleanTipClass = function _cleanTipClass() { 10802 var $tip = $$$1(this.getTipElement()); 10803 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 10804 10805 if (tabClass !== null && tabClass.length) { 10806 $tip.removeClass(tabClass.join(''));
10807 } 10808 }; 10809 10810 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 10811 var popperInstance = popperData.instance; 10812 this.tip = popperInstance.popper; 10813 10814 this._cleanTipClass(); 10815 10816 this.addAttachmentClass(this._getAttachment(popperData.placement)); 10817 }; 10818 10819 _proto._fixTransition = function _fixTransition() { 10820 var tip = this.getTipElement(); 10821 var initConfigAnimation = this.config.animation; 10822 10823 if (tip.getAttribute('x-placement') !== null) { 10824 return; 10825 } 10826 10827 $$$1(tip).removeClass(ClassName.FADE); 10828 this.config.animation = false; 10829 this.hide(); 10830 this.show(); 10831 this.config.animation = initConfigAnimation; 10832 }; // Static 10833 10834 10835 Tooltip._jQueryInterface = function _jQueryInterface(config) { 10836 return this.each(function () { 10837 var data = $$$1(this).data(DATA_KEY); 10838 10839 var _config = typeof config === 'object' && config; 10840 10841 if (!data && /dispose|hide/.test(config)) { 10842 return; 10843 } 10844 10845 if (!data) { 10846 data = new Tooltip(this, _config); 10847 $$$1(this).data(DATA_KEY, data); 10848 } 10849 10850 if (typeof config === 'string') { 10851 if (typeof data[config] === 'undefined') { 10852 throw new TypeError("No method named \"" + config + "\""); 10853 } 10854 10855 data[config](); 10856 } 10857 }); 10858 }; 10859 10860 _createClass(Tooltip, null, [{ 10861 key: "VERSION", 10862 get: function get() { 10863 return VERSION; 10864 } 10865 }, { 10866 key: "Default", 10867 get: function get() { 10868 return Default; 10869 } 10870 }, { 10871 key: "NAME", 10872 get: function get() { 10873 return NAME; 10874 } 10875 }, { 10876 key: "DATA_KEY", 10877 get: function get() { 10878 return DATA_KEY; 10879 } 10880 }, { 10881 key: "Event", 10882 get: function get() { 10883 return Event; 10884 } 10885 }, { 10886 key: "EVENT_KEY", 10887 get: function get() { 10888 return EVENT_KEY; 10889 } 10890 }, { 10891 key: "DefaultType", 10892 get: function get() { 10893 return DefaultType; 10894 } 10895 }]); 10896 10897 return Tooltip; 10898 }(); 10899 /** 10900 * ------------------------------------------------------------------------ 10901 * jQuery 10902 * ------------------------------------------------------------------------ 10903 */ 10904 10905 10906 $$$1.fn[NAME] = Tooltip._jQueryInterface; 10907 $$$1.fn[NAME].Constructor = Tooltip; 10908 10909 $$$1.fn[NAME].noConflict = function () { 10910 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 10911 return Tooltip._jQueryInterface; 10912 }; 10913 10914 return Tooltip; 10915 }($, Popper); 10916 10917 /** 10918 * -------------------------------------------------------------------------- 10919 * Bootstrap (v4.1.3): popover.js 10920 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 10921 * -------------------------------------------------------------------------- 10922 */ 10923 10924 var Popover = function ($$$1) { 10925 /** 10926 * ------------------------------------------------------------------------ 10927 * Constants 10928 * ------------------------------------------------------------------------ 10929 */ 10930 var NAME = 'popover'; 10931 var VERSION = '4.1.3'; 10932 var DATA_KEY = 'bs.popover'; 10933 var EVENT_KEY = "." + DATA_KEY; 10934 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 10935 var CLASS_PREFIX = 'bs-popover'; 10936 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 10937 10938 var Default = _objectSpread({}, Tooltip.Default, { 10939 placement: 'right', 10940 trigger: 'click', 10941 content: '', 10942 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 10943 }); 10944 10945 var DefaultType = _objectSpread({}, Tooltip.DefaultType, { 10946 content: '(string|element|function)' 10947 }); 10948 10949 var ClassName = { 10950 FADE: 'fade', 10951 SHOW: 'show' 10952 }; 10953 var Selector = { 10954 TITLE: '.popover-header', 10955 CONTENT: '.popover-body' 10956 }; 10957 var Event = { 10958 HIDE: "hide" + EVENT_KEY, 10959 HIDDEN: "hidden" + EVENT_KEY, 10960 SHOW: "show" + EVENT_KEY, 10961 SHOWN: "shown" + EVENT_KEY, 10962 INSERTED: "inserted" + EVENT_KEY, 10963 CLICK: "click" + EVENT_KEY, 10964 FOCUSIN: "focusin" + EVENT_KEY, 10965 FOCUSOUT: "focusout" + EVENT_KEY, 10966 MOUSEENTER: "mouseenter" + EVENT_KEY, 10967 MOUSELEAVE: "mouseleave" + EVENT_KEY 10968 /** 10969 * ------------------------------------------------------------------------ 10970 * Class Definition 10971 * ------------------------------------------------------------------------ 10972 */ 10973 10974 }; 10975 10976 var Popover = 10977 /*#__PURE__*/ 10978 function (_Tooltip) { 10979 _inheritsLoose(Popover, _Tooltip); 10980 10981 function Popover() { 10982 return _Tooltip.apply(this, arguments) || this; 10983 } 10984 10985 var _proto = Popover.prototype; 10986 10987 // Overrides 10988 _proto.isWithContent = function isWithContent() { 10989 return this.getTitle() || this._getContent(); 10990 }; 10991 10992 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 10993 $$$1(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 10994 }; 10995 10996 _proto.getTipElement = function getTipElement() { 10997 this.tip = this.tip || $$$1(this.config.template)[0]; 10998 return this.tip; 10999 }; 11000 11001 _proto.setContent = function setContent() { 11002 var $tip = $$$1(this.getTipElement()); // We use append for html objects to maintain js events 11003 11004 this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); 11005 11006 var content = this._getContent(); 11007 11008 if (typeof content === 'function') { 11009 content = content.call(this.element); 11010 } 11011
11012 this.setElementContent($tip.find(Selector.CONTENT), content); 11013 $tip.removeClass(ClassName.FADE + " " + ClassName.SHOW); 11014 }; // Private 11015 11016 11017 _proto._getContent = function _getContent() { 11018 return this.element.getAttribute('data-content') || this.config.content; 11019 }; 11020 11021 _proto._cleanTipClass = function _cleanTipClass() { 11022 var $tip = $$$1(this.getTipElement()); 11023 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 11024 11025 if (tabClass !== null && tabClass.length > 0) { 11026 $tip.removeClass(tabClass.join('')); 11027 } 11028 }; // Static 11029 11030 11031 Popover._jQueryInterface = function _jQueryInterface(config) { 11032 return this.each(function () { 11033 var data = $$$1(this).data(DATA_KEY); 11034 11035 var _config = typeof config === 'object' ? config : null; 11036 11037 if (!data && /destroy|hide/.test(config)) { 11038 return; 11039 } 11040 11041 if (!data) { 11042 data = new Popover(this, _config); 11043 $$$1(this).data(DATA_KEY, data); 11044 } 11045 11046 if (typeof config === 'string') { 11047 if (typeof data[config] === 'undefined') { 11048 throw new TypeError("No method named \"" + config + "\""); 11049 } 11050 11051 data[config](); 11052 } 11053 }); 11054 }; 11055 11056 _createClass(Popover, null, [{ 11057 key: "VERSION", 11058 // Getters 11059 get: function get() { 11060 return VERSION; 11061 } 11062 }, { 11063 key: "Default", 11064 get: function get() { 11065 return Default; 11066 } 11067 }, { 11068 key: "NAME", 11069 get: function get() { 11070 return NAME; 11071 } 11072 }, { 11073 key: "DATA_KEY", 11074 get: function get() { 11075 return DATA_KEY; 11076 } 11077 }, { 11078 key: "Event", 11079 get: function get() { 11080 return Event; 11081 } 11082 }, { 11083 key: "EVENT_KEY", 11084 get: function get() { 11085 return EVENT_KEY; 11086 } 11087 }, { 11088 key: "DefaultType", 11089 get: function get() { 11090 return DefaultType; 11091 } 11092 }]); 11093 11094 return Popover; 11095 }(Tooltip); 11096 /** 11097 * ------------------------------------------------------------------------ 11098 * jQuery 11099 * ------------------------------------------------------------------------ 11100 */ 11101 11102 11103 $$$1.fn[NAME] = Popover._jQueryInterface; 11104 $$$1.fn[NAME].Constructor = Popover; 11105 11106 $$$1.fn[NAME].noConflict = function () { 11107 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 11108 return Popover._jQueryInterface; 11109 }; 11110 11111 return Popover; 11112 }($); 11113 11114 /** 11115 * -------------------------------------------------------------------------- 11116 * Bootstrap (v4.1.3): scrollspy.js 11117 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 11118 * -------------------------------------------------------------------------- 11119 */ 11120 11121 var ScrollSpy = function ($$$1) { 11122 /** 11123 * ------------------------------------------------------------------------ 11124 * Constants 11125 * ------------------------------------------------------------------------ 11126 */ 11127 var NAME = 'scrollspy'; 11128 var VERSION = '4.1.3'; 11129 var DATA_KEY = 'bs.scrollspy'; 11130 var EVENT_KEY = "." + DATA_KEY; 11131 var DATA_API_KEY = '.data-api'; 11132 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 11133 var Default = { 11134 offset: 10, 11135 method: 'auto', 11136 target: '' 11137 }; 11138 var DefaultType = { 11139 offset: 'number', 11140 method: 'string', 11141 target: '(string|element)' 11142 }; 11143 var Event = { 11144 ACTIVATE: "activate" + EVENT_KEY, 11145 SCROLL: "scroll" + EVENT_KEY, 11146 LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY 11147 }; 11148 var ClassName = { 11149 DROPDOWN_ITEM: 'dropdown-item', 11150 DROPDOWN_MENU: 'dropdown-menu', 11151 ACTIVE: 'active' 11152 }; 11153 var Selector = { 11154 DATA_SPY: '[data-spy="scroll"]', 11155 ACTIVE: '.active', 11156 NAV_LIST_GROUP: '.nav, .list-group', 11157 NAV_LINKS: '.nav-link', 11158 NAV_ITEMS: '.nav-item', 11159 LIST_ITEMS: '.list-group-item', 11160 DROPDOWN: '.dropdown',
11161 DROPDOWN_ITEMS: '.dropdown-item', 11162 DROPDOWN_TOGGLE: '.dropdown-toggle' 11163 }; 11164 var OffsetMethod = { 11165 OFFSET: 'offset', 11166 POSITION: 'position' 11167 /** 11168 * ------------------------------------------------------------------------ 11169 * Class Definition 11170 * ------------------------------------------------------------------------ 11171 */ 11172 11173 }; 11174 11175 var ScrollSpy = 11176 /*#__PURE__*/ 11177 function () { 11178 function ScrollSpy(element, config) { 11179 var _this = this; 11180 11181 this._element = element; 11182 this._scrollElement = element.tagName === 'BODY' ? window : element; 11183 this._config = this._getConfig(config); 11184 this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " " + Selector.DROPDOWN_ITEMS); 11185 this._offsets = []; 11186 this._targets = []; 11187 this._activeTarget = null; 11188 this._scrollHeight = 0; 11189 $$$1(this._scrollElement).on(Event.SCROLL, function (event) { 11190 return _this._process(event); 11191 }); 11192 this.refresh(); 11193 11194 this._process(); 11195 } // Getters 11196 11197 11198 var _proto = ScrollSpy.prototype; 11199 11200 // Public 11201 _proto.refresh = function refresh() { 11202 var _this2 = this; 11203 11204 var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; 11205 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 11206 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 11207 this._offsets = []; 11208 this._targets = []; 11209 this._scrollHeight = this._getScrollHeight(); 11210 var targets = [].slice.call(document.querySelectorAll(this._selector)); 11211 targets.map(function (element) { 11212 var target; 11213 var targetSelector = Util.getSelectorFromElement(element); 11214 11215 if (targetSelector) { 11216 target = document.querySelector(targetSelector); 11217 } 11218 11219 if (target) { 11220 var targetBCR = target.getBoundingClientRect(); 11221 11222 if (targetBCR.width || targetBCR.height) { 11223 // TODO (fat): remove sketch reliance on jQuery position/offset 11224 return [$$$1(target)[offsetMethod]().top + offsetBase, targetSelector]; 11225 } 11226 } 11227 11228 return null; 11229 }).filter(function (item) { 11230 return item; 11231 }).sort(function (a, b) { 11232 return a[0] - b[0]; 11233 }
11233).forEach(function (item) { 11234 _this2._offsets.push(item[0]); 11235 11236 _this2._targets.push(item[1]); 11237 }); 11238 }; 11239 11240 _proto.dispose = function dispose() { 11241 $$$1.removeData(this._element, DATA_KEY); 11242 $$$1(this._scrollElement).off(EVENT_KEY); 11243 this._element = null; 11244 this._scrollElement = null; 11245 this._config = null; 11246 this._selector = null; 11247 this._offsets = null; 11248 this._targets = null; 11249 this._activeTarget = null; 11250 this._scrollHeight = null; 11251 }; // Private 11252 11253 11254 _proto._getConfig = function _getConfig(config) { 11255 config = _objectSpread({}, Default, typeof config === 'object' && config ? config : {}); 11256 11257 if (typeof config.target !== 'string') { 11258 var id = $$$1(config.target).attr('id'); 11259 11260 if (!id) { 11261 id = Util.getUID(NAME); 11262 $$$1(config.target).attr('id', id); 11263 } 11264 11265 config.target = "#" + id; 11266 } 11267 11268 Util.typeCheckConfig(NAME, config, DefaultType); 11269 return config; 11270 }; 11271 11272 _proto._getScrollTop = function _getScrollTop() { 11273 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 11274 }; 11275 11276 _proto._getScrollHeight = function _getScrollHeight() { 11277 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 11278 }; 11279 11280 _proto._getOffsetHeight = function _getOffsetHeight() { 11281 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 11282 }; 11283 11284 _proto._process = function _process() { 11285 var scrollTop = this._getScrollTop() + this._config.offset; 11286 11287 var scrollHeight = this._getScrollHeight(); 11288 11289 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 11290 11291 if (this._scrollHeight !== scrollHeight) { 11292 this.refresh(); 11293 } 11294 11295 if (scrollTop >= maxScroll) { 11296 var target = this._targets[this._targets.length - 1]; 11297 11298 if (this._activeTarget !== target) { 11299 this._activate(target); 11300 } 11301 11302 return; 11303 } 11304 11305 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 11306 this._activeTarget = null; 11307 11308 this._clear(); 11309 11310 return; 11311 } 11312 11313 var offsetLength = this._offsets.length; 11314 11315 for (var i = offsetLength; i--;) { 11316 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 11317 11318 if (isActiveTarget) { 11319 this._activate(this._targets[i]); 11320 } 11321 } 11322 }; 11323 11324 _proto._activate = function _activate(target) { 11325 this._activeTarget = target; 11326 11327 this._clear(); 11328 11329 var queries = this._selector.split(','); // eslint-disable-next-line arrow-body-style 11330 11331 11332 queries = queries.map(function (selector) { 11333 return selector + "[data-target=\"" + target + "\"]," + (selector + "[href=\"" + target + "\"]"); 11334 }); 11335 var $link = $$$1([].slice.call(document.querySelectorAll(queries.join(',')))); 11336 11337 if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { 11338 $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); 11339 $link.addClass(ClassName.ACTIVE); 11340 } else { 11341 // Set triggered link as active 11342 $link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
11343 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 11344 11345 $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item 11346 11347 $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE); 11348 } 11349 11350 $$$1(this._scrollElement).trigger(Event.ACTIVATE, { 11351 relatedTarget: target 11352 }); 11353 }; 11354 11355 _proto._clear = function _clear() { 11356 var nodes = [].slice.call(document.querySelectorAll(this._selector)); 11357 $$$1(nodes).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); 11358 }; // Static 11359 11360 11361 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 11362 return this.each(function () { 11363 var data = $$$1(this).data(DATA_KEY); 11364 11365 var _config = typeof config === 'object' && config; 11366 11367 if (!data) { 11368 data = new ScrollSpy(this, _config); 11369 $$$1(this).data(DATA_KEY, data); 11370 } 11371 11372 if (typeof config === 'string') { 11373 if (typeof data[config] === 'undefined') { 11374 throw new TypeError("No method named \"" + config + "\""); 11375 } 11376 11377 data[config](); 11378 } 11379 }); 11380 }; 11381 11382 _createClass(ScrollSpy, null, [{ 11383 key: "VERSION", 11384 get: function get() { 11385 return VERSION; 11386 } 11387 }, { 11388 key: "Default", 11389 get: function get() { 11390 return Default; 11391 } 11392 }]); 11393 11394 return ScrollSpy; 11395 }(); 11396 /** 11397 * ------------------------------------------------------------------------ 11398 * Data Api implementation 11399 * ------------------------------------------------------------------------ 11400 */ 11401 11402 11403 $$$1(window).on(Event.LOAD_DATA_API, function () { 11404 var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY)); 11405 var scrollSpysLength = scrollSpys.length; 11406 11407 for (var i = scrollSpysLength; i--;) { 11408 var $spy = $$$1(scrollSpys[i]); 11409 11410 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 11411 } 11412 }); 11413 /** 11414 * ------------------------------------------------------------------------ 11415 * jQuery 11416 * ------------------------------------------------------------------------ 11417 */ 11418 11419 $$$1.fn[NAME] = ScrollSpy._jQueryInterface; 11420 $$$1.fn[NAME].Constructor = ScrollSpy; 11421 11422 $$$1.fn[NAME].noConflict = function () { 11423 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 11424 return ScrollSpy._jQueryInterface; 11425 }; 11426 11427 return ScrollSpy; 11428 }($); 11429 11430 /** 11431 * -------------------------------------------------------------------------- 11432 * Bootstrap (v4.1.3): tab.js 11433 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 11434 * -------------------------------------------------------------------------- 11435 */ 11436 11437 var Tab = function ($$$1) { 11438 /** 11439 * ------------------------------------------------------------------------ 11440 * Constants 11441 * ------------------------------------------------------------------------ 11442 */ 11443 var NAME = 'tab'; 11444 var VERSION = '4.1.3'; 11445 var DATA_KEY = 'bs.tab'; 11446 var EVENT_KEY = "." + DATA_KEY; 11447 var DATA_API_KEY = '.data-api'; 11448 var JQUERY_NO_CONFLICT = $$$1.fn[NAME]; 11449 var Event = { 11450 HIDE: "hide" + EVENT_KEY, 11451 HIDDEN: "hidden" + EVENT_KEY, 11452 SHOW: "show" + EVENT_KEY, 11453 SHOWN: "shown" + EVENT_KEY, 11454 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 11455 }; 11456 var ClassName = { 11457 DROPDOWN_MENU: 'dropdown-menu', 11458 ACTIVE: 'active', 11459 DISABLED: 'disabled', 11460 FADE: 'fade', 11461 SHOW: 'show' 11462 }; 11463 var Selector = { 11464 DROPDOWN: '.dropdown', 11465 NAV_LIST_GROUP: '.nav, .list-group', 11466 ACTIVE: '.active', 11467 ACTIVE_UL: '> li > .active', 11468 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 11469 DROPDOWN_TOGGLE: '.dropdown-toggle', 11470 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' 11471 /** 11472 * ------------------------------------------------------------------------ 11473 * Class Definition 11474 * ------------------------------------------------------------------------ 11475 */ 11476 11477 }; 11478 11479 var Tab = 11480 /*#__PURE__*/ 11481 function () { 11482 function Tab(element) { 11483 this._element = element; 11484 } // Getters 11485 11486 11487 var _proto = Tab.prototype; 11488 11489 // Public 11490 _proto.show = function show() { 11491 var _this = this; 11492 11493 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $$$1(this._element).hasClass(ClassName.ACTIVE) || $$$1(this._element).hasClass(ClassName.DISABLED)) { 11494 return; 11495 } 11496 11497 var target; 11498 var previous; 11499 var listElement = $$$1(this._element).closest(Selector.NAV_LIST_GROUP)[0]; 11500 var selector = Util.getSelectorFromElement(this._element); 11501 11502 if (listElement) { 11503 var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE; 11504 previous = $$$1.makeArray($$$1(listElement).find(itemSelector)); 11505 previous = previous[previous.length - 1]; 11506 } 11507 11508 var hideEvent = $$$1.Event(Event.HIDE, { 11509 relatedTarget: this._element 11510 }); 11511 var showEvent = $$$1.Event(Event.SHOW, { 11512 relatedTarget: previous 11513 }); 11514 11515 if (previous) { 11516 $$$1(previous).trigger(hideEvent); 11517 } 11518 11519 $$$1(this._element).trigger(showEvent); 11520 11521 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 11522 return; 11523 } 11524 11525 if (selector) { 11526 target = document.querySelector(selector); 11527 } 11528 11529 this._activate(this._element, listElement); 11530 11531 var complete = function complete() { 11532 var hiddenEvent = $$$1.Event(Event.HIDDEN, { 11533 relatedTarget: _this._element 11534 }); 11535 var shownEvent = $$$1.Event(Event.SHOWN, { 11536 relatedTarget: previous 11537 }); 11538 $$$1(previous).trigger(hiddenEvent); 11539 $$$1(_this._element).trigger(shownEvent); 11540 }; 11541 11542 if (target) { 11543 this._activate(target, target.parentNode, complete); 11544 } else { 11545 complete(); 11546 } 11547 }; 11548 11549 _proto.dispose = function dispose() { 11550 $$$1.removeData(this._element, DATA_KEY); 11551 this._element = null; 11552 }; // Private 11553 11554 11555 _proto._activate = function _activate(element, container, callback) { 11556 var _this2 = this; 11557 11558 var activeElements; 11559 11560 if (container.nodeName === 'UL') { 11561 activeElements = $$$1(container).find(Selector.ACTIVE_UL); 11562 } else { 11563 activeElements = $$$1(container).children(Selector.ACTIVE); 11564 } 11565 11566 var active = activeElements[0]; 11567 var isTransitioning = callback && active && $$$1(active).hasClass(ClassName.FADE); 11568 11569 var complete = function complete() { 11570 return _this2._transitionComplete(element, active, callback); 11571 }; 11572 11573 if (active && isTransitioning) { 11574 var transitionDuration = Util.getTransitionDurationFromElement(active); 11575 $$$1(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 11576 } else { 11577 complete(); 11578 } 11579 }; 11580 11581 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 11582 if (active) { 11583 $$$1(active).removeClass(ClassName.SHOW + " " + ClassName.ACTIVE);
11584 var dropdownChild = $$$1(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; 11585 11586 if (dropdownChild) { 11587 $$$1(dropdownChild).removeClass(ClassName.ACTIVE); 11588 } 11589 11590 if (active.getAttribute('role') === 'tab') { 11591 active.setAttribute('aria-selected', false); 11592 } 11593 } 11594 11595 $$$1(element).addClass(ClassName.ACTIVE); 11596 11597 if (element.getAttribute('role') === 'tab') { 11598 element.setAttribute('aria-selected', true); 11599 } 11600 11601 Util.reflow(element); 11602 $$$1(element).addClass(ClassName.SHOW); 11603 11604 if (element.parentNode && $$$1(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { 11605 var dropdownElement = $$$1(element).closest(Selector.DROPDOWN)[0]; 11606 11607 if (dropdownElement) { 11608 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE)); 11609 $$$1(dropdownToggleList).addClass(ClassName.ACTIVE); 11610 } 11611 11612 element.setAttribute('aria-expanded', true); 11613 } 11614 11615 if (callback) { 11616 callback(); 11617 } 11618 }; // Static 11619 11620 11621 Tab._jQueryInterface = function _jQueryInterface(config) { 11622 return this.each(function () { 11623 var $this = $$$1(this); 11624 var data = $this.data(DATA_KEY); 11625 11626 if (!data) { 11627 data = new Tab(this); 11628 $this.data(DATA_KEY, data); 11629 } 11630 11631 if (typeof config === 'string') { 11632 if (typeof data[config] === 'undefined') { 11633 throw new TypeError("No method named \"" + config + "\""); 11634 } 11635 11636 data[config](); 11637 } 11638 }); 11639 }; 11640 11641 _createClass(Tab, null, [{ 11642 key: "VERSION", 11643 get: function get() { 11644 return VERSION; 11645 } 11646 }]); 11647 11648 return Tab; 11649 }(); 11650 /** 11651 * ------------------------------------------------------------------------ 11652 * Data Api implementation 11653 * ------------------------------------------------------------------------ 11654 */ 11655 11656 11657 $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 11658 event.preventDefault(); 11659 11660 Tab._jQueryInterface.call($$$1(this), 'show'); 11661 }); 11662 /** 11663 * ------------------------------------------------------------------------ 11664 * jQuery 11665 * ------------------------------------------------------------------------ 11666 */ 11667 11668 $$$1.fn[NAME] = Tab._jQueryInterface; 11669 $$$1.fn[NAME].Constructor = Tab; 11670 11671 $$$1.fn[NAME].noConflict = function () { 11672 $$$1.fn[NAME] = JQUERY_NO_CONFLICT; 11673 return Tab._jQueryInterface; 11674 }; 11675 11676 return Tab; 11677 }($); 11678 11679 /** 11680 * -------------------------------------------------------------------------- 11681 * Bootstrap (v4.1.3): index.js 11682 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 11683 * -------------------------------------------------------------------------- 11684 */ 11685 11686 (function ($$$1) { 11687 if (typeof $$$1 === 'undefined') { 11688 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 11689 } 11690 11691 var version = $$$1.fn.jquery.split(' ')[0].split('.'); 11692 var minMajor = 1; 11693 var ltMajor = 2; 11694 var minMinor = 9; 11695 var minPatch = 1; 11696 var maxMajor = 4; 11697 11698 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 11699 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 11700 } 11701 })($); 11702 11703 exports.Util = Util; 11704 exports.Alert = Alert; 11705 exports.Button = Button; 11706 exports.Carousel = Carousel; 11707 exports.Collapse = Collapse; 11708 exports.Dropdown = Dropdown; 11709 exports.Modal = Modal; 11710 exports.Popover = Popover; 11711 exports.Scrollspy = ScrollSpy; 11712 exports.Tab = Tab; 11713 exports.Tooltip = Tooltip; 11714 11715 Object.defineProperty(exports, '__esModule', { value: true }); 11716 11717}))); 11718//# sourceMappingURL=bootstrap.bundle.js.map 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750/* 11751 * jQuery Hotkeys Plugin 11752 * Copyright 2010, John Resig 11753 * Dual licensed under the MIT or GPL Version 2 licenses. 11754 * 11755 * Based upon the plugin by Tzury Bar Yochay: 11756 * http://github.com/tzuryby/hotkeys 11757 * 11758 * Original idea by: 11759 * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ 11760 */ 11761 11762/* 11763 * One small change is: now keys are passed by object { keys: '...' } 11764 * Might be useful, when you want to pass some other data to your handler 11765 */ 11766 11767(function(jQuery) { 11768 11769 jQuery.hotkeys = { 11770 version: "0.8", 11771 11772 specialKeys: { 11773 8: "backspace", 11774 9: "tab", 11775 10: "return", 11776 13: "return", 11777 16: "shift", 11778 17: "ctrl", 11779 18: "alt", 11780 19: "pause", 11781 20: "capslock", 11782 27: "esc", 11783 32: "space", 11784 33: "pageup", 11785 34: "pagedown", 11786 35: "end", 11787 36: "home", 11788 37: "left", 11789 38: "up", 11790 39: "right", 11791 40: "down", 11792 45: "insert", 11793 46: "del", 11794 59: ";", 11795 61: "=", 11796 96: "0", 11797 97: "1", 11798 98: "2", 11799 99: "3", 11800 100: "4", 11801 101: "5", 11802 102: "6", 11803 103: "7", 11804 104: "8", 11805 105: "9", 11806 106: "*", 11807 107: "+", 11808 109: "-", 11809 110: ".", 11810 111: "/", 11811 112: "f1", 11812 113: "f2", 11813 114: "f3", 11814 115: "f4", 11815 116: "f5", 11816 117: "f6", 11817 118: "f7", 11818 119: "f8",
11819 120: "f9", 11820 121: "f10", 11821 122: "f11", 11822 123: "f12", 11823 144: "numlock", 11824 145: "scroll", 11825 173: "-", 11826 186: ";", 11827 187: "=", 11828 188: ",", 11829 189: "-", 11830 190: ".", 11831 191: "/", 11832 192: "`", 11833 219: "[", 11834 220: "\\", 11835 221: "]", 11836 222: "'" 11837 }, 11838 11839 shiftNums: { 11840 "`": "~", 11841 "1": "!", 11842 "2": "@", 11843 "3": "#", 11844 "4": "$", 11845 "5": "%", 11846 "6": "^", 11847 "7": "&", 11848 "8": "*", 11849 "9": "(", 11850 "0": ")", 11851 "-": "_", 11852 "=": "+", 11853 ";": ": ", 11854 "'": "\"", 11855 ",": "<", 11856 ".": ">", 11857 "/": "?", 11858 "\\": "|" 11859 }, 11860 11861 // excludes: button, checkbox, file, hidden, image, password, radio, reset, search, submit, url 11862 textAcceptingInputTypes: ["text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime", "datetime-local", "search", "color", "tel"], 11863 11864 options: { 11865 filterTextInputs: true 11866 } 11867 }; 11868 11869 function keyHandler(handleObj) { 11870 if (typeof handleObj.data === "string") { 11871 handleObj.data = { 11872 keys: handleObj.data 11873 }; 11874 } 11875 11876 // Only care when a possible input has been specified 11877 if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string") { 11878 return; 11879 } 11880 11881 var origHandler = handleObj.handler, 11882 keys = handleObj.data.keys.toLowerCase().split(" "); 11883 11884 handleObj.handler = function(event) { 11885 // Don't fire in text-accepting inputs that we didn't directly bind to 11886 if (this !== event.target && (/textarea|select/i.test(event.target.nodeName) || (jQuery.hotkeys.options.filterTextInputs && jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) { 11887 return; 11888 } 11889 11890 var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which], 11891 character = String.fromCharCode(event.which).toLowerCase(), 11892 modif = "", 11893 possible = {}; 11894 11895 jQuery.each(["alt", "ctrl", "shift"], function(index, specialKey) { 11896 11897 if (event[specialKey + 'Key'] && special !== specialKey) { 11898 modif += specialKey + '+'; 11899 } 11900 }); 11901 11902 // metaKey is triggered off ctrlKey erronously 11903 if (event.metaKey && !event.ctrlKey && special !== "meta") { 11904 modif += "meta+"; 11905 } 11906 11907 if (event.metaKey && special !== "meta" && modif.indexOf("alt+ctrl+shift+") > -1) { 11908 modif = modif.replace("alt+ctrl+shift+", "hyper+"); 11909 } 11910 11911 if (special) { 11912 possible[modif + special] = true; 11913 } else { 11914 possible[modif + character] = true; 11915 possible[modif + jQuery.hotkeys.shiftNums[character]] = true; 11916 11917 // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" 11918 if (modif === "shift+") { 11919 possible[jQuery.hotkeys.shiftNums[character]] = true; 11920 } 11921 } 11922 11923 for (var i = 0, l = keys.length; i < l; i++) { 11924 if (possible[keys[i]]) { 11925 return origHandler.apply(this, arguments); 11926 } 11927 } 11928 }; 11929 } 11930 11931 jQuery.each(["keydown", "keyup", "keypress"], function() { 11932 jQuery.event.special[this] = { 11933 add: keyHandler 11934 }; 11935 }); 11936 11937})(this.jQuery); 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993(function(jQuery) { 11994 jQuery.fn.ellipsis = function(lines, enableUpdating, moreText, lessText) { 11995 return jQuery(this).each(function() { 11996 var el = jQuery(this); 11997 var resetDescription = function(height, originalText) { 11998 el.html(originalText); 11999 el.animate({ 12000 "height": height 12001 }, "normal", null, function() { 12002 el.ellipsis(true, true, moreText, lessText); 12003 }); 12004 }; 12005 12006 if (el.css("overflow") == "hidden") { 12007 12008 var originalText = el.html();
12009 var availWidth = el.width(); 12010 var availHeight = el.height(); 12011 12012 12013 var t = jQuery(this.cloneNode(true)) 12014 .hide() 12015 .css({ 12016 'position': 'absolute', 12017 'overflow': 'visible', 12018 'max-width': 'none', 12019 'max-height': 'none' 12020 }); 12021 if (lines) t.css("height", "auto").width(availWidth); 12022 else t.css("width", "auto"); 12023 el.after(t); 12024 12025 12026 var fullHeight = t.height(); 12027 12028 var avail = (lines) ? availHeight : availWidth; 12029 var test = (lines) ? t.height() : t.width(); 12030 var foundMin = false, 12031 foundMax = false; 12032 if (test > avail) { 12033 //Binary search style trimming of the temp element to find its optimal size 12034 var min = 0; 12035 var max = originalText.length; 12036 while (min <= max) { 12037 var trimLocation = (min + max) / 2; 12038 var text = originalText.substr(0, trimLocation); 12039 t.html(text + "…"); 12040 12041 test = (lines) ? t.height() : t.width(); 12042 if (test > avail) { 12043 if (foundMax) 12044 foundMin = true; 12045 12046 max = trimLocation - 1; 12047 if (min > max) { 12048 //If we would be ending decrement the min and regenerate the text so we don't end with a 12049 //slightly larger text than there is space for 12050 trimLocation = (max + max - 2) / 2; 12051 text = originalText.substr(0, trimLocation); 12052 t.html(text + "…"); 12053 break; 12054 } 12055 } else if (test < avail) { 12056 min = trimLocation + 1; 12057 } else { 12058 if (foundMin && foundMax && ((max - min) / max < .2)) 12059 break; 12060 foundMax = true; 12061 min = trimLocation + 1; 12062 } 12063 } 12064 } 12065 12066 el.html(t.html()); 12067 t.remove(); 12068 12069 12070 12071 if (enableUpdating == true) { 12072 var oldW = el.width(); 12073 var oldH = el.height(); 12074 el.one("resize", function() { 12075 if (el.width() != oldW || (lines && el.height != oldH)) { 12076 el.html(originalText); 12077 el.ellipsis(lines, enableUpdating, moreText, lessText); 12078 } 12079 }); 12080 } 12081 } 12082 12083 }); 12084 }; 12085})(jQuery); 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122/* 12123 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 12124 * 12125 * Uses the built in easing capabilities added In jQuery 1.1 12126 * to offer multiple easing options 12127 * 12128 * TERMS OF USE - jQuery Easing 12129 * 12130 * Open source under the BSD License. 12131 * 12132 * Copyright © 2008 George McGinley Smith 12133 * All rights reserved. 12134 * 12135 * Redistribution and use in source and binary forms, with or without modification, 12136 * are permitted provided that the following conditions are met: 12137 * 12138 * Redistributions of source code must retain the above copyright notice, this list of 12139 * conditions and the following disclaimer. 12140 * Redistributions in binary form must reproduce the above copyright notice, this list 12141 * of conditions and the following disclaimer in the documentation and/or other materials 12142 * provided with the distribution. 12143 * 12144 * Neither the name of the author nor the names of contributors may be used to endorse 12145 * or promote products derived from this software without specific prior written permission. 12146 * 12147 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 12148 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 12149 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 12150 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,308 bytes, lines 12151-12284
12151 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 12152 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 12153 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 12154 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 12155 * OF THE POSSIBILITY OF SUCH DAMAGE. 12156 * 12157 */ 12158 12159// t: current time, b: begInnIng value, c: change In value, d: duration 12160jQuery.easing['jswing'] = jQuery.easing['swing']; 12161 12162jQuery.extend(jQuery.easing, { 12163 def: 'easeOutQuad', 12164 swing: function(x, t, b, c, d) { 12165 //alert(jQuery.easing.default); 12166 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 12167 }, 12168 easeInQuad: function(x, t, b, c, d) { 12169 return c * (t /= d) * t + b; 12170 }, 12171 easeOutQuad: function(x, t, b, c, d) { 12172 return -c * (t /= d) * (t - 2) + b; 12173 }, 12174 easeInOutQuad: function(x, t, b, c, d) { 12175 if ((t /= d / 2) < 1) return c / 2 * t * t + b; 12176 return -c / 2 * ((--t) * (t - 2) - 1) + b; 12177 }, 12178 easeInCubic: function(x, t, b, c, d) { 12179 return c * (t /= d) * t * t + b; 12180 }, 12181 easeOutCubic: function(x, t, b, c, d) { 12182 return c * ((t = t / d - 1) * t * t + 1) + b; 12183 }, 12184 easeInOutCubic: function(x, t, b, c, d) { 12185 if ((t /= d / 2) < 1) return c / 2 * t * t * t + b; 12186 return c / 2 * ((t -= 2) * t * t + 2) + b; 12187 }, 12188 easeInQuart: function(x, t, b, c, d) { 12189 return c * (t /= d) * t * t * t + b; 12190 }, 12191 easeOutQuart: function(x, t, b, c, d) { 12192 return -c * ((t = t / d - 1) * t * t * t - 1) + b; 12193 }, 12194 easeInOutQuart: function(x, t, b, c, d) { 12195 if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b; 12196 return -c / 2 * ((t -= 2) * t * t * t - 2) + b; 12197 }, 12198 easeInQuint: function(x, t, b, c, d) { 12199 return c * (t /= d) * t * t * t * t + b; 12200 }, 12201 easeOutQuint: function(x, t, b, c, d) { 12202 return c * ((t = t / d - 1) * t * t * t * t + 1) + b; 12203 }, 12204 easeInOutQuint: function(x, t, b, c, d) { 12205 if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b; 12206 return c / 2 * ((t -= 2) * t * t * t * t + 2) + b; 12207 }, 12208 easeInSine: function(x, t, b, c, d) { 12209 return -c * Math.cos(t / d * (Math.PI / 2)) + c + b; 12210 }, 12211 easeOutSine: function(x, t, b, c, d) { 12212 return c * Math.sin(t / d * (Math.PI / 2)) + b; 12213 }, 12214 easeInOutSine: function(x, t, b, c, d) { 12215 return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b; 12216 }, 12217 easeInExpo: function(x, t, b, c, d) { 12218 return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b; 12219 }, 12220 easeOutExpo: function(x, t, b, c, d) { 12221 return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; 12222 }, 12223 easeInOutExpo: function(x, t, b, c, d) { 12224 if (t == 0) return b; 12225 if (t == d) return b + c; 12226 if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b; 12227 return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b; 12228 }, 12229 easeInCirc: function(x, t, b, c, d) { 12230 return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b; 12231 }, 12232 easeOutCirc: function(x, t, b, c, d) { 12233 return c * Math.sqrt(1 - (t = t / d - 1) * t) + b; 12234 }, 12235 easeInOutCirc: function(x, t, b, c, d) { 12236 if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b; 12237 return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b; 12238 }, 12239 easeInElastic: function(x, t, b, c, d) { 12240 var s = 1.70158; 12241 var p = 0; 12242 var a = c; 12243 if (t == 0) return b; 12244 if ((t /= d) == 1) return b + c; 12245 if (!p) p = d * .3; 12246 if (a < Math.abs(c)) { 12247 a = c; 12248 var s = p / 4; 12249 } else var s = p / (2 * Math.PI) * Math.asin(c / a); 12250 return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; 12251 }, 12252 easeOutElastic: function(x, t, b, c, d) { 12253 var s = 1.70158; 12254 var p = 0; 12255 var a = c; 12256 if (t == 0) return b; 12257 if ((t /= d) == 1) return b + c; 12258 if (!p) p = d * .3; 12259 if (a < Math.abs(c)) { 12260 a = c; 12261 var s = p / 4; 12262 } else var s = p / (2 * Math.PI) * Math.asin(c / a); 12263 return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b; 12264 }, 12265 easeInOutElastic: function(x, t, b, c, d) { 12266 var s = 1.70158; 12267 var p = 0; 12268 var a = c; 12269 if (t == 0) return b; 12270 if ((t /= d / 2) == 2) return b + c; 12271 if (!p) p = d * (.3 * 1.5); 12272 if (a < Math.abs(c)) { 12273 a = c; 12274 var s = p / 4; 12275 } else var s = p / (2 * Math.PI) * Math.asin(c / a); 12276 if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; 12277 return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b; 12278 }, 12279 easeInBack: function(x, t, b, c, d, s) { 12280 if (s == undefined) s = 1.70158; 12281 return c * (t /= d) * t * ((s + 1) * t - s) + b; 12282 }, 12283 easeOutBack: function(x, t, b, c, d, s) { 12284 if (s == undefined) s = 1.70158;
12285 return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; 12286 }, 12287 easeInOutBack: function(x, t, b, c, d, s) { 12288 if (s == undefined) s = 1.70158; 12289 if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b; 12290 return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b; 12291 }, 12292 easeInBounce: function(x, t, b, c, d) { 12293 return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b; 12294 }, 12295 easeOutBounce: function(x, t, b, c, d) { 12296 if ((t /= d) < (1 / 2.75)) { 12297 return c * (7.5625 * t * t) + b; 12298 } else if (t < (2 / 2.75)) { 12299 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b; 12300 } else if (t < (2.5 / 2.75)) { 12301 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b; 12302 } else { 12303 return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b; 12304 } 12305 }, 12306 easeInOutBounce: function(x, t, b, c, d) { 12307 if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b; 12308 return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b; 12309 } 12310}); 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350/*! SmartMenus jQuery Plugin - v1.0.0-beta1 - June 1, 2015 12351 * http://www.smartmenus.org/ 12352 * Copyright 2015 Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */ 12353 12354 (function(t){function i(i){var r=".smartmenus_mouse";if(h||i)h&&i&&(t(document).unbind(r),h=!1);else{var u=!0,l=null;t(document).bind(o([["mousemove",function(i){var e={x:i.pageX,y:i.pageY,timeStamp:(new Date).getTime()};if(l){var s=Math.abs(l.x-e.x),o=Math.abs(l.y-e.y);if((s>0||o>0)&&2>=s&&2>=o&&300>=e.timeStamp-l.timeStamp&&(n=!0,u)){var r=t(i.target).closest("a");r.is("a")&&t.each(a,function(){return t.contains(this.$root[0],r[0])?(this.itemEnter({currentTarget:r[0]}),!1):void 0}),u=!1}}l=e}],[s()?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut",function(t){e(t.originalEvent)&&(n=!1)}]],r)),h=!0}}function e(t){return!/^(4|mouse)$/.test(t.pointerType)}function s(){return"ontouchstart"in window}function o(i,e){e||(e="");var s={};return t.each(i,function(t,i){s[i[0].split(" ").join(e+" ")+e]=i[1]}),s}var a=[],r=!!window.createPopup,n=!1,h=!1;t.SmartMenus=function(i,e){this.$root=t(i),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.isTouchScrolling=!1,this.wasCollapsible=!1,this.init()},t.extend(t.SmartMenus,{hideAll:function(){t.each(a,function(){this.menuHideAll()})},destroy:function(){for(;a.length;)a[0].destroy();i(!0)},prototype:{init:function(e){var s=this;if(!e){a.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var r=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).bind(o([["mouseover focusin",t.proxy(this.rootOver,this)],["mouseout focusout",t.proxy(this.rootOut,this)],["keydown",t.proxy(this.rootKeyDown,this)]],r)).delegate("a",o([["mouseenter",t.proxy(this.itemEnter,this)],["mouseleave",t.proxy(this.itemLeave,this)],["mousedown",t.proxy(this.itemDown,this)],["focus",t.proxy(this.itemFocus,this)],["blur",t.proxy(this.itemBlur,this)],["click",t.proxy(this.itemClick,this)],["touchend",t.proxy(this.itemTouchEnd,this)]],r)),r+=this.rootId,this.opts.hideOnClick&&t(document).bind(o([["touchstart",t.proxy(this.docTouchStart,this)],["touchmove",t.proxy(this.docTouchMove,this)],["touchend",t.proxy(this.docTouchEnd,this)],["click",t.proxy(this.docClick,this)]],r)),t(window).bind(o([["resize orientationchange",t.proxy(this.winResize,this)]],r)),this.opts.subIndicators&&(this.$subArrow=t("<span/>
12354").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),i()}if(this.$firstSub=this.$root.find("ul").each(function(){s.menuInit(t(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var n=/(index|default)\.[^#\?\/]*/i,h=/#.*/,u=window.location.href.replace(n,""),l=u.replace(h,"");this.$root.find("a").each(function(){var i=this.href.replace(n,""),e=t(this);(i==u||i==l)&&(e.addClass("current"),s.opts.markCurrentTree&&e.parentsUntil("[data-smartmenus-id]","ul").each(function(){t(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(i){if(!i){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").unbind(e).undelegate(e),e+=this.rootId,t(document).unbind(e),t(window).unbind(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var s=this;this.$root.find("ul").each(function(){var i=t(this);i.dataSM("scroll-arrows")&&i.dataSM("scroll-arrows").remove(),i.dataSM("shown-before")&&((s.opts.subMenusMinWidth||s.opts.subMenusMaxWidth)&&i.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),i.dataSM("scroll-arrows")&&i.dataSM("scroll-arrows").remove(),i.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==i.attr("id").indexOf(s.accessIdPrefix)&&i.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var i=t(this);0==i.attr("id").indexOf(s.accessIdPrefix)&&i.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),i||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),a.splice(t.inArray(this,a),1))},disable:function(i){if(!this.disabled){if(this.menuHideAll(),!i&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=t('<div class="sm-jquery-disable-overlay"/>').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(i){return this.isTouchScrolling?(this.isTouchScrolling=!1,void 0):((this.visibleSubMenus.length&&!t.contains(this.$root[0],i.target)||t(i.target).is("a"))&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&t.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var i=this;this.hideTimeout=setTimeout(function(){i.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var i=t.originalEvent.touches[0];this.lastTouch.x2=i.pageX,this.lastTouch.y2=i.pageY}},docTouchStart:function(t){var i=t.originalEvent.touches[0];this.lastTouch={x1:i.pageX,y1:i.pageY,target:i.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(i){for(var e=t(i).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,i){var e;"none"==t.css("display")&&(e={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(i?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=i?t[0].offsetHeight:t[0].offsetWidth),e&&t.hide().css(e),o},getStartZIndex:function(t){var i=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(i)&&(i=parseInt(this.$root.css("z-index"))),isNaN(i)?1:i},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var i=t?"Height":"Width",e=document.documentElement["client"+i],s=window["inner"+i];return s&&(e=Math.min(e,s)),e}
12354,getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"block"==this.$firstLink.css("display")},isFixed:function(){var i="fixed"==this.$root.css("position");return i||this.$root.parentsUntil("body").each(function(){return"fixed"==t(this).css("position")?(i=!0,!1):void 0}),i},isLinkInMegaMenu:function(i){return t(this.getClosestMenu(i[0])).hasClass("mega-menu")},isTouchMode:function(){return!n||this.isCollapsible()},itemActivate:function(i,e){var s=i.closest("ul"),o=s.dataSM("level");if(o>1&&(!this.activatedItems[o-2]||this.activatedItems[o-2][0]!=s.dataSM("parent-a")[0])){var a=this;t(s.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(s).each(function(){a.itemActivate(t(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[o-1]&&this.activatedItems[o-1][0]==i[0]?o:o-1),this.activatedItems[o-1]=i,this.$root.triggerHandler("activate.smapi",i[0])!==!1){var r=i.dataSM("sub");r&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(r)}},itemBlur:function(i){var e=t(i.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(i){if(this.isTouchScrolling)return this.isTouchScrolling=!1,i.stopPropagation(),!1;var e=t(i.currentTarget);if(this.handleItemEvents(e)){if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;e.dataSM("href")&&e.attr("href",e.dataSM("href")).removeDataSM("href");var s=t(i.target).is("span.sub-arrow"),o=e.dataSM("sub");if(o&&!o.is(":visible")){if(this.itemActivate(e),o.is(":visible"))return this.focusActivated=!0,!1}else if(this.isCollapsible()&&s)return this.itemActivate(e),this.menuHide(o),!1;return this.opts.showOnClick&&o&&2==o.dataSM("level")?(this.clickActivated=!0,this.menuShow(o),!1):e.hasClass("disabled")?!1:this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(i){var e=t(i.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(i){var e=t(i.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var s=this;this.showTimeout=setTimeout(function(){s.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(i){var e=t(i.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(i){var e=t(i.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},itemTouchEnd:function(i){var e=t(i.currentTarget);if(this.handleItemEvents(e)){var s=e.dataSM("sub");"#"!==e.attr("href").charAt(0)&&s&&!s.is(":visible")&&e.dataSM("href",e.attr("href")).attr("href","#")}},menuHide:function(i){if(this.$root.triggerHandler("beforehide.smapi",i[0])!==!1&&(i.stop(!0,!0),"none"!=i.css("display"))){var e=function(){i.css("z-index","")};this.isCollapsible()?this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,i,e):i.hide(this.opts.collapsibleHideDuration,e):this.opts.hideFunction?this.opts.hideFunction.call(this,i,e):i.hide(this.opts.hideDuration,e),i.dataSM("ie-shim")&&i.dataSM("ie-shim").remove(),i.dataSM("scroll")&&(this.menuScrollStop(i),i.css({"touch-action":"","-ms-touch-action":""}).unbind(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),i.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","fal
12354se"),i.attr({"aria-expanded":"false","aria-hidden":"true"});var s=i.dataSM("level");this.activatedItems.splice(s-1,1),this.visibleSubMenus.splice(t.inArray(i,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",i[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,i=this.visibleSubMenus.length-1;i>=t;i--)this.menuHide(this.visibleSubMenus[i]);this.opts.isPopup&&(this.$root.stop(!0,!0),this.$root.is(":visible")&&(this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration),this.$root.dataSM("ie-shim")&&this.$root.dataSM("ie-shim").remove())),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0},menuHideSubMenus:function(t){for(var i=this.activatedItems.length-1;i>=t;i--){var e=this.activatedItems[i].dataSM("sub");e&&this.menuHide(e)}},menuIframeShim:function(i){r&&this.opts.overlapControlsInIE&&!i.dataSM("ie-shim")&&i.dataSM("ie-shim",t("<iframe/>").attr({src:"javascript:0",tabindex:-9}).css({position:"absolute",top:"auto",left:"0",opacity:0,border:"0"}))},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var i=2,e=t[0];(e=e.parentNode.parentNode)!=this.$root[0];)i++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",i).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(i){var e,a,r=i.dataSM("parent-a"),n=r.closest("li"),h=n.parent(),u=i.dataSM("level"),l=this.getWidth(i),c=this.getHeight(i),d=r.offset(),m=d.left,p=d.top,f=this.getWidth(r),v=this.getHeight(r),b=t(window),S=b.scrollLeft(),g=b.scrollTop(),M=this.getViewportWidth(),w=this.getViewportHeight(),T=h.hasClass("sm")&&!h.hasClass("sm-vertical"),I=this.opts.rightToLeftSubMenus&&!n.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&n.is("[data-sm-reverse]"),$=2==u?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,x=2==u?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(T?(e=I?f-l-$:$,a=this.opts.bottomToTopSubMenus?-c-x:v+x):(e=I?$-l:f-$,a=this.opts.bottomToTopSubMenus?v-x-c:x),this.opts.keepInViewport){var y=m+e,C=p+a;if(I&&S>y?e=T?S-y+e:f-$:!I&&y+l>S+M&&(e=T?S+M-l-y+e:$-l),T||(w>c&&C+c>g+w?a+=g+w-c-C:(c>=w||g>C)&&(a+=g-C)),T&&(C+c>g+w+.49||g>C)||!T&&c>w+.49){var H=this;i.dataSM("scroll-arrows")||i.dataSM("scroll-arrows",t([t('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0],t('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]).bind({mouseenter:function(){i.dataSM("scroll").up=t(this).hasClass("scroll-up"),H.menuScroll(i)},mouseleave:function(t){H.menuScrollStop(i),H.menuScrollOut(i,t)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(i));var A=".smartmenus_scroll";i.dataSM("scroll",{step:1,itemH:v,subH:c,arrowDownH:this.getHeight(i.dataSM("scroll-arrows").eq(1))}).bind(o([["mouseover",function(t){H.menuScrollOver(i,t)}],["mouseout",function(t){H.menuScrollOut(i,t)}],["mousewheel DOMMouseScroll",function(t){H.menuScrollMousewheel(i,t)}]],A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(i.css("border-left-width"))||0),width:l-(parseInt(i.css("border-left-width"))||0)-(parseInt(i.css("border-right-width"))||0),zIndex:i.css("z-index")}).eq(T&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()&&i.css({"touch-action":"none","-ms-touch-action":"none"}).bind(o([[s()?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp",function(t){H.menuScrollTouch(i,t)}]],A))}}i.css({top:"auto",left:"0",marginLeft:e,marginTop:a-v}),this.menuIframeShim(i),i.dataSM("ie-shim")&&i.dataSM("ie-shim").css({zIndex:i.css("z-index"),width:l,height:c,marginLeft:e,marginTop:a-v})},menuScroll:function(t,i,e){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),r=parseFloat(t.css("margin-top")),h=o.up?o.upEnd:o.downEnd;
12354if(!i&&o.velocity){if(o.velocity*=.9,s=o.velocity,.5>s)return this.menuScrollStop(t),void 0}else s=e||(i||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var u=t.dataSM("level");this.activatedItems[u-1]&&this.activatedItems[u-1].dataSM("sub")&&this.activatedItems[u-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(u-1);var l=o.up&&r>=h||!o.up&&h>=r?r:Math.abs(h-r)>s?r+(o.up?s:-s):h;if(t.add(t.dataSM("ie-shim")).css("margin-top",l),n&&(o.up&&l>o.downEnd||!o.up&&o.upEnd>l)&&a.eq(o.up?1:0).show(),l==h)n&&a.eq(o.up?0:1).hide(),this.menuScrollStop(t);else if(!i){this.opts.scrollAccelerate&&o.step<this.opts.scrollStep&&(o.step+=.5);var c=this;this.scrollTimeout=setTimeout(function(){c.menuScroll(t)},this.opts.scrollInterval)}},menuScrollMousewheel:function(t,i){if(this.getClosestMenu(i.target)==t[0]){i=i.originalEvent;var e=(i.wheelDelta||-i.detail)>0;t.dataSM("scroll-arrows").eq(e?0:1).is(":visible")&&(t.dataSM("scroll").up=e,this.menuScroll(t,!0))}i.preventDefault()},menuScrollOut:function(i,e){n&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(i[0]==e.relatedTarget||t.contains(i[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==i[0]||i.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,i){if(n&&!/^scroll-(up|down)/.test(i.target.className)&&this.getClosestMenu(i.target)==t[0]){this.menuScrollRefreshData(t);var e=t.dataSM("scroll");t.dataSM("scroll-arrows").eq(0).css("margin-top",e.upEnd).end().eq(1).css("margin-top",e.downEnd+e.subH-e.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(i){var e=i.dataSM("scroll"),s=t(window),o=s.scrollTop()-i.dataSM("parent-a").offset().top-e.itemH;t.extend(e,{upEnd:o,downEnd:o+this.getViewportHeight()-e.subH})},menuScrollStop:function(i){return this.scrollTimeout?(clearTimeout(this.scrollTimeout),this.scrollTimeout=0,t.extend(i.dataSM("scroll"),{step:1,velocity:0}),!0):void 0},menuScrollTouch:function(i,s){if(s=s.originalEvent,e(s)){var o=this.getTouchPoint(s);if(this.getClosestMenu(o.target)==i[0]){var a=i.dataSM("scroll");if(/(start|down)$/i.test(s.type))this.menuScrollStop(i)?(s.preventDefault(),this.isTouchScrolling=!0):this.isTouchScrolling=!1,this.menuScrollRefreshData(i),t.extend(a,{touchY:o.pageY,touchTimestamp:s.timeStamp,velocity:0});else if(/move$/i.test(s.type)){var r=a.touchY;void 0!==r&&r!=o.pageY&&(this.isTouchScrolling=!0,t.extend(a,{up:o.pageY>r,touchY:o.pageY,touchTimestamp:s.timeStamp,velocity:a.velocity+.5*Math.abs(o.pageY-r)}),this.menuScroll(i,!0,Math.abs(a.touchY-r))),s.preventDefault()}else void 0!==a.touchY&&(120>s.timeStamp-a.touchTimestamp&&a.velocity>0&&(a.velocity*=.5,this.menuScrollStop(i),this.menuScroll(i),s.preventDefault()),delete a.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0).stop(!0,!0),!t.is(":visible"))){var i=t.dataSM("parent-a");if((this.opts.keepHighlighted||this.isCollapsible())&&i.addClass("highlighted"),this.isCollapsible())t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var e=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),e>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t),t.dataSM("ie-shim")&&t.dataSM("ie-shim").insertBefore(t)}var s=function(){t.css("overflow","")};this.isCollapsible()?this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,s):t.show(this.opts.collapsibleShowDuration,s):this.opts.showFunction?this.opts.showFunction.call(this,t,s):t.show(this.opts.showDuration,s),i.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var i=this;this.hideTimeout=setTimeout(function(){i.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,i){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0).stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:i}
12354),this.menuIframeShim(this.$root),this.$root.dataSM("ie-shim")&&this.$root.dataSM("ie-shim").css({zIndex:this.$root.css("z-index"),width:this.getWidth(this.$root),height:this.getHeight(this.$root),left:t,top:i}).insertBefore(this.$root);var e=this,s=function(){e.$root.css("overflow","")};this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(i){if(this.handleEvents())switch(i.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var s=e.dataSM("sub");s&&this.menuHide(s)}break;case 32:var o=t(i.target);if(o.is("a")&&this.handleItemEvents(o)){var s=o.dataSM("sub");s&&!s.is(":visible")&&(this.itemClick({currentTarget:i.target}),i.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var i=this;this.hideTimeout=setTimeout(function(){i.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var i=this.isCollapsible();this.wasCollapsible&&i||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=i}}else if(this.$disableOverlay){var e=this.$root.offset();this.$disableOverlay.css({top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),t.fn.dataSM=function(t,i){return i?this.data(t+"_smartmenus",i):this.data(t+"_smartmenus")},t.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},t.fn.smartmenus=function(i){if("string"==typeof i){var e=arguments,s=i;return Array.prototype.shift.call(e),this.each(function(){var i=t(this).data("smartmenus");i&&i[s]&&i[s].apply(i,e)})}var o=t.extend({},t.fn.smartmenus.defaults,i);return this.each(function(){new t.SmartMenus(this,o)})},t.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"prepend",subIndicatorsText:"+",scrollStep:30,scrollInterval:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,i){t.fadeOut(200,i)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,i){t.slideDown(200,i)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,i){t.slideUp(200,i)},showOnClick:!1,hideOnClick:!0,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,overlapControlsInIE:!0}})(jQuery); 12355 12356 12357 12358/*! SmartMenus jQuery Plugin Keyboard Addon - v0.2.0 - June 1, 2015 12359 * http://www.smartmenus.org/ 12360 * Copyright 2015 Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */ 12361 12362 (function(t){function e(t){return t.find("> li > a:not(.disabled), > li > :not(ul) a:not(.disabled)").eq(0)}function s(t){return t.find("> li > a:not(.disabled), > li > :not(ul) a:not(.disabled)").eq(-1)}function i(t,s){var i=t.nextAll("li").find("> a:not(.disabled), > :not(ul) a:not(.disabled)").eq(0);return s||i.length?i:e(t.parent())}function a(e,i){var a=e.prevAll("li").find("> a:not(.disabled), > :not(ul) a:not(.disabled)").eq(/^1\.8\./.test(t.fn.jquery)?0:-1);return i||a.length?a:s(e.parent())}t.fn.focusSM=function(){return this.length&&this[0].focus&&this[0].focus(),this},t.extend(t.SmartMenus.Keyboard={},{docKeydown:function(o){var n=o.keyCode;if(/^(37|38|39|40)$/.test(n)){var r=t(this),h=r.data("smartmenus"),u=t(o.target);if(h&&u.is("a")&&h.handleItemEvents(u)){var l=u.closest("li"),d=l.parent(),c=d.dataSM("level");switch(r.hasClass("sm-rtl")&&(37==n?n=39:39==n&&(n=37)),n){case 37:if(h.isCollapsible())break;c>2||2==c&&r.hasClass("sm-vertical")?h.activatedItems[c-2].focusSM():r.hasClass("sm-vertical")||a((h.activatedItems[0]||u).closest("li")).focusSM();break;case 38:if(h.isCollapsible()){var m;c>1&&(m=e(d)).length&&u[0]==m[0]?h.activatedItems[c-2].focusSM():a(l).focusSM()}else 1==c&&!r.hasClass("sm-vertical")&&h.opts.bottomToTopSubMenus?(!h.activatedItems[0]&&u.dataSM("sub")&&(h.itemActivate(u),u.dataSM("sub").is(":visible")&&(h.focusActivated=!0)),h.activatedItems[0]&&h.activatedItems[0].dataSM("sub")&&h.activatedItems[0].dataSM("sub").is(":visible")&&!h.activatedItems[0].dataSM("sub").hasClass("mega-menu")&&s(h.activatedItems[0].dataSM("sub")).focusSM()):(c>1||r.hasClass("sm-vertical"))&&a(l).focusSM();break;case 39:if(h.isCollapsible())break;1==c&&r.hasClass("sm-vertical")?(!h.activatedItems[0]&&u.dataSM("sub")&&(h.itemActivate(u),u.dataSM("sub").is(":visible")&&(h.focusActivated=!0)),h.activatedItems[0]&&h.activatedItems[0].dataSM("sub")&&h.activatedItems[0].dataSM("sub").is(":visible")&&!h.activatedItems[0].dataSM("sub").hasClass("mega-menu")&&e(h.activatedItems[0].dataSM("sub")).focusSM()):1!=c&&(!h.activatedItems[c-1]||h.activatedItems[c-1].dataSM("sub")&&h.activatedItems[c-1].dataSM("sub").is(":visible")&&!h.activatedItems[c-1].dataSM("sub").hasClass("mega-menu"))||r.hasClass("sm-vertical")?h.activatedItems[c-1]&&h.activatedItems[c-1].dataSM("sub")&&h.activatedItems[c-1].dataSM("sub").is(":visible")&&!h.activatedItems[c-1].dataSM("sub").hasClass("mega-menu")&&e(h.activatedItems[c-1].dataSM("sub")).focusSM():i((h.activatedItems[0]||u).closest("li")).focusSM();break;case 40:if(h.isCollapsible()){var p,f;if(h.activatedItems[c-1]&&h.activatedItems[c-1].dataSM("sub")&&h.activatedItems[c-1].dataSM("sub").is(":visible")&&!h.activatedItems[c-1].dataSM("sub").hasClass("mega-menu")&&(p=e(h.activatedItems[c-1].dataSM("sub"))).length)p.focusSM();else if(c>1&&(f=s(d)).length&&u[0]==f[0]){for(var v=h.activatedItems[c-2].closest("li"),b=null;v.is("li")&&!(b=i(v,!0)).length;)v=v.parent().parent();b.length?b.focusSM():e(r).focusSM()}else i(l).focusSM()}else 1!=c||r.hasClass("sm-vertical")||h.opts.bottomToTopSubMenus?(c>1||r.hasClass("sm-vertical"))&&i(l).focusSM():(!h.activatedItems[0]&&u.dataSM("sub")&&(h.itemActivate(u),u.dataSM("sub").is(":visible")&&(h.focusActivated=!0)),h.activatedItems[0]&&h.activatedItems[0].dataSM("sub")&&h.activatedItems[0].dataSM("sub").is(":visible")&&!h.activatedItems[0].dataSM("sub").hasClass("mega-menu")&&e(h.activatedItems[0].dataSM("sub")).focusSM())}o.stopPropagation(),o.preventDefault()}}}}),t(document).delegate("ul.sm","keydown.smartmenus",t.SmartMenus.Keyboard.docKeydown),t.extend(t.SmartMenus.prototype,{keyboardSetHotkey:function(s,i){var a=this;t(document).bind("keydown.smartmenus"+this.rootId,function(o){if
12362(s==o.keyCode){var n=!0;i&&("string"==typeof i&&(i=[i]),t.each(["ctrlKey","shiftKey","altKey","metaKey"],function(e,s){return t.inArray(s,i)>=0&&!o[s]||0>t.inArray(s,i)&&o[s]?(n=!1,!1):void 0})),n&&(e(a.$root).focusSM(),o.stopPropagation(),o.preventDefault())}})}})})(jQuery); 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 // onFocus: function() { 12416 // dojo.removeClass("calendarHelp", "wcag-hide"); 12417 // }, 12418 12419 // onBlur: function() { 12420 // dojo.addClass("calendarHelp", "wcag-hide"); 12421 // }, 12422 12423 12424//https://css-tricks.com/snippets/javascript/javascript-keycodes/ 12425 12426//http://stackoverflow.com/questions/5203407/javascript-multiple-keys-pressed-at-once 12427//http://stackoverflow.com/questions/5203407/javascript-multiple-keys-pressed-at-once 12428//http://stackoverflow.com/questions/5203407/javascript-multiple-keys-pressed-at-once 12429 //http://jsfiddle.net/vor0nwe/mkHsU/ 12430 //http://stackoverflow.com/questions/10655202/detect-multiple-keys-on-single-keypress-event-on-jquery 12431 12432///http://stackoverflow.com/questions/4954403/can-jquery-keypress-detect-more-than-one-key-at-the-same-time 12433jQuery.multipress = function (keys, handler) { 12434 'use strict'; 12435 12436 if (keys.length === 0) { 12437 return; 12438 } 12439 12440 var down = {}; 12441 jQuery(document).keydown(function (event) { 12442 event.stopPropagation(); 12443 down[event.keyCode] = true; 12444 }).keyup(function (event) { 12445 event.stopPropagation(); 12446 // Copy keys array, build array of pressed keys
12447 var remaining = keys.slice(0), 12448 pressed = Object.keys(down).map(function (num) { return parseInt(num, 10); }), 12449 indexOfKey; 12450 // Remove pressedKeys from remainingKeys 12451 jQuery.each(pressed, function (i, key) { 12452 if (down[key] === true) { 12453 down[key] = false; 12454 indexOfKey = remaining.indexOf(key); 12455 if (indexOfKey > -1) { 12456 remaining.splice(indexOfKey, 1); 12457 } 12458 } 12459 }); 12460 // If we hit all the keys, fire off handler 12461 if (remaining.length === 0) { 12462 handler(event); 12463 } 12464 }); 12465}; 12466 12467/* 12468 12469//$(function() { 12470$(document).ready(function(){ 12471 //$("#container_cal").focus(function() { 12472 $("#container_cal").focusin(function(){ 12473 $('#calendarHelp').removeClass('wcag-hide'); 12474 $('#calendarHelp').addClass('ical-focused'); 12475 }); 12476 //$("#container_cal").blur(function() { 12477 $("#container_cal").focusout(function(){ 12478 $('#calendarHelp').removeClass('ical-focused'); 12479 $('#calendarHelp').addClass('wcag-hide'); 12480 });
12481 //#container_cal:focus .calendarHelp 12482}); 12483*/ 12484 12485 12486/* 12487 * First plugin 12488 * 12489 * @author Maarten Hus 12490 */ 12491(function($) { 12492 var eventdates = {}; 12493 var last_focused_obj = null; 12494 12495 $.fn.ical = function(options) { 12496 $.fn.ical.defaults = { 12497 daynames: ['Pon', 'Wt', 'År', 'Czw', 'Pi', 'So', 'Ni'], //default short names for the days of the week 12498 monthnames: ['StyczeÅ', 'Luty', 'Marzec', 'KwiecieÅ', 'Maj', 'Czerwiec', 'Lipiec', 'SierpieÅ', 'WrzesieÅ', 'Październik', 'Listopad', 'GrudzieÅ'], 12499 startdate: new Date(), // The date the calender should take as start point 12500 eventdates: {}, 12501 last_focused_obj: null, 12502 calendarCreated: false, 12503 startOnSunday: false, 12504 beforeDay: function(insdate) {}, 12505 beforeMonth: function(insdate) {}, 12506 beforeYear: function(insdate) {} 12507 }; 12508 12509 options = $.extend({}, $.fn.ical.defaults, options); 12510 12511 return this.each(function() { 12512 var obj = $(this); //get the object 12513 eventdates = options.eventdates; 12514 12515 var insdate = options.startdate; //The date that gets used for calculating the month 12516 12517 createCalendar(obj, insdate); 12518 }); 12519 12520 /** 12521 * Create the calendar 12522 */ 12523 function createCalendar(obj, insdate) { 12524 obj.html(''); 12525 createNavigation(obj, insdate); 12526 createTable(obj); //create table 12527 addDatesToTable(obj, insdate); 12528 codabubble(); 12529 options.calendarCreated = true; 12530 } 12531 12532 /** 12533 * Create the navigation and handle its clicks 12534 */ 12535 function createNavigation(obj, insdate) { 12536 //$(document).off("keydown"); 12537 12538 //obj.prepend("<div id='nav-calendar'><div id='year'><span id='year-left-arrow' class='year-buttons'></span><span id='currentyear'>" + insdate.getFullYear() + "</span><span id='year-right-arrow' class='year-buttons'></span></div>" + "<div id='month'><span id='month-left-arrow'></span><span id='currentmonth'>" + options.monthnames[insdate.getMonth()] + "</span><span id='month-right-arrow'></span></div></div>"); 12539 // var html_top_cal = "<div id='nav-calendar'>" + 12540 // "<div id='year'>" + 12541 // "<a href='#'>" + 12542 // "<span class='wcag-hide'>poprzedni rok</span><i id='year-left-arrow' class='fa fa-angle-double-left'></i>" + 12543 // "</a>" + 12544 // "<span id='currentyear'>" + insdate.getFullYear() + "</span>" + 12545 // "<a href='#'>" + 12546 // "<span class='wcag-hide'>nastÄpny rok</span><i id='year-right-arrow' class='fa fa-angle-double-right'></i>" + 12547 // "</a>" + 12548 // "</div>" + 12549 // "<div id='month'>" + 12550 // "<a href='#'>" + 12551 // "<span class='wcag-hide'>poprzedni miesiÄ c</span><i id='month-left-arrow' class='fa fa-chevron-left'></i>" + 12552 // "</a>" + 12553 // "<span id='currentmonth'>" + options.monthnames[insdate.getMonth()] + "</span>" + 12554 // "<a href='#'>" + 12555 // "<span class='wcag-hide'>nastÄpny miesiÄ c</span><i id='month-right-arrow' class='fa fa-chevron-right'></i>" + 12556 // "</a>" + 12557 // "</div>" + 12558 // "</div>"; 12559 12560 12561 var html_top_cal = "<div id='nav-calendar'>" + 12562 "<div id='year'>" + 12563 "<a id='year-left-arrow' href='' tabindex='0'>" + 12564 "<span class='wcag-hide'>poprzedni rok</span><i class='fa fa-angle-double-left' aria-hidden='true'></i>" + 12565 "</a>" + 12566 "<span id='currentyear'>" + insdate.getFullYear() + "</span>" + 12567 "<a id='year-right-arrow' href='' tabindex='0'>" + 12568 "<span class='wcag-hide'>nastÄpny rok</span><i class='fa fa-angle-double-right' aria-hidden='true'></i>" + 12569 "</a>" + 12570 "</div>" + 12571 "<div id='month'>" + 12572 "<a id='month-left-arrow' href='' tabindex='0'>" + 12573 "<span class='wcag-hide'>poprzedni miesiÄ c</span><i class='fa fa-chevron-left' aria-hidden='true'></i>" + 12574 "</a>" + 12575 "<span id='currentmonth'>" + options.monthnames[insdate.getMonth()] + "</span>" + 12576 "<a id='month-right-arrow' href='' tabindex='0'>" + 12577 "<span class='wcag-hide'>nastÄpny miesiÄ c</span><i class='fa fa-chevron-right' aria-hidden='true'></i>" + 12578 "</a>" + 12579 "</div>" + 12580 "</div>"; 12581 12582 //obj.prepend("<div id='nav-calendar'><div id='year'><a href='#'><span class='wcag-hide'>poprzedni rok</span><i id='year-left-arrow' class='fa fa-angle-double-left'></i></a><span id='currentyear'>" + insdate.getFullYear() + "</span><a href='#'><span class='wcag-hide'>nastÄpny rok</span><i id='year-right-arrow' class='fa fa-angle-double-right'></i></a></div>" + "<div id='month'><a href='#'><span class='wcag-hide'>poprzedni miesiÄ c</span><i id='month-left-arrow' class='fa fa-chevron-left'></i></a><span id='currentmonth'>" + options.monthnames[insdate.getMonth()] + "</span><a href='#'><span class='wcag-hide'>nastÄpny miesiÄ c</span><i id='month-right-arrow' class='fa fa-chevron-right'></i></a></div></div>"); 12583 obj.prepend(html_top_cal);
12584 //obj.prepend("<ul id='calendarHelp' class='calendarHelp wcag-hide'><li class='wcag-hide'>Nawigacja w kalendarzu</li><li>Nawigacja pomiÄdzy datami: strzaÅki </li><li>NastÄpny miesiÄ c: Page-down </li><li>Poprzedni miesiÄ c: Page-up </li><li>NastÄpny rok: Alt+Page-down </li><li>Poprzedni rok: Alt+Page-up </li><li>Pierwszy dzieÅ miesiÄ ca: Home </li><li>Ostatni dzieÅ miesiÄ ca: End </li><li>Wybór daty: Enter, Spacja </li></ul>"); 12585 12586 //nastÄpny rok 12587 $("#year-right-arrow", obj).click(function(e) { 12588 e.preventDefault() 12589 12590 var month = insdate.getMonth() + 12; 12591 var presentMonth = insdate.getMonth(); 12592 var year; 12593 12594 if (month > 11) { 12595 month = presentMonth; 12596 year = insdate.getFullYear() + 1; 12597 options.beforeYear(formatDate(year, month, 1)); 12598 } else { 12599 year = insdate.getFullYear(); 12600 } 12601 12602 options.beforeMonth(formatDate(year, month, 1)); 12603 12604 date = new Date(year, month, 1); 12605 createCalendar(obj, date); 12606 $('#calendarHelp').removeClass('wcag-hide'); 12607 $('#calendarHelp').addClass('ical-focused'); 12608 $( "#year-right-arrow" ).focus(); 12609 last_focused_obj = $( "#year-right-arrow" ); 12610 //alert(last_focused_obj); 12611 //$('#container_cal').focus(); 12612 }); 12613 //https://css-tricks.com/snippets/javascript/javascript-keycodes/ 12614 //$(document).on('keydown', null, 'alt+pagedown', function(){ 12615 12616 12617 jQuery.multipress([18, 34], function () { //alt+pagedown 12618 //if ($("#container_cal").is(":focus")){ 12619 if ($('#calendarHelp').hasClass('ical-focused')){ 12620 //console.log('alt+pagedown'); 12621 var month = insdate.getMonth() + 12; 12622 var presentMonth = insdate.getMonth(); 12623 var year; 12624 12625 if (month > 11) { 12626 month = presentMonth; 12627 year = insdate.getFullYear() + 1; 12628 options.beforeYear(formatDate(year, month, 1)); 12629 } else { 12630 year = insdate.getFullYear(); 12631 } 12632 12633 options.beforeMonth(formatDate(year, month, 1)); 12634 12635 date = new Date(year, month, 1); 12636 createCalendar(obj, date); 12637 $('#calendarHelp').removeClass('wcag-hide'); 12638 $('#calendarHelp').addClass('ical-focused'); 12639 //$('#container_cal').focus(); 12640 //$('#header_cal').focus(); 12641 if (last_focused_obj!==null){ 12642 last_focused_obj.focus(); 12643 } else { 12644 $('#header_cal').focus(); 12645 } 12646 } 12647 }); 12648 12649 12650 //poprzedni rok 12651 $("#year-left-arrow", obj).click(function(e) { 12652 e.preventDefault() 12653 var year; 12654 var month = insdate.getMonth() - 12; 12655 var presentMonth = insdate.getMonth(); 12656 12657 if (month < 0) { 12658 month = presentMonth; 12659 year = insdate.getFullYear() - 1; 12660 options.beforeYear(formatDate(year, month, 1)); 12661 } else { 12662 year = insdate.getFullYear(); 12663 } 12664 12665 options.beforeMonth(formatDate(year, month, 1)); 12666 12667 date = new Date(year, month, 1); 12668 createCalendar(obj, date); 12669 $('#calendarHelp').removeClass('wcag-hide'); 12670 $('#calendarHelp').addClass('ical-focused');
12671 //$('#container_cal').focus(); 12672 $( "#year-left-arrow" ).focus(); 12673 }); 12674 //https://css-tricks.com/snippets/javascript/javascript-keycodes/ 12675 //$(document).on('keydown', null, 'alt+pageup', function(){ 12676 //if ($("#container_cal").is(":focus")){ 12677 jQuery.multipress([18, 33], function () { //alt+pageup 12678 if ($('#calendarHelp').hasClass('ical-focused')){ 12679 //console.log('alt+pageup'); 12680 var year; 12681 var month = insdate.getMonth() - 12; 12682 var presentMonth = insdate.getMonth(); 12683 12684 if (month < 0) { 12685 month = presentMonth; 12686 year = insdate.getFullYear() - 1; 12687 options.beforeYear(formatDate(year, month, 1)); 12688 } else { 12689 year = insdate.getFullYear(); 12690 } 12691 12692 options.beforeMonth(formatDate(year, month, 1)); 12693 12694 date = new Date(year, month, 1); 12695 createCalendar(obj, date); 12696 $('#calendarHelp').removeClass('wcag-hide'); 12697 $('#calendarHelp').addClass('ical-focused'); 12698 //$('#container_cal').focus(); 12699 //$('#header_cal').focus(); 12700 if (last_focused_obj!==null){ 12701 last_focused_obj.focus(); 12702 } else { 12703 $('#header_cal').focus(); 12704 } 12705 } 12706 }); 12707 //} 12708 12709 12710 //nastÄpny miesiÄ c 12711 $("#month-right-arrow", obj).click(function(e) { 12712 e.preventDefault() 12713 var year; 12714 var month = insdate.getMonth() + 1; 12715 12716 if (month > 11) { 12717 month = 0; 12718 year = insdate.getFullYear() + 1; 12719 options.beforeYear(formatDate(year, month, 1)); 12720 } else { 12721 year = insdate.getFullYear(); 12722 } 12723 12724 options.beforeMonth(formatDate(year, month, 1)); 12725 12726 date = new Date(year, month, 1); 12727 createCalendar(obj, date); 12728 $('#calendarHelp').removeClass('wcag-hide'); 12729 $('#calendarHelp').addClass('ical-focused'); 12730 //$('#container_cal').focus(); 12731 $( "#month-right-arrow" ).focus(); 12732 }); 12733 // jQuery.multipress([33], function () { //pageup 12734 // if ($('#calendarHelp').hasClass('ical-focused')){ 12735 // var year; 12736 // var month = insdate.getMonth() + 1; 12737 12738 // if (month > 11) { 12739 // month = 0; 12740 // year = insdate.getFullYear() + 1; 12741 // options.beforeYear(formatDate(year, month, 1)); 12742 // } else { 12743 // year = insdate.getFullYear(); 12744 // } 12745 12746 // options.beforeMonth(formatDate(year, month, 1)); 12747 12748 // date = new Date(year, month, 1); 12749 // createCalendar(obj, date); 12750 // } 12751 // }); 12752 12753 //http://stackoverflow.com/questions/8681162/intercept-pageup-pagedown-keydown-events-in-chrome-browser 12754 //http://jsfiddle.net/CN4UZ/5/ 12755 //if (options.calendarCreated===false){ 12756 12757 12758 $(document).on('keydown', function(e){ 12759 if ($('#calendarHelp').hasClass('ical-focused')){ 12760 //var target = $(e.currentTarget); 12761 //var debugVar = target.val(); 12762 12763 //console.log('options.calendarCreated :'+options.calendarCreated+' page up'); 12764 switch (e.keyCode) { 12765 case 33://pageup 12766 //target.val('page up'); 12767 e.preventDefault(); 12768 e.stopPropagation(); 12769 // $('#calendarHelp').removeClass('wcag-hide'); 12770 // $('#calendarHelp').addClass('ical-focused'); 12771 var year;
12772 var month = insdate.getMonth() + 1; 12773 12774 if (month > 11) { 12775 month = 0; 12776 year = insdate.getFullYear() + 1; 12777 options.beforeYear(formatDate(year, month, 1)); 12778 } else { 12779 year = insdate.getFullYear(); 12780 } 12781 12782 options.beforeMonth(formatDate(year, month, 1)); 12783 12784 date = new Date(year, month, 1); 12785 createCalendar(obj, date); 12786 $('#calendarHelp').removeClass('wcag-hide'); 12787 $('#calendarHelp').addClass('ical-focused'); 12788 //$('#container_cal').focus(); 12789 //$('#header_cal').focus(); 12790 if (last_focused_obj!==null){ 12791 last_focused_obj.focus(); 12792 } else { 12793 $('#header_cal').focus(); 12794 } 12795 break; 12796 } 12797 } 12798 }); 12799 //} 12800 12801 // $(document).on('keydown', null, 'alt+end', function(){ 12802 // var year; 12803 // var month = insdate.getMonth() + 1; 12804 12805 // if (month > 11) { 12806 // month = 0; 12807 // year = insdate.getFullYear() + 1; 12808 // options.beforeYear(formatDate(year, month, 1)); 12809 // } else { 12810 // year = insdate.getFullYear(); 12811 // } 12812 12813 // options.beforeMonth(formatDate(year, month, 1)); 12814 12815 // date = new Date(year, month, 1); 12816 // createCalendar(obj, date); 12817 // }); 12818 12819 //poprzedni miesiac 12820 $("#month-left-arrow", obj).click(function(e) { 12821 e.preventDefault() 12822 var year; 12823 var month = insdate.getMonth() - 1; 12824 12825 if (month < 0) { 12826 month = 11; 12827 year = insdate.getFullYear() - 1; 12828 options.beforeYear(formatDate(year, month, 1)); 12829 } else { 12830 year = insdate.getFullYear(); 12831 } 12832 12833 options.beforeMonth(formatDate(year, month, 1)); 12834 12835 date = new Date(year, month, 1); 12836 createCalendar(obj, date); 12837 $('#calendarHelp').removeClass('wcag-hide'); 12838 $('#calendarHelp').addClass('ical-focused'); 12839 //$('#container_cal').focus(); 12840 $( "#month-left-arrow" ).focus(); 12841 }); 12842 12843 // jQuery.multipress([34], function () { //pagedown 12844 // if ($('#calendarHelp').hasClass('ical-focused')){ 12845 // var year; 12846 // var month = insdate.getMonth() - 1; 12847 12848 // if (month < 0) { 12849 // month = 11; 12850 // year = insdate.getFullYear() - 1; 12851 // options.beforeYear(formatDate(year, month, 1)); 12852 // } else { 12853 // year = insdate.getFullYear(); 12854 // } 12855 12856 // options.beforeMonth(formatDate(year, month, 1)); 12857 12858 // date = new Date(year, month, 1); 12859 // createCalendar(obj, date); 12860 // } 12861 // }); 12862 12863 //http://stackoverflow.com/questions/8681162/intercept-pageup-pagedown-keydown-events-in-chrome-browser 12864 //http://jsfiddle.net/CN4UZ/5/ 12865 12866 12867 12868 12869 12870 $(document).on('keydown', function(e){
12871 //document.body.removeEventListener("keydown"); 12872 //document.body.addEventListener("keydown", function(e){ 12873 //console.log('page down'); 12874 if ($('#calendarHelp').hasClass('ical-focused')){ 12875 //var target = $(e.currentTarget); 12876 //var debugVar = target.val(); 12877 12878 switch (e.keyCode) { 12879 case 34://pagedown 12880 //target.val('page down'); 12881 e.preventDefault(); 12882 e.stopPropagation(); 12883 var year; 12884 var month = insdate.getMonth() - 1; 12885 12886 if (month < 0) { 12887 month = 11; 12888 year = insdate.getFullYear() - 1; 12889 options.beforeYear(formatDate(year, month, 1)); 12890 } else { 12891 year = insdate.getFullYear(); 12892 } 12893 12894 options.beforeMonth(formatDate(year, month, 1)); 12895 12896 date = new Date(year, month, 1); 12897 createCalendar(obj, date); 12898 $('#calendarHelp').removeClass('wcag-hide'); 12899 $('#calendarHelp').addClass('ical-focused'); 12900 //$('#container_cal').focus(); 12901 //$('#header_cal').focus(); 12902 //console.log(last_focused_obj); 12903 if (last_focused_obj!==null){ 12904 //console.log('x'); 12905 last_focused_obj.focus(); 12906 } else { 12907 $('#header_cal').focus(); 12908 } 12909 break; 12910 } 12911 } 12912 }); 12913 12914 // $(document).on('keydown', null, 'alt+home', function(){ 12915 // var year; 12916 // var month = insdate.getMonth() - 1; 12917 12918 // if (month < 0) { 12919 // month = 11; 12920 // year = insdate.getFullYear() - 1; 12921 // options.beforeYear(formatDate(year, month, 1)); 12922 // } else { 12923 // year = insdate.getFullYear(); 12924 // } 12925 12926 // options.beforeMonth(formatDate(year, month, 1)); 12927 12928 // date = new Date(year, month, 1); 12929 // createCalendar(obj, date); 12930 // }); 12931 } 12932 12933 12934 // document.body.removeEventListener("keydown"); 12935 // document.body.addEventListener("keydown", function(e){ 12936 // console.log('page down'); 12937 // if ($('#calendarHelp').hasClass('ical-focused')){ 12938 // var target = $(e.currentTarget); 12939 // var debugVar = target.val(); 12940 12941 // switch (e.keyCode) { 12942 // case 34://pagedown 12943 // target.val('page down'); 12944 // e.preventDefault(); 12945 // e.stopPropagation(); 12946 // var year; 12947 // var month = insdate.getMonth() - 1; 12948 12949 // if (month < 0) { 12950 // month = 11; 12951 // year = insdate.getFullYear() - 1; 12952 // options.beforeYear(formatDate(year, month, 1)); 12953 // } else { 12954 // year = insdate.getFullYear(); 12955 // } 12956 12957 // options.beforeMonth(formatDate(year, month, 1)); 12958 12959 // date = new Date(year, month, 1); 12960 // createCalendar(obj, date); 12961 // break; 12962 // } 12963 // } 12964 // }); 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 // myEventHandler = function(e) { 12975 12976 // var target = $(e.currentTarget); 12977 // var debugVar = target.val(); 12978 12979 // switch (e.keyCode) { 12980 12981 // case 38: 12982 // // on up arrow code 12983 // target.val('up arrow'); 12984 // e.stopPropagation(); 12985 // return false; 12986 // break; 12987 12988 // case 40: 12989 // // on down arrow code 12990 // target.val('down arrow'); 12991 // e.stopPropagation(); 12992 // return false; 12993 // break; 12994 12995 // case 33: 12996 // // on page up code 12997 // target.val('page up'); 12998 // e.stopPropagation(); 12999 // if ($('#calendarHelp').hasClass('ical-focused')){ 13000 // var target = $(e.currentTarget); 13001 // var debugVar = target.val(); 13002 13003 13004 // switch (e.keyCode) { 13005 // case 33://pageup 13006 // target.val('page up'); 13007 // e.preventDefault(); 13008 // e.stopPropagation(); 13009 // var year;
13010 // var month = insdate.getMonth() + 1; 13011 13012 // if (month > 11) { 13013 // month = 0; 13014 // year = insdate.getFullYear() + 1; 13015 // options.beforeYear(formatDate(year, month, 1)); 13016 // } else { 13017 // year = insdate.getFullYear(); 13018 // } 13019 13020 // options.beforeMonth(formatDate(year, month, 1)); 13021 13022 // date = new Date(year, month, 1); 13023 // createCalendar(obj, date); 13024 // break; 13025 // } 13026 // } 13027 // return false; 13028 // break; 13029 13030 // case 34: 13031 // // on page down code 13032 // target.val('page down'); 13033 // e.stopPropagation(); 13034 13035 // console.log('page down'); 13036 // if ($('#calendarHelp').hasClass('ical-focused')){ 13037 // var target = $(e.currentTarget); 13038 // var debugVar = target.val(); 13039 13040 // switch (e.keyCode) { 13041 // case 34://pagedown 13042 // target.val('page down'); 13043 // e.preventDefault(); 13044 // e.stopPropagation(); 13045 // var year; 13046 // var month = insdate.getMonth() - 1; 13047 13048 // if (month < 0) { 13049 // month = 11; 13050 // year = insdate.getFullYear() - 1; 13051 // options.beforeYear(formatDate(year, month, 1)); 13052 // } else { 13053 // year = insdate.getFullYear(); 13054 // } 13055 13056 // options.beforeMonth(formatDate(year, month, 1)); 13057 13058 // date = new Date(year, month, 1); 13059 // createCalendar(obj, date); 13060 // break; 13061 // } 13062 // } 13063 13064 // return false; 13065 // break; 13066 13067 // default: 13068 13069 // return true; 13070 // break; 13071 // }; 13072 // }; 13073 13074 // $(document).on('keydown', function(e) { 13075 // return myEventHandler(e); 13076 // }); 13077 13078 13079 13080 /** 13081 * Create the table for the calendar 13082 */ 13083 function createTable(obj) { 13084 //obj.append("<table class='icaltable'><thead><tr id='week-days'></tr></thead></table>"); //add a table 13085 13086 obj.append("<table class='icaltable'><thead><tr id='week-days'></tr></thead></table>"); //add a table 13087 13088 for (var i = 0; i < options.daynames.length; i++) { 13089 $(".icaltable tr", obj).append("<th>" + options.daynames[i] + "</th>"); //add the day header 13090 } 13091 13092 $(".icaltable", obj).append("<tr class='no_marg'><td colspan='7' id='separator'></td></tr>"); 13093 $(".icaltable", obj).append("<tr class='no_marg'><td colspan='7' id='clear-separator'></td></tr>"); 13094 13095 } 13096 13097 function addDatesToTable(obj, insdate) { 13098 var month = insdate.getMonth(); 13099 var year = insdate.getFullYear(); 13100 13101 var days = getDaysInMonth(year, month); 13102 var first = getFirstDayOfMonth(year, month); // 0 - 6 13103 var last = getLastDayOfMonth(year, month, days); // 0 - 6 13104 13105 var afterpadding = 6 - last; // week minus the last day of the month = afterpadding 13106 13107 var firstrow = true; 13108 13109 var startOnSunday = 0; 13110 13111 if (options.startOnSunday) { 13112 if (first == 6) { 13113 startOnSunday = -6; 13114 } else { 13115 startOnSunday = 1; 13116 } 13117 } 13118 13119 for (var i = 1; i <= days; i++) //each day in month 13120 { 13121 if ((first + i - 1 + startOnSunday) % 7 === 0 || firstrow === true) //add new tr for each new monday our if i is zero 13122 { 13123 $(".icaltable", obj).append("<tr></tr>"); 13124 } 13125 13126 for (var j = 0; j < first + startOnSunday && firstrow; j++) //add pre padding 13127 { 13128 $(".icaltable tr:last", obj).append("<td class = 'padding'></td"); 13129 } 13130 13131 firstrow = false; //no more pre padding 13132
13133 month = getMonthNumber($("#currentmonth", obj).text()); 13134 year = $("#currentyear", obj).text(); 13135 13136 var formatdate = formatDate(year, month, i); 13137 13138 var jsondates = getEventDates(formatdate); 13139 13140 if (jsondates.length === 0) { 13141 options.beforeDay(formatdate); 13142 $(".icaltable tr:last", obj).append("<td id = '" + formatdate + "'><span>" + i + "</span></td"); //add day 13143 } else { 13144 var firstEvent = true; 13145 for (var k = 0; k < jsondates.length; k++) { 13146 var datejson = jsondates[k]; 13147 options.beforeDay(formatdate); 13148 13149 //alert(datejson.title); 13150 13151 var str = "<li><span class='title'>" + datejson.title + "</span><span class='desc'>" + datejson.desc + "</span></li>"; 13152 13153 if (firstEvent) { 13154 //$(".icaltable tr:last", obj).append("<td class='date_has_event " + datejson.className + "' id = '" + formatdate + "'><a href='" + datejson.url + "'>" + i + "</a><div class='events'><ul id ='ul-" + formatdate + "'>" + str + "</ul></div></td>"); //add day 13155 13156 var html = "<td class='date_has_event " + datejson.className + "' id = '" + formatdate + "'>"+ 13157 "<a style='z-index:"+(100-i)+"' class='ical-ev-a' title='Wydarzenia na dzieÅ "+ i +" "+options.monthnames[insdate.getMonth()]+" "+insdate.getFullYear()+"' href='" + datejson.url + "'>" + i + 13158 "<i class='qty'>"+datejson.qty+"</i>" + 13159 "</a>"+ 13160 "</td>"; 13161 $(".icaltable tr:last", obj).append(html); 13162 13163 firstEvent = false; 13164 } else { 13165 //$("#ul-" + formatdate, obj).append(str); 13166 } 13167 } 13168 } 13169 } 13170 13171 13172 13173 if (options.startOnSunday) { 13174 startOnSunday = 1; 13175 } 13176 13177 for (i = 0; i < afterpadding - startOnSunday; i++) //add after padding 13178 { 13179 $(".icaltable tr:last", obj).append("<td class = 'padding'></td"); 13180 } 13181 13182 highlightToday(obj); 13183 } 13184 13185 function getMonthNumber(month) { 13186 for (var i = 0; i < options.monthnames.length; i++) { 13187 if (options.monthnames[i] === month) { 13188 return i; 13189 } 13190 } 13191 } 13192 13193 function getDaysInMonth(year, month) { 13194 return 32 - new Date(year, month, 32).getDate(); 13195 } 13196 13197 function highlightToday(obj) { 13198 var today = new Date(); 13199 today = formatDate(today.getFullYear(), today.getMonth(), today.getDate()); 13200 $("#" + today, obj).addClass("today"); 13201 } 13202 13203 function getEventDates(date) { 13204 13205 var results = []; 13206 13207 for (var i = 0; i < eventdates.length; i++) { 13208 var evaldate = evaluateEventDate(eventdates[i]["date"], date); 13209 if (date === evaldate) { 13210 results.push(eventdates[i]); 13211 } 13212 } 13213 13214 return results; 13215 }; 13216 13217 function evaluateEventDate(eventdate, date) { 13218 var eventdate = eventdate.split('-'); 13219 var date = date.split('-'); 13220 13221 if (eventdate[0] === 'yyyy') { 13222 eventdate[0] = date[0]; 13223 } 13224 13225 if (eventdate[1] === 'mm') { 13226 eventdate[1] = date[1]; 13227 } 13228 13229 if (eventdate[2] === 'dd') { 13230 eventdate[2] = date[2]; 13231 } 13232 13233 return eventdate[0] + '-' + eventdate[1] + '-' + eventdate[2]; 13234 } 13235 13236 function getLastDayOfMonth(year, month, days) { 13237 var date = new Date(year, month, days); 13238 if (date.getDay() === 0) //we start on monday! 13239 { 13240 return 6; 13241 } else { 13242 return date.getDay() - 1; 13243 } 13244 } 13245 13246 function getFirstDayOfMonth(year, month) { 13247 var date = new Date(year, month, 1); 13248 if (date.getDay() === 0) //we start on monday! 13249 { 13250 return 6; 13251 } else { 13252 return date.getDay() - 1; 13253 } 13254 } 13255 13256 function formatDate(year, month, day) { 13257 return year + '-' + formatMonth(month) + '-' + formatDay(day); 13258 } 13259 13260 function formatMonth(month) {
13261 month = month + 1; 13262 13263 if (month < 10) { 13264 month = '0' + month; 13265 } 13266 13267 return month; 13268 } 13269 13270 function formatDay(day) { 13271 if (day < 10) { 13272 day = '0' + day; 13273 } 13274 13275 return day; 13276 } 13277 13278 function codabubble() { //Stefano Verna 13279 $('.date_has_event').each(function() { 13280 // options 13281 var distance = 10; 13282 var time = 250; 13283 var hideDelay = 175; 13284 13285 var hideDelayTimer = null; 13286 13287 // tracker 13288 var beingShown = false; 13289 var shown = false; 13290 13291 var trigger = $(this); 13292 var popup = $('.events ul', this).css('opacity', 0); 13293 13294 // set the mouseover and mouseout on both element 13295 $([trigger.get(0), popup.get(0)]).mouseover(function() { 13296 // stops the hide event if we move from the trigger to the popup element 13297 if (hideDelayTimer) clearTimeout(hideDelayTimer); 13298 13299 // don't trigger the animation again if we're being shown, or already visible 13300 if (beingShown || shown) { 13301 return; 13302 } else { 13303 beingShown = true; 13304 13305 // reset position of popup box 13306 popup.css({ 13307 bottom: 5, 13308 left: -105, 13309 display: 'block' // brings the popup back in to view 13310 }) 13311 13312 // (we're using chaining on the popup) now animate it's opacity and position 13313 .animate({ 13314 bottom: '+=' + distance + 'px', 13315 opacity: 1 13316 }, time, 'swing', function() { 13317 // once the animation is complete, set the tracker variables 13318 beingShown = false; 13319 shown = true; 13320 }); 13321 } 13322 }).mouseout(function() { 13323 // reset the timer if we get fired again - avoids double animations 13324 if (hideDelayTimer) clearTimeout(hideDelayTimer); 13325 13326 // store the timer so that it can be cleared in the mouseover if required 13327 hideDelayTimer = setTimeout(function() { 13328 hideDelayTimer = null; 13329 popup.animate({ 13330 bottom: '-=' + distance + 'px', 13331 opacity: 0 13332 }, time, 'swing', function() { 13333 // once the animate is complete, set the tracker variables 13334 shown = false; 13335 // hide the popup entirely after the effect (opacity alone doesn't do the job) 13336 popup.css('display', 'none'); 13337 }); 13338 }, hideDelay); 13339 }); 13340 }); 13341 } 13342 }; 13343 13344 $.fn.ical.changeEventDates = function(array) { 13345 eventdates = array; 13346 }; 13347 13348})(jQuery); 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373/* 13374 13375 13376// function showIcalEventsTop(obj){ 13377// var t_event_id = $(obj).attr('data-id'); 13378// alert(t_event_id); 13379 13380 13381// } 13382var last_choosen_id_event = false; 13383function showSepIcalEventsTop(obj){ 13384 var t_event_id = $(obj).attr('data-id'); 13385 13386 if ( $(obj).hasClass('selected')==true ){ 13387 $(this).slideUp(); 13388 } else { 13389 $('.ical-ev-a.selected').each(function() { 13390 $(this).removeClass('selected'); 13391 }); 13392 $(obj).addClass('selected'); 13393 13394 $('.events-list-details').find('.evl-det').each(function() { 13395 $(this).slideUp(); 13396 }); 13397 $('#event_'+t_event_id).slideDown(); 13398 last_choosen_id_event = t_event_id; 13399 } 13400//events-list-details"> 13401//<div id="event_ 13402} 13403function showIcalEventsTop(obj){ 13404 if ( $('body').find('.evl-det-tt').length>0 ){ 13405 //$('body').find('.evl-det-tt').fadeOut('fast',function(){ $(this).remove(); }); 13406 $('body').find('.evl-det-tt').remove(); 13407 13408 setTimeout(function(){ 13409 var t_event_id = $(obj).attr('data-id'); 13410 //alert(t_event_id); 13411 13412 13413 var pos = $(obj).offset(); 13414 13415 var w_t = 100;//$('#event_'+t_event_id).outerWidth(); 13416 //var w_h = $('#event_'+t_event_id).outerHeight(); 13417 13418 $('body').append('<div class="evl-det-tt" style="display:none; left:'+(pos.left-(w_t/2))+'px;"><div class="evl-det"></div></div>'); 13419 $('body').find('.evl-det-tt .evl-det').html( $('#event_'+t_event_id).html() );//.fadeIn(); 13420 13421 var w_h = $('body').find('.evl-det-tt').outerHeight(); 13422 $('body').find('.evl-det-tt').css({'top':(pos.top-w_h+10)+'px'}); 13423 13424 $('body').find('.evl-det-tt').fadeIn(); 13425 $('body').find('.evl-det-tt').mouseleave(function() { 13426 $(this).fadeOut('fast',function(){ $(this).remove(); }); 13427 13428 }); 13429 },10); 13430 } else { 13431 var t_event_id = $(obj).attr('data-id'); 13432 //alert(t_event_id); 13433 13434 13435 var pos = $(obj).offset(); 13436 13437 var w_t = 100;//$('#event_'+t_event_id).outerWidth(); 13438 //var w_h = $('#event_'+t_event_id).outerHeight(); 13439 13440 $('body').append('<div class="evl-det-tt" style="display:none; left:'+(pos.left-(w_t/2))+'px;"><div class="evl-det"></div></div>'); 13441 $('body').find('.evl-det-tt .evl-det').html( $('#event_'+t_event_id).html() );//.fadeIn(); 13442 13443 var w_h = $('body').find('.evl-det-tt').outerHeight(); 13444 $('body').find('.evl-det-tt').css({'top':(pos.top-w_h+10)+'px'}); 13445 13446 $('body').find('.evl-det-tt').fadeIn(); 13447 $('body').find('.evl-det-tt').mouseleave(function() { 13448 $(this).fadeOut('fast',function(){ $(this).remove(); }); 13449 13450 }); 13451 // $(obj).parent().append('<div class="evl-det-tt"></div>'); 13452 //$(obj).parent().find('.evl-det-tt').html( $('#event_'+t_event_id).html() ).fadeIn(); 13453 13454 //$(obj).parent().append('<div class="evl-det-tt"></div>'); 13455 //$(obj).parent().find('.evl-det-tt').html( $('#event_'+t_event_id).html() ).fadeIn(); 13456 13457 13458 13459 13460 // $(this).append(out); 13461 // var w_t = $(tipr_cont).outerWidth(); 13462 // var w_e = $(this).width(); 13463 // var m_l = w_e / 2 - w_t / 2; 13464 // $(tipr_cont).css("margin-left", m_l + "px"); 13465 // $(this).removeAttr("title"); 13466 // $(tipr_cont).fadeIn(set.speed) 13467 } 13468 13469} 13470 13471function showIcalEventsTop22(obj){ 13472 if ( $('body').find('.evl-det-tt').length>0 ){ 13473 $('body').find('.evl-det-tt').remove(); 13474 } 13475 var t_event_id = $(obj).attr('data-id'); 13476 //alert(t_event_id); 13477 13478 13479 var pos = $(obj).offset(); 13480 13481 var w_t = 100;//$('#event_'+t_event_id).outerWidth(); 13482 var w_h = $('#event_'+t_event_id).outerHeight(); 13483 13484 $('body').append('<div class="evl-det-tt" style="display:none; top:'+(pos.top-w_h)+'px; left:'+(pos.left-(w_t/2))+'px;"><div class="evl-det"></div></div>'); 13485 $('body').find('.evl-det-tt .evl-det').html( $('#event_'+t_event_id).html() );//.fadeIn(); 13486 $('body').find('.evl-det-tt').fadeIn(); 13487 // $(obj).parent().append('<div class="evl-det-tt"></div>'); 13488 //$(obj).parent().find('.evl-det-tt').html( $('#event_'+t_event_id).html() ).fadeIn(); 13489 13490 //$(obj).parent().append('<div class="evl-det-tt"></div>'); 13491 //$(obj).parent().find('.evl-det-tt').html( $('#event_'+t_event_id).html() ).fadeIn(); 13492 13493 13494 13495 13496 // $(this).append(out); 13497 // var w_t = $(tipr_cont).outerWidth(); 13498 // var w_e = $(this).width(); 13499 // var m_l = w_e / 2 - w_t / 2; 13500 // $(tipr_cont).css("margin-left", m_l + "px"); 13501 // $(this).removeAttr("title"); 13502 // $(tipr_cont).fadeIn(set.speed) 13503 13504} 13505function hideIcalEventsTop(obj){ 13506 //var t_event_id = $(obj).attr('data-id'); 13507 $('body').find('.evl-det-tt').fadeOut('fast',function(){ $(this).remove(); }); 13508} 13509 13510*/ 13511 13512/* 13513 * First plugin 13514 * 13515 * @author Maarten Hus 13516 */ 13517(function($) { 13518 var eventdates = {}; 13519 13520 $.fn.icalbig = function(options) { 13521 $.fn.icalbig.defaults = { 13522 daynames: ['Pon', 'Wt', 'År', 'Czw', 'Pi', 'So', 'Ni'], //default short names for the days of the week 13523 monthnames: ['StyczeÅ', 'Luty', 'Marzec', 'KwiecieÅ
13523', 'Maj', 'Czerwiec', 'Lipiec', 'SierpieÅ', 'WrzesieÅ', 'Październik', 'Listopad', 'GrudzieÅ'], 13524 startdate: new Date(), // The date the calender should take as start point 13525 eventdates: {}, 13526 startOnSunday: false, 13527 beforeDay: function(insdate) {}, 13528 beforeMonth: function(insdate) {}, 13529 beforeYear: function(insdate) {} 13530 }; 13531 13532 options = $.extend({}, $.fn.icalbig.defaults, options); 13533 13534 return this.each(function() { 13535 var obj = $(this); //get the object 13536 eventdates = options.eventdates; 13537 13538 var insdate = options.startdate; //The date that gets used for calculating the month 13539 13540 createCalendar(obj, insdate); 13541 }); 13542 13543 /** 13544 * Create the calendar 13545 */ 13546 function createCalendar(obj, insdate) { 13547 obj.html(''); 13548 createNavigation(obj, insdate); 13549 createTable(obj); //create table 13550 addDatesToTable(obj, insdate); 13551 codabubble(); 13552 } 13553 13554 /** 13555 * Create the navigation and handle its clicks 13556 */ 13557 function createNavigation(obj, insdate) { 13558 13559 //obj.prepend("<div id='nav-calendar'><div id='year'><span id='year-left-arrow' class='year-buttons'></span><span id='currentyear'>" + insdate.getFullYear() + "</span><span id='year-right-arrow' class='year-buttons'></span></div>" + "<div id='month'><span id='month-left-arrow'></span><span id='currentmonth'>" + options.monthnames[insdate.getMonth()] + "</span><span id='month-right-arrow'></span></div></div>"); 13560 obj.prepend("<div id='nav-calendar'><div id='month'><i id='month-left-arrow' class='fa fa-chevron-left' aria-hidden='true'></i><div class='month-year'><span id='currentmonth'>" + options.monthnames[insdate.getMonth()] + "</span><span id='currentyear'>" + insdate.getFullYear() + "</span></div><i id='month-right-arrow' class='fa fa-chevron-right' aria-hidden='true'></i></div></div>"); 13561 13562 13563 $("#month-right-arrow", obj).click(function() { 13564 var year; 13565 var month = insdate.getMonth() + 1; 13566 13567 if (month > 11) { 13568 month = 0; 13569 year = insdate.getFullYear() + 1; 13570 options.beforeYear(formatDate(year, month, 1)); 13571 } else { 13572 year = insdate.getFullYear(); 13573 } 13574 13575 options.beforeMonth(formatDate(year, month, 1)); 13576 13577 date = new Date(year, month, 1); 13578 createCalendar(obj, date); 13579 }); 13580 13581 $("#month-left-arrow", obj).click(function() { 13582 var year; 13583 var month = insdate.getMonth() - 1; 13584 13585 if (month < 0) { 13586 month = 11; 13587 year = insdate.getFullYear() - 1; 13588 options.beforeYear(formatDate(year, month, 1)); 13589 } else { 13590 year = insdate.getFullYear(); 13591 } 13592 13593 options.beforeMonth(formatDate(year, month, 1)); 13594 13595 date = new Date(year, month, 1); 13596 createCalendar(obj, date); 13597 }); 13598 } 13599 13600 /** 13601 * Create the table for the calendar 13602 */ 13603 function createTable(obj) { 13604 //obj.append("<table class='icaltable'><thead><tr id='week-days'></tr></thead></table>"); //add a table 13605 13606 obj.append("<table class='icaltable'><thead><tr id='week-days'></tr></thead></table>"); //add a table 13607 13608 for (var i = 0; i < options.daynames.length; i++) { 13609 $(".icaltable tr", obj).append("<th>" + options.daynames[i] + "</th>"); //add the day header 13610 } 13611 13612 $(".icaltable", obj).append("<tr class='no_marg'><td colspan='7' id='separator'></td></tr>"); 13613 $(".icaltable", obj).append("<tr class='no_marg'><td colspan='7' id='clear-separator'></td></tr>"); 13614 13615 } 13616 13617 function addDatesToTable(obj, insdate) {
13618 var month = insdate.getMonth(); 13619 var year = insdate.getFullYear(); 13620 13621 var days = getDaysInMonth(year, month); 13622 var first = getFirstDayOfMonth(year, month); // 0 - 6 13623 var last = getLastDayOfMonth(year, month, days); // 0 - 6 13624 13625 var afterpadding = 6 - last; // week minus the last day of the month = afterpadding 13626 13627 var firstrow = true; 13628 13629 var startOnSunday = 0; 13630 13631 if (options.startOnSunday) { 13632 if (first == 6) { 13633 startOnSunday = -6; 13634 } else { 13635 startOnSunday = 1; 13636 } 13637 } 13638 13639 for (var i = 1; i <= days; i++) //each day in month 13640 { 13641 if ((first + i - 1 + startOnSunday) % 7 === 0 || firstrow === true) //add new tr for each new monday our if i is zero 13642 { 13643 $(".icaltable", obj).append("<tr></tr>"); 13644 } 13645 13646 for (var j = 0; j < first + startOnSunday && firstrow; j++) //add pre padding 13647 { 13648 $(".icaltable tr:last", obj).append("<td class = 'padding'></td"); 13649 } 13650 13651 firstrow = false; //no more pre padding 13652 13653 month = getMonthNumber($("#currentmonth", obj).text()); 13654 year = $("#currentyear", obj).text(); 13655 13656 var formatdate = formatDate(year, month, i); 13657 13658 var jsondates = getEventDates(formatdate); 13659 13660 if (jsondates.length === 0) { 13661 options.beforeDay(formatdate); 13662 $(".icaltable tr:last", obj).append("<td id = '" + formatdate + "'><span>" + i + "</span></td");
13662 //add day 13663 } else { 13664 var firstEvent = true; 13665 for (var k = 0; k < jsondates.length; k++) { 13666 var datejson = jsondates[k]; 13667 options.beforeDay(formatdate); 13668 13669 //alert(datejson.title); 13670 13671 // $( "div.enterleave" ) 13672 // .mouseenter(function() { 13673 // $( "p:first", this ).text( "mouse enter" ); 13674 // }) 13675 // .mouseleave(function() { 13676 // $( "p:first", this ).text( "mouse leave" ); 13677 // $( "p:last", this ).text( ++n ); 13678 // }); 13679 13680//event_id 13681 if (firstEvent) { 13682 //onmouseover='showIcalEventsTop(this);' onmouseout='hideIcalEventsTop(this);' 13683 //onmouseleave='hideIcalEventsTop(this);' 13684 var html = "<td class='date_has_event " + datejson.className + "' id = '" + formatdate + "'>"+ 13685 //"<a onmouseenter='showIcalEventsTop(this);' data-id='"+datejson.event_id+"' rel='"+datejson.event_id+"' href='" + datejson.url + "'>" + i + "</a>"+ 13686 "<a class='ical-ev-a' onclick='showSepIcalEventsTop(this);' data-id='"+datejson.event_id+"' rel='"+datejson.event_id+"'>" + i + 13687 "<i class='qty'>"+datejson.qty+"</i>" + 13688 "</a>"+ 13689 "</td>"; 13690 $(".icaltable tr:last", obj).append(html); 13691 firstEvent = false; 13692 } else { 13693 //$("#ul-" + formatdate, obj).append(str); 13694 } 13695 13696 13697 13698 //var str = "<li><span class='title'>" + datejson.title + "</span><span class='desc'>" + datejson.desc + "</span></li>"; 13699 13700 // if (firstEvent) { 13701 // $(".icaltable tr:last", obj).append("<td class='date_has_event " + datejson.className + "' id = '" + formatdate + "'><a href='" + datejson.url + "'>" + i + "</a><div class='events'><ul id ='ul-" + formatdate + "'>" + str + "</ul></div></td>"); //add day 13702 // firstEvent = false; 13703 // } else { 13704 // $("#ul-" + formatdate, obj).append(str); 13705 // } 13706 } 13707 } 13708 } 13709 13710 if (options.startOnSunday) { 13711 startOnSunday = 1; 13712 } 13713 13714 for (i = 0; i < afterpadding - startOnSunday; i++) //add after padding 13715 { 13716 $(".icaltable tr:last", obj).append("<td class = 'padding'></td"); 13717 } 13718 13719 highlightToday(obj); 13720 } 13721 13722 13723 13724 function getMonthNumber(month) { 13725 for (var i = 0; i < options.monthnames.length; i++) { 13726 if (options.monthnames[i] === month) { 13727 return i; 13728 } 13729 } 13730 } 13731 13732 function getDaysInMonth(year, month) { 13733 return 32 - new Date(year, month, 32).getDate(); 13734 } 13735 13736 function highlightToday(obj) { 13737 var today = new Date(); 13738 today = formatDate(today.getFullYear(), today.getMonth(), today.getDate()); 13739 $("#" + today, obj).addClass("today"); 13740 } 13741 13742 function getEventDates(date) { 13743 13744 var results = []; 13745 13746 for (var i = 0; i < eventdates.length; i++) { 13747 var evaldate = evaluateEventDate(eventdates[i]["date"], date); 13748 if (date === evaldate) { 13749 results.push(eventdates[i]); 13750 } 13751 } 13752 13753 return results; 13754 }; 13755 13756 function evaluateEventDate(eventdate, date) { 13757 var eventdate = eventdate.split('-'); 13758 var date = date.split('-'); 13759 13760 if (eventdate[0] === 'yyyy') { 13761 eventdate[0] = date[0]; 13762 } 13763 13764 if (eventdate[1] === 'mm') { 13765 eventdate[1] = date[1]; 13766 } 13767 13768 if (eventdate[2] === 'dd') { 13769 eventdate[2] = date[2]; 13770 } 13771 13772 return eventdate[0] + '-' + eventdate[1] + '-' + eventdate[2]; 13773 } 13774 13775 function getLastDayOfMonth(year, month, days) { 13776 var date = new Date(year, month, days); 13777 if (date.getDay() === 0) //we start on monday! 13778 { 13779 return 6; 13780 } else { 13781 return date.getDay() - 1; 13782 } 13783 } 13784 13785 function getFirstDayOfMonth(year, month) { 13786 var date = new Date(year, month, 1); 13787 if (date.getDay() === 0) //we start on monday! 13788 { 13789 return 6; 13790 } else { 13791 return date.getDay() - 1; 13792 } 13793 } 13794 13795 function formatDate(year, month, day) { 13796 return year + '-' + formatMonth(month) + '-' + formatDay(day); 13797 } 13798 13799 function formatMonth(month) {
13800 month = month + 1; 13801 13802 if (month < 10) { 13803 month = '0' + month; 13804 } 13805 13806 return month; 13807 } 13808 13809 function formatDay(day) { 13810 if (day < 10) { 13811 day = '0' + day; 13812 } 13813 13814 return day; 13815 } 13816 13817 function codabubble() { //Stefano Verna 13818 $('.date_has_event').each(function() { 13819 // options 13820 var distance = 10; 13821 var time = 250; 13822 var hideDelay = 175; 13823 13824 var hideDelayTimer = null; 13825 13826 // tracker 13827 var beingShown = false; 13828 var shown = false; 13829 13830 var trigger = $(this); 13831 var popup = $('.events ul', this).css('opacity', 0); 13832 13833 // set the mouseover and mouseout on both element 13834 $([trigger.get(0), popup.get(0)]).mouseover(function() { 13835 // stops the hide event if we move from the trigger to the popup element 13836 if (hideDelayTimer) clearTimeout(hideDelayTimer); 13837 13838 // don't trigger the animation again if we're being shown, or already visible 13839 if (beingShown || shown) { 13840 return; 13841 } else { 13842 beingShown = true; 13843 13844 // reset position of popup box 13845 popup.css({ 13846 bottom: 5, 13847 left: -105, 13848 display: 'block' // brings the popup back in to view 13849 }) 13850 13851 // (we're using chaining on the popup) now animate it's opacity and position 13852 .animate({ 13853 bottom: '+=' + distance + 'px', 13854 opacity: 1 13855 }, time, 'swing', function() { 13856 // once the animation is complete, set the tracker variables 13857 beingShown = false; 13858 shown = true; 13859 }); 13860 } 13861 }).mouseout(function() { 13862 // reset the timer if we get fired again - avoids double animations 13863 if (hideDelayTimer) clearTimeout(hideDelayTimer); 13864 13865 // store the timer so that it can be cleared in the mouseover if required 13866 hideDelayTimer = setTimeout(function() { 13867 hideDelayTimer = null; 13868 popup.animate({ 13869 bottom: '-=' + distance + 'px', 13870 opacity: 0 13871 }, time, 'swing', function() { 13872 // once the animate is complete, set the tracker variables 13873 shown = false; 13874 // hide the popup entirely after the effect (opacity alone doesn't do the job) 13875 popup.css('display', 'none'); 13876 }); 13877 }, hideDelay); 13878 }); 13879 }); 13880 } 13881 }; 13882 13883 $.fn.icalbig.changeEventDates = function(array) { 13884 eventdates = array; 13885 }; 13886 13887})(jQuery); 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914var BigPicture=function(){var t,n,e,o,i,r,a,c,p,s,l,d,u,f,m,b,g,h,x,v,y,w,_,T,k,M,S,L,E,A,H,z,C,I=[],D={},O="appendChild",N="createElement",V="removeChild";function W(){var n=t.getBoundingClientRect();return"transform:translate3D("+(n.left-(e.clientWidth-n.width)/2)+"px, "+(n.top-(e.clientHeight-n.height)/2)+"px, 0) scale3D("+t.clientWidth/o.clientWidth+", "+t.clientHeight/o.clientHeight+", 0)"}function q(t){var n=A.length-1;if(!u){if(t>0&&E===n||t<0&&!E){if(!C.loop)return j(i,""),void setTimeout(j,9,i,"animation:"+(t>0?"bpl":"bpf")+" .3s;transition:transform .35s");E=t>0?-1:n+1}if([(E=Math.max(0,Math.min(E+t,n)))-1,E,E+1].forEach(function(t){if(t=Math.max(0,Math.min(t,n)),!D[t]){var e=A[t].src,o=document[N]("IMG");o.addEventListener("load",F.bind(null,e)),o.src=e,D[t]=o}}),D[E].complete)return B(t);u=1,j(m,"opacity:.4;"),e[O](m),D[E].onload=function(){y&&B(t)},D[E].onerror=function(){A[E]={error:"Error loading image"},y&&B(t)}}}function B(n){u&&(e[V](m),u=0);var r=A[E];if(r.error)alert(r.error);else{var a=e.querySelector("img:last-of-type");j(i=o=D[E],"animation:"+(n>0?"bpfl":"bpfr")+" .35s;transition:transform .35s"),j(a,"animation:"+(n>0?"bpfol":"bpfor")+" .35s both"),e[O](i),r.el&&(t=r.el)}
vendor: 2,286 bytes, line 13914
13914H.innerHTML=E+1+"/"+A.length,X(A[E].caption),M&&M([i,A[E]])}function P(){var t,n,e=.95*window.innerHeight,o=.95*window.innerWidth,i=C.dimensions||[1920,1080],r=i[0],a=i[1],p=a/r;p>e/o?n=(t=Math.min(a,e))/p:t=(n=Math.min(r,o))*p,c.style.cssText+="width:"+n+"px;height:"+t+"px;"}function G(t){~[1,4].indexOf(o.readyState)?(U(),setTimeout(function(){o.play()},99)):o.error?U(t):f=setTimeout(G,35,t)}function R(n){C.noLoader||(n&&j(m,"top:"+t.offsetTop+"px;left:"+t.offsetLeft+"px;height:"+t.clientHeight+"px;width:"+t.clientWidth+"px"),t.parentElement[n?O:V](m),u=n)}function X(t){t&&(g.innerHTML=t),j(b,"opacity:"+(t?"1;pointer-events:auto":"0"))}function F(t){!~I.indexOf(t)&&I.push(t)}function U(t){if(u&&R(),T&&T(),"string"==typeof t)return $(),C.onError?C.onError():alert("Error: The requested "+t+" could not be loaded.");_&&F(s),o.style.cssText+=W(),j(e,"opacity:1;pointer-events:auto"),k&&(k=setTimeout(k,410)),v=1,y=!!A,setTimeout(function(){o.style.cssText+="transition:transform .35s;transform:none",h&&setTimeout(X,250,h)},60)}function Y(t){var n=t?t.target:e,i=[b,x,r,a,g,L,S,m];n.blur(),w||~i.indexOf(n)||(o.style.cssText+=W(),j(e,"pointer-events:auto"),setTimeout($,350),clearTimeout(k),v=0,w=1)}function $(){if((o===c?p:o).removeAttribute("src"),document.body[V](e),e[V](o),j(e,""),j(o,""),X(0),y){for(var t=e.querySelectorAll("img"),n=0;n<t.length;n++)e[V](t[n]);u&&e[V](m),e[V](H),y=A=0,D={},z||e[V](S),z||e[V](L),i.onload=U,i.onerror=U.bind(null,"image")}C.onClose&&C.onClose(),w=u=0}function j(t,n){t.style.cssText=n}return function(w){var D;return n||function(){var t;function s(t){var n=document[N]("button");return n.className=t,n.innerHTML='<svg viewBox="0 0 48 48"><path d="M28 24L47 5a3 3 0 1 0-4-4L24 20 5 1a3 3 0 1 0-4 4l19 19L1 43a3 3 0 1 0 4 4l19-19 19 19a3 3 0 0 0 4 0v-4L28 24z"/></svg>',n}function d(t,n){var e=document[N]("button");return e.className="bp-lr",e.innerHTML='<svg viewBox="0 0 129 129" height="70" fill="#fff"><path d="M88.6 121.3c.8.8 1.8 1.2 2.9 1.2s2.1-.4 2.9-1.2a4.1 4.1 0 0 0 0-5.8l-51-51 51-51a4.1 4.1 0 0 0-5.8-5.8l-54 53.9a4.1 4.1 0 0 0 0 5.8l54 53.9z"/></svg>',j(e,n),e.onclick=function(n){n.stopPropagation(),q(t)},e}var f=document[N]("STYLE");f.innerHTML="#bp_caption,#bp_container{bottom:0;left:0;right:0;position:fixed;opacity:0}
13914#bp_container>*,#bp_loader{position:absolute;right:0;z-index:10}#bp_container,#bp_caption,#bp_container svg{pointer-events:none}#bp_container{top:0;z-index:9999;background:rgba(0,0,0,.7);opacity:0;transition:opacity .35s}#bp_loader{top:0;left:0;bottom:0;display:flex;align-items:center;cursor:wait;background:0;z-index:9}#bp_loader svg{width:50%;max-width:300px;max-height:50%;margin:auto;animation:bpturn 1s infinite linear}#bp_aud,#bp_container img,#bp_sv,#bp_vid{user-select:none;max-height:96%;max-width:96%;top:0;bottom:0;left:0;margin:auto;box-shadow:0 0 3em rgba(0,0,0,.4);z-index:-1}#bp_sv{background:#111}#bp_sv svg{width:66px}#bp_caption{font-size:.9em;padding:1.3em;background:rgba(15,15,15,.94);color:#fff;text-align:center;transition:opacity .3s}#bp_aud{width:650px;top:calc(50% - 20px);bottom:auto;box-shadow:none}#bp_count{left:0;right:auto;padding:14px;color:rgba(255,255,255,.7);font-size:22px;cursor:default}#bp_container button{position:absolute;border:0;outline:0;background:0;cursor:pointer;transition:all .1s}#bp_container>.bp-x{padding:0;height:41px;width:41px;border-radius:100%;top:8px;right:14px;opacity:.8;line-height:1}#bp_container>.bp-x:focus,#bp_container>.bp-x:hover{background:rgba(255,255,255,.2)}.bp-x svg,.bp-xc svg{height:21px;width:20px;fill:#fff;vertical-align:top;}.bp-xc svg{width:16px}#bp_container .bp-xc{left:2%;bottom:100%;padding:9px 20px 7px;background:#d04444;border-radius:2px 2px 0 0;opacity:.85}#bp_container .bp-xc:focus,#bp_container .bp-xc:hover{opacity:1}.bp-lr{top:50%;top:calc(50% - 130px);padding:99px 0;width:6%;background:0;border:0;opacity:.4;transition:opacity .1s}.bp-lr:focus,.bp-lr:hover{opacity:.8}@keyframes bpf{50%{transform:translatex(15px)}100%{transform:none}}@keyframes bpl{50%{transform:translatex(-15px)}100%{transform:none}}@keyframes bpfl{0%{opacity:0;transform:translatex(70px)}100%{opacity:1;transform:none}}@keyframes bpfr{0%{opacity:0;transform:translatex(-70px)}100%{opacity:1;transform:none}}@keyframes bpfol{0%{opacity:1;transform:none}100%{opacity:0;transform:translatex(-70px)}}@keyframes bpfor{0%{opacity:1;transform:none}100%{opacity:0;transform:translatex(70px)}}@keyframes bpturn{0%{transform:none}100%{transform:rotate(360deg)}}@media (max-width:600px){.bp-lr{font-size:15vw}}",document.head[O](f),(e=document[N]("DIV")).id="bp_container",e.onclick=Y,l=s("bp-x"),e[O](l),"ontouchstart"in window&&(z=1,e.ontouchstart=function(n){var e=n.changedTouches;t=e[0].pageX},e.ontouchmove=function(t){t.preventDefault()},e.ontouchend=function(n){var e=n.changedTouches;if(y){var o=e[0].pageX-t;o<-30&&q(1),o>30&&q(-1)}}),i=document[N]("IMG"),(r=document[N]("VIDEO")).id="bp_vid",r.setAttribute("playsinline",1),r.controls=1,r.loop=1,(a=document[N]("audio")).id="bp_aud",a.controls=1,a.loop=1,(H=document[N]("span")).id="bp_count",(b=document[N]("DIV")).id="bp_caption",(x=s("bp-xc")).onclick=X.bind(null,0),b[O](x),g=document[N]("SPAN"),b[O](g),e[O](b),S=d(1,"transform:scalex(-1)"),L=d(-1,"left:0;right:auto"),(m=document[N]("DIV")).id="bp_loader",m.innerHTML='<svg viewbox="0 0 32 32" fill="#fff" opacity=".8"><path d="M16 0a16 16 0 0 0 0 32 16 16 0 0 0 0-32m0 4a12 12 0 0 1 0 24 12 12 0 0 1 0-24" fill="#000" opacity=".5"/><path d="M16 0a16 16 0 0 1 16 16h-4A12 12 0 0 0 16 4z"/></svg>',(c=document[N]("DIV")).id="bp_sv",(p=document[N]("IFRAME")).setAttribute("allowfullscreen",1),p.allow="autoplay; fullscreen",p.onload=function(){return c[V](m)},j(p,"border:0;position:absolute;height:100%;width:100%;left:0;top:0"),c[O](p),i.onload=U,i.onerror=U.bind(null,"image"),window.addEventListener("resize",function(){y||u&&R(1),o===c&&P()}),document.addEventListener("keyup",function(t){var n=t.keyCode;27===n&&v&&Y(),y&&(39===n&&q(1),37===n&&q(-1),38===n&&q(10),40===n&&q(-10))}),document.addEventListener("keydown",function(t){y&&~[37,38,39,40].indexOf(t.keyCode)&&t.preventDefault()}),document.addEventListener("focus",function(t){v&&!e.contains(t.target)&&(t.stopPropagation(),l.focus())},1),n=1}(),u&&(clearTimeout(f),$()),C=w,d=w.ytSrc||w.vimeoSrc,T=w.animationStart,k=w.animationEnd,M=w.onChangeImage,_=0,h=(t=w.el).getAttribute("data-caption"),w.gallery?function(n,r){var a=C.galleryAttribute||"data-bp";if(Array.isArray(n))A=n,h=n[E=r||0].caption;else{var c=(A=[].slice.call("string"==typeof n?document.querySelectorAll(n+" ["+a+"]"):n)).indexOf(t);E=0===r||r?r:-1!==c?c:0,A=A.map(function(t){return{el:t,src:t.getAttribute(a),caption:t.getAttribute("data-caption")}})}_=1,!~I.indexOf(s=A[E].src)&&R(1),A.length>1?(e[O](H),H.innerHTML=E+1+"/"+A.length,z||(e[O](S),e[O](L))):A=0,(o=i).src=s}(w.gallery,w.position):d||w.iframeSrc?(o=c,C.ytSrc?W="https://www.youtube"+(C.ytNoCookie?"-nocookie":"")+".com/embed/"+d+"?html5=1&rel=0&playsinline=1&autoplay=1":C.vimeoSrc?W="https://player.vimeo.com/video/"+d+"?autoplay=1":C.iframeSrc&&(W=C.iframeSrc),j(m,""),c[O](m),p.src=W,P(),setTimeout(U,9)):w.imgSrc?(_=1,!~I.indexOf(s=w.imgSrc)&&R(1),(o=i).src=s):w.audio?(R(1),(o=a).src=w.audio,G("audio file")):w.vidSr
13914c?(R(1),w.dimensions&&j(r,"width:"+w.dimensions[0]+"px"),D=w.vidSrc,Array.isArray(D)?(o=r.cloneNode(),D.forEach(function(t){var n=document[N]("SOURCE");n.src=t,n.type="video/"+t.match(/.(\w+)$/)[1],o[O](n)})):(o=r).src=D,G("video")):(o=i).src="IMG"===t.tagName?t.src:window.getComputedStyle(t).backgroundImage.replace(/^url|[(|)|'|"]/g,""),e[O](o),document.body[O](e),{close:Y,next:function(){return q(1)},prev:function(){return q(-1)}};var W}}(); 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965(function(window, factory) { 13966 if (typeof define === 'function' && define.amd) { 13967 define(['jquery'], function($) { 13968 return factory(window, $); 13969 }); 13970 } else if (typeof module === 'object' && typeof module.exports === 'object') { 13971 module.exports = factory(window, require('jquery')); 13972 } else { 13973 window.lity = factory(window, window.jQuery || window.Zepto); 13974 } 13975}(typeof window !== "undefined" ? window : this, function(window, $) { 13976 'use strict'; 13977 13978 var document = window.document; 13979 13980 var _win = $(window); 13981 var _deferred = $.Deferred; 13982 var _html = $('html'); 13983 var _instances = []; 13984 13985 var _attrAriaHidden = 'aria-hidden'; 13986 var _dataAriaHidden = 'lity-' + _attrAriaHidden; 13987 13988 var _focusableElementsSelector = 'a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])'; 13989 13990 var _defaultOptions = { 13991 esc: true, 13992 handler: null, 13993 handlers: { 13994 image: imageHandler, 13995 inline: inlineHandler, 13996 youtube: youtubeHandler, 13997 vimeo: vimeoHandler, 13998 googlemaps: googlemapsHandler, 13999 facebookvideo: facebookvideoHandler, 14000 iframe: iframeHandler 14001 }, 14002 template: '<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>×</button></div></div></div>' 14003 }; 14004 14005 var _imageRegexp = /(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i; 14006 var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i; 14007 var _vimeoRegex = /(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/; 14008 var _googlemapsRegex = /((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i; 14009 var _facebookvideoRegex = /(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i; 14010 14011 var _transitionEndEvent = (function() { 14012 var el = document.createElement('div'); 14013 14014 var transEndEventNames = { 14015 WebkitTransition: 'webkitTransitionEnd', 14016 MozTransition: 'transitionend', 14017 OTransition: 'oTransitionEnd otransitionend', 14018 transition: 'transitionend' 14019 }; 14020 14021 for (var name in transEndEventNames) { 14022 if (el.style[name] !== undefined) { 14023 return transEndEventNames[name]; 14024 } 14025 } 14026 14027 return false; 14028 })(); 14029 14030 function transitionEnd(element) { 14031 var deferred = _deferred(); 14032 14033 if (!_transitionEndEvent || !element.length) { 14034 deferred.resolve(); 14035 } else { 14036 element.one(_transitionEndEvent, deferred.resolve); 14037 setTimeout(deferred.resolve, 500); 14038 } 14039 14040 return deferred.promise(); 14041 } 14042 14043 function settings(currSettings, key, value) { 14044 if (arguments.length === 1) { 14045 return $.extend({}, currSettings); 14046 } 14047 14048 if (typeof key === 'string') { 14049 if (typeof value === 'undefined') { 14050 return typeof currSettings[key] === 'undefined' 14051 ? null 14052 : currSettings[key]; 14053 } 14054 14055 currSettings[key] = value; 14056 } else { 14057 $.extend(currSettings, key); 14058 } 14059 14060 return this; 14061 } 14062 14063 function parseQueryParams(params) { 14064 var pairs = decodeURI(params.split('#')[0]).split('&'); 14065 var obj = {}, p; 14066 14067 for (var i = 0, n = pairs.length; i < n; i++) { 14068 if (!pairs[i]) { 14069 continue; 14070 } 14071 14072 p = pairs[i].split('='); 14073 obj[p[0]] = p[1]; 14074 } 14075 14076 return obj;
vendor: 7,507 bytes, lines 14077-14353
14077 } 14078 14079 function appendQueryParams(url, params) { 14080 return url + (url.indexOf('?') > -1 ? '&' : '?') + $.param(params); 14081 } 14082 14083 function transferHash(originalUrl, newUrl) { 14084 var pos = originalUrl.indexOf('#'); 14085 14086 if (-1 === pos) { 14087 return newUrl; 14088 } 14089 14090 if (pos > 0) { 14091 originalUrl = originalUrl.substr(pos); 14092 } 14093 14094 return newUrl + originalUrl; 14095 } 14096 14097 function error(msg) { 14098 return $('<span class="lity-error"></span>').append(msg); 14099 } 14100 14101 function imageHandler(target, instance) { 14102 var desc = (instance.opener() && instance.opener().data('lity-desc')) || 'Image with no description'; 14103 var img = $('<img src="' + target + '" alt="' + desc + '"/>'); 14104 var deferred = _deferred(); 14105 var failed = function() { 14106 deferred.reject(error('Failed loading image')); 14107 }; 14108 14109 img 14110 .on('load', function() { 14111 if (this.naturalWidth === 0) { 14112 return failed(); 14113 } 14114 14115 deferred.resolve(img); 14116 }) 14117 .on('error', failed) 14118 ; 14119 14120 return deferred.promise(); 14121 } 14122 14123 imageHandler.test = function(target) { 14124 return _imageRegexp.test(target); 14125 }; 14126 14127 function inlineHandler(target, instance) { 14128 var el, placeholder, hasHideClass; 14129 14130 try { 14131 el = $(target); 14132 } catch (e) { 14133 return false; 14134 } 14135 14136 if (!el.length) { 14137 return false; 14138 } 14139 14140 placeholder = $('<i style="display:none !important"></i>'); 14141 hasHideClass = el.hasClass('lity-hide'); 14142 14143 instance 14144 .element() 14145 .one('lity:remove', function() { 14146 placeholder 14147 .before(el) 14148 .remove() 14149 ; 14150 14151 if (hasHideClass && !el.closest('.lity-content').length) { 14152 el.addClass('lity-hide'); 14153 } 14154 }) 14155 ; 14156 14157 return el 14158 .removeClass('lity-hide') 14159 .after(placeholder) 14160 ; 14161 } 14162 14163 function youtubeHandler(target) { 14164 var matches = _youtubeRegex.exec(target); 14165 14166 if (!matches) { 14167 return false; 14168 } 14169 14170 return iframeHandler( 14171 transferHash( 14172 target, 14173 appendQueryParams( 14174 'https://www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4], 14175 $.extend( 14176 { 14177 autoplay: 1 14178 }, 14179 parseQueryParams(matches[5] || '') 14180 ) 14181 ) 14182 ) 14183 ); 14184 } 14185 14186 function vimeoHandler(target) { 14187 var matches = _vimeoRegex.exec(target); 14188 14189 if (!matches) { 14190 return false; 14191 } 14192 14193 return iframeHandler( 14194 transferHash( 14195 target, 14196 appendQueryParams( 14197 'https://player.vimeo.com/video/' + matches[3], 14198 $.extend( 14199 { 14200 autoplay: 1 14201 }, 14202 parseQueryParams(matches[4] || '') 14203 ) 14204 ) 14205 ) 14206 ); 14207 } 14208 14209 function facebookvideoHandler(target) { 14210 var matches = _facebookvideoRegex.exec(target); 14211 14212 if (!matches) { 14213 return false; 14214 } 14215 14216 if (0 !== target.indexOf('http')) { 14217 target = 'https:' + target; 14218 } 14219 14220 return iframeHandler( 14221 transferHash( 14222 target, 14223 appendQueryParams( 14224 'https://www.facebook.com/plugins/video.php?href=' + target, 14225 $.extend( 14226 { 14227 autoplay: 1 14228 }, 14229 parseQueryParams(matches[4] || '') 14230 ) 14231 ) 14232 ) 14233 ); 14234 } 14235 14236 function googlemapsHandler(target) { 14237 var matches = _googlemapsRegex.exec(target); 14238 14239 if (!matches) { 14240 return false; 14241 } 14242 14243 return iframeHandler( 14244 transferHash( 14245 target, 14246 appendQueryParams( 14247 'https://www.google.' + matches[3] + '/maps?' + matches[6], 14248 { 14249 output: matches[6].indexOf('layer=c') > 0 ? 'svembed' : 'embed' 14250 } 14251 ) 14252 ) 14253 ); 14254 } 14255 14256 function iframeHandler(target) { 14257 return '<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen allow="autoplay; fullscreen" src="' + target + '"/></div>'; 14258 } 14259 14260 function winHeight() { 14261 return document.documentElement.clientHeight 14262 ? document.documentElement.clientHeight 14263 : Math.round(_win.height()); 14264 } 14265 14266 function keydown(e) { 14267 var current = currentInstance(); 14268 14269 if (!current) { 14270 return; 14271 } 14272 14273 // ESC key 14274 if (e.keyCode === 27 && !!current.options('esc')) { 14275 current.close(); 14276 } 14277 14278 // TAB key 14279 if (e.keyCode === 9) { 14280 handleTabKey(e, current); 14281 } 14282 } 14283 14284 function handleTabKey(e, instance) { 14285 var focusableElements = instance.element().find(_focusableElementsSelector); 14286 var focusedIndex = focusableElements.index(document.activeElement); 14287 14288 if (e.shiftKey && focusedIndex <= 0) { 14289 focusableElements.get(focusableElements.length - 1).focus(); 14290 e.preventDefault(); 14291 } else if (!e.shiftKey && focusedIndex === focusableElements.length - 1) { 14292 focusableElements.get(0).focus(); 14293 e.preventDefault(); 14294 } 14295 } 14296 14297 function resize() { 14298 $.each(_instances, function(i, instance) { 14299 instance.resize(); 14300 }); 14301 } 14302 14303 function registerInstance(instanceToRegister) { 14304 if (1 === _instances.unshift(instanceToRegister)) { 14305 _html.addClass('lity-active'); 14306 14307 _win 14308 .on({ 14309 resize: resize, 14310 keydown: keydown 14311 }) 14312 ; 14313 } 14314 14315 $('body > *').not(instanceToRegister.element()) 14316 .addClass('lity-hidden') 14317 .each(function() { 14318 var el = $(this); 14319 14320 if (undefined !== el.data(_dataAriaHidden)) { 14321 return; 14322 } 14323 14324 el.data(_dataAriaHidden, el.attr(_attrAriaHidden) || null); 14325 }) 14326 .attr(_attrAriaHidden, 'true') 14327 ; 14328 } 14329 14330 function removeInstance(instanceToRemove) { 14331 var show; 14332 14333 instanceToRemove 14334 .element() 14335 .attr(_attrAriaHidden, 'true') 14336 ; 14337 14338 if (1 === _instances.length) { 14339 _html.removeClass('lity-active'); 14340 14341 _win 14342 .off({ 14343 resize: resize, 14344 keydown: keydown 14345 }) 14346 ; 14347 } 14348 14349 _instances = $.grep(_instances, function(instance) { 14350 return instanceToRemove !== instance; 14351 }); 14352 14353 if (!!_instances.length) {
14354 show = _instances[0].element(); 14355 } else { 14356 show = $('.lity-hidden'); 14357 } 14358 14359 show 14360 .removeClass('lity-hidden') 14361 .each(function() { 14362 var el = $(this), oldAttr = el.data(_dataAriaHidden); 14363 14364 if (!oldAttr) { 14365 el.removeAttr(_attrAriaHidden); 14366 } else { 14367 el.attr(_attrAriaHidden, oldAttr); 14368 } 14369 14370 el.removeData(_dataAriaHidden); 14371 }) 14372 ; 14373 } 14374 14375 function currentInstance() { 14376 if (0 === _instances.length) { 14377 return null; 14378 } 14379 14380 return _instances[0]; 14381 } 14382 14383 function factory(target, instance, handlers, preferredHandler) { 14384 var handler = 'inline', content; 14385 14386 var currentHandlers = $.extend({}, handlers); 14387 14388 if (preferredHandler && currentHandlers[preferredHandler]) { 14389 content = currentHandlers[preferredHandler](target, instance); 14390 handler = preferredHandler; 14391 } else { 14392 // Run inline and iframe handlers after all other handlers 14393 $.each(['inline', 'iframe'], function(i, name) { 14394 delete currentHandlers[name]; 14395 14396 currentHandlers[name] = handlers[name]; 14397 }); 14398 14399 $.each(currentHandlers, function(name, currentHandler) { 14400 // Handler might be "removed" by setting callback to null 14401 if (!currentHandler) { 14402 return true; 14403 } 14404 14405 if ( 14406 currentHandler.test && 14407 !currentHandler.test(target, instance) 14408 ) { 14409 return true; 14410 } 14411 14412 content = currentHandler(target, instance); 14413 14414 if (false !== content) { 14415 handler = name; 14416 return false; 14417 } 14418 }); 14419 } 14420 14421 return {handler: handler, content: content || ''}; 14422 } 14423 14424 function Lity(target, options, opener, activeElement) { 14425 var self = this; 14426 var result; 14427 var isReady = false; 14428 var isClosed = false; 14429 var element; 14430 var content; 14431 14432 options = $.extend( 14433 {}, 14434 _defaultOptions, 14435 options 14436 ); 14437 14438 element = $(options.template); 14439 14440 // -- API -- 14441 14442 self.element = function() { 14443 return element; 14444 }; 14445 14446 self.opener = function() { 14447 return opener; 14448 }; 14449 14450 self.options = $.proxy(settings, self, options); 14451 self.handlers = $.proxy(settings, self, options.handlers); 14452 14453 self.resize = function() { 14454 if (!isReady || isClosed) { 14455 return; 14456 } 14457 14458 content 14459 .css('max-height', winHeight() + 'px') 14460 .trigger('lity:resize', [self]) 14461 ; 14462 }; 14463 14464 self.close = function() { 14465 if (!isReady || isClosed) { 14466 return; 14467 } 14468 14469 isClosed = true; 14470 14471 removeInstance(self); 14472 14473 var deferred = _deferred(); 14474 14475 // We return focus only if the current focus is inside this instance 14476 if ( 14477 activeElement && 14478 ( 14479 document.activeElement === element[0] || 14480 $.contains(element[0], document.activeElement) 14481 ) 14482 ) { 14483 try { 14484 activeElement.focus(); 14485 } catch (e) { 14486 // Ignore exceptions, eg. for SVG elements which can't be 14487 // focused in IE11 14488 } 14489 } 14490 14491 content.trigger('lity:close', [self]); 14492 14493 element 14494 .removeClass('lity-opened') 14495 .addClass('lity-closed') 14496 ; 14497 14498 transitionEnd(content.add(element)) 14499 .always(function() { 14500 content.trigger('lity:remove', [self]); 14501 element.remove(); 14502 element = undefined; 14503 deferred.resolve(); 14504 }) 14505 ; 14506 14507 return deferred.promise(); 14508 }; 14509 14510 // -- Initialization -- 14511 14512 result = factory(target, self, options.handlers, options.handler); 14513 14514 element 14515 .attr(_attrAriaHidden, 'false') 14516 .addClass('lity-loading lity-opened lity-' + result.handler) 14517 .appendTo('body') 14518 .focus() 14519 .on('click', '[data-lity-close]', function(e) { 14520 if ($(e.target).is('[data-lity-close]')) { 14521 self.close(); 14522 } 14523 }) 14524 .trigger('lity:open', [self]) 14525 ; 14526 14527 registerInstance(self); 14528 14529 $.when(result.content) 14530 .always(ready) 14531 ; 14532 14533 function ready(result) { 14534 content = $(result) 14535 .css('max-height', winHeight() + 'px') 14536 ; 14537 14538 element 14539 .find('.lity-loader') 14540 .each(function() { 14541 var loader = $(this); 14542 14543 transitionEnd(loader) 14544 .always(function() { 14545 loader.remove(); 14546 }) 14547 ; 14548 }) 14549 ; 14550 14551 element 14552 .removeClass('lity-loading') 14553 .find('.lity-content') 14554 .empty() 14555 .append(content) 14556 ; 14557 14558 isReady = true; 14559 14560 content 14561 .trigger('lity:ready', [self]) 14562 ; 14563 } 14564 } 14565 14566 function lity(target, options, opener) { 14567 if (!target.preventDefault) { 14568 opener = $(opener); 14569 } else { 14570 target.preventDefault(); 14571 opener = $(this); 14572 target = opener.data('lity-target') || opener.attr('href') || opener.attr('src'); 14573 } 14574 14575 var instance = new Lity( 14576 target, 14577 $.extend( 14578 {}, 14579 opener.data('lity-options') || opener.data('lity'), 14580 options 14581 ), 14582 opener, 14583 document.activeElement 14584 ); 14585 14586 if (!target.preventDefault) { 14587 return instance; 14588 } 14589 } 14590 14591 lity.version = '@VERSION'; 14592 lity.options = $.proxy(settings, lity, _defaultOptions); 14593 lity.handlers = $.proxy(settings, lity, _defaultOptions.handlers); 14594 lity.current = currentInstance; 14595 14596 $(document).on('click.lity', '[data-lity]', lity); 14597 14598 return lity; 14599})); 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639// LAZY LOAD 14640!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).LazyLoad=n()}(this,(function(){"use strict";function t(){return(t=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t}).apply(this,arguments)}var n="undefined"!=typeof window,e=n&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),i=n&&"IntersectionObserver"in window,o=n&&"classList"in document.createElement("p"),r=n&&window.devicePixelRatio>1,a={elements_selector:".lazy",container:e||n?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},c=function(n){return t({},a,n)},s=function(t,n){var e,i="LazyLoad::Initialized",o=new t(n);try{e=new CustomEvent(i,{detail:{instance:o}})}catch(t){(e=document.createEvent("CustomEvent")).initCustomEvent(i,!1,!1,{instance:o})}window.dispatchEvent(e)}
vendor: 5,966 bytes, line 14640
14640,l="loading",u="loaded",d="applied",f="error",_="native",g="data-",v="ll-status",p=function(t,n){return t.getAttribute(g+n)},b=function(t){return p(t,v)},h=function(t,n){return function(t,n,e){var i="data-ll-status";null!==e?t.setAttribute(i,e):t.removeAttribute(i)}(t,0,n)},m=function(t){return h(t,null)},E=function(t){return null===b(t)},y=function(t){return b(t)===_},A=[l,u,d,f],I=function(t,n,e,i){t&&(void 0===i?void 0===e?t(n):t(n,e):t(n,e,i))},L=function(t,n){o?t.classList.add(n):t.className+=(t.className?" ":"")+n},w=function(t,n){o?t.classList.remove(n):t.className=t.className.replace(new RegExp("(^|\\s+)"+n+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},k=function(t){return t.llTempImage},O=function(t,n){if(n){var e=n._observer;e&&e.unobserve(t)}},x=function(t,n){t&&(t.loadingCount+=n)},z=function(t,n){t&&(t.toLoadCount=n)},C=function(t){for(var n,e=[],i=0;n=t.children[i];i+=1)"SOURCE"===n.tagName&&e.push(n);return e},N=function(t,n,e){e&&t.setAttribute(n,e)},M=function(t,n){t.removeAttribute(n)},R=function(t){return!!t.llOriginalAttrs},G=function(t){if(!R(t)){var n={};n.src=t.getAttribute("src"),n.srcset=t.getAttribute("srcset"),n.sizes=t.getAttribute("sizes"),t.llOriginalAttrs=n}},T=function(t){if(R(t)){var n=t.llOriginalAttrs;N(t,"src",n.src),N(t,"srcset",n.srcset),N(t,"sizes",n.sizes)}},j=function(t,n){N(t,"sizes",p(t,n.data_sizes)),N(t,"srcset",p(t,n.data_srcset)),N(t,"src",p(t,n.data_src))},D=function(t){M(t,"src"),M(t,"srcset"),M(t,"sizes")},F=function(t,n){var e=t.parentNode;e&&"PICTURE"===e.tagName&&C(e).forEach(n)},P={IMG:function(t,n){F(t,(function(t){G(t),j(t,n)})),G(t),j(t,n)},IFRAME:function(t,n){N(t,"src",p(t,n.data_src))},VIDEO:function(t,n){!function(t,e){C(t).forEach((function(t){N(t,"src",p(t,n.data_src))}))}(t),N(t,"poster",p(t,n.data_poster)),N(t,"src",p(t,n.data_src)),t.load()}},S=function(t,n){var e=P[t.tagName];e&&e(t,n)},V=function(t,n,e){x(e,1),L(t,n.class_loading),h(t,l),I(n.callback_loading,t,e)},U=["IMG","IFRAME","VIDEO"],$=function(t,n){!n||function(t){return t.loadingCount>0}(n)||function(t){return t.toLoadCount>0}(n)||I(t.callback_finish,n)},q=function(t,n,e){t.addEventListener(n,e),t.llEvLisnrs[n]=e},H=function(t,n,e){t.removeEventListener(n,e)},B=function(t){return!!t.llEvLisnrs},J=function(t){if(B(t)){var n=t.llEvLisnrs;for(var e in n){var i=n[e];H(t,e,i)}delete t.llEvLisnrs}},K=function(t,n,e){!function(t){delete t.llTempImage}(t),x(e,-1),function(t){t&&(t.toLoadCount-=1)}(e),w(t,n.class_loading),n.unobserve_completed&&O(t,e)},Q=function(t,n,e){var i=k(t)||t;B(i)||function(t,n,e){B(t)||(t.llEvLisnrs={});var i="VIDEO"===t.tagName?"loadeddata":"load";q(t,i,n),q(t,"error",e)}(i,(function(o){!function(t,n,e,i){var o=y(n);K(n,e,i),L(n,e.class_loaded),h(n,u),I(e.callback_loaded,n,i),o||$(e,i)}(0,t,n,e),J(i)}),(function(o){!function(t,n,e,i){var o=y(n);K(n,e,i),L(n,e.class_error),h(n,f),I(e.callback_error,n,i),o||$(e,i)}(0,t,n,e),J(i)}))},W=function(t,n,e){!function(t){t.llTempImage=document.createElement("IMG")}(t),Q(t,n,e),function(t,n,e){var i=p(t,n.data_bg),o=p(t,n.data_bg_hidpi),a=r&&o?o:i;a&&(t.style.backgroundImage='url("'.concat(a,'")'),k(t).setAttribute("src",a),V(t,n,e))}(t,n,e),function(t,n,e){var i=p(t,n.data_bg_multi),o=p(t,n.data_bg_multi_hidpi),a=r&&o?o:i;a&&(t.style.backgroundImage=a,function(t,n,e){L(t,n.class_applied),h(t,d),n.unobserve_completed&&O(t,n),I(n.callback_applied,t,e)}(t,n,e))}(t,n,e)},X=function(t,n,e){!function(t){return U.indexOf(t.tagName)>-1}(t)?W(t,n,e):function(t,n,e){Q(t,n,e),S(t,n),V(t,n,e)}(t,n,e)},Y=["IMG","IFRAME"],Z=function(t){return t.use_native&&"loading"in HTMLImageElement.prototype},tt=function(t,n,e){t.forEach((function(t){return function(t){return t.isIntersecting||t.intersectionRatio>0}(t)?function(t,n,e,i){h(t,"entered"),L(t,e.class_entered),w(t,e.class_exited),function(t,n,e){n.unobserve_entered&&O(t,e)}(t,e,i),I(e.callback_enter,t,n,i),function(t){return A.indexOf(b(t))>=0}(t)||X(t,e,i)}(t.target,t,n,e):function(t,n,e,i){E(t)||(L(t,e.class_exited),function(t,n,e,i){e.cancel_on_exit&&function(t){return b(t)===l}(t)&&"IMG"===t.tagName&&(J(t),function(t){F(t,(function(t){D(t)})),D(t)}(t),function(t){F(t,(function(t){T(t)})),T(t)}(t),w(t,e.class_loading),x(i,-1),m(t),I(e.callback_cancel,t,n,i))}(t,n,e,i),I(e.callback_exit,t,n,i))}(t.target,t,n,e)}))},nt=function(t){return Array.prototype.slice.call(t)},et=function(t){return t.container.querySelectorAll(t.elements_selector)},it=function(t){return function(t){return b(t)===f}(t)},ot=function(t,n){return function(t){return nt(t).filter(E)}(t||et(n))},rt=function(t,e){var o=c(t);this._settings=o,this.loadingCount=0,function(t,n){i&&!Z(t)&&(n._observer=new IntersectionObserver((function(e){tt(e,t,n)}),function(t){return{root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}}(t)))}(o,this),function(t,e){n&&window.addEventListener("online",(function(){!function(t,n){var e;(e=et(t),nt(e).filter(it)).forEach((function(n){w(n,t.class_error),m(n)})),n.update()}(t,e)}))}(o,this),this.update(e)};return rt.prototype={update:function(t){var n,o,r=this._settings,a=ot(t,r);z(this,a.length),!e&&i?Z(r)?function(t,n,e){t.forEach((function(t){-1!==Y.indexOf(t.tagName)&&(t.setAttribute("loading","lazy"),function(t,n,e){Q(t,n,e),S(t,n),h(t,_)}(t,n,e))})),z(e,0)}(a,r,this):(o=a,function(t){t.disconnect()}(n=this._observer),function(t,n){n.forEach((function(n){t.observe(n)}))}(n,o)):this.loadAll(a)},destroy:function(){this._observer&&this._observer.disconnect(),et(this._settings).forEach((function(t){delete t.llOriginalAttrs})),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){var n=this,e=this._settings;ot(t,e).forEach((function(t){O(t,n),X(t,e,n)}))}},rt.load=function(t,n){var e=c(n);X(t,e)},rt.resetStatus=function(t){m(t)},n&&function(t,n){if(n)if(n.length)for(var e,i=0;e=n[i];i+=1)s(t,e);else s(t,n)}(rt,window.lazyLoadOptions),rt}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.