// ==UserScript== // @name NeteaseMusic UI Unlocker // @namespace https://github.com/nondanee // @version 0.2.1 // @description Simple UI Unblock for Netease cloud music Website // @author nondanee // @match https://music.163.com/* // @grant none // @downloadURL none // ==/UserScript== (() => { const search = (object, pattern) => { let result = null Object.keys(object) .some(key => { if (!object[key]) return else if (typeof object[key] === 'function') { result = String(object[key]).match(pattern) ? [key] : null } else if (typeof object[key] === 'object') { const inner = search(object[key], pattern) result = inner ? [key].concat(inner) : null } return !!result }) return result } const attach = (object, path, property) => { let poiner = object const last = path.pop() path.forEach(key => { if (!(key in poiner)) throw new Error('KeyError') poiner = poiner[key] }) return property ? poiner[last] = property : poiner[last] } if (window.top != window.self) { //in iframe const pathOne = search(window.nej, '\\.dataset;if') const pathTwo = search(window.nm, '\\.copyrightId==') const pathThree = search(window.nm, '\\.privilege;if') const functionOne = attach(window.nej, pathOne) attach(window.nej, pathOne, (z, name) => { if (name == 'copyright' || name == 'resCopyright') return 1 return functionOne(z, name) }) attach(window.nm, pathTwo, () => false) attach(window.nm, pathThree, song => { song.status = 0 if (song.privilege) song.privilege.pl = 320000 return 0 }) Array.from(document.getElementsByClassName('js-dis')) .forEach(element => element.classList.remove('js-dis')) } })()