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