diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index 38f40d38a..d6f6a315a 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Offline) -// @version 263.11 +// @version 263.13 // @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -879,7 +879,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/clear-cache.min.js"] = (()=>{return(n,c)=>{return{widget:{content:`\n `,condition:()=>typeof offlineData==="undefined",success:()=>{$("#clear-cache").on("click",()=>{n.cache={};saveSettings(n);Toast.success("已删除全部缓存.","清除缓存",5e3)})}}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/combo-like.min.js"] = (()=>{return(e,t)=>{(async()=>{const e=await SpinQuery.select(()=>document.querySelector(".ops span.like"));if(!e){return}e.style.userSelect="none";function t(t,n){const u=new CustomEvent(t,n);e.dispatchEvent(u)}const n=200;let u=true;e.addEventListener("touchstart",e=>{e.preventDefault();u=true;setTimeout(()=>u=false,n);t("mousedown",e)});e.addEventListener("touchend",e=>{e.preventDefault();t("mouseup",e);if(u===true){t("click",e)}})})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment-dark.min.css"] = `.bb-comment .comment-list .list-item .info .hate.hated>i,.bb-comment .comment-list .list-item .info .hate>i,.bb-comment .comment-list .list-item .info .like.liked>i,.bb-comment .comment-list .list-item .info .like>i,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-list .list-item>.con>.info>.floor,.bb-comment .comment-list .list-item>.con>.info>.time,.bb-comment .comment-list .reply-con>.info>.time,.bb-comment .comment-send .comment-emoji .text,.dynamic-hate i,.dynamic-hate:hover i,.dynamic-hated i,.dynamic-hated:hover i,.dynamic-like i,.dynamic-like:hover i,.dynamic-liked i,.dynamic-liked:hover i,.dynamic-spot,.textarea-container .comm-tool .comm-emoji .icon-face{filter:brightness(0) invert(1)!important}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .hate.hated span,.bb-comment .comment-list .list-item .info .hate:hover span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-list .list-item .info .like.liked span,.bb-comment .comment-list .list-item .info .like:hover span{color:#eee!important}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment.min.css"] = `.comment-list .list-item{position:relative}.bb-comment .comment-list .list-item .info,.dynamic-list-item-wrap .item-detail>.info{display:flex}.bb-comment .comment-list .list-item .info .floor,.dynamic-list-item-wrap .item-detail>.info .floor{order:1}.bb-comment .comment-list .list-item .info .reply,.dynamic-list-item-wrap .item-detail>.info .reply{order:2}.bb-comment .comment-list .list-item .info .operation,.dynamic-list-item-wrap .item-detail>.info .operation{order:3;flex-grow:1;display:flex!important;justify-content:flex-end}.bb-comment .comment-list .list-item>.con>.reply-box{transform:translateX(0)}.bb-comment .comment-list .list-item>.con>.info{margin-top:4px}.bb-comment .comment-list .list-item>.con>.info>.time,.item-detail>.info>.time{position:absolute;right:8px;top:24px;margin:0;line-height:normal;color:#000}.item-detail>.info>.time{top:12px;opacity:1}.reply-box .item-user>a{margin-right:8px}.bb-comment .comment-header .tabs-order li.on:after,.bb-comment .comment-list .list-item .con .vote-container,.bb-comment .comment-list .list-item .user-face .hot-follow,.bb-comment .comment-list .list-item>.con>.info>.plad,.bb-comment .nameplate,.comment-area .dynamic-level,.dynamic-list-item-wrap .info .plat{display:none}.bb-comment .comment-list .reply-con{position:relative}.bb-comment .comment-list .reply-con>.info>.time,.dynamic-list-item-wrap .reply-box .time{position:absolute;right:8px;top:0;margin:0;opacity:.5;line-height:normal;color:#000}.dynamic-list-item-wrap .reply-box .time{top:10px;opacity:.7}.bb-comment .comment-list .list-item .user{margin-right:120px}.reply-box .item-user .text{display:block}.bb-comment .comment-list .list-item .user .level{visibility:hidden;width:0;margin:0}.bb-comment .comment-list .list-item .info .hate>*,.bb-comment .comment-list .list-item .info .like>*,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji>*,.dynamic-hate i,.dynamic-like i{transition:.2s ease-out}.bb-comment .comment-list .list-item .info .hate i,.bb-comment .comment-list .list-item .info .like i,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji .face,.dynamic-hate i,.dynamic-like i,.dynamic-spot,.textarea-container .comm-tool .comm-emoji .icon-face{height:16px!important;width:16px!important;opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-send .comment-emoji span{opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .hate.hated span,.bb-comment .comment-list .list-item .info .hate:hover span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-list .list-item .info .like.liked span,.bb-comment .comment-list .list-item .info .like:hover span,.bb-comment .comment-send .comment-emoji span{color:#000}.bb-comment .comment-list .list-item .info .hate:hover>*,.bb-comment .comment-list .list-item .info .like.hated:hover>*,.bb-comment .comment-list .list-item .info .like.hated>*,.bb-comment .comment-list .list-item .info .like.liked:hover>*,.bb-comment .comment-list .list-item .info .like.liked>*,.bb-comment .comment-list .list-item .info .like:hover>*,.bb-comment .comment-list .list-item .info .operation .spot:hover,.bb-comment .comment-send .comment-emoji.open .face,.bb-comment .comment-send .comment-emoji:hover .face,.bb-comment .comment-send .comment-emoji:hover span{opacity:.7}.bb-comment .comment-list .list-item .info .like i,.dynamic-like i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .like.liked i,.bb-comment .comment-list .list-item .info .like.liked:hover i,.dynamic-like:hover i,.dynamic-liked i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate i,.dynamic-hate i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate.hated i,.bb-comment .comment-list .list-item .info .hate.hated:hover i,.dynamic-hate:hover i,.dynamic-hated i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .operation .spot,.dynamic-spot{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-send .comment-emoji .face,.textarea-container .comm-tool .comm-emoji .icon-face{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item{background-color:#0001;border:none;display:flex;align-items:center;padding:10px 14px}.bb-comment .reply-notice .notice-item .icon-notice{order:0;position:static;margin-right:12px;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item a{order:1;flex-grow:1;color:#000}.bb-comment .reply-notice .notice-item .icon-close-notice{order:2;position:static;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item .icon-close-notice,.bb-comment .reply-notice .notice-item .icon-notice{height:18px;width:18px;opacity:.7}.bb-comment .comment-list .list-item .user .text-con{white-space:pre-wrap;display:block}.bb-comment .comment-list .list-item .text{white-space:pre-wrap}`; +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment.min.css"] = `.comment-list .list-item{position:relative}.bb-comment .comment-list .list-item .info,.dynamic-list-item-wrap .item-detail>.info{display:flex}.bb-comment .comment-list .list-item .info .floor,.dynamic-list-item-wrap .item-detail>.info .floor{order:1}.bb-comment .comment-list .list-item .info .reply,.dynamic-list-item-wrap .item-detail>.info .reply{order:2}.bb-comment .comment-list .list-item .info .operation,.dynamic-list-item-wrap .item-detail>.info .operation{order:3;flex-grow:1;display:flex!important;justify-content:flex-end}.bb-comment .comment-list .list-item>.con>.reply-box{transform:translateX(0)}.bb-comment .comment-list .list-item>.con>.info{margin-top:4px}.bb-comment .comment-list .list-item>.con>.info>.time,.item-detail>.info>.time{position:absolute;right:8px;top:24px;margin:0;line-height:normal;color:#000}.item-detail>.info>.time{top:12px;opacity:1}.reply-box .item-user>a{margin-right:8px}.bb-comment .comment-header .tabs-order li.on:after,.bb-comment .comment-list .list-item .con .vote-container,.bb-comment .comment-list .list-item .user-face .hot-follow,.bb-comment .comment-list .list-item>.con>.info>.plad,.bb-comment .nameplate,.comment-area .dynamic-level,.dynamic-list-item-wrap .info .plat{display:none!important}.bb-comment .comment-list .reply-con{position:relative}.bb-comment .comment-list .reply-con>.info>.time,.dynamic-list-item-wrap .reply-box .time{position:absolute;right:8px;top:0;margin:0;opacity:.5;line-height:normal;color:#000}.dynamic-list-item-wrap .reply-box .time{top:10px;opacity:.7}.bb-comment .comment-list .list-item .user{margin-right:120px}.reply-box .item-user .text{display:block}.bb-comment .comment-list .list-item .user .level{visibility:hidden;width:0;margin:0}.bb-comment .comment-list .list-item .info .hate>*,.bb-comment .comment-list .list-item .info .like>*,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji>*,.dynamic-hate i,.dynamic-like i{transition:.2s ease-out}.bb-comment .comment-list .list-item .info .hate i,.bb-comment .comment-list .list-item .info .like i,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji .face,.dynamic-hate i,.dynamic-like i,.dynamic-spot,.textarea-container .comm-tool .comm-emoji .icon-face{height:16px!important;width:16px!important;opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-send .comment-emoji span{opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .hate.hated span,.bb-comment .comment-list .list-item .info .hate:hover span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-list .list-item .info .like.liked span,.bb-comment .comment-list .list-item .info .like:hover span,.bb-comment .comment-send .comment-emoji span{color:#000}.bb-comment .comment-list .list-item .info .hate:hover>*,.bb-comment .comment-list .list-item .info .like.hated:hover>*,.bb-comment .comment-list .list-item .info .like.hated>*,.bb-comment .comment-list .list-item .info .like.liked:hover>*,.bb-comment .comment-list .list-item .info .like.liked>*,.bb-comment .comment-list .list-item .info .like:hover>*,.bb-comment .comment-list .list-item .info .operation .spot:hover,.bb-comment .comment-send .comment-emoji.open .face,.bb-comment .comment-send .comment-emoji:hover .face,.bb-comment .comment-send .comment-emoji:hover span{opacity:.7}.bb-comment .comment-list .list-item .info .like i,.dynamic-like i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .like.liked i,.bb-comment .comment-list .list-item .info .like.liked:hover i,.dynamic-like:hover i,.dynamic-liked i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate i,.dynamic-hate i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate.hated i,.bb-comment .comment-list .list-item .info .hate.hated:hover i,.dynamic-hate:hover i,.dynamic-hated i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .operation .spot,.dynamic-spot{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-send .comment-emoji .face,.textarea-container .comm-tool .comm-emoji .icon-face{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item{background-color:#0001;border:none;display:flex;align-items:center;padding:10px 14px}.bb-comment .reply-notice .notice-item .icon-notice{order:0;position:static;margin-right:12px;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item a{order:1;flex-grow:1;color:#000}.bb-comment .reply-notice .notice-item .icon-close-notice{order:2;position:static;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item .icon-close-notice,.bb-comment .reply-notice .notice-item .icon-notice{height:18px;width:18px;opacity:.7}.bb-comment .comment-list .list-item .user .text-con{white-space:pre-wrap;display:block}.bb-comment .comment-list .list-item .text{white-space:pre-wrap}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment.min.js"] = (()=>{return(r,e)=>{}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/compact-layout.min.css"] = `.groom-module{margin:0!important;width:192px!important;height:120px!important}.bangumi-timing-module .card-timing,.groom-module{-webkit-tap-highlight-color:transparent}.chief-recommend-module .recommend-module,.groom-box-m,.nominate-m .video-card-box{height:240px!important}.groom-module .lazy-img,.groom-module .pic{width:100%!important;height:100%!important;transition:.2s}.groom-module:hover .lazy-img,.groom-module:hover .pic{filter:blur(8px)}.groom-module .card-mark{width:calc(100% - 20px)!important;top:88px;padding:10px!important}.groom-module:hover .card-mark{top:0!important}.chief-recommend-module .carousel-box,.chief-recommend-module .carousel-box img{height:240px!important;width:480px!important}.nominate-m .carousel-box,.nominate-m .carousel-box img{height:240px!important;width:672px!important}.live-module .storey-box .card-live-module,.special-module,.storey-box .spread-module,.video-item-biref{margin:0!important;width:192px!important;height:168px!important;-webkit-tap-highlight-color:transparent}.special-module{height:192px!important}.special-module .pic .title{line-height:unset!important;height:auto!important}.special-recommend-module .storey-box{height:180px!important}.special-module .user{transform:translatey(24px)}.live-module .storey-box .card-live-module .pic,.mod-1 .l .spread-module,.mod-2 .spread-module,.mod-2 li .l,.mod-3 .l .spread-module,.mod-3 .l-item .l,.special-module .pic-box,.spread-module .pic,.video-item-biref .biref-img{width:192px!important;height:120px!important}.mod-2 li .l-item{height:auto}.mod-3 .l-item,.mod-3 li{width:192px!important}.mod-3 .l .spread-module{margin:0!important}.mod-1 .r,.mod-1 li,.mod-2 li .l-item,.mod-3 li{padding:0!important}.mod-3 .r .title,.mod-3 .r .up-info,.mod-3 .r .v-info{padding-top:4px!important;margin-top:0!important}.mod-2 li .r .v-desc{padding:0!important;margin:10px 0!important}.live-module .storey-box .card-live-module .num,.spread-module .num{padding-left:8px;padding-right:8px;bottom:6px}.live-module .storey-box .card-live-module .t,.special-module .pic .title,.spread-module .t,.video-item-biref .biref-info .biref-title{padding-left:4px;padding-right:4px;padding-top:4px}.sec-rank .rank-list-wrap .rank-list{min-height:288px}.hot-recom-module{height:auto!important}.game-groom-box-m,.game-groom-box-m .game-groom-m{height:100%!important}.card-live-module .pic .mask,.carousel-box .carousel-module .panel,.carousel-wrapper,.game-groom-box-m .game-groom-m,.groom-module,.live-module .storey-box .card-live-module .pic,.mod-3 .l-item,.special-module .pic-box,.spread-module .pic,.video-item-biref .biref-img{border-radius:0!important}.card-timing-module .pic,.rank-list .rank-item .ri-num,.timeline-box .timeline-item .preview,.timeline-box .timeline-item .preview img{border-radius:50%!important}.cover-preview-module .cover{width:160px;transform-origin:left top 0;transform:scale(1.3)}.bangumi-timing-module .card-timing{width:205px}.card-timing-module .r-text{width:120px}.recommend-module .rec-btn.prev{left:0!important}.primary-menu{display:flex;align-items:center;margin:0;width:100%}.primary-menu .nav-menu{flex:1 0 auto;display:flex;justify-content:space-between;align-items:center;margin-right:28px}.primary-menu .nav-menu>li .num-wrap span{padding:2.5px;line-height:unset;height:auto;min-width:30px}.primary-menu .nav-menu .side-nav .side-link i.blackroom,.primary-menu .nav-menu .side-nav .side-link i.live,.primary-menu .nav-menu .side-nav .side-link i.square,.primary-menu .nav-menu .side-nav .side-link i.zhuanlan,.primary-menu .nav-menu>li.home>a{background-size:contain;background-repeat:no-repeat;background-position:initial}.primary-menu .nav-menu>li .num-wrap{top:0;position:static;height:auto}.primary-menu .nav-menu li .nav-name{line-height:unset;height:auto}.primary-menu .nav-menu>li:not(.home) .nav-name{height:auto;padding:0}.nav-gif{position:static;flex:0 0 auto}.primary-menu .nav-menu li.home>a .nav-name{visibility:hidden;display:block;position:static}.primary-menu .nav-menu .sub-nav{top:36px;padding-top:4px}@media screen and (min-width:1300px){.bili-wrapper,.cinema-home-wrapper{width:1248px!important}.block-area .block-left{width:960px!important}.timeline-box .timeline-item{padding-right:32px!important}.elevator-module{margin-left:630px!important}.bili-wrapper .l-con{width:988px!important}.bangumi-timing-module .card-timing{padding:36px 30px 0 0}.bangumi-timing-module .card-timing:nth-child(4):nth-child(4){padding-top:0}.mod-1 li .r{width:750px!important}.mod-2 li .r{width:245px!important}.mod-2 li .r .up-info .v-author,.mod-2 li .r .v-info .v-info-i{width:70px!important}.bangumi-timing-module .headline .bili-tab{width:700px;display:flex;justify-content:space-evenly}}@media screen and (max-width:1300px){.bili-wrapper,.cinema-home-wrapper{width:1056px!important}.block-area .block-left{width:768px!important}.elevator-module{margin-left:540px!important}.bili-wrapper .l-con{width:768px!important}.bangumi-timing-module .card-timing{padding:36px 36px 0 0}#ranking_guochuang{width:260px!important;transform:translatex(28px)}.mod-1 li .r{width:530px!important}.mod-2 li .r{width:160px!important}.mod-2 li .r .up-info .v-author,.mod-2 li .r .v-info .v-info-i{width:50px!important}}.article-card .article-info{width:304px!important}.article-card .article-cover,.article-card .article-cover img{width:116px!important;height:87px!important;border-radius:0!important}.article-card{margin-bottom:0!important}.article-card .article-info .data>.comment,.article-card .article-info .data>.view{display:inline-flex!important;align-items:center!important}.article-card .article-info .data{display:flex!important;align-items:center!important}@media screen and (max-width:1300px){.article-card .article-info{width:220px!important}}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/compact-layout.min.js"] = (()=>{return(t,i)=>{const c=["https://www.bilibili.com/","https://www.bilibili.com/watchlater/#/list"];if(c.indexOf(location.href.replace(location.search,""))!==-1){document.documentElement.classList.add("compact")}}})(); @@ -927,7 +927,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/i18n.min.js"] = (()=>{return(e,t)=>{const a={"日本語":"ja-JP",English:"en-US",Deutsch:"de-DE"};class r{accepts(e){return e.nodeType===Node.ELEMENT_NODE}getValue(e){return e.nodeValue}setValue(e,t){e.nodeValue=t}getElement(e){return e}translate(e){const t=this.getValue(e);if(!t||typeof t!=="string"||t==="*"){return}const a=r.map.get(t.trim());if(a===undefined){return}if(typeof a==="string"){this.setValue(e,a)}else if(Array.isArray(a)){let t=null;for(const r of a){if(typeof r==="string"){t=r}else{const{text:a,selector:s,not:l}=r;if(this.getElement(e).matches(s)!==Boolean(l)){t=a}}}if(t!==null){this.setValue(e,t)}}else{const{text:t,selector:r,not:s}=a;if(this.getElement(e).matches(r)!==Boolean(s)){this.setValue(e,t)}}}static walk(e,t){const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,null,false);let r=a.nextNode();while(r){t(r);r=a.nextNode()}}static translate(e){if(e.nodeType===Node.TEXT_NODE){r.textNode.translate(e);return}r.walk(e,e=>{for(const t of r.allTranslators){if(t.accepts(e)){t.translate(e)}}})}static translateCssMatches(){const e=r.map.get("*");if(!e){return}for(const{selector:t,text:a}of e){const e=document.querySelector(t);if(e){[...e.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).forEach(e=>e.nodeValue=a)}}}}class s extends r{accepts(e){return e.nodeType===Node.TEXT_NODE}getElement(e){return e.parentElement}}class l extends r{getValue(e){return e.getAttribute("title")}setValue(e,t){e.setAttribute("title",t)}}class n extends r{getValue(e){return e.getAttribute("placeholder")}setValue(e,t){e.setAttribute("placeholder",t)}}r.textNode=new s;r.title=new l;r.placeholder=new n;r.allTranslators=[r.textNode,r.title,r.placeholder];(async()=>{const{map:s}=await t.importAsync(`i18n.${a[e.i18nLanguage]}`);r.map=s;r.translate(document.body);r.translateCssMatches();Observer.observe("body",e=>{e.forEach(e=>{if(e.type==="childList"){if(e.addedNodes.length>0){r.translateCssMatches()}e.addedNodes.forEach(e=>{r.translate(e)})}else if(e.type==="characterData"){r.textNode.translate(e.target)}})},{characterData:true,childList:true,subtree:true})})();return{export:{Translator:r,TextNodeTranslator:s,TitleTranslator:l,PlaceholderTranslator:n}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/i18n.zh-TW.min.js"] = (()=>{return(r,e)=>{const n=new Map([[`主站`,`主站`],[`画友`,`絵画`],[`音频`,`音樂`],[`游戏中心`,`遊戲`],[`会员购`,`購物`],[`漫画`,`漫畫`],[`下载APP`,`下載APP`],[`大会员`,`大會員`],[`动态`,`動態`],[`稍后再看`,`稍後再看`],[`历史`,`歷史`],[`番剧`,`番劇`],[`动画`,`動畫`],[`国创`,`國創`],[`音乐`,`音樂`],[`游戏`,`遊戲`],[`数码`,`數位`],[`电影`,`電影`],[`纪录片`,`紀錄片`],[`时尚`,`時尚`],[`娱乐`,`娛樂`],[`广告`,`廣告`],[`原创`,`原創`],[`广场`,`廣場`],[`发布`,`發佈`],[`专栏`,`專欄`],[`关注`,`關注`],[`粉丝`,`粉絲`],[`热门`,`熱門`],[`视频`,`影片`],[`图片`,`圖片`],[`小视频`,`短影片`],[`公告栏`,`公告欄`],[`特别推荐`,`特別推薦`],[`有新动态`,`有新動態`],[`所有关注`,`所有關注`],[`首页`,`首頁`],[`编辑`,`編輯`],[`回复`,`回覆`],[`举报`,`舉報`],[`在线人数`,`在線人數`],[`*`,[]]]);return{export:{map:n}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/icons.min.css"] = `.icons-enabled [class^=icon-]{width:24px;height:24px;display:inline-block;background-image:none}.icons-enabled [class^=icon-]::after{content:"";width:24px;height:24px;display:inline-block}.icons-enabled .icon-view::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-clear::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-download::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-update::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-info::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-settings::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-widgets::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-cancel::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-ok::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-video::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-style::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-tool::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-touch::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-other::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-arrow::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-rank::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-like::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-danmaku::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-search::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu>li.home>a,.icons-enabled .icon-home::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.zhuanlan,.icons-enabled .icon-read::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.square,.icons-enabled .icon-square::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.live,.icons-enabled .icon-live::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.blackroom,.icons-enabled .icon-judge::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-medal::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-live-title::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-biliplus::after{background-image:url('data:image/svg+xml;utf-8,')}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-resolution.min.js"] = (()=>{return(t,e)=>{const r=/@(\d+)[Ww]_(\d+)[Hh]/;const i=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseInt(t.imageResolutionScale);const o=["#certify-img1","#certify-img2"];const n=[".jpg",".png",".gif",".webp"];function s(t){const e=()=>{if(o.some(e=>t.matches(e))){return}if(!n.some(e=>t.src.endsWith(e))){return}const e=t.src.match(r);if(!e){return}let[,s,c]=e;let u=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(s)>=u&&u!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",s)}s=(i*parseInt(s)).toString();c=(i*parseInt(c)).toString();t.setAttribute("data-resolution-width",s);t.src=t.src.replace(r,`@${s}w_${c}h`)};Observer.observe(t,()=>{e()},{attributeFilter:["src"],attributes:true})}document.querySelectorAll("img").forEach(t=>s(t));Observer.childListSubtree(document.body,t=>{for(const e of t){for(const t of e.addedNodes){if(t.nodeName.toLowerCase()==="img"){s(t)}else if(t instanceof Element){t.querySelectorAll("img").forEach(t=>s(t))}}}});return{export:{imageResolution:s}}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-resolution.min.js"] = (()=>{return(t,e)=>{const r=/@(\d+)[Ww]_(\d+)[Hh]/;const n=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseInt(t.imageResolutionScale);const o=["#certify-img1","#certify-img2"];const i=[".jpg",".png",".gif",".webp"];const s=(t,e)=>{const r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null,false);let n=r.nextNode();while(n){e(n);n=r.nextNode()}};async function a(t){const e=(e,i)=>{const s=e(t);if(s===null){return}if(o.some(e=>t.matches(e))){return}const a=s.match(r);if(!a){return}let[,u,c]=a;let l=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(u)>=l&&l!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",u)}u=(n*parseInt(u)).toString();c=(n*parseInt(c)).toString();t.setAttribute("data-resolution-width",u);i(t,s.replace(r,`@${u}w_${c}h`))};Observer.observe(t,()=>{e(t=>t.getAttribute("src"),(t,e)=>t.setAttribute("src",e));e(t=>t.style.backgroundImage,(t,e)=>t.style.backgroundImage=e)},{attributeFilter:["src","style"],attributes:true})}s(document.body,t=>a(t));Observer.childListSubtree(document.body,t=>{for(const e of t){for(const t of e.addedNodes){if(t instanceof HTMLElement){a(t);if(t.nodeName.toUpperCase()!=="IMG"){s(t,t=>a(t))}}}}});return{export:{imageResolution:a}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-viewer.min.css"] = `body.image-viewer-opened,html.image-viewer-opened{overflow:hidden!important}.image-viewer-container{background:rgba(0,0,0,.85);width:100%;height:100%;position:fixed;top:0;left:0;z-index:100000;display:none;justify-content:center;align-items:center}.image-viewer-container.opened{display:flex}.image-viewer{width:90%;height:90%;display:grid;grid-template-columns:auto 48px;grid-template-rows:48px auto 48px 12px 48px 18px 48px;grid-template-areas:"image close" "image ." "image copy-link" "image ." "image new-tab" "image ." "image download";grid-column-gap:12px;justify-items:center;justify-content:stretch;align-items:center;align-content:stretch}.image-viewer .image{grid-area:image;width:auto;height:auto;max-width:100%;max-height:100%}.image-viewer .close{grid-area:close}.image-viewer .download{grid-area:download}.image-viewer .copy-link{grid-area:copy-link;transform:scale(.95)}.image-viewer .new-tab{grid-area:new-tab;transform:scale(.85)}.image-viewer-icon{cursor:pointer;width:100%;height:100%}.image-viewer-icon svg{max-width:48px;max-height:48px}.image-viewer-icon path{fill:#eee;transition:.2s;transform-origin:center}.image-viewer-icon:hover path{fill:var(--theme-color);transform:scale(1.1)}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-viewer.min.html"] = `
`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/medal-helper.min.css"] = `.medal-popup{position:absolute;top:calc(100% + 2px);transition:.16s ease-out;transform-origin:top;transform:scaleY(0) translateX(-50%);left:50%;background:#fff;box-shadow:0 3px 20px 2px #0004;z-index:100}.medal-popup.opened{transform:scaleY(1) translateX(-50%)}.medal-popup *{transition:.2s}.medal-popup ul{list-style:none;margin:0;padding:0}.medal-popup ul>li.active{box-shadow:0 0 4px 0 var(--theme-color)}.medal-popup ul>li:hover{background-color:rgba(0,0,0,.16)}.medal-popup label{display:flex;align-items:center;justify-content:center;cursor:pointer;padding:8px}.medal-popup label>*{flex-shrink:0}.medal-popup input[type=radio]{visibility:collapse;width:0;margin:0;padding:0}.medal-popup input[type=radio]~i{opacity:0;transform:scale(.8);margin:0}.medal-popup input[type=radio]~.fans-medal-item{margin:0 8px}.medal-popup input[type=radio]:checked~i{opacity:1}.title-image{display:inline-block;vertical-align:middle;height:20px}.fans-medal-item .label{width:40px;text-align:center;padding:0 2px;color:#fff}.fans-medal-item .level{width:16px;background-color:#fff;text-align:center;color:#61decb}.fans-medal-item .label,.fans-medal-item .level{position:relative;display:block;float:left}.fans-medal-item{display:inline-block;height:14px;line-height:14px;color:#fff;border:1px solid #61decb;border-left:0;white-space:nowrap;border-radius:2px;flex-shrink:0;font-size:12px}.level-1,.level-2,.level-3,.level-4{border-color:#61decb}.level-1 .label,.level-2 .label,.level-3 .label,.level-4 .label{background-color:#61decb}.level-1 .level,.level-2 .level,.level-3 .level,.level-4 .level{color:#61decb}.level-5,.level-6,.level-7,.level-8{border-color:#5896de}.level-5 .label,.level-6 .label,.level-7 .label,.level-8 .label{background-color:#5896de}.level-5 .level,.level-6 .level,.level-7 .level,.level-8 .level{color:#5896de}.level-10,.level-11,.level-12,.level-9{border-color:#a068f1}.level-10 .label,.level-11 .label,.level-12 .label,.level-9 .label{background-color:#a068f1}.level-10 .level,.level-11 .level,.level-12 .level,.level-9 .level{color:#a068f1}.level-13,.level-14,.level-15,.level-16{border-color:#ff86b2}.level-13 .label,.level-14 .label,.level-15 .label,.level-16 .label{background-color:#ff86b2}.level-13 .level,.level-14 .level,.level-15 .level,.level-16 .level{color:#ff86b2}.level-17,.level-18,.level-19,.level-20{border-color:#f6be18}.level-17 .label,.level-18 .label,.level-19 .label,.level-20 .label{background-color:#f6be18}.level-17 .level,.level-18 .level,.level-19 .level,.level-20 .level{color:#f6be18}`; diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index c2099caf3..144032263 100644 --- a/bilibili-evolved.preview-offline.user.js +++ b/bilibili-evolved.preview-offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Preview Offline) -// @version 263.11 +// @version 263.13 // @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -879,7 +879,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/clear-cache.min.js"] = (()=>{return(n,c)=>{return{widget:{content:`\n `,condition:()=>typeof offlineData==="undefined",success:()=>{$("#clear-cache").on("click",()=>{n.cache={};saveSettings(n);Toast.success("已删除全部缓存.","清除缓存",5e3)})}}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/combo-like.min.js"] = (()=>{return(e,t)=>{(async()=>{const e=await SpinQuery.select(()=>document.querySelector(".ops span.like"));if(!e){return}e.style.userSelect="none";function t(t,n){const u=new CustomEvent(t,n);e.dispatchEvent(u)}const n=200;let u=true;e.addEventListener("touchstart",e=>{e.preventDefault();u=true;setTimeout(()=>u=false,n);t("mousedown",e)});e.addEventListener("touchend",e=>{e.preventDefault();t("mouseup",e);if(u===true){t("click",e)}})})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment-dark.min.css"] = `.bb-comment .comment-list .list-item .info .hate.hated>i,.bb-comment .comment-list .list-item .info .hate>i,.bb-comment .comment-list .list-item .info .like.liked>i,.bb-comment .comment-list .list-item .info .like>i,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-list .list-item>.con>.info>.floor,.bb-comment .comment-list .list-item>.con>.info>.time,.bb-comment .comment-list .reply-con>.info>.time,.bb-comment .comment-send .comment-emoji .text,.dynamic-hate i,.dynamic-hate:hover i,.dynamic-hated i,.dynamic-hated:hover i,.dynamic-like i,.dynamic-like:hover i,.dynamic-liked i,.dynamic-liked:hover i,.dynamic-spot,.textarea-container .comm-tool .comm-emoji .icon-face{filter:brightness(0) invert(1)!important}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .hate.hated span,.bb-comment .comment-list .list-item .info .hate:hover span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-list .list-item .info .like.liked span,.bb-comment .comment-list .list-item .info .like:hover span{color:#eee!important}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment.min.css"] = `.comment-list .list-item{position:relative}.bb-comment .comment-list .list-item .info,.dynamic-list-item-wrap .item-detail>.info{display:flex}.bb-comment .comment-list .list-item .info .floor,.dynamic-list-item-wrap .item-detail>.info .floor{order:1}.bb-comment .comment-list .list-item .info .reply,.dynamic-list-item-wrap .item-detail>.info .reply{order:2}.bb-comment .comment-list .list-item .info .operation,.dynamic-list-item-wrap .item-detail>.info .operation{order:3;flex-grow:1;display:flex!important;justify-content:flex-end}.bb-comment .comment-list .list-item>.con>.reply-box{transform:translateX(0)}.bb-comment .comment-list .list-item>.con>.info{margin-top:4px}.bb-comment .comment-list .list-item>.con>.info>.time,.item-detail>.info>.time{position:absolute;right:8px;top:24px;margin:0;line-height:normal;color:#000}.item-detail>.info>.time{top:12px;opacity:1}.reply-box .item-user>a{margin-right:8px}.bb-comment .comment-header .tabs-order li.on:after,.bb-comment .comment-list .list-item .con .vote-container,.bb-comment .comment-list .list-item .user-face .hot-follow,.bb-comment .comment-list .list-item>.con>.info>.plad,.bb-comment .nameplate,.comment-area .dynamic-level,.dynamic-list-item-wrap .info .plat{display:none}.bb-comment .comment-list .reply-con{position:relative}.bb-comment .comment-list .reply-con>.info>.time,.dynamic-list-item-wrap .reply-box .time{position:absolute;right:8px;top:0;margin:0;opacity:.5;line-height:normal;color:#000}.dynamic-list-item-wrap .reply-box .time{top:10px;opacity:.7}.bb-comment .comment-list .list-item .user{margin-right:120px}.reply-box .item-user .text{display:block}.bb-comment .comment-list .list-item .user .level{visibility:hidden;width:0;margin:0}.bb-comment .comment-list .list-item .info .hate>*,.bb-comment .comment-list .list-item .info .like>*,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji>*,.dynamic-hate i,.dynamic-like i{transition:.2s ease-out}.bb-comment .comment-list .list-item .info .hate i,.bb-comment .comment-list .list-item .info .like i,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji .face,.dynamic-hate i,.dynamic-like i,.dynamic-spot,.textarea-container .comm-tool .comm-emoji .icon-face{height:16px!important;width:16px!important;opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-send .comment-emoji span{opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .hate.hated span,.bb-comment .comment-list .list-item .info .hate:hover span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-list .list-item .info .like.liked span,.bb-comment .comment-list .list-item .info .like:hover span,.bb-comment .comment-send .comment-emoji span{color:#000}.bb-comment .comment-list .list-item .info .hate:hover>*,.bb-comment .comment-list .list-item .info .like.hated:hover>*,.bb-comment .comment-list .list-item .info .like.hated>*,.bb-comment .comment-list .list-item .info .like.liked:hover>*,.bb-comment .comment-list .list-item .info .like.liked>*,.bb-comment .comment-list .list-item .info .like:hover>*,.bb-comment .comment-list .list-item .info .operation .spot:hover,.bb-comment .comment-send .comment-emoji.open .face,.bb-comment .comment-send .comment-emoji:hover .face,.bb-comment .comment-send .comment-emoji:hover span{opacity:.7}.bb-comment .comment-list .list-item .info .like i,.dynamic-like i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .like.liked i,.bb-comment .comment-list .list-item .info .like.liked:hover i,.dynamic-like:hover i,.dynamic-liked i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate i,.dynamic-hate i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate.hated i,.bb-comment .comment-list .list-item .info .hate.hated:hover i,.dynamic-hate:hover i,.dynamic-hated i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .operation .spot,.dynamic-spot{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-send .comment-emoji .face,.textarea-container .comm-tool .comm-emoji .icon-face{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item{background-color:#0001;border:none;display:flex;align-items:center;padding:10px 14px}.bb-comment .reply-notice .notice-item .icon-notice{order:0;position:static;margin-right:12px;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item a{order:1;flex-grow:1;color:#000}.bb-comment .reply-notice .notice-item .icon-close-notice{order:2;position:static;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item .icon-close-notice,.bb-comment .reply-notice .notice-item .icon-notice{height:18px;width:18px;opacity:.7}.bb-comment .comment-list .list-item .user .text-con{white-space:pre-wrap;display:block}.bb-comment .comment-list .list-item .text{white-space:pre-wrap}`; +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment.min.css"] = `.comment-list .list-item{position:relative}.bb-comment .comment-list .list-item .info,.dynamic-list-item-wrap .item-detail>.info{display:flex}.bb-comment .comment-list .list-item .info .floor,.dynamic-list-item-wrap .item-detail>.info .floor{order:1}.bb-comment .comment-list .list-item .info .reply,.dynamic-list-item-wrap .item-detail>.info .reply{order:2}.bb-comment .comment-list .list-item .info .operation,.dynamic-list-item-wrap .item-detail>.info .operation{order:3;flex-grow:1;display:flex!important;justify-content:flex-end}.bb-comment .comment-list .list-item>.con>.reply-box{transform:translateX(0)}.bb-comment .comment-list .list-item>.con>.info{margin-top:4px}.bb-comment .comment-list .list-item>.con>.info>.time,.item-detail>.info>.time{position:absolute;right:8px;top:24px;margin:0;line-height:normal;color:#000}.item-detail>.info>.time{top:12px;opacity:1}.reply-box .item-user>a{margin-right:8px}.bb-comment .comment-header .tabs-order li.on:after,.bb-comment .comment-list .list-item .con .vote-container,.bb-comment .comment-list .list-item .user-face .hot-follow,.bb-comment .comment-list .list-item>.con>.info>.plad,.bb-comment .nameplate,.comment-area .dynamic-level,.dynamic-list-item-wrap .info .plat{display:none!important}.bb-comment .comment-list .reply-con{position:relative}.bb-comment .comment-list .reply-con>.info>.time,.dynamic-list-item-wrap .reply-box .time{position:absolute;right:8px;top:0;margin:0;opacity:.5;line-height:normal;color:#000}.dynamic-list-item-wrap .reply-box .time{top:10px;opacity:.7}.bb-comment .comment-list .list-item .user{margin-right:120px}.reply-box .item-user .text{display:block}.bb-comment .comment-list .list-item .user .level{visibility:hidden;width:0;margin:0}.bb-comment .comment-list .list-item .info .hate>*,.bb-comment .comment-list .list-item .info .like>*,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji>*,.dynamic-hate i,.dynamic-like i{transition:.2s ease-out}.bb-comment .comment-list .list-item .info .hate i,.bb-comment .comment-list .list-item .info .like i,.bb-comment .comment-list .list-item .info .operation .spot,.bb-comment .comment-send .comment-emoji .face,.dynamic-hate i,.dynamic-like i,.dynamic-spot,.textarea-container .comm-tool .comm-emoji .icon-face{height:16px!important;width:16px!important;opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-send .comment-emoji span{opacity:.5}.bb-comment .comment-list .list-item .info .hate span,.bb-comment .comment-list .list-item .info .hate.hated span,.bb-comment .comment-list .list-item .info .hate:hover span,.bb-comment .comment-list .list-item .info .like span,.bb-comment .comment-list .list-item .info .like.liked span,.bb-comment .comment-list .list-item .info .like:hover span,.bb-comment .comment-send .comment-emoji span{color:#000}.bb-comment .comment-list .list-item .info .hate:hover>*,.bb-comment .comment-list .list-item .info .like.hated:hover>*,.bb-comment .comment-list .list-item .info .like.hated>*,.bb-comment .comment-list .list-item .info .like.liked:hover>*,.bb-comment .comment-list .list-item .info .like.liked>*,.bb-comment .comment-list .list-item .info .like:hover>*,.bb-comment .comment-list .list-item .info .operation .spot:hover,.bb-comment .comment-send .comment-emoji.open .face,.bb-comment .comment-send .comment-emoji:hover .face,.bb-comment .comment-send .comment-emoji:hover span{opacity:.7}.bb-comment .comment-list .list-item .info .like i,.dynamic-like i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .like.liked i,.bb-comment .comment-list .list-item .info .like.liked:hover i,.dynamic-like:hover i,.dynamic-liked i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate i,.dynamic-hate i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .hate.hated i,.bb-comment .comment-list .list-item .info .hate.hated:hover i,.dynamic-hate:hover i,.dynamic-hated i{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-list .list-item .info .operation .spot,.dynamic-spot{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .comment-send .comment-emoji .face,.textarea-container .comm-tool .comm-emoji .icon-face{background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item{background-color:#0001;border:none;display:flex;align-items:center;padding:10px 14px}.bb-comment .reply-notice .notice-item .icon-notice{order:0;position:static;margin-right:12px;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item a{order:1;flex-grow:1;color:#000}.bb-comment .reply-notice .notice-item .icon-close-notice{order:2;position:static;background:url('data:image/svg+xml;utf-8,')!important}.bb-comment .reply-notice .notice-item .icon-close-notice,.bb-comment .reply-notice .notice-item .icon-notice{height:18px;width:18px;opacity:.7}.bb-comment .comment-list .list-item .user .text-con{white-space:pre-wrap;display:block}.bb-comment .comment-list .list-item .text{white-space:pre-wrap}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/comment.min.js"] = (()=>{return(r,e)=>{}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/compact-layout.min.css"] = `.groom-module{margin:0!important;width:192px!important;height:120px!important}.bangumi-timing-module .card-timing,.groom-module{-webkit-tap-highlight-color:transparent}.chief-recommend-module .recommend-module,.groom-box-m,.nominate-m .video-card-box{height:240px!important}.groom-module .lazy-img,.groom-module .pic{width:100%!important;height:100%!important;transition:.2s}.groom-module:hover .lazy-img,.groom-module:hover .pic{filter:blur(8px)}.groom-module .card-mark{width:calc(100% - 20px)!important;top:88px;padding:10px!important}.groom-module:hover .card-mark{top:0!important}.chief-recommend-module .carousel-box,.chief-recommend-module .carousel-box img{height:240px!important;width:480px!important}.nominate-m .carousel-box,.nominate-m .carousel-box img{height:240px!important;width:672px!important}.live-module .storey-box .card-live-module,.special-module,.storey-box .spread-module,.video-item-biref{margin:0!important;width:192px!important;height:168px!important;-webkit-tap-highlight-color:transparent}.special-module{height:192px!important}.special-module .pic .title{line-height:unset!important;height:auto!important}.special-recommend-module .storey-box{height:180px!important}.special-module .user{transform:translatey(24px)}.live-module .storey-box .card-live-module .pic,.mod-1 .l .spread-module,.mod-2 .spread-module,.mod-2 li .l,.mod-3 .l .spread-module,.mod-3 .l-item .l,.special-module .pic-box,.spread-module .pic,.video-item-biref .biref-img{width:192px!important;height:120px!important}.mod-2 li .l-item{height:auto}.mod-3 .l-item,.mod-3 li{width:192px!important}.mod-3 .l .spread-module{margin:0!important}.mod-1 .r,.mod-1 li,.mod-2 li .l-item,.mod-3 li{padding:0!important}.mod-3 .r .title,.mod-3 .r .up-info,.mod-3 .r .v-info{padding-top:4px!important;margin-top:0!important}.mod-2 li .r .v-desc{padding:0!important;margin:10px 0!important}.live-module .storey-box .card-live-module .num,.spread-module .num{padding-left:8px;padding-right:8px;bottom:6px}.live-module .storey-box .card-live-module .t,.special-module .pic .title,.spread-module .t,.video-item-biref .biref-info .biref-title{padding-left:4px;padding-right:4px;padding-top:4px}.sec-rank .rank-list-wrap .rank-list{min-height:288px}.hot-recom-module{height:auto!important}.game-groom-box-m,.game-groom-box-m .game-groom-m{height:100%!important}.card-live-module .pic .mask,.carousel-box .carousel-module .panel,.carousel-wrapper,.game-groom-box-m .game-groom-m,.groom-module,.live-module .storey-box .card-live-module .pic,.mod-3 .l-item,.special-module .pic-box,.spread-module .pic,.video-item-biref .biref-img{border-radius:0!important}.card-timing-module .pic,.rank-list .rank-item .ri-num,.timeline-box .timeline-item .preview,.timeline-box .timeline-item .preview img{border-radius:50%!important}.cover-preview-module .cover{width:160px;transform-origin:left top 0;transform:scale(1.3)}.bangumi-timing-module .card-timing{width:205px}.card-timing-module .r-text{width:120px}.recommend-module .rec-btn.prev{left:0!important}.primary-menu{display:flex;align-items:center;margin:0;width:100%}.primary-menu .nav-menu{flex:1 0 auto;display:flex;justify-content:space-between;align-items:center;margin-right:28px}.primary-menu .nav-menu>li .num-wrap span{padding:2.5px;line-height:unset;height:auto;min-width:30px}.primary-menu .nav-menu .side-nav .side-link i.blackroom,.primary-menu .nav-menu .side-nav .side-link i.live,.primary-menu .nav-menu .side-nav .side-link i.square,.primary-menu .nav-menu .side-nav .side-link i.zhuanlan,.primary-menu .nav-menu>li.home>a{background-size:contain;background-repeat:no-repeat;background-position:initial}.primary-menu .nav-menu>li .num-wrap{top:0;position:static;height:auto}.primary-menu .nav-menu li .nav-name{line-height:unset;height:auto}.primary-menu .nav-menu>li:not(.home) .nav-name{height:auto;padding:0}.nav-gif{position:static;flex:0 0 auto}.primary-menu .nav-menu li.home>a .nav-name{visibility:hidden;display:block;position:static}.primary-menu .nav-menu .sub-nav{top:36px;padding-top:4px}@media screen and (min-width:1300px){.bili-wrapper,.cinema-home-wrapper{width:1248px!important}.block-area .block-left{width:960px!important}.timeline-box .timeline-item{padding-right:32px!important}.elevator-module{margin-left:630px!important}.bili-wrapper .l-con{width:988px!important}.bangumi-timing-module .card-timing{padding:36px 30px 0 0}.bangumi-timing-module .card-timing:nth-child(4):nth-child(4){padding-top:0}.mod-1 li .r{width:750px!important}.mod-2 li .r{width:245px!important}.mod-2 li .r .up-info .v-author,.mod-2 li .r .v-info .v-info-i{width:70px!important}.bangumi-timing-module .headline .bili-tab{width:700px;display:flex;justify-content:space-evenly}}@media screen and (max-width:1300px){.bili-wrapper,.cinema-home-wrapper{width:1056px!important}.block-area .block-left{width:768px!important}.elevator-module{margin-left:540px!important}.bili-wrapper .l-con{width:768px!important}.bangumi-timing-module .card-timing{padding:36px 36px 0 0}#ranking_guochuang{width:260px!important;transform:translatex(28px)}.mod-1 li .r{width:530px!important}.mod-2 li .r{width:160px!important}.mod-2 li .r .up-info .v-author,.mod-2 li .r .v-info .v-info-i{width:50px!important}}.article-card .article-info{width:304px!important}.article-card .article-cover,.article-card .article-cover img{width:116px!important;height:87px!important;border-radius:0!important}.article-card{margin-bottom:0!important}.article-card .article-info .data>.comment,.article-card .article-info .data>.view{display:inline-flex!important;align-items:center!important}.article-card .article-info .data{display:flex!important;align-items:center!important}@media screen and (max-width:1300px){.article-card .article-info{width:220px!important}}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/compact-layout.min.js"] = (()=>{return(t,i)=>{const c=["https://www.bilibili.com/","https://www.bilibili.com/watchlater/#/list"];if(c.indexOf(location.href.replace(location.search,""))!==-1){document.documentElement.classList.add("compact")}}})(); @@ -927,7 +927,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/i18n.min.js"] = (()=>{return(e,t)=>{const a={"日本語":"ja-JP",English:"en-US",Deutsch:"de-DE"};class r{accepts(e){return e.nodeType===Node.ELEMENT_NODE}getValue(e){return e.nodeValue}setValue(e,t){e.nodeValue=t}getElement(e){return e}translate(e){const t=this.getValue(e);if(!t||typeof t!=="string"||t==="*"){return}const a=r.map.get(t.trim());if(a===undefined){return}if(typeof a==="string"){this.setValue(e,a)}else if(Array.isArray(a)){let t=null;for(const r of a){if(typeof r==="string"){t=r}else{const{text:a,selector:s,not:l}=r;if(this.getElement(e).matches(s)!==Boolean(l)){t=a}}}if(t!==null){this.setValue(e,t)}}else{const{text:t,selector:r,not:s}=a;if(this.getElement(e).matches(r)!==Boolean(s)){this.setValue(e,t)}}}static walk(e,t){const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,null,false);let r=a.nextNode();while(r){t(r);r=a.nextNode()}}static translate(e){if(e.nodeType===Node.TEXT_NODE){r.textNode.translate(e);return}r.walk(e,e=>{for(const t of r.allTranslators){if(t.accepts(e)){t.translate(e)}}})}static translateCssMatches(){const e=r.map.get("*");if(!e){return}for(const{selector:t,text:a}of e){const e=document.querySelector(t);if(e){[...e.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).forEach(e=>e.nodeValue=a)}}}}class s extends r{accepts(e){return e.nodeType===Node.TEXT_NODE}getElement(e){return e.parentElement}}class l extends r{getValue(e){return e.getAttribute("title")}setValue(e,t){e.setAttribute("title",t)}}class n extends r{getValue(e){return e.getAttribute("placeholder")}setValue(e,t){e.setAttribute("placeholder",t)}}r.textNode=new s;r.title=new l;r.placeholder=new n;r.allTranslators=[r.textNode,r.title,r.placeholder];(async()=>{const{map:s}=await t.importAsync(`i18n.${a[e.i18nLanguage]}`);r.map=s;r.translate(document.body);r.translateCssMatches();Observer.observe("body",e=>{e.forEach(e=>{if(e.type==="childList"){if(e.addedNodes.length>0){r.translateCssMatches()}e.addedNodes.forEach(e=>{r.translate(e)})}else if(e.type==="characterData"){r.textNode.translate(e.target)}})},{characterData:true,childList:true,subtree:true})})();return{export:{Translator:r,TextNodeTranslator:s,TitleTranslator:l,PlaceholderTranslator:n}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/i18n.zh-TW.min.js"] = (()=>{return(r,e)=>{const n=new Map([[`主站`,`主站`],[`画友`,`絵画`],[`音频`,`音樂`],[`游戏中心`,`遊戲`],[`会员购`,`購物`],[`漫画`,`漫畫`],[`下载APP`,`下載APP`],[`大会员`,`大會員`],[`动态`,`動態`],[`稍后再看`,`稍後再看`],[`历史`,`歷史`],[`番剧`,`番劇`],[`动画`,`動畫`],[`国创`,`國創`],[`音乐`,`音樂`],[`游戏`,`遊戲`],[`数码`,`數位`],[`电影`,`電影`],[`纪录片`,`紀錄片`],[`时尚`,`時尚`],[`娱乐`,`娛樂`],[`广告`,`廣告`],[`原创`,`原創`],[`广场`,`廣場`],[`发布`,`發佈`],[`专栏`,`專欄`],[`关注`,`關注`],[`粉丝`,`粉絲`],[`热门`,`熱門`],[`视频`,`影片`],[`图片`,`圖片`],[`小视频`,`短影片`],[`公告栏`,`公告欄`],[`特别推荐`,`特別推薦`],[`有新动态`,`有新動態`],[`所有关注`,`所有關注`],[`首页`,`首頁`],[`编辑`,`編輯`],[`回复`,`回覆`],[`举报`,`舉報`],[`在线人数`,`在線人數`],[`*`,[]]]);return{export:{map:n}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/icons.min.css"] = `.icons-enabled [class^=icon-]{width:24px;height:24px;display:inline-block;background-image:none}.icons-enabled [class^=icon-]::after{content:"";width:24px;height:24px;display:inline-block}.icons-enabled .icon-view::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-clear::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-download::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-update::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-info::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-settings::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-widgets::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-cancel::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-ok::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-video::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-style::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-tool::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-touch::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-other::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-arrow::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-rank::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-like::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-danmaku::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-search::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu>li.home>a,.icons-enabled .icon-home::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.zhuanlan,.icons-enabled .icon-read::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.square,.icons-enabled .icon-square::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.live,.icons-enabled .icon-live::after{background-image:url('data:image/svg+xml;utf-8,')}.compact .primary-menu .nav-menu .side-nav .side-link i.blackroom,.icons-enabled .icon-judge::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-medal::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-live-title::after{background-image:url('data:image/svg+xml;utf-8,')}.icons-enabled .icon-biliplus::after{background-image:url('data:image/svg+xml;utf-8,')}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-resolution.min.js"] = (()=>{return(t,e)=>{const r=/@(\d+)[Ww]_(\d+)[Hh]/;const i=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseInt(t.imageResolutionScale);const o=["#certify-img1","#certify-img2"];const n=[".jpg",".png",".gif",".webp"];function s(t){const e=()=>{if(o.some(e=>t.matches(e))){return}if(!n.some(e=>t.src.endsWith(e))){return}const e=t.src.match(r);if(!e){return}let[,s,c]=e;let u=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(s)>=u&&u!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",s)}s=(i*parseInt(s)).toString();c=(i*parseInt(c)).toString();t.setAttribute("data-resolution-width",s);t.src=t.src.replace(r,`@${s}w_${c}h`)};Observer.observe(t,()=>{e()},{attributeFilter:["src"],attributes:true})}document.querySelectorAll("img").forEach(t=>s(t));Observer.childListSubtree(document.body,t=>{for(const e of t){for(const t of e.addedNodes){if(t.nodeName.toLowerCase()==="img"){s(t)}else if(t instanceof Element){t.querySelectorAll("img").forEach(t=>s(t))}}}});return{export:{imageResolution:s}}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-resolution.min.js"] = (()=>{return(t,e)=>{const r=/@(\d+)[Ww]_(\d+)[Hh]/;const n=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseInt(t.imageResolutionScale);const o=["#certify-img1","#certify-img2"];const i=[".jpg",".png",".gif",".webp"];const s=(t,e)=>{const r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null,false);let n=r.nextNode();while(n){e(n);n=r.nextNode()}};async function a(t){const e=(e,i)=>{const s=e(t);if(s===null){return}if(o.some(e=>t.matches(e))){return}const a=s.match(r);if(!a){return}let[,u,c]=a;let l=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(u)>=l&&l!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",u)}u=(n*parseInt(u)).toString();c=(n*parseInt(c)).toString();t.setAttribute("data-resolution-width",u);i(t,s.replace(r,`@${u}w_${c}h`))};Observer.observe(t,()=>{e(t=>t.getAttribute("src"),(t,e)=>t.setAttribute("src",e));e(t=>t.style.backgroundImage,(t,e)=>t.style.backgroundImage=e)},{attributeFilter:["src","style"],attributes:true})}s(document.body,t=>a(t));Observer.childListSubtree(document.body,t=>{for(const e of t){for(const t of e.addedNodes){if(t instanceof HTMLElement){a(t);if(t.nodeName.toUpperCase()!=="IMG"){s(t,t=>a(t))}}}}});return{export:{imageResolution:a}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-viewer.min.css"] = `body.image-viewer-opened,html.image-viewer-opened{overflow:hidden!important}.image-viewer-container{background:rgba(0,0,0,.85);width:100%;height:100%;position:fixed;top:0;left:0;z-index:100000;display:none;justify-content:center;align-items:center}.image-viewer-container.opened{display:flex}.image-viewer{width:90%;height:90%;display:grid;grid-template-columns:auto 48px;grid-template-rows:48px auto 48px 12px 48px 18px 48px;grid-template-areas:"image close" "image ." "image copy-link" "image ." "image new-tab" "image ." "image download";grid-column-gap:12px;justify-items:center;justify-content:stretch;align-items:center;align-content:stretch}.image-viewer .image{grid-area:image;width:auto;height:auto;max-width:100%;max-height:100%}.image-viewer .close{grid-area:close}.image-viewer .download{grid-area:download}.image-viewer .copy-link{grid-area:copy-link;transform:scale(.95)}.image-viewer .new-tab{grid-area:new-tab;transform:scale(.85)}.image-viewer-icon{cursor:pointer;width:100%;height:100%}.image-viewer-icon svg{max-width:48px;max-height:48px}.image-viewer-icon path{fill:#eee;transition:.2s;transform-origin:center}.image-viewer-icon:hover path{fill:var(--theme-color);transform:scale(1.1)}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-viewer.min.html"] = ``; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/medal-helper.min.css"] = `.medal-popup{position:absolute;top:calc(100% + 2px);transition:.16s ease-out;transform-origin:top;transform:scaleY(0) translateX(-50%);left:50%;background:#fff;box-shadow:0 3px 20px 2px #0004;z-index:100}.medal-popup.opened{transform:scaleY(1) translateX(-50%)}.medal-popup *{transition:.2s}.medal-popup ul{list-style:none;margin:0;padding:0}.medal-popup ul>li.active{box-shadow:0 0 4px 0 var(--theme-color)}.medal-popup ul>li:hover{background-color:rgba(0,0,0,.16)}.medal-popup label{display:flex;align-items:center;justify-content:center;cursor:pointer;padding:8px}.medal-popup label>*{flex-shrink:0}.medal-popup input[type=radio]{visibility:collapse;width:0;margin:0;padding:0}.medal-popup input[type=radio]~i{opacity:0;transform:scale(.8);margin:0}.medal-popup input[type=radio]~.fans-medal-item{margin:0 8px}.medal-popup input[type=radio]:checked~i{opacity:1}.title-image{display:inline-block;vertical-align:middle;height:20px}.fans-medal-item .label{width:40px;text-align:center;padding:0 2px;color:#fff}.fans-medal-item .level{width:16px;background-color:#fff;text-align:center;color:#61decb}.fans-medal-item .label,.fans-medal-item .level{position:relative;display:block;float:left}.fans-medal-item{display:inline-block;height:14px;line-height:14px;color:#fff;border:1px solid #61decb;border-left:0;white-space:nowrap;border-radius:2px;flex-shrink:0;font-size:12px}.level-1,.level-2,.level-3,.level-4{border-color:#61decb}.level-1 .label,.level-2 .label,.level-3 .label,.level-4 .label{background-color:#61decb}.level-1 .level,.level-2 .level,.level-3 .level,.level-4 .level{color:#61decb}.level-5,.level-6,.level-7,.level-8{border-color:#5896de}.level-5 .label,.level-6 .label,.level-7 .label,.level-8 .label{background-color:#5896de}.level-5 .level,.level-6 .level,.level-7 .level,.level-8 .level{color:#5896de}.level-10,.level-11,.level-12,.level-9{border-color:#a068f1}.level-10 .label,.level-11 .label,.level-12 .label,.level-9 .label{background-color:#a068f1}.level-10 .level,.level-11 .level,.level-12 .level,.level-9 .level{color:#a068f1}.level-13,.level-14,.level-15,.level-16{border-color:#ff86b2}.level-13 .label,.level-14 .label,.level-15 .label,.level-16 .label{background-color:#ff86b2}.level-13 .level,.level-14 .level,.level-15 .level,.level-16 .level{color:#ff86b2}.level-17,.level-18,.level-19,.level-20{border-color:#f6be18}.level-17 .label,.level-18 .label,.level-19 .label,.level-20 .label{background-color:#f6be18}.level-17 .level,.level-18 .level,.level-19 .level,.level-20 .level{color:#f6be18}`; diff --git a/min/image-resolution.min.js b/min/image-resolution.min.js index e03806f72..ae7f0a2a0 100644 --- a/min/image-resolution.min.js +++ b/min/image-resolution.min.js @@ -1 +1 @@ -(()=>{return(t,e)=>{const r=/@(\d+)[Ww]_(\d+)[Hh]/;const i=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseInt(t.imageResolutionScale);const o=["#certify-img1","#certify-img2"];const n=[".jpg",".png",".gif",".webp"];function s(t){const e=()=>{if(o.some(e=>t.matches(e))){return}if(!n.some(e=>t.src.endsWith(e))){return}const e=t.src.match(r);if(!e){return}let[,s,c]=e;let u=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(s)>=u&&u!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",s)}s=(i*parseInt(s)).toString();c=(i*parseInt(c)).toString();t.setAttribute("data-resolution-width",s);t.src=t.src.replace(r,`@${s}w_${c}h`)};Observer.observe(t,()=>{e()},{attributeFilter:["src"],attributes:true})}document.querySelectorAll("img").forEach(t=>s(t));Observer.childListSubtree(document.body,t=>{for(const e of t){for(const t of e.addedNodes){if(t.nodeName.toLowerCase()==="img"){s(t)}else if(t instanceof Element){t.querySelectorAll("img").forEach(t=>s(t))}}}});return{export:{imageResolution:s}}}})(); \ No newline at end of file +(()=>{return(t,e)=>{const r=/@(\d+)[Ww]_(\d+)[Hh]/;const n=t.imageResolutionScale==="auto"?window.devicePixelRatio:parseInt(t.imageResolutionScale);const o=["#certify-img1","#certify-img2"];const i=[".jpg",".png",".gif",".webp"];const s=(t,e)=>{const r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null,false);let n=r.nextNode();while(n){e(n);n=r.nextNode()}};async function a(t){const e=(e,i)=>{const s=e(t);if(s===null){return}if(o.some(e=>t.matches(e))){return}const a=s.match(r);if(!a){return}let[,u,c]=a;let l=parseInt(t.getAttribute("data-resolution-width")||"0");if(parseInt(u)>=l&&l!==0){return}if(t.getAttribute("width")===null&&t.getAttribute("height")===null){t.setAttribute("width",u)}u=(n*parseInt(u)).toString();c=(n*parseInt(c)).toString();t.setAttribute("data-resolution-width",u);i(t,s.replace(r,`@${u}w_${c}h`))};Observer.observe(t,()=>{e(t=>t.getAttribute("src"),(t,e)=>t.setAttribute("src",e));e(t=>t.style.backgroundImage,(t,e)=>t.style.backgroundImage=e)},{attributeFilter:["src","style"],attributes:true})}s(document.body,t=>a(t));Observer.childListSubtree(document.body,t=>{for(const e of t){for(const t of e.addedNodes){if(t instanceof HTMLElement){a(t);if(t.nodeName.toUpperCase()!=="IMG"){s(t,t=>a(t))}}}}});return{export:{imageResolution:a}}}})(); \ No newline at end of file diff --git a/utils/image-resolution.js b/utils/image-resolution.js index c22668338..17a4c3f02 100644 --- a/utils/image-resolution.js +++ b/utils/image-resolution.js @@ -10,15 +10,28 @@ const imageFormats = [ ".gif", ".webp" ]; -export function imageResolution(element) { - const replaceSource = () => { +const walk = (rootElement, action) => { + const walker = document.createTreeWalker(rootElement, NodeFilter.SHOW_ELEMENT, null, false); + let node = walker.nextNode(); + while (node) { + action(node); + node = walker.nextNode(); + } +}; +export async function imageResolution(element) { + const replaceSource = (getValue, setValue) => { + const value = getValue(element); + if (value === null) { + return; + } if (excludeSelectors.some(it => element.matches(it))) { return; } - if (!imageFormats.some(it => element.src.endsWith(it))) { - return; - } - const match = element.src.match(regex); + // if (!imageFormats.some(it => value.endsWith(it))) + // { + // return; + // } + const match = value.match(regex); if (!match) { return; } @@ -33,21 +46,22 @@ export function imageResolution(element) { width = (dpi * parseInt(width)).toString(); height = (dpi * parseInt(height)).toString(); element.setAttribute("data-resolution-width", width); - element.src = element.src.replace(regex, `@${width}w_${height}h`); + setValue(element, value.replace(regex, `@${width}w_${height}h`)); }; Observer.observe(element, () => { - replaceSource(); - }, { attributeFilter: ["src"], attributes: true }); + replaceSource(e => e.getAttribute("src"), (e, v) => e.setAttribute("src", v)); + replaceSource(e => e.style.backgroundImage, (e, v) => e.style.backgroundImage = v); + }, { attributeFilter: ["src", "style"], attributes: true }); } -document.querySelectorAll("img").forEach(it => imageResolution(it)); +walk(document.body, it => imageResolution(it)); Observer.childListSubtree(document.body, records => { for (const record of records) { for (const node of record.addedNodes) { - if (node.nodeName.toLowerCase() === "img") { + if (node instanceof HTMLElement) { imageResolution(node); - } - else if (node instanceof Element) { - node.querySelectorAll("img").forEach(it => imageResolution(it)); + if (node.nodeName.toUpperCase() !== "IMG") { + walk(node, it => imageResolution(it)); + } } } } diff --git a/utils/image-resolution.ts b/utils/image-resolution.ts index 440f31ee7..bd25d4e99 100644 --- a/utils/image-resolution.ts +++ b/utils/image-resolution.ts @@ -10,19 +10,34 @@ const imageFormats = [ ".gif", ".webp" ] -export function imageResolution(element: HTMLImageElement) +const walk = (rootElement: Node, action: (node: HTMLElement) => void) => { - const replaceSource = () => + const walker = document.createTreeWalker(rootElement, NodeFilter.SHOW_ELEMENT, null, false); + let node = walker.nextNode(); + while (node) { + action(node as HTMLElement); + node = walker.nextNode(); + } +} +export async function imageResolution(element: HTMLElement) +{ + const replaceSource = (getValue: (e: HTMLElement) => string | null, setValue: (e: HTMLElement, v: string) => void) => + { + const value = getValue(element); + if (value === null) + { + return; + } if (excludeSelectors.some(it => element.matches(it))) { return; } - if (!imageFormats.some(it => element.src.endsWith(it))) - { - return; - } - const match = element.src.match(regex); + // if (!imageFormats.some(it => value.endsWith(it))) + // { + // return; + // } + const match = value.match(regex); if (!match) { return; @@ -40,28 +55,28 @@ export function imageResolution(element: HTMLImageElement) width = (dpi * parseInt(width)).toString(); height = (dpi * parseInt(height)).toString(); element.setAttribute("data-resolution-width", width); - element.src = element.src.replace(regex, `@${width}w_${height}h`); - + setValue(element, value.replace(regex, `@${width}w_${height}h`)); }; Observer.observe(element, () => { - replaceSource(); - }, { attributeFilter: ["src"], attributes: true }); + replaceSource(e => e.getAttribute("src"), (e, v) => e.setAttribute("src", v)); + replaceSource(e => e.style.backgroundImage, (e, v) => e.style.backgroundImage = v); + }, { attributeFilter: ["src", "style"], attributes: true }); } -document.querySelectorAll("img").forEach(it => imageResolution(it)); +walk(document.body, it => imageResolution(it)); Observer.childListSubtree(document.body, records => { for (const record of records) { for (const node of record.addedNodes) { - if (node.nodeName.toLowerCase() === "img") + if (node instanceof HTMLElement) { - imageResolution(node as HTMLImageElement); - } - else if (node instanceof Element) - { - node.querySelectorAll("img").forEach(it => imageResolution(it)); + imageResolution(node); + if (node.nodeName.toUpperCase() !== "IMG") + { + walk(node, it => imageResolution(it)); + } } } }