Greasy Fork

Greasy Fork is available in English.

适用于网易云音乐扁平风格样式表的辅助用户脚本

为网易云音乐扁平风格样式表提供更佳的用户体验。

当前为 2020-07-20 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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.0.23-0.6.0
// @author wTonyChen
// @compatible chrome 推荐 83+ 版本
// @compatible edge 推荐 83+ 版本
// @compatible opera 推荐 67+ 版本
// @compatible firefox 推荐 78+ 版本
// @license Apache-2.0
// @homepage https://github.com/wTonyChen/flatnmusic
// @supportURL https://github.com/wTonyChen/flatnmusic/issues
// @match http*://music.163.com/*
// @run-at document-start
// @grant none
// ==/UserScript==

(function () {
	"use strict";
	document.documentElement.setAttribute("wk-style-assist", "true");
	let mainEvent = e => {
		let alt_imgs = document.querySelectorAll("img[data-src]");
		for (let i = 0; i < alt_imgs; i++) {
			if (alt_imgs[i].dataset.src && alt_imgs[i].src == "") alt_imgs[i].src = alt_imgs[i].dataset.src;
		}
		let imgs = window.document.images;
		for (let i = 0; i < imgs.length; i++) {
			let base = imgs[i].src.split("?")[0];
			if (imgs[i].src != base) {
				let a = new Image();
				let l = j => {
					if (!imgs[i]) return;
					if (imgs[i].src.split("?")[0] == base) {
						imgs[i].src = base;
						imgs[i].classList.add("wk-hires-loaded");
					}
					a.removeEventListener("load", l, !1);
				}
				a.addEventListener("load", l, !1);
				imgs[i].classList.remove("wk-hires-loaded");
				a.src = base;
			}
		}
		if (location.pathname.indexOf("/user/") == 0) {
			let user_pic = document.querySelector(".m-proifo dt img"),
				container = document.querySelector(".g-bd");
			if (user_pic && user_pic.src && container)(document.documentElement.classList.add("has-upb"), container.style.cssText = `--upb: url("${user_pic.src}")`);
		}
		let cover_img = document.querySelector(".g-wrap > .m-info .cover img"),
			con = document.querySelector(".g-wrap > .m-info");
		if (cover_img && con)(document.documentElement.classList.add("has-mib"), con.style.cssText = `--mib: url("${cover_img.src}")`);
	}
	mainEvent();
	window.setInterval(mainEvent, 2000);
})();