diff options
-rw-r--r-- | layout/_partial/scripts.ejs | 10 | ||||
-rw-r--r-- | source/css/shikwasa.chapter.min.css | 1 | ||||
-rw-r--r-- | source/css/shikwasa.min.css | 1 | ||||
-rw-r--r-- | source/js/shikwasa.chapter.min.js | 1 | ||||
-rw-r--r-- | source/js/shikwasa.min.js | 1 |
5 files changed, 5 insertions, 9 deletions
diff --git a/layout/_partial/scripts.ejs b/layout/_partial/scripts.ejs index 61aece8..6c4bc14 100644 --- a/layout/_partial/scripts.ejs +++ b/layout/_partial/scripts.ejs @@ -40,13 +40,13 @@ <!-- Shikwasa Player support --> <% if (is_post() && theme.podcast && page.podcast) { %> - <script defer src="/js/shikwasa.min.js"></script> - <link media="none" onload="media='all'" rel="stylesheet" href="/css/shikwasa.min.css"> + <script defer src="https://cdn.jsdelivr.net/npm/shikwasa/dist/shikwasa.min.js"></script> + <link media="none" onload="media='all'" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/shikwasa/dist/shikwasa.min.css"> <% if (page.podcast.chapters) { %> - <script defer src="/js/shikwasa.chapter.min.js"></script> + <script defer src="https://cdn.jsdelivr.net/npm/shikwasa/dist/shikwasa.chapter.min.js"></script> <link media="none" onload="media='all'" rel="stylesheet" - href="/css/shikwasa.chapter.min.css"> - <% } %> + href="https://cdn.jsdelivr.net/npm/shikwasa/dist/shikwasa.chapter.min.css"> + <% } %> <% } %> <!-- Font Awesome delay loading --> diff --git a/source/css/shikwasa.chapter.min.css b/source/css/shikwasa.chapter.min.css deleted file mode 100644 index 40112f6..0000000 --- a/source/css/shikwasa.chapter.min.css +++ /dev/null @@ -1 +0,0 @@ -@-webkit-keyframes stretch{0%,to{box-shadow:0 0}50%{box-shadow:0 -5px}}@keyframes stretch{0%,to{box-shadow:0 0}50%{box-shadow:0 -5px}}.shk .shk-controls_extra .shk-btn.shk-btn_chapter{display:none}.shk[data-has-chapter] .shk-controls_extra .shk-btn.shk-btn_chapter{display:inline-block}.shk-chapter{background:var(--color-theme);border:1px solid rgba(0,41,37,.05);border-radius:2px;bottom:0;box-shadow:0 0 10px rgba(0,41,37,.07);box-sizing:border-box;height:0;left:20px;margin:0 auto;opacity:0;overflow:hidden;position:absolute;right:20px;transition:height .2s ease-in-out,bottom .1s ease-in-out,opacity .1s linear,visibility .1s .2s;visibility:hidden;z-index:0}.shk[data-show-chapter] .shk-chapter{bottom:120px;height:340px;opacity:1;transition:height .2s ease-in-out,bottom .1s ease-in-out,opacity .1s linear;visibility:visible}.shk-btn_close{fill:var(--color-primary);font-size:0;position:absolute;right:4px;top:4px}.shk-btn .shk-icon_close{height:16px;width:16px}.shk-chapter_main{box-sizing:border-box;height:calc(100% - 60px);margin:40px 0 20px;-webkit-mask-image:linear-gradient(180deg,transparent,#202124 5%,#202124 95%,transparent);mask-image:linear-gradient(180deg,transparent,#202124 5%,#202124 95%,transparent);overflow-x:hidden;overflow-y:scroll;padding:0 40px;scroll-behavior:smooth}.shk-chapter_list{box-sizing:border-box;list-style:none;margin:10px 0 0;padding:0}.shk-chapter_item{margin:5px 0}.shk-chapter .shk-chapter_btn{align-items:center;box-sizing:border-box;color:var(--color-text);display:flex;flex-flow:row nowrap;justify-content:flex-start;overflow:hidden;width:100%}.shk-chapter .shk-chapter_btn:after{border-radius:2px}.shk-chapter_btn div{fill:currentColor;color:currentColor}.shk-chapter_item[data-active] .shk-chapter_btn div{color:var(--color-primary);font-weight:600}.shk-icon_chapter{flex-shrink:0;height:12px;width:12px}.shk[data-play=playing] .shk-chapter_item[data-active] .shk-icon_playing,.shk[data-play=playing] .shk-chapter_item[data-active] .shk-icon_playing:after,.shk[data-play=playing] .shk-chapter_item[data-active] .shk-icon_playing:before{display:block}.shk-icon_playing,.shk-icon_playing:after,.shk-icon_playing:before{-webkit-animation:stretch 1s ease-in-out infinite;animation:stretch 1s ease-in-out infinite;background:currentColor;color:currentColor;display:none;height:5px;left:4px;top:6px;width:3px}.shk-icon_playing{-webkit-animation-delay:.16s;animation-delay:.16s;position:relative}.shk-icon_playing:after,.shk-icon_playing:before{content:"";position:absolute;top:0}.shk-icon_playing:before{-webkit-animation-delay:-.16s;animation-delay:-.16s;left:-4px}.shk-icon_playing:after{left:4px}.shk-icon_triangle{align-items:flex-start;display:flex;flex-shrink:0}.shk[data-play=playing] .shk-chapter_item[data-active] .shk-icon_triangle{display:none}.shk-icon_triangle svg{fill:currentColor;height:12px;width:12px}.shk-chapter_duration{color:var(--color-secondary);flex-shrink:0;font-weight:200;margin:0 5%;min-width:60px;text-align:left}.shk-chapter_title_wrap{flex-grow:1;overflow:hidden;white-space:nowrap}.shk-chapter_item[data-active] .shk-chapter_title_wrap[data-overflow]{-webkit-mask-image:linear-gradient(90deg,transparent,#202124 2%,#202124 98%,transparent);mask-image:linear-gradient(90deg,transparent,#202124 2%,#202124 98%,transparent)}.shk-chapter_title_inner{-webkit-animation-duration:inherit;animation-duration:inherit;display:flex}.shk-chapter_item[data-active] .shk-chapter_title_wrap[data-overflow] .shk-chapter_title_inner{box-sizing:border-box;padding:0 3%}.shk-chapter_item[data-active] .shk-chapter_title_wrap[data-overflow] .shk-chapter_title_inner:after{content:attr(data-chapter);display:block}.shk-chapter_title{color:var(--color-text);overflow:hidden;text-align:left;text-overflow:ellipsis}.shk-chapter_item[data-active] .shk-chapter_title{overflow:visible}.shk-chapter_item[data-active] .shk-chapter_title_wrap[data-overflow] .shk-chapter_title,.shk-chapter_item[data-active] .shk-chapter_title_wrap[data-overflow] .shk-chapter_title_inner:after{-webkit-animation:marquee linear infinite;animation:marquee linear infinite;-webkit-animation-duration:inherit;animation-duration:inherit;color:currentColor;padding-right:60px}@media (max-width:640px){.shk-chapter{left:10px;right:10px}.shk-chapter_main{padding:0 10px}}
\ No newline at end of file diff --git a/source/css/shikwasa.min.css b/source/css/shikwasa.min.css deleted file mode 100644 index d6deb0f..0000000 --- a/source/css/shikwasa.min.css +++ /dev/null @@ -1 +0,0 @@ -.shk{--color-primary:#0d6efd;--color-opac:#b9b9b94d;--color-theme:#fff;--color-secondary:#767676;--color-text:#333;--color-shadow:#b9b6b680;--color-handle-shadow-mobile:#b9b6b6;--background-body:var(--color-theme);--color-title:var(--color-text);--color-artist:var(--color-secondary);--color-button:var(--color-primary);--color-button-disabled:var(--color-opac);--color-button-active-background:var(--color-opac);--color-handle:var(--color-primary);--color-handle-disabled:#b9b9b9;--color-bar-loaded:var(--color-opac);--color-bar-played:var(--color-primary);--color-time:var(--color-secondary);--color-spinner:var(--color-primary);--color-live-symbol:var(--color-primary);--color-live-text:var(--color-primary);--shadow-body:2px 2px 8px -2px var(--color-shadow);--shadow-body-mobile:0 -2px 6px -2px var(--color-shadow);--shadow-handle:0px 2px 10px 2px var(--color-shadow);--shadow-handle-mobile:2px 2px 8px -2px var(--color-handle-shadow-mobile)}.shk[data-theme=dark]{--color-theme:#333;--color-secondary:#b9b6b6;--color-text:#f8f9fa;--color-handle-shadow-mobile:#141414;--color-shadow:#14141480}@media (prefers-color-scheme:dark){.shk[data-theme=auto]{--color-theme:#333;--color-secondary:#b9b6b6;--color-text:#fff;--color-handle-shadow-mobile:#141414;--color-shadow:#14141480}}@-webkit-keyframes rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes marquee{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}@keyframes marquee{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translateX(-100%);transform:translateX(-100%)}}.shk{border:none;color:var(--color-text);cursor:auto;font-family:inherit;font-size:16px;font-weight:400;line-height:1.42;position:relative}.js-focus-visible :focus:not(.focus-visible),.js-focus-visible:focus:not(.focus-visible){outline:none}.shk[data-fixed-type=fixed]{bottom:0;left:0;margin:0;position:fixed;width:100%}.shk[data-fixed-type=fixed][data-fixed-pos=top]{bottom:auto;top:0}.shk[data-seeking] .shk-player{cursor:grabbing}.shk button{font-family:inherit}.shk-player{background:var(--background-body);border-radius:2px;box-sizing:border-box;height:120px;position:relative;z-index:10}.shk-body{align-items:stretch;display:flex;flex-flow:row nowrap;position:relative;-webkit-user-select:none;-ms-user-select:none;user-select:none;width:100%}.shk-cover{background-repeat:no-repeat;background-size:cover;flex:0 0 auto;height:80px;margin-right:16px;width:80px}.shk-main{display:flex;flex-grow:1;flex-wrap:nowrap;justify-content:flex-start;position:relative}.shk-text{overflow:hidden}.shk-artist,.shk-title{margin:auto;white-space:nowrap}.shk-artist{color:var(--color-artist);font-weight:500;text-overflow:clip}.shk-title_wrap[data-overflow]{-webkit-mask-image:linear-gradient(90deg,transparent,#202124 5%,#202124 95%,transparent);mask-image:linear-gradient(90deg,transparent,#202124 5%,#202124 95%,transparent)}.shk-title_inner{display:inline-flex;overflow:visible}.shk-title_wrap[data-overflow] .shk-title_inner{-webkit-animation-duration:inherit;animation-duration:inherit;box-sizing:border-box;padding:0 3%;white-space:nowrap}.shk-title_wrap[data-overflow] .shk-title_inner:after{content:attr(data-title);display:inline-block}.shk-title,.shk-title_wrap[data-overflow] .shk-title_inner:after{color:var(--color-title);font-size:1.33em;font-weight:300}.shk-title_wrap[data-overflow] .shk-title,.shk-title_wrap[data-overflow] .shk-title_inner:after{-webkit-animation:marquee linear infinite;animation:marquee linear infinite;-webkit-animation-duration:inherit;animation-duration:inherit;padding-right:60px}.shk-btn{fill:currentColor;-webkit-appearance:none;appearance:none;background:transparent;border:none;box-sizing:content-box;color:var(--color-button);cursor:pointer;font-size:1em;line-height:normal;padding:10px;position:relative}.shk-btn:disabled{color:var(--color-button-disabled);cursor:not-allowed}.shk-btn:after{background:var(--color-button-active-background);border-radius:50%;content:"";height:100%;left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);transition:opacity 1s cubic-bezier(0,0,.2,1),visibility 1s linear;visibility:hidden;width:100%;z-index:-1}.shk-btn:not(:disabled):active:after{opacity:1;visibility:visible}a.shk-btn:visited{color:var(--color-button)}.shk-btn svg{height:24px;vertical-align:middle;width:24px}.shk-controls{flex:0 0 auto;margin:0 auto;position:relative;width:280px}.shk-controls .shk-btn{border-radius:100%}.shk-controls>div{align-items:center;display:flex;flex-flow:row nowrap}.shk-controls_basic{justify-content:space-between}.shk-controls_extra{background:var(--background-body);bottom:0;height:100%;justify-content:flex-end;margin-right:44px;opacity:0;overflow:hidden;padding-right:0 8px;position:absolute;right:0;transition:width .2s ease-in-out,opacity .1s linear .1s,visibility .2s;visibility:hidden;white-space:nowrap;width:0;z-index:10}.shk[data-extra] .shk-controls_extra{opacity:1;transition:width .2s ease-in-out,opacity .1s linear;visibility:visible;width:calc(100% - 44px)}.shk[data-extra] .shk-controls_extra .shk-btn{display:inline-block}.shk-btn_toggle svg{height:32px;width:32px}.shk[data-play=paused] .shk-btn_play,.shk[data-play=playing] .shk-btn_pause{display:inline}.shk[data-play=paused] .shk-btn_pause,.shk[data-play=playing] .shk-btn_play{display:none}.shk-btn_speed{font-size:.86em;font-weight:400;height:44px;padding:0;width:44px}.shk-btn_more{position:relative;-webkit-transform:none;transform:none;transition:-webkit-transform .2s .1s;transition:transform .2s .1s;transition:transform .2s .1s,-webkit-transform .2s .1s;z-index:11}.shk[data-extra] .shk-btn_more{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.shk[data-mute] svg.shk-btn_mute,svg.shk-btn_unmute{display:inline-block}.shk[data-mute] svg.shk-btn_unmute,svg.shk-btn_mute{display:none}.shk-bar_wrap{cursor:pointer;position:relative;z-index:1}.shk-bar{background:var(--background-body);box-sizing:border-box;height:4px;position:relative;width:100%}.shk-bar_loaded,.shk-bar_played{bottom:0;left:0;position:absolute;top:0;transition:width .1s ease-in;width:0}.shk-bar_loaded{background:var(--color-bar-loaded)}.shk-bar_played{background:var(--color-bar-played)}.shk[data-seeking] .shk-bar_played{transition:none}.shk-bar-handle{background:var(--color-handle);border:0;border-radius:20px;box-sizing:content-box;cursor:grab;height:20px;padding:0;position:absolute;right:-10px;width:20px}.shk-bar-handle:disabled{background-color:var(--color-handle-disabled);box-shadow:none;cursor:not-allowed}.shk-bar-handle:active{cursor:grabbing}.shk-display{position:absolute}.shk-loader{color:var(--color-spinner);display:none;vertical-align:middle}.shk[data-loading] .shk-loader{display:inline-block}.shk-loader svg{-webkit-animation:rotate 1.4s linear infinite;animation:rotate 1.4s linear infinite;height:12px;position:relative;width:12px}.shk-visuallyhidden:not(:focus):not(:active){clip:rect(0 0 0 0);border:0;-webkit-clip-path:inset(100%);clip-path:inset(100%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.shk-time{color:var(--color-time);display:inline-block;font-size:.8em;font-weight:300;vertical-align:middle}.shk .shk-live{align-items:center;color:var(--color-live-text);display:none;font-family:sans-serif;font-size:.8em;text-transform:uppercase}.shk .shk-live:before{background:var(--color-live-symbol);border-radius:50%;content:"";height:.5em;margin-right:2px;width:.5em}.shk-icons,.shk[data-live] .shk-bar,.shk[data-live] .shk-time{display:none}.shk[data-live] .shk-live{display:inline-flex}@media (min-width:641px){.shk-player{box-shadow:var(--shadow-body);margin-top:4px;padding:20px 16px}.shk-main{align-items:flex-end;flex-direction:row;max-width:calc(100% - 96px);padding:10px 0}.shk-text{flex:2 1 auto}.shk-bar_wrap{left:0;padding:4px 0 16px;position:absolute;right:0;top:-4px}.shk-bar{transition:height .15s ease-in}.shk-bar_wrap:hover .shk-bar{height:10px}.shk-bar-handle{border:4px solid transparent;box-shadow:var(--shadow-handle);top:-9.5px;-webkit-transform:scale(.0001);transform:scale(.0001);transition:all .1s ease-in}.shk-bar-handle.focus-visible,.shk-bar_wrap:hover .shk-bar-handle:not(:disabled){border-color:#fff;-webkit-transform:scale(.8);transform:scale(.8)}.shk-display{right:8px;top:-6px}.shk-loader{margin-right:4px}.shk-time_duration:before{content:"/";margin:0 4px}}@media (max-width:640px){.shk-player{box-shadow:var(--shadow-body-mobile);padding:5px 16px}.shk[data-fixed-type=auto]{bottom:0;left:0;position:fixed;width:100%}.shk[data-fixed-type=auto][data-fixed-pos=top]{bottom:auto;top:0}.shk[data-live] .shk-bar_wrap{height:4px}.shk-cover{display:none}.shk-main{align-items:center;flex-direction:column;max-width:none;padding:0;width:100%}.shk-text{flex:0 0 auto;text-align:center;width:100%}.shk-artist_wrap{font-size:.8em;line-height:1.1}.shk-artist{display:inline-block}.shk-title,.shk-title_wrap[data-overflow] .shk-title_inner:after{font-size:1em;line-height:1}.shk-bar_wrap{margin:0 60px;padding:8px 0}.shk-bar-handle{box-shadow:var(--shadow-handle-mobile);display:inline-block;top:-8px}.shk-bar{background:var(--color-opac);border-radius:2px}.shk-display{left:0;right:0;top:-16px}.shk-loader{left:-10px;position:absolute;top:-5px}.shk-time{display:flex;flex-flow:row nowrap;font-size:.7em;justify-content:space-between;line-height:1;margin:0 5px}.shk-time_now{text-align:right;width:40px}.shk-time_duration{text-align:left;width:40px}.shk-live{position:absolute;right:0;top:0}}
\ No newline at end of file diff --git a/source/js/shikwasa.chapter.min.js b/source/js/shikwasa.chapter.min.js deleted file mode 100644 index 070e180..0000000 --- a/source/js/shikwasa.chapter.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a="undefined"==typeof globalThis?a||self:globalThis,a.Chapter=b())})(this,function(){"use strict";var a=Math.round;function b(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function c(a){for(var c,e=1;e<arguments.length;e++)c=null==arguments[e]?{}:arguments[e],e%2?b(Object(c),!0).forEach(function(b){d(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):b(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))});return a}function d(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function e(b){var c=Math.floor;b=a(b);var d=c(b/3600),e=c((b-3600*d)/60),f=c(b-3600*d-60*e);return(e=10>e?"0"+e:e,f=10>f?"0"+f:f,0===d)?"".concat(e,":").concat(f):(d=10>d?"0"+d:d,"".concat(d,":").concat(e,":").concat(f))}function f(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:60,d=b.offsetWidth-a.offsetWidth;if(0<d){a.setAttribute("data-overflow","");var e=b.offsetWidth/c;a.style.animationDuration="".concat(e,"s")}else a.removeAttribute("data-overflow")}function g(a){a.tag=a.tag||"div";var b=document.createElement(a.tag);return a.className&&("string"==typeof a.className?b.classList.add(a.className):a.className.forEach(a=>{b.classList.add(a)})),a.attrs&&Object.keys(a.attrs).forEach(c=>{b.setAttribute(c,a.attrs[c])}),a.innerHTML&&(b.innerHTML=a.innerHTML),b}function h(a,b){return"function"==typeof a.toggleAttribute?void a.toggleAttribute(b):void(a.hasAttribute(b)?a.removeAttribute(b):a.setAttribute(b,""))}function i(a,b,c,d,e,f){var g=(a-b)/1e3/c;f.scrollTop=d+e*g,1>g&&window.requestAnimationFrame(a=>{i(a,b,c,d,e,f)})}var j;class k{constructor(a){this.ctx=a,this.list=[],this.initEvents(),this.current=null,this._currentSrc=null,this._chapterPatched=!1}init(){this.patchPlayer(),this.ui=new l(this.ctx),this.ctx.on("chapterchange",a=>{var b=a&&a.newVal?a.newVal.id:null;this.ui.setChapterActive(b)})}initEvents(){this.ctx.on("audioupdate",a=>{this._chapterPatched||(this.init(),this._chapterPatched=!0),this.updateList(a)}),this.ctx.on("audioparse",a=>{this.updateList(a)}),this.ctx.on("timeupdate",this.onTimeupdate.bind(this))}clearList(){this.ui.chapterList.innerHTML="",this.list=[],this.current=null}updateList(a){this.list.length&&this.clearList(),a.chapters.length&&(this.list=this.handleChapters(a),this.ui.renderChapterList(this.ctx.chapters),this.clickChapterHandler()),this.ui.handleChapterPanel(this.ctx,a)}handleChapters(a){if(a.chapters&&a.chapters.length)return a.chapters.map((a,b)=>(/^ch\d+$/.test(a.id)||(a.id="ch".concat(b)),a))}patchPlayer(){var a=this;Object.defineProperties(this.ctx,{chapters:{get(){return a.list}},currentChapter:{get(){return a.current}}}),this.ctx.events.playerEvents.push("chapterchange"),this.ctx.updateChapter=function(a){this.setCurrent(this.list[a]),this.ctx.seek(this.current.startTime),this.ctx.play()}.bind(a)}setCurrent(a){var b=this.current?c({},this.current):null;this.current=a,this.ctx.events.trigger("chapterchange",{newVal:this.current,oldVal:b})}onTimeupdate(a){if(this._currentSrc!==a.currentTarget.src)return void(this._currentSrc=a.currentTarget.src);var b=this.searchDirection(this.ctx.currentTime,this.current);if(b){var c,d=this.list.indexOf(this.current);c=-1===d?this.list:1===b?this.list.slice(d):this.list.slice(0,d+1);var e=c.find(a=>!this.searchDirection(this.ctx.currentTime,a));this.setCurrent(e)}}searchDirection(b,c){return b=a(b),!c||"object"!=typeof c||c.endTime<=b?1:c.startTime>b?-1:0}clickChapterHandler(){Array.from(this.ui.chapterList.children).forEach(a=>{a.addEventListener("click",()=>{if(this.ctx.seekable){var b=a.getAttribute("data-id").match(/\d+$/);b&&this.ctx.updateChapter(+b[0])}})})}destroy(){this.ui.destroy()}}class l{constructor(a,b){this.initEl(a),this.initEvents(a,b),this.renderChapterList(a.chapters),a.ui.el.append(this.el),this.activeChapterEl=null}initEl(a){this.el=g({className:"shk-chapter",innerHTML:"\n <div class=\"shk-chapter_main\">\n <ol class=\"shk-chapter_list\"></ol>\n </div>\n <button class=\"shk-btn shk-btn_close\" aria-label=\"close chapter panel\" title=\"close chapter panel\">\n <svg class=\"shk-icon_close\" aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_close\" />\n </svg>\n </button>\n"});var b={title:"view chapters","aria-label":"view chapters"};a.seekable||(b.disabled=""),this.chapterBtn=g({tag:"button",className:["shk-btn","shk-btn_chapter"],attrs:b,innerHTML:"\n <svg aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_chapter\" />\n </svg>\n "}),a.ui.seekControls.push(this.chapterBtn),a.ui.extraControls.append(this.chapterBtn),this.closeBtn=this.el.querySelector(".shk-btn_close"),this.chapterList=this.el.querySelector(".shk-chapter_list"),this.overflowLayer=this.el.querySelector(".shk-chapter_main")}initEvents(a){this.chapterBtn.addEventListener("click",()=>{h(a.el,"data-show-chapter")}),a.ui.hideExtraControl(this.chapterBtn),this.closeBtn.addEventListener("click",()=>{a.el.removeAttribute("data-show-chapter")}),j=()=>{if(this.activeChapterEl){var a=this.activeChapterEl.querySelector(".shk-chapter_title_wrap"),b=this.activeChapterEl.querySelector(".shk-chapter_title");f.call(this,a,b)}},window.addEventListener("resize",j)}handleChapterPanel(a,b){b.chapters.length?a.el.setAttribute("data-has-chapter",""):a.el.removeAttribute("data-has-chapter"),b.chapters.length&&a.seekable||a.el.removeAttribute("data-show-chapter")}renderChapterList(a){a.length&&a.forEach(a=>{var b=this.renderChapterItem(a);this.chapterList.append(b)})}renderChapterItem(a){var b=e(a.startTime),c="\n <button class=\"shk-btn shk-chapter_btn\" title=\"seek chapter: ".concat(a.title,"\" aria-label=\"seek chapter: ").concat(a.title,"\">\n <div class=\"shk-icon_chapter\" aria-hidden=\"true\">\n <span class=\"shk-icon_playing\"></span>\n <span class=\"shk-icon_triangle\">\n <svg>\n <use xlink:href=\"#shk-icon_triangle\" />\n </svg>\n </span>\n </div>\n <div class=\"shk-chapter_duration\">").concat(b,"</div>\n <div class=\"shk-chapter_title_wrap\">\n <div class=\"shk-chapter_title_inner\" data-chapter=\"").concat(a.title,"\">\n <div class=\"shk-chapter_title\">").concat(a.title,"</div>\n </div>\n </div>\n </button>\n ");return g({tag:"li",className:"shk-chapter_item",innerHTML:c,attrs:{"data-id":a.id}})}setChapterActive(a){this.chapterList.querySelectorAll(".shk-chapter_item").forEach(b=>{if(b.getAttribute("data-id")===a){b.setAttribute("data-active",""),this.scrollIntoView(b),this.activeChapterEl=b;var c=b.querySelector(".shk-chapter_title"),d=b.querySelector(".shk-chapter_title_wrap");f(d,c)}else b.removeAttribute("data-active")})}scrollIntoView(a){if("hidden"!==this.el.style.visibility){var b=window.getComputedStyle(this.overflowLayer).marginTop,c=window.getComputedStyle(this.chapterList).marginTop,d=parseInt(b)+parseInt(c),e=0<this.overflowLayer.scrollTop+d-a.offsetTop||0<a.offsetTop-this.overflowLayer.scrollTop-this.overflowLayer.offsetHeight,f=this.overflowLayer.scrollTop,g=a.offsetTop-f-d,h=performance.now();e&&i(h,h,.2,f,g,this.overflowLayer)}}destroy(){window.removeEventListener("resize",j)}}return k._name="chapter",k});
\ No newline at end of file diff --git a/source/js/shikwasa.min.js b/source/js/shikwasa.min.js deleted file mode 100644 index 31b422f..0000000 --- a/source/js/shikwasa.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a="undefined"==typeof globalThis?a||self:globalThis,a.Shikwasa=b())})(this,function(){"use strict";var a=Math.max,b=Math.min;function c(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function d(a){return function(){var b=this,d=arguments;return new Promise(function(e,f){function g(a){c(i,e,f,g,h,"next",a)}function h(a){c(i,e,f,g,h,"throw",a)}var i=a.apply(b,d);g(void 0)})}}function e(a){var b=Math.floor,c=Math.round;a=c(a);var d=b(a/3600),e=b((a-3600*d)/60),f=b(a-3600*d-60*e);return(e=10>e?"0"+e:e,f=10>f?"0"+f:f,0===d)?"".concat(e,":").concat(f):(d=10>d?"0"+d:d,"".concat(d,":").concat(e,":").concat(f))}function f(a){var b=parseFloat(a).toFixed(2);return"0"===b.slice(-1)?b.slice(0,-1):b}function g(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:60,d=b.offsetWidth-a.offsetWidth;if(0<d){a.setAttribute("data-overflow","");var e=b.offsetWidth/c;a.style.animationDuration="".concat(e,"s")}else a.removeAttribute("data-overflow")}function h(a){var b=Object.assign({},a);b.audio=Object.assign({},a.audio),Object.keys(r).forEach(a=>{b[a]=b[a]||"boolean"==typeof b[a]?b[a]:r[a]}),"function"==typeof b.container&&(b.container=b.container());var c=s.fixedOptions.find(a=>a===b.fixed.type);return c||(b.fixed.type=r.fixed.type),Array.isArray(b.speedOptions)||(b.speedOptions=[b.speedOptions]),-1===b.speedOptions.indexOf(1)&&b.speedOptions.push(1),b.speedOptions=b.speedOptions.map(a=>parseFloat(a)).filter(a=>!isNaN(a)),1<b.speedOptions.length&&b.speedOptions.sort((c,a)=>c-a),b}function i(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=Object.assign({},a);return Object.keys(s.audioOptions).forEach(a=>{c[a]=c[a]||b[a]||s.audioOptions[a]}),c}function j(){return k.apply(this,arguments)}function k(){return k=d(function*(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},{tags:c}=(yield l(a.src,b))||{},d=m(c);return i(a,d)}),k.apply(this,arguments)}function l(a,b){return new Promise((c,d)=>{b.read(a,{onSuccess:c,onError:d})})}function m(){var a,b,c,d=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},{title:e,artist:f}=d;if(d.picture&&d.picture.data&&d.picture.format){var g=new Uint8Array(d.picture.data),h=new Blob([g],{type:d.picture.format});a=URL.createObjectURL(h)}return d.TLEN&&d.TLEN.data&&(c=+d.TLEN.data/1e3),d.CHAP&&d.CHAP.length&&(b=d.CHAP.filter(a=>"CHAP"===a.id).map(a=>!!(a.data&&a.data.subFrames&&a.data.subFrames.TIT2)&&{id:a.data.id,startTime:a.data.startTime/1e3,endTime:a.data.endTime/1e3,title:a.data.subFrames.TIT2.data}).sort((c,a)=>c.id-a.id)),{title:e,artist:f,cover:a,duration:c,chapters:b}}function n(a){a.tag=a.tag||"div";var b=document.createElement(a.tag);return a.className&&("string"==typeof a.className?b.classList.add(a.className):a.className.forEach(a=>{b.classList.add(a)})),a.attrs&&Object.keys(a.attrs).forEach(c=>{b.setAttribute(c,a.attrs[c])}),a.innerHTML&&(b.innerHTML=a.innerHTML),b}function o(a,b){return"function"==typeof a.toggleAttribute?void a.toggleAttribute(b):void(a.hasAttribute(b)?a.removeAttribute(b):a.setAttribute(b,""))}function p(a,b){function c(a){return!!(a&&a!==document&&"HTML"!==a.nodeName&&"BODY"!==a.nodeName&&"classList"in a&&"contains"in a.classList)}function d(a){a.classList.contains("focus-visible")||(a.classList.add("focus-visible"),a.setAttribute("data-focus-visible-added",""))}function f(a){a.hasAttribute("data-focus-visible-added")&&(a.classList.remove("focus-visible"),a.removeAttribute("data-focus-visible-added"))}function g(){n=!1}function h(a){!c(a.target)||n&&d(a.target)}function i(a){!c(a.target)||(a.target.classList.contains("focus-visible")||a.target.hasAttribute("data-focus-visible-added"))&&(o=!0,window.clearTimeout(p),p=window.setTimeout(function(){o=!1},100),f(a.target))}function j(){"hidden"===document.visibilityState&&(o&&(n=!0),k())}function k(){a.addEventListener("mousemove",m),a.addEventListener("mousedown",m),a.addEventListener("mouseup",m),a.addEventListener("pointermove",m),a.addEventListener("pointerdown",m),a.addEventListener("pointerup",m),a.addEventListener("touchmove",m,!!b&&{passive:!0}),a.addEventListener("touchstart",m,!!b&&{passive:!0}),a.addEventListener("touchend",m,!!b&&{passive:!0})}function l(c){a.removeEventListener("mousemove",m),a.removeEventListener("mousedown",m),a.removeEventListener("mouseup",m),a.removeEventListener("pointermove",c),a.removeEventListener("pointerdown",m),a.removeEventListener("pointerup",m),a.removeEventListener("touchmove",m,!!b&&{passive:!0}),a.removeEventListener("touchstart",m,!!b&&{passive:!0}),a.removeEventListener("touchend",m,!!b&&{passive:!0})}function m(){n=!1,l()}var n=!0,o=!1,p=null;a.addEventListener("keydown",function(b){b.metaKey||b.altKey||b.ctrlKey||(c(document.activeElement)&&a.contains(document.activeElement)&&d(document.activeElement),n=!0)},!0),a.addEventListener("mousedown",g,!0),a.addEventListener("pointerdown",g,!0),a.addEventListener("touchstart",g,!b||{passive:!0,capture:!0}),a.addEventListener("visibilitychange",j,!0),k(),a.addEventListener("focus",h,!0),a.addEventListener("blur",i,!0),a.classList.add("js-focus-visible")}var q,r={container:()=>document.querySelector("body"),parser:null,fixed:{type:"auto",position:"bottom"},download:!1,themeColor:"#0d6efd",theme:"auto",autoPlay:!1,muted:!1,preload:"metadata",speedOptions:[.5,.75,1,1.25,1.5],audio:null},s={fixedOptions:["auto","static","fixed"],audioOptions:{title:"Unknown Title",artist:"Unknown Artist",duration:NaN,cover:null,chapters:[],src:null,album:"",live:!1}},t=null,u=!0;class v{constructor(a){this.mounted=!1,this.icons=n({className:"shk-icons",innerHTML:"\n <svg class=\"shk-icons\" xmlns=\"http://www.w3.org/2000/svg\">\n <symbol id=\"shk-icon_play\" viewbox=\"0 0 64 64\">\n <path\n d=\"M32 0a32 32 0 1 1 0 64 32 32 0 0 1 0-64zm-9 17.8c-1 0-1.7.6-1.7 1.4v25.6c0 .8.8 1.4 1.7 1.4 0 0 25-12 26.2-13.1 1-1 .3-1.9.1-2.1z\" />\n </symbol>\n\n <symbol id=\"shk-icon_pause\" viewbox=\"0 0 64 64\">\n <path fill-rule=\"nonzero\"\n d=\"M32 0a32 32 0 1 0 0 64 32 32 0 0 0 0-64zm-4 40a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V24c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v16zm16 0a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V24c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v16z\" />\n </symbol>\n\n <symbol id=\"shk-icon_download\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3\" />\n </symbol>\n\n <symbol id=\"shk-icon_forward\" viewbox=\"0 0 128 139\">\n <path\n d=\"M64 11v14h-.8A50 50 0 1 0 114 75h14a64 64 0 1 1-64-64zm16.9 35c6.6 0 11.8 2.7 15.6 8.3a38 38 0 0 1 5.3 21.4c0 9-1.8 16-5.3 21.3-3.8 5.6-9 8.4-15.6 8.4-6.7 0-12-2.8-15.6-8.4A38 38 0 0 1 60 75.7c0-9 1.8-16.1 5.3-21.4C69 48.7 74.2 46 80.9 46zm-32.5 1v57.1H39V58.3a32.3 32.3 0 0 1-13 7V56a34 34 0 0 0 15.4-9h7zm32.5 7c-4.6 0-7.8 2.4-9.6 7.5-1.3 3.5-2 8.2-2 14.2 0 5.9.7 10.6 2 14.1 1.8 5 5 7.6 9.6 7.6 4.5 0 7.7-2.5 9.6-7.6 1.3-3.5 1.9-8.2 1.9-14.1 0-6-.6-10.7-2-14.2-1.8-5.1-5-7.6-9.5-7.6zM64 0l48 19-48 19V0z\" />\n </symbol>\n\n <symbol id=\"shk-icon_backward\" viewbox=\"0 0 128 139\">\n <path\n d=\"M64 0v11A64 64 0 1 1 0 75h14a50 50 0 1 0 50-50v13L16 19 64 0zm17 45.8c6.6 0 11.8 2.7 15.6 8.3a38 38 0 0 1 5.3 21.3c0 9-1.8 16.1-5.3 21.4a18 18 0 0 1-15.6 8.3c-6.7 0-12-2.8-15.6-8.3a38 38 0 0 1-5.3-21.4c0-9 1.8-16 5.3-21.3 3.7-5.6 8.9-8.3 15.6-8.3zm-32.4 1V104h-9.4V58.2a32.3 32.3 0 0 1-13 7v-9.4a34 34 0 0 0 15.4-9h7zm32.4 7c-4.6 0-7.8 2.5-9.6 7.6-1.3 3.4-2 8.1-2 14.1s.7 10.7 2 14.2c1.8 5 5 7.6 9.6 7.6 4.5 0 7.7-2.6 9.6-7.6 1.3-3.5 2-8.2 2-14.2s-.7-10.7-2-14.1c-2-5.1-5.1-7.6-9.6-7.6z\" />\n </symbol>\n\n <symbol id=\"shk-icon_more\" viewbox=\"0 0 64 64\">\n <path\n d=\"M8 24a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8zm48 0a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8zm-24 0a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8zm0 0\" />\n </symbol>\n\n <symbol id=\"shk-icon_chapter\" viewbox=\"0 0 64 64\">\n <path d=\"M60.8 55.3H18.1a3.2 3.2 0 1 1 0-6.4h42.8a3.2 3.2 0 0 1 3.1 4.9c-.7 1-1.9 1.6-3.1 1.5zm0-20.2H18.1a3.2 3.2 0 1 1 0-6.4h42.8a3.2 3.2 0 1 1 0 6.4zm0-20H18.1a3.2 3.2 0 1 1 0-6.3h42.8a3.2 3.2 0 0 1 0 6.3zM8.5 12.3a4.2 4.2 0 1 1-8.5 0 4.2 4.2 0 0 1 8.5 0zm0 19.8A4.2 4.2 0 1 1 0 32a4.2 4.2 0 0 1 8.5 0zm0 19.8a4.3 4.3 0 1 1-8.5 0 4.3 4.3 0 0 1 8.5 0zm0 0\"/>\n </symbol>\n\n <symbol id=\"shk-icon_unmute\" viewBox=\"0 0 64 66\">\n <path d=\"M34.3 0c1.5.1 2.6 1.4 2.9 2.8v60.3c-.3 1.4-1.4 2.7-3 2.8-.7.1-1.6-.1-2.6-.7L13.7 50H4.2a4 4 0 0 1-4.1-4V20.6c0-2.2 1.8-4 4-4.1h9.6c.7-.8 17.2-15.1 17.9-15.8 1-.6 1.9-.8 2.6-.7zm6.4 9.3a2 2 0 0 1 2.4-1.6 25.8 25.8 0 0 1 0 50.5l-.4.1a2 2 0 1 1-.4-4.1 21.7 21.7 0 0 0 0-42.5 2 2 0 0 1-1.6-2.4zm4.7 12.8a12.1 12.1 0 0 1 0 21.8 2 2 0 0 1-2.8-1c-.5-1-.1-2.2 1-2.8a8 8 0 0 0 0-14.4 2 2 0 0 1-1-2.7 2 2 0 0 1 2.8-.9zm0 0\"/>\n </symbol>\n\n <symbol id=\"shk-icon_mute\" viewBox=\"0 0 64 64\">\n <path d=\"M33.2 0c-.8 0-1.6.1-2.6.7l-17.4 15H4a4 4 0 0 0-4 4v24.1a4 4 0 0 0 4 4h9.2l17.4 14.5c1 .6 1.8.8 2.6.7 1.4-.1 2.5-1.4 2.8-2.6V2.7C35.7 1.4 34.6 0 33.2 0zm23.2 31.5l6.9-6.8c.7-.6 1-1.5.7-2.4-.2-.8-.9-1.5-1.8-1.7-.8-.2-1.8 0-2.4.7L53 28.1 46 21.3c-.6-.6-1.5-1-2.4-.7-.9.2-1.5.9-1.8 1.7-.2.9.1 1.8.8 2.4l6.9 6.8-7 6.8c-.8 1-.8 2.4.2 3.3.9 1 2.4 1 3.3.1l7-6.8 6.8 6.8c1 .9 2.5.8 3.4 0 1-1 1-2.4 0-3.4l-6.8-6.8zm0 0\"/>\n </symbol>\n\n <symbol id=\"shk-icon_triangle\" viewbox=\"0 0 64 64\"><path d=\"M59 29.2L7.8.4A3.2 3.2 0 003 3.2v57.6a3.2 3.2 0 004.8 2.8L59 34.8a3.2 3.2 0 000-5.6z\" /></symbol>\n <symbol id=\"shk-icon_chart\" viewbox=\"0 0 64 64\"><g transform=\"matrix(1 0 0 -1 0 64)\"><rect x=\"10\" width=\"8\" height=\"54.1\" rx=\"3\"><animate attributeName=\"height\" begin=\"0s\" dur=\"2s\" values=\"64;55;33;5;60;23;58;33;12;14;52;64\" calcMode=\"linear\" repeatCount=\"indefinite\"/></rect><rect x=\"26\" width=\"8\" height=\"32.8\" rx=\"3\"><animate attributeName=\"height\" begin=\"0s\" dur=\"2s\" values=\"50;34;64;23;56;23;34;4;64;54;21;50\" calcMode=\"linear\" repeatCount=\"indefinite\"/></rect><rect x=\"42\" width=\"8\" height=\"42.6\" rx=\"3\"><animate attributeName=\"height\" begin=\"0s\" dur=\"2s\" values=\"30;45;13;64;56;24;45;64;34;23;64;30\" calcMode=\"linear\" repeatCount=\"indefinite\"/></rect></g></symbol>\n <symbol id=\"shk-icon_close\" viewbox=\"0 0 16 16\"><path d=\"M3.207 14.207a1 1 0 1 1-1.414-1.414l11-11a1 1 0 0 1 1.414 1.414zm11-1.414a1 1 0 0 1-1.414 1.414l-11-11a1 1 0 0 1 1.414-1.414z\"></path></symbol>\n </svg>\n"}),this.initEl(),this.initOptions(a)}initEl(){var a=this;return d(function*(){a.el=n({className:["shk","shikwasa"],attrs:{"data-name":"shikwasa"},innerHTML:"\n <div class=\"shk-player\">\n <div class=\"shk-bar_wrap\">\n <div class=\"shk-bar\" aria-label=\"progress bar\">\n <div class=\"shk-bar_loaded\"\n role=\"progressbar\"\n aria-label=\"loaded progress\"\n aria-valuenow=\"0\"\n aria-valuemin=\"0\"\n aria-valuemax=\"1\"></div>\n <div class=\"shk-bar_played\"\n role=\"progressbar\"\n aria-label=\"played progress\"\n aria-valuenow=\"0\"\n aria-valuemin=\"0\"\n aria-valuemax=\"1\">\n <button class=\"shk-bar-handle\"\n role=\"slider\"\n aria-label=\"seek progress\"\n aria-valuenow=\"0\"\n aria-valuemin=\"0\"\n aria-orientation=\"horizontal\"\n aria-valuemax=\"1\"></button>\n </div>\n </div>\n </div>\n <div class=\"shk-body\">\n <div class=\"shk-cover\">\n <div class=\"shk-img\"></div>\n </div>\n <div class=\"shk-main\">\n <div class=\"shk-text\">\n <div class=\"shk-artist_wrap\">\n <span class=\"shk-artist\"></span>\n </div>\n <div class=\"shk-title_wrap\">\n <div class=\"shk-title_inner\">\n <span class=\"shk-title\"></span>\n </div>\n </div>\n </div>\n <div class=\"shk-controls\">\n <div class=\"shk-controls_basic\">\n <button class=\"shk-btn shk-btn_speed\"\n aria-label=\"toggle playback rate\"\n title=\"change playback rate\"\n aria-live=\"polite\">1.0x</button>\n <button class=\"shk-btn shk-btn_backward\"\n aria-label=\"rewind 10 seconds\"\n title=\"rewind 10 seconds\">\n <svg aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_backward\" />\n </svg>\n </button>\n <button class=\"shk-btn shk-btn_toggle\" aria-label=\"toggle play and pause\">\n <svg class=\"shk-btn_play\" aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_play\" />\n </svg>\n <svg class=\"shk-btn_pause\" aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_pause\" />\n </svg>\n </button>\n <button class=\"shk-btn shk-btn_forward\" aria-label=\"forward 10 seconds\" title=\"forward 10 seconds\">\n <svg aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_forward\" />\n </svg>\n </button>\n <button class=\"shk-btn shk-btn_more\" aria-label=\"more controls\" title=\"more controls\">\n <svg aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_more\" />\n </svg>\n </button>\n </div>\n <div class=\"shk-controls_extra\">\n <button class=\"shk-btn shk-btn_volume\" aria-label=\"toggle volume\" title=\"volume\">\n <svg class=\"shk-btn_unmute\" aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_unmute\" />\n </svg>\n <svg class=\"shk-btn_mute\" aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_mute\" />\n </svg>\n </button>\n </div>\n </div>\n <div class=\"shk-display\">\n <span class=\"shk-loader\" aria-live=\"polite\">\n <span class=\"shk-visuallyhidden\" tabindex=\"-1\">loading</span>\n <svg aria-hidden=\"true\" aria-label=\"loading\" aria-live=\"polite\" viewbox=\"0 0 66 66\">\n <circle cx=\"33\" cy=\"33\" r=\"30\" fill=\"transparent\" stroke=\"url(#shk-gradient)\" stroke-dasharray=\"170\"\n stroke-dashoffset=\"20\" stroke-width=\"6\" />\n <lineargradient id=\"shk-gradient\">\n <stop offset=\"50%\" stop-color=\"currentColor\" />\n <stop offset=\"65%\" stop-color=\"currentColor\" stop-opacity=\".5\" />\n <stop offset=\"100%\" stop-color=\"currentColor\" stop-opacity=\"0\" />\n </lineargradient>\n </svg>\n </span>\n <span class=\"shk-time\">\n <span class=\"shk-time_now\">00:00</span><span class=\"shk-time_duration\">00:00</span>\n </span>\n <div class=\"shk-live\">live</div>\n </div>\n </div>\n </div>\n </div>\n"}),a.playBtn=a.el.querySelector(".shk-btn_toggle"),a.fwdBtn=a.el.querySelector(".shk-btn_forward"),a.bwdBtn=a.el.querySelector(".shk-btn_backward"),a.speedBtn=a.el.querySelector(".shk-btn_speed"),a.moreBtn=a.el.querySelector(".shk-btn_more"),a.muteBtn=a.el.querySelector(".shk-btn_volume"),a.extraControls=a.el.querySelector(".shk-controls_extra"),a.texts=a.el.querySelector(".shk-text"),a.artist=a.el.querySelector(".shk-artist"),a.artistWrap=a.el.querySelector(".shk-artist_wrap"),a.titleWrap=a.el.querySelector(".shk-title_wrap"),a.titleInner=a.el.querySelector(".shk-title_inner"),a.title=a.el.querySelector(".shk-title"),a.currentTime=a.el.querySelector(".shk-time_now"),a.duration=a.el.querySelector(".shk-time_duration"),a.bar=a.el.querySelector(".shk-bar"),a.barWrap=a.el.querySelector(".shk-bar_wrap"),a.audioPlayed=a.el.querySelector(".shk-bar_played"),a.audioLoaded=a.el.querySelector(".shk-bar_loaded"),a.handle=a.el.querySelector(".shk-bar-handle"),a.cover=a.el.querySelector(".shk-cover"),a.seekControls=[a.fwdBtn,a.bwdBtn,a.handle]})()}initOptions(a){this.el.style="--color-primary: ".concat(a.themeColor),this.el.setAttribute("data-theme",a.theme),a.download&&a.audio&&a.audio.src&&(this.downloadBtn=n({tag:"a",className:["shk-btn","shk-btn_download"],attrs:{title:"download","aria-label":"download",href:"string"==typeof a.download?a.download:a.audio.src,download:"",target:"_blank",rel:"noopener noreferrer"},innerHTML:"\n <svg aria-hidden=\"true\">\n <use xlink:href=\"#shk-icon_download\" />\n </svg>\n "}),this.extraControls.append(this.downloadBtn)),this.el.setAttribute("data-fixed-type",a.fixed.type),"static"!==a.fixed.type&&"top"===a.fixed.position&&this.el.setAttribute("data-fixed-pos",a.fixed.position);var b=a.autoPlay?"playing":"paused";this.el.setAttribute("data-play",b),a.muted&&this.el.setAttribute("data-mute","")}initEvents(a){this.moreBtn.addEventListener("click",()=>{o(this.el,"data-extra")}),Array.from(this.extraControls.children).forEach(a=>{this.hideExtraControl(a)}),p(this.el,a),q=()=>{u&&(u=!1,setTimeout(()=>u=!0,100),g.call(this,this.titleWrap,this.title))},window.addEventListener("resize",q)}setAudioInfo(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};t&&(URL.revokeObjectURL(t),t=null),/blob/.test(a.cover)&&(t=a.cover),this.cover.style.backgroundImage=a.cover?"url(".concat(a.cover,")"):"none",this.title.innerHTML=a.title,this.titleInner.setAttribute("data-title",a.title),this.artist.innerHTML=a.artist,a.duration&&(this.duration.innerHTML=e(a.duration)),this.downloadBtn&&(this.downloadBtn.href=a.src),this.setBar("loaded",0),this.setLive(a.live),g(this.titleWrap,this.title)}setPlaying(){this.el.setAttribute("data-play","playing")}setPaused(){this.el.setAttribute("data-play","paused"),this.el.removeAttribute("data-loading")}setTime(a,b){this[a].innerHTML=e(b)}setBar(c,d){var e="audio"+c.charAt(0).toUpperCase()+c.substr(1);d=b(d,1),d=a(d,0),this[e].style.width=100*d+"%";var f=d.toFixed(2);this[e].setAttribute("aria-valuenow",f),this.handle.setAttribute("aria-valuenow",f)}setProgress(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;a&&!b?b=c?a/c:0:a=b*(c||0),this.setTime("currentTime",a),this.setBar("played",b)}setSpeed(a){this.speedBtn.innerHTML=f(a)+"x"}setLive(){var a=!!(0<arguments.length&&void 0!==arguments[0])&&arguments[0];a?this.el.setAttribute("data-live",""):this.el.removeAttribute("data-live")}getPercentByPos(c){var d=c.clientX||c.changedTouches&&c.changedTouches[0].clientX||0,e=this.barWrap.getBoundingClientRect().left,f=this.barWrap.clientWidth,g=(d-e)/f;return g=b(g,1),g=a(0,g),g}hideExtraControl(a){a.addEventListener("click",()=>{setTimeout(()=>{this.el.removeAttribute("data-extra")},800)})}mount(a,b){a.innerHTML="",a.append(this.el),this.icons&&a.append(this.icons),this.mounted=!0,this.initEvents(b),g(this.titleWrap,this.title)}destroy(){window.removeEventListener("resize",q),t&&URL.revokeObjectURL(t)}}class w{constructor(){this.audioEvents=["abort","canplay","canplaythrough","complete","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],this.playerEvents=["audioupdate","audioparse"],this.events={}}on(a,b){this.type(a)&&"function"==typeof b&&(!this.events[a]&&(this.events[a]=[]),this.events[a].push(b))}trigger(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};this.events[a]&&this.events[a].length&&this.events[a].forEach(a=>a(b))}type(a){return-1===this.playerEvents.indexOf(a)?-1===this.audioEvents.indexOf(a)?(console.error("Shikwasa: unknown event name: ".concat(a)),null):"audio":"player"}}var x=[],y=[],z="undefined"!=typeof window&&/mobile/i.test(window.navigator.userAgent),A=z?"touchstart":"mousedown",B=z?"touchmove":"mousemove",C=z?"touchend":"mouseup",D=!1;if("undefined"!=typeof window)try{var E=Object.defineProperty({},"passive",{get:function(){return D=!0,!1}});window.addEventListener("testPassvie",null,E),window.removeEventListener("testPassvie",null,E)}catch(a){D=!1}var F=D&&z;class G{constructor(a){this.id=x.length,x.push(this),this.comps={},this._audio={},this._hasMediaSession=!1,this._initSeek=0,this.live=!1,this._canplay=!1,this._dragging=!1,this.events=new w,this.options=h(a),this.renderComponents(),this.initUI(this.options),this.initAudio(),this.ui.mount(this.options.container,D)}get duration(){return this.audio&&this.audio.duration?this.audio.duration:this._audio.duration}get seekable(){return!this.live&&!!this.duration}set seekable(a){a?this.ui.seekControls.forEach(a=>{a.removeAttribute("disabled")}):this.ui.seekControls.forEach(a=>{a.setAttribute("disabled","")})}get currentTime(){return this.audio?this.audio.currentTime:void 0}get playbackRate(){return this.audio?this.audio.playbackRate:void 0}set playbackRate(a){this.audio&&(this.audio.playbackRate=a,this.audio.defaultPlaybackRate=a)}get muted(){return this.audio?this.audio.muted:void 0}set muted(a){this.audio&&(this.audio.muted=a,this.audio.defaultMuted=a)}initUI(){this.ui=new v(this.options),this.el=this.ui.el,this.initControlEvents(),this.initBarEvents()}initControlEvents(){this.ui.playBtn.addEventListener("click",()=>{this.toggle()}),this.ui.muteBtn.addEventListener("click",()=>{this.muted=!this.muted,o(this.el,"data-mute")}),this.ui.fwdBtn.addEventListener("click",()=>{this.seekBySpan()}),this.ui.bwdBtn.addEventListener("click",()=>{this.seekBySpan({forward:!1})}),this.ui.speedBtn.addEventListener("click",()=>{var a=this.options.speedOptions.indexOf(this.playbackRate),b=this.options.speedOptions;this.playbackRate=a+1>=b.length?b[0]:b[a+1],this.ui.setSpeed(this.playbackRate)})}initBarEvents(){var a=0,b=a=>{this.ui.setProgress(null,this.ui.getPercentByPos(a),this.duration)},c=d=>{d.preventDefault(),document.removeEventListener(B,b),document.removeEventListener(C,c),a=this.ui.getPercentByPos(d)*this.duration,this.seek(a),this._dragging=!1,setTimeout(()=>this.el.removeAttribute("data-seeking"),50)};this.ui.barWrap.addEventListener(A,a=>{this.seekable&&(a.preventDefault(),this.el.setAttribute("data-seeking",""),this._dragging=!0,document.addEventListener(B,b,!!F&&{passive:!0}),document.addEventListener(C,c))}),this.ui.handle.addEventListener("keydown",a=>{if(this.seekable){var b=a.key.replace("Arrow",""),c=["PageDown","PageUp"],d=["Home","End"],e=-1!==["Left","Down"].indexOf(b),f=-1!==["Right","Up"].indexOf(b),g=b===c[0],h=b===c[1],i=b===d[0],j=b===d[1];if(e||f||-1!==c.indexOf(b)||-1!==d.indexOf(b)){if(i)return void this.seek(0);if(j)return void this.seek(this.duration);var k=(h||g?.1:.01)*(f||h?1:-1),l=this._canplay?this.currentTime:this._initSeek,m=k*this.duration+l;this.seek(m)}}})}initAudio(){this.options.audio.src&&(this.audio=new Audio,this.initAudioEvents(),this.events.audioEvents.forEach(a=>{this.audio.addEventListener(a,b=>{this.events.trigger(a,b)})}),this.audio.preload=this.options.preload,this.muted=this.options.muted,this.update(this.options.audio))}initAudioEvents(){this.on("play",()=>{this.ui.setPlaying(),x.forEach(a=>{a.id!==this.id&&a.audio&&!a.audio.paused&&a.pause()})}),this.on("pause",()=>{this.ui.setPaused()}),this.on("ended",()=>{this.ui.setPaused(),this.seek(0)}),this.on("waiting",()=>{this.el.setAttribute("data-loading","")}),this.on("durationchange",()=>{this.duration!==1/0&&this.live&&(this.live=!1),this.duration&&1!==this.duration&&this.duration!==1/0&&(this.seekable=!0,this.ui.setTime("duration",this.duration))}),this.on("canplay",()=>{this._canplay||(this._canplay=!0,this._initSeek&&(this.seek(this._initSeek),this._initSeek=0)),this.duration!==1/0||this.live||(this.live=!0,this.ui.setLive(this.live))}),this.on("canplaythrough",()=>{this.el.removeAttribute("data-loading")}),this.on("progress",()=>{if(this.audio.buffered.length){var a=this.audio.buffered.length?this.audio.buffered.end(this.audio.buffered.length-1)/this.duration:0;this.ui.setBar("loaded",a)}}),this.on("timeupdate",()=>{this._dragging||this.ui.setProgress(this.audio.currentTime,null,this.duration)}),this.on("abort",()=>{this.ui.setPaused()}),this.on("audioupdate",a=>{this.seekable=a.duration&&a.duration!==1/0,this.updateMetadata(a)}),this.on("audioparse",a=>{this.seekable=a.duration&&a.duration!==1/0,this.updateMetadata(a)})}initMediaSession(){var a=this;if("mediaSession"in navigator){this._hasMediaSession=!0,this.setMediaMetadata(this._audio);var b={play:this.play.bind(a),pause:this.pause.bind(a),seekforward:this.seekBySpan.bind(a),seekbackward:()=>this.seekBySpan({forward:!1}),seekto:this.seek.bind(a)};Object.keys(b).forEach(a=>{navigator.mediaSession.setActionHandler(a,b[a])})}}setMediaMetadata(a){var b=a.cover?[{src:a.cover,sizes:"150x150"}]:void 0;navigator.mediaSession.metadata=new MediaMetadata({title:a.title,artist:a.artist,album:a.album,artwork:b})}on(a,b){this.events.on(a,b)}play(){if(this.audio.paused){var a=this.audio.play();return a instanceof Promise?(a.then(()=>{this.initMediaSession()}),a.catch(a=>{("NotAllowedError"===a.name||"NotSupportedError"===a.name)&&this.pause()})):this.initMediaSession(),a}}pause(){this.audio.paused||this.audio.pause()}toggle(){return this.audio.paused?this.play():this.pause()}seek(c){this.seekable&&(c=parseInt(c),isNaN(c)&&console.error("Shikwasa: seeking time is NaN"),c=b(c,this.duration),c=a(c,0),this.ui.setProgress(c,null,this.duration),this._canplay?this.audio.currentTime=c:this._initSeek=c)}seekBySpan(){var{time:a=10,forward:b=!0}=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=this._canplay?this.audio.currentTime:this._initSeek,d=c+a*(b?1:-1);this.seek(d)}update(a){if(a&&a.src){this._audio=i(a),this.live=this._audio.live,this._canplay=!1,this.audio.src=this._audio.src,this.events.trigger("audioupdate",this._audio);var b=!a.title||!a.artist||!a.cover||!a.chapters;!this.live&&this.options.parser&&b&&j(Object.assign({},a),this.options.parser).then(a=>{this._audio=a||this._audio,this.events.trigger("audioparse",this._audio)})}else throw new Error("Shikwasa: audio source is not specified")}updateMetadata(a){this.audio.title=a.title,this.ui.setAudioInfo(a),this._hasMediaSession&&this.setMediaMetadata(a)}destroyAudio(){this.audio.pause(),this.audio.src="",this.audio.load(),this.audio=null}destroy(){this.destroyAudio(),this.ui.destroy(),Object.keys(this.comps).forEach(a=>{this.comps[a].destroy&&"function"==typeof this.comps[a].destroy&&this.comps[a].destroy()}),this.comps=null,this.options.container.innerHTML=""}renderComponents(){y.length&&y.forEach(a=>{this.comps[a._name]=new a(this)})}}G.use=function(a){y.push(a)};return console.log("%c\uD83C\uDF4A%c Shikwasa Podcast Player v2.1.3 %c https://shikwasa.js.org","background-color:#00869B40;padding:4px;","background:#00869B80;color:#fff;padding:4px 0","padding: 2px 0;"),G});
\ No newline at end of file |