-
Notifications
You must be signed in to change notification settings - Fork 2
/
QBox.min.js
3 lines (3 loc) · 1.07 KB
/
QBox.min.js
1
2
3
/* Copyright 2012 - Dave McAlpine (github: dmcalpin), 2013 - Dan Nixon (github: turboclaw) */
var QBox=function(){function l(e,a){for(o in a)a.hasOwnProperty(o)&&(e[o]=a[o]);return e}function h(e,a){var f=a?document.querySelector("."+a):document.body;elem=document.createElement("div");elem.className=e;f.insertBefore(elem,f.firstChild);return elem}var k="qb-content",m="qb-close";return function(e){function a(){g=h(m,k);g.onclick=function(){f()};g.innerHTML=b.closeHTML}function f(){var a=c.parentNode;a&&a.removeChild(c);b.onClose(this)}var b={html:"",modal:!1,showClose:!0,onOpen:function(){},
onClose:function(){},className:"",closeHTML:"×",autoCenter:!0,blurBackground:!1},c,d,g;l(b,e);this.show=function(){c=h("qb-mask");c.style.display="block";b.blurBackground&&(c.className+=" qb-blur-background");b.modal||(c.onclick=function(a){a.target!==c&&a.target!==g||f()});d=h(k,"qb-mask");d.style.display="block";d.className+=" "+b.className;b.autoCenter&&(d.className+=" qb-auto-center");d.innerHTML=b.html;b.showClose&&a();b.onOpen(this)};this.hide=f;this.settings=function(){return b}}}();