// ==UserScript==
// @name 福利吧论坛好孩子看得见
// @name:zh-CN 福利吧论坛 - 好孩子看得见
// @name:zh-TW 福利吧論壇 - 好孩子看得見
// @namespace https://greasyfork.org/zh-CN/users/193133-pana
// @homepage https://www.sailboatweb.com
// @version 8.3.1
// @description 好孩子才看得见,支持移动端
// @description:zh-CN 好孩子才看得见,论坛小助手
// @description:zh-TW 好孩子才看得見,論壇小助手
// @author pana
// @include http*://www.wnflb19.com/*
// @include http*://www.wnflb66.com/*
// @exclude http*://*/member.php?mod=register
// @require https://cdn.bootcss.com/crypto-js/3.1.9-1/core.min.js
// @require https://cdn.bootcss.com/crypto-js/3.1.9-1/enc-base64.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// @connect pan.baidu.com
// @connect keyfc.net
// @connect search.pandown.cn
// @connect www.kutv8.com
// @grant GM_info
// @grant GM_setClipboard
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const SETTING_VALUE = {
WRAP_DIV: ['settingWrapDiv', 'userStyleConBGC'],
MAIN_FIELDSET: ['mainFieldset', ''],
HEADLINE_LEGEND: ['headlineLegend', ''],
HEADLINE_LINK: ['headlineLink', '设置 ver.' + GM_info.script.version + get_Update_Time(GM_info.script.lastModified), '脚本详细信息', 'https://greasyfork.org/zh-CN/scripts/381494'],
FEEDBACK_LINK: ['feedbackLink', '反馈', '通过站内消息报告问题', 'https://www.wnflb66.com/home.php?mod=spacecp&ac=pm&op=showmsg&touid=8548'],
TAG_UL: ['tagUl', ''],
HIGHLIGHT_CHECKBOX: ['highlightCheckbox', '启用热帖高亮功能', '在帖子列表页面开启热帖高亮 (移动端只支持回复高亮)'],
AGREE_NUMBER_TEXT: ['agreeNumberText', '--> 按分享值高亮的阈值: '],
AGREE_NUMBER_INPUT: ['agreeNumberInput', '(推荐: 20)'],
AGREE_COLOR_TEXT: ['agreeColorText', '--> 按分享值高亮的颜色: '],
AGREE_COLOR_INPUT: ['agreeColorInput', '(推荐: #EE1B2E)'],
AGREE_COLOR_EG: ['agreeColorEg', '颜色示例'],
REPLY_NUMBER_TEXT: ['replyNumberText', '--> 按回复数高亮的阈值: '],
REPLY_NUMBER_INPUT: ['replyNumberInput', '(推荐: 50)'],
REPLY_COLOR_TEXT: ['replyColorText', '--> 按回复数高亮的颜色: '],
REPLY_COLOR_INPUT: ['replyColorInput', '(推荐: #2B65B7)'],
REPLY_COLOR_EG: ['replyColorEg', '颜色示例'],
COPY_CHECKBOX: ['copyCheckbox', '显示复制按钮', '在提取到的链接后显示一个复制按钮'],
TEXT_COLOR_TEXT: ['textColorText', '隐藏文字的高亮颜色: '],
TEXT_COLOR_INPUT: ['textColorInput', '(推荐: #FF33CC)'],
TEXT_COLOR_EG: ['textColorEg', '颜色示例'],
LINK_COLOR_TEXT: ['linkColorText', '提取链接的文字颜色: '],
LINK_COLOR_INPUT: ['linkColorInput', '(推荐: #369)'],
LINK_COLOR_EG: ['linkColorEg', '颜色示例'],
SAVE_BUTTON: ['saveButton', '保存', '保存设置'],
CANCEL_BUTTON: ['cancelButton', '取消', '关闭设置'],
FLOAT_CHECKBOX: ['floatCheckbox', '启用浮动模式', '将提取到的链接浮动于当前楼层的右侧 (仅支持电脑版页面)'],
EXTRACT_CHECKBOX: ['extractCheckbox', '识别文字中的链接并转换为<a>标签 (NEW!)', 'ver.8.2.0+'],
PANDOWNLOAD_CHECKBOX: ['pandownloadCheckbox', '显示跳转到 PanDownload 网页版的按钮', '在提取到的百度云链接后显示一个跳转按钮'],
QUERY_CHECKBOX: ['queryCheckbox', '开启自动查询百度网盘提取码', '自动查询百度网盘提取码并填充'],
CODE_CHECKBOX: ['codeCheckbox', '显示编码解码工具图标', '在网页的右上角显示一个工具图标 (仅支持电脑版页面)'],
BT_CHECKBOX: ['btCheckbox', '显示磁力链接搜索工具图标', '在网页的右上角显示一个工具图标 (仅支持电脑版页面)'],
CLICK_CHECKBOX: ['clickCheckbox', '自动点击张国立', '进入帖子后自动点击张国立 (仅支持电脑版页面。注: 网络不好时慎用!)'],
CHECK_CHECKBOX: ['checkCheckbox', '自动检测百度云链接是否失效', '标记失效的百度云链接'],
NIGHT_CHECKBOX: ['nightCheckbox', '显示切换夜间模式的按钮 (NEW!)', '在网页顶部显示夜间模式切换按钮 (仅支持电脑版页面。ver.7.7.0+ 夜间模式已实现与网页同步加载)'],
CHECK_IN_CHECKBOX: ['checkInCheckbox', '自动签到', '进入论坛后自动点击签到按钮'],
MAX_LINK_TEXT: ['maxLinkText', '楼层提取的链接数量的最大值: '],
MAX_LINK_INPUT: ['maxLinkInput', '(0 表示无限制)']
};
const CODE_VALUE = {
WRAP_DIV: ['toolWrapDiv', 'userStyleConBGC'],
MAIN_FIELDSET: ['toolMainFieldest', ''],
HEADLINE_LEGEND: ['toolHeadlineLegend', '编码、解码工具'],
LEFT_BAR: ['leftBar', ''],
LEFT_TITLE: ['leftTitle', '内容:'],
LEFT_TEXTAREA: ['leftTextarea', '(请输入内容)'],
OPERATE_BAR: ['operateBar', ''],
RIGHT_BAR: ['rightBar', ''],
RIGHT_TITLE: ['rightTitle', '结果:'],
RIGHT_TEXTAREA: ['rightTextarea', '(此处显示结果)'],
COPY_BUTTON: ['toolCopyButton', '复制结果', '复制右侧方框中的内容'],
CLOSE_BUTTON: ['toolCloseButton', '关闭', '关闭工具界面'],
BJX_ENCODE: ['BJXEncode', '百家姓 编码 >>> ', '使用"百家姓"进行编码'],
BJX_DECODE: ['BJXDecode', '解码 百家姓 >>> ', '对"百家姓"的编码进行解码'],
JZG_ENCODE: ['JZGEncode', '价值观 编码 >>> ', '使用"社会主义核心价值观"进行编码'],
JZG_DECODE: ['JZGDecode', '解码 价值观 >>> ', '对"社会主义核心价值观"的编码进行解码'],
YFLC_ENCODE: ['YFLCEncode', '与佛论禅 编码 >>> ', '使用"与佛论禅"进行编码'],
YFLC_DECODE: ['YFLCDecode', '解码 与佛论禅 >>> ', '对"与佛论禅"的编码进行解码'],
BASE64_ENCODE: ['BASE64Encode', 'BASE64 编码 >>> ', '使用"BASE64"进行编码'],
BASE64_DECODE: ['BASE64Decode', '解码 BASE64 >>> ', '对"BASE64"的编码进行解码'],
BAIDU_QUERY: ['BAIDUQuery', '查询提取码 >>> ', '查询百度网盘的提取码'],
STATUS_BAR: ['toolStatusBar', '等待操作中...'],
};
const BT_VALUE = {
WRAP_DIV: ['btWrapDiv', 'userStyleConBGC'],
MAIN_FIELDSET: ['btMainFieldset', ''],
HEADLINE_LEGEND: ['btHeadlineLegend', ''],
HEADLINE_LINK: ['btHeadlineLink', '磁力链接搜索工具', '源站地址', 'https://www.kutv8.com'],
TOP_BAR: ['btTopBar', ''],
SEARCH_INPUT: ['btSearchInput', '(请输入内容)'],
SEARCH_BUTTON: ['btSearchButton', '搜索', '搜索磁力链接'],
MIDDLE_BAR: ['btMiddleBar', ''],
TABLE_HEADER_DIV: ['btTableHeaderDiv', ''],
TABLE_HEADER: ['btTableHeader', ''],
TH: ['btTh_', ''],
TABLE_BODY_DIV: ['btTableBodyDiv', ''],
TABLE_BODY: ['btTableBody', ''],
TBODY: ['btTbody', ''],
BOTTOM_BAR: ['btBottomBar', ''],
STATUS_BAR: ['btStatusBar', '等待操作中...', '搜索中,请等候...', '搜索完成!'],
CLOSE_BUTTON: ['btCloseButton', '关闭', '关闭工具界面'],
PAGE_TEXT: ['btPageText', '当前页数: '],
PREV_PAGE_BUTTON: ['btPrevPageButton', '上一页'],
NEXT_PAGE_BUTTON: ['btNextPageButton', '下一页'],
API_ARRAR: ['https://www.kutv8.com/api/search?source=+Btdad&keyword=$1$&page=$2$&sort=default', 20]
};
const CODE_ICON = {
CLASS_NAME: 'codeTool userStyleIcon',
TITLE: '编码、解码工具',
GRAY: 'url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIC0xMTggNTEyLjAwMDUgNTEyIiB3aWR0aD0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IDwvc3ZnPg==)'
};
const COLLAPSED_IMG = {
YES: 'static/image/common/collapsed_yes.gif',
NO: 'static/image/common/collapsed_no.gif'
};
const URL_REG = /^[\S\s]*?((?:magnet:\?xt=urn:btih:(?:[a-z0-9]{40}|[a-z0-9]{32})&?|ftp:\/\/|ed2k:\/\/|thunder:\/\/|flashget:\/\/|qqdl:\/\/|xfplay:\/\/|https?:\/\/[\w零一二三四五六七八九壹贰叁肆伍陆柒捌玖-]*\.?[\w零一二三四五六七八九壹贰叁肆伍陆柒捌玖-]+\.+\w+)\S+)/i;
const DOWNLOAD_REG = /^[\S\s]*?((?:magnet:\?xt=urn:btih:(?:[a-z0-9]{40}|[a-z0-9]{32})&?|ed2k:\/\/|thunder:\/\/)\S+)/i;
const WWW_REG = /^[\S\s]*?(www\.[\w-]+\.[a-z]+[\w#=%+?/-]*)/i;
const BAIDUPAN_REG = /^https?:\/\/pan\.baidu\.com\/s(?:hare)?\/[\w=?&-]+$/i;
const BAIDUPAN_INCLUDE_CODE_REG = /^https?:\/\/pan\.baidu\.com\/s(?:hare)?\/[\w=?#&-]+$/i;
const CODE_REG = /(?:提取)+[^a-z0-9解压]*([a-z0-9]{4})[^a-z0-9]*/i;
const BAIDUPAN_CODE_REG = /^(?:(?:下载)?链接\S+\s+)?(?:[^解压]+\s+)?[^a-z0-9解压]*([a-z0-9]{4})[^a-z0-9]*(?:app)?[^a-z0-9]*$/i;
const SINGLE_CHAR_CODE_REG = /^[a-z0-9]$/i;
const MISSING_HEADER_BAIDUPAN_REG = /^[\S\s]*?[^/\w-]?(\/?s(?:hare)?\/[\w=?-]{10,50})/i;
const MISSING_HEADER_BAIDUPAN_TEST_REG = /^([\w=?-]{15,50})\s+[a-z0-9]{4}$/i;
const PAN_REG = /^[\S\s]*?(pan\.baidu\.com\/s(?:hare)?\/[\w=?&-]+)/i;
const HASH_REG = /(?:[^a-z0-9]|^)([a-z0-9]{40}|[a-z0-9]{32})(?:&dn=.*|[^a-z0-9]|$)/i;
const MD5_REG = /(?:md5[^a-z0-9]+|sha1[^a-z0-9]+)/i;
const CORE_VALUES_REG = /^.*?((?:富强|民主|文明|和谐|自由|平等|公正|法治|爱国|敬业|诚信|友善){10,}).*?$/i;
const BAIJIA_REG = /^.*?([赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻福水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳唐罗薛伍余米贝姚孟顾尹江钟]{10,}).*?$/i;
const FOYU_REG = /^.*?((?:佛曰:|如是我闻:)\S{10,}).*?$/i;
const PREFIX_LINK_REG = {
MAGNET: /^https?:\/\/www\.wnflb\d*\.com\/magnet:\?xt=.*$/i,
MAGNET_SWITCH: /^https?:\/\/www\.wnflb\d*\.com\//i,
};
const PREFIX_CODE_REG = {
CODE: /^https?:\/\/www\.wnflb\d*\.com\/\w+-\w+$/i,
CODE_SWITCH: /^https?:\/\/www\.wnflb\d*\.com\//i,
};
const BASE_IMAGE_REG = /^https?:\/\/(data:)/i;
const FILTER_LINK_REG = {
PAN_TEXT: /^https?:\/\/pan\.baidu\.com\/(?:s|share|mbox)?\/[\w#?%=/&-]*[^\w#?%=/&-]+/i,
POJIE: /^https?:\/\/www\.52pojie\.cn\/?#?$/i,
POJIE_PHP: /^https?:\/\/www\.52pojie\.cn\/(?:forum|home|misc)\.php\?/i,
POJIE_HTML: /^https?:\/\/www\.52pojie\.cn\/(?:forum|thread)-\d+-\d+(?:-\d+)?\.html$/i,
FULIBA: /^https?:\/\/www\.wnflb\d*\.com\/?$/i,
FULIBA_PHP: /^https?:\/\/www\.wnflb\d*\.com\/(?:home|forum)\.php\?/i,
FULIBA_HTML: /^https?:\/\/www\.wnflb\d*\.com\/(?:thread|forum)-\d+-\d+(?:-\d+)?\.html$/i,
IMDB: /^https?:\/\/www\.imdb\.com\/title\//i,
DOUBAN: /^https?:\/\/movie\.douban\.com\/(?:subject|celebrity)/i,
PHOTO_WEIBO: /^https?:\/\/photo\.weibo\.com\//i,
S_WEIBO: /^https?:\/\/s\.weibo\.com\/weibo\?q=/i,
BAIKE: /^https?:\/\/baike\.(?:so|baidu|sogou)\.com/i,
BILIBILI_APP: /^https?:\/\/app\.bilibili\.com/i,
ZHIYOO: /^https?:\/\/bbs\.zhiyoo\.com\/(?:forum|gforum)-\d+-\d+\.html/i,
TAG_3DM: /^https?:\/\/www\.3dmgame\.com\/tag\//i,
GAMES_3DM: /^https?:\/\/www\.3dmgame\.com\/games\/[^/]*\/?$/i,
TV432: /^https?:\/\/www\.tv432\.com\/search\.php\?searchword=/i,
VIIDII: /^https?:\/\/www\.viidii\.info\/\?/i,
DAYBOX: /^https?:\/\/www\.daybox\.net\/image\//i,
YIDIANZIXUN: /^https?:\/\/www\.yidianzixun\.com\/channel\//i,
SINA: /^https?:\/\/[\w-]*\.?sina\.com\.cn\/?/i,
};
const CORE_VALUES = '富强民主文明和谐自由平等公正法治爱国敬业诚信友善';
const BAIJIA_VALUES = {
"赵": "0",
"钱": "1",
"孙": "2",
"李": "3",
"周": "4",
"吴": "5",
"郑": "6",
"王": "7",
"冯": "8",
"陈": "9",
"褚": "a",
"卫": "b",
"蒋": "c",
"沈": "d",
"韩": "e",
"杨": "f",
"朱": "g",
"秦": "h",
"尤": "i",
"许": "j",
"何": "k",
"吕": "l",
"施": "m",
"张": "n",
"孔": "o",
"曹": "p",
"严": "q",
"华": "r",
"金": "s",
"魏": "t",
"陶": "u",
"姜": "v",
"戚": "w",
"谢": "x",
"邹": "y",
"喻": "z",
"福": "A",
"水": "B",
"窦": "C",
"章": "D",
"云": "E",
"苏": "F",
"潘": "G",
"葛": "H",
"奚": "I",
"范": "J",
"彭": "K",
"郎": "L",
"鲁": "M",
"韦": "N",
"昌": "O",
"马": "P",
"苗": "Q",
"凤": "R",
"花": "S",
"方": "T",
"俞": "U",
"任": "V",
"袁": "W",
"柳": "X",
"唐": "Y",
"罗": "Z",
"薛": ".",
"伍": "-",
"余": "_",
"米": "+",
"贝": "=",
"姚": "/",
"孟": "?",
"顾": "#",
"尹": "%",
"江": "&",
"钟": "*"
};
const CON_STYLE = '.userStyleIcon { background-color: #f4f4f4 !important; } .userStyleConBGC { background-color: #fff !important; }';
const NIGHT_STYLE = "html, body, .bm, .bdl, .bdl dt, .bdl dd.bdl_a a, .tb .a a, .pn, .fl .bm_h, .ct2_a, .ct3_a { background: #282A36 !important; } .bdl dl.a, .tl .th, .tl .ts th, .tl .ts td, .pg a, .pg strong, .pgb a, .pg label, .bml .bm_h, #scrolltop a, .bmn, .bm_h, td.pls, .ad td.plc, div.exfm, .tb a, .tb_h, .ttp li.a a, div.uo a, input#addsubmit_btn, #gh .bm .bm_h, .jump_bdl li, .newthread tr th, .newthread tr td, .tl .threadpre td, .tl .threadpre:hover td, .nfl .f_c { background-color: #282A36 !important; } .userStyleIcon, .userStyleConBGC { background-color: #282A36 !important; } #nv, .card_gender_0, .card .o a, .tbn li.a, #p_btn a, #p_btn i { background: #40444D !important;} #toptb, .tedt .bar, .edt .bar, .edt .bbar, #post_extra_tb label.a, #extcreditmenu.a, #g_upmine.a, .tl #forumnewshow, .jump_bdl .a a, .jump_bdl .a a:hover, .psth, .pl .quote, .pm_tac, .pm .c, .pml .hover, #uhd, #flw_header .bar, .ttp a, .ttp strong, .bmw .bm_h, .GzList ul li a, .m_c, .m_c .o, .dt th { background-color: #40444D !important; } #nv li a:hover, #nv li.hover a, #nv li.hover a:hover { background: #1A1A1A !important; } .p_pop, .p_pof, .sllt, .tl #forumnewshow a:hover, #autopbn:hover, .pgbtn a:hover { background-color: #1A1A1A !important; } #threadlist > div > table > tbody > tr:hover > *, #threadlist > div > form > table > tbody > tr:not(.threadpre):hover > *, div.tl > form > table > tbody > tr:hover > * { background-color: #1A1A1A !important; } .p_pop a:hover { background: #3D3D3D !important; } a, #um, #um a, body, input, button, select, textarea, .xi2, .xi2 a, .pg a, .pg strong, .pgb a, .pg label, .jump_bdl a, div#forum_rules_37 font { color: #C0C0C0 !important; } .tps a, .chart em { color: #666 !important; } .GzList ul li a { color: #000 !important !important; } .tedt .pt, .px, .pt, .ps, select, input { background-color: #38383D !important; } .userStyleTextarea { background-color: #38383D !important; }";
var highlight_config = {
highlight_enable: true,
agree_threshold: 20,
agree_color: '#EE1B2E',
reply_threshold: 50,
reply_color: '#2B65B7',
copy_enable: true,
text_color: '#FF33CC',
link_color: '#369',
float_enable: false,
extract_new_enable: true,
pandownload_enable: false,
query_enable: false,
code_enable: false,
bt_enable: false,
click_enable: false,
check_enable: false,
night_btn_enable: false,
auto_check_in_enable: true,
max_link_number: 5
};
var check_date = '2000-1-1';
var switch_config = {};
var night_enable = false;
var bt_page_num = 0;
var time_start = 0;
function rand_Bin() {
return Math.random() >= 0.5
}
function str_2_Utf8(str) {
let not_encoded = /[A-Za-z0-9\-_.!~*'()]/g;
let str1 = str.replace(not_encoded, c => c.codePointAt(0).toString(16));
let str2 = encodeURIComponent(str1);
let concated = str2.replace(/%/g, '').toUpperCase();
return concated
}
function hex_2_Duo(hexs) {
let duo = [];
for (let c of hexs) {
let n = Number.parseInt(c, 16);
if (n < 10) {
duo.push(n)
} else {
if (rand_Bin()) {
duo.push(10);
duo.push(n - 10)
} else {
duo.push(11);
duo.push(n - 6)
}
}
}
return duo
}
function utf8_2_Str(utfs) {
let l = utfs.length;
let splited = [];
for (let i = 0; i < l; i++) {
if ((i & 1) === 0) {
splited.push('%')
}
splited.push(utfs[i])
}
return decodeURIComponent(splited.join(''))
}
function duo_2_Hex(duo) {
let hex = [];
let l = duo.length;
let i = 0;
while (i < l) {
if (duo[i] < 10) {
hex.push(duo[i])
} else {
if (duo[i] === 10) {
i++;
hex.push(duo[i] + 10)
} else {
i++;
hex.push(duo[i] + 6)
}
}
i++
}
return hex.map(v => v.toString(16).toUpperCase()).join('')
}
function duo_2_Values(duo) {
return duo.map(d => CORE_VALUES[2 * d] + CORE_VALUES[2 * d + 1]).join('')
}
function values_Encode(str) {
return duo_2_Values(hex_2_Duo(str_2_Utf8(str)))
}
function values_Decode(encoded) {
let duo = [];
for (let c of encoded) {
let i = CORE_VALUES.indexOf(c);
if (i === -1) {
continue
} else if (i & 1) {
continue
} else {
duo.push(i >> 1)
}
}
let hexs = duo_2_Hex(duo);
let str;
try {
str = utf8_2_Str(hexs)
} catch (e) {
throw e;
}
return str
}
function get_Cut_Link_Text(link_text, float_enable = false) {
if (check_Mobile_Page()) {
return (link_text.length >= 35) ? (link_text.slice(0, 15) + ' ... ' + link_text.slice(-10)) : (link_text)
} else if (float_enable) {
return (link_text.length >= 50) ? (link_text.slice(0, 25) + ' ... ' + link_text.slice(-15)) : (link_text)
}
return (link_text.length >= 80) ? (link_text.slice(0, 45) + ' ... ' + link_text.slice(-25)) : (link_text)
}
function create_Button(value_array, style_string, wrap_id, callback) {
let user_btn = document.createElement('button');
user_btn.className = 'pn pnc';
user_btn.type = 'button';
user_btn.id = value_array[0];
user_btn.innerText = value_array[1];
user_btn.title = value_array[2];
user_btn.setAttribute('style', style_string);
if (wrap_id) {
user_btn.addEventListener('click', function(e) {
document.getElementById(wrap_id).style.display = 'none';
e.stopPropagation()
})
} else {
user_btn.addEventListener('click', callback)
}
return user_btn
}
function create_Link(link_href, list_style, float_enable = false) {
let link_li = document.createElement('li');
if (list_style) {
link_li.style.listStyleType = 'disc'
} else {
link_li.style.listStyleType = 'circle'
}
let link_a = document.createElement('a');
link_a.title = '点击访问';
link_href = manage_Prefix_Code(link_href);
link_a.href = encodeURI(link_href);
link_a.target = '_blank';
link_a.innerText = get_Cut_Link_Text(link_href, float_enable);
link_a.style.display = 'inline';
link_a.style.fontSize = '15px';
link_a.style.color = highlight_config.link_color;
link_a.style.whiteSpace = 'nowrap';
link_li.appendChild(link_a);
if (highlight_config.copy_enable) {
let copy_a = document.createElement('a');
copy_a.className = 'copy_btn';
copy_a.title = '复制链接';
copy_a.href = 'javascript:;';
copy_a.target = '_self';
copy_a.innerText = '复制';
copy_a.style.display = 'inline-block';
copy_a.style.fontSize = '15px';
copy_a.style.color = highlight_config.link_color;
copy_a.style.marginLeft = '20px';
copy_a.style.textDecoration = 'underline';
copy_a.addEventListener('click', function() {
GM_setClipboard(link_href, "text");
this.style.color = '#f60';
this.title = '复制成功'
});
link_li.appendChild(copy_a);
if (BAIDUPAN_INCLUDE_CODE_REG.test(link_href) && (/#[a-z0-9]{4}$/i.test(link_href))) {
let code_value = /#([a-z0-9]{4})$/i.exec(link_href)[1];
let code_copy_a = document.createElement('a');
code_copy_a.className = 'code_copy_btn';
code_copy_a.title = '复制提取码';
code_copy_a.href = 'javascript:;';
code_copy_a.target = '_self';
code_copy_a.innerText = '复制提取码';
code_copy_a.style.display = 'inline-block';
code_copy_a.style.fontSize = '15px';
code_copy_a.style.color = highlight_config.link_color;
code_copy_a.style.marginLeft = '20px';
code_copy_a.style.textDecoration = 'underline';
code_copy_a.addEventListener('click', function() {
GM_setClipboard(code_value, "text");
this.style.color = '#f60';
this.title = '复制成功'
});
link_li.appendChild(code_copy_a)
}
}
if (highlight_config.pandownload_enable) {
if (BAIDUPAN_INCLUDE_CODE_REG.test(link_href)) {
let jump_a = document.createElement('a');
jump_a.className = 'jump_btn';
jump_a.title = '跳转到PanDownload网页版';
jump_a.href = link_href.replace('pan.baidu.com', 'pan.baiduwp.com');
jump_a.target = '_blank';
jump_a.innerText = '跳转';
jump_a.style.display = 'inline-block';
jump_a.style.fontSize = '15px';
jump_a.style.color = highlight_config.link_color;
jump_a.style.marginLeft = '20px';
jump_a.style.textDecoration = 'underline';
link_li.appendChild(jump_a)
}
}
if (highlight_config.query_enable) {
query_Baidupan(link_a.href, link_a)
}
if (highlight_config.check_enable) {
if (BAIDUPAN_INCLUDE_CODE_REG.test(link_href)) {
check_Baidupan(link_href, link_a)
}
}
return link_li
}
function query_Baidupan(link_value, link_dom) {
if (BAIDUPAN_REG.test(link_value, link_dom)) {
let temp_time = 0;
let time_now = new Date().getTime();
if (time_now - time_start < 2000) {
temp_time = time_start - time_now + 2000;
time_start += 2000
} else {
time_start = time_now
}
setTimeout(function() {
let details = {
'method': 'GET',
'url': 'https://search.pandown.cn/api/query?surl=' + link_value.split('/').pop(),
'responseType': 'json',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'onload': function(res) {
try {
if ((res.response.code === 0) && (res.response.data[0].password)) {
link_dom.href = link_value + '#' + res.response.data[0].password;
link_dom.innerText = link_dom.innerText + '#' + res.response.data[0].password
} else {
console.log(res.response.message)
}
} catch (e) {
console.log(e)
}
},
'onerror': function() {
console.log('网络连接出问题啦。')
}
};
GM_xmlhttpRequest(details)
}, temp_time)
}
}
function check_Baidupan(link_value, link_dom) {
let pan_details = {
method: 'GET',
url: link_value,
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(res) {
if ((res.responseText.indexOf('此链接分享内容可能因为涉及侵权') !== -1) || (res.responseText.indexOf('你所访问的页面不存在了') !== -1) || (res.responseText.indexOf('分享的文件已经被取消了') !== -1)) {
link_dom.style.textDecoration = 'line-through';
link_dom.style.color = '#999999';
link_dom.title = '链接失效!'
} else {
link_dom.title = '链接可以访问。'
}
},
onerror: function() {
console.log('"' + link_value + '" is error.')
}
};
GM_xmlhttpRequest(pan_details)
}
function manage_Prefix(input_link_array) {
let return_link_array = [];
input_link_array.forEach(function(item) {
return_link_array.push(PREFIX_LINK_REG.MAGNET.test(item) ? item.replace(PREFIX_LINK_REG.MAGNET_SWITCH, '') : item)
});
return return_link_array
}
function manage_Prefix_Code(input_link) {
return (PREFIX_CODE_REG.CODE.test(input_link) ? input_link.replace(PREFIX_CODE_REG.CODE_SWITCH, '') : input_link)
}
function manage_Text(text_array) {
let temp_array = [];
text_array.forEach(function(item) {
let temp_link = '';
if (PAN_REG.test(item)) {
temp_link = 'https://' + PAN_REG.exec(item)[1]
} else if (URL_REG.test(item)) {
temp_link = URL_REG.exec(item)[1]
} else if (WWW_REG.test(item)) {
temp_link = 'http://' + WWW_REG.exec(item)[1]
} else if (MISSING_HEADER_BAIDUPAN_REG.test(item)) {
let link_miss_value = MISSING_HEADER_BAIDUPAN_REG.exec(item)[1];
temp_link = (/^\//i.test(link_miss_value)) ? ('https://pan.baidu.com' + link_miss_value) : ('https://pan.baidu.com/' + link_miss_value)
} else if (MISSING_HEADER_BAIDUPAN_TEST_REG.test(item)) {
temp_link = 'https://pan.baidu.com/s/' + MISSING_HEADER_BAIDUPAN_TEST_REG.exec(item)[1]
} else if ((!MD5_REG.test(item)) && HASH_REG.test(item)) {
temp_link = 'magnet:?xt=urn:btih:' + HASH_REG.exec(item)[1]
} else if (item.length > 32) {
temp_link = pick_Up_Magnet(item)
}
if (filter_Link(temp_link)) {
temp_array.push(temp_link)
}
});
return manage_Prefix(temp_array)
}
function pick_Up_Magnet(item) {
let temp_link = '';
let item_1 = item.replace(/[^a-z0-9:=?/.&%|-]/gi, '');
if (DOWNLOAD_REG.test(item_1)) {
temp_link = DOWNLOAD_REG.exec(item_1)[1]
} else {
let item_2 = item.replace(/[^a-z0-9:=?/.,,。|\s-]/gi, '');
if ((!MD5_REG.test(item_2)) && HASH_REG.test(item_2) && (!(URL_REG.test(item_2)))) {
let temp_hash = HASH_REG.exec(item_2)[1];
if (!(/^(?:[a-z]+|[0-9]+)$/i.test(temp_hash))) {
temp_link = 'magnet:?xt=urn:btih:' + temp_hash
}
}
}
return temp_link
}
function decode_Link(input_link_array) {
input_link_array.forEach(function(item, index) {
if (URL_REG.test(item)) {
input_link_array[index] = decodeURI(item)
}
});
return input_link_array
}
function foyu_Promise(encoded) {
return new Promise(function(resolve, _reject) {
let details = {
'method': 'POST',
'url': 'http://keyfc.net/bbs/tools/tudou.aspx',
'data': 'orignalMsg=' + encoded.replace(/\s/g, '') + '&action=Decode',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'onload': function(res) {
resolve(res.responseText.replace(/^<BUDDHIST><Message><!\[CDATA\[|\]\]><\/Message><\/BUDDHIST>$/g, ''))
},
'onerror': function() {
console.log('Decode is error.');
resolve('')
}
};
GM_xmlhttpRequest(details)
})
}
async function foyu_Decode(container, encoded, float_enable) {
await foyu_Promise(encoded).then(function(data) {
if (data) {
let good_boy_ul = container.getElementsByClassName('goodBoyUi')[0];
if (good_boy_ul) {
insert_Link_Item(good_boy_ul, [data], float_enable, good_boy_ul.getElementsByTagName('li').length)
} else {
if (float_enable) {
let good_boy_div = create_Good_Boy_Div();
let good_boy_p = create_Good_Boy_P(float_enable);
good_boy_ul = document.createElement('ul');
good_boy_ul.className = 'goodBoyUi';
good_boy_ul.appendChild(good_boy_p);
good_boy_div.appendChild(good_boy_ul);
insert_Link_Item(good_boy_ul, [data], float_enable);
container.appendChild(good_boy_div)
} else {
good_boy_ul = document.createElement('ul');
good_boy_ul.className = 'goodBoyUi';
let good_boy_p = create_Good_Boy_P();
good_boy_ul.appendChild(good_boy_p);
insert_Link_Item(good_boy_ul, [data], float_enable);
container.appendChild(good_boy_ul)
}
}
}
})
}
function baijia_Encode(str) {
str = str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
let v = str.replace(/magnet:\?xt=urn:btih:/, "");
let strc = v.split("");
let a = '';
for (let i = 0; i < strc.length; i++) {
for (let key in BAIJIA_VALUES) {
if (BAIJIA_VALUES[key] === strc[i]) {
a += key;
break
}
}
}
return a
}
function baijia_Decode(encoded) {
let char_array = encoded.split("");
let str = '';
for (let i = 0; i < char_array.length; i++) {
if (BAIJIA_VALUES[char_array[i]]) {
str += BAIJIA_VALUES[char_array[i]]
}
}
if (/^https?\/\/[\w-]*\.*[\w-]+\.+\w+/i.test(str)) {
return str.replace('https//', 'https://').replace('http//', 'http://')
} else {
return 'magnet:?xt=urn:btih:' + str
}
}
function decode_Core_Values(container, text_array, float_enable) {
let decode_array = [];
text_array.forEach(function(item) {
if (CORE_VALUES_REG.test(item)) {
decode_array.push(values_Decode(CORE_VALUES_REG.exec(item)[1]))
} else if (BAIJIA_REG.test(item)) {
decode_array.push(baijia_Decode(BAIJIA_REG.exec(item)[1]))
} else if (FOYU_REG.test(item)) {
foyu_Decode(container, FOYU_REG.exec(item)[1], float_enable)
}
});
return decode_array
}
function pick_Up_Baidupan_Code(text_array) {
let code_array = [];
let char_array = [];
for (let i = 0; i < text_array.length; i++) {
let temp_value = '';
if (CODE_REG.test(text_array[i])) {
temp_value = CODE_REG.exec(text_array[i])[1]
} else if (BAIDUPAN_CODE_REG.test(text_array[i])) {
temp_value = BAIDUPAN_CODE_REG.exec(text_array[i])[1]
} else if (SINGLE_CHAR_CODE_REG.test(text_array[i])) {
char_array.push(text_array[i])
}
if (temp_value && (!(/\d{4}/i.test(temp_value))) && (code_array.indexOf(temp_value) === -1)) {
code_array.push(temp_value)
}
}
while ((char_array.length > 0) && (char_array.length % 4 === 0)) {
let temp_code = char_array.splice(0, 4);
let char_value = temp_code.join("");
if ((!(/\d{4}/i.test(char_value))) && (code_array.indexOf(char_value) === -1)) {
code_array.push(char_value)
}
}
return code_array
}
function judge_Links(links_array, link_value) {
let status = true;
for (let i = 0; i < links_array.length; i++) {
if (get_Pure_Link(links_array[i], true).includes(get_Pure_Link(link_value, true))) {
status = false;
break
}
}
return status
}
function baidupan_Auto_Event(container, link_obj_array, baidu_obj_array, links_array, hide_text_array, show_text_array, node_text_array, float_enable = false) {
let link_array = [];
let link_text_array = [];
link_obj_array.forEach(function(item) {
link_array.push(item.ele_value);
link_text_array.push(item.ele_container)
});
let concat_text_array = manage_Repeat_Array(decode_Link(hide_text_array));
let concat_link_array = manage_Repeat_Array(decode_Link(manage_Text(link_array.concat(concat_text_array))));
let general_text_array = show_text_array.concat(node_text_array.concat(link_text_array));
let index_a = [];
let code_b = pick_Up_Baidupan_Code(concat_text_array);
let code_c = [];
if (code_b.length > 0) {
for (let j = 0; j < concat_link_array.length; j++) {
if (BAIDUPAN_REG.test(concat_link_array[j])) {
index_a.push(j)
}
}
if (code_b.length === index_a.length) {
for (let k = 0; k < index_a.length; k++) {
concat_link_array[index_a[k]] += ('#' + code_b[k])
}
} else if (code_b.length === baidu_obj_array.length) {
for (let l = 0; l < baidu_obj_array.length; l++) {
baidu_obj_array[l].ele.innerText = baidu_obj_array[l].ele_container + '#' + code_b[l];
baidu_obj_array[l].ele.href = baidu_obj_array[l].ele_value + '#' + code_b[l]
}
}
} else {
code_c = pick_Up_Baidupan_Code(general_text_array);
if (code_c.length > 0) {
for (let j = 0; j < concat_link_array.length; j++) {
if (BAIDUPAN_REG.test(concat_link_array[j])) {
index_a.push(j)
}
}
if (code_c.length === index_a.length) {
for (let k = 0; k < index_a.length; k++) {
concat_link_array[index_a[k]] += ('#' + code_c[k])
}
} else if (code_c.length === baidu_obj_array.length) {
for (let l = 0; l < baidu_obj_array.length; l++) {
baidu_obj_array[l].ele.innerText = baidu_obj_array[l].ele_container + '#' + code_c[l];
baidu_obj_array[l].ele.href = baidu_obj_array[l].ele_value + '#' + code_c[l]
}
}
}
}
let hash_array = [];
general_text_array.forEach(function(item) {
if (!URL_REG.test(item)) {
if ((!MD5_REG.test(item)) && (HASH_REG.test(item))) {
hash_array.push('magnet:?xt=urn:btih:' + HASH_REG.exec(item)[1])
} else if (item.length > 32) {
let temp_link = pick_Up_Magnet(item);
if (temp_link) {
hash_array.push(temp_link)
}
}
}
});
hash_array = decode_Link(hash_array);
concat_link_array = manage_Repeat_Array(concat_link_array.concat(hash_array));
if (highlight_config.check_enable) {
for (let pan_index = 0; pan_index < baidu_obj_array.length; pan_index++) {
check_Baidupan(baidu_obj_array[pan_index].ele_value, baidu_obj_array[pan_index].ele)
}
}
if (highlight_config.query_enable) {
for (let query_index = 0; query_index < baidu_obj_array.length; query_index++) {
query_Baidupan(baidu_obj_array[query_index].ele.href, baidu_obj_array[query_index].ele)
}
}
let hide_code_text_array = decode_Core_Values(container, hide_text_array.concat(general_text_array), float_enable);
if (hide_code_text_array.length > 0) {
concat_link_array = manage_Repeat_Array(concat_link_array.concat(hide_code_text_array))
}
return concat_link_array
}
function create_Good_Boy_Div() {
let good_boy_div = document.createElement('div');
good_boy_div.className = 'goodBoyDiv';
good_boy_div.style.position = 'absolute';
good_boy_div.style.width = '430px';
good_boy_div.style.paddingLeft = '20px';
good_boy_div.style.paddingRight = '10px';
good_boy_div.style.marginLeft = '962px';
good_boy_div.style.marginTop = '-170px';
good_boy_div.style.border = '2px #CDCDCD solid';
good_boy_div.style.borderRadius = '8px';
return good_boy_div
}
function create_Good_Boy_P(float_enable = false) {
let good_boy_p = document.createElement('p');
good_boy_p.style.color = 'red';
good_boy_p.style.fontSize = '15px';
if (float_enable) {
good_boy_p.style.marginLeft = '0px'
}
return good_boy_p
}
function convert_Chinese_Number(text_string) {
return text_string.replace(/[零一二三四五六七八九壹贰叁肆伍陆柒捌玖]/gi, (arg0) => {
let index = '零一二三四五六七八九'.indexOf(arg0);
if (index === -1) {
index = '壹贰叁肆伍陆柒捌玖'.indexOf(arg0) + 1
}
return index
})
}
function insert_Link_Item(ul_tag, link_array, float_enable = false, link_count = 0) {
let total_count = link_count + link_array.length;
if (link_count < highlight_config.max_link_number) {
for (let i = 0; i < link_array.length; i++) {
ul_tag.appendChild(create_Link(convert_Chinese_Number(link_array[i]), true, float_enable));
link_count++;
if (link_count == highlight_config.max_link_number) {
break
}
}
}
ul_tag.getElementsByTagName('p')[0].innerText = ((total_count <= highlight_config.max_link_number) ? '[共提取到 ' + total_count + ' 个链接]:' : '[共提取到 ' + total_count + ' 个链接,仅显示前 ' + highlight_config.max_link_number + ' 个]:')
}
function create_Good_Boy_Button(container, link_obj, text_obj, node_text_array, float_enable = false) {
let back_link_array = baidupan_Auto_Event(container, link_obj.link_obj_array, link_obj.baidu_obj_array, link_obj.links_array, text_obj.hide_text_array, text_obj.show_text_array, node_text_array, float_enable);
if (back_link_array.length > 0) {
let good_boy_ul = container.getElementsByClassName('goodBoyUi')[0];
if (good_boy_ul) {
insert_Link_Item(good_boy_ul, back_link_array, float_enable, good_boy_ul.getElementsByTagName('li').length)
} else {
if (float_enable) {
let good_boy_div = create_Good_Boy_Div();
good_boy_ul = document.createElement('ul');
good_boy_ul.className = 'goodBoyUi';
good_boy_ul.appendChild(create_Good_Boy_P(float_enable));
good_boy_div.appendChild(good_boy_ul);
insert_Link_Item(good_boy_ul, back_link_array, float_enable);
container.appendChild(good_boy_div)
} else {
good_boy_ul = document.createElement('ul');
good_boy_ul.className = 'goodBoyUi';
good_boy_ul.appendChild(create_Good_Boy_P());
insert_Link_Item(good_boy_ul, back_link_array, float_enable);
container.appendChild(good_boy_ul)
}
}
}
}
function filter_Link(input_link) {
let status = true;
if (input_link) {
for (let i in FILTER_LINK_REG) {
if (FILTER_LINK_REG[i].test(input_link)) {
status = false;
break
}
}
} else {
status = false
}
return status
}
function manage_Repeat_Array(input_link_array) {
let output_link_array = [];
for (let i = 0, l = input_link_array.length; i < l; i++) {
for (let j = i + 1; j < l; j++) {
if (get_Pure_Link(input_link_array[i]) === get_Pure_Link(input_link_array[j])) {
++i;
j = i
}
}
output_link_array.push(input_link_array[i])
}
return output_link_array
}
function get_Pure_Link(input_link, depth_boolean) {
let output_link = input_link;
if (depth_boolean) {
if (BAIDUPAN_INCLUDE_CODE_REG.test(output_link)) {
if (/#[a-z0-9]{4}$/i.test(output_link)) {
output_link = output_link.replace(/#[a-z0-9]{4}$/i, '')
}
} else if (/^https?:\/\/www\.bilibili\.com\/video\/av\d+\?from=search/i.test(output_link)) {
output_link = output_link.replace(/\?from=search.*/, '')
}
}
return output_link.replace(/(^(?:\s+)?(?:\[url\])?(?:\s+)?(?:https?:\/\/)?|(?:\/+)?(?:\s+)?(?:\[\/url\])?$|%C2%A0$)/gi, '').replace(/%C2%A0/gi, '%20')
}
function contrast_Text_And_Link(text_value, link_value) {
let status = true;
text_value = get_Pure_Link(text_value, true);
link_value = get_Pure_Link(link_value, true);
if (/\s...\s/i.test(text_value)) {
status = false
} else if (text_value === link_value) {
status = false
}
return status
}
function find_Link(container) {
let link_a = container.getElementsByTagName('a');
let temp_obj = {
link_obj_array: [],
baidu_obj_array: [],
links_array: [],
};
let temp_baidu_array = [];
for (let i = 0; i < link_a.length; i++) {
if (link_a[i].closest('div.aimg_tip')) {
continue
}
let temp_link = link_a[i].href;
if ((link_a[i].querySelectorAll('img.zoom').length === 1) && (!BAIDUPAN_REG.test(temp_link))) {
let zoom_img = link_a[i].querySelector('img.zoom');
if (!/^data:/i.test(zoom_img.src)) {
continue
}
}
if (filter_Link(temp_link)) {
let temp_img = link_a[i].querySelectorAll('img');
if ((temp_img.length === 0) || ((temp_img.length > 0) && (temp_img[0].src !== temp_link))) {
let temp_text = link_a[i].innerText.replace(/^\s+|\s+$/gi, '');
if (contrast_Text_And_Link(temp_text, temp_link)) {
let link_obj = {
ele_value: temp_link,
ele_container: temp_text,
ele: link_a[i],
};
temp_obj.link_obj_array.push(link_obj)
} else if (BAIDUPAN_REG.test(temp_link)) {
let baidu_obj = {
ele_value: temp_link,
ele_container: temp_text,
ele: link_a[i],
};
if (temp_baidu_array.indexOf(temp_link) === -1) {
temp_baidu_array.push(temp_link);
temp_obj.baidu_obj_array.push(baidu_obj)
}
}
}
if (temp_obj.links_array.indexOf(temp_link) === -1) {
temp_obj.links_array.push(temp_link)
}
}
}
return temp_obj
}
function judge_Color(rgb_color_value) {
if (/rgb\(/i.test(rgb_color_value)) {
let rgb_value = rgb_color_value.replace('rgb(', '').replace(')', '');
let rgb_value_array = rgb_value.split(',');
let gray_level = rgb_value_array[0] * 0.299 + rgb_value_array[1] * 0.587 + rgb_value_array[2] * 0.114;
return gray_level > 192
} else if (/rgba\(/i.test(rgb_color_value)) {
let rgba_value = rgb_color_value.replace('rgba(', '').replace(')', '');
let rgba_value_array = rgba_value.split(',');
if (rgba_value_array[3] <= 0.2) {
return true
} else {
let gray_level_2 = rgba_value_array[0] * 0.299 + rgba_value_array[1] * 0.587 + rgba_value_array[2] * 0.114;
return gray_level_2 > 192
}
}
return false
}
function rgb_To_Rgba(color_string) {
let color_value = color_string.match(/\d+/g);
if (color_value.length === 3) {
return 'rgba(' + color_value[0] + ', ' + color_value[1] + ', ' + color_value[2] + (', 1)')
}
return color_string
}
function display_Text(container, new_text_color, new_text_background_color) {
let text_font = container.getElementsByTagName('font');
let temp_obj = {
hide_text_array: [],
show_text_array: [],
};
for (let i = 0; i < text_font.length; i++) {
if ((text_font[i].closest('.quote')) || (text_font[i].getElementsByClassName('aimg_tip').length !== 0)) {
continue
}
if (text_font[i].childNodes.length === 1 && text_font[i].childNodes[0].nodeType === 3) {
let temp_text = text_font[i].innerText.replace(/^\s+|\s+$/gi, '');
if (!/^\s*$/i.test(temp_text)) {
let text_color = window.getComputedStyle(text_font[i]).color;
let text_background_color = window.getComputedStyle(text_font[i]).backgroundColor;
if ((judge_Color(text_color)) && (judge_Color(text_background_color))) {
text_font[i].style.color = new_text_color;
temp_obj.hide_text_array.push(temp_text)
} else if (rgb_To_Rgba(text_background_color) === rgb_To_Rgba(text_color)) {
text_font[i].style.backgroundColor = new_text_background_color;
text_font[i].style.color = new_text_color;
temp_obj.hide_text_array.push(temp_text)
} else if ((!judge_Color(text_background_color)) && (!judge_Color(text_color))) {
text_font[i].style.backgroundColor = new_text_background_color;
text_font[i].style.color = new_text_color;
temp_obj.hide_text_array.push(temp_text)
} else {
if (highlight_config.extract_new_enable) {
if (URL_REG.test(temp_text)) {
text_font[i].innerHTML = text_font[i].innerHTML.replace(URL_REG, (_arg0, arg1) => {
return '<a href="' + convert_Chinese_Number(arg1) + '" title="点击访问" target="_blank">' + convert_Chinese_Number(arg1) + '</a>'
})
}
}
if (!temp_obj.show_text_array.includes(temp_text)) {
temp_obj.show_text_array.push(temp_text)
}
}
}
}
}
let temp_table = container.getElementsByTagName('table');
for (let j = 0; j < temp_table.length; j++) {
if ((!judge_Color(temp_table[j].style.backgroundColor)) && (!judge_Color(temp_table[j].style.color))) {
temp_table[j].style.backgroundColor = new_text_background_color
} else if ((judge_Color(temp_table[j].style.color)) && (judge_Color(temp_table[j].style.backgroundColor))) {
temp_table[j].style.color = new_text_color
}
}
return temp_obj
}
function analysis_Text(dom_point) {
let node_list = dom_point.childNodes;
let node_text_array = [];
for (let i = 0; i < node_list.length; i++) {
if (node_list[i].nodeType === 3) {
let temp_text = node_list[i].nodeValue.replace(/^\s+|\s+$/gi, '');
if (!/^\s*$/i.test(temp_text)) {
if (highlight_config.extract_new_enable) {
if (URL_REG.test(temp_text)) {
let temp_span = document.createElement('span');
temp_span.innerHTML = node_list[i].data.replace(URL_REG, (_arg0, arg1) => {
return '<a href="' + convert_Chinese_Number(arg1) + '" title="点击访问" target="_blank">' + convert_Chinese_Number(arg1) + '</a>'
});
node_list[i].parentNode.replaceChild(temp_span, node_list[i])
}
}
node_text_array.push(temp_text)
}
} else if ((node_list[i].nodeType === 1) && (!node_list[i].className.includes('quote')) && (!node_list[i].className.includes('pstatus')) && (!node_list[i].className.includes('aimg_tip')) && (!node_list[i].className.includes('blockcode')) && ((node_list[i].nodeName !== 'FONT') || ((node_list[i].nodeName === 'FONT') && node_list[i].getElementsByTagName('br').length > 0)) && (node_list[i].nodeName !== 'A') && (node_list[i].nodeName !== 'SCRIPT') && (node_list[i].childNodes.length > 0)) {
let recursive_array = analysis_Text(node_list[i]);
for (let j = 0; j < recursive_array.length; j++) {
node_text_array.push(recursive_array[j])
}
}
}
return node_text_array
}
function check_Mobile_Page() {
return /android|webos|iphone|ipod|blackberry/i.test(navigator.userAgent)
}
function get_Now_Date() {
let now = new Date();
return now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate()
}
function time_Add_Zero(value) {
return (value < 10) ? '0' + value : value
}
function get_Update_Time(unix_time) {
if (unix_time) {
let temp_time = new Date(unix_time);
return ' (update: ' + temp_time.getFullYear() + '-' + time_Add_Zero(temp_time.getMonth() + 1) + '-' + time_Add_Zero(temp_time.getDate()) + ' ' + time_Add_Zero(temp_time.getHours()) + ':' + time_Add_Zero(temp_time.getMinutes()) + ':' + time_Add_Zero(temp_time.getSeconds()) + ')'
}
return ''
}
function highlight_Post() {
console.log('Ver.7.6.0: Console debug log. Executing function highlight_Post.');
let access_num = document.getElementById('g_upmine').innerText;
access_num = /LV\.(-?[0-9])/.exec(access_num)[1];
if (access_num) {
access_num = Number(access_num);
switch (access_num) {
case -1:
access_num = 0;
break;
case 0:
access_num = 5;
break;
case 1:
access_num = 10;
break;
case 2:
access_num = 20;
break;
case 3:
access_num = 30;
break;
case 4:
access_num = 40;
break;
case 5:
access_num = 50;
break;
case 6:
access_num = 60;
break;
case 7:
access_num = 70;
break;
case 8:
access_num = 80;
break;
case 9:
access_num = 90;
break;
default:
access_num = 90;
break
}
} else {
access_num = 90
}
console.log('Ver.7.5.0: Console debug log. Variable access_num = ' + access_num);
document.body.arrive('div#threadlist form table tbody', {
onceOnly: true
}, function() {
let item = this.querySelectorAll('.common, .new, .lock')[0];
if (item) {
let read_num = item.querySelector('.xw1');
let temp_status = true;
if (read_num) {
read_num = Number(read_num.innerText);
if (read_num > 90) {
item.querySelector('.xst').setAttribute('style', 'color: #99999; font-weight: bold; text-decoration-line: line-through; text-decoration-color: #000000;');
temp_status = false
} else if (read_num > access_num) {
item.querySelector('.xst').setAttribute('style', 'color: #999999; font-weight: bold;');
temp_status = false
}
}
if (temp_status && item.querySelector('.xst').style.fontWeight === '700') {
temp_status = false
}
if (temp_status) {
let agree_num = 0;
let font_ele = item.querySelectorAll('font');
for (let j = 0; j < font_ele.length; j++) {
let font_num = font_ele[j].innerText;
if (font_num) {
font_num = Number(font_num.replace('+', ''));
if (font_num > agree_num) {
agree_num = font_num
}
}
}
if (agree_num > 0) {
if (agree_num >= highlight_config.agree_threshold) {
item.querySelector('.xst').setAttribute('style', 'font-weight: bold; color: ' + highlight_config.agree_color + ';');
temp_status = false
}
}
}
if (temp_status) {
let reply_num = item.parentNode.querySelector('td.num a').innerText;
if (reply_num) {
reply_num = Number(reply_num);
if (reply_num >= highlight_config.reply_threshold) {
item.querySelector('.xst').setAttribute('style', 'font-weight: bold; color: ' + highlight_config.reply_color + ';')
}
}
}
}
})
}
function insert_Checkbox(ul_node, li_array, check_enable_value, status = false) {
let temp_li = document.createElement('li');
temp_li.style.padding = '1px 0px';
let temp_label = document.createElement('label');
temp_label.setAttribute('style', 'vertical-align: middle; ' + (status ? 'text-decoration: line-through;' : ''));
let temp_input = document.createElement('input');
temp_input.id = li_array[0];
temp_input.type = 'checkbox';
temp_input.setAttribute('style', 'margin-right: 5px; margin-bottom: 6px;');
if (check_enable_value) {
temp_input.checked = 'checked'
}
let temp_span = document.createElement('span');
temp_span.innerText = li_array[1];
temp_span.title = li_array[2];
temp_label.appendChild(temp_input);
temp_label.appendChild(temp_span);
temp_li.appendChild(temp_label);
ul_node.appendChild(temp_li)
}
function insert_Input(ul_node, text_array, input_array, input_value, eg_array) {
let temp_li = document.createElement('li');
temp_li.style.padding = '1px 0px';
let text_span = document.createElement('span');
text_span.id = text_array[0];
text_span.innerText = text_array[1];
text_span.style.marginLeft = '5px';
temp_li.appendChild(text_span);
let temp_input = document.createElement('input');
temp_input.id = input_array[0];
temp_input.placeholder = input_array[1];
temp_input.value = input_value;
temp_input.style.width = '100px';
temp_input.style.height = '16px';
temp_li.appendChild(temp_input);
if (arguments.length === 5) {
let eg_span = document.createElement('span');
eg_span.id = eg_array[0];
eg_span.innerText = eg_array[1];
eg_span.style.marginLeft = '5px';
eg_span.style.color = input_value;
temp_input.oninput = function() {
eg_span.style.color = this.value
};
temp_li.appendChild(eg_span)
}
ul_node.appendChild(temp_li)
}
function show_Display_Mode(html_span, display_status) {
if (display_status) {
html_span.title = '开启日间模式';
html_span.style.backgroundImage = MODE_ICON.DAY
} else {
html_span.title = '开启夜间模式';
html_span.style.backgroundImage = MODE_ICON.NIGHT
}
}
function create_Night_Icon() {
let icon_span = document.createElement('span');
icon_span.id = 'nightIcon';
icon_span.style.display = 'block';
icon_span.style.float = 'right';
icon_span.style.cursor = 'pointer';
icon_span.style.marginTop = '5px';
icon_span.style.width = '23px';
icon_span.style.height = '18px';
icon_span.style.backgroundRepeat = 'no-repeat';
icon_span.style.backgroundSize = '16px auto';
icon_span.style.backgroundPosition = 'center';
if (night_enable) {
show_Display_Mode(icon_span, true)
} else {
show_Display_Mode(icon_span, false)
}
icon_span.addEventListener('click', function() {
if (night_enable) {
night_enable = false
} else {
night_enable = true
}
GM_setValue('night_enable', night_enable);
location.reload()
});
return icon_span
}
function create_Icon(icon_obj, top_value, wrap_id, hide_id, create_tag) {
let icon_span = document.createElement('span');
let icon_a = document.createElement('a');
icon_a.className = icon_obj.CLASS_NAME;
icon_a.title = icon_obj.TITLE;
icon_a.target = '_self';
icon_a.href = 'javascript:;';
icon_a.style.backgroundImage = icon_obj.GRAY;
icon_a.style.backgroundRepeat = 'no-repeat';
icon_a.style.backgroundSize = '24px auto';
icon_a.style.backgroundPosition = 'center';
icon_a.style.visibility = 'visible';
icon_a.style.position = 'fixed';
icon_a.style.display = 'block';
icon_a.style.border = '1px #cdcdcd solid';
icon_a.style.borderRadius = '3px';
icon_a.style.width = '30px';
icon_a.style.height = '24px';
icon_a.style.right = '10px';
icon_a.style.padding = '3px 5px';
icon_a.style.top = top_value;
hover(icon_a, function() {
this.style.backgroundImage = icon_obj.BLUE
}, function() {
this.style.backgroundImage = icon_obj.GRAY
});
icon_a.addEventListener('click', function() {
if (document.getElementById(hide_id)) {
document.getElementById(hide_id).style.display = 'none'
}
if (document.getElementById(wrap_id)) {
if (document.getElementById(wrap_id).style.display === 'none') {
document.getElementById(wrap_id).style.display = 'block'
} else {
document.getElementById(wrap_id).style.display = 'none'
}
} else {
document.body.appendChild(create_tag())
}
});
icon_span.appendChild(icon_a);
return icon_span
}
function hover(ele, over, out) {
ele.addEventListener('mouseover', over, false);
ele.addEventListener('mouseout', out, false)
}
function set_Status_Bar(bar_id, bar_value) {
if (bar_id === 0) {
document.getElementById(CODE_VALUE.STATUS_BAR[0]).innerText = bar_value
} else if (bar_id === 1) {
document.getElementById(BT_VALUE.STATUS_BAR[0]).innerText = bar_value
}
}
function create_Operate_Button(text_array, callback, status = 0) {
let operate_btn = create_Button(text_array, 'height: auto; margin: 5px; padding: 0 5px;', '', function() {
let str = document.getElementById(CODE_VALUE.LEFT_TEXTAREA[0]).value;
let result = callback(str);
if (result) {
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = result;
if (status === 0) {
set_Status_Bar(0, '编码完成!')
} else {
set_Status_Bar(0, '解码完成!')
}
}
});
return operate_btn
}
function create_Col(width) {
let col = document.createElement('col');
col.width = width;
return col
}
function create_Th(class_name, text_value, align_value = 0) {
let th = document.createElement('th');
th.className = class_name;
th.innerText = text_value;
if (align_value === 1) {
th.style.textAlign = 'center'
}
return th
}
function create_Td(id_name, html_value, align_value = 0) {
let td = document.createElement('td');
td.id = id_name;
td.innerHTML = html_value;
if (align_value === 1) {
td.style.textAlign = 'center'
}
return td
}
function create_Magnet_Result(num, name_html, format_size, hot, date, magnet) {
let tr = document.createElement('tr');
tr.appendChild(create_Td('btNum_' + num, num + 1, 1));
tr.appendChild(create_Td('btName_' + num, name_html));
tr.appendChild(create_Td('btSize_' + num, format_size, 1));
tr.appendChild(create_Td('btHot_' + num, hot, 1));
tr.appendChild(create_Td('btDate_' + num, date, 1));
let temp_td = document.createElement('td');
temp_td.style.textAlign = 'center';
let copy_button = create_Button(['btCopy_' + num, '复制', '复制磁力链接'], 'padding: 0 5px; margin-right: 0;', '', function() {
GM_setClipboard(magnet, "text");
set_Status_Bar(1, '复制成功!')
});
temp_td.appendChild(copy_button);
tr.appendChild(temp_td);
return tr
}
function search_Magnet(page_num = 1) {
set_Status_Bar(1, BT_VALUE.STATUS_BAR[2]);
let bt_url = BT_VALUE.API_ARRAR[0].replace('$1$', document.getElementById(BT_VALUE.SEARCH_INPUT[0]).value).replace('$2$', page_num);
let bt_details = {
'method': 'GET',
'url': bt_url,
'responseType': 'json',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'onload': function(res) {
document.getElementById(BT_VALUE.TBODY[0]).innerHTML = '';
if (res.response.data) {
if (res.response.data.results.length > 0) {
let results = res.response.data.results;
for (let i = 0; i < results.length; i++) {
document.getElementById(BT_VALUE.TBODY[0]).appendChild(create_Magnet_Result(i, results[i].nameHtml, results[i].formatSize, results[i].hot, results[i].date, results[i].magnet))
}
if (results.length >= BT_VALUE.API_ARRAR[1]) {
document.getElementById(BT_VALUE.NEXT_PAGE_BUTTON[0]).style.display = 'inline-block'
} else {
document.getElementById(BT_VALUE.NEXT_PAGE_BUTTON[0]).style.display = 'none'
}
}
} else {
document.getElementById(BT_VALUE.NEXT_PAGE_BUTTON[0]).style.display = 'none'
}
bt_page_num = page_num;
document.getElementById(BT_VALUE.PAGE_TEXT[0]).innerText = BT_VALUE.PAGE_TEXT[1] + bt_page_num;
if (bt_page_num > 1) {
document.getElementById(BT_VALUE.PREV_PAGE_BUTTON[0]).style.display = 'inline-block'
} else {
document.getElementById(BT_VALUE.PREV_PAGE_BUTTON[0]).style.display = 'none'
}
if (res.response.message) {
set_Status_Bar(1, res.response.message)
} else {
set_Status_Bar(1, BT_VALUE.STATUS_BAR[3])
}
},
'onerror': function() {
set_Status_Bar(1, '网络连接出问题啦!')
}
};
GM_xmlhttpRequest(bt_details)
}
function create_Wrap_Div(wrap_array, style_value = '') {
let wrap_div = document.createElement('div');
wrap_div.id = wrap_array[0];
wrap_div.className = wrap_array[1];
if (style_value) {
wrap_div.setAttribute('style', style_value)
} else {
wrap_div.setAttribute('style', 'position: fixed; top: 50%; left: 50%; z-index: 250; dispaly: block; padding: 0; margin: -300px 0 0 -450px; border: 1px solid #a0a0a0; border-radius: 3px; width: 900px; height: 600px;')
}
return wrap_div
}
function create_Main_Fieldsest(fieldset_array, style_value = '') {
let main_fieldset = document.createElement('fieldset');
main_fieldset.id = fieldset_array[0];
if (style_value) {
main_fieldset.setAttribute('style', style_value)
} else {
main_fieldset.setAttribute('style', 'border: 3px solid #ccc; border-radius: 3px; padding: 4px 9px 6px 9px; margin: 8px; height: 540px;')
}
return main_fieldset
}
function create_Bt_Tag() {
console.log('Ver.7.7.0: Console debug log. Executing function create_Bt_Tag.');
let wrap_div = create_Wrap_Div(BT_VALUE.WRAP_DIV, 'position: fixed; top: 50%; left: 50%; z-index: 250; dispaly: block; padding: 0; margin: -300px 0 0 -450px; border: 1px solid #a0a0a0; border-radius: 3px; width: 900px; height: 650px;');
let main_fieldset = create_Main_Fieldsest(BT_VALUE.MAIN_FIELDSET, 'border: 3px solid #ccc; border-radius: 3px; padding: 4px 9px 6px 9px; margin: 5px 8px 2px 8px; height: 600px;');
wrap_div.appendChild(main_fieldset);
let headline_legend = document.createElement('legend');
headline_legend.id = BT_VALUE.HEADLINE_LEGEND[0];
let headline_link = document.createElement('a');
headline_link.id = BT_VALUE.HEADLINE_LINK[0];
headline_link.innerText = BT_VALUE.HEADLINE_LINK[1];
headline_link.title = BT_VALUE.HEADLINE_LINK[2];
headline_link.href = BT_VALUE.HEADLINE_LINK[3];
headline_link.target = '_blank';
headline_legend.appendChild(headline_link);
main_fieldset.appendChild(headline_legend);
let top_bar = document.createElement('div');
top_bar.id = BT_VALUE.TOP_BAR[0];
main_fieldset.appendChild(top_bar);
let search_input = document.createElement('input');
search_input.id = BT_VALUE.SEARCH_INPUT[0];
search_input.type = 'text';
search_input.placeholder = BT_VALUE.SEARCH_INPUT[1];
search_input.style.width = '400px';
search_input.style.marginTop = '5px';
search_input.oninput = function() {
document.getElementById(BT_VALUE.PREV_PAGE_BUTTON[0]).style.display = 'none';
document.getElementById(BT_VALUE.NEXT_PAGE_BUTTON[0]).style.display = 'none'
};
search_input.addEventListener('keyup', function(e) {
if (e.keyCode === 13) {
search_Magnet(1)
}
});
top_bar.appendChild(search_input);
let search_button = create_Button(BT_VALUE.SEARCH_BUTTON, 'padding: 0 5px; margin-left: 5px;', '', function() {
search_Magnet(1)
});
top_bar.appendChild(search_button);
let prev_page_button = create_Button(BT_VALUE.PREV_PAGE_BUTTON, 'padding: 0 5px; display: none;', '', function() {
if (bt_page_num > 1) {
search_Magnet(bt_page_num - 1)
}
});
top_bar.appendChild(prev_page_button);
let next_page_button = create_Button(BT_VALUE.NEXT_PAGE_BUTTON, 'padding: 0 5px; display: none;', '', function() {
search_Magnet(bt_page_num + 1)
});
top_bar.appendChild(next_page_button);
let page_text = document.createElement('span');
page_text.id = BT_VALUE.PAGE_TEXT[0];
page_text.innerText = BT_VALUE.PAGE_TEXT[1] + 0;
page_text.style.float = 'right';
page_text.style.marginRight = '5px';
top_bar.appendChild(page_text);
let middle_bar = document.createElement('div');
middle_bar.id = BT_VALUE.MIDDLE_BAR[0];
middle_bar.style.marginTop = '5px';
main_fieldset.appendChild(middle_bar);
let table_header_div = document.createElement('div');
table_header_div.id = BT_VALUE.TABLE_HEADER_DIV[0];
let table_header = document.createElement('table');
table_header.id = BT_VALUE.TABLE_HEADER[0];
table_header.border = '1';
let colgroup_header = document.createElement('colgroup');
colgroup_header.appendChild(create_Col(30));
colgroup_header.appendChild(create_Col(560));
colgroup_header.appendChild(create_Col(90));
colgroup_header.appendChild(create_Col(50));
colgroup_header.appendChild(create_Col(80));
colgroup_header.appendChild(create_Col(50));
table_header.appendChild(colgroup_header);
let theader = document.createElement('thead');
let theader_tr = document.createElement('tr');
theader_tr.appendChild(create_Th(BT_VALUE.TH[0] + '1', '序号', 1));
theader_tr.appendChild(create_Th(BT_VALUE.TH[0] + '2', '名称'));
theader_tr.appendChild(create_Th(BT_VALUE.TH[0] + '3', '大小', 1));
theader_tr.appendChild(create_Th(BT_VALUE.TH[0] + '4', '人气', 1));
theader_tr.appendChild(create_Th(BT_VALUE.TH[0] + '5', '发布日期', 1));
theader_tr.appendChild(create_Th(BT_VALUE.TH[0] + '6', '操作', 1));
theader.appendChild(theader_tr);
table_header.appendChild(theader);
table_header_div.appendChild(table_header);
middle_bar.appendChild(table_header_div);
let table_body_div = document.createElement('div');
table_body_div.id = BT_VALUE.TABLE_BODY_DIV[0];
table_body_div.style.marginTop = '1px';
middle_bar.appendChild(table_body_div);
let table_body = document.createElement('table');
table_body.id = BT_VALUE.TABLE_BODY[0];
table_body.border = '1';
table_body_div.appendChild(table_body);
let colgroup_body = colgroup_header.cloneNode(true);
table_body.appendChild(colgroup_body);
let tbody = document.createElement('tbody');
tbody.id = BT_VALUE.TBODY[0];
table_body.appendChild(tbody);
let close_btn = create_Button(BT_VALUE.CLOSE_BUTTON, 'position: relative; float: right; margin-right: 10px; padding: 0 5px;', BT_VALUE.WRAP_DIV[0]);
wrap_div.appendChild(close_btn);
let status_bar = document.createElement('span');
status_bar.id = BT_VALUE.STATUS_BAR[0];
status_bar.innerText = BT_VALUE.STATUS_BAR[1];
status_bar.style.marginLeft = '10px';
wrap_div.appendChild(status_bar);
return wrap_div
}
function create_Code_Tag() {
console.log('Ver.7.7.0: Console debug log. Executing function create_Code_Tag.');
let wrap_div = create_Wrap_Div(CODE_VALUE.WRAP_DIV);
let main_fieldset = create_Main_Fieldsest(CODE_VALUE.MAIN_FIELDSET);
wrap_div.appendChild(main_fieldset);
let headline_legend = document.createElement('legend');
headline_legend.id = CODE_VALUE.HEADLINE_LEGEND[0];
headline_legend.innerText = CODE_VALUE.HEADLINE_LEGEND[1];
main_fieldset.appendChild(headline_legend);
let left_bar = document.createElement('span');
left_bar.id = CODE_VALUE.LEFT_BAR[0];
left_bar.style.float = 'left';
main_fieldset.appendChild(left_bar);
let left_title = document.createElement('div');
left_title.id = CODE_VALUE.LEFT_TITLE[0];
left_title.innerText = CODE_VALUE.LEFT_TITLE[1];
left_bar.appendChild(left_title);
let left_textarea = document.createElement('textarea');
left_textarea.id = CODE_VALUE.LEFT_TEXTAREA[0];
left_textarea.className = 'userStyleTextarea';
left_textarea.placeholder = CODE_VALUE.LEFT_TEXTAREA[1];
left_textarea.setAttribute('style', 'width: 372px; height: 500px; border: 1px solid #ccc;');
left_bar.appendChild(left_textarea);
let operate_bar = document.createElement('span');
operate_bar.id = CODE_VALUE.OPERATE_BAR[0];
operate_bar.style.float = 'left';
operate_bar.style.width = '100px';
operate_bar.style.marginTop = '20px';
main_fieldset.appendChild(operate_bar);
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.BJX_ENCODE, baijia_Encode, 0));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.BJX_DECODE, baijia_Decode, 1));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.JZG_ENCODE, values_Encode, 0));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.JZG_DECODE, values_Decode, 1));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.YFLC_ENCODE, function(str) {
set_Status_Bar(0, '编码中...');
let encode_details = {
'method': 'POST',
'url': 'http://keyfc.net/bbs/tools/tudou.aspx',
'data': 'orignalMsg=' + encodeURIComponent(str) + '&action=Encode',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'onload': function(res) {
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = res.responseText.replace(/^<BUDDHIST><Message><!\[CDATA\[|\]\]><\/Message><\/BUDDHIST>$/g, '');
set_Status_Bar(0, '编码完成!')
},
'onerror': function() {
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = '编码出现错误!';
set_Status_Bar(0, '编码完成!')
}
};
GM_xmlhttpRequest(encode_details);
return false
}));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.YFLC_DECODE, function(str) {
set_Status_Bar(0, '解码中...');
let decode_details = {
'method': 'POST',
'url': 'http://keyfc.net/bbs/tools/tudou.aspx',
'data': 'orignalMsg=' + str.replace(/\s/g, '') + '&action=Decode',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'onload': function(res) {
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = res.responseText.replace(/^<BUDDHIST><Message><!\[CDATA\[|\]\]><\/Message><\/BUDDHIST>$/g, '');
set_Status_Bar(0, '解码完成!')
},
'onerror': function() {
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = '解码出现错误!';
set_Status_Bar(0, '解码完成!')
}
};
GM_xmlhttpRequest(decode_details);
return false
}));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.BASE64_ENCODE, function(str) {
str = CryptoJS.enc.Utf8.parse(str);
return CryptoJS.enc.Base64.stringify(str)
}, 0));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.BASE64_DECODE, function(str) {
let words = CryptoJS.enc.Base64.parse(str);
return words.toString(CryptoJS.enc.Utf8)
}, 1));
operate_bar.appendChild(create_Operate_Button(CODE_VALUE.BAIDU_QUERY, function(str) {
set_Status_Bar(0, '查询提取码中...');
let query_details = {
'method': 'GET',
'url': 'https://search.pandown.cn/api/query?surl=' + str.split('/').pop(),
'responseType': 'json',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'onload': function(res) {
try {
if ((res.response.code === 0) && (res.response.data[0].password)) {
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = res.response.data[0].password
} else {
console.log(res.response.message);
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = '没有查询到提取码哦。'
}
} catch (e) {
console.log(e)
}
set_Status_Bar(0, '查询提取码完成!')
},
'onerror': function() {
document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value = '网络连接出问题啦。';
set_Status_Bar(0, '查询提取码完成!')
}
};
GM_xmlhttpRequest(query_details);
return false
}));
let right_bar = document.createElement('span');
right_bar.id = CODE_VALUE.RIGHT_BAR[0];
right_bar.style.float = 'right';
main_fieldset.appendChild(right_bar);
let right_title = document.createElement('div');
right_title.id = CODE_VALUE.RIGHT_TITLE[0];
right_title.innerText = CODE_VALUE.RIGHT_TITLE[1];
right_bar.appendChild(right_title);
let right_textarea = document.createElement('textarea');
right_textarea.id = CODE_VALUE.RIGHT_TEXTAREA[0];
right_textarea.className = 'userStyleTextarea';
right_textarea.placeholder = CODE_VALUE.RIGHT_TEXTAREA[1];
right_textarea.setAttribute('style', 'width: 372px; height: 500px; border: 1px solid #ccc;');
right_bar.appendChild(right_textarea);
let close_btn = create_Button(CODE_VALUE.CLOSE_BUTTON, 'position: relative; float: right; margin-right: 10px; padding: 0 5px;', CODE_VALUE.WRAP_DIV[0]);
wrap_div.appendChild(close_btn);
let copy_btn = create_Button(CODE_VALUE.COPY_BUTTON, 'position: relative; float: right; margin-right: 10px; padding: 0 5px;', '', function() {
GM_setClipboard(document.getElementById(CODE_VALUE.RIGHT_TEXTAREA[0]).value, "text");
set_Status_Bar(0, '复制成功!')
});
wrap_div.appendChild(copy_btn);
let status_bar = document.createElement('span');
status_bar.id = CODE_VALUE.STATUS_BAR[0];
status_bar.innerText = CODE_VALUE.STATUS_BAR[1];
status_bar.style.marginLeft = '10px';
wrap_div.appendChild(status_bar);
return wrap_div
}
function create_Setting_Tag() {
console.log('Ver.7.6.0: Console debug log. Executing function create_Setting_Tag.');
let wrap_div = create_Wrap_Div(SETTING_VALUE.WRAP_DIV, 'position: fixed; top: 4vw; right: 2vw; z-index: 9999; text-align: left; display: block; padding: 0; margin: 0; border: 1px solid #a0a0a0; border-radius: 3px; color: #000; font-size: 13px; display: block;');
let main_fieldset = create_Main_Fieldsest(SETTING_VALUE.MAIN_FIELDSET, 'border: 3px solid #ccc; border-radius: 3px; padding: 4px 9px 6px 9px; margin: 8px; min-width: 300px; width: auto; height: auto;');
wrap_div.appendChild(main_fieldset);
let headline_legend = document.createElement('legend');
headline_legend.id = SETTING_VALUE.HEADLINE_LEGEND[0];
let headline_link = document.createElement('a');
headline_link.id = SETTING_VALUE.HEADLINE_LINK[0];
headline_link.innerText = SETTING_VALUE.HEADLINE_LINK[1];
headline_link.title = SETTING_VALUE.HEADLINE_LINK[2];
headline_link.href = SETTING_VALUE.HEADLINE_LINK[3];
headline_link.target = '_blank';
let feedback_link = document.createElement('a');
feedback_link.id = SETTING_VALUE.FEEDBACK_LINK[0];
feedback_link.innerText = SETTING_VALUE.FEEDBACK_LINK[1];
feedback_link.title = SETTING_VALUE.FEEDBACK_LINK[2];
feedback_link.href = SETTING_VALUE.FEEDBACK_LINK[3];
feedback_link.target = '_blank';
feedback_link.style.marginLeft = '10px';
feedback_link.style.color = 'blue';
headline_legend.appendChild(headline_link);
headline_legend.appendChild(feedback_link);
main_fieldset.appendChild(headline_legend);
let tag_ul = document.createElement('ul');
tag_ul.id = SETTING_VALUE.TAG_UL[0];
tag_ul.setAttribute('style', 'list-style: none; padding-left: 0;');
main_fieldset.appendChild(tag_ul);
insert_Checkbox(tag_ul, SETTING_VALUE.HIGHLIGHT_CHECKBOX, highlight_config.highlight_enable);
insert_Input(tag_ul, SETTING_VALUE.AGREE_NUMBER_TEXT, SETTING_VALUE.AGREE_NUMBER_INPUT, highlight_config.agree_threshold);
insert_Input(tag_ul, SETTING_VALUE.AGREE_COLOR_TEXT, SETTING_VALUE.AGREE_COLOR_INPUT, highlight_config.agree_color, SETTING_VALUE.AGREE_COLOR_EG);
insert_Input(tag_ul, SETTING_VALUE.REPLY_NUMBER_TEXT, SETTING_VALUE.REPLY_NUMBER_INPUT, highlight_config.reply_threshold);
insert_Input(tag_ul, SETTING_VALUE.REPLY_COLOR_TEXT, SETTING_VALUE.REPLY_COLOR_INPUT, highlight_config.reply_color, SETTING_VALUE.REPLY_COLOR_EG);
let br = document.createElement('li');
br.innerHTML = '------------------------------------------------------------------';
br.style.textAlign = 'center';
tag_ul.appendChild(br);
insert_Checkbox(tag_ul, SETTING_VALUE.FLOAT_CHECKBOX, highlight_config.float_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.CLICK_CHECKBOX, highlight_config.click_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.EXTRACT_CHECKBOX, highlight_config.extract_new_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.COPY_CHECKBOX, highlight_config.copy_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.CHECK_CHECKBOX, highlight_config.check_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.QUERY_CHECKBOX, highlight_config.query_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.PANDOWNLOAD_CHECKBOX, highlight_config.pandownload_enable, true);
let br_clone_1 = br.cloneNode(true);
tag_ul.appendChild(br_clone_1);
insert_Checkbox(tag_ul, SETTING_VALUE.CHECK_IN_CHECKBOX, highlight_config.auto_check_in_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.NIGHT_CHECKBOX, highlight_config.night_btn_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.CODE_CHECKBOX, highlight_config.code_enable);
insert_Checkbox(tag_ul, SETTING_VALUE.BT_CHECKBOX, highlight_config.bt_enable);
let br_clone_2 = br.cloneNode(true);
tag_ul.appendChild(br_clone_2);
insert_Input(tag_ul, SETTING_VALUE.TEXT_COLOR_TEXT, SETTING_VALUE.TEXT_COLOR_INPUT, highlight_config.text_color, SETTING_VALUE.TEXT_COLOR_EG);
insert_Input(tag_ul, SETTING_VALUE.LINK_COLOR_TEXT, SETTING_VALUE.LINK_COLOR_INPUT, highlight_config.link_color, SETTING_VALUE.LINK_COLOR_EG);
insert_Input(tag_ul, SETTING_VALUE.MAX_LINK_TEXT, SETTING_VALUE.MAX_LINK_INPUT, highlight_config.max_link_number);
let br_clone_3 = br.cloneNode(true);
tag_ul.appendChild(br_clone_3);
let save_button = create_Button(SETTING_VALUE.SAVE_BUTTON, 'position: relative; float: right; margin-right: 5px; margin-top: 5px; padding: 0 5px;', '', function() {
highlight_config.highlight_enable = document.getElementById(SETTING_VALUE.HIGHLIGHT_CHECKBOX[0]).checked;
highlight_config.agree_threshold = document.getElementById(SETTING_VALUE.AGREE_NUMBER_INPUT[0]).value;
highlight_config.agree_color = document.getElementById(SETTING_VALUE.AGREE_COLOR_INPUT[0]).value;
highlight_config.reply_threshold = document.getElementById(SETTING_VALUE.REPLY_NUMBER_INPUT[0]).value;
highlight_config.reply_color = document.getElementById(SETTING_VALUE.REPLY_COLOR_INPUT[0]).value;
highlight_config.copy_enable = document.getElementById(SETTING_VALUE.COPY_CHECKBOX[0]).checked;
highlight_config.text_color = document.getElementById(SETTING_VALUE.TEXT_COLOR_INPUT[0]).value;
highlight_config.link_color = document.getElementById(SETTING_VALUE.LINK_COLOR_INPUT[0]).value;
highlight_config.float_enable = document.getElementById(SETTING_VALUE.FLOAT_CHECKBOX[0]).checked;
highlight_config.extract_new_enable = document.getElementById(SETTING_VALUE.EXTRACT_CHECKBOX[0]).checked;
highlight_config.pandownload_enable = document.getElementById(SETTING_VALUE.PANDOWNLOAD_CHECKBOX[0]).checked;
highlight_config.query_enable = document.getElementById(SETTING_VALUE.QUERY_CHECKBOX[0]).checked;
highlight_config.code_enable = document.getElementById(SETTING_VALUE.CODE_CHECKBOX[0]).checked;
highlight_config.bt_enable = document.getElementById(SETTING_VALUE.BT_CHECKBOX[0]).checked;
highlight_config.click_enable = document.getElementById(SETTING_VALUE.CLICK_CHECKBOX[0]).checked;
highlight_config.check_enable = document.getElementById(SETTING_VALUE.CHECK_CHECKBOX[0]).checked;
highlight_config.night_btn_enable = document.getElementById(SETTING_VALUE.NIGHT_CHECKBOX[0]).checked;
highlight_config.auto_check_in_enable = document.getElementById(SETTING_VALUE.CHECK_IN_CHECKBOX[0]).checked;
highlight_config.max_link_number = document.getElementById(SETTING_VALUE.MAX_LINK_INPUT[0]).value;
GM_setValue('highlight_config', highlight_config);
location.reload()
});
tag_ul.appendChild(save_button);
let cancel_button = create_Button(SETTING_VALUE.CANCEL_BUTTON, 'position: relative; float: left; margin-left: 5px; margin-top:5px; padding: 0 5px;', SETTING_VALUE.WRAP_DIV[0]);
tag_ul.appendChild(cancel_button);
return wrap_div
}
function create_Switch_Span(key_value, dom_array) {
console.log('Ver.7.6.0: Console debug log. Executing function create_Switch_Span.');
let switch_span = document.createElement('span');
switch_span.className = 'o';
switch_span.style.float = 'right';
switch_span.style.cursor = 'pointer';
Promise.all([GM_getValue('switch_config')]).then(function(data) {
console.log('Ver.7.6.0: Console debug log. Read the value of variable switch_config.');
if (data[0] !== undefined) {
switch_config = data[0]
}
let switch_img = document.createElement('img');
switch_img.id = key_value + '_user_img';
switch_img.title = '收起/展开';
switch_img.alt = '收起/展开';
if (switch_config[key_value]) {
dom_array.forEach(function(item) {
item.style.display = 'none'
});
switch_img.src = COLLAPSED_IMG.YES
} else {
switch_img.src = COLLAPSED_IMG.NO
}
switch_img.addEventListener('click', function() {
if (switch_config[key_value]) {
dom_array.forEach(function(item) {
item.style.display = ''
});
switch_img.src = COLLAPSED_IMG.NO;
switch_config[key_value] = false
} else {
dom_array.forEach(function(item) {
item.style.display = 'none'
});
switch_img.src = COLLAPSED_IMG.YES;
switch_config[key_value] = true
}
GM_setValue('switch_config', switch_config)
});
switch_span.appendChild(switch_img)
}).
catch (function(except) {
console.log('Ver.7.6.0: Fatal script error!');
console.log(except)
});
return switch_span
}
function init() {
console.log('Ver.7.5.0: Console debug log. The script initialization.');
let old_url = location.href;
if (check_Mobile_Page()) {
console.log('Ver.7.9.0: Console debug log. On the mobile page. If you choose the computer version of the page on your phone, you can still see this message, indicating that the script has made a mistake.');
GM_addStyle(CON_STYLE);
document.arrive('body', {
onceOnly: true
}, function() {
if (highlight_config.highlight_enable) {
if ((old_url.indexOf('mod=forumdisplay') !== -1) || (/forum-\d+-\d+\.html/i.test(old_url))) {
document.body.arrive('.threadlist li', {
onceOnly: true
}, function() {
let reply_num = this.querySelector('span.num.icon.iconfont').innerText;
if (reply_num) {
reply_num = Number(/\d+/.exec(reply_num)[0]);
if (reply_num >= highlight_config.reply_threshold) {
this.querySelector('div.thread-item-sub').setAttribute('style', 'font-weight: bold; color: ' + highlight_config.reply_color + ';')
}
}
})
}
}
if ((old_url.indexOf('mod=viewthread') !== -1) || (/thread-\d+-\d+(?:-\d+)?\.html/i.test(old_url))) {
let phone_background_color = window.getComputedStyle(document.body).backgroundColor;
console.log('Ver.7.9.0: Console debug log. Variable phone_background_color = ' + phone_background_color);
document.body.arrive('.message', {
onceOnly: true
}, function() {
let text_obj = display_Text(this, highlight_config.text_color, phone_background_color);
let text_array = analysis_Text(this);
let link_obj = find_Link(this);
create_Good_Boy_Button(this, link_obj, text_obj, text_array)
})
}
if (highlight_config.auto_check_in_enable) {
document.body.arrive('.bg > a', {
onceOnly: true,
existing: true
}, function(item) {
if (item.innerText === '签到领奖') {
Promise.all([GM_getValue('check_date')]).then(function(data) {
console.log('Ver.7.10.0: Consele debug log. Read the value of the variable check_date.');
if (data[0] !== undefined) {
check_date = data[0]
}
let now_date = get_Now_Date();
if (now_date !== check_date) {
GM_setValue('check_date', now_date);
item.click();
console.log('Ver.7.10.0: Console debug log. Check-in completed.')
}
}).
catch (function(e) {
console.log('Ver.7.10.0: Console debug log. Fatal script error!');
console.log(e)
})
}
})
}
})
} else {
Promise.all([GM_getValue('night_enable')]).then(function(data) {
console.log('Ver.7.6.0: Console debug log. Read the value of variable night_enable.');
if (data[0] !== undefined) {
night_enable = data[0]
}
if (night_enable) {
GM_addStyle(NIGHT_STYLE)
} else {
GM_addStyle(CON_STYLE)
}
if (highlight_config.night_btn_enable) {
document.arrive('#sslct', {
onceOnly: true
}, function() {
document.getElementById('sslct').after(create_Night_Icon())
})
}
}).
catch (function(except) {
console.log('Ver.7.6.0: Fatal script error!');
console.log(except)
});
document.arrive('body', {
onceOnly: true
}, function() {
let html_background_color = window.getComputedStyle(document.body).backgroundColor;
console.log('Ver.7.5.0: Console debug log. Variable html_background_color = ' + html_background_color);
if ((old_url.indexOf('mod=forumdisplay') !== -1) || (/forum-\d+-\d+\.html/i.test(old_url))) {
if ((old_url.indexOf('fid=37') !== -1) || (/forum-37-/i.test(old_url))) {
document.body.arrive('div.bm_h.cl', {
fireOnAttributesModification: true,
onceOnly: true,
existing: true
}, function() {
if (this.querySelectorAll('span.y').length === 0) {
let theme_array = [];
theme_array.push(this.nextElementSibling);
this.insertBefore(create_Switch_Span('collapsed_gwwz_enable', theme_array), this.childNodes[0])
}
})
}
if (highlight_config.highlight_enable) {
highlight_Post()
}
}
if ((old_url.indexOf('mod=viewthread') !== -1) || (/thread-\d+-\d+(?:-\d+)?\.html/i.test(old_url))) {
document.body.arrive('td.t_f img', {
onceOnly: true
}, function() {
let base_src = this.getAttribute('file');
if (BASE_IMAGE_REG.test(base_src)) {
base_src = base_src.replace(BASE_IMAGE_REG, '$1');
this.setAttribute('file', base_src);
this.src = base_src
}
});
document.body.arrive('.t_f img.zoom', {
onceOnly: true
}, function() {
this.removeAttribute('height')
});
document.body.arrive('td.t_f', function() {
if (highlight_config.float_enable) {
let favatar_btn = this.closest('table.plhin').querySelector('div.favatar');
let text_obj = display_Text(this, highlight_config.text_color, html_background_color);
let text_array = analysis_Text(this);
let link_obj = find_Link(this);
create_Good_Boy_Button(favatar_btn, link_obj, text_obj, text_array, true)
} else {
let main_btn = this.closest('div.pcb').querySelector('div.cm');
let text_obj = display_Text(this, highlight_config.text_color, html_background_color);
let text_array = analysis_Text(this);
let link_obj = find_Link(this);
create_Good_Boy_Button(main_btn, link_obj, text_obj, text_array)
}
});
if (highlight_config.click_enable) {
document.body.arrive('.buttona', {
fireOnAttributesModification: true,
onceOnly: true,
existing: true
}, function() {
let click_status = true;
let uid_href = document.querySelector('.vwmy a').href;
let uid = /&uid=(\d+)/.exec(uid_href)[1];
let ratl_l = document.querySelectorAll('.ratl_l tr');
for (let ra = 0; ra < ratl_l.length; ra++) {
let rate_id = ratl_l[ra].id.replace(/rate_\d+_/, '');
if (rate_id === uid) {
click_status = false;
break
}
}
if (click_status) {
document.querySelector(".buttona").click();
if (document.querySelectorAll('.ratl_l tr').length > ratl_l.length) {
location.reload()
} else {
document.querySelector('#postlist > div').leave('.t_f', function() {
location.reload()
})
}
}
})
}
document.body.arrive('div.sign a', {
onceOnly: true
}, function() {
if (/member\.php\?mod=logging&action=logout/i.test(this.href)) {
this.style.display = 'none';
console.log('Ver.7.8.3: Consoel debug log. Hide a malicious signature. Maybe later it will be used to hide promotion links.')
}
})
}
if (highlight_config.auto_check_in_enable) {
document.body.arrive('#fx_checkin_topb', {
fireOnAttributesModification: true,
onceOnly: true,
existing: true
}, function() {
if (this.getElementsByTagName('img')[0].alt !== '已签到') {
if (typeof(fx_checkin) === 'function') {
this.click()
} else {
setTimeout(() => {
this.click()
}, 2000)
}
console.log('Ver.7.6.0: Console debug log. Check-in completed.')
}
})
}
if (highlight_config.code_enable) {
document.body.appendChild(create_Icon(CODE_ICON, '30px', CODE_VALUE.WRAP_DIV[0], BT_VALUE.WRAP_DIV[0], create_Code_Tag))
}
if (highlight_config.bt_enable) {
let bt_top = highlight_config.code_enable ? '60px' : '30px';
document.body.appendChild(create_Icon(BT_ICON, bt_top, BT_VALUE.WRAP_DIV[0], CODE_VALUE.WRAP_DIV[0], create_Bt_Tag))
}
})
}
}
Promise.all([GM_getValue('highlight_config')]).then(function(data) {
console.log('Ver.7.6.0: Console debug log. Read the value of the variable highlight_config.');
if (data[0] !== undefined) {
highlight_config = data[0];
if ((highlight_config.auto_check_in_enable === undefined) || (highlight_config.max_link_number === undefined) || (highlight_config.extract_new_enable === undefined)) {
if (highlight_config.auto_check_in_enable === undefined) {
highlight_config.auto_check_in_enable = true
}
if (highlight_config.max_link_number === undefined) {
highlight_config.max_link_number = 5
}
if (highlight_config.extract_new_enable === undefined) {
highlight_config.extract_new_enable = true
}
GM_setValue('highlight_config', highlight_config);
console.log('Ver.7.10.0: Console debug log. Handle older version script updates.')
}
}
try {
GM_registerMenuCommand('好孩子看得见 - 设置', function() {
if (document.getElementById(SETTING_VALUE.WRAP_DIV[0])) {
if (document.getElementById(SETTING_VALUE.WRAP_DIV[0]).style.display === 'none') {
document.getElementById(SETTING_VALUE.WRAP_DIV[0]).style.display = 'block'
} else {
document.getElementById(SETTING_VALUE.WRAP_DIV[0]).style.display = 'none'
}
} else {
document.body.appendChild(create_Setting_Tag())
}
})
} catch (e) {
console.log('Ver.7.6.0: Script error. GM_registerMenuCommand abnormal.');
console.log(e)
}
init()
}).
catch (function(except) {
console.log('Ver.7.6.0: Fatal script error!');
console.log(except)
})
})();