// ==UserScript==
// @icon https://nd-static.bdstatic.com/v20-static/static/favicon.ico
// @name 百度云精简
// @namespace taozhiyu.gitee.io
// @version 0.2.6
// @description 删除“复制这段内容后打开百度网盘手机App,操作更方便哦,来自百度会员超级无敌永久svip”,精简部主页广告、邀请,视频添加倍速按钮
// @author 涛之雨
// @match *://pan.baidu.com/disk/*
// @match *://pan.baidu.com/mbox/*
// @match *://pan.baidu.com/play/*
// @match *://yun.baidu.com/disk/*
// @match *://yun.baidu.com/mbox/*
// @match *://yun.baidu.com/play/*
// @match *://pan.baidu.com/s/*
// @match *://yun.baidu.com/s/*
// @grant GM_addStyle
// @grant unsafeWindow
// @home-url http://greasyfork.icu/zh-CN/scripts/422814
// @license GPL-3.0-only
// ==/UserScript==
/**********************************************\
* 小尾巴部分修改自http://greasyfork.icu/zh-CN/scripts/374100
* V 0.2.6
* 新增 + 对于分享页的适配(去广告)
* 新增 + 视频播放页添加倍速按钮(仿原生,贼强)
* 添加 + 遵循协议 GPL-3.0-only
* TODO : 默认永久分享(可自定义1-365天和永久)
* TODO : 自定义分享密码(或公开链接,无密码)
* TODO : 自定义限制分享次数链接
* V 0.2.5
* 新增 + 对于“在线视频”界面的支持
* TODO : 加上倍速播放按钮
* V 0.2.4
* 新增 + 对于“分享”界面的支持
* V 0.2.3
* 删除 - 百度文库相关代码,迁移到新项目
* V 0.2.1
* 新增 + 百度文库大量垃圾、广告删除
* TODO : 正在研究非VIP会员免【广告全屏阅读】
* V 0.1.7
* 修复 + “个人分享”界面“复制这段内容...”移除失败的bug
* 新增 + 删除主界面的部分垃圾(可以自行对比)
* 新增 + 关闭4秒内主动弹出的【设备管理】、【新功能测试】、【在线文档】、【在线解压】、等等。。。窗口
\************************************************/
(function() {
'use strict';
GM_addStyle(`
.hx-right-bottom,
.title-wrap > .join-vip,
.title-wrap > .info,
.hx-bottom-wrapper,
.hx-recom-wrapper,
.app-btn,.hx-warp,
.relative-doc-ad-wrapper,
.qr-wrapper,
.side-doc-tool-wrapper,
.feedback-wrapper,
.vip-pop-wrap,
.red-point,
.wp-side-options,
.module-header-wrapper > dl > dd[node-type='header-union'],
.yike-entrance,
.find-light-icon,
.newIcon,
.app-download,
.app-notice,
.icon-notice,
.icon-feedback,
.app-feedback,
.wp-disk-header__right-item,
.bz-doc-tool-dialog-fix,
.ex-wrapper,
.fixed-activity-bar,
.vip-card-wrap,
.btn-img-tips,
.rights-section,
a[title="举报"],
.vip-activity-content,
.video-title-right-open-mobile,
.tips{
display:none!important;
width:0!important;
overflow:hidden!important;
}
`);
if(location.href.indexOf("baidu.com/disk/")>=0){
let t = " ", e = "text", o = "去除小尾巴失败o(╥﹏╥)o", a = "body", l = "copy",y=true,f=(a)=>{a.style.display="none";a.style.width=0;a.style.overflow="hidden"};
document.querySelector(a).addEventListener(l, function(a) {try {let l = a.target.value;l = l.split(t).filter((t, e) => {if(!!t.match(/手机App|复制这段/))y=false;return y}).join("").replace("提取码"," 提取码"),a.clipboardData.setData(e, l),a.preventDefault(),y=true; } catch (a) { console.log(o);}});
let id=setInterval(()=>{
document.querySelectorAll(".close-mask").forEach(a=>{a.click()});
document.querySelectorAll(".dialog-close").forEach(a=>{a.click()});
document.querySelectorAll(".wp-guide-dialog-close").forEach(a=>{a.click()});
document.querySelectorAll(".guide-dialog-close").forEach(a=>{a.click()});
document.querySelectorAll(".wp-disk-header__right-item").forEach((a)=>{if(a.href&&!!a.href.match(/buy|addnew/)){f(a);}});
},1);
setTimeout(()=>{clearInterval(id)},4000)
document.querySelector(a).addEventListener("mouseup",a=>{
if(a.target.title!=="分享"){return;}
let id2=setInterval(()=>{
const x=document.querySelectorAll(".share-file__link-ad");
if(!x){return;}
x.forEach((a)=>{f(a);});
// if(document.querySelector("#g-select-1 > button"))document.querySelector("#g-select-1 > button").innerHTML="永久有效";
// if(document.querySelector(".is-selected"))document.querySelector(".is-selected").classList.remove("is-selected")
// if(document.querySelector("#g-select-1 > button"))document.querySelector("#g-select-1 > button").click()
// if(document.querySelector("#g-select-1 > div > div[data-value='0']"))document.querySelector("#g-select-1 > div > div[data-value='0']").click()//.classList.add("is-selected")
setTimeout(()=>{clearInterval(id2)},100);
},10);
});
}else if(location.href.indexOf("play/video")>=0){
const w=unsafeWindow||window
let id=setInterval(()=>{
if(w.videojs&&w.videojs.players&&w.videojs.players.html5player){
const Myplayback=w.videojs.extend(w.videojs.getComponent('PlaybackRateMenuButton'), {
handleClick: function() {
if(this.menu.el_.style.display === '' || this.menu.el_.style.display === 'none'){
this.menu.el_.style.display = 'block';
}else{
this.menu.el_.style.display = 'none';
}
},
playbackRates: function() {
return [0.5,1,1.5,2,2.7,4];
},
controlText_:"播放速率,\n涛之雨植入"
});
w.videojs.registerComponent('Myplayback', Myplayback);
clearInterval(id);
w.videojs.players.html5player.controlBar.addChild('Myplayback', {}, 6);
}
},500);
//setTimeout(()=>{clearInterval(id)},10000)
}
})();