Last active
February 7, 2021 12:12
-
-
Save nb5p/34375562bbdd37b48b52c8778943feeb to your computer and use it in GitHub Desktop.
百度网盘播放器增强
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name 百度网盘播放器增强 | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.5 | |
| // @description 播放器增强 | |
| // @author nb5p | |
| // @grant none | |
| // @match *://*.pan.baidu.com/* | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| window.onload = function () { | |
| var btn_only_video = document.createElement("li"); | |
| var btn_only_video_node = document.createTextNode("Only Video"); | |
| btn_only_video.id = 'Only_Video_li'; | |
| btn_only_video.className = 'Only_Video_li_class'; | |
| btn_only_video.appendChild(btn_only_video_node); | |
| var setpoint = document.getElementsByClassName("tips-ul")[0]; | |
| setpoint.appendChild(btn_only_video); | |
| // 倍速播放标签 | |
| var quick_ddiv = "<div><font color='#238E23' size=3>倍速选择:</font><select class='select_class_name'><option value=1 id ='select_option_1id' class='select_option_1'>1</option><option value=1.25 id ='select_option_1id' class='select_option_125'>1.25</option><option value=1.5 id ='select_option_1id' class='select_option_1'>1.5</option><option value=2 class='select_option_2'>2</option><option value=2.6 class='select_option_25'>2.6</option><option value=3 class='select_option_3'>3</option><option value=4 class='select_option_4'>4</option></select></div>"; | |
| // 增加倍速播放按键vjs-control-bar | |
| $(".video-title").append(quick_ddiv); | |
| $(".select_class_name").change(function () { | |
| // 获取下拉框选中项的value属性值 | |
| window.videojs.getPlayers("video-player").html5player.tech_.setPlaybackRate($(this).val()); | |
| }); | |
| setTimeout(function () { | |
| $(".video-title-right").remove(); // 右上角客户端下载提示 | |
| $(".app-download").remove(); // 右上角app下载提醒 | |
| $(".video-title-right").remove(); // 视频上边角广告 | |
| $(".dis-footer").remove(); // 尾部广告的剔除 | |
| $(".top-right-box").remove(); // 开通会员广告 | |
| $(".gOIbzPb").remove(); // 好书推荐广告 | |
| }, 500); | |
| $(".Only_Video_li_class").click(function () { | |
| if ($(".other-video-box").is(':hidden')) { | |
| $(".video-toolbar-buttonbox").show(); // 视频下部菜单栏 | |
| $(".other-video-box").show(); // 视频下部菜单栏 | |
| $(".Only_Video_li_class").text("Only Video"); | |
| $(".video-toolbar").remove(); | |
| } else { | |
| $(".module-header-wrapper").hide(); // 顶部菜单栏 | |
| $(".video-toolbar-buttonbox").hide(); // 视频下部菜单栏 | |
| $(".other-video-box").hide(); // 视频下部菜单栏 | |
| $(".Only_Video_li_class").text("Other"); | |
| } | |
| }); | |
| $(".video-item").click(function () { | |
| $(".select_class_name").val("1"); | |
| }); | |
| } // window.onload = function | |
| $(document).keydown(function (event) { | |
| console.log("Key: " + event.keyCode); | |
| if (event.keyCode === 97) { | |
| return false; | |
| } | |
| else if (event.keyCode === 98) { | |
| return false; | |
| } else if (event.keyCode === 99) { | |
| window.videojs.getPlayers("video-player").html5player.tech_.setPlaybackRate(3); | |
| return false; | |
| } | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment