Greasy Fork

Greasy Fork is available in English.

网易云音乐扁平用户样式辅助脚本

优化样式表用户体验,用于提供样式表无法做到的一些功能。

当前为 2018-06-21 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         网易云音乐扁平用户样式辅助脚本
// @name:en    Userscript Helper for Netease Music Flat Userstyle
// @namespace    undefined
// @version      0.0.1-0.3.5.6
// @description  优化样式表用户体验,用于提供样式表无法做到的一些功能。
// @description:en  Provides a better experience for Netease Music Flat Userstyle.
// @author       wTonyChen
// @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;}
        else {continue;}
    }
    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) imgs[i].src = base;
    }
    if (location.pathname.indexOf("/user/") == 0) {
        let user_pic = document.querySelector(".m-proifo dt img");
        let 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}")`;}
    }
}
window.setInterval(mainEvent, 2000);
})();