toast.js

coco-message TheWindRises-2 js toast

Verze ze dne 09. 05. 2021. Zobrazit nejnovější verzi.

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greasyfork.org/scripts/426194/929290/toastjs.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

"use strict";function _createForOfIteratorHelper(o,e){var t;if("undefined"==typeof Symbol||null==o[Symbol.iterator]){if(Array.isArray(o)||(t=_unsupportedIterableToArray(o))||e&&o&&"number"==typeof o.length){t&&(o=t);var r=0,n=function(){};return{s:n,n:function(){return r>=o.length?{done:!0}:{done:!1,value:o[r++]}},e:function(o){throw o},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){t=o[Symbol.iterator]()},n:function(){var o=t.next();return s=o.done,o},e:function(o){c=!0,a=o},f:function(){try{s||null==t.return||t.return()}finally{if(c)throw a}}}}function _unsupportedIterableToArray(o,e){if(o){if("string"==typeof o)return _arrayLikeToArray(o,e);var t=Object.prototype.toString.call(o).slice(8,-1);return"Object"===t&&o.constructor&&(t=o.constructor.name),"Map"===t||"Set"===t?Array.from(o):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(o,e):void 0}}function _arrayLikeToArray(o,e){(null==e||e>o.length)&&(e=o.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=o[t];return r}function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}!function(o,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(o=o||self,o.cocoMessage=e())}(void 0,function(){function o(o,e){var t=document.createElement("div");for(var r in o){var n=o[r];"className"==r?(r="class",t.setAttribute(r,n)):"_"==r[0]&&t.addEventListener(r.slice(1),n)}if("string"==typeof e)t.innerHTML=e;else if("object"==_typeof(e)&&e.tagName)t.appendChild(e);else if(e){var a,s=_createForOfIteratorHelper(e);try{for(s.s();!(a=s.n()).done;){var c=a.value;t.appendChild(c)}}catch(o){s.e(o)}finally{s.f()}}return t}function e(o,e){["a","webkitA"].forEach(function(t){var r=t+"nimationEnd";o.addEventListener(r,function(){e()})})}function t(o,e){for(var t in e)o.style[t]=e[t];""===o.getAttribute("style")&&o.removeAttribute("style")}function r(o,e){var t=o.className||"";if(!n(t,e)){var r=t.split(/\s+/);r.push(e),o.className=r.join(" ")}}function n(o,e){return o.indexOf(e)>-1}function a(o,e){var t=o.className||"";if(n(t,e)){var r=t.split(/\s+/),a=r.indexOf(e);r.splice(a,1),o.className=r.join(" ")}""===o.className&&o.removeAttribute("class")}function s(o,e){var t,r=Object.assign({},u),n=_createForOfIteratorHelper(o);try{for(n.s();!(t=n.n()).done;){var a=t.value;void 0!==a&&("string"==typeof a||"object"==_typeof(a)?r.msg=a:"boolean"==typeof a?r.showClose=a:"function"==typeof a?r.onClose=a:"number"==typeof a&&(r.duration=a))}}catch(o){n.e(o)}finally{n.f()}return r.type=e,c(r)}function c(r){var n=r.type,s=r.duration,c=r.msg,d=r.showClose,m=r.onClose,p=0===s,u=l();"loading"==n&&(c=""===c?"正在加载":c,p=d,s=0);var h=o({className:"coco-msg-wrapper"},[o({className:"coco-msg coco-msg-fade-in ".concat(n)},[o({className:"coco-msg-icon"},u[n]),o({className:"coco-msg-content"},c),o({className:"coco-msg-wait ".concat(p?"coco-msg-pointer":""),_click:function(){p&&f(h,m)}},i(p))])]),y=h.querySelector(".coco-msg__circle");if(y&&(t(y,{animation:"coco-msg_".concat(n," ").concat(s,"ms linear")}),"onanimationend"in window?e(y,function(){f(h,m)}):setTimeout(function(){f(h,m)},s)),"loading"==n&&0!==s&&setTimeout(function(){f(h,m)},s),g.children.length||document.body.appendChild(g),g.appendChild(h),t(h,{height:h.offsetHeight+"px"}),setTimeout(function(){a(h.children[0],"coco-msg-fade-in")},300),"loading"==n)return function(){f(h,m)}}function i(o){return o?'\n    <svg class="coco-msg-close" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5514"><path d="M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z" p-id="5515"></path></svg>\n    ':'<svg class="coco-msg-progress" viewBox="0 0 33.83098862 33.83098862" xmlns="http://www.w3.org/2000/svg">\n    <circle class="coco-msg__background" cx="16.9" cy="16.9" r="15.9"></circle>\n    <circle class="coco-msg__circle" stroke-dasharray="100,100" cx="16.9" cy="16.9" r="15.9"></circle>\n    </svg>\n    '}function f(o,e){o&&(t(o,{padding:0,height:0}),r(o.children[0],"coco-msg-fade-out"),e&&e(),setTimeout(function(){if(o){var e,t=!1,r=_createForOfIteratorHelper(g.children);try{for(r.s();!(e=r.n()).done;){var n=e.value;n===o&&(t=!0)}}catch(o){r.e(o)}finally{r.f()}t&&d(o),o=null,g.children.length||t&&d(g)}},300))}function l(){return{info:'\n    <svg t="1609810636603" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3250"><path d="M469.333333 341.333333h85.333334v469.333334H469.333333z" fill="#ffffff" p-id="3251"></path><path d="M469.333333 213.333333h85.333334v85.333334H469.333333z" fill="#ffffff" p-id="3252"></path><path d="M384 341.333333h170.666667v85.333334H384z" fill="#ffffff" p-id="3253"></path><path d="M384 725.333333h256v85.333334H384z" fill="#ffffff" p-id="3254"></path></svg>\n    ',success:'\n    <svg t="1609781242911" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1807"><path d="M455.42 731.04c-8.85 0-17.75-3.05-24.99-9.27L235.14 553.91c-16.06-13.81-17.89-38.03-4.09-54.09 13.81-16.06 38.03-17.89 54.09-4.09l195.29 167.86c16.06 13.81 17.89 38.03 4.09 54.09-7.58 8.83-18.31 13.36-29.1 13.36z" p-id="1808" fill="#ffffff"></path><path d="M469.89 731.04c-8.51 0-17.07-2.82-24.18-8.6-16.43-13.37-18.92-37.53-5.55-53.96L734.1 307.11c13.37-16.44 37.53-18.92 53.96-5.55 16.43 13.37 18.92 37.53 5.55 53.96L499.67 716.89c-7.58 9.31-18.64 14.15-29.78 14.15z" p-id="1809" fill="#ffffff"></path></svg>\n    ',warning:'\n    <svg t="1609776406944" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18912"><path d="M468.114286 621.714286c7.314286 21.942857 21.942857 36.571429 43.885714 36.571428s36.571429-14.628571 43.885714-36.571428L585.142857 219.428571c0-43.885714-36.571429-73.142857-73.142857-73.142857-43.885714 0-73.142857 36.571429-73.142857 80.457143l29.257143 394.971429zM512 731.428571c-43.885714 0-73.142857 29.257143-73.142857 73.142858s29.257143 73.142857 73.142857 73.142857 73.142857-29.257143 73.142857-73.142857-29.257143-73.142857-73.142857-73.142858z" p-id="18913" fill="#ffffff"></path></svg>\n    ',error:'\n    <svg t="1609810716933" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5514"><path d="M810 274l-238 238 238 238-60 60-238-238-238 238-60-60 238-238-238-238 60-60 238 238 238-238z" p-id="5515" fill="#ffffff"></path></svg>\n    ',loading:'\n    <div class="coco-msg_loading">\n    <svg class="coco-msg-circular" viewBox="25 25 50 50">\n      <circle class="coco-msg-path" cx="50" cy="50" r="20" fill="none" stroke-width="4" stroke-miterlimit="10"/>\n    </svg>\n    </div>\n    '}}function d(o){o&&o.parentNode.removeChild(o)}function m(){var o,e=_createForOfIteratorHelper(g.children);try{for(e.s();!(o=e.n()).done;){var t=o.value;f(t)}}catch(o){e.e(o)}finally{e.f()}}function p(){var o=document;if(o&&o.head){var e=o.head,t=o.createElement("style"),r="\n[class|=coco],[class|=coco]::after,[class|=coco]::before{box-sizing:border-box;outline:0}.coco-msg-progress{width:13px;height:13px}.coco-msg__circle{stroke-width:2;stroke-linecap:square;fill:none;transform:rotate(-90deg);transform-origin:center}.coco-msg-stage:hover .coco-msg__circle{-webkit-animation-play-state:paused!important;animation-play-state:paused!important}.coco-msg__background{stroke-width:2;fill:none}.coco-msg-stage{position:fixed;top:20px;left:50%;width:auto;transform:translate(-50%,0);z-index:3000}.coco-msg-wrapper{position:relative;left:50%;transform:translate(-50%,0);transform:translate3d(-50%,0,0);transition:height .3s ease,padding .3s ease;padding:6px 0;will-change:transform,opacity}.coco-msg{padding:13px 14px 13px 18px;border-radius:2px;position:relative;left:50%;transform:translate(-50%,0);transform:translate3d(-50%,0,0);display:flex;align-items:center;color:#5b6161;background-color:#fff;box-shadow:1px 4px 16px rgba(5,32,44,.08)}.coco-msg-content,.coco-msg-icon,.coco-msg-wait{display:inline-block}.coco-msg-icon{position:relative;width:13px;height:13px;border-radius:100%;display:flex;justify-content:center;align-items:center}.coco-msg-icon svg{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:11px;height:11px}.coco-msg-wait{width:20px;height:20px;position:relative;fill:#4eb127}.coco-msg-wait svg{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.coco-msg-close{width:14px;height:14px}.coco-msg-content{margin:0 10px;min-width:150px;text-align:left;font-size:14px;font-weight:500;font-family:-apple-system,Microsoft Yahei,sans-serif}.coco-msg.info .coco-msg-icon{background-color:#428ae9}.coco-msg.success .coco-msg-icon{background-color:#4ebb23}.coco-msg.warning .coco-msg-icon{background-color:#f1b306}.coco-msg.error .coco-msg-icon{background-color:#f34b51}.coco-msg_loading{flex-shrink:0;width:20px;height:20px;position:relative}.coco-msg-circular{-webkit-animation:coco-msg-rotate 2s linear infinite both;animation:coco-msg-rotate 2s linear infinite both;transform-origin:center center;height:18px!important;width:18px!important}.coco-msg-path{stroke-dasharray:1,200;stroke-dashoffset:0;stroke:#428ae9;-webkit-animation:coco-msg-dash 1.5s ease-in-out infinite;animation:coco-msg-dash 1.5s ease-in-out infinite;stroke-linecap:round}@-webkit-keyframes coco-msg-rotate{100%{transform:translate(-50%,-50%) rotate(360deg)}}@keyframes coco-msg-rotate{100%{transform:translate(-50%,-50%) rotate(360deg)}}@-webkit-keyframes coco-msg-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes coco-msg-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}.coco-msg .coco-msg-wait{fill:#969696}.coco-msg-pointer{cursor:pointer}@-webkit-keyframes coco-msg_info{0%{stroke:#428ae9}to{stroke:#428ae9;stroke-dasharray:0 100}}@keyframes coco-msg_info{0%{stroke:#428ae9}to{stroke:#428ae9;stroke-dasharray:0 100}}@-webkit-keyframes coco-msg_success{0%{stroke:#4eb127}to{stroke:#4eb127;stroke-dasharray:0 100}}@keyframes coco-msg_success{0%{stroke:#4eb127}to{stroke:#4eb127;stroke-dasharray:0 100}}@-webkit-keyframes coco-msg_warning{0%{stroke:#fcbc0b}to{stroke:#fcbc0b;stroke-dasharray:0 100}}@keyframes coco-msg_warning{0%{stroke:#fcbc0b}to{stroke:#fcbc0b;stroke-dasharray:0 100}}@-webkit-keyframes coco-msg_error{0%{stroke:#eb262d}to{stroke:#eb262d;stroke-dasharray:0 100}}@keyframes coco-msg_error{0%{stroke:#eb262d}to{stroke:#eb262d;stroke-dasharray:0 100}}.coco-msg-fade-in{-webkit-animation:coco-msg-fade .2s ease-out both;animation:coco-msg-fade .2s ease-out both}.coco-msg-fade-out{animation:coco-msg-fade .3s linear reverse both}@-webkit-keyframes coco-msg-fade{0%{opacity:0;transform:translate(-50%,0);transform:translate3d(-50%,-80%,0)}to{opacity:1;transform:translate(-50%,0);transform:translate3d(-50%,0,0)}}@keyframes coco-msg-fade{0%{opacity:0;transform:translate(-50%,0);transform:translate3d(-50%,-80%,0)}to{opacity:1;transform:translate(-50%,0);transform:translate3d(-50%,0,0)}}\n        ";t.innerHTML=r,e.children.length?e.insertBefore(t,e.children[0]):e.appendChild(t)}}var g=o({className:"coco-msg-stage"}),u={msg:"",duration:2e3,showClose:!1},h={info:function(){s(arguments,"info")},success:function(){s(arguments,"success")},warning:function(){s(arguments,"warning")},error:function(){s(arguments,"error")},loading:function(){return s(arguments,"loading")},destroyAll:function(){m()},config:function(o){for(var e in o)Object.hasOwnProperty.call(o,e)&&void 0!==o[e]&&(u[e]=o[e])}};return window.addEventListener("DOMContentLoaded",function(){p()}),h});