UNPKG

insight-plugin-verifier

Version:

Insight-verifier

2 lines 2.84 kB
/*! #Dialog-plugin @author:Rzcccccc @update:2019.01.28 @version:v2.17 */ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var i in o)("object"==typeof exports?exports:e)[i]=o[i]}}(window,function(){return function(e){var t={};function o(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){e=e||{},this.el=e.el||"dialog",this.width=e.width||500,this.height=e.height||500,this.opacity=e.opacity||1,this.touchClose=e.touchClose||!1,this.closeBtn=e.closeBtn||!1,this.closeEle=e.closeEle||"dialog-close-btn"}return e.prototype.createWrap=function(){var e=document.body.clientWidth,t=document.body.clientHeight,o=document.createElement("div");o.setAttribute("id","cover-layer"),o.style.width=e+"px",o.style.height=t+"px",o.style.backgroundColor="rgb(0,0,0,"+this.opacity+")",o.style.position="absolute",o.style.left="0",o.style.top="0",o.style.zIndex="998",document.body.appendChild(o);var i=this;1==this.touchClose&&(document.getElementById("cover-layer").onclick=function(){i.hideDialog()})},e.prototype.createEle=function(){var e=document.getElementById(this.el),t=this.checkMachine();try{e.style.width="0"}catch(e){return void console.error("请先在html中定义el弹窗元素")}if("pc"==t)e.style.width=this.width+"px",e.style.height=this.height+"px";else{var o=this.width/100,i=this.height/100;e.style.width=o+"rem",e.style.height=i+"rem"}if(e.style.position="absolute",e.style.left="0",e.style.top="0",e.style.bottom="0",e.style.right="0",e.style.margin="auto",e.style.zIndex="999",e.style.display="block",1==this.closeBtn){var n=this,r=document.createElement("div");r.setAttribute("class",this.closeEle),e.appendChild(r),r.onclick=function(){n.hideDialog()}}},e.prototype.checkMachine=function(){if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent))var e="ios";else e=/(Android)/i.test(navigator.userAgent)?"android":"pc";return e},e.prototype.showDialog=function(){this.createWrap(),this.createEle()},e.prototype.hideDialog=function(){var e=document.getElementById(this.el);try{e.style.display="none"}catch(e){console.error("请先在html中定义el弹窗元素")}var t=document.getElementById("cover-layer");document.body.removeChild(t)},e}();t.Dialog=i}])});