// ==UserScript==
// @name 全网VIP视频免费看,视频广告跳过,全网小说免费阅读,百度文库下载,视频图片下载,电商优惠券,短视频无水印下载。长期更新,放心使用
// @description 🔥全网VIP视频免费看🔥电影搜索:最新最热电影、电视剧推荐🔥视频网站广告跳过🔥图虫、微信公众号图文、贴吧、小红书图片下载,YouTube、Facebook视频下载🔥百度文库下载🔥电商优惠券查询🔥标记百度搜索结果页中的广告网页、垃圾网页🔥广告清理🔥无水印短视频下载🔥网页二维码生成🔥链接立即跳转🔥OneTab🔥划词翻译,持续更新维护中...
// @namespace https://payback.bwaq.cn
// @icon https://payback.bwaq.cn/logo.png
// @author 星星龙♪(・ω・)ノ
// @antifeature referral-link 应GreasyFork代码规范要求:含有优惠券查询功能的脚本必须添加此提示!在此感谢大家的理解...
// @version 2.4.0
// @include *
// @license MIT License
// @require https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.js
// @require https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.js
// @resource iconInfo https://payback.bwaq.cn/logo.png
// @resource toastr_css https://cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.css
// @connect *
// @grant GM_log
// @grant GM.info
// @grant GM_info
// @grant GM_addStyle
// @grant GM.setValue
// @grant GM_setValue
// @grant GM.getValue
// @grant GM_getValue
// @grant GM_download
// @grant unsafeWindow
// @grant GM.openInTab
// @grant GM_openInTab
// @grant GM_addElement
// @grant GM.listValues
// @grant GM_listValues
// @grant GM.deleteValue
// @grant GM_deleteValue
// @grant GM.setClipboard
// @grant GM_setClipboard
// @grant GM.notification
// @grant GM.xmlHttpRequest
// @grant GM_xmlhttpRequest
// @grant GM.getResourceUrl
// @grant GM_getResourceURL
// @grant GM_getResourceText
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// ==/UserScript==
(function () {
'use strict';
class RedisStorage {
constructor() {
this.name = 'RedisStorage';
}
//设置缓存
set(params) {
let obj = {
name: '',
value: '',
expires: 0,
startTime: new Date().getTime(),//记录何时将值存入缓存,毫秒级
};
let options = {};
//将obj和传进来的params合并
Object.assign(options, obj, params);
if (options.expires > 0) {
//如果设置了过期时间的话,以options.name为key,options为值放进去
GM_setValue(options.name, JSON.stringify(options));
} else {
//如果过期时间没有设置,就判断一下value的类型
let type = Object.prototype.toString.call(options.value);
//如果value是对象或者数组对象的类型,就先用JSON.stringify转一下,再存进去
if (type === '[object Object]') {
options.value = JSON.stringify(options.value);
}
if (type === '[object Array]') {
options.value = JSON.stringify(options.value);
}
GM_setValue(options.name, options.value);
}
}
//获取缓存
get(name) {
let item = GM_getValue(name);
//先将获取的缓存试着进行json转为对象的形式
try {
item = JSON.parse(item);
} catch (error) {
//如果不行就不是json的字符串,就直接返回
item = GM_getValue(name);
}
if (item === null || typeof(item) === "undefined") {
return false
}
//如果有startTime的值,说明设置了失效时间
if (item.startTime) {
let date = new Date().getTime();
//何时将值取出减去刚存入的时间,与item.expires比较,如果大于就是过期了,如果小于或等于就还没过期
if (date - item.startTime > item.expires) {
//缓存过期,清除缓存,返回false
GM_deleteValue(name);
return false
} else {
//缓存未过期,返回值
return item.value
}
} else {
//如果没有设置失效时间,直接返回值
return item
}
}
//移出缓存
remove(name) {
GM_deleteValue(name);
}
}
let tbk = ['taobao.', 'Tb.', 'tb.', 'tmall.', 'liangxinyao.'];
let jd = ['jd.'];
let pdd = ['pinduoduo.', 'yangkeduo.'];
let platformShop = [
'jd.',
'pinduoduo.',
'yangkeduo.',
'taobao.',
'Tb.',
'tb.',
'tmall.',
'liangxinyao.',
];
var GUtils = {
loggerOn: function () {
return 'true'
// return false
},
log: function (args1, args2) {
if (this.loggerOn()) {
if (typeof args2 === 'undefined') {
GM_log(args1);
} else {
GM_log(args1 + '==================>' + args2);
}
}
},
inIframe: function () {
return self.frameElement && 'IFRAME' == self.frameElement.tagName
|| !(window.frames.length === parent.frames.length && self == top)
},
sleep: function (time) {
// sleep time expects milliseconds
//使用: GUtils.sleep(500).then(() => {})
return new Promise((resolve) => setTimeout(resolve, time))
},
getSelect: function () {
if (window.getSelection) {
return window.getSelection().toString().trim() || ''
} else {
return document.selection.createRange().text.trim() || ''
}
},
/*查找给定的网址中的某个参数*/
getQueryVariable: function (url, name) {
let regExp = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
let result = '';
let indexOf = url.indexOf('?');
if (indexOf !== -1) {
let linkUrl = url.substr(indexOf + 1);
let matcher = linkUrl.match(regExp);
if (matcher && matcher.length > 0) {
result = unescape(matcher[2]);
}
}
this.log('==========>获取地址: ' + url + ' 中的 ' + name + ' 参数, 结果为: ' + result);
return result
},
/*查找当前网页的地址栏中的某个参数*/
getUrlParam: function (name) {
let regSearch = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
//从问号 (?) 开始的 URL(查询部分)
let search = window.location.search.substr(1).match(regSearch);
if (search && search.length > 0) {
return unescape(search[2])
}
let regPath = new RegExp('(^|/)' + name + '/([^/]*)(/|$)', 'i');
//当前 URL 的路径部分
let path = window.location.pathname.substr(1).match(regPath);
if (path && path.length > 0) {
return unescape(path[2])
}
return ''
},
/*截取网址 ? 前的内容*/
getUrlPath: function (url) {
let indexOf = url.indexOf('?');
if (indexOf === -1) {
return url
} else {
return url.substr(0, indexOf)
}
},
interceptor: function (regexStr) {
if (regexStr && regexStr.length) {
let linkUrl = this.cleanUrl(location.href);
for (let i = 0; i < regexStr.length; i++) {
let item = regexStr[i];
let indexOf = item.url.indexOf('?');
let regexpUrl = indexOf == -1 ? item.url : item.url.substring(0, indexOf);
let regexpType = item.linkType;
if ('startWith' === regexpType) {
if (linkUrl.startsWith(regexpUrl)) {
this.log('interceptor linkUrl', linkUrl);
return false
}
} else if ('contains' == regexpType) {
if (linkUrl.indexOf(regexpUrl) > -1) {
this.log('interceptor linkUrl', linkUrl);
return false
}
} else if ('regexp' == regexpType) {
if (new RegExp(regexpUrl).test(linkUrl)) {
this.log('interceptor linkUrl', linkUrl);
return false
}
}
}
return true
}
return false
},
completeUrlHttp: function (regexpUrl) {
if (regexpUrl.startsWith('https://') || regexpUrl.startsWith('http://')) {
return regexpUrl
} else {
return 'http://' + regexpUrl
}
},
completeUrlHttps: function (regexpUrl) {
if (regexpUrl.startsWith('https://') || regexpUrl.startsWith('http://')) {
return regexpUrl
} else {
return 'https://' + regexpUrl
}
},
/*遍历列表, 如果某个字符串包含传入参数就返回 true */
hrefIndexOfIn: function (listUrl) {
let linkUrl = this.cleanUrl(location.href);
for (let item of listUrl) {
if (linkUrl.indexOf(item) >= 0) {
return true
}
}
return false
},
itemIndexOfIn: function (str, list) {
for (let item of list) {
if (str.indexOf(item) >= 0) {
return true
}
}
return false
},
/*遍历列表, 如果某个字符串等于传入参数则返回 true */
itemEqualsIndex: function (str, list) {
for (let i = 0; i < list.length; i++) {
if (str === list[i]) {
//字符串等于参数
return i
}
}
return -1
},
cleanUrl: function (url) {
let indexOf = url.indexOf('?');
let linkUrl = indexOf == -1 ? url : url.substring(0, indexOf);
let https = 'https://';
linkUrl = linkUrl.startsWith(https) ? linkUrl.substring(linkUrl.indexOf(https) + https.length, linkUrl.length) : linkUrl;
let http = 'http://';
linkUrl = linkUrl.startsWith(http) ? linkUrl.substring(linkUrl.indexOf(http) + http.length, linkUrl.length) : linkUrl;
let www = 'www.';
linkUrl = linkUrl.startsWith(www) ? linkUrl.substring(linkUrl.indexOf(www) + www.length, linkUrl.length) : linkUrl;
return linkUrl
},
getPlatformShop: function () {
return platformShop
},
getChannel: function (str) {
for (let item of jd) {
if (str.indexOf(item) !== -1) {
return 'jd'
}
}
for (let item of tbk) {
if (str.indexOf(item) !== -1) {
return 'tbk'
}
}
for (let item of pdd) {
if (str.indexOf(item) !== -1) {
return 'pdd'
}
}
return ''
},
isNumber: function (val) {
return /^[-]?[\.\d]+$/.test(val)
},
hasNumber: function (val) {
return /\d/.test(val)
},
delHtmlTag: function (str) {
return str.replace(/<[^>]+>/g, '')
},
getDateFormat: function () {
let date = new Date();
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
let D = date.getDate() + ' ';
let h = date.getHours() + ':';
let m = date.getMinutes() + ':';
let s = date.getSeconds();
this.log(Y + M + D + h + m + s);
return Y + M + D
},
UUID: function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16)
})
},
urlQrCode: function (url) {
return 'https://wenhairu.com/static/api/qr/?size=100&text=' + url
// return ''
},
urlWenkuDonload: function (url) {
return ''
},
urlYouTuBe: function (url) {
return 'https://yt1s.com/en260?q=' + url
},
urlFacebook: function () {
return 'https://yt1s.com/facebook-downloader/en2'
//https://www.videofk.com/ 备用地址:支持更多网站
},
zhihuIndexUrl: function (url) {
return `https://link.zhihu.com/?target=${encodeURIComponent(url)}`
},
indexToGoodsPdd: function (itemId) {
return this.indexToGoods('pdd', itemId)
},
indexToGoodsTB: function (itemId) {
return this.indexToGoods('tbk', itemId)
},
indexToGoodsJd: function (itemId) {
return this.indexToGoods('jd', itemId)
},
indexToGoods: function (channel, itemId) {
return `https://payback.bwaq.cn/goods?channel=${channel}&id=${itemId}`
},
indexToCouponUrl: function (channel, itemId, couponMoney) {
let that = this;
let requestUrl = this.goodsId(channel, itemId);
return new Promise((resolve, reject) => {
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
that.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
let data = resp.data;
if (resp.code == 10 && data) {
let linkUrl = '';
if (data.channel === 'tbk') {
linkUrl = data['tbk'].couponUrl || '';
} else if (data.channel === 'jd') {
linkUrl = data['jd'].data || '';
} else {
linkUrl = data['pdd'].data || '';
}
if (linkUrl && linkUrl.length) {
that.log('================>获取优惠券成功: 链接 ' + linkUrl);
resolve({linkUrl: linkUrl, couponMoney: couponMoney});
} else {
that.log('================>该商品没有优惠券');
reject('');
}
} else {
that.log('================>该商品没有优惠券');
reject('');
}
},
});
})
},
goodsDetail: function (channel, goodsId) {
let that = this;
let requestUrl = `https://server.bwaq.cn/tbk/api/goods/purchase/details?fromPlugin=true&channel=${channel}&goodsId=${goodsId}`;
return new Promise((resolve, reject) => {
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
that.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
let couponMoney;
try {
couponMoney = Number.parseFloat(resp.data.data.couponmoney) || 0;
} catch (error) {
couponMoney = 0;
}
if (resp.code == 10 && resp.data && couponMoney > 0.1) {
let itemId = resp.data.data.itemid;
let afterPrice = Number.parseFloat(resp.data.data.itemendprice);
that.log('================>获取优惠券成功: 金额 ' + couponMoney);
resolve({itemId: itemId, couponMoney: couponMoney, afterPrice: afterPrice});
} else {
that.log('================>该商品没有优惠券');
reject('');
}
},
});
})
},
goodsId: function (channel, goodsId) {
return `https://server.bwaq.cn/tbk/api/goods/purchase/rates?fromPlugin=true&channel=${channel}&goodsId=${goodsId}`
},
goodsUrl: function (channel, goodsUrl) {
return `https://server.bwaq.cn/tbk/api/goods/purchase/rates?fromPlugin=true&channel=${channel}&goodsUrl=${goodsUrl}`
},
goodsSearch: function (channel, goodsName) {
let sort = 0;
if (channel === 'pdd') {
sort = 6;
} else if (channel === 'jd') {
sort = 4;
} else {
sort = 2;//tb
}
return `https://server.bwaq.cn/tbk/api/goods/search/keyword?fromPlugin=true&channel=${channel}&keyword=${goodsName}&pageIndex=1&sort=${sort}`
},
translateUrl: function (text) {
return `https://server.bwaq.cn/tbk/api/english/translate?fromPlugin=true&kw=${text}`
},
bookTypeUrl: function () {
return 'https://server.bwaq.cn/tbk/api/bookType/getListBySort?fromPlugin=true&category=1'
},
bookMarkUrl: function (idListStr) {
return `https://server.bwaq.cn/tbk/api/bookMark/getListBySort?fromPlugin=true&typeIds=${idListStr}`
},
qrcodeConfigUrl: function () {
return `https://server.bwaq.cn/tbk/api/qrcodeConfig/list?fromPlugin=true`
},
systemConfigUrl: function (requestField) {
return `https://server.bwaq.cn/tbk/api/config/systemConfig/item?fromPlugin=true&requestField=${requestField}`
},
goodsSearchAllPlatform: function (goodsName) {
return `https://server.bwaq.cn/tbk/api/goods/search/platformAll?fromPlugin=true&keyword=${goodsName}`
},
ipSearchUrl: function () {
let host = this.getHost(location.href);
return 'https://server.bwaq.cn/tbk/api/ipTrack/insert?originUrl=' + encodeURIComponent(host)
},
getHost: function (url) {
url = url.match(/https?:\/\/([^/]+)\//i);
let domain = '';
if (url && url[1]) {
domain = url[1];
}
this.log('==========>url: ' + url + ' domain: ' + domain);
return domain
},
clickEventUrl: function (event) {
let host = this.getHost(location.href);
let requestUrl = `https://server.bwaq.cn/tbk/api/ipTrack/insertEvent?event=${event}&originUrl=${encodeURIComponent(host)}`;
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
},
});
},
};
let removeDataSet = new Array();
var evalCopy = eval;
var Utils$2 = {
/**
* @param exeTag - Execute Type: 'id' => Use document.getElementById() to remove
* @param exeTag - Execute Type: 'selector' => Use document.querySelector() to remove
* @param exeTag - Execute Type: 'class' => Use document.getElementsByClassName() to remove
* @param exeTag - Execute Type: 'cssClick' => css click event
* @param exeTag - Execute Type: 'tag' => Use document.getElementsByTagName() to remove
* @param exeTag - Execute Type: 'exe' => Use eval to execute the code
*
* @param exeData - Data container of exeTag execute type
*
* @param exeType - (>0) => Only x Times execute the data
* @param exeType - (-1) => Interval execute the data for interval 500ms
*/
addData: function (exeTag, exeData, exeType) {
let len = this.appendArray(removeDataSet);
removeDataSet[len][0] = exeTag;
removeDataSet[len][1] = exeData;
removeDataSet[len][2] = exeType;
},
appendArray: function (ary) {
ary.splice(ary.length, 0, []);
return ary.length - 1;
},
execute: function (timeout) {
if (typeof timeout == 'undefined') {
timeout = 500;
}
removeDataSet.forEach(removeItem => {
let excuteTimes = removeItem[2];
if (excuteTimes < 0) {
//循环执行
setInterval(() => {
this.nomalExecute(removeItem);
}, timeout);
} else if (excuteTimes > 0) {
//执行指定的次数
let times = 0;
let timer = setInterval(() => {
times++;
if (times > excuteTimes) {
clearInterval(timer);
}
this.nomalExecute(removeItem);
}, timeout);
} else ;
});
},
nomalExecute: function (removeItem) {
GUtils.log('checking...');
let exeTag = removeItem[0]; //Execute Type
let exeData = removeItem[1]; //Data container of Execute type
switch (exeTag) {
case 'auto'://通过前面的前缀判断
exeData.forEach(item => {
if (item.startsWith("#")) {
this.removeId(item.substring(1));
} else if (item.startsWith(".")) {
this.removeClass(item.substring(1));
}
});
break;
case 'id':
exeData.forEach(item => {
this.removeId(item);
});
break;
case 'class':
exeData.forEach(item => {
this.removeClass(item);
});
break;
case 'selector':
exeData.forEach(item => {
this.removePath(item);
});
break;
case 'tag':
exeData.forEach(item => {
this.removeTag(item);
});
break;
case 'click':
exeData.forEach(item => {
this.performClick(item);
});
break;
case 'invoke':
exeData.forEach(item => {
this.invokeMethod(item);
});
break;
}
},
removeId: function (id) {
if (document.getElementById(id) == null) {
return;
}
document.getElementById(id).remove();
GUtils.log('removing...');
},
removeClass: function (className) {
let times = 0;
while (document.getElementsByClassName(className).length > 0) {
times++;
//限制执行次数
if (times > 100) {
break;
}
document.getElementsByClassName(className)[0].remove();
GUtils.log('removing...');
}
},
removeTag: function (tag) {
let times = 0;
while (document.getElementsByTagName(tag).length > 0) {
times++;
//限制执行次数
if (times > 100) {
break;
}
document.getElementsByTagName(tag)[0].remove();
GUtils.log('removing...');
}
},
removePath: function (path) {
if (document.querySelector(path) == null) {
return;
}
document.querySelector(path).remove();
GUtils.log('removing...');
},
performClick: function (item) {
let elements = document.getElementsByClassName(item[0]);
if (elements.length > item[1]) {
elements[item[1]].click();
}
},
invokeMethod: function (methodName) {
evalCopy(methodName);
}
};
let regexStr$Z = [
{url: 'so.com', linkType: 'contains'},
{url: '360kan.com', linkType: 'contains'}
];
const website$$ = {
interceptor: function () {
return GUtils.interceptor(regexStr$Z)
},
setRunType: function (val) {
},
init: function ($j) {
let cycle = 500;// 检测广告的刷新时间
// 360搜索
if (location.href.indexOf('www.so.com') !== -1) {
Utils$2.addData('auto',
[
'.sad',
'.lawnfooter-image__panel',
'#side',
'#m-spread-left',
'.m-spread-middle',
'#m-spread-bottom',
'.res-mediav',
'#news-sdk-sad',
'.mh-ad',
'#e_idea_pp',
], -1);
Utils$2.addData('selector',
[
'[data-i=\'tmall\']',
'div[id*=\'--strong\']',
'div[id*=\'--normal\']',
], -1);
Utils$2.execute(cycle);
}
// 360资讯
if (location.href.indexOf('news.so.com') !== -1) {
Utils$2.addData('auto', [
'#side',
'.js-multi-i-item',
'.info-flow',
], -1);
Utils$2.execute(cycle);
}
// 360问答
if (location.href.indexOf('wenda.so.com') !== -1) {
Utils$2.addData('auto', [
'.aside',
'#js-mod-fixed-float',
'.js-left-flow-busi',
'#attention',
'#guess-see',
'#e_idea_wenda_leftBox',
'.js-busi-item',
'.js-ajax-busi-item',
'#detail-guess-wrap',
'.js-mod-flow',
], -1);
Utils$2.execute(cycle);
}
// 360视频
if (location.href.indexOf('360kan.com') !== -1) {
Utils$2.addData('auto', ['.rt-btm-popup_ad',
'.info-flow__ad',
'.p-searchad-wrap',
'#soRightAd',
'.adbig',
], -1);
Utils$2.addData('selector', [
'[data-adclicklog]',
'[data-so-mod=\'list-ad\']',
], -1);
Utils$2.execute(cycle);
}
// 360图片
if (location.href.indexOf('image.so.com') !== -1) {
Utils$2.addData('selector', [
'[data-id*=\'cm_extended_init\']',
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j('.related_query').parent().remove();
}, cycle);
}
// 360良医
if (location.href.indexOf('ly.so.com') !== -1) {
Utils$2.addData('auto', [
'#so_ob',
'#news-card',
'#m-spread-left',
], -1);
Utils$2.execute(cycle);
}
// 360地图
if (location.href.indexOf('ditu.so.com') !== -1) {
Utils$2.addData('selector', [
'[data-e_href]',
], -1);
Utils$2.execute(cycle);
}
// 360百科
if (location.href.indexOf('baike.so.com/search') !== -1) {
Utils$2.addData('auto', [
'.aside',
'#e_idea_wenda_leftBox',
], -1);
Utils$2.addData('selector', [
'div[id*=\'mvdiv\']',
], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('baike.so.com/doc') !== -1) {
Utils$2.addData('auto', [
'#js-mod-fixed-float',
'.js-newsfeed-popup',
'#J-mod-right-recommend',
'#J-mod-hot-rank',
'#rightbanner',
'#J-mod-interested-possible',
'.entry-plus',
'#js-doc-recommand',
], -1);
Utils$2.addData('selector', [
'div[id*=\'J-mod-right-ad\']',
], -1);
Utils$2.execute(cycle);
}
// 360国学
if (location.href.indexOf('guoxue.baike.so.com') !== -1) {
Utils$2.addData('auto', [
'.right',
'.js-newsfeed-popup',
'#js-doc-recommand',
'.lm-bottom-container',
'#J-entry-newsfeed-bottom',
'#interest-wrap',
], -1);
Utils$2.execute(cycle);
}
// 360文库
if (location.href.indexOf('wenku.so.com/s') !== -1) {
Utils$2.addData('auto', [
'.rt-side',
'#e_idea_wenda_leftBox',
], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('wenku.so.com/d') !== -1) {
Utils$2.addData('auto', [
'.js-page-busi',
'#interest',
'.infoFlow',
'.fixed-rtbot',
'#js-fixed-rt',
], -1);
Utils$2.addData('selector', [
'[data-so-mod=\'right_flow\']',
], -1);
Utils$2.execute(cycle);
}
// 360翻译
if (location.href.indexOf('fanyi.so.com') !== -1) {
Utils$2.addData('auto', [
'#card_container',
], -1);
Utils$2.execute(cycle);
}
},
};
let regexStr$Y = [
{url: 'baidu.com', linkType: 'contains'}
];
const website$_ = {
interceptor: function () {
return GUtils.interceptor(regexStr$Y)
},
setRunType: function (val) {
},
init: function ($j) {
let cycle = 500;// 检测广告的刷新时间
// 百度搜索
if (location.href.indexOf('www.baidu.com') !== -1) {
Utils$2.addData('auto', [
"#content_right",
"#top-ad",
".ec-pl-container",
], 1);
Utils$2.execute(200);
setInterval(function () {
$j("#content_left > div").each(function () {
if ($j(this).attr('id') === 'undefined'
&& $j('> style', this).attr('id') !== 'undefined') {
$j(this).remove();
}
});
if ($j(".s-tab-item").css("color") === "rgb(255, 255, 255)") {
// 防止导航栏出现白色
$j(".cur-tab").css("color", "black");
$j(".s-tab-item").css("color", "gray");
}
$j("#content_left > div").each(function () {
if ($j(this).attr('id') === 'undefined' && $j('> div', this).attr('data-placeid') !== 'undefined') {
$j(this).remove();
}
});
$j("a").each(function () {
if ($j(this)[0].innerHTML === '广告') {
$j(this).parents(".result").remove();
}
});
$j(".san-card").each(function () {
if ($j(this).attr("tpl") === 'feed-ad') {
$j(this).remove();
}
});
}, 200);
}
// 百度知道
if (location.href.indexOf('zhidao.baidu.com') !== -1) {
Utils$2.addData('auto', [
".shop-entrance",
".activity-entry",
".task-list-button",
], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('zhidao.baidu.com/search') !== -1) {
Utils$2.addData('auto', [
".leftup",
".wgt-iknow-special-business",
".aside.fixheight",
], 1);
Utils$2.addData('auto', [
".bannerdown",
".wgt-bottom-ask",
], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('zhidao.baidu.com/question') !== -1) {
Utils$2.addData('auto', [
".adTopImg",
".exp-topwld-tip",
"#wgt-ecom-banner",
"#wgt-ecom-right",
".question-number-text-chain",
".grid-r.qb-side",
".wgt-ads",
".wgt-bottom-union",
".ec-pc_mat_coeus__related_link_text-content",
".businessvip-wrapper",
".new-icon",
".phone-icon",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j("#answer-bar").removeClass("exp-answerbtn-yh");
}, cycle);
}
// 百度百科
if (location.href.indexOf('baike.baidu.com') !== -1) {
Utils$2.addData('auto', [
"#navbarAdNew",
".userbar_mall",
], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('baike.baidu.com/item') !== -1) {
Utils$2.addData('auto', [
".pinzhuanWrap",
".configModuleBanner",
".topA",
".right-ad",
".lemmaWgt-promotion-vbaike",
".lemmaWgt-promotion-slide",
"#side_box_unionAd",
".after-content",
], -1);
Utils$2.execute(cycle);
}
// 百度文库
if (location.href.indexOf('wenku.baidu.com') !== -1) {
Utils$2.addData('auto', [
".tiger-lossUser-dialog-vip",
".banner-ad",
".ad-box",
"#banurl",
".vip-card",
".zsj-topbar",
".lastcell-dialog",
".zsj-toppos",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j("#my-wkHome-vip-tips").parent().remove();
}, cycle);
}
if (location.href.indexOf('wenku.baidu.com/search') !== -1) {
Utils$2.addData('auto', [
".fc-product-result-wrap",
".fc-first-result-wrap",
".bottom-right-dsp-ad-wrap",
], -1);
Utils$2.addData('auto', [
".user-vip",
".base-layout-content-right",
".vip-guide-test",
], 1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('wenku.baidu.com/view') !== -1) {
Utils$2.addData('auto', [
".pager-container",
".add-has-money-pay",
".experience-card-wrap",
".experience-card-bar-wrap",
".join-vip",
".vip-card-wrap",
".vip-pop-wrap",
".vip-activity-wrap",
".fold-page-tip",
".hx-warp",
".convert-tip",
".new-user-discount-tip",
".top-ads-banner-wrap",
".banner-core-wrap.super-vip",
".vip-layer-inner",
".vip-activity-wrap-new",
".vip-pay-pop-v2-wrap",
".zhenxuan-guide",
".fufei-activity-bar",
".qua-box",
".service-entry",
".relative-doc-ad-wrapper",
".ad-onff",
".second-ad",
".relative-course-wrapper",
".hx-right-wrapper",
".extension",
".reader-extensin",
".pc-common-sidebar",
".vip-privilege-card-wrap",
".woniu-guide-card",
".hx-recom-wrapper",
".hx-bottom-wrapper",
"#relative-videos-wrap",
".bottom-pop-wrap",
".inner-vip",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j("#ggbtm").parent().remove();
$j("#ggbtm-ads").parent().remove();
$j(".union-ad-bottom").parent().remove();
}, cycle);
}
// 百度图片
if (location.href.indexOf('image.baidu.com/search/index') !== -1) {
Utils$2.addData('auto', [
".newfcImgli"
], -1);
Utils$2.addData('auto', [
"#pnlBeforeContent",
".adMask",
], 1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('image.baidu.com/search/detail') !== -1) {
Utils$2.addData('auto', [
".text-link-ads",
".rsresult-card",
"#adCard",
], -1);
Utils$2.execute(cycle);
}
// 百度视频
if (location.href.indexOf('video.baidu.com') !== -1 || location.href.indexOf('v.baidu.com') !== -1) {
Utils$2.addData('auto', [
"#pallcommoncolumnad",
"#index_right_top",
"#qzfcadid",
"#PCallpagesidebar1",
"#PCallpagesidebar2",
"#sidebarADRightWrap",
"#detail_adm_right",
"#pcshortchannelTopRight",
"#topic-wrap-v2",
".ctt-adver1-banner",
".section-ad",
".full-collunm-ad",
], -1);
Utils$2.addData('selector', [
"div[id*='channelBannerAdver']",
"div[id*='PCDetailPageTopRightList']",
"div[id*='adone']",
"div[id*='adtwo']",
"div[id*='pc']",
"div[id*='PC']",
"[id*='FeedAdSys']",
"div[id*='TabAd']",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j(".bdvideo-adver-carousel").parent().remove();
$j("#__lawnImageContainer").parent().parent().remove();
$j("div[id*='channelColumn']").parent().remove();
$j("div[id*='ChannelColumn']").parent().remove();
$j("div[id*='adv-carousel-item']").parent().remove();
}, cycle);
}
if (location.href.indexOf('video.baidu.com/v') !== -1
|| location.href.indexOf('v.baidu.com/v') !== -1) {
Utils$2.addData('auto', [
".side-content",
"#searchPagefeedBanner",
"#searchResultAdOne",
"#searchHotShortSeven",
"#searchHotShortSevenTwo",
], -1);
Utils$2.addData('selector', [
"div[id*='searchMoreLong']",
], -1);
Utils$2.execute(cycle);
$j(".top-ad-cont").remove();
setInterval(function () {
$j("#psBottomColumn").parent().remove();
}, cycle);
}
if (location.href.indexOf('www.baidu.com/sf/vsearch') !== -1) {
$j("#s_tab").next().next().each(function () {
let id = String($j(this).attr("id"));
if (typeof id === 'undefined') {
$j(this).remove();
}
});
}
// 百度贴吧
if (location.href.indexOf('tieba.baidu.com/f/search') !== -1) {
Utils$2.addData('auto', [
".s_aside",], 1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('tieba.baidu.com/f?') !== -1) {
Utils$2.addData('auto', [
".fengchao-wrap-feed",
".tb_poster_placeholder",
"#lu-frs-aside",
"#lu-frs-aside-seat",
], -1);
Utils$2.addData('selector', [
"div[id$='_ad']",], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('tieba.baidu.com/p') !== -1) {
Utils$2.addData('auto', [
".tb_poster_placeholder",
], -1);
Utils$2.execute(cycle);
$j("#j_p_postlist").find("div").each(function () {
let isAd = String($j(this).attr("ad-dom-img"));
if (isAd === "true") {
$j(this).remove();
}
});
}
// 百度地图
if (location.href.indexOf('map.baidu.com') !== -1) {
Utils$2.addData('auto', [
"#activity-banner-panel",
".damoce-search-item",
], -1);
Utils$2.execute(cycle);
}
// 百度经验
if (location.href.indexOf('jingyan.baidu.com/search') !== -1) {
$j(".ec_ad").parent().remove();
}
if (location.href.indexOf('jingyan.baidu.com/article') !== -1) {
Utils$2.addData('auto', [
"#fresh-share-exp-e",
".wgt-income-money",
".aside-pro-container",
"#bottom-ads-container",
".magzine-list",
"#wgt-left-promo",
".right-fixed-related-wrap",
"#task-panel-wrap",
"#aside-ads-container",
".wgt-cms-banner",
".bottom-pic-ads",
], 1);
Utils$2.execute(cycle);
}
// 百度翻译
if (location.href.indexOf('fanyi.baidu.com') !== -1) {
Utils$2.addData('auto', [
"#sideAdContainer",
".spread-wrap",
"#sideBannerContainer",
], 1);
Utils$2.execute(cycle);
}
// 百度网盘
if (location.href.indexOf('pan.baidu.com') !== -1) {
Utils$2.addData('selector', [
"[node-type=header-union]",
], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('pan.baidu.com/share/') !== -1) {
Utils$2.addData('auto', [
".phone-banner",
], -1);
Utils$2.execute(cycle);
}
if (location.href.indexOf('pan.baidu.com/s/') !== -1) {
Utils$2.addData('auto', [
"#web-right-view",
".ad-platform-tips",
".btn-img-tips",
], 1);
Utils$2.addData('auto', [
".rights-section",
".bottom-tip-bar",
], -1);
Utils$2.execute(cycle);
}
}
};
let regexStr$X = [];
const website$Z = {
interceptor: function () {
return GUtils.interceptor(regexStr$X)
},
setRunType: function (val) {
},
init: function ($j) {
let cycle = 500;// 检测广告的刷新时间
// hao123
if (location.href.indexOf('hao123.com') !== -1) {
Utils$2.addData('auto', [
"#topbeWrapper",
"#lefttip",
".rightTip",
"#box-famous-resource",
".bottom-banner-link-wrapper",
".wm",
], -1);
Utils$2.execute(cycle);
}
// 2345网址导航
if (location.href.indexOf('2345.com') !== -1) {
Utils$2.addData('auto', [
".tip_stopXP",
"#corner_a",
"#mzBrowserWrap",
"#J_s11_logowall_left",
"#J_s11_logowall_right",
"#J_gul_yg",
"#map_shop",
".ad-wrap",
"#J_hot_event",
"#rightXieCheng",
"#J_right_bottom_ad",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j("h3:contains('发现你喜欢')").parent().parent().parent().remove();
$j(".adTag").parents(".slide-item").remove();
}, cycle);
}
// 360导航
if (location.href.indexOf('hao.360') !== -1) {
Utils$2.addData('auto', [
"#corner-flash",
"#daily-hotwords",
"#hotsite-view-front",
"#activity",
".pubble-shape-wrap",
"#large2small",
".js-mv-infoflow-item",
], -1);
Utils$2.addData('selector', [
"a[class*='mediav-ads']",
"li[notice-ad = 'true']",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j(".notice-panel-count").text("(2)");
$j("h3:contains('发现你喜欢')").parent().parent().remove();
$j(".ad").parent().remove();
$j(".textlink_ad_icon").parent().remove();
$j(".adMark").parents(".cube-mod").remove();
$j(".ads-img").parents(".right-content").remove();
}, cycle);
}
// 搜狗网址导航、QQ导航(上网导航)
if (location.href.indexOf('123.sogou.com') !== -1 ||
location.href.indexOf('hao.qq.com') !== -1 ||
location.href.indexOf('daohang.qq.com') !== -1) {
Utils$2.addData('auto', [
".hd-slider",
".cs_right_hw",
".ads",
".banner-ad",
".adword",
".tmallskin",
"#wrap",
], -1);
Utils$2.addData('selector', [
"div[id*='AD']",
"ul[pbflag='top3ad'] li:eq(0)",
"div[pbflag='guess']",
"div[pbflag='rec_shop']",
"div[pbflag='coolsitefeed_ad']",
"div[pbflag='bt_newsb_ad']",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j("#sdtom").parent().remove();
$j("div[pbflag='bt_baike']").parent().remove();
$j("div[pbflag='bt_mai']").parent().remove();
}, cycle);
}
// UC导航
if (location.href.indexOf('uc123.com') !== -1) {
Utils$2.addData('auto', [
".header-push-container",
".s-push-box",
".m-links",
".side-hot",
".cool",
"#J_shopping",
"#J_shopping",
], -1);
Utils$2.execute(cycle);
}
// 毒霸网址大全
if (location.href.indexOf('duba.com') !== -1 ||
location.href.indexOf('newduba.cn') !== -1) {
Utils$2.addData('auto', [
"#__lawnImageContainer",
".skin_bg",
".m_site_ad_wrap",
".m_elevator.elevator_hidden",
".m_rec_game",
"#js-ysjpp",
"#J_sideFooter",
".rtcenter_game.jq_rtcenter_game",
".fav_box_wrap",
".side_game",
".side_taobao",
".left_ad_collection",
".jqrp_infoflow_ad",
".top_func_ad",
".fav_box",
".taobao_search",
".sort_wm",
".sort_line",
".box_shopping",
".box_happy",
".tj_ul",
".newslist > div",
".mediavAd",
], -1);
Utils$2.addData('selector', [
"div[opname='w_search_right_ad']",
], -1);
Utils$2.execute(cycle);
setInterval(function () {
$j("#top_ad_tmall_ul").parent().remove();
$j(".ads-tag").parent().parent().parent().remove();
$j(".adTag").parents(".swiper-slide").remove();
}, cycle);
}
}
};
let regexStr$W = [
{url: 'zhihu.com', linkType: 'contains'}
];
const website$Y = {
interceptor: function () {
return GUtils.interceptor(regexStr$W)
},
setRunType: function (val) {
},
init: function ($j) {
let cycle = 500;// 检测广告的刷新时间
// 知乎去广告
setInterval(function () {
//==============屏蔽知乎广告==============
$j(".Pc-feedAd-container").each(function () {
if ($j(this).find(".Pc-feedAd").length > 0) {
$j(this).remove();
}
});
//==============屏蔽知乎广告==============
let story = $j(".KfeCollection-PaidAnswerFooter");
if (story.length > 0) {
story.parent().parent().parent()[0].innerText = "付费答案";
}
}, cycle);
//==============屏蔽知乎营销号==============
Utils$2.addData('selector', [
"[data-zop*='\"authorName\":\"故事档案局\"']",
"[data-zop*='\"authorName\":\"盐选科普\"']",
"[data-zop*='\"authorName\":\"盐选推荐\"']",
"[href*='www.zhihu.com/market']",
"[href*='www.zhihu.com/pub/reader']",
], 1);
Utils$2.execute(cycle);
//==============屏蔽知乎营销号==============
}
};
let regexStr$V = [
{url: 'jianshu.com/p', linkType: 'contains'}
];
const website$X = {
interceptor: function () {
return GUtils.interceptor(regexStr$V)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let cycle = 500;
Utils$2.addData('selector', [
'#__next > div > div > aside > div',
'#__next > div > div > div._gp-ck > section:nth-child(2)',
], 1);
Utils$2.execute(cycle);
});
},
};
const modules$9 = [website$$, website$_, website$Z, website$Y, website$X];
const prepare$9 = {
init: function ($j, runType) {
if (GUtils.inIframe()) {
return
}
for (let i = 0; i < modules$9.length; i++) {
let module = modules$9[i];
if (module.interceptor()) {
continue;
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
}
};
let regexStr$U = [
{url: 'iqiyi.com', linkType: 'startWith'}
];
const website$W = {
interceptor: function () {
return GUtils.interceptor(regexStr$U)
},
setRunType: function (val) {
},
init: function ($j) {
if (location.href.indexOf('www.iqiyi.com') !== -1 || location.href.indexOf('sports.iqiyi.com') !== -1) {
GUtils.log("爱奇艺广告屏蔽");
setInterval(() => {
var skipView = $j('.skippable-after')[0];
if (skipView) {
// 防止无限弹窗
if (skipView.href === 'javascript:;' && skipView.style.display === 'none') {
skipView.click();
}
}
}, 1000);
} else if (location.href.indexOf('sports.iqiyi.com') !== -1) {
// 爱奇艺体育的广告按钮改了 所以可以使用上面的代码进行屏蔽,此段代码保留一段时间
GUtils.log("爱奇艺体育广告屏蔽");
setInterval(() => {
let container = $j('#engine-container');
let videos = $j('video');
if (videos && container
&& container.style['pointer-events'] === 'auto'
&& container.style['cursor'] === 'pointer') {
for (let video of videos) {
video.currentTime = 1000;
}
}
}, 1000);
}
},
};
const common$1 = {
generic: function ($j) {
setInterval(() => {
let skip = $j('body').find('video');
if (skip && skip.get()) {
for (let video of skip.get()) {
let attrSrc = $j(video).attr('src');
if (attrSrc && !attrSrc.startsWith('blob:')) {
video.currentTime = 1000;
}
}
}
}, 1000);
}
};
let regexStr$T = [
{url: 'v.youku.com', linkType: 'startWith'}
];
const website$V = {
interceptor: function () {
return GUtils.interceptor(regexStr$T)
},
setRunType: function (val) {
},
init: function ($j) {
common$1.generic($j);
},
};
let regexStr$S = [
{url: 'mgtv.com', linkType: 'startWith'}
];
const website$U = {
interceptor: function () {
return GUtils.interceptor(regexStr$S)
},
setRunType: function (val) {
},
init: function ($j) {
common$1.generic($j);
}
};
let regexStr$R = [
{url: 'tv.sohu.com', linkType: 'startWith'}
];
const website$T = {
interceptor: function () {
return GUtils.interceptor(regexStr$R)
},
setRunType: function (val) {
},
init: function ($j) {
common$1.generic($j);
}
};
let regexStr$Q = [
{url: 'v.pptv.com', linkType: 'startWith'}
];
const website$S = {
interceptor: function () {
return GUtils.interceptor(regexStr$Q)
},
setRunType: function (val) {
},
init: function ($j) {
common$1.generic($j);
},
};
let regexStr$P = [
{url: 'v.qq.com', linkType: 'startWith'}
];
const website$R = {
interceptor: function () {
return GUtils.interceptor(regexStr$P)
},
setRunType: function (val) {
},
init: function ($j) {
common$1.generic($j);
}
};
let regexStr$O = [
{url: 'tv.cctv.com', linkType: 'startWith'}
];
const website$Q = {
interceptor: function () {
return GUtils.interceptor(regexStr$O)
},
setRunType: function (val) {
},
init: function ($j) {
setInterval(() => {
if ($j('#ticktack_player')) {
let videos = $j('video');
if (videos) {
// 存在广告
for (let video of videos) {
video.currentTime = 1000;
}
}
}
}, 1000);
}
};
let regexStr$N = [
{url: 'youtube.com', linkType: 'startWith'}
];
const website$P = {
interceptor: function () {
return GUtils.interceptor(regexStr$N)
},
setRunType: function (val) {
},
init: function ($j) {
getStart();
}
};
function getStart() {
var closeAd = function () {
let css = '.video-ads,.video-ads .ad-container .adDisplay,#player-ads,.ytp-ad-module,.ytp-ad-image-overlay{ display: none!important; }';
let head = document.head || document.getElementsByTagName('head')[0];
let style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
};
var skipInt;
var skipAd = function () {
var skipbtn = document.querySelector('.ytp-ad-skip-button.ytp-button') || document.querySelector('.videoAdUiSkipButton ');
if (skipbtn) {
skipbtn = document.querySelector('.ytp-ad-skip-button.ytp-button') || document.querySelector('.videoAdUiSkipButton ');
GUtils.log('skip');
skipbtn.click();
if (skipInt) {
clearTimeout(skipInt);
}
skipInt = setTimeout(skipAd, 500);
} else {
GUtils.log('checking...');
if (skipInt) {
clearTimeout(skipInt);
}
skipInt = setTimeout(skipAd, 500);
}
};
closeAd();
skipAd();
}
const modules$8 = [website$W, website$V, website$R, website$U, website$T, website$S, website$Q, website$P];
const prepare$8 = {
init: function ($j, runType) {
for (let i = 0; i < modules$8.length; i++) {
let module = modules$8[i];
if (module.interceptor()) {
continue;
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
}
};
let regexStr$M = [
{url: 'baidu.com/', linkType: 'startWith'},
];
var blockUrl = ['https://download.csdn.net/'];
var blockColor = 'linear-gradient(to bottom, #ffc4ba, #ffffeb)';
var adColor = 'linear-gradient(to bottom, #ff8168, #ff8168, #fff4f3)';
const website$O = {
interceptor: function () {
return GUtils.interceptor(regexStr$M)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
setInterval(function () {
doQuerySelect($j);
}, 1000);
doQuerySelect($j);
});
function doQuerySelect($j) {
let domList = $j('#content_left > div');
for (let dom of domList) {
if (dom.getAttribute('redirectUrlParsed')) {
continue
}
dom.setAttribute('redirectUrlParsed', '1');
let selectView = $j(dom);
let realUrl = selectView.attr('mu');
GUtils.log('realUrl', realUrl);
if (realUrl && realUrl.length !== '') {
//链接还原
let linkTag = selectView.find('div > h3').find('a');
linkTag.attr('href', realUrl);
//网址标红
if (GUtils.itemIndexOfIn(realUrl, blockUrl)) {
selectView.css('background-image', blockColor);
selectView.css('border-radius', '4px');
}
}
}
for (let dom of domList) {
if (dom.getAttribute('advertiseFlag')) {
continue
}
dom.setAttribute('advertiseFlag', '1');
let selectView = $j(dom);
let adTag = selectView.find('span.c-gap-left,span.c-color-gray');
if (adTag && adTag.length) {
let text = adTag.text().trim() || '';
if (text === '惠生活') {
let rendView = selectView.find('div.c-border');
rendView.css('background-image', adColor);
rendView.css('border-radius', '4px');
} else {
let newText = text.replace(/广告/g, '');
if (newText === '' && text !== '') {//会出现多个‘广告’的字符
selectView.css('background-image', adColor);
selectView.css('border-radius', '4px');
}
}
}
if (selectView.find('h3.c-title > span.c-title-text').text().indexOf('百度健康') > -1
&& selectView.find('div.f13 > a.c-showurl').text() === 'expert.baidu.com/') {
//网址标红
selectView.css('background-image', blockColor);
selectView.css('border-radius', '4px');
}
}
}
},
};
const modules$7 = [website$O];
const prepare$7 = {
init: function ($j, runType) {
for (let i = 0; i < modules$7.length; i++) {
let module = modules$7[i];
if (module.interceptor()) {
continue;
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
}
};
/*这里的ID若改变记得同步到optimize-search中,否则会导致设置模块失效*/
let idQrcodeContent$2 = 'maga-qrcode-dialog';
let idQrcodeContentClose = 'maga-qrcode-dialog-close';
let idQrcodeContentContent = 'maga-qrcode-dialog-qrcode';
let idQrcodeContentHint = 'maga-qrcode-dialog-hint';
var QRCode = {
init: function ($j) {
// 按住CTRL键,右击图片或超级链接,即可查看该图片或链接的地址的二维码;
$j(document).contextmenu(function (e) {
if (e.ctrlKey) {
let target = e.target;
GUtils.log('tagName', target.tagName);
//找出选中的内容是否存在超链接
if (!/^(a|img)$/i.test(target.tagName)) {
while (!/^(body|html)$/i.test(target.tagName)) {
target = target.parentNode;
if (/^(a|img)$/i.test(target.tagName)) {
break
}
}
}
if (checkUrl(target.href)) {
if (target.tagName === 'A') {
this.generateQRCode($j, target.href);
} else if (target.tagName === 'IMG') {
this.generateQRCode($j, target.src);
}
}
}
});
$j(document).keyup(function (e) {
GUtils.log('e.key', e.key);
if (e.key === 'Escape') {
if ($j(`#${idQrcodeContent$2}`).length === 0) {
return
}
// ESC关闭二维码弹窗
$j(`#${idQrcodeContent$2}`).css('display', 'none');
} else if (e.ctrlKey && e.key === 'q') {
// 划词按Ctrl + Q 转化为二维码
let selectText = GUtils.getSelect() || location.href;
this.generateQRCode($j, selectText);
$j(`#${idQrcodeContent$2}`).css('display', 'flex');
}
});
},
generateQRCode: function ($j, qrcodeText) {
if ($j(`#${idQrcodeContent$2}`).length === 0) {
let html = `<div id='${idQrcodeContent$2}'>
<span id='${idQrcodeContentClose}' style="cursor: pointer"> ✕ </span>
<img id='${idQrcodeContentContent}'></img>
<span id='${idQrcodeContentHint}'>请用手机扫描二维码</span>
</div>`;
$j('body').append(html);
$j(`#${idQrcodeContentClose}`).click(function () {
$j(`#${idQrcodeContent$2}`).css('display', 'none');
});
}
let qrcodeUrl = GUtils.urlQrCode(encodeURIComponent(qrcodeText));
$j(`#${idQrcodeContentContent}`).attr('src', qrcodeUrl);
$j(`#${idQrcodeContent$2}`).css('display', 'flex');
GUtils.log('qrcodeText', qrcodeText);
},
};
function checkUrl(string) {
return /^(https?:)?\/\/(\S+\.)+\S{2,}$/i.test(string)
}
let regexStr$L = [
{url: 'list.tmall.com', linkType: 'startWith'},
{url: 'list.tmall.hk', linkType: 'startWith'},
{url: 's.taobao.com', linkType: 'startWith'},
{url: 'maiyao.liangxinyao.com/category', linkType: 'startWith'},
{url: 'search.jd.com/Search', linkType: 'startWith'},
{url: 'chaoshi.detail.tmall.com/item.htm', linkType: 'startWith'},
{url: 'taobao.com', linkType: 'startWith'},
{url: 'world.taobao.com', linkType: 'startWith'},
{url: 'detail.tmall.com', linkType: 'startWith'},
{url: 'detail.tmall.hk', linkType: 'startWith'},
{url: 'item.taobao.com', linkType: 'startWith'},
{url: 'detail.liangxinyao.com', linkType: 'startWith'},
{url: 'tmall.com', linkType: 'startWith'},
{url: 'item.jd.com', linkType: 'startWith'},
{url: 'item.yiyaojd.com', linkType: 'startWith'},
];
let idQrcodeContent$1 = 'maga-qrcode-dialog';
let RegexJdSearch = [
'search.jd.com/Search',
];
let RegexJdDetail = [
'item.jd.com',
'item.yiyaojd.com',
];
let RegexTmallSearch = [
'tmall.com',
];
let RegexTmallChaoShi = [
'chaoshi.detail.tmall.com/item.htm',
];
let RegexTaobaoListOrSearch = [
's.taobao.com/search',
's.taobao.com/list',
'taobao.com',
'world.taobao.com',
];
let RegexTmallMedicineCategory = [
'maiyao.liangxinyao.com/category.htm',
'maiyao.liangxinyao.com/category-',
];
let RegexTaobaoDetail = [
'item.taobao.com',
];
let RegexTmallDetail = [
'detail.tmall.com',
'detail.tmall.hk',
];
let RegexTmallMedicineDetail = [
'detail.liangxinyao.com',
];
const website$N = {
interceptor: function () {
return GUtils.interceptor(regexStr$L)
},
setRunType: function (val) {
},
init: function ($j) {
let objs = {};
let channel = '';
let selectConfig = [];
if (GUtils.hrefIndexOfIn(RegexTaobaoListOrSearch)) {
channel = 'tbk';
selectConfig.push({
selector: 'div[class^=\'Content--contentInner--\'] > div > a',
selectType: 's.taobao.com/search',
});
selectConfig.push({
selector: 'div.m-itemlist > div > div:nth-child(1) div.pic > a',
selectType: 's.taobao.com/list',
});
selectConfig.push({
selector: 'div[class=\'rax-view list\'] > a',
selectType: 'word.taobao.com',
});
selectConfig.push({
selector: 'div.tb-pick-feeds-container > div.tb-pick-content-item > a.item-link',
selectType: 'taobao.com',
});
} else if (GUtils.hrefIndexOfIn(RegexTmallChaoShi)) {
selectConfig.push({
selector: 'div[class^=\'Recommend--recommend--\'] > a',
selectType: 'list',
});
} else if (GUtils.hrefIndexOfIn(RegexTmallSearch)) {
channel = 'tbk';
selectConfig.push({
selector: 'div[class^=\'rax-view-v2 FloorModule--tmcsContentItem--\']',
selectType: 'tmall-chaoshi',
});
selectConfig.push({
selector: 'div[class^=\'rax-view-v2 FloorModule--tmgjContentItem--\']',
selectType: 'tmall-guoji',
});
selectConfig.push({
selector: 'div[class^=\'rax-view-v2 Wonderful--WonderfulItem--\']',
selectType: 'tmall-cainixihuan',
});
} else if (GUtils.hrefIndexOfIn(RegexTmallMedicineCategory)) {
channel = 'tbk';
selectConfig.push({
selector: '.item4line1 .item',
selectType: 'list',
});
/*阿里大药房的左侧边栏*/
selectConfig.push({
selector: '#bd div.panels div ul li.item div.detail p.desc',
selectType: 'tmall-medicine-left',
});
} else if (GUtils.hrefIndexOfIn(RegexJdSearch)) {
channel = 'jd';
selectConfig.push({
selector: '.gl-item',
selectType: 'list',
});
/*京东搜索列表左侧*/
selectConfig.push({
selector: '#J_main .m-aside .aside-bar div#J_promGoodsWrap_291 div.mc ul li div.p-client-click div.p-img',
selectType: 'jd-list-left',
});
/*京东搜索列表底部:商品精选*/
selectConfig.push({
selector: 'div#J_promGoodsWrap_292 div.mc ul li div.p-client-click',
selectType: 'jd-list-bottom',
});
/*京东搜索列表底部:猜你喜欢*/
selectConfig.push({
selector: 'div#footmark div div.mc ul li div.p-img',
selectType: 'jd-list-favorite',
});
} else if (GUtils.hrefIndexOfIn(RegexTaobaoDetail)) {
channel = 'tbk';
selectConfig.push({
selector: 'div[class^=\'Recommend--recommend--\'] > a',
selectType: 'detail-left',
});
} else if (GUtils.hrefIndexOfIn(RegexTmallDetail)) {
channel = 'tbk';
selectConfig.push({
selector: 'div[class^=\'Recommend--recommend--\'] > a',
selectType: 'detail-bottom',
});
} else if (GUtils.hrefIndexOfIn(RegexTmallMedicineDetail)) {
channel = 'tbk';
selectConfig.push({
selector: 'div[class^=\'Recommend--recommend--\'] > a',
selectType: 'detail-bottom',
});
} else if (GUtils.hrefIndexOfIn(RegexJdDetail)) {
channel = 'jd';
selectConfig.push({
selector: '.track-con li',
selectType: 'detail-right',
});
selectConfig.push({
selector: '#sp-hot-sale ul li',
selectType: 'detail-left',
});
selectConfig.push({
selector: '#shop-reco li',
selectType: 'detail-center',
});
}
//GUtils.log('channel', channel)
let cssArea = 'maga-coupon-list-area';
let cssAreaTmallMedicine = 'maga-coupon-list-area-tmall-medicine';
let cssWait = 'maga-coupon-list-wait';
let cssAlready = 'maga-coupon-list-already';
let cssListInfo = 'maga-coupon-list-info';
let cssListInfoTmallMedicine = 'maga-coupon-list-info-tmall-medicine';
let cssFind = 'maga-coupon-list-info-find';
let cssEmpty = 'maga-coupon-list-info-empty';
let cssDefault = 'maga-coupon-list-info-default';
objs.initItem = function (selector, selectType) {
let selectView = $j(selector);
if (selectView.hasClass(cssAlready)) {
return
}
selectView.addClass(cssAlready);
let nid = '';
if (GUtils.hrefIndexOfIn(RegexJdSearch)) {
if (selectType === 'jd-list-left'
|| selectType === 'jd-list-bottom'
|| selectType === 'jd-list-favorite') {
let selectLink = selectView.find('a');
if (selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
nid = hrefStr.match('\\d+(?=\\.html)');
}
} else {
nid = selectView.attr('data-sku') || selectView.attr('data-spu') || '';
if (nid.length === 0) {
let hrefStr = selectView.find('a').attr('href');
nid = hrefStr.match('\\d+(?=\\.html)');
}
}
GUtils.log('商品ID:京东列表', nid);
} else if (GUtils.hrefIndexOfIn(RegexTmallSearch)) {
let selectLink = selectView.find('a');
if (selectLink && selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
nid = GUtils.getQueryVariable(hrefStr, 'id');
}
GUtils.log('商品ID:阿里药房、天猫列表', nid);
} else if (GUtils.hrefIndexOfIn(RegexTmallChaoShi)) {
let selectLink = selectView;
if (selectLink && selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
nid = GUtils.getQueryVariable(hrefStr, 'id');
}
GUtils.log('商品ID:阿里药房、天猫列表', nid);
} else if (GUtils.hrefIndexOfIn(RegexTmallMedicineCategory)) {
if (selectType === 'tmall-bottom') {
nid = selectView.parent().attr('atpanel').split(',')[1];
} else if (selectType === 'tmall-medicine-left') {
let selectLink = selectView.find('a');
if (selectLink && selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
nid = GUtils.getQueryVariable(hrefStr, 'id');
}
} else {
nid = selectView.attr('data-id');
}
GUtils.log('商品ID:阿里药房、天猫列表', nid);
} else if (GUtils.hrefIndexOfIn(RegexTaobaoListOrSearch)) {
if (selectType === 'list-word') {
let hrefStr = selectView.attr('href');
nid = GUtils.getQueryVariable(hrefStr, 'itemIds');
} else {
let hrefStr = selectView.attr('href');
if (hrefStr && hrefStr.length > 0) {
nid = location.protocol + hrefStr;
nid = GUtils.getQueryVariable(hrefStr, 'id');
} else {
let selectLink = selectView.find('a');
if (selectLink && selectLink.length > 0) {
nid = selectLink.attr('data-nid');
nid = GUtils.getQueryVariable(hrefStr, 'id');
}
}
}
GUtils.log('商品ID:淘宝列表', nid);
} else if (GUtils.hrefIndexOfIn(RegexTmallDetail)) {
let selectLink = selectView;
if (selectLink && selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
nid = GUtils.getQueryVariable(hrefStr, 'id');
}
GUtils.log('商品ID:阿里药房、天猫详情', nid);
} else if (GUtils.hrefIndexOfIn(RegexTmallMedicineDetail)) {
let selectLink = selectView;
if (selectLink && selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
nid = GUtils.getQueryVariable(hrefStr, 'id');
}
GUtils.log('商品ID:阿里药房、天猫详情', nid);
} else if (GUtils.hrefIndexOfIn(RegexTaobaoDetail)) {
let selectLink = selectView;
if (selectLink && selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
nid = GUtils.getQueryVariable(hrefStr, 'id');
}
GUtils.log('商品ID:淘宝详情', nid);
} else if (GUtils.hrefIndexOfIn(RegexJdDetail)) {
if (selectType === 'detail-right') {
let hrefStr = selectView.find('a').attr('href');
nid = hrefStr.match('\\d+(?=\\.html)');
} else if (selectType === 'detail-left') {
let hrefStr = selectView.find('a').attr('href');
nid = hrefStr.match('\\d+(?=\\.html)');
} else {
//detail-center
let hrefStr = selectView.find('a').attr('href');
nid = hrefStr.match('\\d+(?=\\.html)');
}
GUtils.log('商品ID:京东详情', nid);
}
if (nid && nid.length > 0) {
let cssAreaResult = selectType === 'tmall-medicine-left' ? cssAreaTmallMedicine : cssArea;
let cssListInfoResult = selectType === 'tmall-medicine-left' ? cssListInfoTmallMedicine : cssListInfo;
if (selectType === 'tmall-bottom') {
selectView.parent().append(`
<div class="${cssAreaResult} ${cssWait}" data-item-id="${nid}" select-type="${selectType}">
<a class="${cssListInfoResult} ${cssDefault}" title="点击查询">待查询</a>
</div>`,
);
} else if (selectType === 'tmall-medicine-left') {
selectView.parent().append(`
<div class="${cssAreaResult} ${cssWait}" data-item-id="${nid}" select-type="${selectType}">
<a class="${cssListInfoResult} ${cssDefault} " title="点击查询">待查询</a>
</div>`,
);
} else {
selectView.append(`
<div class="${cssAreaResult} ${cssWait}" data-item-id="${nid}" select-type="${selectType}">
<a class="${cssListInfoResult} ${cssDefault}" title="点击查询">待查询</a>
</div>`,
);
}
}
};
objs.queryItem = function (waitClass) {
let waitView = $j(waitClass);
waitView.removeClass(cssWait);
let goodsId = waitView.attr('data-item-id');
let selectType = waitView.attr('select-type');
let cssListInfoResult = selectType === 'tmall-medicine-left' ? cssListInfoTmallMedicine : cssListInfo;
GUtils.goodsDetail(channel, goodsId).then((data) => {
GUtils.indexToCouponUrl(channel, data.itemId, data.couponMoney).then((rate) => {
linkHtml = `<a href="javascript:void(0);" class="${cssListInfoResult} ${cssFind}">点我领券</a>`;
waitView.click(function () {
// GM_openInTab(rate.linkUrl)
// GUtils.clickEventUrl(`event-click-goods-${channel}`)
QRCode.generateQRCode($j, rate.linkUrl);
$j(`#${idQrcodeContent$1}`).css('display', 'flex');
});
waitView.html(linkHtml);
}).catch((error) => {
let linkHtml = `<a href="javascript:void(0);" class="${cssListInfoResult} ${cssEmpty}">无优惠劵</a>`;
waitView.html(linkHtml);
});
}).catch((error) => {
let linkHtml = `<a href="javascript:void(0);" class="${cssListInfoResult} ${cssEmpty}">无优惠劵</a>`;
waitView.html(linkHtml);
});
};
setInterval(function () {
selectConfig.forEach(function (config) {
$j(config.selector).each(function () {
objs.initItem(this, config.selectType);
});
});
}, 1500);
setInterval(function () {
$j(`.${cssWait}`).each(function () {
GUtils.sleep(200).then(() => {
objs.queryItem(this);
});
});
}, 1500);
$j(document).on('click', `.${cssArea}`, function () {
let view = $j(this);
if (view.hasClass(cssWait)) {
objs.queryItem(this);
}
});
},
};
/*优惠券群*/
let couponGroupLink = 'https://qm.qq.com/cgi-bin/qm/qr?k=Rt6wP6M_S9xVOgdUtqNypuT2xPixHeIR&jump_from=webapi';
let regexStr$K = [
{url: 'detail.tmall.com', linkType: 'startWith'},
{url: 'detail.tmall.hk', linkType: 'startWith'},
{url: 'item.taobao.com', linkType: 'startWith'},
{url: 'detail.liangxinyao.com', linkType: 'startWith'},
{url: 'chaoshi.detail.tmall.com/item.htm', linkType: 'startWith'},
{url: 'item.jd.com', linkType: 'startWith'},
{url: 'item.yiyaojd.com', linkType: 'startWith'},
];
let idLoading = 'maga-coupon-loading';//加载中提示
let idJumpUrl = 'maga-coupon-jump-url';//跳转到领券页面
let idAfterPrice = 'maga-coupon-after-price';//券后价
let idJoinGroup = 'maga-coupon-join-group';//加入神车群
let idJoinGroupQrcode = 'maga-coupon-join-group-qrcode';//加入神车群的二维码
let idPriceTrend = 'maga-coupon-price-trend'; //价格趋势
let idProductSimilar = 'maga-coupon-product-similar';//其他电商平台相似产品
let classProductSimilarItem = 'maga-coupon-product-similar-item';//其他电商平台相似产品-条目
const website$M = {
interceptor: function () {
return GUtils.interceptor(regexStr$K)
},
setRunType: function (val) {
},
init: function ($j) {
let href = location.href;
setTimeout(function () {
let themeColor = 'maga-theme-color-taobao';
if (href.indexOf('tmall.com') !== -1 || href.indexOf('liangxinyao.com') !== -1) {
themeColor = 'maga-theme-color-tmall';
} else if (href.indexOf('jd.com') !== -1) {
themeColor = 'maga-theme-color-jd';
}
let encodeQrcodeUrl = GUtils.urlQrCode(encodeURIComponent(couponGroupLink));
if (encodeQrcodeUrl && encodeQrcodeUrl.length) {
let html = `
<div id='maga-coupon-wrapper'>
<div id='maga-coupon-info'>
<div id="${idJoinGroupQrcode}">
<img class='maga-coupon-qrcode-group' src='${encodeQrcodeUrl}'/>
</div>
<div id="maga-coupon-info-right">
<div id="${idPriceTrend}">正在查询该商品最近价格走势,请稍候...</div>
<div id="${idProductSimilar}">正在查询其他平台同款商品信息,请稍候...</div>
</div>
</div>
<div id='maga-coupon-box'>
<span id="${idLoading}">正在查询优惠信息,请稍候...</span>
</div>
</div>`;
$j('body').append(html);
}
$j('#maga-coupon-wrapper').addClass(themeColor);
let goodsId = '';
let productName = '';
let channel = '';
if (href.indexOf('item.taobao.com') !== -1
|| href.indexOf('detail.tmall.com') !== -1
|| href.indexOf('detail.tmall.hk') !== -1
|| href.indexOf('detail.liangxinyao.com') !== -1
) {
goodsId = GUtils.getUrlParam('id');
channel = 'tbk';
if (href.indexOf('detail.tmall.com') !== -1 ||
href.indexOf('detail.tmall.hk') !== -1) {
productName = $j("#purchasePanel")
.find("div[class^='ItemTitle--root--']")
.find("h1").text().trim();
} else if (href.indexOf('detail.liangxinyao.com') !== -1) {
productName = $j("#root")
.find("div[class^='ItemHeader--root--']")
.find("h1").text().trim();
} else if (href.indexOf('item.taobao.com') !== -1) {
productName = $j("#root")
.find("div[class^='ItemTitle--root--']")
.find("h1").text().trim();
}
} else if (href.indexOf('item.jd.com') !== -1 || href.indexOf('item.yiyaojd.com') !== -1) {
goodsId = location.href.match('\\d+(?=\\.html)');
productName = $j('.itemInfo-wrap .sku-name').text().trim();
channel = 'jd';
} else {
return
}
GUtils.log('goodsId: ' + goodsId);
GUtils.log('productName: ' + productName);
getCoupon($j, goodsId, channel);
getPriceHistory($j, goodsId, channel);
getPriceForOtherPlatform($j, productName);
}, 2000);
},
};
function getCoupon($j, goodsId, channel) {
GUtils.goodsDetail(channel, goodsId).then((data) => {
let couponMoneyStr = data.couponMoney >= 1 ? `扫我领券(${data.couponMoney}元)` : '扫我领券';
let row = `
<span id="${idJumpUrl}">${couponMoneyStr}</span>
<span id="${idAfterPrice}">券后价格(${data.afterPrice}元)</span>
<span id="${idJoinGroup}" style="background-color: #e0bd24">加入捡漏群</span>
`;
//从被选元素中删除子元素
$j(`#${idLoading}`).remove();
$j('#maga-coupon-box').append(row);
GUtils.indexToCouponUrl(channel, data.itemId, data.couponMoney).then((rate) => {
//二维码领券
let encodeQrcodeUrl = GUtils.urlQrCode(encodeURIComponent(rate.linkUrl));
$j(`#${idJoinGroupQrcode}`).html(`<img class='maga-coupon-qrcode-group' src='${encodeQrcodeUrl}'/>`);
//点击事件领券
//$j(`#${idJumpUrl}`).click(function () {
// GM_openInTab(rate.linkUrl)
// GUtils.clickEventUrl(`event-click-goods-${channel}`)
//})
$j(`#${idAfterPrice}`).click(function () {
GM_openInTab(rate.linkUrl);
GUtils.clickEventUrl(`event-click-goods-${channel}`);
});
}).catch((error) => {
$j(`#${idJumpUrl}`).text("扫我入群");
});
$j(`#${idJoinGroup}`).click(function () {
GM_openInTab(couponGroupLink);
GUtils.clickEventUrl(`event-click-join-group`);
});
}).catch((error) => {
let row = `
<span style="cursor: default;background-color: #999999">亲无优惠劵哦</span>
<span id="${idJoinGroup}" style="background-color: #e0bd24">加入捡漏群</span>
`;
$j(`#${idLoading}`).remove();
$j('#maga-coupon-box').append(row);
$j(`#${idJoinGroup}`).click(function () {
GM_openInTab(couponGroupLink);
GUtils.clickEventUrl(`event-click-join-group`);
});
});
}
//获取其他平台相似商品
function getPriceForOtherPlatform($j, productName) {
if (productName.length > 0) {
let requestUrl = GUtils.goodsSearchAllPlatform(productName);
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
GUtils.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
if (resp.code == 10 && resp.data) {
let row = '';
let jdList = resp.data['jd'];
let tbkList = resp.data['tbk'];
let pddList = resp.data['pdd'];
if (jdList.length > 0) {
let clickUrl = GUtils.indexToGoodsJd(jdList[0].itemid);
row = `${row}
<span class="${classProductSimilarItem}" data-url="${clickUrl}">
<span class="maga-color-jd">京东: ¥${jdList[0].itemendprice} </span>
${jdList[0].itemshorttitle}
</span>`;
}
if (tbkList.length > 0) {
let clickUrl = GUtils.indexToGoodsTB(tbkList[0].itemid);
row = `${row}
<span class="${classProductSimilarItem}" data-url="${clickUrl}">
<span class="maga-color-tmall">天猫: ¥${tbkList[0].itemendprice} </span>
${tbkList[0].itemshorttitle}
</span>`;
}
if (pddList.length > 0) {
let clickUrl = GUtils.indexToGoodsPdd(pddList[0].itemid);
row = `${row}
<span class="${classProductSimilarItem}" data-url="${clickUrl}">
<span class="maga-color-pdd">拼多多: ¥${pddList[0].itemendprice} </span>
:${pddList[0].itemshorttitle}
</span>`;
}
$j(`#${idProductSimilar}`).empty();
$j(`#${idProductSimilar}`).append(row);
$j(`.${classProductSimilarItem}`).click(function () {
let url = $j(this).attr('data-url');
GUtils.log('data-url', url);
GM_openInTab(GUtils.zhihuIndexUrl(url));
GUtils.clickEventUrl(`event-click-payback`);
});
} else {
GUtils.log('================>获取其他平台相似商品失败: 后台没有找到商品');
let row = `<span>获取其他平台同款商品失败</span>`;
$j(`#${idProductSimilar}`).empty();
$j(`#${idProductSimilar}`).append(row);
}
},
});
} else {
GUtils.log('================>获取其他平台相似商品成功: 提取关键字出现错误');
}
}
function getPriceHistory($j, goodsId, platform) {
let requestUrl;
if (platform == 'jd') {
let jdUrl = encodeURIComponent(`https://item.jd.com/${goodsId}.html`);
requestUrl = 'https://api.shop.xuelg.com/lsjg/?jdurl=' + jdUrl;
} else {
requestUrl = `https://api.shop.xuelg.com/lsjg/?tbid=${goodsId}`;
}
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
GUtils.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
GUtils.log('================>获取历史价格成功');
let description = '';
let priceMin = resp.zuidijia;
if (GUtils.hasNumber(priceMin)) {
description = `${description}最低价: <span class="maga-price-down">¥${priceMin}</span>`;
} else {
description = `${description}最低价: <span class="maga-price-ping">未收录</span>`;
}
let priceMax = resp.zuigaojia;
if (GUtils.hasNumber(priceMax)) {
description = `${description}最高价: <span class="maga-price-up">¥${priceMax}</span>`;
} else {
description = `${description}最高价: <span class="maga-price-ping">未收录</span>`;
}
GUtils.log('priceMax', priceMax);
GUtils.log('priceMin', priceMin);
$j(`#${idPriceTrend}`).empty();
let row = `<span>${description}</span>`;
$j(`#${idPriceTrend}`).append(row);
},
});
}
let regexStr$J = [
{ url: 'link.zhihu.com', linkType: 'startWith' }
];
const website$L = {
interceptor: function () {
return GUtils.interceptor(regexStr$J)
},
setRunType: function (val) {
},
init: function ($j) {
if (location.href.indexOf('link.zhihu.com/?target=') !== -1) {
//自动跳转,防止被追踪来源
location.href = decodeURIComponent(GUtils.getUrlParam('target'));
}
},
};
const modules$6 = [website$L, website$N, website$M];
const prepare$6 = {
init: function ($j, runType) {
if (GUtils.inIframe()) {
return
}
GM_addStyle(CSS_STR$3);
for (let i = 0; i < modules$6.length; i++) {
let module = modules$6[i];
if (module.interceptor()) {
continue
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
},
};
let CSS_STR$3 = `
#maga-coupon-wrapper {
width: 500px;
position: fixed;
padding: 8px 6px;
font-size: 15px;
font-weight: 550;
z-index: 99999999;
display: flex;
align-items: flex-start;
flex-direction: column;
background-color: #FFFFFF;
bottom: 3%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 8px;
}
.maga-theme-color-taobao {
box-shadow: 0 0 4px 1px rgba(255, 68, 0, 0.9);
}
.maga-theme-color-tmall {
box-shadow: 0 0 4px 1px rgba(255, 0, 54, 0.9);
}
.maga-theme-color-pdd {
box-shadow: 0 0 4px 1px rgba(224, 46, 36, 0.9);
}
.maga-theme-color-jd {
box-shadow: 0 0 4px 1px rgba(233, 53, 54, 0.9);
}
.maga-color-taobao {
font-size: 12px;
color: #ff4400;
}
.maga-color-tmall {
font-size: 12px;
color: #ff0036;
}
.maga-color-pdd {
font-size: 12px;
color: #e02e24;
}
.maga-color-jd {
font-size: 12px;
color: #e4393c;
}
.maga-price-up {
font-size: 12px;
color: #f55050;
}
.maga-price-down {
font-size: 12px;
color: #4db366;
}
.maga-price-ping {
font-size: 12px;
color: #404040;
}
#maga-coupon-info {
display: flex;
flex-direction: row;
align-items: flex-start;
min-height: 105px;
}
#maga-coupon-info-right {
flex: 1;
display: flex;
flex-direction: column;
align-items: flex-start;
margin: 0 8px;
height: 100%;
}
#maga-coupon-price-trend {
color: #333333;
font-size: 12px;
}
#maga-coupon-product-similar {
color: #333333;
cursor: pointer;
font-size: 12px;
display: flex;
flex-direction: column;
align-items: flex-start;
}
.maga-coupon-product-similar-item {
width: 390px;
white-space: nowrap;
margin-top: 2px;
overflow: hidden;
text-overflow: ellipsis;
}
#maga-coupon-box {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
margin-top: 4px;
justify-content: space-between;
}
#maga-coupon-box span {
font-size: 10px;
font-weight: 300;
cursor: pointer;
color: #ffffff;
background-color: #E02E24;
padding: 4px 10px;
border-radius: 3px;
}
.maga-coupon-qrcode-group {
width: 100px;
height: 100px;
cursor: pointer;
transform: scale(1.14);
border-radius: 4px;
padding: 4px;
}
/*搜索页面优惠券查询*/
.maga-coupon-list-area {
background: transparent !important;
position: absolute !important;
top: 3% !important;
right: 6% !important;
}
.maga-coupon-list-area-tmall-medicine {
background: transparent !important;
position: absolute !important;
top: 32% !important;
right: 0 !important;
}
.maga-coupon-list-wait {
cursor: pointer;
}
.maga-coupon-list-already {
position: relative !important;
}
.maga-coupon-list-info {
width: auto !important;
height: 30px !important;
line-height: 30px !important;
box-sizing: border-box !important;
padding: 6px 8px !important;
text-align: center !important;
font-size: 14px !important;
color: #ffffff !important;
font-weight: 500 !important;
border-radius: 15px !important;
cursor: pointer;
display: unset!important;
}
.maga-coupon-list-info, .maga-coupon-list-info:hover, .maga-coupon-list-info:visited {
text-decoration: none !important;
}
.maga-coupon-list-info-tmall-medicine {
width: auto !important;
height: 14px !important;
line-height: 14px !important;
box-sizing: border-box !important;
padding: 2px 2px !important;
text-align: center !important;
font-size: 10px !important;
color: #ffffff !important;
font-weight: 500 !important;
border-radius: 8px !important;
opacity: 0.9 !important;
cursor: pointer;
}
.maga-coupon-list-info-tmall-medicine, .maga-coupon-list-info:hover, .maga-coupon-list-info:visited {
text-decoration: none !important;
}
.maga-coupon-list-info-default {
background: #3186fd !important;
}
.maga-coupon-list-info-find {
background: #ff0036 !important;
}
.maga-coupon-list-info-empty {
background: #CCCCCC !important;
font-weight: 600 !important;
color: #000000 !important;
}
`;
let regexStr$I = [
{url: 'wenku.baidu.com/view/', linkType: 'startWith'}
];
let idDownloadBDWK = 'maga-image-download-bdwk';
let downloadButtonFloat$3 = 'maga-image-download-float';
let downloadButtonStyle$4 = 'maga-image-download-rect';
const website$K = {
interceptor: function () {
return GUtils.interceptor(regexStr$I)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let url = GUtils.urlWenkuDonload(location.href);
if (url && url.length) {
$j('body');
let html = `<button id="${idDownloadBDWK}" class="${downloadButtonStyle$4} ${downloadButtonFloat$3}">
<span>一键下载</span>
</button>`;
$j('body').append(html);
$j(`#${idDownloadBDWK}`).on('click', function () {
GM_openInTab(url);
GUtils.clickEventUrl(`event-click-download-wenku`);
});
}
});
},
};
var Utils$1 = {
downloadImage: function (imgUrls) {
GUtils.log('点击下载按钮', JSON.stringify(imgUrls));
if (imgUrls.length === 0) {
return
}
if (imgUrls.length === 1) {
let image = imgUrls[0];
GM_download(image.imgUrl, image.imgName);
} else {
toastr.success('正在打包中,稍后会下载,请勿重复点击!');
let imageFolder = '多图下载';
//GM.notification({
// text: '正在打包中,稍后会下载,请勿重复点击!',
// image: GM_getResourceText('iconInfo'),
// timeout: 5000,
//})
try {
let zip = JSZip();
let img = zip.folder(imageFolder);
let imgBase64 = [];
for (let i = 0; i < imgUrls.length; i++) {
let imgUrl = imgUrls[i].imgUrl;
if (imgUrl && imgUrl.length > 0) {
this.getBase64(imgUrl).then(function (base64) {
imgBase64.push(base64.substring(22));
}, function (err) {
GUtils.log('图片打包异常', err);
});
}
}
function zipImage() {
setTimeout(function () {
if (imgUrls.length === imgBase64.length) {
for (let i = 0; i < imgUrls.length; i++) {
img.file(imgUrls[i].imgName, imgBase64[i], {base64: true});
}
zip.generateAsync({type: 'blob'}).then(function (content) {
// 调用FileSaver.js的方法
saveAs(content, `${imageFolder}.zip`);
});
} else {
zipImage();
}
}, 100);
}
zipImage();
} catch (err) {
//某些网站特殊处理导致jszip库加载失败, 现在先用单独下载的方式替代
for (let i = 0; i < imgUrls.length; i++) {
let image = imgUrls[i];
let imgUrl = image.imgUrl;
if (imgUrl && imgUrl.length > 0) {
GM_download(imgUrl, image.imgName);
}
}
}
}
},
//传入图片路径,返回base64
getBase64: function (img) {
function getBase64Image(img, width, height) {
//width、height调用时传入具体像素值,控制大小 ,不传则默认图像大小
let canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
let ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
return canvas.toDataURL()
}
let image = new Image();
image.crossOrigin = 'Anonymous';
image.src = img;
let deferred = jQuery.Deferred();
if (img) {
image.onload = function () {
deferred.resolve(getBase64Image(image));//将base64传给done上传处理
};
return deferred.promise()//问题要让onload完成后再return sessionStorage['imgTest']
}
},
};
let regexStr$H = [
{url: 'tieba.baidu.com/p/', linkType: 'startWith'}
];
let idDownloadTieba = 'maga-image-download-tieba';
let downloadButtonFloat$2 = 'maga-image-download-float';
let downloadButtonStyle$3 = 'maga-image-download-rect';
const website$J = {
interceptor: function () {
return GUtils.interceptor(regexStr$H)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let commonUtils = (function (document, $) {
function parseURL(url) {
let a = document.createElement('a');
a.href = url;
return {
source: url,
protocol: a.protocol.replace(':', ''),
host: a.hostname,
port: a.port,
query: a.search,
params: (function () {
let ret = {},
seg = a.search.replace(/^\?/, '').split('&'),
len = seg.length, i = 0, s;
for (; i < len; i++) {
if (seg[i]) {
s = seg[i].split('=');
ret[s[0]] = s[1];
}
}
return ret
})(),
file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
hash: a.hash.replace('#', ''),
path: a.pathname.replace(/^([^\/])/, '/$1'),
relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],
segments: a.pathname.replace(/^\//, '').split('/'),
}
}
function ajaxDownload(url, callback, args, tryTimes) {
tryTimes = tryTimes || 0;
let GM_download = GM.xmlHttpRequest || GM_xmlHttpRequest;
let clearUrl = url.replace(/[&\?]?download_timestamp=\d+/, '');
let retryUrl = clearUrl + (clearUrl.indexOf('?') === -1 ? '?' : '&') + 'download_timestamp=' + new Date().getTime();
GM_download({
method: 'GET',
responseType: 'blob',
url: url,
onreadystatechange: function (responseDetails) {
if (responseDetails.readyState === 4) {
if (responseDetails.status === 200 || responseDetails.status === 304 || responseDetails.status === 0) {
let blob = responseDetails.response, size = blob && blob.size;
if (size && (size / 1024 >= 5)) {
callback(blob, args);
} else if (tryTimes++ == 3) {
callback(blob, args);
} else {
ajaxDownload(retryUrl, callback, args, tryTimes);
}
} else {
if (tryTimes++ == 3) {
callback(null, args);
} else {
ajaxDownload(retryUrl, callback, args, tryTimes);
}
}
}
},
onerror: function (responseDetails) {
if (tryTimes++ == 3) {
callback(null, args);
} else {
ajaxDownload(retryUrl, callback, args, tryTimes);
}
},
});
}
function fileNameFromHeader(disposition, url) {
let result = null;
if (disposition && /filename=.*/ig.test(disposition)) {
result = disposition.match(/filename=.*/ig);
return decodeURI(result[0].split('=')[1])
}
return url.substring(url.lastIndexOf('/') + 1)
}
function downloadBlobFile(content, fileName) {
if ('msSaveOrOpenBlob' in navigator) {
navigator.msSaveOrOpenBlob(content, fileName);
} else {
let aLink = document.createElement('a');
aLink.download = fileName;
aLink.style = 'display:none;';
let blob = new Blob([content]);
aLink.href = window.URL.createObjectURL(blob);
document.body.appendChild(aLink);
if (document.all) {
aLink.click(); //IE
} else {
let evt = document.createEvent('MouseEvents');
evt.initEvent('click', true, true);
aLink.dispatchEvent(evt); // 其它浏览器
}
window.URL.revokeObjectURL(aLink.href);
document.body.removeChild(aLink);
}
}
function downloadUrlFile(url, fileName) {
let aLink = document.createElement('a');
if (fileName) {
aLink.download = fileName;
} else {
aLink.download = url.substring(url.lastIndexOf('/') + 1);
}
aLink.target = '_blank';
aLink.style = 'display:none;';
aLink.href = url;
document.body.appendChild(aLink);
if (document.all) {
aLink.click(); //IE
} else {
let evt = document.createEvent('MouseEvents');
evt.initEvent('click', true, true);
aLink.dispatchEvent(evt); // 其它浏览器
}
document.body.removeChild(aLink);
}
function paddingZero(num, length) {
return (Array(length).join('0') + num).substr(-length)
}
let taskQueue = function (handler) {
let tasks = [];
// empty resolved deferred object
let deferred = $.when();
// handle the next object
function handleNextTask() {
// if the current deferred task has resolved and there are more tasks
if (deferred.state() == 'resolved' && tasks.length > 0) {
// grab a task
let task = tasks.shift();
// set the deferred to be deferred returned from the handler
deferred = handler(task);
// if its not a deferred object then set it to be an empty deferred object
if (!(deferred && deferred.promise)) {
deferred = $.when();
}
// if we have tasks left then handle the next one when the current one
// is done.
if (tasks.length >= 0) {
deferred.fail(function () {
tasks = [];
});
deferred.done(handleNextTask);
}
}
}
// appends a task.
this.append = function (task) {
// add to the array
tasks.push(task);
// handle the next task
handleNextTask();
};
};
return {
'ajaxDownload': ajaxDownload,
'fileNameFromHeader': fileNameFromHeader,
'downloadBlobFile': downloadBlobFile,
'downloadUrlFile': downloadUrlFile,
'parseURL': parseURL,
'paddingZero': paddingZero,
'taskQueue': taskQueue,
}
})(document, jQuery);
let options = {
'type': 2,
'isNeedConfirmDownload': true,
'useQueueDownloadThreshold': 0,
'suffix': null,
'callback': {
'parseLocationInfoCallback': function (locationInfo, options) {
return commonUtils.parseURL(document.location.href)
},
'parseFilesCallback': function (locationInfo, options) {
// file.url file.folderSortIndex
// not folderSortIndex -> use fileName
let files = [];
return files
},
'makeNamesCallback': function (arr, locationInfo, options) {
let names = {};
let time = new Date().getTime();
names.zipName = 'pack_' + time;
names.folderName = names.zipName;
names.infoName = null;
names.infoValue = null;
names.prefix = time;
names.suffix = options.suffix;
return names
},
'beforeFilesDownloadCallback': function (files, names, locationInfo, options, mainFolder) {
},
'beforeFileDownloadCallback': function (file, locationInfo, options, zipFileLength, mainFolder, folder) {
},
'eachFileOnloadCallback': function (blob, file, locationInfo, options, zipFileLength, mainFolder, folder) {
},
'allFilesOnloadCallback': function (files, names, locationInfo, options, mainFolder) {
},
'beforeZipFileDownloadCallback': function (zipBlob, files, names, locationInfo, options, mainFolder) {
commonUtils.downloadBlobFile(zipBlob, names.zipName + '.zip');
},
},
};
initRightClickOpenSource();
let html = `<button id="${idDownloadTieba}" class="${downloadButtonStyle$3} ${downloadButtonFloat$2}">
<span>一键下载</span>
</button>`;
$j('body').append(html);
$j(`#${idDownloadTieba}`).on('click', function () {
tiebaImagesDownload({'onlyPoster': (document.location.href.indexOf('see_lz=1') !== -1 && confirm('是否只下载楼主的图片'))});
});
GM_registerMenuCommand('下载图片', function () {
tiebaImagesDownload();
});
GM_registerMenuCommand('仅下载楼主图片', function () {
tiebaImagesDownload({'onlyPoster': true});
});
let tiebaImagesDownload = unsafeWindow.tiebaImagesDownload = function (options) {
let config = {
'type': 2,
'minWidth': 100,
'suffix': null,
'packNameBy': 'title', // "id" or "title"
'baiduLoadPhotosApi': 'https://tieba.baidu.com/photo/bw/picture/guide',
'findPhotoByApi': true,
'onlyPoster': false,
'callback': {
'parseFilesCallback': function (locationInfo, options) {
let pn = locationInfo.params.pn || 1;
let authorUid = getAuthorUidPoster();
let findPhotosByPage = function () {
let photoList = [];
let partNodesOne = $j('.d_post_content,.d_post_content_main').find('img');
$j.each(partNodesOne, function (i, img) {
let $img = $j(img);
if (options.onlyPoster) {
// 仅下载楼主图片
let replyUid = getAuthorUidReplyer($img.closest('.j_l_post'));
if (replyUid != authorUid) {
return
}
}
// 如果是广告图片则跳过
if (img.parentNode.tagName == 'A' && img.parentNode.className.indexOf('j_click_stats') != -1) {
return true
}
if (img.clientWidth >= options.minWidth) {
if ($img.hasClass('BDE_Image') || $img.hasClass('d_content_img')) {
let photo = {};
photo.location = '';
let thumbUrl = img.src;
photo.folderSortIndex = photoList.length + 1;
// 如果是用户上传的图片
if ($img.attr('pic_type') == '0') {
let urlMatcher = thumbUrl.match(/^(https?):\/\/([a-zA-Z]+)\..*\/([^/]+)$/);
photo.url = urlMatcher[1] + '://' + (urlMatcher[2] == 'tiebapic' ? 'tiebapic' : 'imgsrc') + '.baidu.com/forum/pic/item/' + urlMatcher[3];
photo.id = urlMatcher[3].match(/^[^.]+/)[0];
}
// 如果是用户引用的图片
else {
let m = thumbUrl.match(/^(https?):\/\/(imgsrc|imgsa|tiebapic|\w+\.hiphotos)\.(?:bdimg|baidu)\.com\/(?:forum|album)\/.+\/((\w+)\.(?:jpg|jpeg|gif|png|bmp|webp))(?:\?.+)?$/i);
// 如果引用的是贴吧图片
if (m === null) {
photo.url = thumbUrl;
} else {
photo.url = m[1] + '://' + (m[2] == 'tiebapic' ? 'tiebapic' : 'imgsrc') + '.baidu.com/forum/pic/item/' + m[3];
photo.id = m[4];
}
}
photo.size = $img.attr('size') || 0;
photo.location = 'photos';
photoList.push(photo);
}
}
});
return photoList
};
let notifyPhotoDataLoading = toastr.success('正在请求图片数据~', '', {
'progressBar': false,
'hideDuration': 0,
'showDuration': 0,
'timeOut': 0,
'closeButton': false,
});
return $j.Deferred(function (finalDfd) {
if (options.findPhotoByApi) {
let photoList = [], currLoadCount = 0,
loadQueue = new commonUtils.taskQueue(function (startPicId) {
return $j.Deferred(function (dfd) {
$j.get(options.baiduLoadPhotosApi, {
'tid': locationInfo.file,
'see_lz': options.onlyPoster ? 1 : 0, // 仅下载楼主图片
'from_page': 0,
// 'alt': 'jview',
'next': 50,
'prev': 0,
'pic_id': startPicId,
'_': new Date().getTime(),
}, function (resp) {
let data = resp.data;
if (data && data.pic_list) {
let picAmount = data.pic_amount;
let picList = data.pic_list;
let lastPicId;
let startPushPic = false;
$j.each(picList, function (key, pic) {
let original = pic.img.original, photo;
switch (true) {
case original.id == startPicId:
startPushPic = true;
break
case !startPicId:
startPushPic = true;
case startPushPic:
photo = {};
photo.location = 'photos';
photo.folderSortIndex = photoList.length + 1;
photo.id = original.id;
photo.url = (original.waterurl && original.waterurl.replace(/^http:\/\//, 'https://')) ||
(`https://imgsrc.baidu.com/forum/pic/item/${original.id}.jpg`);
photo.size = original.size;
photoList.push(photo);
currLoadCount++;
lastPicId = original.id;
}
});
if (lastPicId && currLoadCount < picAmount) {
loadQueue.append(lastPicId);
} else {
// 队列下载结束
// 对比页面数据和api返回数据,两者合并结果,并尝试按页面显示顺序排序
let combinePhotoList = [],
pagePhotoList = findPhotosByPage().filter(function (photo) {
return photo.size != 0 // 有些页面图片没写size,所以这里过滤了没写size的,暂时先这样处理
}).map(function (photo) {
let hasDelete = true;
if (photo.id) {
for (let item of photoList) {
// 由于同样一张图片,id有两个,这里采用对比文件大小的方式来确定是否同一张图片
if (item.id == photo.id || (item.size != 0 && item.size == photo.size)) {
hasDelete = false;
break
}
}
}
photo.hasDelete = hasDelete;
return photo
}),
pageLength = pagePhotoList.length,
serverLength = photoList.length,
hasDeleteLength = pagePhotoList.filter(function (photo) {
return photo.hasDelete
}).length;
if (hasDeleteLength > 0) {
let startLeftIndex = 0;
let startRightIndex = 0;
let unshiftLength = 0;
let i;
let j;
let photoUrlList = photoList.map(function (photo) {
return photo.url
});
pn > 1 && $j.each(pagePhotoList, function (i, photo) {
let index = photoUrlList.indexOf(photo.url);
if (index == -1) {
unshiftLength++;
} else {
startRightIndex = index;
startLeftIndex = i;
return false
}
});
if (startRightIndex > 0) {
combinePhotoList.push.apply(combinePhotoList, photoList.slice(0, startRightIndex));
}
if (startLeftIndex > 0) {
combinePhotoList.push.apply(combinePhotoList, pagePhotoList.slice(startLeftIndex - unshiftLength, startLeftIndex));
}
for (i = startLeftIndex, j = startRightIndex; i < pageLength && j < serverLength;) {
let photo, left = pagePhotoList[i],
right = photoList[j];
if (left.id === right.id || (left.size != 0 && left.size == right.size)) {
photo = right;
i++;
j++;
} else {
if (left.hasDelete) {
photo = left;
i++;
} else {
photo = right;
j++;
}
}
combinePhotoList.push(photo);
}
if (i <= pageLength - 1) {
combinePhotoList.push.apply(combinePhotoList, pagePhotoList.slice(i, pageLength));
}
if (j <= serverLength - 1) {
combinePhotoList.push.apply(combinePhotoList, photoList.slice(j, serverLength));
}
$j.each(combinePhotoList, function (i, photo) {
photo.folderSortIndex = i + 1;
});
} else {
combinePhotoList = photoList;
}
finalDfd.resolve(combinePhotoList);
}
dfd.resolve();
} else {
dfd.reject('api返回错误');
}
}, 'json').fail(function () {
dfd.reject('api返回错误');
});
}).fail(function (msg) {
console.warn(msg);
options.findPhotoByApi = false;
finalDfd.resolve(findPhotosByPage());
})
});
loadQueue.append(null);
} else {
finalDfd.resolve(findPhotosByPage());
}
}).always(function () {
notifyPhotoDataLoading.css('display', 'none').remove();
})
},
'makeNamesCallback': function (photos, locationInfo, options) {
let names = {};
let tieId = locationInfo.file;
let pageNumber = locationInfo.params.pn || 1;
let title = $j('.core_title_txt').attr('title');
let forum = ($j('#container').find('.card_title a.card_title_fname').text() || '贴').replace(/^\s*|\s*$/g, '');
names.infoName = '图文详情.txt';
names.infoValue = `ID:${tieId}\r\n标题:${title}\r\n地址:${locationInfo.source}\r\n页码:'${pageNumber}\r\n图片数量:${photos.length}\r\n`;
names.zipName = (options.packNameBy == 'id' ? (`tie_${tieId}`) : (`${forum}_${tieId}_${title}`)) + ((options.findPhotoByApi || pageNumber == 1) ? '' : ('_' + pageNumber));
names.folderName = names.zipName;
names.prefix = tieId + (options.findPhotoByApi ? '' : ('_' + commonUtils.paddingZero(pageNumber, 3)));
names.suffix = options.suffix;
names.tie = {
'id': tieId,
'title': title,
'pn': pageNumber,
'forum': forum,
};
return names
},
'beforeFilesDownloadCallback': function (photos, names, locationInfo, options, mainFolder) {
const paddingZeroLength = (photos.length + '').length;
$j.each(photos, function (i, photo) {
photo.fileName = names.prefix + '_' + commonUtils.paddingZero(photo.folderSortIndex, paddingZeroLength) + '.' + (names.suffix || photo.url.substring(photo.url.lastIndexOf('.') + 1));
});
options.failFiles = undefined;
},
'eachFileOnloadCallback': function (blob, photo, locationInfo, options, zipFileLength, mainFolder, folder) {
if (blob == null) {
if (!options.failFiles) {
options.failFiles = [];
}
options.failFiles.push(photo);
} else if (!options.names.suffix && photo.location == 'photos' && blob.type && blob.type.startsWith('image/')) {
// 如果没有指定后缀名,那么后缀根据content-type来判断
let suffixRegex = /\.[^.]+$/;
let suffix = ('.' + blob.type.replace('image/', '').replace('jpeg', 'jpg'));
photo.fileName = photo.fileName.replace(suffixRegex, suffix);
photo.url = photo.url.replace(suffixRegex, suffix);
}
return true
},
'allFilesOnloadCallback': function (photos, names, locationInfo, options, mainFolder) {
let photoUrlsStr = '';
let failPhotoListStr = '';
// 链接列表文件
$j.each(photos, function (i, photo) {
photoUrlsStr += ((photo.location ? (photo.location + '/') : '') + photo.fileName) + '\t' + photo.url + '\r\n';
});
mainFolder.file('图片地址.txt', photoUrlsStr);
// 帮助文件
mainFolder.file('帮助.txt', '有些图片可能下载下来是裂掉的缩略图,可以从 图片地址.text 中按文件名手动找到链接下载。');
// 失败链接列表
if (options.failFiles && options.failFiles.length > 0) {
toastr.error('共 ' + options.failFiles.length + ' 张下载失败,已记录在 下载失败.txt !', '', {
'progressBar': false,
timeOut: 0,
});
failPhotoListStr = '';
for (let i in options.failFiles) {
let failFile = options.failFiles[i];
failPhotoListStr += (failFile.location + '/' + failFile.fileName + '\t' + failFile.url + '\r\n');
}
mainFolder.file('下载失败.txt', failPhotoListStr);
}
},
},
};
if (options) {
$j.extend(true, config, options);
}
batchDownload(config);
};
let ajaxDownloadAndZipFiles = function (files, names, locationInfo, options) {
let notifyStart = toastr.success('正在打包~', names.zipName,
{
'progressBar': false,
'hideDuration': 0,
'showDuration': 0,
'timeOut': 0,
'closeButton': false,
});
if (files && files.length > 0) {
let zip = JSZip();
let mainFolder = zip.folder(names.folderName);
let zipFileLength = 0;
let maxIndex = files.length;
let paddingZeroLength = (files.length + '').length;
if (names.infoName) {
mainFolder.file(names.infoName, names.infoValue);
}
options.callback.beforeFilesDownloadCallback(files, names, locationInfo, options, mainFolder);
let downloadFile = function (file, resolveCallback) {
return $j.Deferred(function (dfd) {
let folder = file.location ? mainFolder.folder(file.location) : mainFolder;
let isSave = options.callback.beforeFileDownloadCallback(file, locationInfo, options, zipFileLength, mainFolder, folder);
if (isSave === false) {
dfd.resolveWith(file, [null, folder, false]);
} else {
commonUtils.ajaxDownload(file.url, function (blob, file) {
let isSave = options.callback.eachFileOnloadCallback(blob, file, locationInfo, options, zipFileLength, mainFolder, folder);
if (isSave !== false) {
if (file.fileName) {
folder.file(file.fileName, blob);
} else {
let suffix = names.suffix || file.url.substring(file.url.lastIndexOf('.') + 1);
file.fileName = names.prefix + '_' + commonUtils.paddingZero(file.folderSortIndex, paddingZeroLength) + '.' + suffix;
folder.file(file.fileName, blob);
}
}
dfd.resolveWith(file, [blob, folder, isSave]);
}, file);
}
}).done(function (blob, folder, isSave) {
zipFileLength++;
notifyStart.find('.toast-message').text(`正在打包~ 第 ${zipFileLength} 张 ${(isSave ? '' : '跳过')}`);
resolveCallback && resolveCallback(); // resolve延迟对象
if (zipFileLength >= maxIndex) {
let isDownloadZip = options.callback.allFilesOnloadCallback(files, names, locationInfo, options, mainFolder);
if (isDownloadZip !== false) {
zip.generateAsync({type: 'blob'})
.then(function (content) {
options.callback.beforeZipFileDownloadCallback(content, files, names, locationInfo, options, mainFolder);
});
toastr.success('下载完成!', names.zipName, {'progressBar': false, timeOut: 0});
}
notifyStart.css('display', 'none').remove();
}
})
};
if (maxIndex < options.useQueueDownloadThreshold) {
// 并发数在useQueueDownloadThreshold内,直接下载
for (let i = 0; i < maxIndex; i++) {
downloadFile(files[i]);
}
} else {
// 并发数在useQueueDownloadThreshold之上,采用队列下载
let queue = new commonUtils.taskQueue(function (file) {
if (file) {
let dfd = $j.Deferred();
downloadFile(file, function () {
dfd.resolve();
});
return dfd
}
});
for (let j = 0; j < maxIndex; j++) {
queue.append(files[j]);
}
}
} else {
notifyStart.css('display', 'none').remove();
toastr.error('未解析到图片!', '错误', {'progressBar': false});
}
};
/** 批量下载 **/
function batchDownload(config) {
try {
options = $j.extend(true, {}, options, config);
let locationInfo = options.callback.parseLocationInfoCallback(options);
let files = options.callback.parseFilesCallback(locationInfo, options);
if (!(files && files.promise)) {
files = $j.when(files);
}
files.done(function (files) {
if (files && files.length > 0) {
if (!options.isNeedConfirmDownload || confirm('是否下载 ' + files.length + ' 张图片')) {
let names = options.callback.makeNamesCallback(files, locationInfo, options);
options.locationInfo = locationInfo;
options.files = files;
options.names = names;
if (options.type == 1) {
urlDownload(files, names, locationInfo, options);
} else {
ajaxDownloadAndZipFiles(files, names, locationInfo, options);
}
}
} else {
toastr.error('未找到图片~', '');
}
}).fail(function (message) {
toastr.error(message, '错误');
});
} catch (e) {
console.warn('批量下载照片 出现错误!, exception: ', e);
toastr.error('批量下载照片 出现错误!', '');
}
}
/** 下载 **/
function urlDownload(photos, names, locationInfo, options) {
GM_notification('开始下载~', names.zipName);
let index = 0;
let interval = setInterval(function () {
if (index < photos.length) {
let url = photos[index].url;
let fileName = null;
if (names.suffix) {
fileName = names.prefix + '_' + (index + 1) + '.' + names.suffix;
} else {
fileName = names.prefix + '_' + (index + 1) + url.substring(url.lastIndexOf('.'));
}
commonUtils.downloadUrlFile(url, fileName);
} else {
clearInterval(interval);
return
}
index++;
}, 100);
}
let getAuthorUidReplyer = function (reply) {
// 获取回复UID
let userInfo = reply.find('.d_name').attr('data-field');
return (userInfo && userInfo.match(/"user_id":(\d+)/) && RegExp.$1) || 0
};
let getAuthorUidPoster = function () {
// 获取发帖楼主的UID
let reply = $j('#j_p_postlist').children('.j_l_post').first();
return getAuthorUidReplyer(reply)
};
function initRightClickOpenSource() {
let url = document.location.toString();
let m = null;
if ((m = url.match(/^https?:\/\/(imgsrc|tiebapic)\.baidu\.com\/forum\/pic\/item\/.+/i))) {
return
}
if ((m = url.match(/^(https?):\/\/(imgsrc|imgsa|tiebapic|\w+\.hiphotos)\.(?:bdimg|baidu)\.com\/(?:forum|album)\/.+\/(\w+\.(?:jpg|jpeg|gif|png|bmp|webp))(?:\?.+)?$/i))) {
document.location = m[1] + '://' + (m[2] == 'tiebapic' ? 'tiebapic' : 'imgsrc') + '.baidu.com/forum/pic/item/' + m[3];
}
}
});
},
};
let regexStr$G = [
{url: 'tuchong.com', linkType: 'contains'}
];
let idDownloadTuchongTopic = 'maga-image-download-tuchong-topic';
let idDownloadDetail = 'maga-image-download-detail';
let idDownloadDetailAll$1 = 'maga-image-download-detail-all';
let idDownloadTuchongPageAll = 'maga-image-download-tuchong-page-all';
let downloadButtonStyle$2 = 'maga-image-download-rect';
let downloadButtonStyleParent = 'maga-image-download-parent-h';
const website$I = {
interceptor: function () {
return GUtils.interceptor(regexStr$G)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
if (location.href.indexOf('stock.tuchong.com/topic') !== -1) {
// 获取主题套图地址
// 添加主题套图下载按钮
let container = $j('.justified-layout');
if (container.length === 0) {
return
}
let nodeElement = `<span id="${idDownloadTuchongTopic}"
style="right: 160px;" class="maga-download-button">图集下载</span>`;
$j('.toolbar-wrapper').append(nodeElement);
$j(`#${idDownloadTuchongTopic}`).on('click', function () {
let images = [];
let imageViews = container.find('.justified-layout__item');
for (let i = 0; i < imageViews.length; i++) {
let imgUrl = $j(imageViews[i]).find('div').attr('data-lazy-url');
let imgName = imgUrl.substr(imgUrl.lastIndexOf('/') + 1);
if (/http/.test(imgUrl)) {
images.push({ imgUrl: imgUrl, imgName: imgName || i });
} else {
images.push({ imgUrl: `http:${imgUrl}`, imgName: imgName });
}
}
Utils$1.downloadImage(images);
});
} else if (location.href.indexOf('tuchong.com') !== -1) {
let container = $j('.scene-container-next');
if (container.length === 0) {
return
}
if ($j('.theater-handler').length > 0) {
let html = `
<div class="${downloadButtonStyleParent}">
<span id="${idDownloadDetail}" class="${downloadButtonStyle$2}">图片下载</span>
<span id="${idDownloadDetailAll$1}" class="${downloadButtonStyle$2}">套图下载</span>
</div>`;
$j('.theater-handler').append(html);
$j(`#${idDownloadDetail}`).on('click', function () {
let imgUrl = container
.find('.scene-item').not('.prev-scene').not('.next-scene')
.find('img').attr('src');
imgUrl = /http/.test(imgUrl) ? imgUrl : `http:${imgUrl}`;
let imgName = $j('.aside-post-title').text() + imgUrl.split('/f/')[1];
GUtils.log('点击下载按钮:imgUrl>>>' + imgUrl + ' imgName>>>' + imgName);
GM_download(imgUrl, imgName);
});
$j(`#${idDownloadDetailAll$1}`).on('click', function () {
let imgItem = container.find('.scene-item');
let images = [];
for (let i = 0; i < imgItem.length; i++) {
let imgUrl = $j(imgItem[i]).find('img').attr('src');
imgUrl = /http/.test(imgUrl) ? imgUrl : `http:${imgUrl}`;
let ext = imgUrl.substring(imgUrl.lastIndexOf('.')) || 'jpg';
let imgName = new Date().getTime() + '_' + i.toString() + ext;
images.push({ imgUrl: imgUrl, imgName: imgName });
}
Utils$1.downloadImage(images);
});
}
if ($j('.post-content').length > 0) {
let html = `
<div class="${downloadButtonStyleParent}">
<span id="${idDownloadTuchongPageAll}" class="${downloadButtonStyle$2}">套图下载</span>
</div>`;
//根据屏幕的宽度不同,图虫会对网页做适配
$j('.post-content').prepend(html);
$j(`#${idDownloadTuchongPageAll}`).on('click', function () {
downloadPostContent();
});
}
function downloadPostContent() {
let imgItem = $j('.multi-photo-image');
let images = [];
for (let i = 0; i < imgItem.length; i++) {
let imgUrl = $j(imgItem[i]).filter('img').attr('src');
imgUrl = /http/.test(imgUrl) ? imgUrl : `http:${imgUrl}`;
let ext = imgUrl.substring(imgUrl.lastIndexOf('.')) || 'jpg';
let imgName = new Date().getTime() + '_' + i.toString() + ext;
images.push({ imgUrl: imgUrl, imgName: imgName });
}
Utils$1.downloadImage(images);
}
}
});
},
};
let regexStr$F = [
{url: 'mp.weixin.qq.com/s', linkType: 'startWith'}
];
let idDownloadWeixin = 'maga-image-download-weixin';
let downloadButtonFloat$1 = 'maga-image-download-float';
let downloadButtonStyle$1 = 'maga-image-download-rect';
const website$H = {
interceptor: function () {
return GUtils.interceptor(regexStr$F)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let selectView = $j('#js_content');
if (selectView.length === 0) {
return
}
let imageViews = selectView[0].getElementsByTagName('img');
let images = [];
for (let i = 0; i < imageViews.length; i++) {
let temp = imageViews[i].getAttribute('data-src');
let imageSrc = '';
if (temp && temp.length > 0) {
imageSrc = temp;
} else {
imageSrc = imageViews[i].getAttribute('src');
}
let imgUrl = imageSrc.replace('//res.wx.qq.com/mmbizwap', 'http://res.wx.qq.com/mmbizwap');
let imgName = getWechatFileName(imgUrl, i);
images.push({imgUrl: imgUrl, imgName: imgName});
}
let html = `
<button id="${idDownloadWeixin}" class="${downloadButtonStyle$1} ${downloadButtonFloat$1}">
<span>一键下载</span>
<span id="photoNum"></span>
</button>
`;
$j('body').append(html);
$j('#photoNum')[0].innerText = `共 ${images.length} 张`;
$j(`#${idDownloadWeixin}`).on('click', function () {
if (images.length === 0) {
return
}
Utils$1.downloadImage(images);
});
});
},
};
function getWechatFileName(image, index) {
let ext = '.jpg';
if (image.indexOf('wx_fmt=gif') !== -1 ||
image.indexOf('mmbiz_gif') !== -1) {
ext = '.gif';
}
if (image.indexOf('wx_fmt=png') !== -1 ||
image.indexOf('mmbiz_png') !== -1) {
ext = '.png';
}
if (image.indexOf('wx_fmt=bmp') !== -1 ||
image.indexOf('mmbiz_bmp') !== -1) {
ext = '.bmp';
}
if (image.indexOf('wx_fmt=jpeg') !== -1 ||
image.indexOf('mmbiz_jpeg') !== -1) {
ext = '.jpeg';
}
return new Date().getTime() + '_' + index.toString() + ext
}
let regexStr$E = [
{url: 'xiaohongshu.com/explore/', linkType: 'contains'},
];
let idDownloadDetailAll = 'maga-image-download-detail-all';
let downloadButtonStyle = 'maga-image-download-rect';
let downloadButtonFloat = 'maga-image-download-float';
const website$G = {
interceptor: function () {
return GUtils.interceptor(regexStr$E)
},
setRunType: function (val) {
},
init: function ($j) {
GUtils.sleep(3000).then(() => {
let container = $j('div.swiper-wrapper > div > div.img-container');
if (container.length === 0) {
return
}
let html = `
<div class="${downloadButtonFloat}">
<span id="${idDownloadDetailAll}" class="${downloadButtonStyle}">图片下载</span>
</div>`;
$j('body').append(html);
$j(`#${idDownloadDetailAll}`).on('click', function () {
let imgItem = container.find("img");
let images = [];
for (let i = 0; i < container.length; i++) {
let imgUrl = imgItem.attr('src');
let ext = 'webp';
let realImgUrl = GUtils.getUrlPath(imgUrl);
realImgUrl = /http/.test(realImgUrl) ? realImgUrl : `https:${realImgUrl}`;
let imgName = `${new Date().getTime()}_${i.toString()}.${ext}`;
images.push({imgUrl: realImgUrl, imgName: imgName});
}
Utils$1.downloadImage(images);
});
});
},
};
let regexStr$D = [
{url: 'zhihu.com', linkType: 'contains'}
];
/**
* 备注:
* 此部分代码来自于王超先生的知乎视频下载脚本代码,开源协议为MIT协议,故加入到本插件中,感谢大佬的开源、共享精神!
*
* 原作者:王超, 脚本链接:https://greasyfork.org/zh-CN/scripts/39206
* 版权归原作者所有
*/
const website$F = {
interceptor: function () {
return GUtils.interceptor(regexStr$D)
},
setRunType: function (val) {
},
init: function ($j) {
(async () => {
console.log('知乎视频下载');
async function downloadUrl(url, name = (new Date()).valueOf() + '.mp4') {
// Greasemonkey 需要把 url 转为 blobUrl
if (GM_info.scriptHandler === 'Greasemonkey') {
const res = await fetch(url);
const blob = await res.blob();
url = URL.createObjectURL(blob);
}
// Chrome 可以使用 Tampermonkey 的 GM_download 函数绕过 CSP(Content Security Policy) 的限制
if (window.GM_download) {
GM_download({url, name});
} else {
// firefox 需要禁用 CSP, about:config -> security.csp.enable => false
let a = document.createElement('a');
a.href = url;
a.download = name;
a.style.display = 'none';
// a.target = '_blank';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
setTimeout(() => URL.revokeObjectURL(url), 100);
}
}
async function getVideoInfo(videoId) {
GUtils.log("videoId==========", videoId);
const playlistUrl = `https://lens.zhihu.com/api/v4/videos/${videoId}`;
const videoInfo = await (await fetch(playlistUrl, {credentials: 'include'})).json();
let videos = [];
// 不同分辨率视频的信息
for (const [key, video] of Object.entries(videoInfo.playlist_v2 || videoInfo.playlist)) {
video.resolution_ename = key;
video.resolution_cname = resolutionsName.find(v => v.ename === video.resolution_ename)?.cname;
if (!videos.find(v => v.size === video.size)) {
videos.push(video);
}
}
// 按大小排序
videos = videos.sort(function (v1, v2) {
const v1Index = resolutionsName.findIndex(v => v.ename === v1.resolution_ename);
const v2Index = resolutionsName.findIndex(v => v.ename === v2.resolution_ename);
return v1Index === v2Index ? 0 : (v1Index > v2Index ? 1 : -1)
});
return videos
}
// 处理单张卡片(问题/文章)
function processCard(domCard) {
const data = JSON.parse(domCard.dataset.zaExtraModule);
// 视频卡片
if (data.card?.content?.video_id) {
processVideo(domCard);
}
}
// 处理详细内容页面
function processContent(domArticle) {
const data = JSON.parse(domArticle.dataset.zaExtraModule);
if (data.card?.content?.video_id) {
processVideo(domArticle);
}
}
// 处理视频
function processVideo(dom) {
const domData = JSON.parse(dom?.dataset?.zaExtraModule || null);
JSON.parse(dom.querySelector('div[data-zop]')?.dataset?.zop || null);
const videoId = domData ? domData.card.content.video_id : window.location.pathname.split('/').pop();
let observer = new MutationObserver(async mutationRecords => {
for (const mutationRecord of mutationRecords) {
if (mutationRecord.addedNodes.length && mutationRecord.addedNodes.item(0).innerText.includes('倍速')) {
observer.disconnect();
observer = null;
const curVideoUrl = mutationRecord.target.parentElement.children[0].querySelector('video').getAttribute('src');
const toolbar = mutationRecord.addedNodes.item(0).children.item(0).children.item(1).children.item(1);
// 克隆全屏按钮并修改图标作为下载按钮
const domDownload = toolbar.children.item(toolbar.children.length - 3).cloneNode(true);
domDownload.dataset.videoUrl = curVideoUrl;
domDownload.querySelector('svg').setAttribute('viewBox', '0 0 24 24');
domDownload.querySelector('svg').innerHTML = svgDownload;
domDownload.classList.add('download');
domDownload.children.item(0).setAttribute('aria-label', '下载');
domDownload.children.item(1).innerText = '下载';
domDownload.addEventListener('click', (event) => {
event.stopPropagation();
downloadUrl(domDownload.dataset.videoUrl);
});
domDownload.addEventListener('pointerenter', () => {
const domMenu = domDownload.children.item(1);
domMenu.style.opacity = 1;
domMenu.style.visibility = 'visible';
});
domDownload.addEventListener('pointerleave', () => {
const domMenu = domDownload.children.item(1);
domMenu.style.opacity = 0;
domMenu.style.visibility = 'hidden';
});
toolbar.appendChild(domDownload);
// 获取视频信息
const videos = await getVideoInfo(videoId);
// 如果有不同清晰度的视频,添加下载弹出菜单
if (videos.length > 1) {
toolbar.children.item(1).children.item(0).innerText;
// 克隆倍速菜单为下载菜单
const menu = toolbar.children.item(0).children.item(1).cloneNode(true);
const menuItemContainer = menu.children.item(0);
const menuItemTemplate = menuItemContainer.children.item(0).cloneNode(true);
let menuItem;
//menu.style.left = 'auto'
menuItemContainer.innerHTML = '';
for (const video of videos) {
menuItem = menuItemTemplate.cloneNode(true);
menuItem.dataset.videoUrl = video.play_url;
menuItem.innerText = video.resolution_cname;
menuItem.addEventListener('click', (event) => {
event.stopPropagation();
downloadUrl(event.srcElement.dataset.videoUrl);
});
menuItemContainer.appendChild(menuItem);
}
domDownload.removeChild(domDownload.children.item(1));
domDownload.appendChild(menu);
}
}
}
});
observer.observe(dom, {
childList: true, // 观察直接子节点
subtree: true // 观察更低的后代节点
});
}
const svgDownload = '<path d="M9.5,4 H14.5 V10 H17.8 L12,15.8 L6.2,10 H9.5 Z M6.2,18 H17.8 V20 H6.2 Z"></path>';
const resolutionsName = [
{ename: 'FHD', cname: '超清'},
{ename: 'HD', cname: '高清'},
{ename: 'SD', cname: '清晰'},
{ename: 'LD', cname: '普清'}
];
if (['video.zhihu.com', 'v.vzuu.com'].includes(window.location.host)) {
processVideo(document.getElementById('player'));
} else {
const observer = new MutationObserver(mutationRecords => {
for (const mutationRecord of mutationRecords) {
if (!mutationRecord.oldValue) {
if (mutationRecord.target?.dataset?.zaDetailViewPathModule === 'FeedItem') {
processCard(mutationRecord.target);
} else if (mutationRecord.target?.dataset?.zaDetailViewPathModule === 'Content' && mutationRecord.target.tagName === 'ARTICLE') {
processContent(mutationRecord.target);
}
}
}
});
observer.observe(document.body, {
attributeFilter: ['data-za-detail-view-path-module'], // 只观察指定特性的变化
attributeOldValue: true, // 是否将特性的旧值传递给回调
attributes: true, // 观察目标节点的属性节点(新增或删除了某个属性,以及某个属性的属性值发生了变化)
childList: false, // 观察直接子节点
subtree: true // 观察更低的后代节点
});
}
})();
}
};
let filename = 'twitter_{user-name}(@{user-id})_{date-time}_{status-id}_{file-type}';
let lang, host, history, showSensitive, isTweetdeck;
let regexStr$C = [
{url: 'x.com', linkType: 'contains'}
];
const website$E = {
interceptor: function () {
return GUtils.interceptor(regexStr$C)
},
setRunType: function (val) {
},
init: function ($j) {
GM_registerMenuCommand((this.language[navigator.language] || this.language.en).settings, this.settings);
lang = this.language[document.querySelector('html').lang] || this.language.en;
host = location.hostname;
isTweetdeck = host.indexOf('tweetdeck') >= 0;
history = this.storageObsolete();
if (history.length) {
this.storage(history);
this.storageObsolete(true);
} else history = this.storage();
showSensitive = GM_getValue('show_sensitive', false);
document.head.insertAdjacentHTML('beforeend', '<style>' + this.css + (showSensitive ? this.css_ss : '') + '</style>');
let observer = new MutationObserver(ms => ms.forEach(m => m.addedNodes.forEach(node => this.detect(node))));
observer.observe(document.body, {childList: true, subtree: true});
},
detect: function (node) {
let article = node.tagName == 'ARTICLE' && node || node.tagName == 'DIV' && (node.querySelector('article') || node.closest('article'));
if (article) this.addButtonTo(article);
let listitems = node.tagName == 'LI' && node.getAttribute('role') == 'listitem' && [node] || node.tagName == 'DIV' && node.querySelectorAll('li[role="listitem"]');
if (listitems) this.addButtonToMedia(listitems);
},
addButtonTo: function (article) {
if (article.dataset.detected) return;
article.dataset.detected = 'true';
let mediaSelector = [
'a[href*="/photo/1"]',
'div[role="progressbar"]',
'div[data-testid="playButton"]',
'a[href="/settings/content_you_see"]', //hidden content
'div.media-image-container', // for tweetdeck
'div.media-preview-container', // for tweetdeck
'div[aria-labelledby]>div:first-child>div[role="button"][tabindex="0"]' //for audio (experimental)
];
let media = article.querySelector(mediaSelector.join(','));
if (media) {
let statusId = article.querySelector('a[href*="/status/"]').href.split('/status/').pop().split('/').shift();
let btnGroup = article.querySelector('div[role="group"]:last-of-type, ul.tweet-actions, ul.tweet-detail-actions');
let btnShare = Array.from(btnGroup.querySelectorAll(':scope>div>div, li.tweet-action-item>a, li.tweet-detail-action-item>a')).pop().parentNode;
let btnDown = btnShare.cloneNode(true);
if (isTweetdeck) {
btnDown.firstElementChild.innerHTML = '<svg viewBox="0 0 24 24" style="width: 18px; height: 18px;">' + this.svg + '</svg>';
btnDown.firstElementChild.removeAttribute('rel');
btnDown.classList.replace("pull-left", "pull-right");
} else {
btnDown.querySelector('svg').innerHTML = this.svg;
}
let isExist = history.indexOf(statusId) >= 0;
this.status(btnDown, 'tmd-down');
this.status(btnDown, isExist ? 'completed' : 'download', isExist ? lang.completed : lang.download);
btnGroup.insertBefore(btnDown, btnShare.nextSibling);
btnDown.onclick = () => this.click(btnDown, statusId, isExist);
if (showSensitive) {
let btnShow = article.querySelector('div[aria-labelledby] div[role="button"][tabindex="0"]:not([data-testid]) > div[dir] > span > span');
if (btnShow) btnShow.click();
}
}
let imgs = article.querySelectorAll('a[href*="/photo/"]');
if (imgs.length > 1) {
let statusId = article.querySelector('a[href*="/status/"]').href.split('/status/').pop().split('/').shift();
let btnGroup = article.querySelector('div[role="group"]:last-of-type');
Array.from(btnGroup.querySelectorAll(':scope>div>div')).pop().parentNode;
imgs.forEach(img => {
let index = img.href.split('/status/').pop().split('/').pop();
let isExist = history.indexOf(statusId) >= 0;
let btnDown = document.createElement('div');
btnDown.innerHTML = '<div><div><svg viewBox="0 0 24 24" style="width: 18px; height: 18px;">' + this.svg + '</svg></div></div>';
btnDown.classList.add('tmd-down', 'tmd-img');
this.status(btnDown, 'download');
img.parentNode.appendChild(btnDown);
btnDown.onclick = e => {
e.preventDefault();
this.click(btnDown, statusId, isExist, index);
};
});
}
},
addButtonToMedia: function (listitems) {
listitems.forEach(li => {
if (li.dataset.detected) return;
li.dataset.detected = 'true';
let statusId = li.querySelector('a[href*="/status/"]').href.split('/status/').pop().split('/').shift();
let isExist = history.indexOf(statusId) >= 0;
let btnDown = document.createElement('div');
btnDown.innerHTML = '<div><div><svg viewBox="0 0 24 24" style="width: 18px; height: 18px;">' + this.svg + '</svg></div></div>';
btnDown.classList.add('tmd-down', 'tmd-media');
this.status(btnDown, isExist ? 'completed' : 'download', isExist ? lang.completed : lang.download);
li.appendChild(btnDown);
btnDown.onclick = () => this.click(btnDown, statusId, isExist);
});
},
click: async function (btn, statusId, isExist, index) {
if (btn.classList.contains('loading')) return;
this.status(btn, 'loading');
let out = (await GM_getValue('filename', filename)).split('\n').join('');
let saveHistory = await GM_getValue('save_history', true);
let json = await this.fetchJson(statusId);
let tweet = json.legacy;
let user = json.core.user_results.result.legacy;
let invalidChars = {
'\\': '\',
'\/': '/',
'\|': '|',
'<': '<',
'>': '>',
':': ':',
'*': '*',
'?': '?',
'"': '"',
'\u200b': '',
'\u200c': '',
'\u200d': '',
'\u2060': '',
'\ufeff': '',
'🔞': ''
};
let datetime = out.match(/{date-time(-local)?:[^{}]+}/) ? out.match(/{date-time(?:-local)?:([^{}]+)}/)[1].replace(/[\\/|<>*?:"]/g, v => invalidChars[v]) : 'YYYYMMDD-hhmmss';
let info = {};
info['status-id'] = statusId;
info['user-name'] = user.name.replace(/([\\/|*?:"]|[\u200b-\u200d\u2060\ufeff]|🔞)/g, v => invalidChars[v]);
info['user-id'] = user.screen_name;
info['date-time'] = this.formatDate(tweet.created_at, datetime);
info['date-time-local'] = this.formatDate(tweet.created_at, datetime, true);
info['full-text'] = tweet.full_text.split('\n').join(' ').replace(/\s*https:\/\/t\.co\/\w+/g, '').replace(/[\\/|<>*?:"]|[\u200b-\u200d\u2060\ufeff]/g, v => invalidChars[v]);
let medias = tweet.extended_entities && tweet.extended_entities.media;
if (index) medias = [medias[index - 1]];
if (medias.length > 0) {
let tasks = medias.length;
let tasksResult = [];
medias.forEach((media, i) => {
info.url = media.type == 'photo' ? media.media_url_https + ':orig' : media.video_info.variants.filter(n => n.content_type == 'video/mp4').sort((a, b) => b.bitrate - a.bitrate)[0].url;
info.file = info.url.split('/').pop().split(/[:?]/).shift();
info['file-name'] = info.file.split('.').shift();
info['file-ext'] = info.file.split('.').pop();
info['file-type'] = media.type.replace('animated_', '');
info.out = (out.replace(/\.?{file-ext}/, '') + ((medias.length > 1 || index) && !out.match('{file-name}') ? '-' + (index ? index - 1 : i) : '') + '.{file-ext}').replace(/{([^{}:]+)(:[^{}]+)?}/g, (match, name) => info[name]);
this.downloader.add({
url: info.url,
name: info.out,
onload: () => {
tasks -= 1;
tasksResult.push(((medias.length > 1 || index) ? (index ? index : i + 1) + ': ' : '') + lang.completed);
this.status(btn, null, tasksResult.sort().join('\n'));
if (tasks === 0) {
this.status(btn, 'completed', lang.completed);
if (saveHistory && !isExist) {
history.push(statusId);
this.storage(statusId);
}
}
},
onerror: result => {
tasks = -1;
tasksResult.push((medias.length > 1 ? i + 1 + ': ' : '') + result.details.current);
this.status(btn, 'failed', tasksResult.sort().join('\n'));
}
});
});
} else {
this.status(btn, 'failed', 'MEDIA_NOT_FOUND');
}
},
status: function (btn, css, title, style) {
if (css) {
btn.classList.remove('download', 'completed', 'loading', 'failed');
btn.classList.add(css);
}
if (title) btn.title = title;
if (style) btn.style.cssText = style;
},
settings: async function () {
const $element = (parent, tag, style, content, css) => {
let el = document.createElement(tag);
if (style) el.style.cssText = style;
if (typeof content !== 'undefined') {
if (tag == 'input') {
if (content == 'checkbox') el.type = content;
else el.value = content;
} else el.innerHTML = content;
}
if (css) css.split(' ').forEach(c => el.classList.add(c));
parent.appendChild(el);
return el;
};
let wapper = $element(document.body, 'div', 'position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; background-color: #0009; z-index: 10;');
let wapperClose;
wapper.onmousedown = e => {
wapperClose = e.target == wapper;
};
wapper.onmouseup = e => {
if (wapperClose && e.target == wapper) wapper.remove();
};
let dialog = $element(wapper, 'div', 'position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); width: fit-content; width: -moz-fit-content; background-color: #f3f3f3; border: 1px solid #ccc; border-radius: 10px; color: black;');
let title = $element(dialog, 'h3', 'margin: 10px 20px;', lang.dialog.title);
let options = $element(dialog, 'div', 'margin: 10px; border: 1px solid #ccc; border-radius: 5px;');
let saveHistoryLabel = $element(options, 'label', 'display: block; margin: 10px;', lang.dialog.save_history);
let saveHistoryInput = $element(saveHistoryLabel, 'input', 'float: left;', 'checkbox');
saveHistoryInput.checked = await GM_getValue('save_history', true);
saveHistoryInput.onchange = () => {
GM_setValue('save_history', saveHistoryInput.checked);
};
let clearHistory = $element(saveHistoryLabel, 'label', 'display: inline-block; margin: 0 10px; color: blue;', lang.dialog.clear_history);
clearHistory.onclick = () => {
if (confirm(lang.dialog.clear_confirm)) {
history = [];
GM_setValue('download_history', []);
}
};
let showSensitiveLabel = $element(options, 'label', 'display: block; margin: 10px;', lang.dialog.show_sensitive);
let showSensitiveInput = $element(showSensitiveLabel, 'input', 'float: left;', 'checkbox');
showSensitiveInput.checked = await GM_getValue('show_sensitive', false);
showSensitiveInput.onchange = () => {
showSensitive = showSensitiveInput.checked;
GM_setValue('show_sensitive', showSensitive);
};
let filenameDiv = $element(dialog, 'div', 'margin: 10px; border: 1px solid #ccc; border-radius: 5px;');
let filenameLabel = $element(filenameDiv, 'label', 'display: block; margin: 10px 15px;', lang.dialog.pattern);
let filenameInput = $element(filenameLabel, 'textarea', 'display: block; min-width: 500px; max-width: 500px; min-height: 100px; font-size: inherit; background: white; color: black;', await GM_getValue('filename', filename));
let filenameTags = $element(filenameDiv, 'label', 'display: table; margin: 10px;', `
<span class="tmd-tag" title="user name">{user-name}</span>
<span class="tmd-tag" title="The user name after @ sign.">{user-id}</span>
<span class="tmd-tag" title="example: 1234567890987654321">{status-id}</span>
<span class="tmd-tag" title="{date-time} : Posted time in UTC.\n{date-time-local} : Your local time zone.\n\nDefault:\nYYYYMMDD-hhmmss => 20201231-235959\n\nExample of custom:\n{date-time:DD-MMM-YY hh.mm} => 31-DEC-21 23.59">{date-time}</span><br>
<span class="tmd-tag" title="Text content in tweet.">{full-text}</span>
<span class="tmd-tag" title="Type of "video" or "photo" or "gif".">{file-type}</span>
<span class="tmd-tag" title="Original filename from URL.">{file-name}</span>
`);
filenameInput.selectionStart = filenameInput.value.length;
filenameTags.querySelectorAll('.tmd-tag').forEach(tag => {
tag.onclick = () => {
let ss = filenameInput.selectionStart;
let se = filenameInput.selectionEnd;
filenameInput.value = filenameInput.value.substring(0, ss) + tag.innerText + filenameInput.value.substring(se);
filenameInput.selectionStart = ss + tag.innerText.length;
filenameInput.selectionEnd = ss + tag.innerText.length;
filenameInput.focus();
};
});
let btnSave = $element(title, 'label', 'float: right;', lang.dialog.save, 'tmd-btn');
btnSave.onclick = async () => {
await GM_setValue('filename', filenameInput.value);
wapper.remove();
};
},
fetchJson: async function (statusId) {
let baseUrl = `https://${host}/i/api/graphql/NmCeCgkVlsRGS1cAwqtgmw/TweetDetail`;
let variables = {
"focalTweetId": statusId,
"with_rux_injections": false,
"includePromotedContent": true,
"withCommunity": true,
"withQuickPromoteEligibilityTweetFields": true,
"withBirdwatchNotes": true,
"withVoice": true,
"withV2Timeline": true
};
let features = {
"rweb_lists_timeline_redesign_enabled": true,
"responsive_web_graphql_exclude_directive_enabled": true,
"verified_phone_label_enabled": false,
"creator_subscriptions_tweet_preview_api_enabled": true,
"responsive_web_graphql_timeline_navigation_enabled": true,
"responsive_web_graphql_skip_user_profile_image_extensions_enabled": false,
"tweetypie_unmention_optimization_enabled": true,
"responsive_web_edit_tweet_api_enabled": true,
"graphql_is_translatable_rweb_tweet_is_translatable_enabled": true,
"view_counts_everywhere_api_enabled": true,
"longform_notetweets_consumption_enabled": true,
"responsive_web_twitter_article_tweet_consumption_enabled": false,
"tweet_awards_web_tipping_enabled": false,
"freedom_of_speech_not_reach_fetch_enabled": true,
"standardized_nudges_misinfo": true,
"tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true,
"longform_notetweets_rich_text_read_enabled": true,
"longform_notetweets_inline_media_enabled": true,
"responsive_web_media_download_video_enabled": false,
"responsive_web_enhance_cards_enabled": false
};
let url = encodeURI(`${baseUrl}?variables=${JSON.stringify(variables)}&features=${JSON.stringify(features)}`);
let cookies = this.getCookie();
let headers = {
'authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA',
'x-twitter-active-user': 'yes',
'x-twitter-client-language': cookies.lang,
'x-csrf-token': cookies.ct0
};
if (cookies.ct0.length == 32) headers['x-guest-token'] = cookies.gt;
let tweetDetail = await fetch(url, {headers: headers}).then(result => result.json());
let tweetEntrie = tweetDetail.data.threaded_conversation_with_injections_v2.instructions[0].entries.find(n => n.entryId == `tweet-${statusId}`);
let tweetResult = tweetEntrie.content.itemContent.tweet_results.result;
return tweetResult.tweet || tweetResult;
},
getCookie: function (name) {
let cookies = {};
document.cookie.split(';').filter(n => n.indexOf('=') > 0).forEach(n => {
n.replace(/^([^=]+)=(.+)$/, (match, name, value) => {
cookies[name.trim()] = value.trim();
});
});
return name ? cookies[name] : cookies;
},
storage: function (value) {
let data = GM_getValue('download_history', []);
let dataLength = data.length;
if (value) {
if (Array.isArray(value)) {
data = data.concat(value);
} else if (data.indexOf(value) < 0) {
data.push(value);
}
} else {
return data;
}
if (data.length > dataLength) {
GM_setValue('download_history', data);
}
},
storageObsolete: function (isRemove) {
let data = JSON.parse(localStorage.getItem('history') || '[]');
if (isRemove) localStorage.removeItem('history');
else return data;
},
formatDate: function (i, o, tz) {
let d = new Date(i);
if (tz) d.setMinutes(d.getMinutes() - d.getTimezoneOffset());
let m = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
let v = {
YYYY: d.getUTCFullYear().toString(),
YY: d.getUTCFullYear().toString(),
MM: d.getUTCMonth() + 1,
MMM: m[d.getUTCMonth()],
DD: d.getUTCDate(),
hh: d.getUTCHours(),
mm: d.getUTCMinutes(),
ss: d.getUTCSeconds(),
h2: d.getUTCHours() % 12,
ap: d.getUTCHours() < 12 ? 'AM' : 'PM'
};
return o.replace(/(YY(YY)?|MMM?|DD|hh|mm|ss|h2|ap)/g, n => ('0' + v[n]).substr(-n.length));
},
downloader: (function () {
let tasks = [], thread = 0, maxThread = 2, retry = 0, maxRetry = 2, failed = 0, notifier, hasFailed = false;
return {
add: function (task) {
tasks.push(task);
if (thread < maxThread) {
thread += 1;
this.next();
} else this.update();
},
next: async function () {
let task = tasks.shift();
await this.start(task);
if (tasks.length > 0 && thread <= maxThread) this.next();
else thread -= 1;
this.update();
},
start: function (task) {
this.update();
return new Promise(resolve => {
GM_download({
url: task.url,
name: task.name,
onload: result => {
task.onload();
resolve();
},
onerror: result => {
this.retry(task, result);
resolve();
},
ontimeout: result => {
this.retry(task, result);
resolve();
}
});
});
},
retry: function (task, result) {
retry += 1;
if (retry == 3) maxThread = 1;
if (task.retry && task.retry >= maxRetry ||
result.details && result.details.current == 'USER_CANCELED') {
task.onerror(result);
failed += 1;
} else {
if (maxThread == 1) task.retry = (task.retry || 0) + 1;
this.add(task);
}
},
update: function () {
if (!notifier) {
notifier = document.createElement('div');
notifier.title = 'Twitter Media Downloader';
notifier.classList.add('tmd-notifier');
notifier.innerHTML = '<label>0</label>|<label>0</label>';
document.body.appendChild(notifier);
}
if (failed > 0 && !hasFailed) {
hasFailed = true;
notifier.innerHTML += '|';
let clear = document.createElement('label');
notifier.appendChild(clear);
clear.onclick = () => {
notifier.innerHTML = '<label>0</label>|<label>0</label>';
failed = 0;
hasFailed = false;
this.update();
};
}
notifier.firstChild.innerText = thread;
notifier.firstChild.nextElementSibling.innerText = tasks.length;
if (failed > 0) notifier.lastChild.innerText = failed;
if (thread > 0 || tasks.length > 0 || failed > 0) notifier.classList.add('running');
else notifier.classList.remove('running');
}
};
})(),
language: {
en: {
download: 'Download',
completed: 'Download Completed',
settings: 'Settings',
dialog: {
title: 'Download Settings',
save: 'Save',
save_history: 'Remember download history',
clear_history: '(Clear)',
clear_confirm: 'Clear download history?',
show_sensitive: 'Always show sensitive content',
pattern: 'File Name Pattern'
}
},
ja: {
download: 'ダウンロード',
completed: 'ダウンロード完了',
settings: '設定',
dialog: {
title: 'ダウンロード設定',
save: '保存',
save_history: 'ダウンロード履歴を保存する',
clear_history: '(クリア)',
clear_confirm: 'ダウンロード履歴を削除する?',
show_sensitive: 'センシティブな内容を常に表示する',
pattern: 'ファイル名パターン'
}
},
zh: {
download: '下载',
completed: '下载完成',
settings: '设置',
dialog: {
title: '下载设置',
save: '保存',
save_history: '保存下载记录',
clear_history: '(清除)',
clear_confirm: '确认要清除下载记录?',
show_sensitive: '自动显示敏感的内容',
pattern: '文件名格式'
}
},
'zh-Hant': {
download: '下載',
completed: '下載完成',
settings: '設置',
dialog: {
title: '下載設置',
save: '保存',
save_history: '保存下載記錄',
clear_history: '(清除)',
clear_confirm: '確認要清除下載記錄?',
show_sensitive: '自動顯示敏感的内容',
pattern: '文件名規則'
}
}
},
css: `
.tmd-down {margin-left: 12px; order: 99;}
.tmd-down:hover > div > div > div > div {color: rgba(29, 161, 242, 1.0);}
.tmd-down:hover > div > div > div > div > div {background-color: rgba(29, 161, 242, 0.1);}
.tmd-down:active > div > div > div > div > div {background-color: rgba(29, 161, 242, 0.2);}
.tmd-down:hover svg {color: rgba(29, 161, 242, 1.0);}
.tmd-down:hover div:first-child:not(:last-child) {background-color: rgba(29, 161, 242, 0.1);}
.tmd-down:active div:first-child:not(:last-child) {background-color: rgba(29, 161, 242, 0.2);}
.tmd-down.tmd-media {position: absolute; right: 0;}
.tmd-down.tmd-media > div {display: flex; border-radius: 99px; margin: 2px;}
.tmd-down.tmd-media > div > div {display: flex; margin: 6px; color: #fff;}
.tmd-down.tmd-media:hover > div {background-color: rgba(255,255,255, 0.6);}
.tmd-down.tmd-media:hover > div > div {color: rgba(29, 161, 242, 1.0);}
.tmd-down.tmd-media:not(:hover) > div > div {filter: drop-shadow(0 0 1px #000);}
.tmd-down g {display: none;}
.tmd-down.download g.download, .tmd-down.completed g.completed, .tmd-down.loading g.loading,.tmd-down.failed g.failed {display: unset;}
.tmd-down.loading svg {animation: spin 1s linear infinite;}
@keyframes spin {0% {transform: rotate(0deg);} 100% {transform: rotate(360deg);}}
.tmd-btn {display: inline-block; background-color: #1DA1F2; color: #FFFFFF; padding: 0 20px; border-radius: 99px;}
.tmd-tag {display: inline-block; background-color: #FFFFFF; color: #1DA1F2; padding: 0 10px; border-radius: 10px; border: 1px solid #1DA1F2; font-weight: bold; margin: 5px;}
.tmd-btn:hover {background-color: rgba(29, 161, 242, 0.9);}
.tmd-tag:hover {background-color: rgba(29, 161, 242, 0.1);}
.tmd-notifier {display: none; position: fixed; left: 16px; bottom: 16px; color: #000; background: #fff; border: 1px solid #ccc; border-radius: 8px; padding: 4px;}
.tmd-notifier.running {display: flex; align-items: center;}
.tmd-notifier label {display: inline-flex; align-items: center; margin: 0 8px;}
.tmd-notifier label:before {content: " "; width: 32px; height: 16px; background-position: center; background-repeat: no-repeat;}
.tmd-notifier label:nth-child(1):before {background-image:url("data:image/svg+xml;charset=utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22><path d=%22M3,14 v5 q0,2 2,2 h14 q2,0 2,-2 v-5 M7,10 l4,4 q1,1 2,0 l4,-4 M12,3 v11%22 fill=%22none%22 stroke=%22%23666%22 stroke-width=%222%22 stroke-linecap=%22round%22 /></svg>");}
.tmd-notifier label:nth-child(2):before {background-image:url("data:image/svg+xml;charset=utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22><path d=%22M12,2 a1,1 0 0 1 0,20 a1,1 0 0 1 0,-20 M12,5 v7 h6%22 fill=%22none%22 stroke=%22%23999%22 stroke-width=%222%22 stroke-linejoin=%22round%22 stroke-linecap=%22round%22 /></svg>");}
.tmd-notifier label:nth-child(3):before {background-image:url("data:image/svg+xml;charset=utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 viewBox=%220 0 24 24%22><path d=%22M12,0 a2,2 0 0 0 0,24 a2,2 0 0 0 0,-24%22 fill=%22%23f66%22 stroke=%22none%22 /><path d=%22M14.5,5 a1,1 0 0 0 -5,0 l0.5,9 a1,1 0 0 0 4,0 z M12,17 a2,2 0 0 0 0,5 a2,2 0 0 0 0,-5%22 fill=%22%23fff%22 stroke=%22none%22 /></svg>");}
.tmd-down.tmd-img {position: absolute; right: 0; bottom: 0; display: none !important;}
.tmd-down.tmd-img > div {display: flex; border-radius: 99px; margin: 2px; background-color: rgba(255,255,255, 0.6);}
.tmd-down.tmd-img > div > div {display: flex; margin: 6px; color: #fff !important;}
.tmd-down.tmd-img:not(:hover) > div > div {filter: drop-shadow(0 0 1px #000);}
.tmd-down.tmd-img:hover > div > div {color: rgba(29, 161, 242, 1.0);}
:hover > .tmd-down.tmd-img, .tmd-img.loading, .tmd-img.completed, .tmd-img.failed {display: block !important;}
.tweet-detail-action-item {width: 20% !important;}
`,
css_ss: `
/* show sensitive in media tab */
li[role="listitem"]>div>div>div>div:not(:last-child) {filter: none;}
li[role="listitem"]>div>div>div>div+div:last-child {display: none;}
`,
svg: `
<g class="download"><path d="M3,14 v5 q0,2 2,2 h14 q2,0 2,-2 v-5 M7,10 l4,4 q1,1 2,0 l4,-4 M12,3 v11" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></g>
<g class="completed"><path d="M3,14 v5 q0,2 2,2 h14 q2,0 2,-2 v-5 M7,10 l3,4 q1,1 2,0 l8,-11" fill="none" stroke="#1DA1F2" stroke-width="2" stroke-linecap="round" /></g>
<g class="loading"><circle cx="12" cy="12" r="10" fill="none" stroke="#1DA1F2" stroke-width="4" opacity="0.4" /><path d="M12,2 a10,10 0 0 1 10,10" fill="none" stroke="#1DA1F2" stroke-width="4" stroke-linecap="round" /></g>
<g class="failed"><circle cx="12" cy="12" r="11" fill="#f33" stroke="currentColor" stroke-width="2" opacity="0.8" /><path d="M14,5 a1,1 0 0 0 -4,0 l0.5,9.5 a1.5,1.5 0 0 0 3,0 z M12,17 a2,2 0 0 0 0,4 a2,2 0 0 0 0,-4" fill="#fff" stroke="none" /></g>
`
};
let regexStr$B = [
{url: 'facebook.com', linkType: 'contains'}
];
const website$D = {
interceptor: function () {
return GUtils.interceptor(regexStr$B)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let url = GUtils.urlFacebook();
if (url && url.length) {
let container = $j('body');
let nodeElement = '<span id="maga-video-download" class="maga-download-button">视频下载</span>';
container.append(nodeElement);
$j('#maga-video-download').on('click', function () {
GM_openInTab(url);
GUtils.clickEventUrl(`event-click-download-facebook`);
});
}
});
}
};
let regexStr$A = [
{url: 'youtube.com/watch', linkType: 'contains'}
];
const website$C = {
interceptor: function () {
return GUtils.interceptor(regexStr$A)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let url = GUtils.urlYouTuBe(encodeURIComponent(window.location.href));
if (url && url.length) {
let container = $j('body');
let nodeElement = '<span id="maga-video-download" class="maga-download-button">视频下载</span>';
container.append(nodeElement);
$j('#maga-video-download').on('click', function () {
GM_openInTab(url);
GUtils.clickEventUrl(`event-click-download-youtube`);
});
}
});
}
};
const modules$5 = [website$K, website$J, website$I, website$H, website$G, website$F, website$E, website$D, website$C];
const prepare$5 = {
init: function ($j, runType) {
GM_addElement('script', {
src: 'https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js',
type: 'text/javascript'
});
GM_addElement('script', {
src: 'https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js',
type: 'text/javascript'
});
GM_addStyle(CSS_STR$2);
for (let i = 0; i < modules$5.length; i++) {
let module = modules$5[i];
if (module.interceptor()) {
continue
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
},
};
let CSS_STR$2 = `
/*浮动按钮样式*/
.maga-image-download-float {
z-index: 9999999;
position: fixed;
bottom: 20%;
left: 50%;
transform: translate(-50%, -50%);
}
/*多个按钮的父布局样式:竖向*/
.maga-image-download-parent-v {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/*多个按钮的父布局样式:横向*/
.maga-image-download-parent-h {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
/*圆形按钮样式*/
.maga-image-download-oval {
color: #FFFFFF;
background: #5CB85C;
cursor: pointer;
border-radius: 50%;
border-color: transparent;
font-weight: 400;
font-size: 14px;
width: 55px;
height: 55px;
padding: 10px;
margin: 6px;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
/*方形按钮样式*/
.maga-image-download-rect {
color: #FFFFFF;
background: #5CB85C;
cursor: pointer;
font-weight: 400;
font-size: 14px;
border-radius: 4px;
border-color: transparent;
width: 105px;
min-height: 36px;
padding: 2px 4px;
margin: 6px;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
/*视频和图片的下载按钮*/
.maga-download-button {
bottom: 180px;
right: 50px;
position: fixed;
width: 48px;
word-wrap: break-word;
color: #fff;
background-color: #5CB85C;
cursor: pointer;
display: inline-block;
font-weight: 400;
text-align: center;
vertical-align: middle;
padding: 6px 6px;
border-radius: 4px;
box-sizing: border-box;
font-size: 14px;
z-index: 99;
}
`;
let KEY_BUTTON_TOP = 'maga-tag-navigator-button-top';
let KEY_BUTTON_LEFT = 'maga-tag-navigator-button-left';
let KEY_QRCODE = 'maga-navigator-qrcode-list-v3';
let CLASS_MENU = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'];
let idNavigatorContainer = 'maga-navigator-container';
let classSideMenu = 'maga-navigator-menu';
let classQiDianReadButton = 'maga-navigator-qidain-read';
let idNavigatorContent = 'maga-navigator-content';
let idNavigatorContentText = 'maga-navigator-content-text';
let idNavigatorContentClose = 'maga-navigator-content-close';
let regexStrQiDian = [
'qidian.com',
];
let regexStrDouBan = [
'movie.douban.com/subject',
];
let regexStrMovie = [
'360kan.com',
'iqiyi.com',
'v.qq.com',
'youku.com',
'mgtv.com',
'tv.sohu.com',
'www.le.com',
'pptv.com',
'www.wasu.cn',
'bilibili.com/video',
];
let regexStrShortVideo = [
'douyin.com',
'iesdouyin.com',
'huoshan.com',
'kuaishou.com',
'gifshow.com',
'chenzhongtech.com',
'pipix.com',
'weishi.qq.com',
'izuiyou.com',
'm.acfun.cn/v/',
'bilibili.com/video',
];
let redisStorage$2 = new RedisStorage();
let ONE_DAY$1 = 24 * 60 * 60 * 1000;
const website$B = {
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
if ($j(`#${idNavigatorContainer}`).length === 0) {
initMenu();
extraOperate();
}
});
function initMenu() {
let menus = '';
if (GUtils.hrefIndexOfIn(regexStrQiDian)) {
menus = [
{title: '小说搜索', show: '搜索<br>小说', type: 'novel', style: 'special'},
{title: '影视大全', show: '搜索<br>电影', type: 'video', style: 'normal'},
{title: '淘宝优惠', show: '淘宝<br>优惠', type: 'tb', style: 'normal'},
{title: '京东优惠', show: '京东<br>优惠', type: 'jd', style: 'normal'},
{title: '更多功能', show: '更多<br>功能', type: 'qrcode', style: 'normal'},
];
} else if (GUtils.hrefIndexOfIn(regexStrDouBan)) {
menus = [
{title: '豆瓣资源', show: '搜索<br>电影', type: 'movie_douban', style: 'special'},
{title: '小说搜索', show: '搜索<br>小说', type: 'novel', style: 'normal'},
{title: '淘宝优惠', show: '淘宝<br>优惠', type: 'tb', style: 'normal'},
{title: '京东优惠', show: '京东<br>优惠', type: 'jd', style: 'normal'},
{title: '更多功能', show: '更多<br>功能', type: 'qrcode', style: 'normal'},
];
} else if (GUtils.hrefIndexOfIn(regexStrMovie)) {
menus = [
{title: '影视大全', show: '搜索<br>电影', type: 'video', style: 'special'},
{title: '电影解析', show: '视频<br>解析', type: 'movie', style: 'special'},
{title: '淘宝优惠', show: '淘宝<br>优惠', type: 'tb', style: 'normal'},
{title: '京东优惠', show: '京东<br>优惠', type: 'jd', style: 'normal'},
{title: '更多功能', show: '更多<br>功能', type: 'qrcode', style: 'normal'},
];
} else if (GUtils.hrefIndexOfIn(regexStrShortVideo)) {
menus = [
{title: '影视大全', show: '搜索<br>电影', type: 'video', style: 'normal'},
{title: '视频解析', show: '视频<br>下载', type: 'parse', style: 'special'},
{title: '淘宝优惠', show: '淘宝<br>优惠', type: 'tb', style: 'normal'},
{title: '京东优惠', show: '京东<br>优惠', type: 'jd', style: 'normal'},
{title: '更多功能', show: '更多<br>功能', type: 'qrcode', style: 'normal'},
];
}
if (menus.length === 0) {
return
}
registerMenuCommand();
let htmlMenu = '';
$j.each(menus, function (i, item) {
htmlMenu = htmlMenu + `
<a href="javascript:void(0)" title="${item.title}"
data-cat="${item.type}" class="menu-item menu-line menu-${CLASS_MENU[i]}">
${item.show}
</a>`;
});
let html = `
<div class="maga-navigator bounceInUp animated" id="${idNavigatorContainer}">
<label class="${classSideMenu}" title="按住拖动">工具</label>${htmlMenu}
</div>`;
$j('body').append(html);
let mainMenu = $j(`#${idNavigatorContainer}`)[0];
mainMenu.style.top = GM_getValue(KEY_BUTTON_TOP, mainMenu.style.top) || '50%';
mainMenu.style.left = GM_getValue(KEY_BUTTON_LEFT, mainMenu.style.left) || '10%';
let drags = {down: false, x: 0, y: 0, clientX: 0, clientY: 0};
$j('body').on('mousedown', `#${idNavigatorContainer}`, function (a) {
drags.down = true;
drags.clientX = a.clientX;
drags.clientY = a.clientY;
drags.x = getCss(this, 'left');
drags.y = getCss(this, 'top');
drags.winHeight = $j(window).height();
drags.winWidth = $j(window).width();
$j(document).on('mousemove', function (a) {
let xMove = a.clientX - drags.clientX;
let yMove = a.clientY - drags.clientY;
mainMenu.style.top = parseInt(drags.y) + yMove + 'px';
mainMenu.style.left = parseInt(drags.x) + xMove + 'px';
GM_setValue(KEY_BUTTON_TOP, mainMenu.style.top);
GM_setValue(KEY_BUTTON_LEFT, mainMenu.style.left);
});
}).on('mouseup', `#${idNavigatorContainer}`, function () {
drags.down = false;
$j(document).off('mousemove');
});
$j('body').on('click', '[data-cat=movie]', function () {//视频解析
GM_openInTab('http://video.bwaq.cn/player?url=' + encodeURIComponent(window.location.href));
GUtils.clickEventUrl(`event-click-video`);
});
$j('body').on('click', '[data-cat=video]', function () {//影视大全
GM_openInTab('http://video.bwaq.cn');
GUtils.clickEventUrl(`event-click-video`);
});
$j('body').on('click', '[data-cat=qrcode]', function () {//更多功能:二维码
onNavigatorContentChanged($j);
});
$j('body').on('click', '[data-cat=movie_douban]', function () {//电影资源:豆瓣
let keyword = $j(document).attr('title').replace(' (豆瓣)', '');
if (keyword && keyword.length) {
GUtils.log(keyword);
GM_openInTab('http://video.bwaq.cn/search?keyword=' + encodeURIComponent(keyword));
} else {
GM_openInTab('http://video.bwaq.cn');
}
GUtils.clickEventUrl(`event-click-video`);
});
$j('body').on('click', '[data-cat=tb]', function () {
GM_openInTab(GUtils.zhihuIndexUrl('https://payback.bwaq.cn?channel=tbk'));
GUtils.clickEventUrl(`event-click-payback`);
});
$j('body').on('click', '[data-cat=jd]', function () {
GM_openInTab('https://payback.bwaq.cn?channel=jd');
GUtils.clickEventUrl(`event-click-payback`);
});
$j('body').on('click', '[data-cat=novel]', function () {
let href = href;
let keyword = '';
if (href.indexOf('https://book.qidian.com/info/') !== -1) {
keyword = $j('.book-info').find('h1').find('em').text() || '';
}
if (keyword && keyword.length) {
GM_openInTab('http://video.bwaq.cn/novel/bookShelf?keyword=' + keyword);
} else {
GM_openInTab('http://video.bwaq.cn/novel');
}
GUtils.clickEventUrl(`event-click-novel`);
});
$j('body').on('click', '[data-cat=parse]', function () {
//短视频解析
GM_openInTab('https://api.spapi.cn/');
GUtils.clickEventUrl(`event-click-video-parser`);
});
}
function getCss(element, properties) {
return document.defaultView.getComputedStyle(element, null)[properties]
}
function extraOperate() {
if (GUtils.hrefIndexOfIn(regexStrQiDian)) {
let buttonParent = $j('body > div.wrap > div.book-detail-wrap.center990 > div.book-information.cf > div.book-info > p:nth-child(5)');
let novelNameView = $j('body > div.wrap > div.book-detail-wrap.center990 > div.book-information.cf > div.book-info > h1 > em');
//添加一个跳转按钮
let indexUrl;
let novelName = novelNameView.text() || '';
if (novelName.length === 0) {
indexUrl = 'http://video.bwaq.cn/novel';
} else {
indexUrl = 'http://video.bwaq.cn/novel/bookShelf?keyword=' + encodeURIComponent(novelName);
}
let row = `<a class="${classQiDianReadButton}"
href="${indexUrl}" target="_blank">
<span>小说插件免费阅读</span>
</a>`;
buttonParent.prepend(row);
}
}
function registerMenuCommand() {
GM_registerMenuCommand('工具按钮位置复位', function () {
GM_deleteValue(KEY_BUTTON_TOP);
GM_deleteValue(KEY_BUTTON_LEFT);
let mainMenu = $j(`#${idNavigatorContainer}`)[0];
mainMenu.style.top = '50%';
mainMenu.style.left = '0';
});
}
/*控制搜索结果面板的显示和隐藏*/
function renderQrcode($j, qrcodeList) {
let qrcodeHtml = '';
qrcodeList.forEach(qrcode => {
let qrcodeUrl;
if (qrcode.qrcodeImageUrl && qrcode.qrcodeImageUrl.length) {
qrcodeUrl = qrcode.qrcodeImageUrl;
} else {
qrcodeUrl = GUtils.urlQrCode(encodeURIComponent(qrcode.qrcodeContent));
}
let qrcodeDesc = qrcode.qrcodeDesc.replaceAll('\\n', '</br>');
qrcodeHtml = qrcodeHtml + `
<div style="padding:10px 30px;display: flex;flex-direction: column;justify-content: center;align-items: center">
<span style="font-size: 18px;font-weight:550;color: #000000;">
${qrcode.qrcodeName}
</span>
<img style="width: 140px;height: 140px;margin: 10px 0" src="${qrcodeUrl}"></img>
<span style="font-size: 13px;font-weight:510;color: #444444;text-align:center">${qrcodeDesc}</span>
</div>`;
});
$j(`#${idNavigatorContentText}`).html(`<div style="display: flex;flex-direction: row">${qrcodeHtml}</div>`);
}
function onNavigatorContentChanged($j) {
if ($j(`#${idNavigatorContent}`).length === 0) {
let html = `
<div id='${idNavigatorContent}'>
<span id='${idNavigatorContentClose}' style="cursor: pointer"> ✕ </span>
<div id='${idNavigatorContentText}'></div>
</div>`;
$j('body').append(html);
$j(`#${idNavigatorContentClose}`).click(function () {
$j(`#${idNavigatorContent}`).css('display', 'none');
});
$j(document).keyup(function (e) {
if (e.key === 'Escape') {// ESC关闭页面
$j(`#${idNavigatorContent}`).css('display', 'none');
}
});
}
$j(`#${idNavigatorContent}`).css('display', 'flex');
let qrcodeList = redisStorage$2.get(KEY_QRCODE);
if (qrcodeList) {
GUtils.log('二维码缓存获取成功');
renderQrcode($j, JSON.parse(qrcodeList));
} else {
let requestUrl = GUtils.qrcodeConfigUrl();
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
GUtils.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
let data = resp.data;
if (resp.code == 10 && data) {
redisStorage$2.set({
name: KEY_QRCODE,
value: JSON.stringify(data),
expires: ONE_DAY$1,
});
renderQrcode($j, data);
}
},
});
}
}
},
};
const modules$4 = [website$B];
const prepare$4 = {
init: function ($j, runType) {
if (GUtils.inIframe()) {
return
}
GM_addStyle(CSS_STR$1);
for (let i = 0; i < modules$4.length; i++) {
let module = modules$4[i];
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
},
};
let CSS_STR$1 = `
.maga-navigator {
margin: 0;
width: 260px;
height: 260px;
opacity: 0.75;
z-index: 99999999;
position: fixed;
filter: url(#goo);
-webkit-filter: url(#goo);
user-select: none;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
font-family: "Helvetica Neue", Helvetica, "Microsoft YaHei", Arial, sans-serif;
}
.maga-navigator .maga-navigator-menu {
position: absolute;
width: 70px;
height: 70px;
-webkit-border-radius: 50%;
border-radius: 50%;
background: #f34444;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
text-align: center;
line-height: 70px;
color: #fff;
font-size: 20px;
z-index: 1;
cursor: move
}
.maga-navigator .menu-item {
position: absolute;
width: 60px;
height: 60px;
background-color: #FF7676;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
line-height: 60px;
text-align: center;
-webkit-border-radius: 50%;
border-radius: 50%;
text-decoration: none;
color: #fff;
-webkit-transition: background .5s, -webkit-transform .6s;
transition: background .5s, -webkit-transform .6s;
-moz-transition: transform .6s, background .5s, -moz-transform .6s;
transition: transform .6s, background .5s;
transition: transform .6s, background .5s, -webkit-transform .6s, -moz-transform .6s;
font-size: 14px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}
.maga-navigator .menu-item:hover {
background: #A9C734;
}
.maga-navigator .menu-line {
line-height: 20px;
padding-top: 10px;
}
.maga-navigator:hover {
opacity: 1;
}
.maga-navigator:hover .maga-navigator-menu {
-webkit-animation: jello 1s;
-moz-animation: jello 1s;
animation: jello 1s
}
.maga-navigator:hover .menu-first {
-webkit-transform: translate3d(0, -135%, 0);
-moz-transform: translate3d(0, -135%, 0);
transform: translate3d(0, -135%, 0)
}
.maga-navigator:hover .menu-second {
-webkit-transform: translate3d(120%, -70%, 0);
-moz-transform: translate3d(120%, -70%, 0);
transform: translate3d(120%, -70%, 0)
}
.maga-navigator:hover .menu-third {
-webkit-transform: translate3d(120%, 70%, 0);
-moz-transform: translate3d(120%, 70%, 0);
transform: translate3d(120%, 70%, 0)
}
.maga-navigator:hover .menu-fourth {
-webkit-transform: translate3d(0, 135%, 0);
-moz-transform: translate3d(0, 135%, 0);
transform: translate3d(0, 135%, 0)
}
.maga-navigator:hover .menu-fifth {
-webkit-transform: translate3d(-120%, 70%, 0);
-moz-transform: translate3d(-120%, 70%, 0);
transform: translate3d(-120%, 70%, 0)
}
.maga-navigator:hover .menu-sixth {
-webkit-transform: translate3d(-120%, -70%, 0);
-moz-transform: translate3d(-120%, -70%, 0);
transform: translate3d(-120%, -70%, 0)
}
@-webkit-keyframes jello {
from, 11.1%, to {
-webkit-transform: none;
transform: none
}
22.2% {
-webkit-transform: skewX(-12.5deg) skewY(-12.5deg);
transform: skewX(-12.5deg) skewY(-12.5deg)
}
33.3% {
-webkit-transform: skewX(6.25deg) skewY(6.25deg);
transform: skewX(6.25deg) skewY(6.25deg)
}
44.4% {
-webkit-transform: skewX(-3.125deg) skewY(-3.125deg);
transform: skewX(-3.125deg) skewY(-3.125deg)
}
55.5% {
-webkit-transform: skewX(1.5625deg) skewY(1.5625deg);
transform: skewX(1.5625deg) skewY(1.5625deg)
}
66.6% {
-webkit-transform: skewX(-.78125deg) skewY(-.78125deg);
transform: skewX(-.78125deg) skewY(-.78125deg)
}
77.7% {
-webkit-transform: skewX(0.390625deg) skewY(0.390625deg);
transform: skewX(0.390625deg) skewY(0.390625deg)
}
88.8% {
-webkit-transform: skewX(-.1953125deg) skewY(-.1953125deg);
transform: skewX(-.1953125deg) skewY(-.1953125deg)
}
}
#maga-navigator-content {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3);
z-index: 999999;
position: fixed;
background: #FFFFFF;
border-radius: 6px;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
min-width: 300px;
min-height: 300px;
overflow-y: scroll;
box-sizing: content-box;
font-family: "Helvetica Neue", "Helvetica", "Microsoft Yahei", "微软雅黑", "Arial", "sans-serif";
font-size: 14px;
}
#maga-navigator-content::-webkit-scrollbar {
width: 0;
height: 0;
}
#maga-navigator-content-close {
font-size: 14px;
color: #333333;
line-height: 22px;
margin: 10px;
text-align: center;
align-self: flex-end;
text-decoration: none !important;
}
.maga-navigator-qidain-read {
width: 140px !important;
font-size: 14px !important;
line-height: 34px !important;
text-align: center !important;
color: #ffffff !important;
text-align: center !important;
text-decoration: none !important;
background: #bf2c24 !important;
margin: 0 15px 0 0 !important;
}
@-moz-keyframes jello {
from, 11.1%, to {
-moz-transform: none;
transform: none
}
22.2% {
-moz-transform: skewX(-12.5deg) skewY(-12.5deg);
transform: skewX(-12.5deg) skewY(-12.5deg)
}
33.3% {
-moz-transform: skewX(6.25deg) skewY(6.25deg);
transform: skewX(6.25deg) skewY(6.25deg)
}
44.4% {
-moz-transform: skewX(-3.125deg) skewY(-3.125deg);
transform: skewX(-3.125deg) skewY(-3.125deg)
}
55.5% {
-moz-transform: skewX(1.5625deg) skewY(1.5625deg);
transform: skewX(1.5625deg) skewY(1.5625deg)
}
66.6% {
-moz-transform: skewX(-.78125deg) skewY(-.78125deg);
transform: skewX(-.78125deg) skewY(-.78125deg)
}
77.7% {
-moz-transform: skewX(0.390625deg) skewY(0.390625deg);
transform: skewX(0.390625deg) skewY(0.390625deg)
}
88.8% {
-moz-transform: skewX(-.1953125deg) skewY(-.1953125deg);
transform: skewX(-.1953125deg) skewY(-.1953125deg)
}
}
@keyframes jello {
from, 11.1%, to {
-webkit-transform: none;
-moz-transform: none;
transform: none
}
22.2% {
-webkit-transform: skewX(-12.5deg) skewY(-12.5deg);
-moz-transform: skewX(-12.5deg) skewY(-12.5deg);
transform: skewX(-12.5deg) skewY(-12.5deg)
}
33.3% {
-webkit-transform: skewX(6.25deg) skewY(6.25deg);
-moz-transform: skewX(6.25deg) skewY(6.25deg);
transform: skewX(6.25deg) skewY(6.25deg)
}
44.4% {
-webkit-transform: skewX(-3.125deg) skewY(-3.125deg);
-moz-transform: skewX(-3.125deg) skewY(-3.125deg);
transform: skewX(-3.125deg) skewY(-3.125deg)
}
55.5% {
-webkit-transform: skewX(1.5625deg) skewY(1.5625deg);
-moz-transform: skewX(1.5625deg) skewY(1.5625deg);
transform: skewX(1.5625deg) skewY(1.5625deg)
}
66.6% {
-webkit-transform: skewX(-.78125deg) skewY(-.78125deg);
-moz-transform: skewX(-.78125deg) skewY(-.78125deg);
transform: skewX(-.78125deg) skewY(-.78125deg)
}
77.7% {
-webkit-transform: skewX(0.390625deg) skewY(0.390625deg);
-moz-transform: skewX(0.390625deg) skewY(0.390625deg);
transform: skewX(0.390625deg) skewY(0.390625deg)
}
88.8% {
-webkit-transform: skewX(-.1953125deg) skewY(-.1953125deg);
-moz-transform: skewX(-.1953125deg) skewY(-.1953125deg);
transform: skewX(-.1953125deg) skewY(-.1953125deg)
}
}
.animated {
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
animation-fill-mode: both
}
@-webkit-keyframes bounceInUp {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, .61, .355, 1);
animation-timing-function: cubic-bezier(0.215, .61, .355, 1)
}
from {
opacity: 0;
-webkit-transform: translate3d(0, 800px, 0);
transform: translate3d(0, 800px, 0)
}
60% {
opacity: 1;
-webkit-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0)
}
75% {
-webkit-transform: translate3d(0, 10px, 0);
transform: translate3d(0, 10px, 0)
}
90% {
-webkit-transform: translate3d(0, -5px, 0);
transform: translate3d(0, -5px, 0)
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
}
@-moz-keyframes bounceInUp {
from, 60%, 75%, 90%, to {
-moz-animation-timing-function: cubic-bezier(0.215, .61, .355, 1);
animation-timing-function: cubic-bezier(0.215, .61, .355, 1)
}
from {
opacity: 0;
-moz-transform: translate3d(0, 800px, 0);
transform: translate3d(0, 800px, 0)
}
60% {
opacity: 1;
-moz-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0)
}
75% {
-moz-transform: translate3d(0, 10px, 0);
transform: translate3d(0, 10px, 0)
}
90% {
-moz-transform: translate3d(0, -5px, 0);
transform: translate3d(0, -5px, 0)
}
to {
-moz-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
}
@keyframes bounceInUp {
from, 60%, 75%, 90%, to {
-webkit-animation-timing-function: cubic-bezier(0.215, .61, .355, 1);
-moz-animation-timing-function: cubic-bezier(0.215, .61, .355, 1);
animation-timing-function: cubic-bezier(0.215, .61, .355, 1)
}
from {
opacity: 0;
-webkit-transform: translate3d(0, 800px, 0);
-moz-transform: translate3d(0, 800px, 0);
transform: translate3d(0, 800px, 0)
}
60% {
opacity: 1;
-webkit-transform: translate3d(0, -20px, 0);
-moz-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0)
}
75% {
-webkit-transform: translate3d(0, 10px, 0);
-moz-transform: translate3d(0, 10px, 0);
transform: translate3d(0, 10px, 0)
}
90% {
-webkit-transform: translate3d(0, -5px, 0);
-moz-transform: translate3d(0, -5px, 0);
transform: translate3d(0, -5px, 0)
}
to {
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
}
.bounceInUp {
-webkit-animation-name: bounceInUp;
-moz-animation-name: bounceInUp;
animation-name: bounceInUp;
-webkit-animation-delay: 1s;
-moz-animation-delay: 1s;
animation-delay: 1s
}
@media screen and (max-width: 640px) {
.maga-navigator {
/* display: none!important */
}
}
@media screen and (min-width: 641px) and (max-width: 1367px) {
.maga-navigator {
top: 50px
}
}
`;
var Constant = {
getLinkStr: function () {
return linkStr
},
getSelectMode: function () {
return 'maga-key-optimize-select-mode'//记录上次点击的是书签还是搜索模块
},
StrSearch: function () {
return 'maga-optimize-select-mode-search'//常量
},
StrBookMark: function () {
return 'maga-optimize-select-mode-bookmark'//常量
},
getBookMarkIds: function () {
return 'maga-optimize-select-booktype-id-'//书签类型ID缓存
},
getListBookType: function () {
return 'maga-optimize-select-booktype-list'//书签类型缓存
},
getListBookMark: function () {
return 'maga-optimize-select-bookmark-list-'//书签缓存
},
getKeyButtonTop: function () {
return 'maga-tag-navigator-button-top'//工具按钮的y坐标的记录点常量
},
getKeyButtonLeft: function () {
return 'maga-tag-navigator-button-left'//工具按钮的x坐标的记录点常量
},
getKeySwitch: function () {
return 'maga-key-optimize-search-switch'//总开关:处于关闭状态则其他的按钮全部是收起状态
},
getKeySearch: function () {
return 'maga-key-optimize-search-search'//搜索功能上次是否开启
},
getKeyBookMark: function () {
return 'maga-key-optimize-search-bookmark'//书签功能上次是否开启
},
};
let linkStr = `
[百度搜索] [https://www.baidu.com/s?wd=#keyword#]
[360搜索] [https://www.so.com/s?q=#keyword#]
[搜狗搜索] [https://www.sogou.com/web?query=#keyword#]
[谷歌搜索] [https://www.google.com/search?q=#keyword#]
[Bing搜索] [https://cn.bing.com/search?q=#keyword#]
[雅虎] [https://search.yahoo.com/search?p=#keyword#] (input[name=p])
[Yandex] [https://yandex.com/search/?text=#keyword#] (input[name=text])
[百度翻译] [https://fanyi.baidu.com/#en/zh/#keyword#] [新窗口]
[谷歌翻译] [https://translate.google.com/?hl=zh-CN&tab=wT0#view=home&op=translate&sl=auto&tl=zh-CN&text=#keyword#] [新窗口]
[搜狗翻译] [https://fanyi.sogou.com/?keyword=#keyword#] [新窗口]
[Quora] [https://www.quora.com/search?q=#keyword#] [新窗口]
[维基百科] [https://zh.wikipedia.org/wiki/#keyword#] [新窗口]
[知乎搜索] [https://www.zhihu.com/search?type=content&q=#keyword#]
[豆瓣搜索] [https://www.douban.com/search?source=suggest&q=#keyword#]
[简书] [https://www.jianshu.com/search?q=#keyword#] (#q)
[GitHub] [https://github.com/search?utf8=✓&q=#keyword#]
[Stackoverflow] [https://stackoverflow.com/search?q=#keyword#] [新窗口]
[Segmentfault] [https://segmentfault.com/search?q=#keyword#]
[博客园] [https://zzk.cnblogs.com/s?w=#keyword#] (input[name=Keywords]) [右侧]
[CSDN] [https://so.csdn.net/so/search/s.do?q=#keyword#] (#toolbar-search-input)
[掘金] [https://juejin.im/search?query=#keyword#] (.search-input)
[MSDN] [https://docs.microsoft.com/zh-cn/search/?terms=#keyword#] [新窗口]
[百度图片] [https://image.baidu.com/search/index?tn=baiduimage&word=#keyword#] [新窗口]
[Google图片] [https://www.google.com/search?q=#keyword#&tbm=isch] [新窗口]
[Bing图片] [https://cn.bing.com/images/search?q=#keyword#&scenario=ImageBasicHover] [新窗口]
[有道词典] [https://dict.youdao.com/w/#keyword#] [新窗口]
[必应词典] [https://cn.bing.com/dict/search?q=#keyword#] [新窗口]
[Vocabulary] [https://www.vocabulary.com/dictionary/#keyword#] [新窗口]
[格林斯高阶] [https://www.collinsdictionary.com/dictionary/english/#keyword#] [新窗口]
[剑桥词典] [https://dictionary.cambridge.org/zhs/%E8%AF%8D%E5%85%B8/%E8%8B%B1%E8%AF%AD-%E6%B1%89%E8%AF%AD-%E7%AE%80%E4%BD%93/#keyword#] [新窗口]
[韦氏词典] [https://www.learnersdictionary.com/definition/#keyword#] [新窗口]
[淘宝搜索] [https://s.taobao.com/search?q=#keyword#] [新窗口]
[天猫搜索] [https://list.tmall.com/search_product.htm?q=#keyword#] [新窗口]
[京东搜索] [http://search.jd.com/Search?keyword=#keyword#] [新窗口]
[亚马逊] [https://www.amazon.cn/s?k=#keyword#] [新窗口]
[当当网] [http://search.dangdang.com/?key=#keyword#] [新窗口]
[孔夫子] [http://search.kongfz.com/product_result/?key=#keyword#] [新窗口]
[YouTube] [https://www.youtube.com/results?search_query=#keyword#] [新窗口]
[Bilibili] [http://search.bilibili.com/all?keyword=#keyword#] [新窗口]
[优酷搜索] [https://so.youku.com/search_video/q_#keyword#] [新窗口]
[爱奇艺搜索] [https://so.iqiyi.com/so/q_#keyword#] [新窗口]
[腾讯视频] [https://v.qq.com/x/search/?q=#keyword#] [新窗口]
[云盘精灵搜] [https://www.yunpanjingling.com/search/#keyword#]
[大圣盘搜索] [https://www.dashengpan.com/search?keyword=#keyword#]
[大力盘搜索] [https://www.dalipan.com/search?keyword=#keyword#]
[小昭来啦] [https://www.xiaozhaolaila.com/s/search?q=#keyword#]
[小可搜搜] [https://www.xiaokesoso.com/s/search?q=#keyword#]
`;
let linkList = '';
let currQueryPramVal = '';
let currSelector = '';
var Utils = {
get: function () {
if (!linkList || linkList.length === 0) {
linkList = this.trim(this.getDefault());
}
return linkList
},
getDefault: function () {
//默认的搜索引擎格式:[名称][搜索网址][是否新窗口打开,可省略] 搜索关键词用 #keyword# 表示,每行一个网站
return this.trim(Constant.getLinkStr())
},
trim: function (str) {
if (typeof str === 'string') {
//去除字符串两端空白符
return str
.replace(/^\s\s*/, '')
.replace(/\s\s*$/, '')
.trim()
} else {
return str
}
},
//获取搜索关键词
getQueryPramValue: function () {
{
return currQueryPramVal
}
},
getUserSelector: function ($j) {
{
return currSelector
}
},
//尝试用户自定义关键词
getKeywordConfig: function ($j) {
//尝试用户自定义选择符
let val = '';
let selector = this.getUserSelector($j);
if (selector) {
if (selector.indexOf('#') !== -1 ||
selector.indexOf('.') !== -1 ||
selector.indexOf('=') !== -1 ||
selector.indexOf('input') !== -1 ||
selector.indexOf(':') !== -1) {
val = $j(selector).val() || $j(selector).text();
}
if (val && val.length > 0) {
return val
} else {
return $j('#' + selector).val() ||
$j('.' + selector).val() ||
$j('input[name=\'' + selector + '\']').val() ||
$j('#' + selector).text() ||
$j('.' + selector).text() ||
$j('input[name=\'' + selector + '\']').text()
}
} else {
return ''
}
},
//尝试获取常见选择符
getKeywordCommon: function ($j) {
//尝试常用标记
let val = $j('input[name=q]').val() || $j('input[name=query]').val()
|| $j('input[name=search]').val() || $j('input[name=keyword]').val()
|| $j('input[name=Keywords]').val() || $j('input[name=\'w\']').val()
|| $j('input[name=searchInput]').val() || $j('input[name=word]').val()
|| $j('input[name=\'search-input\']').val() || $j('input[name=\'text\']').val()
|| $j('input[name=\'s\']').val() || $j('input[name=key]').val()
|| $j('input#q').val() || $j('input#query').val()
|| $j('input#search').val() || $j('input#keyword').val()
|| $j('input#Keywords').val() || $j('input#w').val()
|| $j('input#input').val() || $j('#input[name=searchWord]').val()
|| $j('input#searchInput').val() || $j('input#word').val()
|| $j('input#search-input').val() || $j('input#text').val()
|| $j('input#s').val() || $j('input#search_input').val()
|| $j('input#key').val() || $j('input.q').val()
|| $j('input.query').val() || $j('input.search').val()
|| $j('input.keyword').val() || $j('input.Keywords').val()
|| $j('input.w').val() || $j('input.input').val()
|| $j('input.key').val() || $j('input.searchInput').val()
|| $j('input.word').val() || $j('input.search-input').val()
|| $j('input.text').val() || $j('input.s').val()
|| $j('input.search_input').val()
|| $j('#kw').val() || $j('input[name=q]').val()
|| $j('#upquery').val() || $j('#baidu_translate_input').val()
|| $j('#sb_form_q').val() || $j('#query').val()
|| $j('#trans-input').val() || $j('#Popover2-toggle').val()
|| $j('input.word').val() || $j('input[name=q]').eq(1).val()
|| $j('#search').val() || $j('#searchword').val()
|| $j('input[name=keyword]').val() || $j('input[name=searchInput]').val()
|| $j('#mq').val() || $j('#keywords').val()
|| $j('input[name=p]').val() || $j('.right_contents input.selector_input').val()
|| $j('#searchIput').val() || $j('input[name=text]').val()
|| $j('input[name=Keywords]').val() || $j('#q').val()
|| $j('#toolbar-search-input').val() || $j('input.search-input').val()
|| $j('input[name=\'facet-search-input\']').val() || $j('.headword').text()
|| $j('input[name=ld_search_inp]').eq(1).val() || $j('#twotabsearchtextbox').val()
|| $j('#key_S').val() || $j('#stickSearchKey').val() || '';
//获取地址栏参数
if (val) {
return val
} else {
return this.getQueryPramValue()
}
},
//获取youtube选择符
getKeywordYuToBe: function () {
let ytbObj = document.getElementsByName('search_query');
if (ytbObj && ytbObj[0] && ytbObj[0].value) {
return ytbObj[0].value
}
return ''
},
//获取搜索关键词
getKeyword: function ($j) {
let keyword = this.getKeywordCommon($j) || this.getKeywordYuToBe() || this.getKeywordConfig($j);
return encodeURIComponent(keyword.replace(/^\s+|\s+$/gm, ''))
},
};
let idChatGPTClose = 'maga-chatgpt-close';
let idChatGPTContent$1 = 'maga-chatgpt-content';
let idChatGPTContentLink = 'maga-chatgpt-content-link';
let idChatGPTBottomLink = 'maga-chatgpt-bottom';
let classChatGPTBottomLink = 'maga-chatgpt-bottom';
let classChatGPTBottomLinkItem = 'maga-link-url-item';
var Chatgpt = {
createChatGPTPanel: function ($j) {
if ($j(`#${idChatGPTContent$1}`).length === 0) {
let html = `
<div id='${idChatGPTContent$1}'>
<div class="tablayout">
<div style="flex: 1"></div>
<span id='${idChatGPTClose}'> ✕ </span>
</div>
<div id='${idChatGPTContentLink}'></div>
<div id='${idChatGPTBottomLink}' class='${classChatGPTBottomLink}'></div>
</div>`;
$j('body').append(html);
$j(`#${idChatGPTClose}`).click(function () {
$j(`#${idChatGPTContent$1}`).css('display', 'none');
});
$j(document).keyup(function (e) {
if (e.key === 'Escape') {
// ESC关闭页面 输入框没有输入的内容时
$j(`#${idChatGPTContent$1}`).css('display', 'none');
}
});
}
createHtmlLink$1($j);
$j(`#${idChatGPTContent$1}`).css('display', 'flex');
},
};
function createHtmlLink$1($j) {
let linkHtml = `
<iframe
ref="iframe"
src="https://bwaq.cn/chat?iframe=true"
allowTransparency="true"
allowfullscreen="true"
border="0"
style="height: 100%;object-fit: cover"
frameborder="no"
height="100%"
hspace="1"
marginheight="0"
marginwidth="0"
runat="server"
scrolling="auto"
vspace="1"
width="100%">
</iframe>
`;
GUtils.log('linkHtml', linkHtml);
let linkBottomHtml = `
<a class="${classChatGPTBottomLinkItem}" target="_blank" href="https://video.bwaq.cn/">
免费电影
</a>
<a class="${classChatGPTBottomLinkItem}" target="_blank" href="https://video.bwaq.cn/novel">
免费小说
</a>
<a class="${classChatGPTBottomLinkItem}" target="_blank" href="https://payback.bwaq.cn/">
优惠券
</a>
<div style="flex: 1"></div>
<a class="${classChatGPTBottomLinkItem}"
style="color: #ff9900 !important;font-weight: 540 !important;"
target="_blank" href="https://bwaq.cn/chat">
使用完整版本
</a>`;
$j(`#${idChatGPTContentLink}`).html(linkHtml);
$j(`#${idChatGPTBottomLink}`).html(linkBottomHtml);
}
let KeyTodo = 'maga-one-tab-key-todo-v02';
class Todo {
READY() {
return 'ready'
}
DOING() {
return 'doing'
}
FINISH() {
return 'finish'
}
PAUSE() {
return 'pause'
}
LEVEL_L() {
return 'low'
}
LEVEL_M() {
return 'middle'
}
LEVEL_H() {
return 'high'
}
constructor() {
this.name = 'Todo';
}
add(content, level) {
GUtils.log('content:' + content + ', level:' + level);
if (content && content.length) {
let todoList = this.get();
todoList.unshift({
id: GUtils.UUID(),
level: level || this.LEVEL_L(),
status: this.READY(),
content: content,
});
GM_setValue(KeyTodo, todoList);
}
}
alter(todo) {
GUtils.log('todo', JSON.stringify(todo));
let todoList = this.get();
todoList.map((item, index) => {
if (todo.id === item.id) {
todoList.splice(index, 1);
todoList.unshift(todo);
}
});
GM_setValue(KeyTodo, todoList);
}
remove(id) {
let todoList = this.get();
for (let i = 0; i < todoList.length; i++) {
if (todoList[i].id === id) {
todoList.splice(i, 1);
GM_setValue(KeyTodo, todoList);
break
}
}
}
get() {
let value = GM_getValue(KeyTodo, '');
if (typeof value === 'string') {
return []
} else {
return value
}
}
getItem(id) {
let todoList = this.get();
for (let todoItem of todoList) {
if (todoItem.id === id) {
return todoItem
}
}
return null
}
}
//使用例子:
// let hashmap = new HashMap();
// hashmap.put(key, value);
// var value = hashmap.get(key);
let length = 0;//定义长度
let obj = new Object();//创建一个对象
class HashMap {
constructor() {
this.name = 'HashMap';
}
//判断Map是否为空
isEmpty() {
return length == 0
}
//判断对象中是否包含给定Key
containsKey(key) {
return (key in obj)
}
//判断对象中是否包含给定的Value
containsValue(value) {
for (var key in obj) {
if (obj[key] == value) {
return true
}
}
return false
}
//向map中添加数据
put(key, value) {
if (this.containsKey(key)) {
obj[key] = value;
} else {
length++;
obj[key] = value;
}
}
//向map中添加数据
putAll(hashMap) {
if (hashMap === null || hashMap.size() === 0) {
return
}
for (var key of hashMap.keySet()) {
let value = hashMap.get(key);
if (value !== null) {
this.put(key, value);
}
}
}
//根据给定的key获取Value
get(key) {
return this.containsKey(key) ? obj[key] : null
}
//根据给定的Key删除一个值
remove(key) {
if (this.containsKey(key) && (delete obj[key])) {
length--;
}
}
//获得Map中所有的value
values() {
var _values = new Array();
for (var key in obj) {
_values.push(obj[key]);
}
return _values
}
//获得Map中的所有key
keySet() {
var _keys = new Array();
for (var key in obj) {
_keys.push(key);
}
return _keys
}
//获得Map的长度
size() {
return length
}
//清空Map
clear() {
length = 0;
obj = new Object();
}
//打印所有的键值对
toStringStr() {
let str = '';
for (var key in obj) {
str += `["key":${key}, "value":${obj[key]}] `;
}
return str.trim()
}
}
let KeyOneTabDate = 'maga-one-tab-key-date-v1';
class Operator {
constructor() {
this.name = 'Operator';
}
put(linkUrl) {
let date = GUtils.getDateFormat();
let linkUrlList = this.getLinkUrlList(date);
if (GUtils.itemEqualsIndex(linkUrl, linkUrlList) > -1) {
//将某一项移到首位
linkUrlList.map((item, index) => {
if (item === linkUrl) {
linkUrlList.unshift(linkUrlList.splice(index, 1)[0]);
}
});
} else {
linkUrlList.unshift(linkUrl);
}
GM_setValue(KeyOneTabDate + date, linkUrlList);
let dateList = this.getDateList();
if (GUtils.itemEqualsIndex(date, dateList) > -1) {
return
}
dateList.unshift(date);
GM_setValue(KeyOneTabDate, dateList);
}
remove(date, linkUrl) {
let linkUrlList = this.getLinkUrlList(date);
let indexLink = GUtils.itemEqualsIndex(linkUrl, linkUrlList);
if (indexLink > -1) {
linkUrlList.splice(indexLink, 1);
if (linkUrlList.length === 0) {
//该日期下已经不存在任何条目
GM_deleteValue(KeyOneTabDate + date);
let dateList = this.getDateList();
let indexDate = GUtils.itemEqualsIndex(date, dateList);
if (indexDate > -1) {
dateList.splice(indexDate, 1);
GM_setValue(KeyOneTabDate, dateList);
}
} else {
GM_setValue(KeyOneTabDate + date, linkUrlList);
}
}
}
isFavorite() {
let linkUrlList = this.getLinkUrlList(GUtils.getDateFormat());
return GUtils.itemEqualsIndex(location.href, linkUrlList) > -1
}
get() {
let result = [];
let dateList = this.getDateList();
for (let i = 0; i < dateList.length; i++) {
let date = dateList[i];
let linkUrlList = this.getLinkUrlList(date);
result.push({date: date, list: linkUrlList});
}
GUtils.log('OneTab:', result);
return result
}
getDateList() {
var value = GM_getValue(KeyOneTabDate, '');
if (typeof value === 'string') {
return []
} else {
return value
}
}
getLinkUrlList(date) {
var value = GM_getValue(KeyOneTabDate + date, '');
if (typeof value === 'string') {
return []
} else {
return value
}
}
}
let KeyTabSelect = 'maga-one-tab-key-select-tab';
let idOnetabContent$1 = 'maga-onetab-content';
let idOnetabContentClose = 'maga-onetab-content-close';
let idOnetabLink = 'maga-onetab-link';
let idOnetabTodo = 'maga-onetab-todo';
let idOnetabFavorite = 'maga-onetab-favorite';
let classOnetabContentWrapper = 'maga-onetab-content-wrapper';
let classOnetabBottom = 'maga-onetab-bottom';
let idOnetabContentLink = 'maga-onetab-content-link';
let idOnetabContentTodo = 'maga-onetab-content-todo';
let idOnetabBottomLink = 'maga-onetab-bottom-link';
let idOnetabBottomTodo = 'maga-onetab-bottom-todo';
let iconEmpty = `
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
<path d="M491.12588 196.681c0 13.868-11.26 25.095-25.107 25.095H365.56188a25.11 25.11 0 0 1-17.762-7.344 25.135 25.135 0 0 1-7.361-17.751c0-13.864 11.249-25.113 25.124-25.113h100.457c13.846-0.001 25.106 11.249 25.106 25.113z m136.727 0c0 13.868-7.915 25.095-17.682 25.095h-70.667c-9.778 0-17.682-11.237-17.682-25.095 0-13.864 7.903-25.113 17.682-25.113h70.667c9.767-0.001 17.682 11.249 17.682 25.113zM781.32088 298.526a29.297 29.297 0 0 1-29.313 29.303H461.81388c-16.178 0-29.295-13.117-29.295-29.302 0-16.177 13.118-29.295 29.295-29.295h290.195a29.303 29.303 0 0 1 20.727 8.575 29.306 29.306 0 0 1 8.585 20.719z m78.135 104.634c0 15.416-12.494 27.916-27.915 27.916H393.45588c-15.416 0-27.91-12.494-27.91-27.91 0-15.41 12.495-27.909 27.91-27.909H831.53088c15.415 0 27.915 12.489 27.925 27.903z m25.113 99.073a29.313 29.313 0 0 1-8.58 20.725 29.287 29.287 0 0 1-20.721 8.586h-80.938c-16.189 0-29.307-13.123-29.307-29.306 0-16.185 13.117-29.308 29.307-29.308h80.938c7.77 0 15.223 3.088 20.721 8.58a29.328 29.328 0 0 1 8.58 20.723z m-161.85 0c0 16.192-19.491 29.311-43.589 29.311H118.90088c-24.055 0-43.558-13.106-43.558-29.311 0-16.186 19.502-29.303 43.558-29.303h560.229c24.098 0.001 43.589 13.118 43.589 29.303z m0 0" fill="#E3EDF1"></path>
<path d="M245.56088 562.214a30.712 30.712 0 0 1-8.994 21.719 30.661 30.661 0 0 1-21.714 8.988h-41.856c-16.955 0-30.697-13.74-30.697-30.697 0-16.951 13.742-30.691 30.697-30.691h41.856a30.695 30.695 0 0 1 30.708 30.681z m0 0" fill="#E3EDF1"></path>
<path d="M546.92488 622.212a33.522 33.522 0 0 1-9.805 23.689 33.495 33.495 0 0 1-23.685 9.811H33.48888A33.492 33.492 0 0 1 4.48988 638.97a33.46 33.46 0 0 1 0-33.488 33.483 33.483 0 0 1 28.999-16.748h479.946a33.482 33.482 0 0 1 23.679 9.805 33.457 33.457 0 0 1 9.811 23.673z m429.73 118.303c-0.006 18.326-14.857 33.18-33.184 33.186H543.83688c-17.993-0.469-32.329-15.191-32.329-33.186 0-17.996 14.336-32.715 32.329-33.186H943.46088c18.326 0.01 33.183 14.861 33.194 33.186z m0 0" fill="#E3EDF1"></path>
<path d="M641.80188 797.718a24.01 24.01 0 0 1-24.028 24.015H584.88088c-13.263 0-24.018-10.748-24.018-24.016 0-13.264 10.755-24.018 24.018-24.018h32.893c13.262 0.005 24.017 10.755 24.028 24.019z m0 0" fill="#E3EDF1"></path>
<path d="M909.70288 845.665a23.93 23.93 0 0 1-7.018 16.932 23.967 23.967 0 0 1-16.935 6.996H439.68688c-13.214 0-23.926-10.713-23.926-23.928s10.712-23.932 23.926-23.932H885.75088c13.229 0 23.952 10.711 23.952 23.932z m92.054 0c0 13.209-10.707 23.922-23.921 23.928H958.73088c-13.22 0-23.932-10.713-23.932-23.928s10.712-23.932 23.932-23.932h19.104c13.199 0 23.922 10.711 23.922 23.932z m0 0" fill="#E3EDF1"></path>
<path d="M708.23688 210.098H289.12288s-32.227-4.026-34.262 38.291c-2.02 42.305 0 486.035 0 543.744-0.677 47.117 57.732 57.383 78.587 30.553 28.216-34.246 10.078-74.561 4.043-76.584-6.062-2.031 392.934 0 392.934 0V264.5c-0.001 0 5.562-54.515-22.188-54.402z m0 0" fill="#FFFFFF"></path>
<path d="M300.61188 842.454c-14.448 0-28.14-5.471-37.553-15.045-8.966-9.096-13.605-21.328-13.402-35.357 0-12.902-0.102-45.41-0.236-88.504-0.461-147.648-1.332-422.482 0.236-455.407 1.53-31.97 20.248-43.353 37.249-43.353 1.803 0 2.871 0.146 2.871 0.146l418.46-0.033c6.804 0 12.468 2.507 16.951 7.464 14.031 15.528 10.563 51.164 10.417 52.673l0.032 486.307-5.235-0.02c-0.011 0-177.319-0.902-293.733-0.902-52.776 0-77.653 0.193-89.111 0.396 2.002 4.119 3.275 8.275 3.667 9.66 3.12 10.898 8.017 39.084-13.756 65.514-8.097 10.426-21.565 16.461-36.857 16.461z m-13.706-627.255c-7.588 0-25.393 3.27-26.843 33.436-1.557 32.655-0.697 307.319-0.236 454.874 0.135 43.107 0.236 75.641 0.236 88.623-0.16 11.26 3.431 20.898 10.401 27.959 7.49 7.592 18.471 11.945 30.148 11.945 12.05 0 22.52-4.568 28.711-12.553 13.832-16.779 15.169-34.219 13.875-45.908-1.407-12.756-6.304-21.51-8.005-22.836-1.836-0.52-3.334-2.975-2.916-5.508 0.328-2.047 0.526-3.287 6.846-4.039v-0.016l0.021 0.016c9.853-1.176 34.525-1.176 97.503-1.176 104.612 0 258.397 0.725 288.541 0.871V264.5c0.945-9.535 1.316-35.131-7.748-45.167a11.582 11.582 0 0 0-9.144-4.032H289.12288c-0.73-0.043-1.316-0.102-2.217-0.102z m0 0" fill="#21a2db"></path>
<path d="M309.11288 301.808h368.68v101.289h-368.68V301.808z m0 136.023h348.963v21.826H309.11288v-21.826z m0 53.941h184.332v21.82H309.11288v-21.82z m0 63.01H612.50088v21.826H309.11288v-21.826z m0 62.645h223.292v21.822H309.11288v-21.822z m543.465 83.677c9.053 9.043 11.608 21.393 5.719 27.578-5.863 6.18-18.004 3.85-27.035-5.213l-86.877-86.922c-9.031-9.043-11.598-21.398-5.687-27.576 5.858-6.186 17.998-3.852 27.014 5.213l86.866 86.92z m0 0" fill="#D0EAF1"></path>
<path d="M849.45888 734.749c-6.658 0-14.154-3.523-20.044-9.434l-86.867-86.922c-10.201-10.201-12.709-23.918-5.729-31.217 6.642-7.021 20.988-4.58 30.739 5.184l86.856 86.918c10.201 10.182 12.747 23.895 5.761 31.201-2.641 2.793-6.346 4.27-10.716 4.27zM747.51488 608.122c-2.014 0-4.864 0.451-6.921 2.637-4.864 5.068-2.266 16.039 5.638 23.953l86.866 86.92c4.94 4.941 11.056 7.893 16.361 7.893 2.024 0 4.875-0.449 6.948-2.637 4.854-5.078 2.238-16.043-5.665-23.938l-86.861-86.93c-4.935-4.945-11.05-7.898-16.366-7.898z m0 0" fill="#21a2db"></path>
<path d="M736.97488 611.364c-6.652 1.988 2.48-3.869-0.811 4.291-1.203 7.02 1.67 12.877 6.975 18.258l82.49 83.922c8.495 8.674 25.473 17.467 29.64 12.254 0.43-0.553 0.913-1.037 1.326-1.568l-119.62-117.157z m0 0" fill="#21a2db"></path>
<path d="M751.42388 458.224c-47.632-47.643-125.172-47.643-172.836 0.023-47.691 47.641-47.702 125.219-0.032 172.883 47.675 47.633 125.226 47.633 172.868 0 47.642-47.664 47.642-125.264 0-172.906" fill="#FFFFFF"></path>
<path d="M664.99788 672.062a126.68 126.68 0 0 1-90.126-37.258 126.54 126.54 0 0 1-37.274-90.131c0-34.086 13.257-66.098 37.296-90.117a126.572 126.572 0 0 1 90.12-37.274 126.6 126.6 0 0 1 90.083 37.249c49.688 49.693 49.688 130.568 0 180.273a126.577 126.577 0 0 1-90.099 37.258z m0.026-244.363c-31.293 0-60.685 12.164-82.753 34.23a116.226 116.226 0 0 0-34.257 82.754c0 31.305 12.15 60.697 34.219 82.764 22.074 22.063 51.461 34.197 82.765 34.197s60.685-12.135 82.742-34.197c45.641-45.65 45.641-119.898 0-165.527a116.105 116.105 0 0 0-82.716-34.221z m0 0" fill="#21a2db"></path>
<path d="M732.10988 516.892h-14.965v-5.214h14.965v5.214z m-30.594 0H685.89088v-5.214h15.625v5.214z m-31.245 0h-15.63v-5.214h15.63v5.214z m-31.261 0H623.39088v-5.214h15.619v5.214z m-31.234 0h-15.631v-5.214h15.631v5.214z m85.734-42.629h-15.625v-5.215h15.625v5.215z m-31.245 0h-15.619v-5.215h15.619v5.215z m-31.25 0h-15.63v-5.215h15.63v5.215z m115.545 98.347h-14.605v-5.215h14.605v5.215z m-30.225 0H700.72088v-5.215h15.614v5.215z m-31.245 0h-15.63v-5.215h15.63v5.215z m-31.25 0h-15.63v-5.215h15.63v5.215z m-31.261 0h-15.614v-5.215h15.614v5.215z m-31.233 0h-15.631v-5.215h15.631v5.215z m108.505 52.28h-15.63v-5.213h15.63v5.213z m-31.261 0h-15.614v-5.213h15.614v5.213z m-31.234 0h-15.631v-5.213h15.631v5.213z m0 0M331.66988 742.519s38.337 72.16-33.065 94.742c0 0-3.828-0.412 0 0 79.994-0.717 460.272 1.988 460.272 1.988s30.224-18.832 38.547-39.303c8.285-20.447-6.046-49.33-18.144-57.732-26.417-2.578-447.61 0.305-447.61 0.305z m0 0" fill="#CEE7EE"></path>
<path d="M759.61188 841.849h-0.757c-2.959-0.023-297.074-2.105-420.388-2.105-16.484 0-30.01 0.031-39.443 0.113l-0.145 0.053-4.236-0.461-0.328-2.518 0.134-2.471h2.47l0.279 0.037v-0.016l1.16 0.127c18.916-6.092 31.438-16.365 37.236-30.52 11.104-27.113-6.046-60.029-6.212-60.357l-2.019-3.791 4.291-0.035c2.019-0.014 202.814-1.369 334.316-1.369 67.987 0 106.207 0.359 113.574 1.078l0.671 0.07 0.563 0.379c13.424 9.322 27.669 39.66 19.067 60.854-8.549 21.012-38.312 39.74-39.584 40.539l-0.649 0.393z m-421.145-7.309c120.216 0 402.722 1.982 419.658 2.105 4.312-2.803 29.623-19.818 36.888-37.678 7.78-19.232-5.955-46.205-16.667-54.221-8.692-0.666-46.482-0.986-112.376-0.986-121.043 0-300.816 1.158-330.171 1.334 4.403 9.854 14.449 36.916 4.628 60.955-4.999 12.242-14.401 21.799-28.039 28.533 7.421-0.032 16.216-0.042 26.079-0.042z m0 0" fill="#21a2db"></path>
<path d="M1021.33888 359.582c0 20.925-17.252 37.894-38.477 37.894H814.41788c-21.241 0-38.478-16.969-38.478-37.894v-12.837c0-20.919 17.236-37.903 38.478-37.903h168.444c21.225 0 38.477 16.973 38.477 37.903v12.837z m0 0" fill="#FFFFFF"></path>
<path d="M982.86188 399.435H814.41788c-22.288 0-40.438-17.869-40.438-39.853v-12.837c0-21.978 18.139-39.847 40.438-39.847h168.444c22.282 0 40.437 17.87 40.437 39.847v12.837c-0.011 21.973-18.154 39.853-40.437 39.853z m-168.444-88.633c-20.136 0-36.522 16.125-36.522 35.943v12.837c0 19.819 16.387 35.944 36.522 35.944h168.444c20.135 0 36.517-16.125 36.517-35.944v-12.837c0-19.818-16.382-35.943-36.517-35.943H814.41788z m0 0" fill="#5BB6D2"></path>
<path d="M848.57788 437.154l14.739-41.628h54.456l-69.195 41.628z m17.499-37.719l-10.181 28.768 47.793-28.768h-37.612z m0 0" fill="#5BB6D2"></path>
<path d="M864.41188 407.284l5.687-16.699 15.706-3.232 15.979 3.491 5.316 2.667 3.624 0.415L883.06088 410.5l-18.649-3.216z m0 0" fill="#FFFFFF"></path>
<path d="M904.38788 340.441a11.74 11.74 0 1 0-5.986 21.848 11.745 11.745 0 0 0 17.719-10.465c-0.194-6.341-5.391-11.383-11.733-11.383zM833.59188 340.441c-6.347-0.005-11.544 5.031-11.742 11.372a11.735 11.735 0 0 0 5.756 10.476 11.739 11.739 0 0 0 11.952 0.005 11.736 11.736 0 0 0 5.767-10.47c-0.194-6.341-5.386-11.383-11.733-11.383zM975.18388 340.441c-6.347-0.005-11.55 5.031-11.748 11.372a11.747 11.747 0 1 0 23.481 0.011c-0.194-6.341-5.393-11.383-11.733-11.383z" fill="#21a2db"></path>
</svg>`;
let iconArrowLeft = `
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
<path fill="#FFFFFF" d="M262.144 405.504l255.68-170.432a128 128 0 0 1 198.976 106.496v340.864a128 128 0 0 1-199.008 106.496l-255.648-170.432a128 128 0 0 1 0-212.992z"></path>
</svg>`;
let iconArrowRight = `
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
<path fill="#FFFFFF" d="M761.856 405.504l-255.68-170.432A128 128 0 0 0 307.2 341.568v340.864a128 128 0 0 0 199.008 106.496l255.648-170.432a128 128 0 0 0 0-212.992z"></path>
</svg>`;
let todo = new Todo();
let operator = new Operator();
let selectTodoItem = null;
function createHtmlLink($j) {
let linkUrlList = operator.get();
let linkHtml = '';
if (linkUrlList.length === 0) {
linkHtml = `
<span style="margin-top: 80px;text-align: center;">
${iconEmpty}
</span>`;
} else {
for (let linkUrl of linkUrlList) {
let linkUrlStr = '';
for (let item of linkUrl.list) {
linkUrlStr = `${linkUrlStr}
<div class="maga-link-wrapper">
<span class="maga-link-delete" data-url="${item}" data-date="${linkUrl.date}"> ✕ </span>
<a target="_blank" href="${item}">
${item.substring(0, Math.min(item.length, 80))}
</a>
</div>`;
}
linkHtml = linkHtml + `
<div class="maga-link-url-item">
<span class="link-date">
${linkUrl.date}
</span>
<span class="link-list">
${linkUrlStr}
</span>
</div>`;
}
}
GUtils.log('linkHtml', linkHtml);
let linkBottomHtml = `
<span id="${idOnetabFavorite}">
${operator.isFavorite() ? '取消收藏标签' : '收藏当前标签'}
</span>
<a class="maga-link-url-item" target="_blank" href="https://video.bwaq.cn/">
免费电影
</a>
<a class="maga-link-url-item" target="_blank" href="https://video.bwaq.cn/novel">
免费小说
</a>
<a class="maga-link-url-item" target="_blank" href="https://payback.bwaq.cn/">
优惠券
</a>`;
$j(`#${idOnetabContentLink}`).html(linkHtml);
$j(`#${idOnetabBottomLink}`).html(linkBottomHtml);
$j('.maga-link-delete').each(function () {
let selectView = $j(this);
selectView.click(function () {
let date = selectView.attr('data-date');
let linkUrl = selectView.attr('data-url');
operator.remove(date, linkUrl);
createHtmlLink($j);
});
});
$j(`#${idOnetabFavorite}`).click(function () {
if (operator.isFavorite()) {
operator.remove(GUtils.getDateFormat(), location.href);
} else {
operator.put(location.href);
}
createHtmlLink($j);
});
}
function createHtmlTodo($j) {
let todoList = todo.get();
let readyHtml = '';
let doingHtml = '';
let finishHtml = '';
let pauseHtml = '';
for (let todoItem of todoList) {
let temp = `
<div class="maga-todo-item-${todoItem.level}">
<div class="maga-todo-item" data-id="${todoItem.id}">
<span class="maga-todo-arrow-left" data-id="${todoItem.id}">
${iconArrowLeft}
</span>
<span class="maga-todo-content" data-id="${todoItem.id}">
${todoItem.content}
</span>
<span class="maga-todo-arrow-right" data-id="${todoItem.id}">
${iconArrowRight}
</span>
</div>
</div>`;
if (todoItem.status === todo.READY()) {
readyHtml += temp;
} else if (todoItem.status === todo.DOING()) {
doingHtml += temp;
} else if (todoItem.status === todo.FINISH()) {
finishHtml += temp;
} else if (todoItem.status === todo.PAUSE()) {
pauseHtml += temp;
}
}
let todoHtml = `
<div class="maga-todo-container">
<div id="maga-todo-ready" class="maga-todo-box">
<div class="maga-todo-title">任务列表</div>
${readyHtml}
</div>
<div id="maga-todo-doing" class="maga-todo-box">
<div class="maga-todo-title">进行中</div>
${doingHtml}
</div>
<div id="maga-todo-finish" class="maga-todo-box">
<div class="maga-todo-title">已完成</div>
${finishHtml}
</div>
<div id="maga-todo-pause" class="maga-todo-box">
<div class="maga-todo-title">任务暂停</div>
${pauseHtml}
</div>
</div>`;
GUtils.log('todoHtml', todoHtml);
let todoBottomHtml = `
<div class="maga-todo-bottom-container">
<input class="maga-todo-input" type="text" placeholder="请输入待办事项">
<div id="maga-todo-delete" class="maga-todo-button">删除</div>
<div id="maga-todo-level-low" class="maga-todo-button">普通</div>
<div id="maga-todo-level-middle" class="maga-todo-button">中等</div>
<div id="maga-todo-level-high" class="maga-todo-button">重要</div>
</div>`;
$j(`#${idOnetabContentTodo}`).html(todoHtml);
$j(`#${idOnetabBottomTodo}`).html(todoBottomHtml);
let inputView = $j('.maga-todo-input');
$j('.maga-todo-item').each(function () {
let selectView = $j(this);
selectView.click(function () {
$j('.maga-todo-item').each(function () {
$j(this).parent().removeAttr('select');
});
let selectTemp = todo.getItem(selectView.attr('data-id'));
if (selectTodoItem && selectTodoItem.id === selectTemp.id) {
selectTodoItem = null;
selectView.parent().removeAttr('select');
$j(`#maga-todo-delete`).removeAttr('select');
} else {
selectTodoItem = selectTemp;
selectView.parent().attr('select', 'true');
$j(`#maga-todo-delete`).attr('select', 'true');
}
inputView.val(selectTodoItem ? selectTodoItem.content : '');
});
});
$j('.maga-todo-arrow-left').each(function () {
let selectView = $j(this);
selectView.click(function () {
let todoItem = todo.getItem(selectView.attr('data-id'));
if (todoItem.status === todo.READY()) {
return
} else if (todoItem.status === todo.DOING()) {
todoItem.status = todo.READY();
} else if (todoItem.status === todo.FINISH()) {
todoItem.status = todo.DOING();
} else if (todoItem.status === todo.PAUSE()) {
todoItem.status = todo.FINISH();
}
todo.alter(todoItem);
createHtmlTodo($j);
});
});
$j('.maga-todo-arrow-right').each(function () {
let selectView = $j(this);
selectView.click(function () {
let todoItem = todo.getItem(selectView.attr('data-id'));
if (todoItem.status === todo.READY()) {
todoItem.status = todo.DOING();
} else if (todoItem.status === todo.DOING()) {
todoItem.status = todo.FINISH();
} else if (todoItem.status === todo.FINISH()) {
todoItem.status = todo.PAUSE();
} else if (todoItem.status === todo.PAUSE()) {
return
}
todo.alter(todoItem);
createHtmlTodo($j);
});
});
$j(`#maga-todo-delete`).click(function () {
if (selectTodoItem && selectTodoItem.id) {
todo.remove(selectTodoItem.id);
inputView.val('');
selectTodoItem = null;
createHtmlTodo($j);
}
});
$j(`#maga-todo-level-low`).click(function () {
onSubmitClick($j, inputView, todo.LEVEL_L());
});
$j(`#maga-todo-level-middle`).click(function () {
onSubmitClick($j, inputView, todo.LEVEL_M());
});
$j(`#maga-todo-level-high`).click(function () {
onSubmitClick($j, inputView, todo.LEVEL_H());
});
function onSubmitClick($j, inputView, level) {
if (selectTodoItem) {
selectTodoItem.level = level;
selectTodoItem.content = inputView.val();
todo.alter(selectTodoItem);
selectTodoItem = null;
} else {
todo.add(inputView.val(), todo.LEVEL_L());
}
inputView.val('');
createHtmlTodo($j);
}
}
function onTabSelect($j, selectTab) {
$j(`#${idOnetabContentLink}`).css('display', selectTab === 'link' ? 'flex' : 'none');
$j(`#${idOnetabBottomLink}`).css('display', selectTab === 'link' ? 'flex' : 'none');
$j(`#${idOnetabContentTodo}`).css('display', selectTab === 'link' ? 'none' : 'flex');
$j(`#${idOnetabBottomTodo}`).css('display', selectTab === 'link' ? 'none' : 'flex');
if (selectTab === 'link') {
$j(`#${idOnetabTodo}`).removeAttr('select');
$j(`#${idOnetabLink}`).attr('select', 'true');
} else {
$j(`#${idOnetabTodo}`).attr('select', 'true');
$j(`#${idOnetabLink}`).removeAttr('select');
}
GM_setValue(KeyTabSelect, selectTab);
}
var Onetab = {
createOneTabPanel: function ($j) {
if ($j(`#${idOnetabContent$1}`).length === 0) {
let html = `
<div id='${idOnetabContent$1}'>
<div class="tablayout">
<span id="${idOnetabLink}" select="true">书签</span>
<span id="${idOnetabTodo}" style="margin-left: 20px">待办</span>
<span style="flex: 1"></span>
<span id='${idOnetabContentClose}'> ✕ </span>
</div>
<div id='${idOnetabContentLink}' class='${classOnetabContentWrapper}'></div>
<div id='${idOnetabContentTodo}' class='${classOnetabContentWrapper}'></div>
<div id='${idOnetabBottomLink}' class='${classOnetabBottom}'></div>
<div id='${idOnetabBottomTodo}' class='${classOnetabBottom}'></div>
</div>`;
$j('body').append(html);
$j(`#${idOnetabContentClose}`).click(function () {
$j(`#${idOnetabContent$1}`).css('display', 'none');
});
$j(document).keyup(function (e) {
if (e.key === 'Escape' && '' === $j('.maga-todo-input').val()) {
// ESC关闭页面 输入框没有输入的内容时
$j(`#${idOnetabContent$1}`).css('display', 'none');
}
});
$j(`#${idOnetabLink}`).click(function () {
onTabSelect($j, 'link');
});
$j(`#${idOnetabTodo}`).click(function () {
onTabSelect($j, 'todo');
});
}
onTabSelect($j, GM_getValue(KeyTabSelect, 'link'));
createHtmlLink($j);
createHtmlTodo($j);
$j(`#${idOnetabContent$1}`).css('display', 'flex');
},
};
let animIn = 300;
let animOut = 0;
let idSite$1 = 'maga-better-site';
let idBookmark$1 = 'maga-better-bookmark';
let idMore$1 = 'maga-better-more';
let idSetting$1 = 'maga-better-setting';
let idSwitchIcon$1 = 'maga-better-icon-switch';
let idSiteIcon$1 = 'maga-better-icon-site';
let idSettingIcon$1 = 'maga-better-icon-setting';
let idBookmarkIcon$1 = 'maga-better-icon-bookmark';
let idChatgptIcon$1 = 'maga-better-icon-chatgpt';
let idOnetabIcon$1 = 'maga-better-icon-onetab';
let idQrcodeIcon$1 = 'maga-better-icon-qrcode';
let idMoreIcon$1 = 'maga-better-icon-more';
let idSettingCoupon$1 = 'maga-better-setting-coupon';
let idSettingVideo$1 = 'maga-better-setting-video';
let idSettingGroupWeixin$1 = 'maga-better-setting-group-weixin';
let idSettingGroupQQ$1 = 'maga-better-setting-group-qq';
let idSettingButtonReset$1 = 'maga-better-setting-button-reset';
let idSettingCache$1 = 'maga-better-setting-reset';
let idChatGPTContent = 'maga-chatgpt-content';
let idOnetabContent = 'maga-onetab-content';
let idQrcodeContent = 'maga-qrcode-dialog';
var Event = {
initEvent: function ($j, runType) {
//默认选中的模块
//setSelectMode($j)
//插件功能是否开启
setOnClickListenerSwitch($j);
//搜索页面点击事件
setOnClickListenerSearch($j);
//书签页面点击事件
setOnClickListenerBookMark($j);
//CHATGPT页面点击事件
setOnClickListenerChatgpt($j);
//Onetab页面点击事件
setOnClickListenerOnetab($j);
//二维码页面点击事件
setOnClickListenerQrcode($j);
//更多页面点击事件
setOnClickListenerMore($j);
//设置页面点击事件
setOnClickListenerSetting($j, runType);
//搜索引擎
$j(`#${idSite$1} a`).each(function () {
$j(this).attr('data-href', $j(this).attr('href'));
});
//修改链接
$j(`#${idSite$1} a`).on('mouseover', function () {
let href = $j(this).attr('data-href').replace(/#keyword#/i, Utils.getKeyword($j));
$j(this).attr('href', href);
});
//链接跳转
$j(`#${idSite$1} a`).on('click', function () {
if ($j(this).attr('href').indexOf('#keyword#') !== -1) {
let href = $j(this).attr('href').replace(/#keyword#/i, Utils.getKeyword($j));
$j(this).attr('href', href);
}
return true
});
},
};
function setOnClickListenerSwitch($j) {
function fadeOutViews($j) {
$j(`#${idSiteIcon$1}`).fadeOut(animOut);
$j(`#${idBookmarkIcon$1}`).fadeOut(animOut);
$j(`#${idChatgptIcon$1}`).fadeOut(animOut);
$j(`#${idOnetabIcon$1}`).fadeOut(animOut);
$j(`#${idQrcodeIcon$1}`).fadeOut(animOut);
$j(`#${idMoreIcon$1}`).fadeOut(animOut);
$j(`#${idSettingIcon$1}`).fadeOut(animOut);
}
function fadeInViews($j) {
$j(`#${idSiteIcon$1}`).fadeIn(animIn);
$j(`#${idBookmarkIcon$1}`).fadeIn(animIn);
$j(`#${idChatgptIcon$1}`).fadeIn(animIn);
$j(`#${idOnetabIcon$1}`).fadeIn(animIn);
$j(`#${idQrcodeIcon$1}`).fadeIn(animIn);
$j(`#${idSettingIcon$1}`).fadeIn(animIn);
$j(`#${idMoreIcon$1}`).fadeIn(animIn);
}
$j(document).keyup(function (e) {
GUtils.log('e.key', e.key);
if (e.key === 'Escape') {
// ESC关闭页面
$j(`#${idSite$1}`).fadeOut(animOut);
$j(`#${idBookmark$1}`).fadeOut(animOut);
$j(`#${idMore$1}`).fadeOut(animOut);
$j(`#${idSetting$1}`).fadeOut(animOut);
}
});
$j(`#${idSwitchIcon$1}`).click(function () {
GM_setValue(Constant.getKeySwitch(), !GM_getValue(Constant.getKeySwitch(), true));
if (GM_getValue(Constant.getKeySwitch(), true)) {
fadeInViews($j);
} else {
fadeOutViews($j);
/*总开关关闭 ==> 关闭所有展示的模块*/
GM_setValue(Constant.getKeySearch(), false);
GM_setValue(Constant.getKeyBookMark(), false);
$j(`#${idSite$1}`).fadeOut(animOut);
$j(`#${idBookmark$1}`).fadeOut(animOut);
$j(`#${idMore$1}`).fadeOut(animOut);
$j(`#${idSetting$1}`).fadeOut(animOut);
}
});
if (GM_getValue(Constant.getKeySwitch(), true)) {
$j(`#${idSiteIcon$1}`).fadeIn(animIn);
$j(`#${idBookmarkIcon$1}`).fadeIn(animIn);
$j(`#${idChatgptIcon$1}`).fadeIn(animIn);
$j(`#${idOnetabIcon$1}`).fadeIn(animIn);
$j(`#${idQrcodeIcon$1}`).fadeIn(animIn);
$j(`#${idMoreIcon$1}`).fadeIn(animIn);
$j(`#${idSettingIcon$1}`).fadeIn(animIn);
} else {
$j(`#${idSiteIcon$1}`).fadeOut(animOut);
$j(`#${idBookmarkIcon$1}`).fadeOut(animOut);
$j(`#${idChatgptIcon$1}`).fadeOut(animOut);
$j(`#${idOnetabIcon$1}`).fadeOut(animOut);
$j(`#${idQrcodeIcon$1}`).fadeOut(animOut);
$j(`#${idMoreIcon$1}`).fadeOut(animOut);
$j(`#${idSettingIcon$1}`).fadeOut(animOut);
}
}
function hideOtherViews($j, excludeView) {
if (excludeView !== idSite$1) {
$j(`#${idSite$1}`).fadeOut(animOut);
}
if (excludeView !== idBookmark$1) {
$j(`#${idBookmark$1}`).fadeOut(animOut);
}
if (excludeView !== idChatGPTContent) {
$j(`#${idChatGPTContent}`).fadeOut(animOut);
}
if (excludeView !== idOnetabContent) {
$j(`#${idOnetabContent}`).fadeOut(animOut);
}
if (excludeView !== idQrcodeContent) {
$j(`#${idQrcodeContent}`).fadeOut(animOut);
}
if (excludeView !== idMore$1) {
$j(`#${idMore$1}`).fadeOut(animOut);
}
if (excludeView !== idSetting$1) {
$j(`#${idSetting$1}`).fadeOut(animOut);
}
}
function setOnClickListenerSearch($j) {
$j(`#${idSiteIcon$1}`).click(function () {
hideOtherViews($j, idSite$1);
GM_setValue(Constant.getSelectMode(), Constant.StrSearch());
if ($j(`#${idSite$1}`).css('display') === 'none') {
$j(`#${idSite$1}`).css('display', 'flex');
GM_setValue(Constant.getKeySearch(), true);
} else {
GM_setValue(Constant.getKeySearch(), false);
}
if (GM_getValue(Constant.getKeySearch(), true)) {
$j(`#${idSite$1}`).fadeIn(animIn);
$j(`#${idSite$1}`).css('display', 'flex');
} else {
$j(`#${idSite$1}`).fadeOut(animOut);
}
});
}
function setOnClickListenerChatgpt($j) {
$j(`#${idChatgptIcon$1}`).click(function () {
hideOtherViews($j, idChatGPTContent);
if ($j(`#${idChatGPTContent}`).length === 0 ||
$j(`#${idChatGPTContent}`).css('display') === 'none') {
Chatgpt.createChatGPTPanel($j);
} else {
$j(`#${idChatGPTContent}`).css('display', 'none');
}
});
}
function setOnClickListenerOnetab($j) {
$j(`#${idOnetabIcon$1}`).click(function () {
hideOtherViews($j, idOnetabContent);
if ($j(`#${idOnetabContent}`).length === 0 ||
$j(`#${idOnetabContent}`).css('display') === 'none') {
Onetab.createOneTabPanel($j);
} else {
$j(`#${idOnetabContent}`).css('display', 'none');
}
});
}
function setOnClickListenerQrcode($j) {
QRCode.init($j);
$j(`#${idQrcodeIcon$1}`).click(function () {
hideOtherViews($j, idQrcodeContent);
if ($j(`#${idQrcodeContent}`).length === 0 ||
$j(`#${idQrcodeContent}`).css('display') === 'none') {
QRCode.generateQRCode($j, window.location.href);
} else {
$j(`#${idQrcodeContent}`).css('display', 'none');
}
});
}
function setOnClickListenerBookMark($j) {
$j(`#${idBookmarkIcon$1}`).click(function () {
hideOtherViews($j, idBookmark$1);
GM_setValue(Constant.getSelectMode(), Constant.StrBookMark());
if ($j(`#${idBookmark$1}`).css('display') === 'none') {
$j(`#${idBookmark$1}`).css('display', 'flex');
GM_setValue(Constant.getKeyBookMark(), true);
} else {
GM_setValue(Constant.getKeyBookMark(), false);
}
if (GM_getValue(Constant.getKeyBookMark(), true)) {
$j(`#${idBookmark$1}`).fadeIn(animIn);
$j(`#${idBookmark$1}`).css('display', 'flex');
} else {
$j(`#${idBookmark$1}`).fadeOut(animOut);
}
});
}
function setOnClickListenerMore($j) {
$j(`#${idMoreIcon$1}`).click(function () {
$j(`#${idSite$1}`).fadeOut(animOut);
$j(`#${idSetting$1}`).fadeOut(animOut);
$j(`#${idBookmark$1}`).fadeOut(animOut);
if ($j(`#${idMore$1}`).css('display') === 'none') {
$j(`#${idMore$1}`).fadeIn(animIn);
$j(`#${idMore$1}`).css('display', 'flex');
} else {
$j(`#${idMore$1}`).fadeOut(animOut);
}
});
}
function setOnClickListenerSetting($j, runType) {
// 设置页面点击事件
$j(`#${idSettingIcon$1}`).click(function () {
$j(`#${idSite$1}`).hide();
$j(`#${idMore$1}`).hide();
$j(`#${idBookmark$1}`).hide();
if ($j(`#${idSetting$1}`).css('display') === 'none') {
$j(`#${idSetting$1}`).fadeIn(animIn);
$j(`#${idSetting$1}`).css('display', 'flex');
} else {
$j(`#${idSetting$1}`).fadeOut(animOut);
}
});
if (runType == 'complex') {
$j(`#${idSettingButtonReset$1}`).click(function () {
// 导航按钮复位
GM_deleteValue(Constant.getKeyButtonTop());
GM_deleteValue(Constant.getKeyButtonLeft());
toastr.success('设置成功,网页刷新!');
setTimeout(() => {
location.reload();
}, 200);
});
}
$j(`#${idSettingCache$1}`).click(function () {
// 清理缓存
GM_deleteValue(Constant.getSelectMode());
GM_deleteValue(Constant.getBookMarkIds());
GM_deleteValue(Constant.getListBookType());
GM_deleteValue(Constant.getKeyButtonTop());
GM_deleteValue(Constant.getKeyButtonLeft());
GM_deleteValue(Constant.getKeySwitch());
GM_deleteValue(Constant.getKeySearch());
GM_deleteValue(Constant.getKeyBookMark());
toastr.success('清理成功,网页刷新!');
setTimeout(() => {
location.reload();
}, 200);
});
// 链接跳转
$j('.maga-better-booktype').click(function () {
let dataId = $j(this).attr('data-id');
GUtils.log('书签分类', dataId);
let ids = GM_getValue(Constant.getBookMarkIds(), []);
if (ids.length > 2) {
for (let i = 0; i < ids.length; i++) {
let id = ids[i].id;
let typeName = ids[i].typeName;
if (id == dataId) {
GUtils.log(typeName);
if ($j(this).hasClass('maga-better-green-select')) {
$j(this).attr('class', 'maga-better-booktype maga-better-green-unselect');
} else {
$j(this).attr('class', 'maga-better-booktype maga-better-green-select');
}
ids[i].enable = !ids[i].enable;
break
}
}
GUtils.log(ids);
GM_setValue(Constant.getBookMarkIds(), ids);
} else {
toastr.error('请至少保留2个书签分类!');
}
});
$j(`#${idSettingCoupon$1}`).click(function () {
// 全网优惠券
GM_openInTab('https://payback.bwaq.cn?channel=tbk');
GUtils.clickEventUrl(`event-click-payback`);
});
$j(`#${idSettingVideo$1}`).click(function () {
// 全网VIP影视
GM_openInTab('https://video.bwaq.cn');
GUtils.clickEventUrl(`event-click-video`);
});
$j(`#${idSettingGroupWeixin$1}`).click(function () {
// 关注公众号
GM_openInTab('https://payback.bwaq.cn/wechat/platform');
GUtils.clickEventUrl(`event-click-platform-weixin`);
});
$j(`#${idSettingGroupQQ$1}`).click(function () {
// 加入捡漏群
let requestField = 'couponUrl';
let requestUrl = GUtils.systemConfigUrl(requestField);
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let data = response.response;
if (typeof data === 'string') {
data = JSON.parse(data);
}
GUtils.log(JSON.stringify(data));
if (data.code == 10) {
GUtils.log('获取成功');
let couponUrl = data[requestField];
if (couponUrl && couponUrl.length) {
GM_openInTab(couponUrl);
GUtils.clickEventUrl(`event-click-join-group`);
} else {
GM_openInTab('https://payback.bwaq.cn?channel=tbk');
GUtils.clickEventUrl(`event-click-payback`);
}
} else {
GM_openInTab('https://payback.bwaq.cn?channel=tbk');
GUtils.clickEventUrl(`event-click-payback`);
}
},
});
});
}
let runType = 'alone';
let idSite = 'maga-better-site';
let idBookmark = 'maga-better-bookmark';
let idMore = 'maga-better-more';
let idSetting = 'maga-better-setting';
let idSwitchIcon = 'maga-better-icon-switch';
let idSiteIcon = 'maga-better-icon-site';
let idSettingIcon = 'maga-better-icon-setting';
let idBookmarkIcon = 'maga-better-icon-bookmark';
let idChatgptIcon = 'maga-better-icon-chatgpt';
let idOnetabIcon = 'maga-better-icon-onetab';
let idQrcodeIcon = 'maga-better-icon-qrcode';
let idMoreIcon = 'maga-better-icon-more';
let idSettingCoupon = 'maga-better-setting-coupon';
let idSettingVideo = 'maga-better-setting-video';
let idSettingGroupWeixin = 'maga-better-setting-group-weixin';
let idSettingGroupQQ = 'maga-better-setting-group-qq';
let idSettingButtonReset = 'maga-better-setting-button-reset';
let idSettingCache = 'maga-better-setting-reset';
let idSettingBooktypeList = 'maga-better-setting-booktype-list';
let redisStorage$1 = new RedisStorage();
let ONE_DAY = 24 * 60 * 60 * 1000;
const website$A = {
setRunType: function (val) {
runType = val || 'alone';
},
init: function ($j) {
if (GUtils.inIframe()) {
return
}
let html = `
<div id="maga-better-wrapper">
<div id="maga-better-icon-wrapper">
<!--关闭插件-->
<div id="${idSwitchIcon}" class="maga-better-icon"></div>
<!--搜索优化-->
<div id="${idSiteIcon}" class="maga-better-icon"></div>
<!--书签模块-->
<div id="${idBookmarkIcon}" class="maga-better-icon"></div>
<!--CHATGPT功能-->
<div id="${idChatgptIcon}" class="maga-better-icon"></div>
<!--Onetab功能-->
<div id="${idOnetabIcon}" class="maga-better-icon"></div>
<!--二维码功能-->
<div id="${idQrcodeIcon}" class="maga-better-icon"></div>
<!--更多功能-->
<div id="${idMoreIcon}" class="maga-better-icon"></div>
<!--设置功能-->
<div id="${idSettingIcon}" class="maga-better-icon"></div>
</div>
<div id="maga-better-content-wrapper">
<!--搜索列表-->
<div id="${idSite}" class="maga-better-pannel"
style="justify-content: space-between"></div>
<!--书签列表-->
<div id="${idBookmark}" class="maga-better-pannel"
style="justify-content: flex-start"></div>
<!--更多列表-->
<div id="${idMore}" class="maga-better-pannel"
style="justify-content: space-between"></div>
<!--设置列表-->
<div id="${idSetting}" class="maga-better-pannel"
style="justify-content: flex-start"></div>
</div>
</div>
`;
$j(document).ready(function () {
$j('body').append(html);
parseConfigSite($j);
parseConfigBookMark($j);
parseConfigMore($j);
parseConfigSetting($j, runType);
Event.initEvent($j, runType);
});
function parseConfigSite($j) {
let template = `
<a class="maga-better-grey" href="{{siteurl}}"
{{sitetarget}} data-selector="{{inputselector}}">
{{sitename}}
</a>
`;
let linkArr = Utils.get().split(/\r*?\n|\r/);
let html = '';
for (let i in linkArr) {
let link = Utils.trim(linkArr[i]);
if (typeof link !== 'string' || link === '') {
continue
}
link = link.replace(/【/g, '[').replace(/】/g, ']');
let matches = link.match(/\[(.*?)\][^\[]*?\[(.*?)\]/);
if (matches == null) {
continue
}
let title = Utils.trim(matches[1]);
let url = matches[2].indexOf('#keyword#') !== -1 ? Utils.trim(matches[2]) : Utils.trim(matches[2]) + '#keyword#';
let target = /\[\s*?新窗口(打开)?\s*?]/.test(link) ? 'target="_blank"' : '';
let inputSelector = link.match(/\(\s*?(.*?)\s*?\)/);
inputSelector = inputSelector && inputSelector[1] ? inputSelector[1] : '';
let linkHtmlItem = template
.replace(/{{sitename}}/g, title)
.replace('{{siteurl}}', url)
.replace('{{sitetarget}}', target)
.replace('{{inputselector}}', inputSelector);
html += linkHtmlItem;
}
$j(`#${idSite}`).append(html);
}
function parseConfigBookMark($j) {
function renderHtml(bookmark, $j) {
let templateTitle = `
<span class="maga-better-grey-title">
{{sitename}}
</span>
`;
let templateItem = `
<a class="maga-better-grey" href="{{siteurl}}" target="_blank">
{{sitename}}
</a>
`;
let linkHtmlStr = '';
if (bookmark.data && bookmark.data.length > 0) {
bookmark.data.forEach((item, index) => {
if (item.data.length === 0) {
return
}
let linkHtmlItem = templateTitle
.replace(/{{sitename}}/g, item.typeName);
linkHtmlStr += linkHtmlItem;
item.data.forEach((row) => {
let linkHtmlItem = templateItem
.replace(/{{sitename}}/g, row.remarks)
.replace('{{siteurl}}', row.clickUrl);
linkHtmlStr += linkHtmlItem;
});
});
}
$j(`#${idBookmark}`).empty();
$j(`#${idBookmark}`).append(linkHtmlStr);
}
return new Promise((resolve, reject) => {
function getBookmark(resolve, reject) {
let ids = GM_getValue(Constant.getBookMarkIds(), []);
if (ids.length === 0) {
reject('get book mark error!');
} else {
let idListStr = [];
for (let i = 0; i < ids.length; i++) {
if (ids[i].enable) {
idListStr.unshift(ids[i].id);
}
}
idListStr = idListStr.join(',');
let key = Constant.getListBookMark() + idListStr;
let bookMarkCache = redisStorage$1.get(key);
if (bookMarkCache) {
GUtils.log('书签缓存获取成功');
resolve(bookMarkCache);
return
}
let bookMarkUrl = GUtils.bookMarkUrl(idListStr);
GUtils.log('idListStr', idListStr);
GUtils.log('bookMarkUrl', bookMarkUrl);
GM.xmlHttpRequest({
method: 'GET',
url: bookMarkUrl,
onload: function onload(response) {
let bookMark = response.response;
if (typeof bookMark === 'string') {
bookMark = JSON.parse(bookMark);
}
//GUtils.log(JSON.stringify(bookMark))
GM_setValue(Constant.getListBookType(), bookMark);
if (bookMark.code == 10) {
GUtils.log('书签获取成功');
redisStorage$1.set({
name: key,
value: bookMark,
expires: ONE_DAY * 2,
});
resolve(bookMark);
} else {
reject('get book mark error!');
}
},
});
}
}
// 书签
function getBookType(resolve, reject) {
let bookTypeUrl = GUtils.bookTypeUrl();
GM.xmlHttpRequest({
method: 'GET',
url: bookTypeUrl,
onload: function onload(response) {
let data = response.response;
if (typeof data === 'string') {
data = JSON.parse(data);
}
GUtils.log(JSON.stringify(data));
if (data.code == 10) {
GUtils.log('================>获取书签类型成功');
let ids = GM_getValue(Constant.getBookMarkIds(), []);
for (let i = 0; i < data.data.length; i++) {
let id = data.data[i].id;
let newElement = true;
for (let j = 0; j < ids.length; j++) {
if (ids[j].id == id) {
newElement = false;
break
}
}
if (newElement) {
let typeName = data.data[i].typeName;
ids.unshift({id: id, enable: true, typeName: typeName});
}
}
GM_setValue(Constant.getBookMarkIds(), ids);
getBookmark(resolve, reject);
} else {
reject('get book type id error!');
}
},
});
}
let bookMark = GM_getValue(Constant.getListBookType(), null);
if (bookMark) {
renderHtml(bookMark, $j);
}
if (GM_getValue(Constant.getBookMarkIds(), []).length === 0) {
getBookType(resolve, reject);
} else {
getBookmark(resolve, reject);
}
}).then((bookMark) => {
renderHtml(bookMark, $j);
})
}
function parseConfigMore($j) {
let linkHtmlStr = `
<span id="${idSettingCoupon}" class="maga-better-green-select">电商优惠券</span>
<span id="${idSettingVideo}" class="maga-better-green-select">免费影视会员</span>
<span id="${idSettingGroupWeixin}" class="maga-better-green-select">关注公众号</span>
<span id="${idSettingGroupQQ}" class="maga-better-green-select">加入捡漏群</span>
`;
$j(`#${idMore}`).append(linkHtmlStr);
}
function parseConfigSetting($j, runType) {
let linkHtmlStr = '';
if (runType == 'complex') {
linkHtmlStr = `
<span id="${idSettingButtonReset}"
class="maga-better-green-select">
工具按钮复位
</span>`;
}
linkHtmlStr += `
<span id="${idSettingCache}"
class="maga-better-green-select">
清理缓存
</span>
<span style="color: #FAFAFA;margin: 4px 0;width: 100%">书签分类设置</span>
<div id="${idSettingBooktypeList}"></div>
`;
$j(`#${idSetting}`).append(linkHtmlStr);
let ids = GM_getValue(Constant.getBookMarkIds(), []);
if (ids.length === 0) {
return new Promise((resolve, reject) => {
let bookTypeUrl = GUtils.bookTypeUrl();
GM.xmlHttpRequest({
method: 'GET',
url: bookTypeUrl,
onload: function onload(response) {
let data = response.response;
if (typeof data === 'string') {
data = JSON.parse(data);
}
GUtils.log(JSON.stringify(data));
if (data.code == 10) {
GUtils.log('获取成功');
let ids = GM_getValue(Constant.getBookMarkIds(), []);
for (let i = 0; i < data.data.length; i++) {
let id = data.data[i].id;
let newElement = true;
for (let j = 0; j < ids.length; j++) {
if (ids[j].id == id) {
newElement = false;
break
}
}
if (newElement) {
let typeName = data.data[i].typeName;
ids.unshift({id: id, enable: true, typeName: typeName});
}
}
GM_setValue(Constant.getBookMarkIds(), ids);
resolve(ids);
} else {
reject('get book type id error!');
}
},
});
}).then((ids) => {
renderHtml($j, ids);
})
} else {
renderHtml($j, ids);
}
function renderHtml($j, ids) {
let templateIdOpen = `
<span class="maga-better-booktype maga-better-green-select" data-id="{{data-id}}">
{{typeName}}
</span>
`;
let templateIdClose = `
<span class="maga-better-booktype maga-better-green-unselect" data-id="{{data-id}}">
{{typeName}}
</span>
`;
let linkHtmlStr = '';
for (let index = 0; index < ids.length; index++) {
let item = ids[index];
let linkHtmlItem;
if (item.enable) {
linkHtmlItem = templateIdOpen
.replace('{{data-id}}', item.id)
.replace(/{{typeName}}/g, item.typeName);
} else {
linkHtmlItem = templateIdClose
.replace('{{data-id}}', item.id)
.replace(/{{typeName}}/g, item.typeName);
}
linkHtmlStr += linkHtmlItem;
}
$j(`#${idSettingBooktypeList}`).append(linkHtmlStr);
}
}
},
};
const modules$3 = [website$A];
const prepare$3 = {
init: function ($j, runType) {
if (GUtils.inIframe()) {
return
}
GM_addStyle(CSS_STR_SEARCH);
GM_addStyle(CSS_STR_ONETAB);
GM_addStyle(CSS_STR_QRCODE);
GM_addStyle(CSS_STR_CHATGPT);
for (let i = 0; i < modules$3.length; i++) {
let module = modules$3[i];
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
},
};
let CSS_STR_CHATGPT = `
#maga-chatgpt-close {
font-size: 14px !important;
color: #333333 !important;
line-height: 22px !important;
text-decoration: none !important;
cursor: pointer !important;
}
#maga-chatgpt-content {
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3) !important;
z-index: 999999 !important;
position: fixed !important;
padding: 10px 10px !important;
background: #FFFFFF !important;
border-radius: 6px !important;
display: flex;
flex-direction: column !important;
font-family: "Helvetica Neue", "Helvetica", "Microsoft Yahei", "微软雅黑", "Arial", "sans-serif";
font-size: 14px;
}
#maga-chatgpt-content .tablayout {
display: flex !important;
flex-direction: row !important;
align-items: center !important;
}
#maga-chatgpt-content .tablayout span {
cursor: pointer !important;
color: #666666 !important;
font-size: 16px !important;
font-weight: 500 !important;
line-height: 32px !important;
}
#maga-chatgpt-content .tablayout span:hover {
color: #333333 !important;
font-weight: 550 !important;
}
#maga-chatgpt-content .tablayout span[select] {
color: #333333 !important;
font-size: 16px !important;
font-weight: 550 !important;
}
#maga-chatgpt-content-link {
width: 800px !important;
height: 600px !important;
overflow-y: scroll !important;
box-sizing: content-box !important;
display: flex;
flex-direction: column !important;
}
#maga-chatgpt-content-link::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
display: none!important;
}
.maga-chatgpt-bottom {
width: 100% !important;
height: 44px !important;
display: flex;
flex-direction: row !important;
flex-wrap: nowrap !important;
align-items: center !important;
margin-top: 2px !important;
}
.maga-chatgpt-bottom .maga-link-url-item {
color: #666666 !important;
margin: 0 20px !important;
text-decoration: underline !important;
}
`;
let CSS_STR_ONETAB = `
#maga-onetab-content {
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3) !important;
z-index: 999999 !important;
position: fixed !important;
padding: 10px 10px !important;
background: #FFFFFF !important;
border-radius: 6px !important;
display: flex;
flex-direction: column !important;
font-family: "Helvetica Neue", "Helvetica", "Microsoft Yahei", "微软雅黑", "Arial", "sans-serif";
font-size: 14px;
}
#maga-onetab-content .tablayout {
height: 40px !important;
display: flex !important;
flex-wrap: nowrap !important;
flex-direction: row !important;
justify-content: flex-start !important;
}
#maga-onetab-content .tablayout span {
cursor: pointer !important;
color: #666666 !important;
font-size: 16px !important;
font-weight: 500 !important;
line-height: 32px !important;
}
#maga-onetab-content .tablayout span:hover {
color: #333333 !important;
font-weight: 550 !important;
}
#maga-onetab-content .tablayout span[select] {
color: #333333 !important;
font-size: 16px !important;
font-weight: 550 !important;
}
.maga-onetab-content-wrapper {
width: 800px !important;
height: 400px !important;
overflow-y: scroll !important;
box-sizing: content-box !important;
display: flex;
flex-direction: column !important;
}
.maga-onetab-bottom {
width: 100% !important;
height: 44px !important;
display: flex;
flex-direction: row !important;
flex-wrap: nowrap !important;
align-items: center !important;
margin-top: 2px !important;
}
.maga-onetab-bottom .maga-link-url-item {
color: #666666 !important;
margin: 0 20px !important;
text-decoration: underline !important;
}
#maga-onetab-favorite {
color: #444444 !important;
cursor: pointer !important;
}
.maga-onetab-content-wrapper::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
}
#maga-onetab-content-close {
font-size: 14px !important;
color: #333333 !important;
line-height: 22px !important;
text-align: center !important;
text-decoration: none !important;
cursor: pointer !important;
}
.maga-onetab-content-wrapper .maga-link-url-item {
margin-bottom: 6px !important;
font-size: 14px !important;
font-weight: 500 !important;
color: #333333 !important;
text-align: left !important;
}
.maga-onetab-content-wrapper .link-date {
font-size: 12px !important;
font-weight: 500 !important;
color: #ffffff !important;
padding: 4px 6px !important;
display: inline-block;
border-radius: 2px !important;
background-color: #3186fd !important;
}
.maga-onetab-content-wrapper .link-list {
display: flex;
flex-direction: column !important;
}
.maga-onetab-content-wrapper .link-list .maga-link-wrapper {
margin: 3px 0 !important;
}
.maga-onetab-content-wrapper .link-list .maga-link-delete {
cursor: pointer !important;
}
.maga-onetab-content-wrapper .link-list a {
text-decoration: none !important;
color: #444444 !important;
font-size: 15px !important;
font-weight: 500 !important;
}
.maga-todo-container {
width: 100% !important;
display: flex;
flex-direction: row !important;
flex-wrap: nowrap !important;
justify-content: space-between !important;
}
#maga-todo-ready {
border: 1px solid #4db366 !important
}
#maga-todo-doing {
border: 1px solid #ff9900 !important
}
#maga-todo-finish {
border: 1px solid #f34444 !important
}
#maga-todo-pause {
border: 1px solid #999999 !important
}
#maga-todo-ready:hover {
box-shadow: 0 0 4px 0px #4db366 !important;
}
#maga-todo-doing:hover {
box-shadow: 0 0 4px 0px #ff9900 !important;
}
#maga-todo-finish:hover {
box-shadow: 0 0 4px 0px #f34444 !important;
}
#maga-todo-pause:hover {
box-shadow: 0 0 4px 0px #999999 !important;
}
.maga-todo-box {
margin: 0 3px !important;
flex: 1 !important;
border-radius: 4px !important;
flex-direction: column !important;
flex-wrap: wrap !important;
overflow-y: scroll !important;
height: 390px !important;
}
.maga-todo-box::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
}
.maga-todo-title {
color: #FFFFFF !important;
font-size: 13px !important;
text-align: center !important;
padding: 6px !important;
border-top-left-radius: 4px !important;
border-top-right-radius: 4px !important;
}
#maga-todo-ready .maga-todo-title {
background-color: #4db366 !important;
opacity: 0.6 !important;
}
#maga-todo-doing .maga-todo-title {
background-color: #ff9900 !important;
opacity: 0.6 !important;
}
#maga-todo-finish .maga-todo-title {
background-color: #f34444 !important;
opacity: 0.6 !important;
}
#maga-todo-pause .maga-todo-title {
background-color: #999999 !important;
opacity: 0.6 !important;
}
.maga-todo-bottom-container {
width: 100% !important;
display: flex;
flex-direction: row !important;
flex-wrap: nowrap !important;
padding: 0 2px !important;
}
.maga-todo-input {
flex: 1 !important;
height: 32px !important;
line-height: 32px !important;
padding: 0 12px !important;
border-radius: 4px !important;
border: 1px solid #666666 !important;
color: #444444 !important;
opacity: 0.7 !important;
background-color: #FFFFFF !important;
}
.maga-todo-input:hover {
opacity: 1 !important;
}
.maga-todo-button {
height: 32px !important;
line-height: 32px !important;
color: #FFFFFF !important;
border-radius: 4px !important;
padding: 0 12px !important;
margin-left: 6px !important;
cursor: pointer !important;
}
#maga-todo-delete {
background-color: #f6b2b2 !important;
}
#maga-todo-delete[select] {
background-color: #f31f1f !important;
}
#maga-todo-level-low {
background-color: #4db366 !important;
}
#maga-todo-level-middle {
background-color: #ff9900 !important;
}
#maga-todo-level-high {
background-color: #f34444 !important;
}
.maga-todo-content {
color: #FFFFFF !important;
flex: 1 !important;
text-align: center !important;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1 !important;
-webkit-box-orient: vertical;
}
.maga-todo-arrow-right {
display: flex;
align-items: center !important;
}
.maga-todo-arrow-left {
display: flex;
align-items: center !important;
}
.maga-todo-item {
display: flex;
flex-direction: row !important;
justify-content: center !important;
box-sizing: border-box !important;
line-height: 36px !important;
}
.maga-todo-item-low {
margin: 3px !important;
cursor: pointer !important;
border-radius: 4px !important;
background-image: linear-gradient(to left, #7abe8c, #4db366, #7abe8c) !important;
}
.maga-todo-item-middle {
margin: 3px !important;
cursor: pointer !important;
border-radius: 4px !important;
background-image: linear-gradient(to left, #ffc481, #ff9900, #ffc481) !important;
}
.maga-todo-item-high {
margin: 3px !important;
cursor: pointer !important;
border-radius: 4px !important;
background-image: linear-gradient(to left, #f17777, #f34444, #f17777) !important;
}
.maga-todo-item-low[select] {
box-shadow: 0 0 4px 1px #333333 !important;
}
.maga-todo-item-middle[select] {
box-shadow: 0 0 4px 1px #333333 !important;
}
.maga-todo-item-high[select] {
box-shadow: 0 0 4px 1px #333333 !important;
}
`;
let CSS_STR_QRCODE = `
#maga-qrcode-dialog {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.3);
z-index: 999999;
position: fixed;
padding: 10px 10px;
font-family: Arial, serif;
background: #FFFFFF;
border-radius: 4px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#maga-qrcode-dialog-qrcode {
background-position: center;
background-repeat: no-repeat;
width: 150px;
height: 150px;
}
#maga-qrcode-dialog-close {
font-size: 14px;
color: #333333;
line-height: 22px;
text-align: center;
align-self: flex-end;
text-decoration: none !important;
}
#maga-qrcode-dialog-hint {
color: #666666;
font-size: 14px;
padding: 8px 10px;
}
`;
let CSS_STR_SEARCH = `
#maga-better-wrapper {
background: transparent;
position: fixed;
top: 140px;
right: 10px;
flex-direction: row-reverse;
max-width: 320px;
font-size: 14px;
z-index: 99999999 !important;
font-weight: 400;
box-sizing: border-box;
display: flex;
align-items: flex-start;
}
#maga-better-wrapper a:hover {
color: #FFFFFF !important;
background: rgba(54, 54, 54, 1) !important;
}
#maga-better-wrapper a:visited {
color: #FFFFFF !important;
background: rgba(54, 54, 54, 1) !important;
}
/*设置:书签分类列表*/
#maga-better-setting-booktype-list {
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
/*链接-条目*/
.maga-better-grey {
cursor: pointer;
margin: 3px 2px !important;
padding: 3px 3px !important;
list-style: none !important;
text-decoration: none !important;
border-radius: 2px !important;
color: #EEEEEE !important;
font-weight: 500 !important;
background: rgba(51, 51, 51, 0.8) !important;
}
/*链接:条目标题*/
.maga-better-grey-title {
width: 100% !important;
color: #FFFFFF !important;
font-weight: 500 !important;
padding: 6px 4px !important;
user-select: none !important;
pointer-events: none !important;
}
/*绿色按钮条目:选中状态*/
.maga-better-green-select {
cursor: pointer;
padding: 3px 4px;
text-align: center;
border-radius: 3px;
margin: 2px 3px;
color: #FFFFFF;
background: rgba(77, 179, 102, 1);
}
.maga-better-green-select:hover {
color: #CCCCCC;
background: rgba(77, 179, 102, 0.9);
}
/*绿色按钮条目:非选中状态*/
.maga-better-green-unselect {
cursor: pointer;
padding: 3px 4px;
text-align: center;
border-radius: 3px;
margin: 2px 3px;
color: #AAAAAA;
background: rgba(77, 179, 102, 0.5);
}
.maga-better-green-unselect:hover {
color: #CCCCCC;
background: rgba(77, 179, 102, 0.9);
}
/*【右边】的面板的样式*/
#maga-better-icon-wrapper {
width: 36px;
}
/*【左边】的面板的样式*/
#maga-better-content-wrapper {
margin: 0 2px;
min-height: 316px;
border-radius: 4px;
background: rgba(28, 35, 35, 1);
}
/*左边的面板的背景公共样式*/
.maga-better-pannel {
padding: 6px 4px;
max-height: 500px;
overflow-y: scroll;
display: none;
flex-wrap: wrap;
flex-direction: row;
}
.maga-better-pannel::-webkit-scrollbar {
width: 0;
height: 0;
}
/*右边的按钮*/
.maga-better-icon {
width: 36px;
height: 36px;
cursor: pointer;
border-radius: 4px;
background: rgba(28, 35, 35, 1);
margin-bottom: 4px;
}
/*fill=%22%23FAFAFA%22*/
#maga-better-icon-switch {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2230%22 height=%2230%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22> <path fill=%22%23FAFAFA%22 d=%22M208.5 284.93c-37.07 19.34-41.73 51.05-43.29 63.69-0.09 0.68 0 2.25-0.08 2.9a117.17 117.17 0 0 0 0.13 16.09l0.13 2.1v285.85l-0.13 1.06a116.39 116.39 0 0 0-0.2 15.77v2.12c1.16 14.2 6.55 45 42.81 64.23l0.88 0.47 0.47 0.25 256.7 148.22c0.05 0 9.64 6.14 17 8.62 0.24 0.08 0.76 0.39 1 0.47a89.08 89.08 0 0 0 27 5.66 80.57 80.57 0 0 0 8.49-0.11 100 100 0 0 0 35.84-9.46L811.41 745.8c6.92-5.16 41.85-33.35 47.92-65 0.85-3.25 1.32-11.21 1.32-14.61L860.28 512l0.51-154.31c0-3.43-0.47-11.46-1.33-14.75-6.07-31.55-40.75-59.58-47.74-64.78L556 131.14a99.8 99.8 0 0 0-35.49-9.45c-3-0.18-5.92-0.21-8.78-0.11-11.66 0.61-20.55 3.72-25.33 5.2-0.53 0.16-1.66 0.77-2.16 0.94-7.34 2.46-16.87 8.54-16.94 8.6l-1.34 0.87z m-19.15-35.79l251.83-144.48c0.92-0.62 11.44-6.74 13.64-7.78a121.67 121.67 0 0 1 55.37-15.95c2.2-0.08 4.43-0.11 6.7-0.07 19.05 0.32 38.28 5 57.14 13.92l1.46 0.76 258.57 148.75 1.26 0.9c8.35 6.12 63.23 48.18 65.77 103.58 0.18 1.42 0.25 10.93 0.25 12.41l-0.5 150.9 0.37 150.47c0 1.51-0.08 11.27-0.27 12.73-2.6 55.07-57 96.93-65.83 103.43-0.51 0.38-1.41 1-1.53 1.07l-1 0.64S573.75 929 573.32 929.22c-18.88 8.89-38.13 13.57-57.29 13.9-2.3 0-4.57 0-6.81-0.07a123.52 123.52 0 0 1-55.73-15.91c-2.27-1.06-13-7.31-13.88-7.91L189.34 774.79c-58.85-30.95-67.12-85.91-64.67-112.48 0-2 0.06-12 0.15-13V374.76c-0.09-1-0.19-11.07-0.15-13.08-2.45-26.6 5.83-81.57 64.68-112.54z%22/> <path fill=%22%23FAFAFA%22 d=%22M163.7 603.25a20.31 20.31 0 0 1-20.28 20.31 20.32 20.32 0 0 1-20.29-20.31V436a20.3 20.3 0 0 1 20.29-20.31A20.29 20.29 0 0 1 163.7 436zM888.74 603.25a20.31 20.31 0 0 1-20.28 20.31 20.31 20.31 0 0 1-20.29-20.31V436a20.29 20.29 0 0 1 20.29-20.31A20.29 20.29 0 0 1 888.74 436zM627.12 894a20.24 20.24 0 0 1-27.72-7.41 20.29 20.29 0 0 1 7.43-27.7l144.84-83.74a20.27 20.27 0 0 1 27.7 7.38 20.3 20.3 0 0 1-7.4 27.72zM506 873.48c-29 0-47.07-13.33-47.82-13.88L235 730.34c-56.67-29.61-46-86.53-45.92-87.1V390.41c-0.07-0.05-10.7-57 46.07-86.67l223.69-129.4c0.48-0.37 18.48-13.7 47.44-13.7 14.85 0 29.92 3.53 44.81 10.57L773 298.8c2.28 1.6 51.48 36.94 51.48 81.42l-0.42 136.84 0.38 136.81c0 44.47-49.25 79.84-51.34 81.3l-222 127.65c-15.1 7.12-30.22 10.66-45.1 10.66z m0.24-707.82c-27.28 0-44.47 12.76-44.64 12.9l-224 129.63c-53.42 27.93-43.92 79.52-43.48 81.71v253.8c-0.47 2.7-10 54.3 43.37 82.16L461 855.38c0.42 0.31 17.8 13.07 45 13.07 14.13 0 28.5-3.42 42.71-10.11l221.65-127.42c0.29-0.2 49-35.2 49-77L819 517.06l0.44-136.84c0-41.86-48.68-76.83-49.17-77.17L548.72 175.69c-14.02-6.61-28.4-10.03-42.47-10.03z%22/> <path fill=%22%23FAFAFA%22 d=%22M612.26 330.11H411.75A71.84 71.84 0 0 0 340 401.87v7.39A71.84 71.84 0 0 0 411.75 481h200.51A71.84 71.84 0 0 0 684 409.26v-7.39a71.84 71.84 0 0 0-71.74-71.76z m-3.17 126.64c-28.49 0-50.65-22.17-50.65-50.66s22.16-50.66 50.65-50.66 50.65 22.17 50.65 50.66-22.16 50.66-50.65 50.66zM612.25 543h-200.5A71.85 71.85 0 0 0 340 614.74v7.39a71.84 71.84 0 0 0 71.77 71.76h200.5A71.84 71.84 0 0 0 684 622.13v-7.39A71.84 71.84 0 0 0 612.25 543zM414.91 669.62c-28.49 0-50.65-22.16-50.65-50.66s22.16-50.65 50.65-50.65 50.66 22.16 50.66 50.65-22.16 50.66-50.66 50.66z%22/> </svg>");
}
#maga-better-icon-site {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2224%22 height=%2224%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22> <path fill=%22%23FAFAFA%22 d=%22M512 64.7C265.3 64.7 64.7 265.3 64.7 512S265.3 959.3 512 959.3 959.3 758.7 959.3 512 758.7 64.7 512 64.7z m0 845.8c-219.8 0-398.5-178.8-398.5-398.5 0-91.3 31.2-175.2 83-242.5-2.2 8.1-6.6 22.9-5.4 27.4 1.6 5.5 0.7 8.4 2.6 13.2-1.2 0.9-3.7 2.6-2.7 4.6 3.3 6.5 7.2 15.9 12.2 16.4-2 9.8 3.2 6 6.3 14.2 0.3 1.6-0.4 4.3 1.5 5.1 8.4 2.6 20.2 6.9 24 14.1-0.1-0.1-0.4 0-0.5 0 0 0.4-0.1 1.3-0.1 1.7 1.6 5.8 3.6 7 5.7 11.2 1.3 3 1.1 9.7 3.9 11.6 4.2 2.7 8.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9 1.2 0.1 1.4-0.3 3.6 0.2 0.3 0.7 1.2 1.1 2.5 1.6 5 1.1 1.4-4.4 5.4-4.4-0.7-1.1-1-3.8-1.5-5.4-0.7-2.6 4.8-1.8 6.3-3.2 56.9 47.4 100.2 110.4 123.8 182.2-0.2 0.2-0.5 0.3-0.6 0.5-6 11.1-10.6 23.8-14 38.1-1.4 5.3-9.3 9.4-9.1 17.1 2.4 14.6 10.7 26.5 10.8 43 0.3 9.3-6.6 26.8-15.2 31.3 2.1 5.2 8.5 12.2 9 17.4-0.2 3.1 1.1 6.1 1.1 11.8h-1c2.3 2.5 2.3 2.8 4.4 5 0.1 1.4 16.3 17.6 18.8 19.4 4.4 4.4 6.4 9.5 8.4 15.2-28.6 147.9-138.6 266.6-281.3 307.8zM632 132c-0.5-0.1-0.6 0-1.3-0.1-1.4-0.2-2.2-0.7-3.1-1.2 1.5 0.4 3 0.8 4.4 1.3z m0 0%22/> </svg>");
}
#maga-better-icon-bookmark {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2224%22 height=%2224%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22> <path d=%22M604.8 771.2c-6.4 0-12.8-1.6-17.6-3.2L512 734.4 436.8 768c-14.4 6.4-32 4.8-43.2-4.8-12.8-9.6-19.2-24-17.6-40l8-81.6-54.4-60.8c-11.2-11.2-14.4-28.8-9.6-43.2 4.8-14.4 17.6-25.6 33.6-30.4l80-17.6 41.6-70.4c8-12.8 22.4-22.4 38.4-22.4s30.4 8 38.4 22.4l41.6 70.4 80 17.6c16 3.2 27.2 14.4 32 30.4 4.8 14.4 1.6 32-9.6 43.2l-56 60.8 8 81.6c1.6 16-4.8 30.4-17.6 40-8 4.8-16 8-25.6 8zM400 563.2l38.4 41.6c8 9.6 12.8 22.4 11.2 33.6l-6.4 56 51.2-22.4c11.2-4.8 24-4.8 35.2 0l51.2 22.4L576 640c-1.6-12.8 3.2-24 11.2-33.6l38.4-41.6-54.4-11.2c-12.8-3.2-22.4-9.6-28.8-20.8L512 481.6l-28.8 48c-6.4 11.2-16 17.6-28.8 20.8L400 563.2zM864 288H240c-62.4 0-112-49.6-112-112S177.6 64 240 64h624c17.6 0 32 14.4 32 32s-14.4 32-32 32H240c-27.2 0-48 20.8-48 48s20.8 48 48 48h624c17.6 0 32 14.4 32 32s-14.4 32-32 32z m-64 672H224c-52.8 0-96-43.2-96-96V176c0-17.6 14.4-32 32-32s32 14.4 32 32v688c0 17.6 14.4 32 32 32h576c17.6 0 32-14.4 32-32V256c0-17.6 14.4-32 32-32s32 14.4 32 32v608c0 52.8-43.2 96-96 96z m64-678.4c-4.8 0-8-1.6-12.8-3.2C809.6 260.8 784 220.8 784 176s25.6-84.8 67.2-102.4c16-6.4 35.2 0 41.6 16 6.4 16 0 35.2-16 41.6-17.6 8-28.8 25.6-28.8 44.8s11.2 36.8 28.8 43.2c16 6.4 24 25.6 16 41.6-4.8 12.8-16 20.8-28.8 20.8z%22 fill=%22%23FAFAFA%22/> </svg>");
}
#maga-better-icon-chatgpt {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2220%22 height=%2220%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22 p-id=%222788%22><path d=%22M431.207059 2.199998C335.414129 13.19899 257.420186 72.593947 219.024215 163.78688l-6.199996 14.797989-19.997985 5.799996C104.233299 210.582846 38.840347 279.776795 15.041364 372.369727c-6.999995 27.39698-8.999993 71.393948-4.199997 99.990927 7.399995 44.996967 26.597981 88.592935 53.795961 121.989911l9.198993 11.399991-5.199996 19.597986c-6.799995 26.597981-8.598994 74.593945-3.799997 103.190924 14.799989 87.392936 75.193945 163.58688 155.587886 196.383857 46.395966 18.998986 95.99193 24.797982 142.187895 16.798987l11.599992-1.999998 18.597986 17.598987c30.396978 28.596979 66.593951 48.395965 108.789921 59.994956 25.998981 6.999995 83.193939 8.999993 111.391918 3.599997 53.194961-9.799993 98.391928-33.797975 137.1889-72.794946 27.996979-28.196979 51.194963-64.393953 59.794956-93.591932 2.199998-6.999995 3.599997-8.599994 8.798993-9.799993 12.798991-2.598998 42.595969-13.39799 56.194959-20.196985 35.996974-17.998987 72.793947-49.195964 94.792931-80.593941 19.797985-28.197979 36.196973-65.993952 44.395967-102.990924 1.799999-7.799994 2.799998-24.997982 2.799998-48.995965 0-33.997975-0.6-38.796972-5.799996-58.995956-9.998993-38.795972-25.997981-71.993947-48.395964-100.190927l-10.198993-12.799991 4.399997-17.597987c26.79698-102.790925-16.798988-217.181841-105.391923-276.576797-30.996977-20.598985-58.194957-31.997977-95.59193-40.196971-22.397984-4.999996-70.993948-5.799996-91.991932-1.799998-12.399991 2.399998-12.99999 2.399998-15.799989-1.599999-4.598997-7.199995-34.795975-31.596977-52.794961-42.995969C548.196973 9.598993 486.603019-4.199997 431.207059 2.199998z m45.395967 67.793951c25.197982 2.399998 40.39697 6.399995 61.394955 16.198988 16.797988 7.799994 41.995969 23.397983 41.995969 25.997981 0 0.799999-45.595967 27.79798-101.390926 59.794956-55.995959 32.196976-104.591923 60.794955-108.19092 63.394954-14.799989 10.998992-14.399989 8.399994-14.59999 97.591928-0.2 43.995968-0.999999 110.389919-1.599998 147.387892l-1.199 67.393951-42.596968-24.397982-42.595969-24.397982 0.599999-134.988902c0.799999-154.386887 0.2-147.987892 19.597986-187.383862 29.797978-60.395956 86.792936-100.191927 151.987889-106.591922 8.199994-0.799999 15.398989-1.599999 15.998988-1.599999 0.6-0.2 9.798993 0.6 20.597985 1.599999z m268.977803 82.992939c73.393946 15.399989 132.189903 74.193946 147.387892 147.987892 3.599997 16.998988 4.599997 62.394954 1.599999 67.79495-1.199999 2.399998-22.797983-9.399993-108.590921-59.394957-105.391923-61.394955-107.191921-62.394954-117.989913-62.394954-10.799992 0-13.19999 1.399999-137.989899 73.593946l-126.989907 73.393946-0.599-49.395963c-0.2-27.19798 0.2-49.995963 1-50.795963 3.799997-3.599997 209.182847-121.189911 223.581836-127.989906 35.796974-16.797988 77.992943-21.397984 118.589913-12.798991z m-537.955606 362.369735c3.199998 4.599997 37.596972 25.398981 130.389904 78.993942 69.393949 39.796971 125.988908 72.993947 125.988908 73.593946 0 0.6-5.599996 4.199997-12.598991 8.199994-6.799995 3.799997-25.997981 14.797989-42.596968 24.397982l-30.196978 17.597987-107.790921-62.194954c-59.194957-34.196975-114.589916-67.393951-122.78991-73.793946-29.397978-22.597983-56.395959-63.793953-66.194952-101.190926-6.199995-24.197982-7.199995-60.794955-2.199998-84.992938 7.599994-36.996973 23.397983-66.994951 49.195964-93.792931 17.398987-17.997987 33.197976-29.396978 55.195959-40.195971l16.997988-8.199994 0.999999 127.589907 0.999999 127.589906 4.599997 6.398996zM750.379825 367.169731c56.394959 32.596976 108.389921 62.994954 115.589916 67.593951 43.396968 28.597979 73.593946 75.793944 81.99294 127.989906 3.599997 21.597984 1.599999 61.994955-3.999997 80.992941-8.998993 31.397977-24.996982 58.995957-47.594966 82.593939-17.598987 18.397987-48.195965 38.995971-65.794951 44.395967l-4.599997 1.399999v-124.189909c0-138.188899 0.4-133.389902-13.59899-143.387895-4.399997-2.999998-62.393954-37.196973-128.988906-75.593944-66.594951-38.596972-121.189911-70.393948-121.189911-70.993948-0.2-0.799999 83.592939-49.795964 85.192938-49.995964 0.4 0 46.595966 26.597981 102.991924 59.194957z m-181.385867 50.195963l54.99596 31.596977v127.989906l-55.19596 31.596977-55.194959 31.797977-39.196971-22.598983c-21.797984-12.398991-46.795966-26.99698-55.994959-32.196977l-16.398988-9.799993 0.399999-63.393953 0.6-63.394954 53.99496-31.396977c29.797978-17.198987 54.79596-31.397977 55.59596-31.397977 0.799999-0.2 26.197981 13.99999 56.394958 31.197977z m147.587892 85.592938l41.39697 23.797982v127.389907c0 139.787898-0.4 146.187893-11.999991 178.384869-11.597992 31.796977-36.595973 65.394952-64.593953 86.592937-6.799995 5.199996-21.397984 13.79899-32.396976 18.997986-51.995962 24.997982-109.59092 25.597981-162.586881 1.799999-12.598991-5.799996-40.39697-23.397983-40.396971-25.797982 0-0.6 46.996966-28.196979 104.191924-61.194955 57.394958-32.996976 107.190921-62.794954 110.789919-66.193951 3.799997-3.799997 7.399995-9.999993 8.799993-15.399989 1.599999-6.398995 2.199998-50.994963 2.199999-151.386889 0-78.392943 0.799999-141.987896 1.599999-141.587896 0.799999 0.2 20.197985 11.398992 42.995968 24.597982zM622.590919 732.139464c-3.799997 3.599997-205.38285 119.189913-221.781838 126.989907-26.597981 12.798991-47.995965 17.397987-79.792941 17.397987-19.798985 0-30.197978-0.999999-43.596968-4.199997-68.59395-16.997988-120.589912-66.193952-140.587897-133.787902-5.599996-18.798986-8.599994-57.395958-5.999996-75.193945l1.399999-9.199993 50.395963 29.197979c174.185872 100.391926 165.185879 95.59193 176.185871 95.591929 9.598993-0.2 16.597988-3.799997 137.1879-73.393946l126.989907-73.393946 0.599999 49.395964c0.2 26.99798-0.2 49.795964-0.999999 50.595963z%22 p-id=%222789%22 fill=%22%23FAFAFA%22></path></svg>");
}
#maga-better-icon-onetab {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2220%22 height=%2220%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22 p-id=%2213058%22><path d=%22M599.5 775.6l-28.9-28.9 11.5 11.5c10.3 9.2 26.1 8.8 36-1.1l-18.6 18.5zM484 891.8l-29-28.9 11.5 11.5c10.3 9.2 26.1 8.8 36-1.1L484 891.8zM137.7 544.7l28.9-28.9-11.5 11.5c-9.2 10.3-8.8 26.1 1.1 36l-18.5-18.6zM671.7 211.8c-77.3 0-140 62.7-140 140s62.7 140 140 140 140-62.7 140-140-62.7-140-140-140z m0 198.1c-32.1 0-58.1-26-58.1-58.1s26-58.1 58.1-58.1 58.1 26 58.1 58.1-26 58.1-58.1 58.1z%22 fill=%22%23FAFAFA%22 p-id=%2213059%22></path><path d=%22M980.2 488.5V88.7c0-22.6-18.3-41-41-41H535.7c-13 0-24.6 6.1-32.1 15.5l-438 438c-20.7 25-20.8 61.2-0.4 86.3L440 962.4c25.3 21.4 62.4 21.4 87.7 0.1l26.3-26.3c16-16 16-41.9 0-57.9s-41.9-16-57.9 0L484 890.4 138.1 544.6l415-415h345.2v346.5L599.5 774.9 333.1 508.5c-16-16-41.9-16-57.9 0s-16 41.9 0 57.9l238 238 37.6 37.6c0.3 0.3 0.6 0.7 1 1 24.4 24.4 62.7 26.4 89.4 6l327.2-327.2c9.1-9.1 13-21.5 11.8-33.3z%22 fill=%22%23FAFAFA%22 p-id=%2213060%22></path></svg>");
}
#maga-better-icon-qrcode {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2218%22 height=%2218%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22><path d=%22M126.160164 820.041068h77.798768v77.798768H126.160164z m126.160165-48.361397V946.201232H77.798768v-174.521561z m7.359342-77.798768h-189.240246A70.439425 70.439425 0 0 0 0 764.320329v189.240246a70.439425 70.439425 0 0 0 70.439425 70.439425h189.240246a70.439425 70.439425 0 0 0 70.439426-70.439425v-189.240246a70.439425 70.439425 0 0 0-70.439426-70.439426z m560.361397 126.160165h77.798768v77.798768H820.041068z m126.160164-48.361397V946.201232h-174.521561v-174.521561z m7.359343-77.798768h-189.240246a70.439425 70.439425 0 0 0-70.439426 70.439426v189.240246a70.439425 70.439425 0 0 0 70.439426 70.439425h189.240246a70.439425 70.439425 0 0 0 70.439425-70.439425v-189.240246a70.439425 70.439425 0 0 0-70.439425-70.439426zM820.041068 126.160164h77.798768v77.798768H820.041068z m126.160164-48.361396V252.320329h-174.521561V77.798768zM953.560575 0h-189.240246a70.439425 70.439425 0 0 0-70.439426 70.439425v189.240246a70.439425 70.439425 0 0 0 70.439426 70.439426h189.240246a70.439425 70.439425 0 0 0 70.439425-70.439426v-189.240246A70.439425 70.439425 0 0 0 953.560575 0zM126.160164 126.160164h77.798768v77.798768H126.160164z m-48.361396 126.160165V77.798768H252.320329V252.320329z m-7.359343 77.798768h189.240246a70.439425 70.439425 0 0 0 70.439426-70.439426v-189.240246A70.439425 70.439425 0 0 0 259.679671 0h-189.240246A70.439425 70.439425 0 0 0 0 70.439425v189.240246a70.439425 70.439425 0 0 0 70.439425 70.439426zM0 567.720739h77.798768v77.798768H0zM456.279261 630.800821H378.480493v203.958933h63.080082v48.361396H378.480493v77.798768h126.160164v63.080082h77.798768v-63.080082h63.080082V883.12115H567.720739V946.201232h-48.361396v-111.441478h126.160164V756.960986h-189.240246z m504.640657-252.320328H883.12115v126.160164h-111.441479V378.480493h-189.240246V252.320329h-63.080082v-48.361397h63.080082v-63.080082h63.080082V63.080082h-63.080082V0H378.480493v77.798768h126.160164v48.361396H441.560575v140.87885h63.080082V378.480493H441.560575v63.080082H330.119097V378.480493H252.320329v63.080082h-48.361397V378.480493H63.080082v63.080082H0v77.798768h77.798768v-63.080082H189.240246v63.080082h63.080083v126.160164h77.798768v-126.160164h126.160164v-63.080082h237.601642v48.361396H504.640657v77.798768h63.080082v126.160164h140.87885V630.800821h-63.080082v-48.361396h252.320329v-63.080082H946.201232v63.080082h77.798768V504.640657h-63.080082z%22 fill=%22%23FAFAFA%22></path></svg>");
}
#maga-better-icon-more {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2224%22 height=%2224%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22> <path d=%22M411.733333 232.533333v206.933334H200.533333c-44.8-2.133333-81.066667-40.533333-81.066666-85.333334s36.266667-83.2 81.066666-85.333333h4.266667c21.333333 0 42.666667 8.533333 57.6 21.333333-12.8-14.933333-21.333333-34.133333-21.333333-57.6v-4.266666c2.133333-44.8 40.533333-81.066667 85.333333-81.066667s83.2 36.266667 85.333333 81.066667v4.266666z%22 fill=%22%23FAFAFA%22></path> <path d=%22M433.066667 460.8h-234.666667c-55.466667-4.266667-100.266667-49.066667-100.266667-106.666667s44.8-102.4 100.266667-106.666666h21.333333v-14.933334-6.4c4.266667-55.466667 49.066667-100.266667 106.666667-100.266666s104.533333 44.8 106.666667 100.266666v234.666667z m-228.266667-170.666667h-4.266667c-34.133333 2.133333-59.733333 29.866667-59.733333 64s25.6 61.866667 59.733333 64H390.4v-185.6-4.266666c-2.133333-34.133333-29.866667-59.733333-64-59.733334s-61.866667 25.6-64 59.733334v4.266666c0 14.933333 6.4 32 17.066667 42.666667l-29.866667 29.866667c-12.8-10.666667-29.866667-14.933333-44.8-14.933334z%22 fill=%22%23FAFAFA%22></path> <path d=%22M612.266667 791.466667v-206.933334H823.466667c44.8 2.133333 81.066667 40.533333 81.066666 85.333334s-36.266667 83.2-81.066666 85.333333h-4.266667c-21.333333 0-42.666667-8.533333-57.6-21.333333 12.8 14.933333 21.333333 34.133333 21.333333 57.6v4.266666c-2.133333 44.8-40.533333 81.066667-85.333333 81.066667s-83.2-36.266667-85.333333-81.066667v-4.266666z%22 fill=%22%23FAFAFA%22></path> <path d=%22M697.6 898.133333c-57.6 0-104.533333-44.8-106.666667-100.266666v-234.666667h234.666667c55.466667 4.266667 100.266667 49.066667 100.266667 106.666667s-44.8 102.4-100.266667 106.666666h-21.333333v21.333334c-2.133333 55.466667-49.066667 100.266667-106.666667 100.266666z m-64-292.266666V795.733333c2.133333 34.133333 29.866667 59.733333 64 59.733334s61.866667-25.6 64-59.733334v-4.266666c0-14.933333-6.4-32-17.066667-42.666667l29.866667-29.866667c12.8 10.666667 29.866667 17.066667 46.933333 17.066667 34.133333-2.133333 59.733333-29.866667 59.733334-64s-25.6-61.866667-59.733334-64H633.6z%22 fill=%22%23FAFAFA%22></path> <path d=%22M411.733333 791.466667v-206.933334H200.533333c-44.8 2.133333-81.066667 40.533333-81.066666 85.333334s36.266667 83.2 81.066666 85.333333h4.266667c21.333333 0 42.666667-8.533333 57.6-21.333333-12.8 14.933333-21.333333 34.133333-21.333333 57.6v4.266666c2.133333 44.8 40.533333 81.066667 85.333333 81.066667s83.2-36.266667 85.333333-81.066667v-4.266666z%22 fill=%22%23FAFAFA%22></path> <path d=%22M326.4 898.133333c-57.6 0-102.4-44.8-106.666667-100.266666v-6.4-14.933334c-6.4 0-14.933333 2.133333-21.333333 0-55.466667-4.266667-100.266667-49.066667-100.266667-106.666666s44.8-104.533333 100.266667-106.666667h234.666667v234.666667c-4.266667 55.466667-51.2 100.266667-106.666667 100.266666z m-78.933333-179.2l29.866666 29.866667c-10.666667 12.8-17.066667 27.733333-17.066666 42.666667v4.266666c2.133333 34.133333 29.866667 59.733333 64 59.733334s61.866667-25.6 64-59.733334V605.866667H200.533333c-34.133333 2.133333-59.733333 29.866667-59.733333 64s25.6 61.866667 59.733333 64h4.266667c14.933333 0 32-4.266667 42.666667-14.933334z%22 fill=%22%23FAFAFA%22></path> <path d=%22M612.266667 232.533333v206.933334H823.466667c44.8-2.133333 81.066667-40.533333 81.066666-85.333334s-36.266667-83.2-81.066666-85.333333h-4.266667c-21.333333 0-42.666667 8.533333-57.6 21.333333 12.8-14.933333 21.333333-34.133333 21.333333-57.6v-4.266666c-2.133333-44.8-40.533333-81.066667-85.333333-81.066667s-83.2 36.266667-85.333333 81.066667v4.266666z%22 fill=%22%23FAFAFA%22></path> <path d=%22M819.2 460.8H590.933333V232.533333v-6.4c4.266667-55.466667 49.066667-100.266667 106.666667-100.266666s102.4 44.8 106.666667 100.266666v21.333334c6.4 0 14.933333-2.133333 21.333333 0 55.466667 4.266667 100.266667 49.066667 100.266667 106.666666s-44.8 102.4-100.266667 106.666667h-6.4z m-185.6-42.666667H823.466667c34.133333-2.133333 59.733333-29.866667 59.733333-64s-25.6-61.866667-59.733333-64h-4.266667c-14.933333 0-32 6.4-42.666667 17.066667L746.666667 275.2c10.666667-12.8 17.066667-27.733333 17.066666-42.666667v-4.266666c-2.133333-34.133333-29.866667-59.733333-64-59.733334s-61.866667 25.6-64 59.733334V418.133333z%22 fill=%22%23FAFAFA%22></path> </svg>");
}
#maga-better-icon-setting {
background-repeat: no-repeat;
background-position: center;
background-image: url("data:image/svg+xml;charset=utf8,<svg width=%2224%22 height=%2224%22 class=%22icon%22 viewBox=%220 0 1024 1024%22 version=%221.1%22 xmlns=%22http://www.w3.org/2000/svg%22> <path d=%22M547.6 960h-71.3c-31.9 0-57.9-26-57.9-57.9v-37.2c-31.5-8.3-61.6-20.8-89.9-37.3L302.2 854c-22.5 22.6-59.3 22.6-81.8 0L170 803.6c-22.6-22.5-22.6-59.3 0-81.8l26.4-26.4c-0.9-1.5-1.7-2.9-2.5-4.4-15.3-27-26.9-55.7-34.8-85.5h-37.2c-31.9 0-57.8-26-57.8-57.9v-71.3c0-31.9 25.9-57.9 57.8-57.9h37.2c8.3-31.5 20.8-61.6 37.3-89.9L170 302.2c-22.6-22.5-22.6-59.3 0-81.8l50.4-50.4c22.5-22.5 59.3-22.6 81.8 0l26.4 26.4c13.9-8.1 28.4-15.3 43.2-21.5 15.2-6.3 30.8-11.6 46.7-15.8v-37.2c0-31.9 26-57.9 57.9-57.9h71.3c31.9 0 57.9 26 57.9 57.9v37.2c31.5 8.3 61.6 20.8 89.9 37.3l26.4-26.4c22.5-22.5 59.3-22.6 81.8 0l50.4 50.4c22.6 22.5 22.6 59.3 0 81.8l-26.4 26.4c16.5 28.3 29 58.4 37.3 89.9h37.2c31.9 0 57.9 26 57.9 57.9v71.3c0 31.9-26 57.9-57.9 57.9H865c-8.3 31.5-20.8 61.6-37.3 89.9l26.4 26.4c22.6 22.5 22.6 59.3 0 81.8L803.6 854c-22.5 22.6-59.3 22.6-81.8 0l-26.4-26.4c-28.3 16.5-58.4 29-89.9 37.3v37.2c0 31.9-26 57.9-57.9 57.9zM324.8 767.8c5.1 0 10.1 1.4 14.6 4.4 33.9 22.5 71.1 38 110.7 45.9 12.3 2.5 21.2 13.3 21.2 25.8V902c0 2.8 2.3 5.1 5.1 5.1h71.3c2.8 0 5.1-2.3 5.1-5.1v-58c0-12.6 8.9-23.4 21.2-25.8 39.6-8 76.8-23.4 110.7-45.9 10.4-7 24.3-5.6 33.2 3.3l41.2 41.2c2 2 5.3 2 7.3 0l50.4-50.4c2-2 2-5.3 0-7.3l-41.2-41.2c-8.9-8.9-10.3-22.8-3.3-33.2 22.5-33.9 38-71.1 45.9-110.7 2.5-12.3 13.3-21.2 25.8-21.2h58.1c2.8 0 5.1-2.3 5.1-5.1v-71.3c0-2.8-2.3-5.1-5.1-5.1H844c-12.6 0-23.4-8.9-25.8-21.2-8-39.6-23.4-76.8-45.9-110.7-6.9-10.4-5.6-24.3 3.3-33.2l41.2-41.2c2-2 2-5.3 0-7.3l-50.4-50.4c-2-2-5.3-2-7.3 0l-41.2 41.2c-8.9 8.9-22.8 10.2-33.2 3.3-33.9-22.5-71.1-38-110.7-45.9-12.3-2.5-21.2-13.3-21.2-25.8V122c0-2.8-2.3-5.1-5.1-5.1h-71.3c-2.8 0-5.1 2.3-5.1 5.1v58c0 12.6-8.9 23.4-21.2 25.8-19.7 4-39.2 9.9-57.9 17.7-18.4 7.7-36.1 17.2-52.8 28.2-10.5 7-24.4 5.6-33.2-3.3L265 207.3c-2-2-5.3-2-7.3 0l-50.4 50.4c-2 2-2 5.3 0 7.3l41.2 41.2c8.9 8.9 10.3 22.8 3.3 33.2-22.5 33.9-38 71.1-45.9 110.7-2.5 12.3-13.3 21.2-25.8 21.2H122c-2.8 0-5.1 2.3-5.1 5.1v71.3c0 2.8 2.3 5.1 5.1 5.1h58c12.6 0 23.4 8.9 25.8 21.2 6.4 32 17.8 62.6 33.9 91.1 3.8 6.7 7.8 13.2 12 19.6 6.9 10.4 5.6 24.3-3.3 33.2L207.3 759c-2 2-2 5.3 0 7.3l50.4 50.4c2 2 5.3 2 7.3 0l41.2-41.2c5-5 11.8-7.7 18.6-7.7z%22 fill=%22%23FAFAFA%22></path> <path d=%22M512 716.4c-112.7 0-204.4-91.7-204.4-204.4S399.3 307.6 512 307.6c71.5 0 136.6 36.4 174.1 97.3 7.6 12.4 3.8 28.6-8.6 36.3-12.4 7.6-28.6 3.8-36.3-8.6-27.8-45.2-76.1-72.2-129.2-72.2-83.6 0-151.7 68-151.7 151.6s68 151.6 151.7 151.6 151.6-68 151.6-151.6c0-14.5 11.8-26.4 26.4-26.4s26.4 11.8 26.4 26.4c0 112.7-91.7 204.4-204.4 204.4z%22 fill=%22%23FAFAFA%22></path></svg>");
}
`;
const common = {
generic: function (param) {
let url;
if (typeof param == 'undefined') {
param = 'target';
}
let encodeUrl = GUtils.getUrlParam(param);
if (encodeUrl && encodeUrl.length > 0) {
url = decodeURIComponent(encodeUrl);
GUtils.log("通过参数获取", url);
} else {
let regex = location.href.match(/target=(.+?)(&|$)/);
if (regex && regex.length === 3) {
url = decodeURIComponent(regex[1]);
GUtils.log("通过正则获取", url);
}
}
if (url && url.length > 0) {
if (url.startsWith("http")) {
location.href = url;
} else if (url.startsWith("//")) {
location.href = "http:" + url;
} else {
location.href = "http://" + url;
}
}
}
};
let regexStr$z = [
{url: 'docs.qq.com/scenario/link.html', linkType: 'startWith'}
];
const website$z = {
interceptor: function () {
return GUtils.interceptor(regexStr$z)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('url');
}
};
let regexStr$y = [
{url: 'yuque.com/r/goto', linkType: 'contains'}
];
const website$y = {
interceptor: function () {
return GUtils.interceptor(regexStr$y)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('url');
}
};
let regexStr$x = [
{url: 'aiqicha.baidu.com/safetip', linkType: 'startWith'}
];
const website$x = {
interceptor: function () {
return GUtils.interceptor(regexStr$x)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$w = [
{url: 'developers.weixin.qq.com/community/middlepage/href', linkType: 'startWith'}
];
const website$w = {
interceptor: function () {
return GUtils.interceptor(regexStr$w)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('href');
},
};
let regexStr$v = [
{url: 'redirect.epicgames.com', linkType: 'startWith'}
];
const website$v = {
interceptor: function () {
return GUtils.interceptor(regexStr$v)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('redirectTo');
},
};
let regexStr$u = [
{ url: 't.cn/', linkType: 'startWith' },
];
const website$u = {
interceptor: function () {
return GUtils.interceptor(regexStr$u)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let link = $j('.m-container-max .open-url a').attr('href');
location.replace(link);
});
},
};
let regexStr$t = [
{url: 'google.com/search?q=', linkType: 'contains'}
];
const website$t = {
interceptor: function () {
return GUtils.interceptor(regexStr$t)
},
setRunType: function (val) {
},
init: function ($j) {
document.addEventListener("DOMContentLoaded",
() => $j("#res a").attr("target", "_blank"));
},
};
let regexStr$s = [
{url: 'qcc.com/web/transfer-link', linkType: 'contains'}
];
const website$s = {
interceptor: function () {
return GUtils.interceptor(regexStr$s)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('link');
}
};
let regexStr$r = [
{url: 'link.csdn.net', linkType: 'startWith'}
];
const website$r = {
interceptor: function () {
return GUtils.interceptor(regexStr$r)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$q = [
{url: 'google.com/url', linkType: 'contains'},
{url: 'google\.com\.hk/url', linkType: 'regexp'},
];
const website$q = {
interceptor: function () {
return GUtils.interceptor(regexStr$q)
},
setRunType: function (val) {
},
init: function ($j) {
let url = GUtils.getQueryVariable(location.href, 'url');
if (url && url.length > 0) {
common.generic('url');
} else {
common.generic('q');
}
},
};
let regexStr$p = [
{url: 'gitee.com/link', linkType: 'contains'}
];
const website$p = {
interceptor: function () {
return GUtils.interceptor(regexStr$p)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$o = [
{url: 'chinaz.com/go.shtml', linkType: 'contains'}
];
const website$o = {
interceptor: function () {
return GUtils.interceptor(regexStr$o)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('url');
}
};
let regexStr$n = [
{url: 'blog.51cto.com/transfer', linkType: 'startWith'}
];
const website$n = {
interceptor: function () {
return GUtils.interceptor(regexStr$n)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$m = [
{url: 'douban.com/link2/', linkType: 'contains'}
];
const website$m = {
interceptor: function () {
return GUtils.interceptor(regexStr$m)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('url');
}
};
let regexStr$l = [
{url: 'link.uisdc.com', linkType: 'startWith'}
];
const website$l = {
interceptor: function () {
return GUtils.interceptor(regexStr$l)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('redirect');
}
};
let regexStr$k = [
{url: 'c.pc.qq.com/middlem.html', linkType: 'startWith'}
];
const website$k = {
interceptor: function () {
return GUtils.interceptor(regexStr$k)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('pfurl');
},
};
let regexStr$j = [
{url: 'oschina.net/action/GoToLink', linkType: 'contains'}
];
const website$j = {
interceptor: function () {
return GUtils.interceptor(regexStr$j)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('url');
}
};
let regexStr$i = [
{url: 'weibo.cn/sinaurl', linkType: 'contains'}
];
const website$i = {
interceptor: function () {
return GUtils.interceptor(regexStr$i)
},
setRunType: function (val) {
},
init: function ($j) {
let url = GUtils.getQueryVariable(location.href, 'toasturl');
if (url && url.length > 0) {
common.generic('toasturl');
} else {
common.generic('u');
}
},
};
let regexStr$h = [
{url: 'link.juejin.cn', linkType: 'startWith'}
];
const website$h = {
interceptor: function () {
return GUtils.interceptor(regexStr$h)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$g = [
{url: 'weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi', linkType: 'startWith'}
];
const website$g = {
interceptor: function () {
return GUtils.interceptor(regexStr$g)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let select = $j('.weui-msg__text-area .ui-ellpisis-content p');
let indexUrl = select.text();
if (indexUrl && indexUrl.length > 0) {
location.replace(indexUrl);
}
});
},
};
let regexStr$f = [
{url: 'app.yinxiang.com/OutboundRedirect.action', linkType: 'startWith'}
];
const website$f = {
interceptor: function () {
return GUtils.interceptor(regexStr$f)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('dest');
}
};
let regexStr$e = [
{url: 'leetcode.cn/link/', linkType: 'contains'}
];
const website$e = {
interceptor: function () {
return GUtils.interceptor(regexStr$e)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$d = [
{url: 'afdian.net/link', linkType: 'contains'}
];
const website$d = {
interceptor: function () {
return GUtils.interceptor(regexStr$d)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$c = [
{url: 'link.zhihu.com/', linkType: 'startWith'}
];
const website$c = {
interceptor: function () {
return GUtils.interceptor(regexStr$c)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$b = [
{url: 'tianyancha.com/security', linkType: 'contains'}
];
const website$b = {
interceptor: function () {
return GUtils.interceptor(regexStr$b)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('target');
}
};
let regexStr$a = [
{url: 'jianshu.com/go-wild', linkType: 'contains'}
];
const website$a = {
interceptor: function () {
return GUtils.interceptor(regexStr$a)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('url');
},
};
let regexStr$9 = [
{url: 'jump2.bdimg.com/safecheck/index', linkType: 'startWith'}
];
const website$9 = {
interceptor: function () {
return GUtils.interceptor(regexStr$9)
},
setRunType: function (val) {
},
init: function ($j) {
let url = $j('.warning_info p.link').text();
GUtils.log('百度贴吧:跳转:url' + url);
location.replace(url);
},
};
let regexStr$8 = [
{url: 'pc6.com/goread.html', linkType: 'contains'}
];
const website$8 = {
interceptor: function () {
return GUtils.interceptor(regexStr$8)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('gourl');
}
};
let regexStr$7 = [
{url: '360doc.com/content', linkType: 'contains'}
];
const website$7 = {
interceptor: function () {
return GUtils.interceptor(regexStr$7)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let selectViews = $j('#artContent');
if (selectViews && selectViews.length > 0) {
selectViews[0].addEventListener('click', event => {
const {
target,
} = event;
if (target.nodeName === 'A') {
let href = target.href;
if (href && href.length > 0) {
// 是否本站
if (new RegExp(location.host).test(new URL(href).host)) {
return
}
GM_openInTab(href);
event.stopPropagation(); //阻止事件的冒泡和捕获(点击了子元素,不想点击事件向上冒泡)
event.preventDefault(); //阻止浏览器默认行为
}
}
}, true);//事件不向上重播
}
});
},
};
let regexStr$6 = [
{url: 'mail.qq.com/cgi-bin/readtemplate', linkType: 'startWith'},
{url: 'mail.qq.com/cgi-bin/mail_spam', linkType: 'startWith'},
];
const website$6 = {
interceptor: function () {
return GUtils.interceptor(regexStr$6)
},
setRunType: function (val) {
},
init: function ($j) {
let url = GUtils.getQueryVariable(location.href, 'url');
if (url && url.length > 0) {
common.generic('url');
} else {
common.generic('gourl');
}
},
};
let regexStr$5 = [
{url: 'youtube.com/redirect', linkType: 'contains'}
];
const website$5 = {
interceptor: function () {
return GUtils.interceptor(regexStr$5)
},
setRunType: function (val) {
},
init: function ($j) {
common.generic('q');
}
};
const modules$2 = [
website$z,
website$y,
website$x,
website$w,
website$v,
website$u,
website$t,
website$s,
website$r,
website$q,
website$p,
website$o,
website$n,
website$m,
website$l,
website$k,
website$j,
website$i,
website$h,
website$g,
website$f,
website$e,
website$d,
website$c,
website$b,
website$a,
website$9,
website$8,
website$7,
website$6,
website$5,
];
const prepare$2 = {
init: function ($j, runType) {
for (let i = 0; i < modules$2.length; i++) {
let module = modules$2[i];
if (module.interceptor()) {
continue;
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
},
};
let regExpStr1 = /<a[^>]*href=['"]https:\/\/xg\.zhihu\.com\/plugin\/(.*?)\?BIZ=ECOMMERCE['"].*?[^>]*>(.*?)<\/a>/g;
let regExpStr2 = /<a[^>]*data-ad-id=['"]Plugin_(.*?)['"].*?[^>]*>(.*?)<\/a>/g;
let cardUrl = 'https://www.zhihu.com/api/v4/commercial/ecommerce';
let selectConfig = [
{
selector: 'div.RichText-Ecommerce',
selectType: 'link-card-ecommerce',
},
{
selector: 'div.RichText-ADLinkCardContainer',
selectType: 'link-card-adlink',
},
];
let cssWait$2 = 'maga-stolen-card-wait';
let flagAlready$2 = 'maga-stolen-card-already';
var stolenUtil = {
getPluginId: function (html) {
var result = [];
while (regExpStr1.exec(html) != null) {
//如果是RegExp.$2那么匹配的就是a标签的value!
result.push(RegExp.$1);
}
while (regExpStr2.exec(html) != null) {
//如果是RegExp.$2那么匹配的就是a标签的value!
result.push(RegExp.$1);
}
return result
},
getPluginCard: function ($j, requestUrl) {
let that = this;
return new Promise((resolve, reject) => {
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
let htmlPlginId = that.getPluginId(resp);
if (htmlPlginId.length === 0) {
return
}
let prams = '';
for (let item of htmlPlginId) {
prams = prams + `Plugin_${item},`;
}
prams = prams.substr(0, prams.length - 1);
GM.xmlHttpRequest({
method: 'POST',
data: JSON.stringify({card_ids: prams}),
headers: {'Content-Type': 'application/json'},
url: cardUrl,
onload: function onload(response) {
let data = response.response;
if (typeof data === 'string') {
data = JSON.parse(data);
}
resolve(data);
},
onerror: function (err) {
reject(err);
},
});
},
});
})
},
overrideClickEvent: function ($j, hashMap) {
let objs = {};
setInterval(function () {
selectConfig.forEach(function (config) {
$j(config.selector).each(function () {
objs.initItem(this, config.selectType);
});
});
}, 1500);
setInterval(function () {
$j(`.${cssWait$2}`).each(function () {
objs.queryItem(this);
});
}, 1500);
objs.initItem = function (selector, selectType) {
let selectView = $j(selector);
if ((selectView.attr('maga-stolen-flag') || '') === flagAlready$2) {
return
}
let channel = '';
let goodsUrl = '';
if (selectType === 'link-card-ecommerce') {
let itemName = selectView
.find('div.ecommerce-ad-box')
.find('div.ecommerce-ad-arrow')
.find('div.ecommerce-ad-arrow-main')
.find('div.ecommerce-ad-arrow-main-content')
.find('div.ecommerce-ad-arrow-main-content-des')
.find('span').text() || '';
if (itemName.length > 0) {
let hrefStr = hashMap.get(itemName);
let hostUrl = hrefStr.indexOf('?') === -1 ? hrefStr : hrefStr.split('?')[0];
if (GUtils.itemIndexOfIn(hostUrl, GUtils.getPlatformShop())) {
//属于购物网站的链接
goodsUrl = hrefStr;
channel = GUtils.getChannel(hostUrl);
} else {
selectView.attr('maga-stolen-flag', flagAlready$2);
}
}
} else if (selectType === 'link-card-adlink') {
let itemName = selectView
.find('div:nth-child(2)')
.find('div.ecommerce-ad-commodity')
.find('div.ecommerce-ad-commodity-main')
.find('div.ecommerce-ad-commodity-main-content')
.find('div.ecommerce-ad-commodity-main-content-des')
.find('span').text() || '';
if (itemName.length > 0) {
let hrefStr = hashMap.get(itemName);
let hostUrl = hrefStr.indexOf('?') === -1 ? hrefStr : hrefStr.split('?')[0];
if (GUtils.itemIndexOfIn(hostUrl, GUtils.getPlatformShop())) {
//属于购物网站的链接
goodsUrl = hrefStr;
channel = GUtils.getChannel(hostUrl);
} else {
selectView.attr('maga-stolen-flag', flagAlready$2);
}
}
}
if (channel && channel.length > 0) {
selectView.attr('data-item-url', goodsUrl);
selectView.attr('data-item-type', channel);
selectView.attr('select-type', selectType);
selectView.addClass(cssWait$2);
selectView.attr('maga-stolen-flag', flagAlready$2);
}
};
objs.queryItem = function (waitClass) {
let waitView = $j(waitClass);
waitView.removeClass(cssWait$2);
let channel = waitView.attr('data-item-type');
let goodsUrl = encodeURIComponent(waitView.attr('data-item-url'));
waitView.attr('select-type');
let requestUrl = GUtils.goodsUrl(channel, goodsUrl);
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
GUtils.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
let data = resp.data;
if (resp.code == 10 && data) {
let linkUrl = '';
if (data.channel === 'tbk') {
linkUrl = data['tbk'].couponUrl || '';
} else if (data.channel === 'jd') {
linkUrl = data['jd'].data || '';
} else {
linkUrl = data['pdd'].data || '';
}
if (linkUrl.length === 0) {
return
}
waitView.attr('data-item-url', linkUrl);
$j(waitView.find('a')).attr('href', linkUrl);
waitView[0].addEventListener('click', event => {
GM_openInTab(linkUrl);
GUtils.clickEventUrl(`event-click-goods-zhihu-${data.channel}`);
event.stopPropagation(); //阻止事件的冒泡和捕获
event.preventDefault(); //阻止浏览器默认行为
}, true);
}
},
});
};
},
};
let hashMap$1 = new HashMap();
let regexStr$4 = [
{url: 'zhihu.com/question/.*?', linkType: 'regexp'},
{url: 'zhihu.com/collection/.*?', linkType: 'regexp'},
{url: 'zhihu.com/people/.*?', linkType: 'regexp'},
];
let pageType = 'question';
let selectArticleConfig = [];//每个文章的节点
const website$4 = {
interceptor: function () {
let linkUrl = GUtils.getUrlPath(location.href);
if (new RegExp('https://www.zhihu.com/question/.*?/answer/.*?').test(linkUrl)) {
//不能与另一个模块冲突
return true
}
if (linkUrl.indexOf('https://www.zhihu.com/question') !== -1) {
pageType = 'question';
} else if (linkUrl.indexOf('https://www.zhihu.com/collection') !== -1) {
pageType = 'collection';
} else if (linkUrl.indexOf('https://www.zhihu.com/people') !== -1) {
pageType = 'people';
}
return GUtils.interceptor(regexStr$4)
},
setRunType: function (val) {
},
init: function ($j) {
selectArticleConfig = [];
if (pageType === 'question') {
selectArticleConfig.push({
selector: 'div.ListShortcut div.List div:nth-child(2) div div.List-item div div[itemtype=\"http://schema.org/Answer\"]',
selectType: 'link-question-answer',
});
selectArticleConfig.push({
selector: 'div.ListShortcut div.List div:nth-child(2) div div.List-item div div[itemtype=\"http://schema.org/SocialMediaPosting\"]',
selectType: 'link-question-zhuanlan',
});
} else if (pageType === 'collection') {
selectArticleConfig.push({
selector: 'div.ListShortcut div div div div[itemtype=\"http://schema.org/Answer\"]',
selectType: 'link-collection-answer',
});
selectArticleConfig.push({
selector: 'div.ListShortcut div div div div[itemtype=\"http://schema.org/SocialMediaPosting\"]',
selectType: 'link-collection-zhuanlan',
});
} else if (pageType === 'people') {
selectArticleConfig.push({
selector: 'div#Profile-activities div:nth-child(2) div.List-item div:nth-child(2) div[itemtype=\"http://schema.org/Answer\"]',
selectType: 'link-people-answer',
});
selectArticleConfig.push({
selector: 'div#Profile-activities div:nth-child(2) div.List-item div:nth-child(2) div[itemtype=\"http://schema.org/SocialMediaPosting\"]',
selectType: 'link-people-zhuanlan',
});
}
if (selectArticleConfig.length === 0) {
return
}
let that = this;
setInterval(function () {
selectArticleConfig.forEach(function (config) {
$j(config.selector).each(function () {
that.getPluginCard($j, this, config.selectType);
});
});
}, 1500);
},
getPluginCard: function ($j, selector, selectType) {
let selectView = $j(selector);
if ((selectView.attr('maga-stolen-flag') || '') !== '') {
return
}
selectView.attr('maga-stolen-flag', selectType);
let requestUrlList = [];
for (let config of selectArticleConfig) {
let link = '';
if (selectType === 'link-question-answer') {
link = selectView.children('meta[itemprop=\"url\"]').attr('content');
} else if (selectType === 'link-question-zhuanlan') {
link = selectView.children('meta[itemprop=\"url\"]').attr('content');
} else if (selectType === 'link-collection-answer') {
link = selectView.children('meta[itemprop=\"url\"]').attr('content');
} else if (selectType === 'link-collection-zhuanlan') {
link = selectView.children('meta[itemprop=\"url\"]').attr('content');
} else if (selectType === 'link-people-answer') {
link = selectView.children('meta[itemprop=\"url\"]').attr('content');
} else if (selectType === 'link-people-zhuanlan') {
link = selectView.children('meta[itemprop=\"url\"]').attr('content');
}
if (link.length) {
if (/http/.test(link)) {
requestUrlList.push(link);
} else {
requestUrlList.push(`https:${link}`);
}
}
}
for (let requestUrl of requestUrlList) {
stolenUtil.getPluginCard($j, requestUrl)
.then((data) => {
for (let response of data.data) {
hashMap$1.put(response.pluginName, response.url);
}
GUtils.log('获取到的卡片的详情', hashMap$1.toStringStr());
stolenUtil.overrideClickEvent($j, hashMap$1);
})
.catch((err) => {
GUtils.log('获取到的卡片的失败的请求', err);
});
}
},
};
let hashMap = new HashMap();
let regexStr$3 = [
{url: 'zhihu.com/question/.*?/answer/.*?', linkType: 'regexp'},
{url: 'zhuanlan.zhihu.com/p/.*?', linkType: 'regexp'},
];
const website$3 = {
interceptor: function () {
return GUtils.interceptor(regexStr$3)
},
setRunType: function (val) {
},
init: function ($j) {
let requestUrl = location.href;
stolenUtil.getPluginCard($j, requestUrl)
.then((data) => {
for (let response of data.data) {
hashMap.put(response.pluginName, response.url);
}
GUtils.log('获取到的卡片的详情', hashMap.toStringStr());
stolenUtil.overrideClickEvent($j, hashMap);
})
.catch((err) => {
GUtils.log('获取到的卡片的失败的请求', err);
});
},
};
let regexStr$2 = [
{url: 'zhihu.com', linkType: 'contains'},
];
let cssWait$1 = 'maga-stolen-wait';
let flagAlready$1 = 'maga-stolen-already';
const website$2 = {
interceptor: function () {
return GUtils.interceptor(regexStr$2)
},
setRunType: function (val) {
},
init: function ($j) {
let selectConfig = [
{
selector: 'div.RichText-MCNLinkCardContainer',
selectType: 'link-card-mcn',
},
{
selector: 'div.RichText-LinkCardContainer',
selectType: 'link-card-normal',
},
];
let objs = {};
setInterval(function () {
selectConfig.forEach(function (config) {
$j(config.selector).each(function () {
objs.initItem(this, config.selectType);
});
});
}, 1500);
setInterval(function () {
$j(`.${cssWait$1}`).each(function () {
objs.queryItem(this);
});
}, 1500);
objs.initItem = function (selector, selectType) {
let selectView = $j(selector);
if ((selectView.attr('maga-stolen-flag') || '') === flagAlready$1) {
return
}
let goodsId = '';
let channel = '';
let goodsUrl = '';
if (selectType === 'link-card-mcn') {
let selectLink = selectView.find('a');
if (selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
let hostUrl = hrefStr.indexOf('?') === -1 ? hrefStr : hrefStr.split('?')[0];
if (GUtils.itemIndexOfIn(hostUrl, GUtils.getPlatformShop())) {
//属于购物网站的链接
goodsUrl = hrefStr;
channel = GUtils.getChannel(hostUrl);
goodsId = selectLink.attr('data-mcn-skuid');
} else {
selectView.attr('maga-stolen-flag', flagAlready$1);
}
}
} else if (selectType === 'link-card-normal') {
let selectLink = selectView.find('a');
if (selectLink.length > 0) {
let hrefStr = selectLink.attr('href');
let targetUrl = decodeURIComponent(GUtils.getQueryVariable(hrefStr, 'target'));
if (targetUrl.length > 0) {
let hostUrl = targetUrl.indexOf('?') === -1 ? targetUrl : targetUrl.split('?')[0];
if (GUtils.itemIndexOfIn(hostUrl, GUtils.getPlatformShop())) {
//属于购物网站的链接
goodsUrl = targetUrl;
channel = GUtils.getChannel(hostUrl);
let temp = selectLink.find('span').find('span:nth-child(2)').text() || '';
if (temp.indexOf('detail.tmall.com') === -1) {
goodsId = temp;
} else {
goodsId = GUtils.getQueryVariable(temp, 'id');
}
} else {
selectView.attr('maga-stolen-flag', flagAlready$1);
}
}
}
}
if (channel && channel.length > 0) {
selectView.attr('data-item-url', goodsUrl);
selectView.attr('data-item-id', goodsId);
selectView.attr('data-item-type', channel);
selectView.attr('select-type', selectType);
selectView.addClass(cssWait$1);
selectView.attr('maga-stolen-flag', flagAlready$1);
}
};
objs.queryItem = function (waitClass) {
let waitView = $j(waitClass);
waitView.removeClass(cssWait$1);
waitView.attr('data-item-id');
let channel = waitView.attr('data-item-type');
let goodsUrl = encodeURIComponent(waitView.attr('data-item-url'));
let selectType = waitView.attr('select-type');
let requestUrl = GUtils.goodsUrl(channel, goodsUrl);
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
GUtils.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
let data = resp.data;
if (resp.code == 10 && data) {
let linkUrl = '';
if (data.channel === 'tbk') {
linkUrl = data['tbk'].couponUrl || '';
} else if (data.channel === 'jd') {
linkUrl = data['jd'].data || '';
} else {
linkUrl = data['pdd'].data || '';
}
if (linkUrl.length === 0) {
return
}
waitView.attr('data-item-url', linkUrl);
if (selectType === 'link-card-mcn') {
$j(waitView.find('a')).attr('href', linkUrl);
} else if (selectType === 'link-card-normal') {
$j(waitView.find('a')).attr('href', linkUrl);
}
waitView[0].addEventListener('click', event => {
GM_openInTab(linkUrl);
GUtils.clickEventUrl(`event-click-goods-zhihu-${data.channel}`);
event.stopPropagation(); //阻止事件的冒泡和捕获
event.preventDefault(); //阻止浏览器默认行为
}, true);
}
},
});
};
},
};
let regexStr$1 = [
{url: 'bilibili.com/video/', linkType: 'startWith'},
];
let cssWait = 'maga-stolen-wait';
let flagAlready = 'maga-stolen-already';
const website$1 = {
interceptor: function () {
return GUtils.interceptor(regexStr$1)
},
setRunType: function (val) {
},
init: function ($j) {
let selectConfig = [
{
selector: '#comment div > div.reply-warp > div.reply-list div.root-reply-container > div.content-warp > div.root-reply > span > span',
selectType: 'link-card-normal',
},
];
let objs = {};
setInterval(function () {
selectConfig.forEach(function (config) {
$j(config.selector).each(function () {
objs.initItem(this, config.selectType);
});
});
}, 1500);
setInterval(function () {
$j(`.${cssWait}`).each(function () {
objs.queryItem(this);
});
}, 1500);
objs.initItem = function (selector, selectType) {
let selectView = $j(selector);
if ((selectView.attr('maga-stolen-flag') || '') === flagAlready) {
return
}
let channel = '';
let goodsName = '';
if (selectType === 'link-card-normal') {
let selectLink = selectView.find('a.jump-link.normal');
if (selectLink.length > 0) {
let dataUrlStr = selectLink.attr('data-url');
let hostUrl = dataUrlStr.indexOf('?') === -1 ? dataUrlStr : dataUrlStr.split('?')[0];
if (GUtils.itemIndexOfIn(hostUrl, GUtils.getPlatformShop())) {
//属于购物网站的链接
goodsName = selectLink.text().trim() || '';
channel = GUtils.getChannel(hostUrl);
} else {
selectView.attr('maga-stolen-flag', flagAlready);
}
}
}
if (channel && channel.length > 0) {
selectView.attr('data-item-name', goodsName);
selectView.attr('data-item-type', channel);
selectView.attr('select-type', selectType);
selectView.addClass(cssWait);
selectView.attr('maga-stolen-flag', flagAlready);
}
};
objs.queryItem = function (waitClass) {
let waitView = $j(waitClass);
waitView.removeClass(cssWait);
let channel = waitView.attr('data-item-type');
let goodsName = encodeURIComponent(waitView.attr('data-item-name'));
let selectType = waitView.attr('select-type');
let requestUrl = GUtils.goodsSearch(channel, goodsName);
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
GUtils.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
let data = resp.data;
if (resp.code == 10 && data) {
let linkUrl = '';
if (data.channel === 'tbk') {
linkUrl = data['tbk'].couponUrl || '';
} else if (data.channel === 'jd') {
linkUrl = data['jd'].data || '';
} else {
linkUrl = data['pdd'].data || '';
}
if (linkUrl.length === 0) {
return
}
if (selectType === 'link-card-normal') {
$j(waitView.find('a.jump-link.normal')).attr('data-url', linkUrl);
}
waitView[0].addEventListener('click', event => {
GM_openInTab(linkUrl);
event.stopPropagation(); //阻止事件的冒泡和捕获
event.preventDefault(); //阻止浏览器默认行为
GUtils.clickEventUrl(`event-click-goods-bilibili-${data.channel}`);
}, true);
}
},
});
};
},
};
const modules$1 = [
website$4,
website$3,
website$2,
website$1,
];
const prepare$1 = {
init: function ($j, runType) {
if (GUtils.inIframe()) {
return
}
for (let i = 0; i < modules$1.length; i++) {
let module = modules$1[i];
if (module.interceptor()) {
continue
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
},
};
let regexStr = [];
let offsetX = 4; // 横坐标翻译入口图标偏移
let offsetY = -12; // 纵坐标翻译入口图标偏移
let idTranslateIcon = 'maga-translate-icon';
let idIconDict = 'maga-icon-dict';
let idIconGoogle = 'maga-icon-google';
let idTranslateContent = 'maga-translate-content';
let idTranslateContentText = 'maga-translate-content-text';
let idTranslateContentClose = 'maga-translate-content-close';
let idTranslateResult = 'maga-translate-result';
let idTranslateExample = 'maga-translate-example';
let website = {
interceptor: function () {
return GUtils.interceptor(regexStr)
},
setRunType: function (val) {
},
init: function ($j) {
$j(document).ready(function () {
let iconPannel = document.createElement('div');
// 创建翻译入口图标
iconPannel.id = `${idTranslateIcon}`;
let iconArray = [
{
name: '多词典查询',
id: idIconDict,
visibility: true,
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAANjklEQVR4Ae2dBVgjyRZG67m7u7u7u/t7yLqOC0lgDBjFdgjj7u7ubkDQcXc3nKSjxO+7N2ts0bCwkw4t9X/fqbEIU31S2t1hekhqTs6be2YV/rVnVlF2j0zr+p7Z1ms9s6xRBFTOfWRbj6yiMb2zx/0zNWPS2xCWSKjQND2yx/4MK/ECAjrgas9M668Rliio0CRPDhn/DqywKUgEAR0RxdZsOv3/EKY0VGiOnJyc12Ml2ajCdExZauq6NyBMSajQHNjHD6NK0ju9sopGIUxJqNAWw8d/GysngIABCD2bPfYnCFMKKjSFAZp+jqKzCFMKKjSDyTTtLVgpQQSMRI9hRR9HmBJQoRmoOaQKMRyZ1kfENBDBRR6T8QQgCmciTAmo0AokwCIjCtAr03ocYUpAhVagccCaRFb8sbOXoLahuQ3lx84kWoJLCFMCKjRE4gQYWjgLolGQTTgcAVPuFD0LIARYu/MQdJTFG3bpWQAhwI07NdBRzl25oVcBhACZRbOBj9fXAq0TiUTAkj9VjwIIATbsLuEOdrTN31GWbtqjRwGEALfv10HrXL9zX7ZVuHDtlt4EEAIMnzAX+Ow4VEn/RlPANi1DesE0PQkgBNi0txT4jJu3KvZv+8uPAp/lW/bqSQAhwN3aBmidQDAIfUeMj/3b5EXrgM+lG3f0IoAQYOSk+cDn3OWXp3v9R02AYCgErRONRmHQczP0IIAQYOv+MuCzdsfBVzzm9MVrwGfVtv16EEAIUFPfxH26AYZaZ73iMQvWbgc+V27e1boAQoAxUxYCn2u377V5XNqYyTLdAMCQwplCAC0LsP1gRaeb9uPnLgOfNdsPCAG0LEBdo73Tg7s5q7YAn+u37wsBtCpA7rTFwOfi9dvtPr7/qIngDwTlxwtCAO0JsKu4Cvgs29zxOv/hUxeAz7qdh4QAWhSg0S613en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vJ6aUDXTbDK9G2FdRDEBiP7Y5193h6ErCUdjdJizjlDcBBAoKABB+wE77vlpUShuodd6rFwSAqhdAP6qYVotpLuAPEjo6dQC0BVHGhBACMBD/Tzd4InOGm70R4CL7F3C6JYwVY1BmHbJS2MDZWcBRoNumJhIAeRahsHHXbGriCajGNMveyH3TCLuEyhdYFgISu0DqUIMR5m0kmEhKJd+aNBbxaYzLAwP3TbdiHcLTylt/jnDQkAY7/sCnPTVMQwLAZJU4fgMVYphmv8yx5MIY1QInielzPGUMQZ/9rUII6hojcDmWIeAbil13HusTHofwggqWiFIXQdvSLLZs7GyArob9NkcW/9d3vhxhL0IFTII/lds/yZW2nGdTPca6etvEcZDhaAd6Mukkkocv0splYYk2aTVWJlXkSgC6kaqTS6VdiEF+Pvk1Ern+xEmx/8B/uTnd+kxPtUAAAAASUVORK5CYII=',
trigger() {
GUtils.log('多词典查询');
onTranslateContentChanged($j);
},
},
{
name: '谷歌翻译',
id: idIconGoogle,
visibility: false,
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAALW0lEQVR4Ae2dBXAcxxKG9QLFoaIwMzMzM3PMzGxLZmZGMZtODkhmZgYxs85ilu5OcJeqzJsOyCVv74mW5rZf1fdCgs393+5MT89OvNr6392+9us53TgWThynnPMXhwlCOmc4x4uQ4u4fXs2ZwXFymAfwKQXefgGe4MRzmAdxggJvW4ArOdM4Lg7zMP7i3E6huxcAwmcezDgKXV6AJ5A739M4R6HjAlyNjPmeyj0UvFSAGRxmEiZT8C201PlOEwmQSMG3FqAbh5mMhyn8SwJYTCjATAr/kgBxJhQgg8K/JEA5h5mQJzkkAN7YMQULOCSAScMH8swdPgkAvMAhAUzMcg4JYGKKOP8jAczN6ySAuVlLApibcs6VJICJ2RBvO1xVW28RnE2cNZypnJ8413O82oAEAMbstTH+YXgaLs4+zrMkQBs8GWxnZdUeEDrOn5xZnKvdCEBsTfWspwBCHOdxGQGIYbs8XgDAyXmXBE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NgIdb2lb4T/BaP9laI2r4Ls4THK9OCEBrAlDrn8gQp9ZHmMbxkhGAuMkn4VG58G+HWj+2TOQ7H8K/kgRog+fmpaHDQMDhYpHH/JbHPgnQBl+syxpzefjTY6yilnoz/pvwdUAAoldoTtTDM1L+/GhVJrOcKROiscMp58RxLJxunOvb+vf8P4SrYCFqyvrgAAAAAElFTkSuQmCC',
trigger() {
GUtils.log('谷歌翻译');
onTranslateContentChanged($j);
},
},
];
iconArray.forEach(obj => {
if (obj.visibility) {
let img = document.createElement('img');
img.setAttribute('id', obj.id);
img.setAttribute('alt', obj.name);
img.setAttribute('src', obj.image);
img.addEventListener('mouseup', () => {
obj.trigger();
onTranslateIconStyleChanged($j, img.getAttribute('id'));
});
iconPannel.appendChild(img);
}
});
$j('body').append(iconPannel);
// 鼠标事件 + 选中变化事件:翻译入口图标的 显示、隐藏
document.addEventListener('mouseup', e => {
onTranslateIconChanged($j, e);
});
document.addEventListener('selectionchange', e => {
onTranslateIconChanged($j, e);
});
document.addEventListener('touchend', e => {
onTranslateIconChanged($j, e);
});
document.addEventListener('mousedown', e => {
if (checkFromSelfClick($j, e)) {
// 翻译入口图标被点击
e.preventDefault();
}
});
$j(document).keyup(function (e) {
if (e.key === 'Escape') {
onTranslateHide($j);
onTranslateContentHide($j);
}
});
/*设置点击的按钮的选中状态和非选中状态*/
function onTranslateIconStyleChanged($j, activeId) {
for (let item of $j(`div#${idTranslateIcon} > img`)) {
if (item.getAttribute('id') == activeId) {
item.setAttribute('activate', 'activate');
} else {
item.removeAttribute('activate');
}
}
}
function onTranslateContentHide($j) {
$j(`#${idTranslateContent}`).css('display', 'none');
$j(`#${idTranslateContentText}`).html('');
}
function onTranslateHide($j) {
GUtils.log('隐藏翻译入口图标');
onTranslateIconStyleChanged($j, '');
iconPannel.style.display = 'none';
}
function onTranslateVisible($j, e) {
let pageX = 0;
let pageY = 0;
if (e.pageX && e.pageY) { // 鼠标的 X、Y 坐标
pageX = e.pageX;
pageY = e.pageY;
} else if (e.changedTouches && e.changedTouches.length > 0) { // 触摸屏
// 多点触控选取第 1 个
pageX = e.changedTouches[0].pageX;
pageY = e.changedTouches[0].pageY;
// 触屏修改翻译入口图标偏移(Android、iOS 选中后的动作菜单一般在当前文字顶部,翻译入口图标则放到底部)
offsetX = -26; // 单个翻译入口图标块宽度
offsetY = 16 * 3; // 一般字体高度的 3 倍,距离系统自带动作菜单、选择光标太近会导致无法点按
}
GUtils.log(`pageX:${pageX}, pageY:${pageY}, offsetX:${offsetX}, offsetY:${offsetY}`);
if (pageX === 0 && pageY === 0) {
//鼠标选中拖动的过程中会在这里执行return
return
}
GUtils.log('显示翻译入口图标');
iconPannel.style.top = `${pageY + offsetY}px`;
iconPannel.style.left = `${pageX + offsetX}px`;
iconPannel.style.display = 'block';
}
/*控制选中或者取消选中后按钮的显示和隐藏*/
function onTranslateIconChanged($j, e) {
/*点击坐标处于翻译插件的自身控件范围内*/
if (checkFromSelfClick($j, e)) {
/*判断是否是关闭事件*/
let contentClose = $j(`#${idTranslateContentClose}`).attr('id') || '';
if (e.target.id == contentClose
|| (e.target.parentNode && e.target.parentNode.id == contentClose)) {
onTranslateContentHide($j);
} else {
if (checkContentValid() && iconPannel.style.display === 'none') {
onTranslateVisible($j, e);
}
}
return// 防止点击翻译按钮后图标移动
} else {
if (checkContentValid()) {
onTranslateVisible($j, e);
} else {
onTranslateHide($j);
}
}
}
/*控制搜索结果面板的显示和隐藏*/
function onTranslateContentChanged($j, searchType) {
if ($j(`#${idTranslateContent}`).length === 0) {
let html = `
<div id='${idTranslateContent}'>
<div class="tablayout">
<span id="${idTranslateResult}" select="true">翻译结果</span>
<span id="${idTranslateExample}" style="margin-left: 20px">短语示例</span>
<span style="flex: 1"></span>
<span id='${idTranslateContentClose}' style="cursor: pointer"> ✕ </span>
</div>
<div id='${idTranslateContentText}'></div>
</div>`;
$j('body').append(html);
$j(`#${idTranslateContentClose}`).click(function () {
onTranslateContentHide($j);
});
}
let requestUrl = GUtils.translateUrl(GUtils.getSelect());
$j(`#${idTranslateContent}`).css('display', 'flex');
GM.xmlHttpRequest({
method: 'GET',
url: requestUrl,
onload: function onload(response) {
let resp = response.response;
if (typeof resp === 'string') {
resp = JSON.parse(resp);
}
GUtils.log('requestUrl: ' + requestUrl + ' result: ' + JSON.stringify(resp));
let data = resp.data;
if (resp.code == 10 && data) {
renderTranslateContent($j, data);
}
},
});
}
/*控制搜索结果面板的显示和隐藏*/
function renderTranslateContent($j, transList) {
let translateContentText = $j(`#${idTranslateContentText}`);
let translateResult = $j(`#${idTranslateResult}`);
let translateExample = $j(`#${idTranslateExample}`);
let transHtml = '';
for (let translate of transList) {
let transTextStr = '';
for (let item of translate.transText) {
transTextStr = `${transTextStr}${item}<br/>`;
}
transHtml = transHtml + `
<div class="trans-container">
<div class="platform">
<a target="_blank" href="${translate.sourceUrl}"
style="background: ${translate.platform.color || '#1DA1F2'}">
${translate.platform.title}
</a>
</div>
<span class="trans-text">
${transTextStr}
</span>
</div>`;
}
GUtils.log('transHtml', transHtml);
translateContentText.html(transHtml);
translateResult.attr('select', 'true');
translateExample.removeAttr('select');
let sentenceHtml = '';
for (let translate of transList) {
let sentenceTextStr = '';
for (let item of translate.sentence) {
let temp = `
<div style="display: flex;flex-direction: column;">
<span class="trans-text">${item.transText}</span>
<span class="source-text">${item.sourceText}</span>
</div>
`;
if (temp && temp.length) {
sentenceTextStr += temp;
}
}
if (sentenceTextStr && sentenceTextStr.length) {
let temp = `
<div class="trans-container">
<div class="platform">
<a target="_blank" href="${translate.sourceUrl}"
style="background: ${translate.platform.color || '#1DA1F2'}">
${translate.platform.title}
</a>
</div>
<div class="sentence">${sentenceTextStr}</div>
</div>`;
if (temp && temp.length) {
sentenceHtml += temp;
}
}
}
GUtils.log('sentenceHtml', sentenceHtml);
translateResult.click(function () {
translateContentText.html(transHtml);
translateResult.attr('select', 'true');
translateExample.removeAttr('select');
});
translateExample.click(function () {
translateContentText.html(sentenceHtml);
translateExample.attr('select', 'true');
translateResult.removeAttr('select');
});
onTranslateHide($j);
}
/*点击位于自身,不响应事件*/
function checkFromSelfClick($j, e) {
if (e.target == iconPannel) {
return true
}
if (e.target.parentNode && e.target.parentNode == iconPannel) {
return true
}
if (e.target.id == idTranslateContent) {
return true
}
if (e.target.parentNode && e.target.parentNode.id == idTranslateContent) {
return true
}
return false
}
/*判断是否要显示图标:纯英文、纯中文*/
function checkContentValid() {
let selectText = GUtils.getSelect();
if (selectText.length === 0) {
return false
}
if (/^[\u4e00-\u9fa5]{1,16}$/.test(selectText)) {
return true
} else if (/^[a-zA-Z]{1,30}$/.test(selectText)) {
return true
} else {
return false
}
}
});
},
};
const modules = [website];
const prepare = {
init: function ($j, runType) {
if (GUtils.inIframe()) {
return
}
GM_addStyle(CSS_STR);
for (let i = 0; i < modules.length; i++) {
let module = modules[i];
if (module.interceptor()) {
continue
}
module.setRunType((typeof runType === 'undefined') ? 'alone' : runType);
module.init($j);
}
},
};
let CSS_STR = `
#maga-translate-icon {
display: none;
z-index: 999999;
position: absolute;
margin: 0;
padding: 0;
cursor: move;
box-sizing: content-box;
font-size: 14px;
text-align: left;
border: 0;
border-radius: 4px;
background: transparent
}
#maga-translate-icon img {
cursor: pointer !important;
display: inline-block;
width: 20px !important;
height: 20px !important;
border: 1px solid #dfe1e5 !important;
border-radius: 4px !important;
background-color: rgba(255, 255, 255, 1) !important;
padding: 2px !important;
margin: 0 !important;
margin-right: 5px !important;
box-sizing: content-box !important;
vertical-align: middle !important;
}
#maga-translate-icon img:last-of-type {
margin-right: auto !important;
}
#maga-translate-icon img:hover {
border: 1px solid #ff9900 !important;
}
#maga-translate-icon img[activate] {
border: 1px solid #ff9900 !important;
}
#maga-translate-icon img[activate]:hover {
border: 1px solid #ff9900 !important;
}
#maga-translate-content {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3);
z-index: 9999;
position: fixed;
padding: 10px 10px;
background: #FFFFFF;
border-radius: 6px;
display: flex;
flex-direction: column;
font-family: "Helvetica Neue", "Helvetica", "Microsoft Yahei", "微软雅黑", "Arial", "sans-serif";
font-size: 14px;
}
#maga-translate-content .tablayout {
height: 32px;
display: flex;
flex-wrap: nowrap;
flex-direction: row;
justify-content: flex-start;
}
#maga-translate-content .tablayout span {
cursor: pointer;
color: #666666;
font-size: 14px;
font-weight: 500;
line-height: 32px;
}
#maga-translate-content .tablayout span:hover {
color: #333333;
}
#maga-translate-content .tablayout span[select] {
color: #333333;
font-size: 16px;
font-weight: 550;
}
#maga-translate-content-close {
font-size: 14px;
color: #333333;
line-height: 22px;
text-align: center;
align-self: flex-end;
text-decoration: none !important;
}
#maga-translate-content-text {
width: 300px;
height: 400px;
overflow-y: scroll;
box-sizing: content-box;
}
#maga-translate-content-text::-webkit-scrollbar {
width: 0;
height: 0;
}
#maga-translate-content-text .trans-container {
margin-bottom: 6px;
display: flex;
flex-direction: column;
}
#maga-translate-content-text .platform {
margin-bottom: 4px;
}
#maga-translate-content-text .platform > a {
font-size: 12px;
font-weight: 500;
color: #ffffff;
padding: 4px 6px;
border-radius: 2px;
line-height: 26px;
}
#maga-translate-content-text .sentence {
margin-bottom: 4px;
font-size: 14px;
font-weight: 500;
color: #333333;
}
#maga-translate-content-text .source-text {
margin-bottom: 6px;
font-size: 14px;
font-weight: 500;
color: #333333;
}
#maga-translate-content-text .trans-text {
margin-bottom: 2px;
font-size: 15px;
font-weight: 500;
color: #444444;
}
`;
let redisStorage = new RedisStorage();
const prepares = [
prepare$9,
prepare$8,
prepare$7,
prepare$6,
prepare$5,
prepare$4,
prepare$3,
prepare$2,
prepare$1,
prepare,
];
(function () {
let jq = jQuery.noConflict();
GM_addStyle(GM_getResourceText('toastr_css'));
for (let i = 0; i < prepares.length; i++) {
let prepare = prepares[i];
prepare.init(jq, 'complex');
}
analytical();
function analytical() {
let KEY_TRACK = 'KEY_TRACK';
if (redisStorage.get(KEY_TRACK)) {
GUtils.log('IP Tracker', '已记录过!!!');
} else {
GUtils.log('IP Tracker', '没有记录过, 开始统计-----------');
GM.xmlHttpRequest({
method: 'GET',
url: GUtils.ipSearchUrl(),
onload: function onload(response) {
let expire = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - new Date().getTime();
redisStorage.set({
name: KEY_TRACK,
value: true,
expires: expire,
});
GUtils.log('IP Tracker', expire);
},
});
}
}
})();
})();