b0y-101 Mini Shell


Current Path : E:/www/risk/media/plg_system_miniteksystemmessages/js/
File Upload :
Current File : E:/www/risk/media/plg_system_miniteksystemmessages/js/polipop.min.js

/*!
 * Polipop v1.0.0
 *
 * A dependency-free JavaScript library for creating discreet pop-up notifications.
 *
 * Copyright (c) 2021 Yannis Maragos.
 *
 * Dual-licensed under the GNU General Public License (GPL) version 3 or later
 * and the Polipop Commercial License.
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This file is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. If not, see https://www.gnu.org/licenses/.
 *
 *  See the Polipop Commercial License at https://www.minitek.gr/license#polipop.
 */

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Polipop=t():e.Polipop=t()}(this,(function(){return(()=>{"use strict";var e={d:(t,o)=>{for(var i in o)e.o(o,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:o[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{default:()=>M});const o={appendTo:"body",block:"polipop",position:"top-right",layout:"popups",theme:"default",icons:!0,insert:"after",spacing:10,pool:0,sticky:!1,life:3e3,progressbar:!1,pauseOnHover:!0,headerText:"Messages",closer:!0,closeText:"Close",loadMoreText:"Load more",hideEmpty:!1,interval:250,effect:"fade",easing:"linear",effectDuration:250,ready:function(){},add:function(){},beforeOpen:function(){},open:function(){},afterOpen:function(){},beforeClose:function(){},close:function(){},click:function(){}};function i(e,t,o){let i=e,s=t,n=o;"string"==typeof e&&(n=t,s=e,i=window),n=n||{},i.dispatchEvent(new CustomEvent(s,{detail:n,bubbles:!0,cancelable:!0}))}function s(){if(this._wrapper.classList.contains(this._classes.block_open)){const e=this._wrapper.querySelector("."+this._classes["block__header-inner"]);this._wrapper.style.height=e.offsetHeight+"px"}else this._wrapper.style.height=this.wrapperHeight+"px";this._wrapper.classList.toggle(this._classes.block_open)}function n(){const e=this;if(!0===e._pauseOnHover)return;e._pauseOnHover=!0;const t=(new Date).getTime();e._container.querySelectorAll("."+e._classes.block__notification).forEach((e=>{e.pauseTime=t}))}function l(){const e=this;e._container.querySelectorAll("."+e._classes.block__notification).forEach((e=>{e.created+=(new Date).getTime()-e.pauseTime})),e._pauseOnHover=!1}function c(){const e=this;e._wrapper&&(clearTimeout(e._resizing),e._resizing=setTimeout((function(){e._overflow=!1,m.call(e)}),500))}function a(e,t){!1!==e.beforeOpen.apply(this,[e,t])&&i(t,"Polipop.open")}function r(e,t){const o=this;if("after"===o.options.insert?o._container.appendChild(t):"before"===o.options.insert&&o._container.insertBefore(t,o._container.querySelectorAll("."+o._classes.block__notification)[0]),t.style.display="block",o.wrapperHeight+="popups"===o.options.layout?t.offsetHeight+o.options.spacing:t.offsetHeight,o.elements.length>0&&"inline"!==o.options.position&&!0===v.apply(o,[e,t]))return;o.elements=o._container.querySelectorAll("."+o._classes.block__notification),"panel"===o.options.layout&&(o._wrapper.querySelector("."+o._classes["block__header-minimize"]).style.display="block",o._wrapper.classList.add(o._classes.block_open)),o._wrapper.style.height=o.wrapperHeight+"px",k.call(o,t),e.open.apply(o,[e,t]);b.apply(o,[t,"in"]).finished.then((function(){t.created=(new Date).getTime(),o._pauseOnHover&&(t.pauseTime=(new Date).getTime()),o.options.progressbar&&!t.sticky&&H.call(o,t),f.call(o),m.call(o),i(t,"Polipop.afterOpen")}))}function p(e,t){e.afterOpen.apply(this,[e,t])}function _(e,t){t.removing||!1!==e.beforeClose.apply(this,[e,t])&&i(t,"Polipop.close")}function h(e,t){const o=this;t.removing=!0,o.wrapperHeight-="popups"===o.options.layout?t.offsetHeight+o.options.spacing:t.offsetHeight;b.apply(o,[t,"out"]).finished.then((function(){w.call(o,t),o._wrapper.style.height=o.wrapperHeight+"px",!1!==e.close.apply(o,[e,t])&&t.remove(),o._overflow=!1,f.call(o),o.elements=o._container.querySelectorAll("."+o._classes.block__notification),"panel"===o.options.layout&&u.call(o,-1),m.call(o)}))}function d(e,t,o){t.click.apply(this,[e,t,o])}function u(e){const t=this._wrapper.querySelector("."+this._classes["block__header-count"]),o=parseInt(t.textContent,10);t.textContent=o+e}function f(){if(!this._closer)return;let e=!1;this.options.pool&&(e=this.elements&&this.elements.length===this.options.pool&&this.queue.length>0);(e||this._overflow)&&this.queue.length?(this._closer.querySelector("."+this._classes["block__closer-text"]).innerHTML=this.options.loadMoreText,this._closer.querySelector("."+this._classes["block__closer-count"]).style.display="inline-block",this._closer.querySelector("."+this._classes["block__closer-count"]).textContent=this.queue.length):0===this.queue.length&&(this._closer.querySelector("."+this._classes["block__closer-count"]).style.display="none",this._closer.querySelector("."+this._classes["block__closer-text"]).innerHTML=this.options.closeText)}function b(e,t){const o=this,i=[{opacity:"in"===t?"0":"1"},{opacity:"in"===t?"1":"0"}];"slide"===o.options.effect&&(o.options.position.endsWith("-left")?(i[0].left="in"===t?"-110%":"0",i[1].left="in"===t?"0":"-110%"):(i[0].right="in"===t?"-110%":"0",i[1].right="in"===t?"0":"-110%"));return e.animate(i,{duration:o.options.effectDuration,easing:o.options.easing,iterations:1,fill:"forwards"})}function y(e){const t=document.createElement("div");if(t.classList.add(this._classes.block__notification),t.sticky=void 0!==e.sticky?e.sticky:this.options.sticky,e.type&&t.classList.add(this._classes.block__notification_type_+e.type),this.options.progressbar&&!t.sticky){const e=document.createElement("div");e.classList.add(this._classes["block__notification-progress"]);const o=document.createElement("div");o.classList.add(this._classes["block__notification-progress-inner"]),e.appendChild(o),t.appendChild(e)}const o=document.createElement("div");if(o.classList.add(this._classes["block__notification-outer"]),this.options.icons){const t=document.createElement("div");t.classList.add(this._classes["block__notification-icon"]);const i=document.createElement("div");i.classList.add(this._classes["block__notification-icon-inner"]),i.innerHTML=function(e){let t;switch(e){case"success":t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>';break;case"warning":t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>';break;case"error":t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"></path></svg>';break;case"info":case"notice":case"default":default:t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"></path></svg>'}return t}(e.type),t.appendChild(i),o.appendChild(t)}const s=document.createElement("div");s.classList.add(this._classes["block__notification-inner"]);const n=document.createElement("button");if(n.classList.add(this._classes["block__notification-close"]),n.innerHTML="&times;",s.appendChild(n),n.addEventListener("click",(()=>{i(t,"Polipop.beforeClose")})),e.title){const t=document.createElement("div");t.classList.add(this._classes["block__notification-title"]),t.innerHTML+=e.title,s.appendChild(t)}if(e.content){const t=document.createElement("div");t.classList.add(this._classes["block__notification-content"]),t.innerHTML=e.content,s.appendChild(t)}return o.appendChild(s),t.appendChild(o),t}function g(e){const t=this,o=y.call(t,e);["beforeOpen","open","afterOpen","beforeClose","close","click"].forEach((o=>{e[o]||(e[o]=t.options[o])})),o.addEventListener("Polipop.beforeOpen",(()=>a.apply(this,[e,o]))),o.addEventListener("Polipop.open",(()=>r.apply(this,[e,o]))),o.addEventListener("Polipop.afterOpen",(()=>p.apply(this,[e,o]))),o.addEventListener("Polipop.beforeClose",(()=>_.apply(this,[e,o]))),o.addEventListener("Polipop.close",(()=>h.apply(this,[e,o]))),o.addEventListener("click",(t=>d.apply(this,[t,e,o]))),i(o,"Polipop.beforeOpen")}function m(){if(this._viewportHeight=window.innerHeight||document.documentElement.clientHeight,"inline"===this.options.position||1===this.elements.length)return;if(this.wrapperHeight+this._wrapperDistance>=this._viewportHeight){i("after"===this.options.insert?this._container.querySelectorAll("."+this._classes.block__notification)[0]:this._container.querySelectorAll("."+this._classes.block__notification+":last-child")[0],"Polipop.beforeClose")}}function k(e,t){let o,i,s,n,l;if(void 0===t&&(t=this.options.insert),this.options.position.startsWith("bottom-")?(i="bottom",s=1,n="previousElementSibling",l="before",o="after"===t?"previous":"next"):(i="top",s=-1,n="nextElementSibling",l="after",o="before"===t?"previous":"next"),"previous"===o)e.style[i]="0px";else if("next"===o)if(this.elements.length>1){const t=Array.prototype.indexOf.call(this.elements,e),o=this.elements[t+s],n=parseInt(o.style[i],10)+o.offsetHeight;e.style[i]=("popups"===this.options.layout?n+this.options.spacing:n)+"px"}else e.style[i]="0px";e[n]&&k.apply(this,[e[n],l])}function w(e){const t=this;let o,i="top";const s=Array.prototype.indexOf.call(t.elements,e);t.options.position.startsWith("bottom-")?(i="bottom",o=e=>e>s):o=e=>e<=s,t.elements.forEach(((s,n)=>{if(o(n))return;const l=parseInt(s.style[i],10)-("popups"===t.options.layout?e.offsetHeight+t.options.spacing:e.offsetHeight);s.style[i]=l+"px"}))}function v(e,t){const o=this;return!!(o.wrapperHeight+o._wrapperDistance>o._viewportHeight&&(o._overflow=!0,o.options.pool))&&(o.wrapperHeight-="popups"===o.options.layout?t.offsetHeight+o.options.spacing:t.offsetHeight,o.queue.push(e),t.remove(),f.call(o),!0)}function H(e){const t=this;let o=0;const i=t.options.life/100,s=e.querySelector("."+t._classes["block__notification-progress-inner"]),n=setInterval((function(){t._pauseOnHover||(o>=100?clearInterval(n):(o++,s.style.width=o+"%"))}),i)}function x(){const e=this;e._pause||(e.elements||(e.elements=e._container.querySelectorAll("."+e._classes.block__notification)),L.call(e),E.call(e),C.call(e))}function L(){const e=this;e._pauseOnHover||e.elements.forEach((t=>{!t.sticky&&(new Date).getTime()-t.created>parseInt(e.options.life,10)&&i(t,"Polipop.beforeClose")}))}function E(){const e=this,t=!1!==e.options.closer&&e._closer&&"none"===e._closer.style.display;if(e.elements.length>0&&t)e._closer.open=!0,e._closer.style.display="block",e.wrapperHeight+=e._closerHeight,e._wrapper.style.height=e.wrapperHeight+"px",b.apply(e,[e._closer,"in"]);else if(0===e.elements.length&&0===e.queue.length&&e._closer&&e._closer.open){e._closer.open=!1;b.apply(e,[e._closer,"out"]).finished.then((function(){e.wrapperHeight-=e._closerHeight,e._wrapper.style.height=e.wrapperHeight+"px",e._closer.style.display="none","panel"===e.options.layout&&(e._wrapper.querySelector("."+e._classes["block__header-minimize"]).style.display="none",e.options.hideEmpty&&(e._wrapper.style.height="0px"))}))}}function C(){const e=this;if(e._overflow&&e.elements.length>1&&"inline"!==e.options.position||0===e.queue.length)return;(0===e.options.pool||e.elements.length<e.options.pool)&&g.call(e,e.queue.shift())}function q(){const e=this;T.call(e),O.call(e),e.options.closer&&P.call(e),"panel"===e.options.layout&&z.call(e),e.options.closer&&S.call(e),e._wrapper.addEventListener("Polipop.ready",(()=>{e.options.ready.call(e)})),e.options.pauseOnHover&&(e._wrapper.addEventListener("mouseenter",(()=>n.call(e))),e._wrapper.addEventListener("mouseleave",(()=>l.call(e,event)))),"inline"!==e.options.position&&window.addEventListener("resize",(()=>c.call(e))),e._id=setInterval((function(){try{x.call(e)}catch(t){throw e.destroy(),t}}),parseInt(e.options.interval,10))}function T(){if(this._selector=this._selector.replace(/\s/g,"_"),this._wrapper=document.querySelector(this._selector),this._wrapper){if(this._wrapper.classList.contains(this._classes.block))return void console.log('Selector with id "'+this.options.selector+'" is used by another instance of Polipop.')}else this._wrapper=document.createElement("div"),this._wrapper.id=this._selector,document.querySelector(this.options.appendTo).appendChild(this._wrapper);this._wrapper.classList.add(this._classes.block,this._classes.block_position,this._classes.block_theme,this._classes.block_layout),"popups"===this.options.layout&&(this._wrapper.style.height="0px"),this._viewportHeight=window.innerHeight||document.documentElement.clientHeight,this._wrapperDistance=this.options.position.startsWith("bottom-")?this._viewportHeight-this._wrapper.getBoundingClientRect().bottom:this._wrapper.getBoundingClientRect().top}function O(){this._container=document.createElement("div"),this._container.classList.add(this._classes.block__notifications),this._wrapper.appendChild(this._container)}function S(){let e=0;"popups"===this.options.layout?e=this._closerHeight:"panel"===this.options.layout&&(e=this._wrapper.querySelector("."+this._classes["block__header-inner"]).offsetHeight+this._closerHeight),this.options.position.startsWith("bottom-")?this._container.style.bottom=e+"px":this._container.style.top=e+"px",this._container.style.height="calc(100% - "+e+"px)"}function P(){const e=this;e._closer=document.createElement("div"),e._closer.classList.add(e._classes.block__closer);const t=document.createElement("span");t.classList.add(e._classes["block__closer-text"]),t.innerHTML=e.options.closeText,e._closer.appendChild(t);const o=document.createElement("span");o.classList.add(e._classes["block__closer-count"]),o.style.display="none",e._closer.appendChild(o),e.options.position.startsWith("bottom-")?e._wrapper.appendChild(e._closer):e._wrapper.insertBefore(e._closer,e._container),e._closer.style.visibility="hidden",e._closerHeight="popups"===e.options.layout?e._closer.offsetHeight+e.options.spacing:e._closer.offsetHeight,e._closer.style.display="none",e._closer.style.visibility="visible",e._closer.addEventListener("click",(()=>e.closeAll()))}function z(){const e=this,t=document.createElement("div");t.classList.add(e._classes.block__header);const o=document.createElement("div");o.classList.add(e._classes["block__header-inner"]);const i=document.createElement("span");i.classList.add(e._classes["block__header-title"]),i.innerHTML=e.options.headerText,o.appendChild(i);const n=document.createElement("span");n.classList.add(e._classes["block__header-count"]),n.textContent="0",o.appendChild(n);const l=document.createElement("div");l.classList.add(e._classes["block__header-minimize"]),l.innerHTML="&equiv;",o.appendChild(l),t.appendChild(o),e.options.position.startsWith("bottom-")?e._wrapper.appendChild(t):e._wrapper.prepend(t),o.style.height=t.offsetHeight-1+"px",e.wrapperHeight+=o.offsetHeight,e._wrapper.style.height=e.options.hideEmpty?"0px":o.offsetHeight+"px",t.addEventListener("click",(()=>s.call(e)))}class M{constructor(e,t={}){this.options=function(e,t){let o=e;return null===e&&(o={}),[].slice.call(Object.keys(t)).forEach((e=>{o[e]=t[e]})),e}(o,t),this.queue=[],this.elements=null,this.wrapperHeight=0,this._selector=e,this._wrapper=null,this._closer=null,this._container=null,this._wrapperDistance=0,this._closerHeight=0,this._id=0,this._viewportHeight=0,this._overflow=!1,this._resizing=0,this._pauseOnHover=!1,this._pause=!1,this._disable=!1,this._classes=function(e){return{block:e.block,block_position:e.block+"_position_"+e.position,block_theme:e.block+"_theme_"+e.theme,block_layout:e.block+"_layout_"+e.layout,block_open:e.block+"_open",block__header:e.block+"__header","block__header-inner":e.block+"__header-inner","block__header-title":e.block+"__header-title","block__header-count":e.block+"__header-count","block__header-minimize":e.block+"__header-minimize",block__notifications:e.block+"__notifications",block__closer:e.block+"__closer","block__closer-text":e.block+"__closer-text","block__closer-count":e.block+"__closer-count",block__notification:e.block+"__notification","block__notification-progress":e.block+"__notification-progress","block__notification-progress-inner":e.block+"__notification-progress-inner","block__notification-outer":e.block+"__notification-outer","block__notification-icon":e.block+"__notification-icon","block__notification-icon-inner":e.block+"__notification-icon-inner","block__notification-inner":e.block+"__notification-inner","block__notification-title":e.block+"__notification-title","block__notification-close":e.block+"__notification-close","block__notification-content":e.block+"__notification-content",block__notification_type_:e.block+"__notification_type_"}}(this.options),q.call(this),i(this._wrapper,"Polipop.ready")}getOption(e){return this.options[e]}setOption(e,t){if(["appendTo","block","position","layout","spacing","headerText","closer","interval","pauseOnHover"].includes(e))return;this.options[e]=t}add(e){this._disable||(e.add||(e.add=this.options.add),"panel"===this.options.layout&&u.call(this,1),this.queue.push(e),f.call(this),e.add.call(this,e))}enable(){this._disable=!1}disable(){this._disable=!0}pause(){this._pause=!0}unpause(){this._pause=!1}closeAll(){this._container.querySelectorAll("."+this._classes.block__notification).forEach((e=>{i(e,"Polipop.beforeClose")}))}emptyQueue(){this.queue=[]}destroy(){this._wrapper&&(this.elements=null,this._container=null,this._closer=null,this._wrapper.remove(),this._wrapper=null,clearInterval(this._id))}}return t=t.default})()}));

Copyright © 2019 by b0y-101