// ==UserScript== // @name Bilibili首页添加订阅番剧 // @namespace http://tampermonkey.net/ // @version 1.0 // @description anime is trash, so am I // @author ementt // @match https://www.bilibili.com/ // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; function getCookie(name) { let matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } var xmlhttp = new XMLHttpRequest(); var t_mid = getCookie('DedeUserID') var url = 'https://space.bilibili.com/ajax/Bangumi/getList?mid=' + t_mid; var list = {}; xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { list = JSON.parse(xmlhttp.responseText).data.result var bangumi = document.getElementById('bili_anime'); var bans = '
'; for (var i = 0; i < 9; i++) { var div = ``; bans += div; } bans += '
' var doc = document.createRange().createContextualFragment(`
订阅番剧${bans}
`); bangumi.parentNode.insertBefore(doc, bangumi.nextSibling); } } xmlhttp.open("GET", url, true); xmlhttp.send() })();