Greasy Fork is available in English.

My163MusicHelper|网易音乐C+|网易|网易音乐|music.163.com

美化网易音乐的排布,使音乐下载不需要安装app, 在线播放使用更高音质。

Tính đến 10-06-2017. Xem phiên bản mới nhất.

// ==UserScript==
// @id            heawercher@gmail.com
// @name          My163MusicHelper|网易音乐C+|网易|网易音乐|music.163.com
// @namespace     Chang_way_enjoying
// @description   美化网易音乐的排布,使音乐下载不需要安装app, 在线播放使用更高音质。
// @description   网易音乐C+|My163MusicHelper|网易|网易音乐
// @author        Chang
// @connect       imdb.com
// @grant         none
// @require       http://cdn.bootcss.com/jquery/3.2.1/jquery.min.js
// @include       http://music.163.com/
// @match         http://music.163.com/*
// @version       06102017aTg
// @run-at        document-start
// ==/UserScript==
var myScriptStyle = document.createElement("style");
myScriptStyle.innerHTML = "@charset utf-8;.download,a[class='btnl click-flag f-alpha'],a[class='btnr click-flag f-alpha'],#g_backtop,div.g-ft,ul.m-nav.j-tflag>li.lst,#j-music-ad,div.m-multi{display:none}a.btnr.click-flag.f-alpha[hidefocus=true]{right:184px}";
document.getElementsByTagName("head")[0].appendChild(myScriptStyle);
var myScriptInject = document.createElement("script");
    myScriptInject.type = "text/javascript";
    myScriptInject.innerHTML = 'var parseURL; parseURL = function(url) { var a; a = document.createElement(\'a\'); a.href = url; return { source: url, protocol: a.protocol.replace(\':\', \'\'), host: a.hostname, port: a.port, query: a.search, params: (function() { var i, len, ret, s, seg; ret = {}; seg = a.search.replace(/^\?/, \'\').split(\'&\'); len = seg.length; i = 0; s = void 0; while (i < len) { if (!seg[i]) { i++; continue; } s = seg[i].split(\'=\'); ret[s[0]] = s[1]; i++; } return ret; })(), file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, \'\'])[1], hash: a.hash.replace(\'#\', \'\'), path: a.pathname.replace(/^([^\/])/, \'/$1\'), relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, \'\'])[1], segments: a.pathname.replace(/^\//, \'\').split(\'/\') }; };';
    document.getElementsByTagName("head")[0].appendChild(myScriptInject);
var myScriptInject = document.createElement("script");
    myScriptInject.type = "text/javascript";
    myScriptInject.innerHTML = 'var handleXhr; handleXhr = function(xhr) { var appfix, data, filename; if (xhr.url.startsWith(\'/weapi/song/enhance/player/url\')) { data = JSON.parse(xhr.text); console.log(data); if (data.code === 200) { $("#g_player > div.head > a.mask").attr(\'href\', data.data[0].url).attr(\'target\', \'_blank\').attr(\'data-url\', data.data[0].url); filename = $("#g_player > div.play > div.words > a.name").text() + \' - \' + $("#g_player > div.play > div.words > span.by").text(); appfix = data.data[0].url.split(\'.\'); appfix = appfix[appfix.length - 1]; filename = filename + \'.\' + appfix; return $("#g_player > div.head > a.mask").attr(\'download\', filename).attr(\'title\', filename); } } };';
    document.getElementsByTagName("head")[0].appendChild(myScriptInject);
var myScriptInject = document.createElement("script");
    myScriptInject.type = "text/javascript";
    myScriptInject.innerHTML = 'window.myScriptData = {}; !function (ob) { ob.hookAjax = function (funs) { window._ahrealxhr = window._ahrealxhr || XMLHttpRequest; XMLHttpRequest = function () { this.xhr = new window._ahrealxhr; for (var attr in this.xhr) { var type = ""; try { type = typeof this.xhr[attr] } catch (e) { } if (type === "function") { this[attr] = hookfun(attr); } else { Object.defineProperty(this, attr, { get: getFactory(attr), set: setFactory(attr) }) } } }; function getFactory(attr) { return function () { return this.hasOwnProperty(attr + "_") ? this[attr + "_"] : this.xhr[attr]; } } function setFactory(attr) { return function (f) { var xhr = this.xhr; var that = this; if (attr.indexOf("on") != 0) { this[attr + "_"] = f; return; } if (funs[attr]) { xhr[attr] = function () { funs[attr](that) || f.apply(xhr, arguments); } } else { xhr[attr] = f; } } } function hookfun(fun) { return function () { var args = [].slice.call(arguments); if (funs[fun] && funs[fun].call(this, args, this.xhr)) { return; } return this.xhr[fun].apply(this.xhr, args); } } return window._ahrealxhr; }; ob.unHookAjax = function () { if (window._ahrealxhr) XMLHttpRequest = window._ahrealxhr; window._ahrealxhr = undefined; } }(window); hookAjax({ onreadystatechange: function (xhr) { if (xhr.xhr.readyState === xhr.DONE && xhr.xhr.status === 200) { handleXhr({url: xhr.xhr._url, data: xhr.xhr._data, text: xhr.xhr.responseText}) } }, open: function (arg, xhr) { xhr._url = arg[1]; }, send: function (arg, xhr) { if (arg) xhr._data = arg[0]; } });';
    document.getElementsByTagName("head")[0].appendChild(myScriptInject);
if (!document.getElementById("hsgsnn") && document.title.indexOf('网易云音乐') !== -1) {
    var hsgsnn = document.createElement("a");
    hsgsnn.id = "hsgsnn";
    document.getElementsByTagName("html")[0].appendChild(hsgsnn);

    if (location.href.startsWith('http://music.163.com')) {
        $(document).ready(function() {
            var getDoc, getJSON, postDoc;
            getDoc = function(url, meta, callback) {
                GM_xmlhttpRequest({
                    method: 'GET',
                    url: url,
                    headers: {
                        'User-agent': window.navigator.userAgent,
                        'Content-type': null
                    },
                    onload: function(responseDetail) {
                        var doc;
                        doc = '';
                        if (responseDetail.status == 200) {
                            doc = (new DOMParser).parseFromString(responseDetail.responseText, 'text/html');
                            if (doc == undefined) {
                                doc = document.implementation.createHTMLDocument('');
                                doc.querySelector('html').innerHTML = responseText;
                            }
                        }
                        callback(doc, responseDetail, meta);
                    }
                });
            };
            postDoc = function(url, data, meta, callback) {
                GM_xmlhttpRequest({
                    anonymous: true,
                    method: 'POST',
                    url: url,
                    headers: {
                        'User-agent': window.navigator.userAgent,
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    data: data,
                    onload: function(responseDetail) {
                        callback(responseDetail.responseText, responseDetail, meta);
                    }
                });
            };
            getJSON = function(url, callback) {
                GM_xmlhttpRequest({
                    method: 'GET',
                    url: url,
                    headers: {
                        'Accept': 'application/json'
                    },
                    onload: function(response) {
                        if (response.status >= 200 && response.status < 400) {
                            callback(JSON.parse(response.responseText), url);
                        } else {}
                    }
                });
            };
            var checkin;
            checkin = $('a[data-action=checkin] > i');
            if (checkin) {
                checkin.click();
            }
        });
    }

}