// ==UserScript==
// @name [🤣]知乎使用增强、B站哔哩哔哩使用增强、全网VIP视频免费破解去广告,支持电视剧免跳出选集、全网音乐直接下载、百度文库下载等多合一纯净脚本
// @namespace coolhii_vip
// @version 4.1.2
// @description 【组合型多功能脚本,完全免费】【1】知乎使用增强:外链接直接跳出、问题,回答时间标注、短视频下载方便保存等;【2】B站哔哩哔哩使用增强、番剧大会员VIP视频解析、视频下载、一键三联、浏览记录提醒;【3】全网VIP视频免费破解去广告,移动端+PC(需要第三方网站支持,可能需要关注公众号):支持爱奇艺、腾讯、芒果、优酷、哔哩哔哩等;【4】全网音乐有声音频免客户端下载,支持网易云音乐、QQ音乐、酷狗、喜马拉雅、咪咕等;【5】优惠券查询
// @author 橘子爱哭,爱画画的猫
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADUAAAAwCAYAAACxKzLDAAAAAXNSR0IArs4c6QAABSRJREFUaEPtWm9oG2UY/z2X2KmgaCdom7vksnUKCsMPA4lD6BCduG65dNoqWpGpQUEm/mU6ZBPEMf/r1Dp0wpzMrdPmYrfi9sUiOoV+ECcdTFdzyaVs/pkiKEiW3CNXk9m0d703WXL2Qw/y6X7P7/f83ue9e+993hAEr7B+4koJxc0AbgWwj5iGMgl5l2B4zTA1ld0MoisACjDjYDah7BAlIRHgpCEqDoBx1VQ8Ay9mNeVxEY5aMGra3A5GsjqGXjE0+RERHiFTqp5/GOCXnQl5CIVS0uiJnhQRnA2zWJ9QLFj9DKxywjFhbTauDHrpCJoyPwPQ6UrGPEpB6b7MavlbL0G3+xF94lqC1Q9g6SwcI4amrPDSEDOVzr8F5gdmJSPKga2koYUPeolOv6/quV6AbEMXzx7LbxtaePY8AAiZiqRz64hJ5EEtwLKSRndkp6ixqJ57jEEveOEJ9KcFWpnVQoe9sV6I8n01be4G43ZB+AZDU7Z6YVXdfA3Aei+cfd9+zrKaMiyCFapUhUjVzQ0AtogQA+5vq2j6p0uZC/Z0S4hwMaTlIhWqcDmaWpTOLSsxbi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+RAYrzZWxj82IurJxOV9tuK0g+zJzo7df4v6l85ZK5lE9GjF0AxTFfrydFwHQisYCwG0AjjvrOUbRkAGMPlF8ZEVtHbluiK/T6X+B3vhrTTNoUfLAAAAAElFTkSuQmCC
// @include *://wenku.baidu.com/*
// @include *://*.youku.com/v_*
// @include *://*.iqiyi.com/v_*
// @include *://*.iqiyi.com/w_*
// @include *://*.iqiyi.com/a_*
// @include *://*.le.com/ptv/vplay/*
// @include *://v.qq.com/x/cover/*
// @include *://v.qq.com/x/page/*
// @include *://v.qq.com/tv/*
// @include *://*.tudou.com/listplay/*
// @include *://*.tudou.com/albumplay/*
// @include *://*.tudou.com/programs/view/*
// @include *://*.mgtv.com/b/*
// @include *://film.sohu.com/album/*
// @include *://tv.sohu.com/v/*
// @include *://*.bilibili.com/video/*
// @include *://*.bilibili.com/bangumi/play/*
// @include *://*.baofeng.com/play/*
// @include *://vip.pptv.com/show/*
// @include *://v.pptv.com/show/*
// @include *://www.le.com/ptv/vplay/*
// @include *://www.wasu.cn/Play/show/*
// @include *://m.v.qq.com/x/cover/*
// @include *://m.v.qq.com/x/page/*
// @include *://m.v.qq.com/*
// @include *://m.iqiyi.com/v_*
// @include *://m.iqiyi.com/w_*
// @include *://m.iqiyi.com/a_*
// @include *://m.youku.com/alipay_video/*
// @include *://https://m.youku.com/video/id_*
// @include *://m.mgtv.com/b/*
// @include *://m.tv.sohu.com/v/*
// @include *://m.film.sohu.com/album/*
// @include *://m.le.com/ptv/vplay/*
// @include *://m.pptv.com/show/*
// @include *://m.acfun.cn/v/*
// @include *://m.bilibili.com/video/*
// @include *://m.bilibili.com/anime/*
// @include *://m.bilibili.com/bangumi/play/*
// @include *://m.wasu.cn/Play/show/*
// @include *music.163.com*
// @include *://y.qq.com*
// @include *://www.kugou.com*
// @include *://www.kuwo.cn*
// @include *://www.lizhi.fm*
// @include *://*.ximalaya.com*
// @include *://music.migu.cn*
// @include *://item.taobao.com/*
// @include *://*detail.tmall.com/*
// @include *://*detail.tmall.hk/*
// @include *://*product.suning.com/*
// @include *://*item.jd.com/*
// @include *://item.yiyaojd.com/*
// @include *://npcitem.jd.hk/*
// @include *://*detail.vip.com/*
// @include *://*mobile.yangkeduo.com/goods*
// @include *://*.zhihu.com/*
// @include *://v.vzuu.com/video/*
// @include *://video.zhihu.com/video/*
// @include *://www.bilibili.com/**
// @include *://search.bilibili.com/**
// @include *://space.bilibili.com/**
// @connect api.bilibili.com
// @connect t.mimixiaoke.com
// @connect t.jtm.pub
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_openInTab
// @grant GM_download
// @grant GM_info
// @grant GM_registerMenuCommand
// @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.2.1/jquery.min.js
// @run-at document-idle
// @charset UTF-8
// @license AGPL License
// @original-script https://greasyfork.org/zh-CN/scripts/418804
// @original-author 爱画画的猫
// @original-license AGPL License
// @original-changes 已经获得原作者的完全授权,在源码使用出也做了相应版权说明,特此申明
// @antifeature referral-link
// ==/UserScript==
(function() {
'use strict';
/*
* VIP解析部分代码借鉴以下脚本,哔哩哔哩部分代码
* 脚本地址:https://greasyfork.org/zh-CN/scripts/418804
* 作者:爱画画的猫,代码已经授权,在原作者的基础上优化了代码逻辑,修复了部分bug
*/
function ToolObject(){
this.GMgetValue = function (name, value) {
if (typeof GM_getValue === "function") {
return GM_getValue(name, value);
} else {
return GM.getValue(name, value);
}
};
this.GMsetValue = function(name, value){
if (typeof GM_setValue === "function") {
return GM_setValue(name, value);
} else {
return GM.setValue(name, value);
}
};
this.GMaddStyle = function(css){
var myStyle = document.createElement('style');
myStyle.textContent = css;
var doc = document.head || document.documentElement;
doc.appendChild(myStyle);
};
this.GMopenInTab = function(url, open_in_background){
if (typeof GM_openInTab === "function") {
GM_openInTab(url, open_in_background);
} else {
GM.openInTab(url, open_in_background);
}
};
this.addScript = function(url){
var s = document.createElement('script');
s.setAttribute('src',url);
document.body.appendChild(s);
};
this.randomNumber = function(){
return Math.ceil(Math.random()*100000000);
};
this.request = function(mothed, url, param){
return new Promise(function(resolve, reject){
GM_xmlhttpRequest({
url: url,
method: mothed,
data:param,
onload: function(response) {
var status = response.status;
var playurl = "";
if(status==200||status=='200'){
var responseText = response.responseText;
resolve({"result":"success", "data":responseText});
}else{
reject({"result":"error", "data":null});
}
}
});
})
};
this.getBilibiliBV=function(){
var pathname = window.location.pathname;
var bv = pathname.replace("/video/","").replace("/","");
return bv;
}
}
//全局统一变量
const toolObject = new ToolObject();
const window_url = window.location.href;
const window_host = window.location.host;
const coolhiiVIPVideo={};
coolhiiVIPVideo.eleId = Math.ceil(Math.random()*100000000);
coolhiiVIPVideo.analysisWebsite="https://www.xixicai.top/mov/s/?sv=1&url=";
coolhiiVIPVideo.judgeVipWebsite=function(){
var urls = ["www.iqiyi.com","v.qq.com","youku.com", "www.le.com","mgtv.com","sohu.com", "acfun.cn","bilibili.com","baofeng.com","pptv.com","m.iqiyi.com","m.v.qq.com","m.youku.com", "m.mgtv.com", "m.bilibili.com"];
var result = false;
for(var i=0; i<urls.length;i++){
if(window.location.host.indexOf("bilibili.com")==-1){ //不是B站直接判断
if(window.location.host.indexOf(urls[i])!=-1){
result = true;
}
}else{ //是B站只有番剧才开启VIP解析
if(window.location.href.indexOf("www.bilibili.com/bangumi/play")!=-1){
result = true;
}
}
}
return result;
};
coolhiiVIPVideo.addStyle=function(){
var themeColor = "#FF5C31";
var innnerCss = "";
innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+"{position:fixed; top:160px; left:0px; width:25px; z-index:99999999999999;}";
innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .vip_analysis_interface_box{position:relative;}";
innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .plugin_item{cursor:pointer;text-align:center;}";
innnerCss += "#plugin_coolhii_analysis_vip_"+this.eleId+" .jump_analysis_666666 >img{width:100%; display: inline-block; vertical-align: middle;}";
$("body").prepend("<style>"+innnerCss+"</style>");
};
coolhiiVIPVideo.generateHtml=function(){
var vipBase64Image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAABgCAYAAABbjPFwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAaFSURBVHhe7ZwLbBVFFIb/W0AEDFTeLYK0VBKgUh6KFDEgtvJWQYMGRSEKmKoRIQoCRnyAYhREFC1orBowiiKmhooUJVJFBOSRAAEUKE95tRUCigL1HOYslIa9O3d39u69Sb9kszNnb5v5Z2fOnHncG4JQnoOmOIPHKdmXrnZ01WR7DFGCEArpviCUi6+VCWQiykdSoUNYQMlEzscBP9A1PDQXexLO13x8FZ65la45nEiQZhNPhbfoXz4aAxMowW0+PinHUBbAHTZeyWIBseZtIqEhC4hrYlvAlXUlYU9sCmiTBQybB2SPFYM9sSOgcRr5w4nAcxuBMcuA7o/Ig/AEK6A6+Y8uQ4GcxcBLO4C7pgLXtJeHegQjIO1mYMibwLTdwMPzgYw75UHkRE9A/RbAbWOA8T8DTxdR+kmgXlN56B5/BYQoVux0t6rlqTup1mcCqZny0Az+CGjZBRj0imrXo79Q7Tyhmjw0izkB9ZKAHjnKgzy7GugzAWjUSh76R6h8FIVEXmg/EOg4SDUVjYHHkXNngELq4MupuZUdEKM97gQ07wB0oEJzwZtdL0aPbF+hCr7xwmRLi8gEtB8A3DJK1boJTp9UNb1kGvDf32KMDD0BSW2Bwa+aK/jmpcC39P+41j2iJ2DCL0DKTZJxycljwNLX1GUQPS9Ut4kkXLB+EfBiBjC2ofHCM3oCVn0kCU3K9gOfjKQxgAay98g77d8kD8yjJyB/ConIk4wGO1YCv9MVBfQHsrwR5ObIY+hw433ApN+A3s+IwT+qTekMql5NtpD34PgmrTvdHbRXq0ETk2yg7e1AyV7gKMVCPuBuIGvVDeg3CUjvJwYNVrwDfEUTln+Oi8EM7gRYcEjMQq5qJAYHSvep/vTTB2LwjjcBTFIbJaLL/WLQYFM+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Ex4zArgfWE+++BVxOKJaoFYA7MCGEtEONcaDl6G4dMsmpjzQpej2wj1lUI+6esEe6d8KnyEq9X+CrDg79qk9wdSuwLJlb5/bXV+lw4gOgIqwht9fDi2eg21MPbXQXngjugLMIz5ThxlWMBplYxLTrMAAyNPYGxmAQUqHZcUhORHYbZSJt5+3aMM1dEmITQHf5IfGnreED+UcZm57BcOI8TBz/Ows+H+WkA1//b5igfwP4DBAodXyDR7AAAAAElFTkSuQmCC";
var html=
`
<div id='plugin_coolhii_analysis_vip_`+this.eleId+`'>
<div class="vip_analysis_interface_box">
<div class='plugin_item jump_analysis_666666' title='点我!跳转综合VIP视频解析'><img src='`+vipBase64Image+`'></div>
</div>
</div>
`;
$("body").append(html);
};
coolhiiVIPVideo.operation=function(){
$("body").on("click", "#plugin_coolhii_analysis_vip_"+coolhiiVIPVideo.eleId+" .jump_analysis_666666", function(){
var jumpWebsite = coolhiiVIPVideo.analysisWebsite + window.location.href;
GM_openInTab(jumpWebsite, {active:true});
});
};
coolhiiVIPVideo.start=function(){
if(this.judgeVipWebsite() && window.top==window.self){
const self = this;
setTimeout(function(){
self.addStyle();
self.generateHtml();
self.operation();
},1500);
}
};
coolhiiVIPVideo.start();
/**
* 音乐下载:无损音乐、封面、歌词
*/
const coolhiiVIPMusic={};
coolhiiVIPMusic.eleId = Math.ceil(Math.random()*100000000);
coolhiiVIPMusic.isRun = function(){
var musicurls=["music.163.com","y.qq.com","www.kugou.com","www.kuwo.cn","www.xiami.com","music.taihe.com","music.migu.cn","lizhi.fm","qingting.fm","ximalaya.com"];
for(var i=0; i<musicurls.length;i++){
if(window.location.host.indexOf(musicurls[i])!=-1){
return true;
}
}
return false;
};
coolhiiVIPMusic.getPlayUrl = function(){
var currentHost = window.location.host;
var currentUrl = window.location.href;
var playUrl = null;
if(currentUrl.match(/music\.163\./)){ //网易云音乐
if(currentUrl.match(/^https?:\/\/music\.163\.com\/#\/(?:song|dj)\?id/)) {
playUrl = 'https://music.liuzhijin.cn/?url='+encodeURIComponent(currentUrl);
}else if(currentUrl.match(/^https?:\/\/y\.music\.163\.com\/m\/(?:song|dj)\?id/)) {
playUrl = 'https://music.liuzhijin.cn/?url='+encodeURIComponent('https://music.163.com/song?id='+getQueryString('id'));
}
}
else if(currentUrl.match(/y\.qq\.com/)){ //QQ音乐
if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
var musicMatch = currentUrl.match(/^https?:\/\/y\.qq\.com\/n\/ryqq\/songDetail\/(\S*)/);
if(musicMatch){
playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=qq'
}
var musicMatch2 = currentUrl.match(/^https?:\/\/y\.qq\.com\/n\/yqq\/song\/(\S*).html/);
if(musicMatch2){
playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch2[1]+'&type=qq';
}
}
else if(currentUrl.match(/kugou\.com/)){ //酷狗
var musicMatch = currentUrl.match(/hash=(\S*)&album/);
if(musicMatch){
playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=kugou';
}
}
else if(currentUrl.match(/kuwo\.cn/)){ //酷我
if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
var musicMatch = currentUrl.match(/play_detail\/(\S*)/);
if(musicMatch){
playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=kuwo';
}
}
else if(currentUrl.match(/www\.ximalaya\.com/)){ //喜马拉雅
var xmlyUrlArr = currentUrl.split("/");
for(var xuaIndex =0;xuaIndex<xmlyUrlArr.length;xuaIndex++){
if(xuaIndex==xmlyUrlArr.length-1){
playUrl = 'https://music.liuzhijin.cn/?id='+xmlyUrlArr[xuaIndex]+'&type=ximalaya&playUrl='+encodeURIComponent(currentUrl);
}
}
}
else if(currentUrl.match(/www\.lizhi\.fm/)){ //荔枝音乐
if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
var musicMatch = currentUrl.match(/^https?:\/\/www\.lizhi\.fm\/(\d*)\/(\d*)/);
if(musicMatch){
playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[2]+'&type=lizhi';
}
}
else if(currentUrl.match(/music\.migu\.cn/)){ //咪咕音乐
if(currentUrl.indexOf("?")) currentUrl = currentUrl.split("?")[0];
if(currentUrl.indexOf("#")) currentUrl = currentUrl.split("#")[0];
var musicMatch = currentUrl.match(/^https?:\/\/music\.migu\.cn\/v3\/music\/song\/(\S*)/);
if(musicMatch){
playUrl = 'https://music.liuzhijin.cn/?id='+musicMatch[1]+'&type=migu';
}
}
return playUrl;
};
coolhiiVIPMusic.addStyle=function(){
var themeColor = "#FF6600";
var innnerCss =
"@keyframes turnaround{0%{-webkit-transform:rotate(0deg);}25%{-webkit-transform:rotate(90deg);}50%{-webkit-transform:rotate(180deg);}75%{-webkit-transform:rotate(270deg);}100%{-webkit-transform:rotate(360deg);}}"+
"#plugin_kiwi_analysis_vip_music_box_"+this.eleId+" {position:fixed; top:160px; left:0px; width:30px; background-color:"+themeColor+";z-index:9999999899999;}"+
"#plugin_kiwi_analysis_vip_music_box_"+this.eleId+" >.plugin_item{cursor:pointer; width:100%; padding:10px 0px; text-align:center;}"+
"#plugin_kiwi_analysis_vip_music_box_"+this.eleId+" >.plugin_item >img{width:20px; display:inline-block; vertical-align:middle;animation:turnaround 3s linear infinite;}";
$("body").prepend("<style>"+innnerCss+"</style>");
};
coolhiiVIPMusic.generateHtml=function(){
var html="";
var vipImgBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAFM0lEQVRoQ+2Ye8jeYxjHP9+i8Afl0JzKOWeSORTFioYhMvuHHFasibaRFH/MxD/awdac5jCznOUUplFbyHnMhMiQOR82ioQ/vrqe7qd+7+/5He7nffe8WnbV09v7PNd139f3Ol+32MRJm7j+bAbw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DaiaNZjZRyAMwA5gLLJY0vXljlgW2BNwodeYgXbG8TB/UxcrQBzAHQzc0LJC1tBJC8MDWqTWKMmSeWms4QZvvplKhtiuX+ngMgmuE7kqKrD6GmnXhO6oYh0AER+wAQ4DYmtZXRLaKYSIr7e6jtVWINcGjBEzF9joQiNOM96XPga2CdpPgbnu3sAzFKFC+IAVBSvD9VUs670LqYOEeidTyVAEskPZyU3S2duTWwXtKaOgBt97YCSBdGuYyaPxyKV7hO7NqOZ8nYbeOZskifAZ3uWvZA24VZANLlEftxeT/7wmJJk23HfLWw0E1r9RoYgAQiSmyAiB0gekETrZI01nZMt8+m8aLNoIPzQPlm28cCpySrRkMrj+FTJC2y/ThwTqvmiWGgHmhSwvYuQACJ58efJP2cvBYTbHguh5ZJirEhm7JzIPvEEmPma0NXqvUVsKzHaADIrWCdkOvXUAMHkMIoxvFda5T7Cri16rErB8yoAEggYkOL7SoW/QD0dnqtiDEh8mRYNGoAhqVdhtBmABlGGijLZg8M1LwZh/8L0s4qT+Ct+wMAAAAASUVORK5CYII=";
html+= "<div id='plugin_kiwi_analysis_vip_music_box_"+this.eleId+"'>";
html+= "<div class='plugin_item jump_analysis_website' title='VIP音乐破解,免客户端下载!'><img src='"+vipImgBase64+"'></div>";
html+= "</div>";
$("body").append(html);
$("#plugin_kiwi_analysis_vip_music_box_"+this.eleId+"").on("click", function(){
var playUrl = coolhiiVIPMusic.getPlayUrl();
if(!!playUrl) GM_openInTab(playUrl, false);
})
};
coolhiiVIPMusic.operation=function(){
setInterval(function(){
var playUrl = coolhiiVIPMusic.getPlayUrl();
var $vipMusicBox = $("#plugin_kiwi_analysis_vip_music_box_"+coolhiiVIPMusic.eleId+"");
if(!!playUrl){
if($vipMusicBox.length==0){
coolhiiVIPMusic.generateHtml();
}
}else{
$vipMusicBox.remove();
}
}, 100);
};
coolhiiVIPMusic.start=function(){
if(this.isRun()){
this.addStyle();
this.operation();
}
};
coolhiiVIPMusic.start();
/**
* 领券相关
*/
var goodsCoupon={};
goodsCoupon.getPlatform=function(){
var couponUrl = window.location.href;
var platform="";
if(couponUrl.indexOf("suning.com")!=-1){
platform = "suning";
}else if(couponUrl.indexOf("detail.tmall")!=-1){
platform = "tmall";
}else if(couponUrl.indexOf("item.taobao.com")!=-1){
platform = "taobao";
}else if(couponUrl.indexOf("item.jd.com")!=-1 || couponUrl.indexOf("item.yiyaojd.com")!=-1 || couponUrl.indexOf("npcitem.jd.hk")!=-1){
platform = "jd";
}else if(couponUrl.indexOf("detail.vip.com")!=-1){
platform = "vpinhui";
}else if(couponUrl.indexOf("mobile.yangkeduo.com")!=-1){
platform = "pdd";
}
return platform;
}
goodsCoupon.filterStr = function(str){
if(!str) return "";
str = str.replace(/\t/g,"");
str = str.replace(/\r/g,"");
str = str.replace(/\n/g,"");
str = str.replace(/\+/g,"%2B");//"+"
str = str.replace(/\&/g,"%26");//"&"
str = str.replace(/\#/g,"%23");//"#"
return encodeURIComponent(str)
};
goodsCoupon.getGoodsData=function(platform){
var goodsId = "";
var goodsName = "";
var websiteUrl = window.location.href;
if(platform=="taobao"){
goodsId = this.getQueryString("id");
goodsName=$(".tb-main-title").text();
}else if(platform=="tmall"){
goodsId = this.getQueryString("id");
goodsName=$(".tb-detail-hd").text();
}else if(platform=="jd"){
goodsName=$("div.sku-name").text();
goodsId = this.getQueryStringByUrl(websiteUrl);
}else if(platform=="suning"){
var text = $("#itemDisplayName").text();
if(!!text){
text = text.replace("苏宁超市","");
text = text.replace("自营","");
}
goodsName=text;
goodsId = this.getQueryStringByUrl(websiteUrl);
}else if(platform=="vpinhui"){
goodsId = this.getQueryStringByUrl(websiteUrl).replace("detail-","");
goodsName = $(".pib-title-detail").text();
}else if(platform=="pdd"){
goodsId = this.getQueryString("goods_id");
goodsName = $(".enable-select").text();
}
var data={"goodsId":goodsId, "goodsName":this.filterStr(goodsName)}
return data;
};
goodsCoupon.request = function(mothed, url, param){
return new Promise(function(resolve, reject){
GM_xmlhttpRequest({
url: url,
method: mothed,
data:param,
onload: function(response) {
var status = response.status;
var playurl = "";
if(status==200||status=='200'){
var responseText = response.responseText;
resolve({"result":"success", "json":responseText});
}else{
reject({"result":"error", "json":null});
}
}
});
})
};
goodsCoupon.createHtml = function(platform, goodsId, goodsName){
if(!platform || !goodsId) return;
var goodsCouponUrl = "https://t.mimixiaoke.com/api/plugin/hit/v2?script=1&v=1.0.2&";
var goodsPrivateUrl = "https://t.mimixiaoke.com/api/private/change/coupon?script=2&v=1.0.2&platform="+platform+"&id=";
if(platform==="jd"){
goodsCouponUrl = "http://t.jtm.pub/api/platform/jd/coupon?itemId="+goodsId+"&q="+goodsName+"&content=&no=1&v=1.0.2";
goodsPrivateUrl = "http://t.jtm.pub/api/private/change/coupon?no=1&v=1.0.2&platform="+platform+"&id=";
}else{
if(platform!=="vpinhui"){
goodsCouponUrl = goodsCouponUrl+"platform="+platform+"&id="+goodsId+"&q="+goodsName;
}else{
var vip = goodsId.split("-");
if(vip.length!=2) return;
var vaddition = vip[0];
var vid = vip[1];
goodsCouponUrl = goodsCouponUrl+"platform="+platform+"&id="+vid+"&q="+goodsName+"&addition="+vaddition;
}
}
this.request("GET", goodsCouponUrl, null).then((resutData)=>{
if(resutData.result==="success" && !!resutData.json){
var data = JSON.parse(resutData.json).data;
if(!data || data==="null" || !data.css || !data.html || !data.handler){
return;
}
var cssText = data.css;
var htmlText = data.html;
var handler = data.handler;
var templateId = data.templateId;
$("body").prepend("<style>"+cssText+"</style>");
var handlers = handler.split("@");
for(var i=0; i<handlers.length; i++){
var $handler = $(""+handlers[i]+"");
if(platform=="taobao"){
$handler.parent().after(htmlText);
}else if(platform=="tmall"){
$handler.parent().after(htmlText);
}else if(platform=="jd"){
$handler.after(htmlText);
}else if(platform=="suning"){
$handler.parent().after(htmlText);
}else if(platform=="vpinhui"){
$handler.parent().after(htmlText);
}else if(platform=="pdd"){
$handler.after(htmlText);
}
}
var $llkk = $("#"+templateId);
if($llkk.length != 0){
//点击
let couponElementA = $llkk.find("a[name='cpShUrl']");
couponElementA.unbind("click").bind("click", ()=>{
event.stopPropagation();
event.preventDefault();
let couponId = $llkk.data("id");
if(!!couponId){
this.request("GET", goodsPrivateUrl+couponId, null).then((resutData2)=>{
if(resutData2.result==="success" && !!resutData2.json){
let url = JSON.parse(resutData2.json).url;
if(!!url) GM_openInTab(url, {active:true});
}
});
}
});
setInterval(()=>{
$llkk.find("*").each(function(){
$(this).removeAttr("data-spm-anchor-id")
});
},100);
//canvas画二维码
var $canvasElement = $("#ca"+templateId);
if($canvasElement.length != 0){
let couponId = $llkk.data("id");
this.request("GET", goodsPrivateUrl+couponId, null).then((resutData2)=>{
if(resutData2.result==="success" && !!resutData2.json){
let img = JSON.parse(resutData2.json).img;
if(!!img){
var canvasElement = document.getElementById("ca"+templateId);
var cxt = canvasElement.getContext("2d");
var imgData = new Image();
imgData.src = img;
imgData.onload=function(){
cxt.drawImage(imgData, 0, 0, imgData.width, imgData.height);
}
}
}
});
}
}
}
});
};
goodsCoupon.getQueryString = function(tag) {
var t = new RegExp("(^|&)" + tag + "=([^&]*)(&|$)");
var a = window.location.search.substr(1).match(t);
if (a != null) return a[2];
return "";
};
goodsCoupon.getQueryStringByUrl = function(url) {
if(url.indexOf("?")!=-1){
url = url.split("?")[0]
}
if(url.indexOf("#")!=-1){
url = url.split("#")[0]
}
var splitText = url.split("/");
var idText = splitText[splitText.length-1];
idText = idText.replace(".html","");
return idText;
};
goodsCoupon.randomSpmValue=function(){
$("meta[name='data-spm']").each(function(){
var max = 5000;
var min = 1000;
var randomValue = Math.floor(Math.random() * (max - min + 1) ) + min;
var randomLetter = String.fromCharCode(Math.floor( Math.random() * 26) + "a".charCodeAt(0));
$(this).attr("content", randomValue+randomLetter);
});
$("meta[name='spm-id']").each(function(){
var max = 5000;
var min = 1000;
var randomValue = Math.floor(Math.random() * (max - min + 1) ) + min;
var randomLetter = String.fromCharCode(Math.floor( Math.random() * 26) + "a".charCodeAt(0));
$(this).attr("content", randomValue+randomLetter);
});
};
goodsCoupon.runAliDeceptionSpm=function() {
if(window.location.host.indexOf("aliyun.com")!=-1 || window.location.host.indexOf("taobao.com")!=-1 || window.location.host.indexOf("tmall.com")!=-1){
this.randomSpmValue();
setInterval(()=>{
this.randomSpmValue();
}, 4000);
}
};
goodsCoupon.start = function(){
var platform = this.getPlatform();
if(!platform) return;
var delayMS = 0;
if(platform=="vpinhui"){ //唯品会采用了异步加载
var vipInterval = setInterval(function(){
if($(".pib-title-detail").length!=0 || delayMS>=1200){
var goodsData = goodsCoupon.getGoodsData(platform);
goodsCoupon.createHtml(platform, goodsData.goodsId, goodsData.goodsName);
clearInterval(vipInterval)
}
delayMS+=100;
},100);
}else{
var goodsData = goodsCoupon.getGoodsData(platform);
goodsCoupon.createHtml(platform, goodsData.goodsId, goodsData.goodsName);
}
};
goodsCoupon.start();
/**
* 百度文库开始
*/
const baiduwenkuHelper={};
baiduwenkuHelper.wenkudownloadUrl = "http://www.tool77.com/tampermonkey/doc/download?docs=11&wenku_url=";
baiduwenkuHelper.isRun = function(){
if(window_host.indexOf("wenku.baidu.com") != -1){
return true;
}
return false;
};
baiduwenkuHelper.removeAD=function(){
if(window_host.indexOf("wenku.baidu.com") != -1){
setInterval(function(){
$(".banner-ad").hide();
$(".union-ad-bottom").hide();
$("iframe").hide();
//VIP去广告小按钮
$(".ggbtm-vip-close").hide();
$(".ad-vip-close-bottom").hide();
$(".ad-vip-close").hide();
//搜索页面
$("#fengchaoad").hide();
$(".search-aside-adWrap").hide();
},300);
}
};
baiduwenkuHelper.generateHtml=function(){
const $that = this;
if((window_url.indexOf("wenku.baidu.com/view")==-1 && window_url.indexOf("wenku.baidu.com/link")==-1)
|| window_host!="wenku.baidu.com"){
return;
}
var topBox = "<div style='position:fixed;z-index:999999;background-color:#ccc;cursor:pointer;top:150px;left:0px;'>"+
"<div id='baiduwenku_helper_download_btn' style='font-size:12px;padding:8px 2px;color:#FFF;background-color:#25AE84;'>下载</div>"+
"</div>";
$("body").append(topBox);
$("body").on("click","#baiduwenku_helper_download_btn",function(){ //解析下载
var wenkuUrl = $that.wenkudownloadUrl+encodeURIComponent(window_url);
GM_openInTab(wenkuUrl, { active: true });
});
};
baiduwenkuHelper.start=function(){
if(this.isRun()){
this.generateHtml();
this.removeAD();
}
};
baiduwenkuHelper.start();
/**
* 知乎助手开始
*/
////**********************************************
//本脚本部分代码借鉴自【人鬼情未了】的脚本,已经获得原作者的完全授权,脚本代码可以随意修改使用,特此申明!
////【人鬼情未了】脚本名字:知乎网页助手
////【人鬼情未了】脚本地址:https://greasyfork.org/zh-CN/scripts/384172
////本脚本做出的修改:重构了部分逻辑
////**********************************************
const zhihuHelper={};
zhihuHelper.markArticleOrQuestion = function(){ //首页标识文章or回答
var questionsCss = `
.AnswerItem .ContentItem-title a::before {
content: '问题';
color: #f68b83;
background-color: #f68b8333;
font-weight: bold;
font-size: 13px;
padding: 1px 4px 0px;
border-radius: 2px;
display: inline-block;
vertical-align: middle;
margin: 0px 4px 0px 0px;
}
.ArticleItem .ContentItem-title a::before {
content: '文章';
color: #0066FF;
background-color: #E5EFFF;
font-weight: bold;
font-size: 13px;
padding: 1px 4px 0;
border-radius: 2px;
display: inline-block;
vertical-align: middle;
margin: 0px 4px 0px 0px;
}
.ZvideoItem .ContentItem-title a::before {
content:'视频';
color: #00BCD4;
background-color: #00BCD433;
font-weight: bold;
font-size: 13px;
padding: 1px 4px 0;
border-radius: 2px;
display: inline-block;
vertical-align: middle;
margin: 0px 4px 0px 0px;
}
.TopstoryItem--advertCard{
text-decoration:line-through;
}
`;
$("body").prepend("<style>"+questionsCss+"</style>");
};
zhihuHelper.autoJumpTarget = function(){ //直接跳转到目标网页
var regexResult = location.search.match(/target=(.+?)(&|$)/);
if(regexResult && regexResult.length==3){
location.href = decodeURIComponent(regexResult[1]);
}
};
zhihuHelper.clearAdvert = function(){ //去除广告,可能造成误伤,用最小策略
setInterval(function(){
var ad1 = document.querySelector('.AppBanner');
if (ad1!=="undefined" && ad1!==null) {
ad1.style.display = "none";
}
var ad2 = document.querySelector('.AdblockBanner');
if (ad2!=="undefined" && ad2!==null) {
ad2.style.display = "none";
}
}, 1000);
};
zhihuHelper.changeHeightQualityPic = function(){ //图片自动高清
setInterval(function(){
$("body").find("img").each(function(){
var dataoriginal = $(this).attr("data-original");
if(!!dataoriginal){
$(this).attr("src", dataoriginal);
}
});
}, 500);
};
zhihuHelper.noLoginBox = function(){ //去除登录提示
var IntervalUnit = 200;
var totalIntervalMs = 0;
var loginInterval = setInterval(function(){
$(".signFlowModal").children(".Modal-closeButton").click();
totalIntervalMs += IntervalUnit;
if(totalIntervalMs >= 2000){ //循环多次,我就不信还显示
clearInterval(loginInterval);
}
}, IntervalUnit);
$(".AppHeader-login").click(function(){
clearInterval(loginInterval);
$(".Modal-wrapper").show();
});
};
zhihuHelper.markQuestionDate = function(){ //标注回答时间
/**
* @param {Object} time
* @param {Object} format
* 时间格式化
* DateFormat(new Date(dateCreated), "yyyy-MM-dd hh:mm:ss")
*/
function DateFormat(time, format) { //
var o = {
"M+": time.getMonth() + 1, //月份
"d+": time.getDate(), //日
"h+": time.getHours(), //小时
"m+": time.getMinutes(), //分
"s+": time.getSeconds(), //秒
"q+": Math.floor((time.getMonth() + 3) / 3), //季度
"S": time.getMilliseconds() //毫秒
};
if(/(y+)/.test(format)){
format = format.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for(var k in o){
if(new RegExp("(" + k + ")").test(format)){
format = format.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
}
return format;
}
/**
* 为问题添加创建时间和编辑时间
*/
function addDateQuestion() {
var title = document.querySelector(".QuestionPage");
if(!!title){
var dateCreated = title.querySelector("[itemprop~=dateCreated][content]").content;
var dateModified = title.querySelector("[itemprop~=dateModified][content]").content;
var createDate = DateFormat(new Date(dateCreated), "yyyy-MM-dd hh:mm:ss");
var editDate = DateFormat(new Date(dateModified), "yyyy-MM-dd hh:mm:ss");
var side = title.querySelector(".QuestionHeader-side");
var timeDiv = document.createElement('div');
timeDiv.innerHTML = `<p>创建于: ${createDate}</p><p>编辑于: ${editDate}</p>`;
timeDiv.style.cssText = 'color:#6f6f6f;font-size:13px;';
side.appendChild(timeDiv);
}
}
/**
* 为回答添加创建时间和编辑时间
*/
function addTimeAnswerItems() {
var list = document.querySelectorAll(".AnswerItem");
for (var i = 0; i < list.length; i++) {
var item = list[i];
if (item.getAttribute('zh_date_mk') === 'true') {
continue;
}
item.setAttribute('zh_date_mk', 'true');
try{
var dateCreated = item.querySelector("[itemprop~=dateCreated][content]").content;
var dateModified = item.querySelector("[itemprop~=dateModified][content]").content;
var createDate = DateFormat(new Date(dateCreated), "yyyy-MM-dd hh:mm:ss");
var editDate = DateFormat(new Date(dateModified), "yyyy-MM-dd hh:mm:ss");
var sideItem = item.querySelector(".ContentItem-meta");
var timeDiv = document.createElement('div');
timeDiv.innerHTML = `创建于: ${createDate} 编辑于: ${editDate}`;
timeDiv.class = "Voters";
timeDiv.style.cssText = 'color:#6f6f6f;font-size:13px;display:block;padding:5px 0px;';
sideItem.appendChild(timeDiv);
}catch(e){}
}
}
addDateQuestion();
setInterval(function(){ //循环检查回答和修改时间
addTimeAnswerItems();
},400);
//document.querySelector(".Question-main").addEventListener('DOMNodeInserted', addTimeAnswerItems);
};
zhihuHelper.autoExpandQuestionInfo = function(){ //问题全部展开
var mm0 = document.querySelector('.QuestionRichText-more');
if(mm0!=="undefined" && mm0!==null) { //展开问题描述
mm0.click();
}
var mm1 = document.querySelector('.SignContainer-content');
if(mm1!=="undefined" && mm1!==null) {
var c1 = document.querySelector('.Modal-backdrop');
if (c1!=="undefined" && c1!==null) {
c1.click();
}
var c2 = document.querySelector('.Modal-closeButton');
if (c2!=="undefined" && c2!==null) {
c2.click();
}
}
};
zhihuHelper.showQuestionAuthor = function(){
//此处代码借鉴自 - 知乎增强
//原作者:X.I.U
//https://greasyfork.org/zh-CN/scripts/419081-%E7%9F%A5%E4%B9%8E%E5%A2%9E%E5%BC%BA
if (document.querySelector('.BrandQuestionSymbol, .QuestionAuthor')) return
let qJson = JSON.parse(document.querySelector('#js-initialData').textContent).initialState.entities.questions[/\d+/.exec(location.pathname)[0]].author,
html = `<div class="BrandQuestionSymbol"><a class="BrandQuestionSymbol-brandLink" href="/people/${qJson.urlToken}"><img role="presentation" src="${qJson.avatarUrl}" class="BrandQuestionSymbol-logo" alt=""><span class="BrandQuestionSymbol-name">${qJson.name}</span></a><div class="BrandQuestionSymbol-divider" style="margin-left: 5px;margin-right: 10px;"></div></div>`;
document.querySelector('.QuestionHeader-topics').insertAdjacentHTML('beforebegin', html);
};
zhihuHelper.downloadVideo = function(){
let downloadElementClassName = "zhihu_helper_666wwi1";
//有借鉴懒哈哈的脚本
//脚本地址:https://greasyfork.org/zh-CN/scripts/370634
document.addEventListener('DOMNodeInserted',(e) => {
if(!e.relatedNode.querySelector) return;
var playBar = e.relatedNode.querySelector(':scope > div:last-child > div:first-child > div:nth-of-type(2)');
if(!playBar || playBar.querySelector('.'+downloadElementClassName)) return;
var playBut = playBar.querySelector(':scope > div:last-child');
if(!playBut) return;
var playButLi = playBut.querySelector('div:first-child');
if(!playButLi) return;
var downloadBut = playButLi.cloneNode(true);
downloadBut.className = playButLi.className + ' ' + downloadElementClassName;
if(!downloadBut.querySelector('._1tg8oir')) return;
downloadBut.querySelector('._1tg8oir').innerText='下载';
playButLi.before(downloadBut);
downloadBut.addEventListener("click",function(){
let playUrl = document.querySelector("video").getAttribute("src");
if(!!playUrl){
commonFunctionObject.GMopenInTab(playUrl, false);
}
});
});
};
zhihuHelper.start = function(){
//直接跳转到目标网页
if(window_host == "link.zhihu.com"){
this.autoJumpTarget();
}
const self = this;
//知乎正文
if(window_host.indexOf("zhihu.com")!=-1){
if(window_url.indexOf("https://www.zhihu.com/question/") != -1){
this.autoExpandQuestionInfo(); //问题全部展开
this.markQuestionDate(); //问题日期
this.showQuestionAuthor(); //提问者标识出来
}
this.noLoginBox(); //去除登录框
this.clearAdvert(); //去除广告
this.markArticleOrQuestion(); //标识文章还是提问
//知乎视频下载
this.downloadVideo();
window.onload=function(){
self.downloadVideo();
}
window.onscroll=function(){
var scrollTop = document.documentElement.scrollTop;
if(scrollTop > 200){
self.downloadVideo();
}
}
}
};
zhihuHelper.start();
/**
* B站视频下载
* @param {Object} toolObject
*/
////**********************************************
//本脚本部分代码借鉴自【爱画画的猫】的脚本,已经获得原作者的完全授权,脚本代码可以随意修改使用,特此申明!
////【爱画画的猫】脚本地址:https://greasyfork.org/zh-CN/scripts/418804
////本脚本做出的修改:重构了部分逻辑
////**********************************************
function BilibiliVideoDownloadHelper(toolObject){
this.toolObject=toolObject;
this.downloadResutError=function($btn){
alert("下载出错了");
$btn.text("下载视频(最高清)");
$btn.removeAttr("disabled");
};
this.downloadResutSuccess=function($btn){
$btn.text("下载视频(最高清)");
$btn.removeAttr("disabled");
};
this.downloadVideo=function($btn){
let bv = toolObject.getBilibiliBV();
if(!bv){
this.downloadResutError();
}else{
//bv转av
toolObject.request("get", "http://api.bilibili.com/x/web-interface/archive/stat?bvid="+bv, null).then((resultData)=>{
let dataJson = JSON.parse(resultData.data);
if(!!dataJson && dataJson.code===0 && !!dataJson.data){
let aid = dataJson.data.aid;
if(!aid){
this.downloadResutError($btn);
}else{
//获取cid
toolObject.request("get", "https://api.bilibili.com/x/web-interface/view?aid="+aid, null).then((resultData2)=>{
let dataJson2 = JSON.parse(resultData2.data);
if(!!dataJson2 && dataJson2.code===0 && !!dataJson2.data){
let aid = dataJson2.data.aid;
let bvid = dataJson2.data.bvid;
let cid = dataJson2.data.cid;
if(!aid || !bvid || !cid){
this.downloadResutError($btn);
}else{
//获取播放链接
toolObject.request("get", "https://api.bilibili.com/x/player/playurl?avid="+aid+"&cid="+cid+"&qn=112", null).then((resultData3)=>{
let dataJson3 = JSON.parse(resultData3.data);
if(!!dataJson3 && dataJson3.code===0 && !!dataJson3.data){
this.downloadResutSuccess($btn);
window.open(dataJson3.data.durl[0].url);
}
}).catch((errorData)=>{
this.downloadResutError($btn);
});
}
}
}).catch((errorData)=>{
this.downloadResutError($btn);
});
}
}
}).catch((errorData)=>{
this.downloadResutError();
});
}
}
this.createElementHtml = function(){
let randomNumber = this.toolObject.randomNumber();
let cssText =
`
#bilibili_exti_`+randomNumber+`{padding:10px;}
#bilibili_exti_`+randomNumber+` >.self_s_btn{background-color:#FB7299; color:#FFF; font-size:10px;display:inline-block; margin-right:15px;padding:2px 4px;border-radius:3px;cursor:pointer;}
`;
let htmlText=
`
<div id="bilibili_exti_`+randomNumber+`">
<span class="self_s_btn" id="download_s_`+randomNumber+`">下载视频(最高清)</span>
<span class="self_s_btn" id="focus_s_`+randomNumber+`">一键三连</span>
</div>
`;
setTimeout(()=>{
if($("#bilibili-player").html().length >= 10){
$("body").prepend("<style>"+cssText+"</style>");
$("#viewbox_report div.video-data").append(htmlText);
let $that = this;
$("#download_s_"+randomNumber).on("click", function(){
$(this).attr("disabled", "disabled");
$(this).text("下载视频(准备中)")
$that.downloadVideo($(this));
});
$("#focus_s_"+randomNumber).on("click", function(){
$("#arc_toolbar_report .like").click();
$("#arc_toolbar_report .coin").click();
});
}
}, 2500);
}
this.start = function(){
if(window.location.pathname.indexOf("/video")!=-1 && window.location.host==="www.bilibili.com"){
this.createElementHtml();
}
}
}
/**
* 记录b站的观看记录
* @param {Object} toolObject
*/
////**********************************************
//本脚本部分代码借鉴自【爱画画的猫】的脚本,已经获得原作者的完全授权,脚本代码可以随意修改使用,特此申明!
////【爱画画的猫】脚本地址:https://greasyfork.org/zh-CN/scripts/418804
////本脚本做出的修改:重构了部分逻辑
////**********************************************
function RecordViewFunction(toolObject){
this.toolObject=toolObject;
this.localCacheName = "bilibili_video_record";
this.recordOneVideo = function(){
let promise = new Promise((resolve, reject)=>{
let bv = toolObject.getBilibiliBV();
let cacheText = toolObject.GMgetValue(this.localCacheName);
cacheText = !cacheText ? "" : cacheText+"#";
let viewArray = cacheText.split("#");
let len = viewArray.length;
let limitNum = 2000; //最多保存2000个视频记录
if(len>=limitNum){ //超过则清除最开始的1/4
let newCacheText = "";
let limitNumHalf = limitNum/4;
for(var i=len-1; i>=0; i--){
if(i>=limitNumHalf){
newCacheText += "#" + viewArray[i];
}else{
break;
}
}
cacheText = newCacheText;
}
if(cacheText.indexOf(bv)==-1){
cacheText += bv;
toolObject.GMsetValue(this.localCacheName, cacheText);
}
resolve({"result":"success"});
});
};
this.searchPageRemindHtml = function($ele, top=8, right=8){
$ele.css("position","relative");
$ele.append("<div style='z-index: 99999999;position:absolute; top:"+top+"px; right:"+right+"px; background-color: rgba(251,123,159,1); border-radius:3px; font-size:10px; color:#FFF;padding:0px 2px;'>已看</div>");
};
this.searchPageRemind = function(){
let $that = this;
var elementArray = [
{"node":".video-list-item", "top":8, "right":8}, //搜索结果
{"node":"#page-index .small-item", "top":12, "right":12}, //用户投稿
{"node":"#submit-video-list .small-item", "top":12, "right":12}, //用户主页
{"node":"#page-series-detail .small-item.fakeDanmu-item", "top":12, "right":12}, //用户主页投稿
];
setInterval(function(){
let cacheText = toolObject.GMgetValue($that.localCacheName);
cacheText = !cacheText ? "" : cacheText;
for(var i=0; i<elementArray.length; i++){
var elementobj = elementArray[i];
$(elementobj.node).each(function(){ //用户主页
if($(this).attr("dealxll")!=="true"){
var videourl = $(this).find("a[href^='//www.bilibili.com/video']").attr("href");
if(!!videourl){
if(cacheText.indexOf(videourl.split("?")[0].replace("//www.bilibili.com/video/",""))!=-1){
$that.searchPageRemindHtml($(this), elementobj.top, elementobj.right);
}
$(this).unbind("click").bind("click", ()=>{ //循环操作,单独绑定
$that.searchPageRemindHtml($(this), elementobj.top, elementobj.right);
})
$(this).attr("dealxll","true");
}
}
});
}
}, 333);
}
this.start=function(){
let $that = this;
if(window.location.pathname.indexOf("/video")!=-1 && window.location.host==="www.bilibili.com"){
let currentHref = "";
setInterval(()=>{ //需要循环存储
if(window.location.href!==currentHref){
this.recordOneVideo();
currentHref = window.location.href;
}
},150);
}
//搜索结果和用户主页已经看过的视频提醒
if(window.location.host.indexOf("bilibili.com")!=-1){
this.searchPageRemind();
GM_registerMenuCommand("清空B站浏览记录",function(){
if(confirm('是否要清空B站浏览记?清空后将不可恢复...')){
$that.toolObject.GMsetValue($that.localCacheName, "");
}
});
}
};
}
try{
(new BilibiliVideoDownloadHelper(toolObject)).start();
(new RecordViewFunction(toolObject)).start();
}catch(e){}
})();