11374766d7c4b705be9328bea4a3c29f5da44fd6fe3c0e6cb2f49d4fc3e086d3

Source Code:

var MG_Modal=function(){"use strict";var n,i;function t(){this.closeButton=null,this.container=null,this.modal=null,this.options=MG_Utils.extendDefaults({autoOpen:!1,className:"generalMTubes",closeButton:!0,closeDocument:!0,closeKey:!1,content:"",maxWidth:"",minWidth:"",overlay:!0,position:"",pageScrolling:!1,timeMs:null,lazyload:!1},arguments[0]),this.options.autoOpen&&this.openModal()}function s(){var e=null;if(document.createElement){var t=document.createElement("p"),o=/^rgba/;if(t&&t.style&&"function"==typeof o.test)try{t.style.color="rgba(1, 1, 1, 0.5)",e=o.test(t.style.color)}catch(t){e=!1}}return e}return t.prototype={constructor:t,closeModal:function(t){var e;n=!1,MG_Utils.removeClass(document.body,"isOpenMTubes"),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.options.timeMs&&clearTimeout(i),this.options.pageScrolling&&(e=document.body,MG_Utils.removeClass(e,"scrollMTubes"),e.style.height=""),t&&"function"==typeof t&&t(this.container,this.modal)},openModal:function(t){var e,o;n||(function(){var t,e=document.createElement("div"),o=document.createDocumentFragment();t="string"==typeof this.options.content?this.options.content:this.options.content.innerHTML.replace(/MHP1138-/gi,"");(function(){this.container=document.createElement("div"),this.container.id="modalWrapMTubes",this.container.className=(s()?"":"noRbga ")+"fadeInMTubes containerMTubes "+this.options.className;return this.container}).call(this),function(){return this.modal=document.createElement("div"),this.modal.className="modalMTubes "+this.options.className,this.modal.style.minWidth=this.options.minWidth,this.modal.style.maxWidth=this.options.maxWidth,this.modal}.call(this),e.className="contentMTubes",e.innerHTML=t,this.modal.appendChild(e),this.container.appendChild(this.modal),function(){this.options.closeButton&&(this.closeButton=document.createElement("button"),this.closeButton.className="closeMTubes buttonMTubes",this.modal.appendChild(this.closeButton));this.options.overlay&&MG_Utils.addClass(this.container,"isVisibleMTubes");{var t,e,o;this.options.pageScrolling&&(t=document.body,e=document.documentElement,o=Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight),MG_Utils.addClassMultiple([this.container,t],"scrollMTubes"),t.style.height=o+"px")}this.options.position&&(this.modal.style.marginTop=this.options.position)}.call(this),o.appendChild(this.container),document.body.appendChild(o)}.call(this),function(){var e=this;{var t;this.closeButton&&(t=function(){e.closeModal(),MG_Utils.removeEventHandler(e.closeButton,"click",t)},MG_Utils.addEventHandler(e.closeButton,"click",t))}{var o;this.container&&this.options.closeDocument&&(o=function(t){"modalWrapMTubes"===(t.target&&t.target.id||t.srcElement&&t.srcElement.id)&&(e.closeModal(),MG_Utils.removeEventHandler(e.container,"click",o))},MG_Utils.addEventHandler(e.container,"click",o))}{var n;this.container&&this.options.closeKey&&(n=function(t){t.keyCode?t.keyCode:t.charCode;27==t.keyCode&&(e.closeModal(),MG_Utils.removeEventHandler(document,"keyup",n))},MG_Utils.addEventHandler(document,"keyup",n))}}.call(this),MG_Utils.addClass(document.body,"isOpenMTubes"),MG_Utils.addClassMultiple([this.modal,this.container],"elOpenMTubes"),this.options.timeMs&&(i=setTimeout(function(){e.closeModal()},(e=this).options.timeMs)),t&&"function"==typeof t&&t(this.container,this.modal),function(t){if("string"==typeof t)return;var e=0,o=t.querySelectorAll("*"),n=o.length;for(;e<n;e++)o[e].id&&!o[e].id.match(/MHP1138-/gi)&&(o[e].id="MHP1138-"+o[e].id)}(this.options.content),this.options.lazyload&&(o=this.container)&&[].forEach.call(o.querySelectorAll(".lazy"),function(t){var e=t.getAttribute("data-src");e&&t.setAttribute("src",e)})),n=!0}},t}();