您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
为哔哩哔哩稍后再看页面的每个视频缩略图添加一个更大的固定位置按钮,点击跳转到新标签页的视频链接
// ==UserScript== // @name 哔哩哔哩稍后再看重定向到详情页面 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 为哔哩哔哩稍后再看页面的每个视频缩略图添加一个更大的固定位置按钮,点击跳转到新标签页的视频链接 // @match https://www.bilibili.com/watchlater/* // @grant none // ==/UserScript== (function() { 'use strict'; // 添加样式 const style = document.createElement('style'); style.textContent = ` .custom-button { position: absolute; bottom: 10px; right: 10px; padding: 6px 12px; background-color: rgba(0, 161, 214, 0.9); color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: bold; transition: all 0.3s ease; z-index: 10; } .custom-button:hover { background-color: rgba(0, 181, 229, 1); box-shadow: 0 4px 8px rgba(0,0,0,0.2); transform: translateY(-2px); } .custom-button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .av-pic { position: relative; } `; document.head.appendChild(style); function addButtonToItem(item) { const avPic = item.querySelector('.av-pic'); if (avPic && !avPic.querySelector('.custom-button')) { const videoLink = avPic.href; const bvid = videoLink.split('/').pop(); const newVideoLink = `https://www.bilibili.com/video/${bvid}`; const button = document.createElement('button'); button.textContent = '打开视频'; button.className = 'custom-button'; button.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); window.open(newVideoLink, '_blank'); }); avPic.appendChild(button); } } function addButtonsToAllItems() { const listItems = document.querySelectorAll('.av-item'); listItems.forEach(addButtonToItem); } const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.type === 'childList') { addButtonsToAllItems(); } }); }); const config = { childList: true, subtree: true }; observer.observe(document.body, config); addButtonsToAllItems(); })();