// ==UserScript== // @name 哔哩哔哩网页视频速度右键菜单 // @namespace http://tampermonkey.net/ // @version 0.3 // @description 在哔哩哔哩网页视频右键菜单中添加视频播放速度选项 // @author beibeibeibei // @match *.bilibili.com/video/* // @match *.bilibili.com/bangumi/play/* // @grant none // @require https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Your code here... var speed_before = ["加速", "加速", "加速","原速", "减速","减速" ]; var speed = ["2.00", "1.50", "1.25","1.00", "0.75","0.50" ]; var speed_display = true; var speed_after = ["★★★★★★", "★★★★★", "★★★★", "★★★", "★★", "★" ]; var $=jQuery.noConflict(); //省得一堆未定义错误 var longClass = "3a4fb3de-e139-4738-864f-acca6bb8b398"; var b_width = 165;//和原来一样宽 var bg_color = "background-color"; var color = ["rgba(255,255,255,0.12)", //鼠标悬停时颜色 "rgba(0,0,0,0)", //未悬停颜色 ]; function isbangumi(){if(location.href.search('bangumi')!==-1){return true;}else{return false;}} function isvideo(){if(location.href.search('video')!==-1){return true;}else{return false;}} function change_speed(videoSpeed){ $("li[data-value='" + videoSpeed + "']").click(); } function s(str){ var speed_index = speed.map(parseFloat).lastIndexOf(parseFloat(str)); var s2 = []; s2[0] = 'id="' + speed_before[speed_index] + str.replace('.',' ') + speed_after[speed_index] + '" class="' + longClass + '"'; s2[1] = '' + speed_before[speed_index] + str + speed_after[speed_index] + ''; s2[2] = parseFloat(str); s2[3] = '[id="' + speed_before[speed_index] + str.replace('.',' ') + speed_after[speed_index] + '"]'; //[id='加速2 0'] if (speed_display === false){ s2[1] = '' + speed_before[speed_index] + speed_after[speed_index] + ''; } return s2; } function add_contextMenu_style(contextMenu_ul, str){ contextMenu_ul.append('