// ==UserScript== // @name bilibili订阅+ // @namespace http://tampermonkey.net/ // @version 0.2.4 // @description bilibili导航添加订阅按钮以及订阅列表 // @author inkbottle // @match http://*.bilibili.com/* // @grant none // @downloadURL none // ==/UserScript== (function() { /** * 如果您想自定义订阅栏目所在的位置,您可以修改 index 变量来实现这一效果 * index = 2 : 插入“头像”之后 * index = 3 : 插入“消息”之后 * index = 4 : 插入“动态”之后 * index = 5 : 插入“收藏夹”之后 * ... * index = 8 : 投稿 */ var index = 2; // 请勿更改 var mid = getCookie('DedeUserID'); //从cookie获取用户mid var currentPage = 1; //定义当前页面为订阅列表第一页 cssStyleInit(); /*导航栏添加订阅按钮*/ $("ul.menu>li:nth-child("+index+")").after(`
  • 订阅
  • `); /*订阅按钮添加下拉列表*/ $("li#i_menu_sub_btn").append(`
    `); var subscrptionList = $("#subscrptionList"); //获取列表节点 /*获取订阅列表并添加到dom*/ $.getJSON('http://space.bilibili.com/ajax/Bangumi/getList?mid='+mid+'&page='+currentPage, function(data){ var items = []; var newestEpisode = ''; // 最新集 window.pages = data.data.pages; //将总页数保存在全局变量里 $.each( data.data.result, function( key, val ) { newestEpisode = (val.is_finish === 0)? val.newest_ep_index : val.total_count; items.push(`
  • `+val.title+` `+newestEpisode+`
  • `); }); $( "