您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
在b站首页刷一刷按钮上添加上一个下一个按钮以此来回到上一个想看的视频
// ==UserScript== // @name bilibili 首页刷新可选择上一个 // @namespace https://fybgame.top/ // @version 1.01 // @description 在b站首页刷一刷按钮上添加上一个下一个按钮以此来回到上一个想看的视频 // @author fyb // @match https://www.bilibili.com/ // @match https://www.bilibili.com/?* // @grant none // @license MIT // ==/UserScript== (function() { window.onload = function (){ let videoArray = [] let videos = document.getElementsByClassName('feed-card'); let itemArray = [] for(let i = 0 ; i < videos.length ; i ++){ itemArray.push(videos[i].cloneNode(true)) } videoArray.push(itemArray) let nowIndex = 0 let toAppendLast = document.createElement("BUTTON"); let spanTextLast = document.createElement("span"); spanTextLast.innerHTML = '上一个'; toAppendLast.addEventListener("click", function () { if(nowIndex != 0){ nowIndex -- ; nowCountText.innerHTML = (nowIndex+1)+'/'+videoArray.length for(let i = 0 ; i < videos.length ; i ++){ videos[i].innerHTML = videoArray[nowIndex][i].innerHTML; } } }) toAppendLast.className = 'primary-btn roll-btn'; toAppendLast.style.marginBottom = "8px" toAppendLast.appendChild(spanTextLast); let toAppendNext = document.createElement("BUTTON"); let spanTextNext = document.createElement("span"); spanTextNext.innerHTML = '下一个'; toAppendNext.addEventListener("click", function () { if(nowIndex < videoArray.length -1){ nowIndex ++ ; nowCountText.innerHTML = (nowIndex+1)+'/'+videoArray.length for(let i = 0 ; i < videos.length ; i ++){ videos[i].innerHTML = videoArray[nowIndex][i].innerHTML; } } }) toAppendNext.className = 'primary-btn roll-btn'; toAppendNext.style.marginBottom = "8px" toAppendNext.appendChild(spanTextNext); var nowCount = document.createElement("BUTTON"); var nowCountText = document.createElement("span"); nowCountText.innerHTML = '1/1'; nowCount.className = 'primary-btn roll-btn'; nowCount.style.marginBottom = "8px" nowCount.appendChild(nowCountText); let c = document.getElementsByClassName('feed-roll-btn')[0]; c.children[0].removeChild(c.children[0].children[0]); c.children[0].children[0].innerHTML = '刷新下'; c.children[0].addEventListener("click", function () { setTimeout(function (){ let itemArray = [] for(let i = 0 ; i < videos.length ; i ++){ itemArray.push(videos[i].cloneNode(true)) } videoArray.push(itemArray) nowIndex = videoArray.length-1; nowCountText.innerHTML = (nowIndex+1)+'/'+videoArray.length },500) }) c.insertBefore(toAppendNext,c.children[0]) c.insertBefore(nowCount,c.children[0]) c.insertBefore(toAppendLast,c.children[0]) } })();