|
|
|
!function(a){"use strict";"function"==typeof define&&define.amd?define(a):window.Ply=a()}(function(){"use strict";function a(a){if(P)return new P(a);var b=M.Deferred();return a(b.resolve,b.reject),b}function b(a){return P?P.all(a):M.when.apply(M,a)}function c(b){return a(function(a){return a(b)})}function d(a){return a&&a.then?a:c(a)}function e(a){return"function"==typeof a}function f(a,b){if(a)for(var c in a)a.hasOwnProperty(c)&&b(a[c],c,a)}function g(a){var b={};return f(a,function(a,c){b[c]=e(a)?a:a instanceof Object?g(a):a}),b}function h(a){for(var b=Array.prototype.slice,c=b.call(arguments,1),d=0,e=c.length;e>d;d++)f(c[d],function(b,c){a[c]=b});return a}function i(a,b){try{return(b||G).querySelector(a)}catch(c){return M(a,b)[0]}}function j(a,b){return a.getElementsByTagName(b)}function k(a,b){try{a&&b&&a.appendChild(b)}catch(c){}}function l(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function m(a,b,c){var d=c.handle=c.handle||function(b){b.target||(b.target=b.srcElement||G),3===b.target.nodeType&&(b.target=b.target.parentNode),b.preventDefault||(b.preventDefault=function(){b.returnValue=!1}),b.stopPropagation||(b.stopPropagation=function(){b.cancelBubble=!0}),c.call(a,b)};a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent("on"+b,d)}function n(a,b,c){var d=c.handle;d&&(a.removeEventListener?a.removeEventListener(b,d,!1):a.detachEvent("on"+b,d))}function o(a){if(null==a&&(a="div"),a.appendChild)return a;if(a.skip)return G.createDocumentFragment();"string"==typeof a&&(a={tag:a});var b,c=a.children,d=R.exec(a.tag||"");return delete a.children,a.tag=d[1]||"div",a.id=a.id||(d[2]||"").substr(1),d=(d[3]||"").split("."),d[0]=a.className||"",a.className=d.join(" "),b=G.createElement(a.tag),delete a.tag,f(a,function(c,d){if(c)if("css"===d)r(b,a.css);else if("text"===d)null!=c&&k(b,G.createTextNode(c));else if("html"===d)null!=c&&(b.innerHTML=c);else if("ply"===d)b.setAttribute(L,c);else if(d in b)try{b[d]=c}catch(e){b.setAttribute(d,c)}else/^data-/.test(d)&&b.setAttribute(d,c)}),c&&c.appendChild?k(b,c):f(c,function(a,c){a&&("string"==typeof a?a={text:a}:"object"!=typeof a&&(a={}),"string"==typeof c&&(a.tag=a.tag||c),k(b,o(a)))}),b}function p(a){for(var b,c,d=j(a,"input"),e=0,f=d.length;f>e;e++)if(b=d[e],"submit"===b.type)!c&&(c=b);else if(!/hidden|check|radio/.test(b.type)&&""==b.value){c=b;break}c||(c=j(a,"button")[0]);try{c.focus()}catch(g){}}function q(b){return s(!0),a(function(a){for(var c,d=j(b,"img"),e=d.length,f=e,g=function(){if(--f<=0){for(e=d.length;e--;)c=d[e],n(c,"load",g),n(c,"error",g);s(!1),a()}};e--;)c=d[e],c.complete?f--:(m(c,"load",g),m(c,"error",g));!f&&g()})}function r(a,b,c){if(a&&a.style&&b)if(b instanceof Object)for(var d in b)r(a,d,b[d]);else{if(void 0===c)return G.defaultView&&G.defaultView.getComputedStyle?c=G.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];S[b]?S[b](a.style,c):a.style[J[b]||b]=c}}function s(a){var b=s.get();clearTimeout(s.pid),s.pid=a?H(function(){k(G.body,b)},100):H(function(){l(b)},100)}function t(a,b){return o({css:{padding:"20px 20px 40px",display:"inline-block",position:"relative",textAlign:"left",whiteSpace:"normal",verticalAlign:"middle",transform:"translate3d(0, 0, 0)"},children:b.baseHtml?[{ply:":layer",tag:".ply-layer",className:b.mod,css:h({overflow:"hidden",position:"relative",backfaceVisibility:"hidden"},b.layer),children:[b.flags.closeBtn&&{ply:":close",tag:".ply-x",text:I.cross},{tag:".ply-inside",children:a}]}]:a})}function u(a){return o({ply:":overlay",tag:".ply-overlay",css:{top:0,left:0,right:0,bottom:0,position:"fixed"},children:[{tag:"div",css:h({width:"100%",height:"100%"},a)}]})}function v(a,b,c){a.wrapEl=o({tag:"form",css:{whiteSpace:"nowrap",zIndex:b.zIndex}}),c||(a.overlayEl=u(b.overlay),a.overlayBoxEl=a.overlayEl.firstChild,k(a.wrapEl,a.overlayEl));var d=o();r(d,{height:"100%",display:"inline-block",verticalAlign:"middle"}),k(a.wrapEl,d);var e=b.el;return a.el=e&&e.cloneNode?e.cloneNode(!0):o({html:e||""}),a.layerEl=t(a.el,b),a.contentEl=w(a.layerEl),a.context=new y(a.layerEl),k(a.wrapEl,a.layerEl),a.bo
|