LocalCDN-Firefox-Chrome-Brave/resources/vex-js/4.1.0/vex.min.jsm

3 lines
8.8 KiB
JavaScript

/*! vex.js 4.1.0 */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).vex=e()}}(function(){return function e(t,n,o){function i(s,l){if(!n[s]){if(!t[s]){var a="function"==typeof require&&require;if(!l&&a)return a(s,!0);if(r)return r(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[s]={exports:{}};t[s][0].call(d.exports,function(e){var n=t[s][1][e];return i(n||e)},d,d.exports,e,t,n,o)}return n[s].exports}for(var r="function"==typeof require&&require,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,n){"document"in window.self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||function(e){"use strict";if("Element"in e){var t="classList",n="prototype",o=e.Element[n],i=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},s=Array[n].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},l=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},a=function(e,t){if(""===t)throw new l("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new l("INVALID_CHARACTER_ERR","String contains an invalid character");return s.call(e,t)},c=function(e){for(var t=r.call(e.getAttribute("class")||""),n=t?t.split(/\s+/):[],o=0,i=n.length;o<i;o++)this.push(n[o]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},d=c[n]=[],u=function(){return new c(this)};if(l[n]=Error[n],d.item=function(e){return this[e]||null},d.contains=function(e){return-1!==a(this,e+="")},d.add=function(){for(var e,t=arguments,n=0,o=t.length,i=!1;e=t[n]+"",-1===a(this,e)&&(this.push(e),i=!0),++n<o;);i&&this._updateClassName()},d.remove=function(){var e,t,n=arguments,o=0,i=n.length,r=!1;do{for(e=n[o]+"",t=a(this,e);-1!==t;)this.splice(t,1),r=!0,t=a(this,e)}while(++o<i);r&&this._updateClassName()},d.toggle=function(e,t){e+="";var n=this.contains(e),o=n?!0!==t&&"remove":!1!==t&&"add";return o&&this[o](e),!0===t||!1===t?t:!n},d.toString=function(){return this.join(" ")},i.defineProperty){var f={get:u,enumerable:!0,configurable:!0};try{i.defineProperty(o,t,f)}catch(e){void 0!==e.number&&-2146823252!==e.number||(f.enumerable=!1,i.defineProperty(o,t,f))}}else i[n].__defineGetter__&&o.__defineGetter__(t,u)}}(window.self),function(){"use strict";var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var n,o=arguments.length;for(n=0;n<o;n++)e=arguments[n],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var n=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:n.call(this,e)}}e=null}())},{}],2:[function(e,t,n){t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var o=n[1];if("body"==o){var i=t.createElement("html");return i.innerHTML=e,i.removeChild(i.lastChild)}var s=r[o]||r._default,l=s[0],a=s[1],c=s[2];(i=t.createElement("div")).innerHTML=a+e+c;for(;l--;)i=i.lastChild;if(i.firstChild==i.lastChild)return i.removeChild(i.firstChild);var d=t.createDocumentFragment();for(;i.firstChild;)d.appendChild(i.removeChild(i.firstChild));return d};var o,i=!1;"undefined"!=typeof document&&((o=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',i=!o.getElementsByTagName("link").length,o=void 0);var r={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:i?[1,"X<div>","</div>"]:[0,"",""]};r.td=r.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],r.option=r.optgroup=[1,'<select multiple="multiple">',"</select>"],r.thead=r.tbody=r.colgroup=r.caption=r.tfoot=[1,"<table>","</table>"],r.polyline=r.ellipse=r.polygon=r.circle=r.text=r.line=r.path=r.rect=r.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"]},{}],3:[function(e,t,n){"use strict";function o(e,t){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var n=Object(e),o=1;o<arguments.length;o++){var i=arguments[o];if(null!=i)for(var r=Object.keys(Object(i)),s=0,l=r.length;s<l;s++){var a=r[s],c=Object.getOwnPropertyDescriptor(i,a);void 0!==c&&c.enumerable&&(n[a]=i[a])}}return n}t.exports={assign:o,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:o})}}},{}],4:[function(e,t,n){e("classlist-polyfill"),e("es6-object-assign").polyfill();var o=e("domify"),i=function(e){if(void 0!==e){var t=document.createElement("div");return t.appendChild(document.createTextNode(e)),t.innerHTML}return""},r=function(e,t){if("string"==typeof t&&0!==t.length)for(var n=t.split(" "),o=0;o<n.length;o++){var i=n[o];i.length&&e.classList.add(i)}},s=function(){var e=document.createElement("div"),t={animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oanimationend",msAnimation:"MSAnimationEnd"};for(var n in t)if(void 0!==e.style[n])return t[n];return!1}(),l="vex",a="vex-content",c="vex-overlay",d="vex-close",u="vex-closing",f="vex-open",p={},v=1,h=!1,m={open:function(e){var t=function(e){console.warn('The "'+e+'" property is deprecated in vex 3. Use CSS classes and the appropriate "ClassName" options, instead.'),console.warn("See http://github.hubspot.com/vex/api/advanced/#options")};e.css&&t("css"),e.overlayCSS&&t("overlayCSS"),e.contentCSS&&t("contentCSS"),e.closeCSS&&t("closeCSS");var n={};n.id=v++,p[n.id]=n,n.isOpen=!0,n.close=function(){if(!this.isOpen)return!0;var e=this.options;if(h&&!e.escapeButtonCloses)return!1;if(!1===function(){return!e.beforeClose||e.beforeClose.call(this)}.bind(this)())return!1;this.isOpen=!1;var t=window.getComputedStyle(this.contentEl);function n(e){return"none"!==t.getPropertyValue(e+"animation-name")&&"0s"!==t.getPropertyValue(e+"animation-duration")}var o=n("")||n("-webkit-")||n("-moz-")||n("-o-"),i=function t(){this.rootEl.parentNode&&(this.rootEl.removeEventListener(s,t),this.overlayEl.removeEventListener(s,t),delete p[this.id],this.rootEl.parentNode.removeChild(this.rootEl),this.bodyEl.removeChild(this.overlayEl),e.afterClose&&e.afterClose.call(this),0===Object.keys(p).length&&document.body.classList.remove(f))}.bind(this);return s&&o?(this.rootEl.addEventListener(s,i),this.overlayEl.addEventListener(s,i),this.rootEl.classList.add(u),this.overlayEl.classList.add(u)):i(),!0},"string"==typeof e&&(e={content:e}),e.unsafeContent&&!e.content?e.content=e.unsafeContent:e.content&&(e.content=i(e.content));var g=n.options=Object.assign({},m.defaultOptions,e),y=n.bodyEl=document.getElementsByTagName("body")[0],b=n.rootEl=document.createElement("div");b.classList.add(l),r(b,g.className);var C=n.overlayEl=document.createElement("div");C.classList.add(c),r(C,g.overlayClassName),g.overlayClosesOnClick&&b.addEventListener("click",function(e){e.target===b&&n.close()}),y.appendChild(C);var E=n.contentEl=document.createElement("div");if(E.classList.add(a),r(E,g.contentClassName),E.appendChild(g.content instanceof window.Node?g.content:o(g.content)),b.appendChild(E),g.showCloseButton){var w=n.closeEl=document.createElement("div");w.classList.add(d),r(w,g.closeClassName),w.addEventListener("click",n.close.bind(n)),E.appendChild(w)}return document.querySelector(g.appendLocation).appendChild(b),g.afterOpen&&g.afterOpen.call(n),document.body.classList.add(f),n},close:function(e){var t;if(e.id)t=e.id;else{if("string"!=typeof e)throw new TypeError("close requires a vex object or id string");t=e}return!!p[t]&&p[t].close()},closeTop:function(){var e=Object.keys(p);return!!e.length&&p[e[e.length-1]].close()},closeAll:function(){for(var e in p)this.close(e);return!0},getAll:function(){return p},getById:function(e){return p[e]}};window.addEventListener("keyup",function(e){27===e.keyCode&&(h=!0,m.closeTop(),h=!1)}),window.addEventListener("popstate",function(){m.defaultOptions.closeAllOnPopState&&m.closeAll()}),m.defaultOptions={content:"",showCloseButton:!0,escapeButtonCloses:!0,overlayClosesOnClick:!0,appendLocation:"body",className:"",overlayClassName:"",contentClassName:"",closeClassName:"",closeAllOnPopState:!0},Object.defineProperty(m,"_escapeHtml",{configurable:!1,enumerable:!1,writable:!1,value:i}),m.registerPlugin=function(e,t){var n=e(m),o=t||n.name;if(m[o])throw new Error("Plugin "+t+" is already registered.");m[o]=n},t.exports=m},{"classlist-polyfill":1,domify:2,"es6-object-assign":3}]},{},[4])(4)});