// ==UserScript== // @name:en Userscript Helper for Flat-Style Netease Music Userstyle 适用于网易云音乐扁平风格样式表的辅助用户脚本 // @description:en Provides a better experience for Flat-Style Netease Music Userstyle. 为网易云音乐扁平风格样式表提供更佳的用户体验。 // @name:zh-CN 适用于网易云音乐扁平风格样式表的辅助用户脚本 // @description:zh-CN 为网易云音乐扁平风格样式表提供更佳的用户体验。 // @name 适用于网易云音乐扁平风格样式表的辅助用户脚本 // @description 为网易云音乐扁平风格样式表提供更佳的用户体验。 // @namespace wTonyChen.flatnmusich // @version 0.1.5-0.7.12 // @author wTonyChen (https://wtonychen.github.io) // @compatible chrome 83+ // @compatible edge 83+ // @compatible opera 67+ // @compatible firefox 78+ // @license Apache-2.0 // @homepage https://wtonychen.github.io/flatnmusic/ // @supportURL https://github.com/wTonyChen/flatnmusic/issues // @match http*://music.163.com/* // @run-at document-end // @grant none // @downloadURL none // ==/UserScript== !(function (e) { var t = {}; function n(l) { if (t[l]) return t[l].exports; var a = (t[l] = { i: l, l: !1, exports: {} }); return e[l].call(a.exports, a, a.exports, n), (a.l = !0), a.exports; } (n.m = e), (n.c = t), (n.d = function (e, t, l) { n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: l }); }), (n.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }); }), (n.t = function (e, t) { if ((1 & t && (e = n(e)), 8 & t)) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var l = Object.create(null); if ( (n.r(l), Object.defineProperty(l, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) ) for (var a in e) n.d( l, a, function (t) { return e[t]; }.bind(null, a) ); return l; }), (n.n = function (e) { var t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return n.d(t, "a", t), t; }), (n.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }), (n.p = ""), n((n.s = 0)); })([ function (e, t) { !(function () { "use strict"; let e = document.querySelector(".wk-fnm-hi-cfg"); e || ((e = document.createElement("div")), (e.className = "wk-fnm-hi-cfg"), document.body.appendChild(e)); let t = getComputedStyle(e), n = (e) => { let n = t.getPropertyValue("--" + e); if (n) try { n && n.indexOf("/") > -1 && (n = decodeURIComponent(n.replace(/\//g, "%"))); } catch (e) {} return ( ((0 === n.indexOf('"') && n.lastIndexOf('"') === n.length - 1) || (0 === n.indexOf("'") && n.lastIndexOf("'") === n.length - 1)) && (n = n.substr(1, n.length - 2)), n ); }, l = (e) => { let t = void 0; return window.localStorage && (t = localStorage.getItem(e)), t; }, a = n("wkhi-a"), r = n("wkhi-b"); if (!r) return void e.parentElement.removeChild(e); document.documentElement.setAttribute("wk-style-assist", "true"); let o = l("wkoptin") || !1, s = function () { let e = arguments[0]; for (let t = 1; t < arguments.length; t++) { let n = RegExp("\\{" + t + "\\}", "g"); e = e.replace(n, arguments[t]); } return e; }; o && ((DocumentFragment.prototype.appendChildHost = DocumentFragment.prototype.appendChild), (DocumentFragment.prototype.appendChild = function () { "g_playlist" == arguments[0].id ? arguments[0].classList.add("hidden") : this.appendChildHost.call(this, ...arguments); }), (Element.prototype.appendChildHost = Element.prototype.appendChild), (Element.prototype.appendChild = function () { "g_playlist" == arguments[0].id && arguments[0].classList.remove("hidden"), this.appendChildHost.call(this, ...arguments); })), l("wksfullpl") && ((e) => { let t = n("wkhi-c"), l = n("wkhi-d"); if (!t || !l) return; (t = t.split("|")), (l = l.split("|")); for (let e = 0; e < t.length; e++) for (let n = 0; n < l.length; n++) (a = t[e]), (r = l[n]), (document.cookie = `${a};path=${r};max-age=3153600000`); var a, r; })(); let i = (e) => { if ( (l("wkshiresimages") && ((e) => { let t = document.querySelectorAll("img[data-src]"); for (let e = 0; e < t; e++) t[e].dataset.src && "" == t[e].src && (t[e].src = t[e].dataset.src); let n = window.document.images; for (let e = 0; e < n.length; e++) { let t = n[e].src.split("?")[0]; if (n[e].src != t) { let l = new Image(), a = (r) => { n[e] && (n[e].src.split("?")[0] == t && ((n[e].src = t), n[e].classList.add("wk-hires-loaded")), l.removeEventListener("load", a, !1)); }; l.addEventListener("load", a, !1), n[e].classList.remove("wk-hires-loaded"), (l.src = t); } } })(), l("wksimprovedlook")) ) { if (0 == location.pathname.indexOf("/user/")) { let e = document.querySelector(".m-proifo dt img"), t = document.querySelector(".g-bd"); e && e.src && t && (document.documentElement.classList.add("has-upb"), (t.style.cssText = `--upb:url("${e.src}")`)); let n = document.querySelector(".m-proifo .name .tit"), l = document.querySelector(".m-proifo .name #j-name-wrap"); n && l && ((l.dataset.wkUsernameFull = l.title = n.innerText), l.classList.add("wk-full-username")); } let e = document.querySelector(".g-wrap>.m-info .cover img"), t = document.querySelector(".g-wrap>.m-info"); e && t && (document.documentElement.classList.add("has-mib"), (t.style.cssText = `--mib:url("${e.src}")`)); } if (l("wksmusicsessionmeta") && "mediaSession" in navigator) { let e = document.querySelector(".m-playbar .words .name"), t = document.querySelector(".m-playbar .words .by"), n = document.querySelector(".m-playbar .head img"), l = [], a = document.querySelector(".m-playbar .btns .prv"), r = document.querySelector(".m-playbar .btns .ply"), o = document.querySelector(".m-playbar .btns .nxt"); n && n.src && l.push([{ src: n.src.split("?")[0] }]), (navigator.mediaSession.metadata = new MediaMetadata({ title: e ? e.innerText : document.title, artist: e ? t.innerText : "", artwork: l, })), navigator.mediaSession.setActionHandler( "play", (e) => !!r && r.click() ), navigator.mediaSession.setActionHandler( "pause", (e) => !!r && r.click() ), navigator.mediaSession.setActionHandler( "previoustrack", (e) => !!a && a.click() ), navigator.mediaSession.setActionHandler( "nexttrack", (e) => !!o && o.click() ); } }; i(), window.setInterval(i, 2e3); r && (function () { if ("/user/update" == location.pathname) { let e = (e) => { let t = document.querySelector("#baseBox"); if (t) { let e = `