Greasy Fork is available in English.
B站直播分区按看过排序,两种模式
// ==UserScript==// @name B站直播分区按看过排序// @namespace http://tampermonkey.net/// @version 0.2// @description B站直播分区按看过排序,两种模式// @author MianJu// @match https://live.bilibili.com/p/eden/area-tags?*// @grant none// ==/UserScript==(function() {'use strict';function order() {function sleep (time) {return new Promise((resolve) => setTimeout(resolve, time));}try {var vue = document.querySelector('#area-tag-list').__vue__var data = vue.listDatadata.sort((a,b)=>{return b.watchedShow.num - a.watchedShow.num})} catch(e) {sleep(100).then(order)}}function button() {var btn = document.createElement('button')btn.style = 'width:50px;position:fixed;top:300px;left:0px;z-index:######;opacity:0.4'btn.innerHTML = "排序";btn.onclick = orderdocument.body.appendChild(btn)}function hook() {const xhrOpen = XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open = function() {const xhr = this;if (arguments[1].indexOf('api.live.bilibili.com/xlive/web-interface/v1/second/getList') > -1) {const getter = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, 'response').get;Object.defineProperty(xhr, 'responseText', {get: () => {let r###lt = getter.call(xhr);let data = JSON.parse(r###lt)data.data.list.sort((a,b)=>{return b.watched_show.num - a.watched_show.num})r###lt = JSON.stringify(data)return r###lt;}});}return xhrOpen.apply(xhr, arguments);};}hook()button()order()})();