1 line
7.4 KiB
JavaScript
1 line
7.4 KiB
JavaScript
|
!function(t,n){"function"==typeof define&&define.amd?define(["jquery"],function(e){return n(t,e)}):"object"==typeof exports?n(t,require("jquery")):n(t,t.jQuery||t.Zepto)}(this,function(t,n){"use strict";function e(t){if(E&&"none"===t.css("animation-name")&&"none"===t.css("-webkit-animation-name")&&"none"===t.css("-moz-animation-name")&&"none"===t.css("-o-animation-name")&&"none"===t.css("-ms-animation-name"))return 0;var n,e,a,i,o=t.css("animation-duration")||t.css("-webkit-animation-duration")||t.css("-moz-animation-duration")||t.css("-o-animation-duration")||t.css("-ms-animation-duration")||"0s",s=t.css("animation-delay")||t.css("-webkit-animation-delay")||t.css("-moz-animation-delay")||t.css("-o-animation-delay")||t.css("-ms-animation-delay")||"0s",r=t.css("animation-iteration-count")||t.css("-webkit-animation-iteration-count")||t.css("-moz-animation-iteration-count")||t.css("-o-animation-iteration-count")||t.css("-ms-animation-iteration-count")||"1";for(o=o.split(", "),s=s.split(", "),r=r.split(", "),i=0,e=o.length,n=Number.NEGATIVE_INFINITY;i<e;i++)a=parseFloat(o[i])*parseInt(r[i],10)+parseFloat(s[i]),a>n&&(n=a);return n}function a(){if(n(document.body).height()<=n(window).height())return 0;var t,e,a=document.createElement("div"),i=document.createElement("div");return a.style.visibility="hidden",a.style.width="100px",document.body.appendChild(a),t=a.offsetWidth,a.style.overflow="scroll",i.style.width="100%",a.appendChild(i),e=i.offsetWidth,a.parentNode.removeChild(a),t-e}function i(){if(!N){var t,e,i=n("html"),o=c("is-locked");i.hasClass(o)||(e=n(document.body),t=parseInt(e.css("padding-right"),10)+a(),e.css("padding-right",t+"px"),i.addClass(o))}}function o(){if(!N){var t,e,i=n("html"),o=c("is-locked");i.hasClass(o)&&(e=n(document.body),t=parseInt(e.css("padding-right"),10)-a(),e.css("padding-right",t+"px"),i.removeClass(o))}}function s(t,n,e,a){var i=c("is",n),o=[c("is",$.CLOSING),c("is",$.OPENING),c("is",$.CLOSED),c("is",$.OPENED)].join(" ");t.$bg.removeClass(o).addClass(i),t.$overlay.removeClass(o).addClass(i),t.$wrapper.removeClass(o).addClass(i),t.$modal.removeClass(o).addClass(i),t.state=n,!e&&t.$modal.trigger({type:n,reason:a},[{reason:a}])}function r(t,a,i){var o=0,s=function(t){t.target===this&&o++},r=function(t){t.target===this&&0===--o&&(n.each(["$bg","$overlay","$wrapper","$modal"],function(t,n){i[n].off(v+" "+C)}),a())};n.each(["$bg","$overlay","$wrapper","$modal"],function(t,n){i[n].on(v,s).on(C,r)}),t(),0===e(i.$bg)&&0===e(i.$overlay)&&0===e(i.$wrapper)&&0===e(i.$modal)&&(n.each(["$bg","$overlay","$wrapper","$modal"],function(t,n){i[n].off(v+" "+C)}),a())}function d(t){t.state!==$.CLOSED&&(n.each(["$bg","$overlay","$wrapper","$modal"],function(n,e){t[e].off(v+" "+C)}),t.$bg.removeClass(t.settings.modifier),t.$overlay.removeClass(t.settings.modifier).hide(),t.$wrapper.hide(),o(),s(t,$.CLOSED,!0))}function l(t){var n,e,a,i,o={};for(t=t.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,","),n=t.split(","),i=0,e=n.length;i<e;i++)n[i]=n[i].split(":"),a=n[i][1],("string"==typeof a||a instanceof String)&&(a="true"===a||"false"!==a&&a),("string"==typeof a||a instanceof String)&&(a=isNaN(a)?a:+a),o[n[i][0]]=a;return o}function c(){for(var t=h,n=0;n<arguments.length;++n)t+="-"+arguments[n];return t}function m(){var t,e,a=location.hash.replace("#","");if(a){try{e=n('[data-remodal-id="'+a+'"]')}catch(t){}e&&e.length&&(t=n[g].lookup[e.data(g)],t&&t.settings.hashTracking&&t.open())}else u&&u.state===$.OPENED&&u.settings.hashTracking&&u.close()}function p(t,e){var a=n(document.body),i=a,o=this;o.settings=n.extend({},O,e),o.index=n[g].lookup.push(o)-1,o.state=$.CLOSED,o.$overlay=n("."+c("overlay")),null!==o.settings.appendTo&&o.settings.appendTo.length&&(i=n(o.settings.appendTo)),o.$overlay.length||(o.$overlay=n("<div>").addClass(c("overlay")+" "+c("is",$.CLOSED)).hide(),i.append(o.$overlay)),o.$bg=n("."+c("bg")).addClass(c("is",$.CLOSED)),o.$modal=t.addClass(h+" "+c("is-initialized")+" "+o.settings.modifier+" "+c("is",$.CLOSED)).attr("tabindex","-1"),o.$wrapper=n("<div>").addClass(c("wrapper")+" "+o.settings.modifier+" "
|