// ==UserScript== // @name 配合“百度网盘视频播放尊享 VIP | 解锁视频倍数 | 解锁全部清晰度”(原作者为:Cangshi)使用 // @namespace http://tampermonkey.net/ // @version 0.1.1 // @description 原脚本失效,原作者大大还未更新脚本,但原脚本在老地址可以正常运行,于是用此脚本进行暂时的维护。 // @author Yangzh12 // @include https://pan.baidu.com/play/video* // @include https://pan.baidu.com/pfile/* // @include https://pan.baidu.com/disk/main* // @icon https://www.google.com/s2/favicons?sz=64&domain=baidu.com // @grant none // @downloadURL none // ==/UserScript== var currentUrl = window.location.href; // 替换URL中的pfile为play/video# var newUrl = currentUrl.replace("pfile", "play/video#"); // 跳转到替换后的页面 window.location.href = newUrl; // 创建跳转按钮元素,设置属性和样式 var button = document.createElement("button"); button.style.width = "3cm"; button.style.height = "3cm"; button.style.backgroundColor = "red"; button.style.position = "absolute"; button.style.left = "2cm"; button.style.top = "2cm"; button.innerText = "点击此跳转到超清画质,如果第一次使用本脚本,请自行点击创建组群,否则无法跳转"; // 添加点击事件 button.onclick = function() { // 执行代码 document.querySelector("#video-toolbar > div.video-toolbar-buttonbox > a:nth-child(2) > span > span").click(); setTimeout(function() { document.querySelector("#dialog1 > div.dialog-body > div > div.share-file-body__nav > div.share-file-body__tabs > div.share-file-body__tabs-item.is-friend").click(); setTimeout(function() { document.querySelector("#dialog1 > div.dialog-body > div > div.share-file-body__content > div.share-file-body__friend > div > div.share-file__friend-body > div.share-file__friend-list-container.has-scroll > div.share-file__friend-list-wrapper.has-scroll > div.share-file__friend-list.is-group > div.share-file__friend-list-title").click() setTimeout(function() { document.querySelector("#dialog1 > div.dialog-body > div > div.share-file-body__content > div.share-file-body__friend > div > div.share-file__friend-body > div.share-file__friend-list-container.has-scroll > div.share-file__friend-list-wrapper.has-scroll > div.share-file__friend-list.is-group.is-expand > div.share-file__friend-list-body > div > div:nth-child(1) > div.share-file__friend-list-item-name").click() setTimeout(function() { document.querySelector("#dialog1 > div.dialog-body > div > div.share-file-body__content > div.share-file-body__friend > div > div.share-file__friend-actions > button > span").click() setTimeout(function() { document.querySelector("body > div.module-yun-tip > div > span.tip-msg > a").click() }, 1000); }, 500); }, 50); }, 1000); }, 1000); }; // 添加按钮元素到页面中 document.body.appendChild(button); // 添加新的按钮元素到页面中 var currentUrl = window.location.href; if (currentUrl == "https://pan.baidu.com/disk/main#/im/session?from=mbox") { // 在距离页面左上角2cm的位置添加一个长为3厘米,宽为2厘米的红色的元素按钮,按钮名字为“正在加载中,如果第一次使用本脚本,请自行点击创建组群” var element = document.createElement("button"); element.style.width = "3cm"; element.style.height = "2cm"; element.style.backgroundColor = "red"; element.innerHTML = "正在加载中"; element.style.position = "absolute"; element.style.top = "8cm"; element.style.left = "4cm"; document.body.appendChild(element); } // 定义一个检查元素是否存在的函数 function checkElement() { var element = document.querySelector("body > div.nd-main-layout > div.nd-main-layout__wrapper > div.nd-main-layout__body > div > div.im-contain > div.im-contain__left > div > div.im-l-contain > div.im-l-contain__content > div > div > div > div:nth-child(1) > div:nth-child(2) > div > div.im-list-card__content > div > div.im-list-card__cov--top") if (element) { //获取需要点击的按钮元素 var button = document.getElementById("myButton"); setTimeout(function() { element.click(); }, 1000); // 如果元素出现,则延迟1秒钟后执行点击事件 clearInterval(intervalId); // 如果元素出现,则清除定时器 } } // 设置定时器每隔一段时间检查一次元素是否存在 var intervalId = setInterval(checkElement, 1000); setTimeout(function(){ document.querySelector("body > div.nd-main-layout > div.nd-main-layout__wrapper > div.nd-main-layout__body > div > div.im-contain > div.im-contain__right > div > div > div > span > i").click() }, 8000); setTimeout(function(){ document.querySelector("body > div.nd-main-layout > div.nd-main-layout__wrapper > div.nd-main-layout__body > div > div.u-drawer__wrapper.is-doc > div > div > section > div.im-doclib > div.im-doc-lib > div.im-pan-list.im-pan-list-loading > div > div > div.im-pan-table__body.mouse-choose-list > table > tbody > tr:nth-child(1) > td:nth-child(2) > div > div > a").click() }, 9000);