// ==UserScript==
// @name 手机百度贴吧自动展开楼层
// @namespace http://tampermonkey.net/
// @homepage https://gf.qytechs.cn/scripts/445657
// @version 4.0
// @description 有时候用手机的浏览器打开百度贴吧,只想看一眼就走,并不想打开APP,这个脚本用于帮助用户自动展开楼层。注意:只支持手机浏览器,测试环境为Iceraven+Tampermonkey
// @author voeoc
// @icon https://tieba.baidu.com/favicon.ico
// @match https://tieba.baidu.com/*
// @match https://jump2.bdimg.com/*
// @match https://tiebac.baidu.com/*
// @exclude https://tieba.baidu.com/index/*
// @exclude https://jump2.bdimg.com/index/*
// @exclude https://tiebac.baidu.com/index/*
// @exclude https://*/index/*
// @exclude https://*/index/tbwise/feed
// @exclude https://*/f?kw=*
// @connect tieba.baidu.com
// @connect jump2.bdimg.com
// @connect tiebac.baidu.com
// @grant unsafeWindow
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_listValues
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @grant GM_getResourceText
// @run-at document-start
// @noframes
// @license MIT
// ==/UserScript==
(function () {
'use strict';
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
var SettingsPanel;
(function (SettingsPanel) {
class SettingValue {
constructor(key, defaultValue) {
this.keyGM = key;
this.defaultValue = defaultValue;
}
get value() {
return GM_getValue(this.keyGM, this.defaultValue);
}
set value(newVal) {
GM_setValue(this.keyGM, newVal);
}
}
SettingsPanel.SettingValue = SettingValue;
class SettingValueSwitch extends SettingValue {
constructor(keyGM, defaultValue) {
super(keyGM, defaultValue);
}
}
SettingsPanel.SettingValueSwitch = SettingValueSwitch;
class SettingValueRange extends SettingValue {
constructor(keyGM, defaultValue, range, step) {
super(keyGM, defaultValue);
this.range = range;
this.step = step;
}
get value() {
return super.value;
}
set value(newVal) {
const thisClass = this;
if (thisClass.range.min > newVal) {
super.value = thisClass.range.min;
}
else if (thisClass.range.max < newVal) {
super.value = thisClass.range.max;
}
else {
super.value = newVal;
}
}
checkRange(value) {
const thisClass = this;
return thisClass.range.min <= value && value <= thisClass.range.max;
}
}
SettingsPanel.SettingValueRange = SettingValueRange;
})(SettingsPanel || (SettingsPanel = {}));
var CSS_BAIDU = ":root {\r\n --str_lzl_page_transition_duration: 0.2s;\r\n}\r\n.open-app-text-real {\r\n display: block !important;\r\n -webkit-box-flex: 0;\r\n -webkit-flex: none;\r\n -ms-flex: none;\r\n flex: none;\r\n font-size: .13rem;\r\n color: #614ec2;\r\n}\r\n.open-app-text-real.error {\r\n color: #ff3366 !important;\r\n text-decoration: line-through;\r\n}\r\n\r\n@keyframes rotate3d {\r\n 0%{-webkit-transform:rotate3d(1, 0, 0, 0deg);}\r\n 25%{-webkit-transform:rotate3d(1, 0, 0, 90deg);}\r\n 50%{-webkit-transform:rotate3d(1, 0, 0, 180deg);}\r\n 75%{-webkit-transform:rotate3d(1, 0, 0, 270deg);}\r\n 100%{-webkit-transform:rotate3d(1, 0, 0, 360deg);}\r\n}\r\n.open-app-guide.loading {\r\n animation: rotate3d 0.5s linear infinite;\r\n pointer-events: none;\r\n}\r\n.VOEOC_DIALOG {\r\n position: fixed;\r\n z-index: 999;\r\n height: 0;\r\n visibility: hidden;\r\n transition: visibility var(--str_lzl_page_transition_duration);\r\n}\r\n.VOEOC_DIALOG.VOEOC_DIALOG_SHOW {\r\n display: block;\r\n height: 100%;\r\n visibility: visible;\r\n}\r\n#VOEOC-ID-LZLPAGE {\r\n overscroll-behavior: none;\r\n width: 100%;\r\n overflow: scroll;\r\n}\r\n#VOEOC-ID-LZLPAGE::-webkit-scrollbar { width: 0 !important }\r\n#VOEOC-ID-LZLPAGEBACKGROUND {\r\n position: fixed;\r\n width: 100%;\r\n height: 200%;\r\n background-color: #00000077;\r\n z-index: 1;\r\n opacity: 0;\r\n transition: opacity var(--str_lzl_page_transition_duration);\r\n}\r\n.VOEOC-CLASSNAME-LZLPAGEIFRAME {\r\n position: fixed;\r\n width: 100%;\r\n height: 0%;\r\n background-color: #ffffff;\r\n bottom: 0;\r\n transition: height var(--str_lzl_page_transition_duration);\r\n overflow: hidden;\r\n}\r\n#VOEOC-ID-LZLPAGE.loading, #VOEOC-ID-LZLPAGE.loading > .VOEOC-CLASSNAME-LZLPAGEIFRAME {\r\n pointer-events: none;\r\n}\r\n#VOEOC-ID-LZLPAGE.VOEOC_DIALOG_SHOW > .VOEOC-CLASSNAME-LZLPAGEIFRAME.VOEOC_DIALOG_SHOW {\r\n height: 80%;\r\n}\r\n#VOEOC-ID-LZLPAGE.VOEOC_DIALOG_SHOW > #VOEOC-ID-LZLPAGEBACKGROUND {\r\n opacity: 1;\r\n}\r\n#VOEOC-ID-LZLPAGE.VOEOC_DIALOG_SHOW > .lzl-reload-btn {\r\n margin-left: 0.1rem;\r\n}\r\n.lzl-nav-btn.lzl-reload-btn {\r\n position:fixed;\r\n top:20%;\r\n margin: 0.1rem 0.1rem 0.1rem -0.5rem;\r\n transition: margin-left var(--str_lzl_page_transition_duration);\r\n}\r\n.lzl-nav-btn {\r\n width: .32rem;\r\n height: .32rem;\r\n display: flex;\r\n background-color:#d0d0d04a;\r\n border-radius:50%;\r\n}\r\n.lzl-nav-btn > svg{\r\n position: relative;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n}\r\n@keyframes rotate {\r\n 0%{-webkit-transform:rotate(0deg);}\r\n 25%{-webkit-transform:rotate(90deg);}\r\n 50%{-webkit-transform:rotate(180deg);}\r\n 75%{-webkit-transform:rotate(270deg);}\r\n 100%{-webkit-transform:rotate(360deg);}\r\n}\r\n#VOEOC-ID-LZLPAGE.loading > .lzl-reload-btn {\r\n animation: rotate 0.2s linear infinite;\r\n pointer-events: none;\r\n }\r\n#VOEOC-ID-LZLPAGE.error > .lzl-reload-btn {\r\n background-color: #ff000070 !important;\r\n }\r\n.slide-down-btn{\r\n position: fixed;\r\n top: 20%;\r\n left: 50%;\r\n margin-left: -0.32rem;\r\n opacity: 0;\r\n transition: opacity,margin-top,background-color 0.1s;\r\n}\r\n.slide-down-btn.confirm{\r\n background-color: #0000004a;\r\n}\r\n#VOEOC-ID-SETTING-FRAME {\r\n height: 100%;\r\n width: 100%;\r\n position: fixed;\r\n z-index: 9999;\r\n display: block;\r\n left: 0;\r\n top: 0;\r\n overscroll-behavior: none;\r\n background-color: white;\r\n}\r\n\r\n.VOEOC_DIALOG_BACKGROUND {\r\n position: fixed;\r\n width: 100%;\r\n height: 101%;\r\n left: 0;\r\n top: 0;\r\n z-index: 9999;\r\n overflow: scroll;\r\n overscroll-behavior: none;\r\n background-color: #00000077;\r\n transition: opacity var(--str_lzl_page_transition_duration);\r\n}\r\n.VOEOC_DIALOG_BACKGROUND::before {\r\n content: \" \";\r\n width: 100%;\r\n height: 101%;\r\n display: block;\r\n overscroll-behavior: none;\r\n}\r\n.VOEOC_DIALOG_BACKGROUND::-webkit-scrollbar,\r\n.VOEOC_DIALOG_BACKGROUND::before::-webkit-scrollbar {\r\n width: 0 !important;\r\n}";
var CSS_REMOVE = ".comment-box, .only-lz, .nav-bar-bottom, .open-app, .more-image-desc {\r\n display: none !important;\r\n}\r\n.logo-wrapper {\r\n visibility: hidden !important;\r\n pointer-events: none !important;\r\n height: 0;\r\n}\r\n.open-app-text {\r\n display: none !important;\r\n}";
var _Stack_items;
const STR_DEBUG_LABEL_ERROR = "error";
class Stack {
constructor() {
_Stack_items.set(this, void 0);
__classPrivateFieldSet(this, _Stack_items, [], "f");
}
push(element) {
__classPrivateFieldGet(this, _Stack_items, "f").push(element);
}
;
pop() {
return __classPrivateFieldGet(this, _Stack_items, "f").pop();
}
;
peek() {
return __classPrivateFieldGet(this, _Stack_items, "f")[__classPrivateFieldGet(this, _Stack_items, "f").length - 1];
}
;
isEmpty() {
return __classPrivateFieldGet(this, _Stack_items, "f").length === 0;
}
;
size() {
return __classPrivateFieldGet(this, _Stack_items, "f").length;
}
;
clear() {
__classPrivateFieldSet(this, _Stack_items, [], "f");
}
;
}
_Stack_items = new WeakMap();
function DEBUGLOG(msg, label = "", dirObj) {
{
return;
}
}
function ASSERT(condition, msg) {
if (!condition) {
throw new Error(`${msg}`);
}
}
function AUTO_CATCH_ERROR(func, msg, dirObj) {
try {
func();
}
catch (e) {
if (msg) {
void 0;
}
else {
void 0;
}
if (dirObj) {
void 0;
}
}
}
function WAIT_ELEMENT_LOADED_ASYNC(selector, { TIME_OUT = 100, searchFunc = document.querySelector.bind(document), millisecond = 50 } = {}) {
return new Promise((resolve, reject) => {
let findTimeNum = 0;
let timer = setInterval(() => {
let element = searchFunc(selector);
if (element != null) {
clearInterval(timer);
resolve(element);
return;
}
findTimeNum++;
if (TIME_OUT < findTimeNum) {
clearInterval(timer);
reject(new Error(`${selector}=${element}`));
}
}, millisecond);
});
}
function WAIT_ELEMENT_LOADED(selector, func, { TIME_OUT = 100, searchFunc = document.querySelector.bind(document), finalFunc = () => {
}, millisecond = 50 } = {}) {
WAIT_ELEMENT_LOADED_ASYNC(selector, { TIME_OUT, searchFunc, millisecond }).then(func, function () {
if (finalFunc) {
finalFunc();
}
});
}
function WAIT_DOCUMENT_READY(documentNode = document) {
return new Promise((resolve, reject) => {
document.addEventListener("readystatechange", function onDocumentReady(event) {
if (documentNode.readyState === "complete") {
document.removeEventListener("readystatechange", onDocumentReady);
resolve(true);
}
});
});
}
function MATCH_REG(regExp, str) {
let regExpMatchArray = regExp.exec(str);
if (regExpMatchArray && regExpMatchArray.length > 1) {
return regExpMatchArray[1].trim();
}
return undefined;
}
function INSERT_CSS(cssText, documentNode = document) {
let newStyleNode = documentNode.createElement('style');
newStyleNode.appendChild(documentNode.createTextNode(cssText));
let head = documentNode.getElementsByTagName('head')[0];
head.appendChild(newStyleNode);
}
class IframeUtils {
constructor(parentNode, id) {
this.iframeNode = parentNode.ownerDocument.createElement("iframe");
this.iframeNode.id = id;
this.parentNode = parentNode;
this.parentNode.appendChild(this.iframeNode);
}
get contentDocument() {
return this.iframeNode.contentDocument;
}
get contentWindow() {
return this.iframeNode.contentWindow;
}
get ownerDocument() {
return this.iframeNode.ownerDocument;
}
writeDoc(data) {
try {
this.contentDocument.open().write(data);
}
finally {
this.contentDocument.close();
}
}
}
function GET_INPUT_ELEMENT_VALUE(inputElement) {
switch (inputElement.type) {
case "checkbox":
return inputElement.checked;
case "range":
return Number(inputElement.value);
default:
return inputElement.value;
}
}
function SET_INPUT_ELEMENT_VALUE(inputElement, value) {
switch (inputElement.type) {
case "checkbox":
inputElement.checked = value;
break;
default:
inputElement.value = String(value);
break;
}
}
function STOPPROPAGATION(event) {
if (event.stopPropagation) {
event.stopPropagation();
}
else {
event.cancelBubble = true;
}
return false;
}
function GET_URL_ATTR(url, attrName) {
return MATCH_REG(RegExp(`${attrName}=([^&]*)&?`, 'i'), url);
}
var _a$1, _HistoryStateManager_showDialogList, _HistoryStateManager_instance;
class VoeocDialog {
constructor(historyState, dialogNode) {
this.historyState = historyState;
this.dialogNode = dialogNode;
this.setDialogTag();
}
static initHistoryStateManager() {
HistoryStateManager.getInstance().init();
}
getHistoryState() {
return this.historyState;
}
getDialogNode() {
return this.dialogNode;
}
setDialogTag() {
const thisClass = this;
if (thisClass.dialogNode && !thisClass.dialogNode.classList.contains(VoeocDialog.STR_CLASSNAME_DIALOG)) {
thisClass.dialogNode.classList.add(VoeocDialog.STR_CLASSNAME_DIALOG);
}
}
show() {
var _b, _c;
const thisClass = this;
(_c = (_b = thisClass.dialogNode) === null || _b === void 0 ? void 0 : _b.classList) === null || _c === void 0 ? void 0 : _c.add(VoeocDialog.STR_CLASSNAME_SHOW_TAG);
}
hide() {
var _b, _c;
const thisClass = this;
(_c = (_b = thisClass.dialogNode) === null || _b === void 0 ? void 0 : _b.classList) === null || _c === void 0 ? void 0 : _c.remove(VoeocDialog.STR_CLASSNAME_SHOW_TAG);
}
isShown() {
var _b, _c;
const thisClass = this;
return ((_c = (_b = thisClass.dialogNode) === null || _b === void 0 ? void 0 : _b.classList) === null || _c === void 0 ? void 0 : _c.contains(VoeocDialog.STR_CLASSNAME_SHOW_TAG)) || false;
}
open() {
const thisClass = this;
HistoryStateManager.getInstance().showNewDialog(thisClass);
}
close() {
HistoryStateManager.getInstance().closeLastDialog();
}
}
VoeocDialog.STR_CLASSNAME_DIALOG = "VOEOC_DIALOG";
VoeocDialog.STR_CLASSNAME_SHOW_TAG = "VOEOC_DIALOG_SHOW";
class HistoryStateManager {
constructor() {
_HistoryStateManager_showDialogList.set(this, void 0);
}
static getInstance() {
if (!__classPrivateFieldGet(HistoryStateManager, _a$1, "f", _HistoryStateManager_instance)) {
__classPrivateFieldSet(HistoryStateManager, _a$1, new HistoryStateManager(), "f", _HistoryStateManager_instance);
}
return __classPrivateFieldGet(HistoryStateManager, _a$1, "f", _HistoryStateManager_instance);
}
init() {
const thisClass = this;
__classPrivateFieldSet(thisClass, _HistoryStateManager_showDialogList, new Stack(), "f");
window.addEventListener("popstate", function () {
var _b, _c;
if ((_b = __classPrivateFieldGet(thisClass, _HistoryStateManager_showDialogList, "f")) === null || _b === void 0 ? void 0 : _b.isEmpty()) {
return;
}
if ((_c = __classPrivateFieldGet(thisClass, _HistoryStateManager_showDialogList, "f")) === null || _c === void 0 ? void 0 : _c.peek().isShown()) {
thisClass.closeLastDialog();
}
}, false);
}
showNewDialog(voeocDialog) {
var _b, _c, _d;
const thisClass = this;
if (!voeocDialog.isShown()) {
voeocDialog.show();
window.history.pushState(voeocDialog.getHistoryState(), (_c = (_b = voeocDialog.getHistoryState()) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : "");
(_d = __classPrivateFieldGet(thisClass, _HistoryStateManager_showDialogList, "f")) === null || _d === void 0 ? void 0 : _d.push(voeocDialog);
}
}
closeLastDialog() {
var _b, _c, _d, _e;
const thisClass = this;
if ((_b = __classPrivateFieldGet(thisClass, _HistoryStateManager_showDialogList, "f")) === null || _b === void 0 ? void 0 : _b.isEmpty()) {
return;
}
let hiddenDialog = (_c = __classPrivateFieldGet(thisClass, _HistoryStateManager_showDialogList, "f")) === null || _c === void 0 ? void 0 : _c.peek();
if (hiddenDialog === null || hiddenDialog === void 0 ? void 0 : hiddenDialog.isShown()) {
if (window.history.state &&
window.history.state.id &&
window.history.state.id === ((_d = hiddenDialog === null || hiddenDialog === void 0 ? void 0 : hiddenDialog.getHistoryState()) === null || _d === void 0 ? void 0 : _d.id)) {
window.history.back();
return;
}
hiddenDialog === null || hiddenDialog === void 0 ? void 0 : hiddenDialog.hide();
(_e = __classPrivateFieldGet(thisClass, _HistoryStateManager_showDialogList, "f")) === null || _e === void 0 ? void 0 : _e.pop();
}
}
}
_a$1 = HistoryStateManager, _HistoryStateManager_showDialogList = new WeakMap();
_HistoryStateManager_instance = { value: void 0 };
var HTML_SETTINGS_DIALOG = "<!doctype html><html lang=en><head><meta charset=UTF-8><meta name=viewport content=\"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no\"><title>Title</title><style>html{background-color:transparent;font-size:16px}label{user-select:none;font-size:16px!important;color:#000!important;display:block}span{font-size:16px}hr{height:.5rem;background-color:transparent;border:none;border-top:#8f8f8f ridge .2rem}del{color:gray}.mul_switch{display:none}.disable{opacity:.5!important;pointer-events:none!important;color:gray!important}.col_space{min-height:5rem;height:100%;flex-grow:100}.voeoc-setting-dialog{height:100%;width:100%;position:fixed;z-index:9999;overflow-y:auto;justify-content:center;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;overflow-x:hidden;transition:background-color .1s;overscroll-behavior:none}.voeoc-setting-dialog.show{height:100%}.voeoc-setting-title{width:100%;height:fit-content;padding:.5rem;background-color:rgba(0,0,0,.25)}.voeoc-setting-content{display:flex;flex-direction:column;flex-grow:10;background-color:rgba(255,255,255,.24);padding:0;min-height:101%}.voeoc-setting-value-list{display:flex;flex-direction:column;flex-grow:10;text-align:left;padding:1rem}.voeoc-setting-value-list>.switch{box-sizing:content-box;border:transparent solid 5px}.voeoc-swal-input-checkbox{width:100%;height:fit-content;display:block;user-select:none}.voeoc-setting-button-pad{width:fit-content;float:right;margin:0 .13rem 0 auto}.voeoc-setting-button-pad>*{display:inline-block;padding:.01rem;margin:.05rem}</style><style>/*!\r\n * Materialize v1.0.0-rc.2 (http://materializecss.com)\r\n * Copyright 2014-2017 Materialize\r\n * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)\r\n */.teal{background-color:#009688!important}.teal.lighten-2{background-color:#4db6ac!important}/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}nav{display:block}a{background-color:transparent;-webkit-text-decoration-skip:objects}input{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}input{overflow:visible}[type=checkbox]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}html{-webkit-box-sizing:border-box;box-sizing:border-box}*,:after,:before{-webkit-box-sizing:inherit;box-sizing:inherit}input{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif}ul:not(.browser-default){padding-left:0;list-style-type:none}ul:not(.browser-default)>li{list-style-type:none}a{color:#039be5;text-decoration:none;-webkit-tap-highlight-color:transparent}nav{-webkit-box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2)}.collection{margin:.5rem 0 1rem 0;border:1px solid #e0e0e0;border-radius:2px;overflow:hidden;position:relative}.collection .collection-item{background-color:#fff;line-height:1.5rem;padding:10px 20px;margin:0;border-bottom:1px solid #e0e0e0}.collection .collection-item:last-child{border-bottom:none}.left{float:left!important}.right{float:right!important}input[type=range]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}nav{color:#fff;background-color:#ee6e73;width:100%;height:56px;line-height:56px}nav a{color:#fff}nav .nav-wrapper{position:relative;height:100%}nav .brand-logo{position:absolute;color:#fff;display:inline-block;font-size:2.1rem;padding:0}@media only screen and (max-width:992px){nav .brand-logo{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}nav .brand-logo.left{padding:0;-webkit-transform:none;transform:none}nav .brand-logo.left{left:.5rem}}nav ul{margin:0}nav ul li{-webkit-transition:background-color .3s;transition:background-color .3s;float:left;padding:0}nav ul a{-webkit-transition:background-color .3s;transition:background-color .3s;font-size:1rem;color:#fff;display:block;padding:0 15px;cursor:pointer}nav ul a:hover{background-color:rgba(0,0,0,.1)}.navbar-fixed{position:relative;height:56px;z-index:997}.navbar-fixed nav{position:fixed}@media only screen and (min-width:601px){nav{height:64px;line-height:64px}.navbar-fixed{height:64px}}a{text-decoration:none}html{line-height:1.5;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;font-weight:400;color:rgba(0,0,0,.87)}@media only screen and (min-width:0){html{font-size:14px}}@media only screen and (min-width:992px){html{font-size:14.5px}}@media only screen and (min-width:1200px){html{font-size:15px}}/*!\r\n * Waves v0.6.0\r\n * http://fian.my.id/Waves\r\n *\r\n * Copyright 2014 Alfiana E. Sibuea and other contributors\r\n * Released under the MIT license\r\n * https://github.com/fians/Waves/blob/master/LICENSE\r\n */label{font-size:.8rem;color:#9e9e9e}::-webkit-input-placeholder{color:#d1d1d1}::-moz-placeholder{color:#d1d1d1}:-ms-input-placeholder{color:#d1d1d1}::-ms-input-placeholder{color:#d1d1d1}::placeholder{color:#d1d1d1}[type=radio]:not(:checked){position:absolute;opacity:0;pointer-events:none}[type=radio]:not(:checked)+span{position:relative;padding-left:35px;cursor:pointer;display:inline-block;height:25px;line-height:25px;font-size:1rem;-webkit-transition:.28s ease;transition:.28s ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[type=radio]:not(:checked)+span:after,[type=radio]:not(:checked)+span:before{border-radius:50%}[type=radio]:not(:checked)+span:after,[type=radio]:not(:checked)+span:before{border:2px solid #5a5a5a}[type=radio]:not(:checked)+span:after{-webkit-transform:scale(0);transform:scale(0)}[type=radio]:disabled:not(:checked)+span:before{background-color:transparent;border-color:rgba(0,0,0,.42)}[type=radio]:disabled:not(:checked)+span:before{border-color:rgba(0,0,0,.42)}[type=checkbox]:checked,[type=checkbox]:not(:checked){position:absolute;opacity:0;pointer-events:none}[type=checkbox]:not(:checked):disabled+span:not(.lever):before{border:none;background-color:rgba(0,0,0,.42)}[type=checkbox]:checked:disabled+span:before{border-right:2px solid rgba(0,0,0,.42);border-bottom:2px solid rgba(0,0,0,.42)}[type=checkbox].filled-in:not(:checked)+span:not(.lever):before{width:0;height:0;border:3px solid transparent;left:6px;top:10px;-webkit-transform:rotateZ(37deg);transform:rotateZ(37deg);-webkit-transform-origin:100% 100%;transform-origin:100% 100%}[type=checkbox].filled-in:not(:checked)+span:not(.lever):after{height:20px;width:20px;background-color:transparent;border:2px solid #5a5a5a;top:0;z-index:0}[type=checkbox].filled-in:disabled:not(:checked)+span:not(.lever):before{background-color:transparent;border:2px solid transparent}[type=checkbox].filled-in:disabled:not(:checked)+span:not(.lever):after{border-color:transparent;background-color:#949494}.switch,.switch *{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.switch label{cursor:pointer}.switch label input[type=checkbox]{opacity:0;width:0;height:0}.switch label input[type=checkbox]:checked+.lever{background-color:#84c7c1}.switch label input[type=checkbox]:checked+.lever:after,.switch label input[type=checkbox]:checked+.lever:before{left:18px}.switch label input[type=checkbox]:checked+.lever:after{background-color:#26a69a}.switch label .lever{content:\"\";display:inline-block;position:relative;width:36px;height:14px;background-color:rgba(0,0,0,.38);border-radius:15px;margin-right:10px;-webkit-transition:background .3s ease;transition:background .3s ease;vertical-align:middle;margin:0 16px}.switch label .lever:after,.switch label .lever:before{content:\"\";position:absolute;display:inline-block;width:20px;height:20px;border-radius:50%;left:0;top:-3px;-webkit-transition:left .3s ease,background .3s ease,-webkit-box-shadow .1s ease,-webkit-transform .1s ease;transition:left .3s ease,background .3s ease,-webkit-box-shadow .1s ease,-webkit-transform .1s ease;transition:left .3s ease,background .3s ease,box-shadow .1s ease,transform .1s ease;transition:left .3s ease,background .3s ease,box-shadow .1s ease,transform .1s ease,-webkit-box-shadow .1s ease,-webkit-transform .1s ease}.switch label .lever:before{background-color:rgba(38,166,154,.15)}.switch label .lever:after{background-color:#f1f1f1;-webkit-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}input[type=checkbox]:checked:not(:disabled).tabbed:focus~.lever::before,input[type=checkbox]:checked:not(:disabled)~.lever:active::before{-webkit-transform:scale(2.4);transform:scale(2.4);background-color:rgba(38,166,154,.15)}input[type=checkbox]:not(:disabled).tabbed:focus~.lever::before,input[type=checkbox]:not(:disabled)~.lever:active:before{-webkit-transform:scale(2.4);transform:scale(2.4);background-color:rgba(0,0,0,.08)}.range-field{position:relative}input[type=range]{cursor:pointer}input[type=range]{position:relative;background-color:transparent;border:none;outline:0;width:100%;margin:15px 0;padding:0}input[type=range]:focus{outline:0}input[type=range]{-webkit-appearance:none}input[type=range]::-webkit-slider-runnable-track{height:3px;background:#c2c0c2;border:none}input[type=range]::-webkit-slider-thumb{border:none;height:14px;width:14px;border-radius:50%;background:#26a69a;-webkit-transition:-webkit-box-shadow .3s;transition:-webkit-box-shadow .3s;transition:box-shadow .3s;transition:box-shadow .3s,-webkit-box-shadow .3s;-webkit-appearance:none;background-color:#26a69a;-webkit-transform-origin:50% 50%;transform-origin:50% 50%;margin:-5px 0 0 0}input[type=range]{border:1px solid #fff}input[type=range]::-moz-range-track{height:3px;background:#c2c0c2;border:none}input[type=range]::-moz-focus-inner{border:0}input[type=range]::-moz-range-thumb{border:none;height:14px;width:14px;border-radius:50%;background:#26a69a;-webkit-transition:-webkit-box-shadow .3s;transition:-webkit-box-shadow .3s;transition:box-shadow .3s;transition:box-shadow .3s,-webkit-box-shadow .3s;margin-top:-5px}input[type=range]:-moz-focusring{outline:1px solid #fff;outline-offset:-1px}input[type=range]::-ms-track{height:3px;background:0 0;border-color:transparent;border-width:6px 0;color:transparent}input[type=range]::-ms-fill-lower{background:#777}input[type=range]::-ms-fill-upper{background:#ddd}input[type=range]::-ms-thumb{border:none;height:14px;width:14px;border-radius:50%;background:#26a69a;-webkit-transition:-webkit-box-shadow .3s;transition:-webkit-box-shadow .3s;transition:box-shadow .3s;transition:box-shadow .3s,-webkit-box-shadow .3s}</style></head><body><div class=navbar-fixed><nav><div class=\"lighten-2 nav-wrapper teal\"><div class=\"brand-logo left\">设置</div><ul class=right><li><a id=btnSaveAndClose href=javascript:void(0);>保存并刷新</a></li><li><a id=btnSave href=javascript:void(0);>保存</a></li><li><a id=btnClose href=javascript:void(0);>取消</a></li></ul></div></nav></div><form><div class=voeoc-setting-content><div class=collection><div class=\"collection-item switch\"><label><input name=isAutoExpand type=checkbox> <span class=lever></span> <span>载入时自动展开楼中楼</span></label></div><div class=\"collection-item switch\"><label class=switch><input name=isRemaindAutoExpand type=checkbox> <span class=lever></span> 剩余评论过少时展开楼中楼</label></div><label class=\"range-field collection-item\"><span>楼中楼一次展开的行数(<span>0</span>):</span> <span class=range-field><input name=eachExpandSize type=range min=10 max=30 step=1/ ></span></label> <label class=\"range-field collection-item\"><span>自动展开次数(<span>0</span>):</span> <span class=range-field><input name=autoExpandNum type=range min=1 max=5 step=1/ ></span></label> <label class=\"range-field collection-item\"><span>剩余评论自动展开(<span>0</span>):</span> <span class=range-field><input name=remaindAutoExpandSize type=range min=0 max=20 step=1/ ></span></label></div><div class=col_space></div></div></form></body></html>";
const STR_ID_SETTING_FRAME = "VOEOC-ID-SETTING-FRAME";
const STR_CLASSNAME_DIALOG_BACKGROUND = "VOEOC_DIALOG_BACKGROUND";
function SettingFrameInit(iframeUtils) {
const contentDocument = iframeUtils.contentDocument;
function onRangeChange() {
const numNode = this.parentNode.previousElementSibling.querySelector("span");
numNode.innerHTML = this.value;
}
function onMulSwitchChange() {
const radioElements = this.parentNode.querySelectorAll("input[type=radio]");
if (radioElements[0]) {
radioElements[0].checked = this.checked;
}
if (radioElements[1]) {
radioElements[1].checked = !this.checked;
}
}
function bindSwitch(switchElement, bindElement) {
switchElement.onchange = () => {
if (switchElement.checked) {
bindElement.classList.remove("disable");
}
else {
bindElement.classList.add("disable");
}
};
switchElement.onchange();
}
function getElementByName(name) {
return contentDocument.querySelector(`input[name=${name}]`);
}
function getAllInputElements(names) {
const allInputElements = new Map();
for (let name of names) {
allInputElements.set(name, getElementByName(name));
}
return allInputElements;
}
(function () {
const rangeElements = contentDocument.querySelectorAll("input[type=range]");
rangeElements.forEach((rangeElement) => {
rangeElement.onchange = onRangeChange;
rangeElement.oninput = onRangeChange;
rangeElement.onchange(undefined);
});
const mulSwitchElements = contentDocument.querySelectorAll("input.mul_switch");
mulSwitchElements.forEach((mulSwitchElement) => {
mulSwitchElement.onchange = onMulSwitchChange;
mulSwitchElement.onchange(undefined);
});
const allInputElements = getAllInputElements([
"isClickToExpandLzlPage",
"isLongClickToExpandLzlPage",
"isAutoExpand",
"isRemaindAutoExpand",
"eachExpandSize",
"autoExpandNum",
"remaindAutoExpandSize",
"lzlCacheSize"
]);
bindSwitch(allInputElements.get("isAutoExpand"), allInputElements.get("autoExpandNum").parentElement.parentElement);
bindSwitch(allInputElements.get("isRemaindAutoExpand"), allInputElements.get("remaindAutoExpandSize").parentElement.parentElement);
})();
}
class SettingsDialog extends VoeocDialog {
constructor(parentNode, settingDatas) {
super({
title: "设置窗口",
id: "SettingsDialog"
}, parentNode.ownerDocument.createElement("div"));
this.dialogNode.classList.add(STR_CLASSNAME_DIALOG_BACKGROUND);
parentNode.appendChild(this.dialogNode);
const iframeUtils = new IframeUtils(this.dialogNode, STR_ID_SETTING_FRAME);
iframeUtils.iframeNode.ontouchmove = STOPPROPAGATION;
iframeUtils.iframeNode.onpointermove = STOPPROPAGATION;
iframeUtils.iframeNode.onscroll = STOPPROPAGATION;
iframeUtils.writeDoc(HTML_SETTINGS_DIALOG);
SettingFrameInit(iframeUtils);
const contentDocument = iframeUtils.contentDocument;
const btnSaveAndClose = contentDocument.getElementById("btnSaveAndClose");
const btnSave = contentDocument.getElementById("btnSave");
const btnClose = contentDocument.getElementById("btnClose");
const allInputElements = new Map();
const originSettingsData = new Map(Object.entries(settingDatas));
originSettingsData.forEach((settingValue, key) => {
void 0;
const inputElement = contentDocument.querySelector(`input[name=${key}]`);
if (inputElement) {
allInputElements.set(key, inputElement);
SET_INPUT_ELEMENT_VALUE(inputElement, settingValue.value);
inputElement.onchange(undefined);
}
});
btnSaveAndClose.onclick = () => {
btnSave.click();
btnClose.click();
window.location.reload();
};
btnSave.onclick = () => {
allInputElements.forEach((element, key) => {
const settingValue = originSettingsData.get(key);
if (settingValue) {
settingValue.value = GET_INPUT_ELEMENT_VALUE(element);
}
});
};
btnClose.onclick = () => {
this.close();
};
}
}
const STR_VOEOCMARK = "VOEOCMARK";
const VOEOC_REG = {
POSTPAGE: RegExp(`postPage\?(?=.*tid\=)(?=.*postAuthorId\=)(?=.*forumId\=)`, 'i'),
LZLPAGE: RegExp(`lzlPage\?(?=.*floor\=)(?=.*pid\=)`, 'i'),
PBDATA: RegExp(`getPbData\?.*pn\=.*`, 'i'),
};
var PAGE_TYPE;
(function (PAGE_TYPE) {
PAGE_TYPE[PAGE_TYPE["UNKNOW"] = 0] = "UNKNOW";
PAGE_TYPE[PAGE_TYPE["MAINPAGE"] = 1] = "MAINPAGE";
PAGE_TYPE[PAGE_TYPE["POSTPAGE"] = 2] = "POSTPAGE";
PAGE_TYPE[PAGE_TYPE["LZLPAGE"] = 3] = "LZLPAGE";
PAGE_TYPE[PAGE_TYPE["TIEBAPAGE"] = 4] = "TIEBAPAGE";
})(PAGE_TYPE || (PAGE_TYPE = {}));
class MainPage {
constructor() {
this.currentHash = window.location.hash;
this.currentScrollYPos = NaN;
this.storagePageData = {
tieNode: undefined,
tiebaNameNode: undefined,
lzId: "",
floorDataList: new Map(),
someKey: {
host: "tieba.baidu_mobile_expand.com",
tid: "",
postAuthorId: "",
forumId: "",
source: "",
}
};
const thisClass = this;
AUTO_CATCH_ERROR(() => {
(function () {
let oldXHR = unsafeWindow.XMLHttpRequest;
unsafeWindow.XMLHttpRequest = function () {
let realXHR = new oldXHR();
realXHR.addEventListener('readystatechange', function () {
DEBUGLOG(realXHR.responseURL, "realXHR.responseURL");
if (VOEOC_REG.PBDATA.test(realXHR.responseURL) && realXHR.response !== "") {
thisClass.parsePbData(realXHR.response, realXHR.responseURL);
}
}, false);
return realXHR;
};
})();
unsafeWindow.onscroll = function () {
thisClass.checkUrlHashChange();
if (MainPage.GET_PAGE_TYPE() === PAGE_TYPE.POSTPAGE) {
if (window.scrollY !== 0) {
thisClass.currentScrollYPos = window.scrollY;
}
}
};
unsafeWindow.onhashchange = function () {
thisClass.checkUrlHashChange();
};
});
}
tryCollectSomeKey() {
const thisClass = this;
thisClass.storagePageData.someKey.host = window.location.hostname;
let tid;
let postAuthorId;
let forumId;
let source;
if ((tid = GET_URL_ATTR(thisClass.currentHash, "tid")) ||
((tid = window.location.pathname.replace("/p/", "")) && !isNaN(tid))) {
thisClass.storagePageData.someKey.tid = tid;
}
if ((postAuthorId = GET_URL_ATTR(thisClass.currentHash, "postAuthorId")) !== undefined) {
thisClass.storagePageData.someKey.postAuthorId = postAuthorId;
}
if ((forumId = GET_URL_ATTR(thisClass.currentHash, "forumId")) !== undefined) {
thisClass.storagePageData.someKey.forumId = forumId;
}
if ((source = GET_URL_ATTR(thisClass.currentHash, "source")) !== undefined) {
thisClass.storagePageData.someKey.source = source;
}
}
listenReady(callback) {
WAIT_DOCUMENT_READY().then(callback);
}
static GET_PAGE_TYPE() {
let isTiePage = false;
if (RegExp(`^/f`).test(window.location.pathname)) {
if (GET_URL_ATTR(window.location.href, "kw")) {
return PAGE_TYPE.TIEBAPAGE;
}
else if (GET_URL_ATTR(window.location.href, "kz")) {
isTiePage = true;
}
}
else if (RegExp(`^/p`).test(window.location.pathname)) {
isTiePage = true;
}
if (isTiePage) {
let hash = window.location.hash;
if (hash === "" || hash === "#/") {
return PAGE_TYPE.MAINPAGE;
}
else if (VOEOC_REG.POSTPAGE.test(hash)) {
return PAGE_TYPE.POSTPAGE;
}
else if (VOEOC_REG.LZLPAGE.test(hash)) {
return PAGE_TYPE.LZLPAGE;
}
}
return PAGE_TYPE.UNKNOW;
}
static REPLACE_HASH(hash) {
window.location.replace(MainPage.GET_MAIN_URL() + hash);
}
static GET_MAIN_URL() {
return window.location.href.replace(window.location.hash, "");
}
tryGetFirstFloorAndGoPostPage() {
const thisClass = this;
thisClass.tryCollectSomeKey();
let url = `${window.origin}/mg/p/getPbData?kz=${thisClass.storagePageData.someKey.tid}&obj_param2=firefox&format=json&eqid=&refer=&pn=1&rn=5`;
GM_xmlhttpRequest({
method: "GET",
url: url,
onload: function (details) {
DEBUGLOG("手动加载pbdata数据", "xmlhttpRequest onload", details.responseText);
thisClass.parsePbData(details.responseText, url);
},
onerror: function () {
},
});
function waitPbdataLoaded(func, finalFunc) {
WAIT_ELEMENT_LOADED("pbdata", function () {
func();
}, {
TIME_OUT: 30,
searchFunc: function () {
if (thisClass.storagePageData.someKey.tid &&
thisClass.storagePageData.someKey.postAuthorId &&
thisClass.storagePageData.someKey.forumId) {
return true;
}
return undefined;
},
finalFunc: finalFunc
});
}
WAIT_ELEMENT_LOADED("div.nav-bar-v2-fixed:nth-child(1)", () => {
thisClass.storagePageData.tiebaNameNode = document.querySelector(".forum-block");
thisClass.storagePageData.tieNode = document.querySelector(".main-thread-content");
let postbtn = document.querySelector(".post-page-entry-btn");
if (postbtn) {
waitPbdataLoaded(function () {
MainPage.REPLACE_HASH(`#/postPage?tid=${thisClass.storagePageData.someKey.tid}&postAuthorId=${thisClass.storagePageData.someKey.postAuthorId}&forumId=${thisClass.storagePageData.someKey.forumId}&locateConfig=%5B%5D&source=`);
}, function () {
DEBUGLOG(`缺乏必要参数,无法计算评论页url:\n`, STR_DEBUG_LABEL_ERROR, thisClass.storagePageData.someKey);
if (postbtn) {
postbtn.click();
thisClass.checkUrlHashChange(false, PAGE_TYPE.MAINPAGE);
}
});
}
else {
waitPbdataLoaded(function () {
thisClass.checkUrlHashChange(true);
}, function () {
});
}
});
}
listenFloorChange(floorParentNode) {
const searchAndUpdatePostPage = () => {
let floorNodeList = floorParentNode.querySelectorAll(`div.post-item:not(.${STR_VOEOCMARK})`);
floorNodeList.forEach((value) => {
this.onNewFloorAdded.call(this, value);
});
};
let observer = new MutationObserver(function (_mutationList) {
searchAndUpdatePostPage();
});
observer.observe(floorParentNode, {
attributes: false,
childList: true,
characterData: false,
subtree: false,
});
searchAndUpdatePostPage();
}
checkUrlHashChange(force = false, lastPageType) {
var _a;
const thisClass = this;
if (thisClass.currentHash !== window.location.hash) {
thisClass.currentHash = window.location.hash;
}
else if (!force) {
return false;
}
let pageType = MainPage.GET_PAGE_TYPE();
if (pageType === PAGE_TYPE.POSTPAGE) {
if (lastPageType === PAGE_TYPE.MAINPAGE) ;
thisClass.tryCollectSomeKey();
WAIT_ELEMENT_LOADED(".post-page-list", (postpagelist) => {
thisClass.listenFloorChange(postpagelist);
});
thisClass.restorePostPage();
MainPage.scrollTo(thisClass.currentScrollYPos);
}
else if (pageType === PAGE_TYPE.MAINPAGE) {
if (thisClass.storagePageData.tieNode) {
WAIT_ELEMENT_LOADED(".pb-page-wrapper", (pbpageNode) => {
thisClass.listenFloorChange(pbpageNode);
});
WAIT_ELEMENT_LOADED("#replySwitch", (splitlineNode) => {
AUTO_CATCH_ERROR(() => {
if (!thisClass.storagePageData.tieNode) {
throw new Error("1楼不存在");
}
if (!splitlineNode.parentNode) {
throw new Error("复原1楼时页面加载失败");
}
splitlineNode.parentNode.insertBefore(thisClass.storagePageData.tieNode, splitlineNode);
});
});
MainPage.scrollTo(0);
}
}
(_a = this.onEnterFinalPage) === null || _a === void 0 ? void 0 : _a.call(this);
return true;
}
static scrollTo(yPos, documentNode = document) {
WAIT_ELEMENT_LOADED(".post-page", (_) => {
documentNode.documentElement.scrollTop = yPos;
setTimeout(function () {
documentNode.documentElement.scrollTop = yPos;
}, 200);
});
}
restorePostPage() {
const thisClass = this;
WAIT_ELEMENT_LOADED(".text", (titletextNode) => {
var _a;
(_a = this.onEnterFinalPage) === null || _a === void 0 ? void 0 : _a.call(this);
AUTO_CATCH_ERROR(() => {
if (!thisClass.storagePageData.tiebaNameNode || !titletextNode.parentNode) {
throw new Error("贴吧名无法加载");
}
let tiebaNameCloneNode = thisClass.storagePageData.tiebaNameNode.cloneNode(true);
titletextNode.parentNode.replaceChild(tiebaNameCloneNode, titletextNode);
tiebaNameCloneNode.onclick = thisClass.storagePageData.tiebaNameNode.click.bind(thisClass.storagePageData.tiebaNameNode);
});
AUTO_CATCH_ERROR(() => {
if (!thisClass.storagePageData.tieNode) {
throw new Error("1楼内容为空!");
}
thisClass.storagePageData.tieNode.style.cssText = `margin-left:0.12rem;margin-right:0.12rem;margin-bottom:0.25rem;`;
let lzavatarNode = thisClass.storagePageData.tieNode.querySelector(".avatar");
if (lzavatarNode) {
lzavatarNode.style.backgroundImage = `url("${lzavatarNode.getAttribute("lines-src")}")`;
}
else {
DEBUGLOG("找不到楼主头像", STR_DEBUG_LABEL_ERROR);
}
let textContentNode = (thisClass.storagePageData.tieNode.querySelector(".thread-text"));
if (textContentNode) {
textContentNode.style.cssText = `margin-top:0.18rem;font-size:0.16rem;line-height:0.28rem;`;
}
else {
DEBUGLOG("1楼不存在", STR_DEBUG_LABEL_ERROR);
}
let replySwitchNode = document.querySelector("#replySwitch");
if (replySwitchNode && replySwitchNode.parentNode) {
replySwitchNode.parentNode.insertBefore(thisClass.storagePageData.tieNode, replySwitchNode);
}
else {
DEBUGLOG("1楼插入失败", STR_DEBUG_LABEL_ERROR);
}
});
AUTO_CATCH_ERROR(() => {
let threadtitleNode = document.querySelector(".thread-title");
if (!threadtitleNode) {
threadtitleNode = document.querySelector(".bottom-thread-title");
}
if (!threadtitleNode) {
throw new Error("标题为空!");
}
threadtitleNode.style.cssText = `margin-bottom: 0.13rem;font-size:0.22rem;font-weight:700;line-height:0.33rem;`;
});
});
}
parsePbData(responseText, responseURL) {
const thisClass = this;
AUTO_CATCH_ERROR(() => {
let data;
if (typeof responseText == "object") {
data = responseText.data;
}
else {
data = JSON.parse(responseText).data;
}
ASSERT(data, "无法获取PBDATA");
DEBUGLOG(`已获取pbdata(${responseURL}):`, "pbdata", data);
AUTO_CATCH_ERROR(() => {
thisClass.storagePageData.someKey.forumId = data.forum.id;
}, "该json并暂无forumId信息");
AUTO_CATCH_ERROR(() => {
thisClass.storagePageData.someKey.tid = data.thread.id;
}, "该json并暂无tid信息");
AUTO_CATCH_ERROR(() => {
let post_list = data.post_list;
if (!post_list) {
throw new Error(`该PBDATA没有post_list数据, ${data}`);
}
AUTO_CATCH_ERROR(() => {
if (GET_URL_ATTR(responseURL, "pn") === "1") {
thisClass.storagePageData.lzId = post_list[0].author.id;
thisClass.storagePageData.someKey.postAuthorId = thisClass.storagePageData.lzId;
DEBUGLOG(thisClass.storagePageData.lzId, "lzId");
}
}, "无法获取楼主id", post_list);
for (let i = 0; i < post_list.length; i++) {
let d = post_list[i];
thisClass.storagePageData.floorDataList.set(d.floor.toString(), d);
}
});
DEBUGLOG("解析后的参数", "someKey", thisClass.storagePageData.someKey);
}, "无法获取pbData:", responseText);
}
}
var HTML_SVG_SETTING_BTN = "<svg class=\"icon\" viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\r\n <path d=\"M424.763392 689.588224l259.528704-259.524608c73.37984 37.507072 165.515264 25.591808 226.932736-35.823616 61.417472-61.41952 73.332736-153.552896 35.825664-226.934784l-168.658944 168.656896-85.05344-85.055488 168.654848-168.656896c-73.37984-37.50912-165.515264-25.593856-226.932736 35.823616-61.417472 61.417472-73.332736 153.552896-35.825664 226.934784L339.707904 604.532736c-73.37984-37.507072-165.515264-25.591808-226.932736 35.823616C51.359744 701.771776 39.44448 793.9072 76.949504 867.291136l168.656896-168.656896 85.057536 85.055488-168.656896 168.656896c73.383936 37.505024 165.517312 25.591808 226.936832-35.827712C450.357248 855.103488 462.27456 762.97216 424.763392 689.588224z\"\r\n fill=\"#121212\"/>\r\n</svg>";
var _CustomLzlExpandManager_instances, _a, _CustomLzlExpandManager_STR_NEWOPENLZLTEXT, _CustomLzlExpandManager_STR_REMAINDOPENLZLTEXT, _CustomLzlExpandManager_LZL_CONTENT_TYPE, _CustomLzlExpandManager_enable, _CustomLzlExpandManager_currentPageNum, _CustomLzlExpandManager_pageSize, _CustomLzlExpandManager_originItemNodeList, _CustomLzlExpandManager_sampleItemNode, _CustomLzlExpandManager_lzTagHTML, _CustomLzlExpandManager_data_v_a, _CustomLzlExpandManager_data_v_b, _CustomLzlExpandManager_pid, _CustomLzlExpandManager_floorNum, _CustomLzlExpandManager_expandNum, _CustomLzlExpandManager_floorNode, _CustomLzlExpandManager_lzlNode, _CustomLzlExpandManager_expandBtnNode, _CustomLzlExpandManager_expandBtnTextNode, _CustomLzlExpandManager_expandTimeoutTimer, _CustomLzlExpandManager_showError, _CustomLzlExpandManager_startExpandAnimation, _CustomLzlExpandManager_endExpandAnimation, _CustomLzlExpandManager_destroy;
const SETTINGS_DATA = {
isClickToExpandLzlPage: new SettingsPanel.SettingValue("VOEOC_GMKEY_isClickToExpandLzlPage", true),
isLongClickToExpandLzlPage: new SettingsPanel.SettingValue("VOEOC_GMKEY_isLongClickToExpandLzlPage", true),
isAutoExpand: new SettingsPanel.SettingValue("VOEOC_GMKEY_isAutoExpand", true),
isRemaindAutoExpand: new SettingsPanel.SettingValue("VOEOC_GMKEY_isRemaindAutoExpand", true),
eachExpandSize: new SettingsPanel.SettingValue("VOEOC_GMKEY_eachExpandSize", 10),
autoExpandNum: new SettingsPanel.SettingValue("VOEOC_GMKEY_autoExpandNum", 1),
remaindAutoExpandSize: new SettingsPanel.SettingValue("VOEOC_GMKEY_remaindAutoExpandSize", 7),
};
SETTINGS_DATA.isClickToExpandLzlPage.value = true;
SETTINGS_DATA.isLongClickToExpandLzlPage.value = true;
let settingDialog;
let mainPage;
function REGISTER_MENUCOMMAND() {
GM_registerMenuCommand(`设置`, function () {
settingDialog === null || settingDialog === void 0 ? void 0 : settingDialog.open();
}, "VOEOC_MENU_ACCESS_KEY_SETTINGS");
}
const HIDE_MAIN_PAGE = (function () {
let timer = undefined;
GM_addStyle(`html {transition: opacity 0.4s, background-color 0.4s;}`);
let styleElement;
return function (isHidden = true) {
if (styleElement) {
styleElement.remove();
styleElement = undefined;
}
if (isHidden) {
styleElement = GM_addStyle(`html {opacity: 0.2;background-color: #00000011}`);
clearTimeout(timer);
timer = setTimeout(function () {
HIDE_MAIN_PAGE(false);
}, 5000);
}
};
})();
class CustomLzlExpandManager {
constructor(floorNode, expandBtnNode, floorNum, pid) {
var _b, _c, _d, _e, _f, _g, _h;
_CustomLzlExpandManager_instances.add(this);
_CustomLzlExpandManager_enable.set(this, false);
_CustomLzlExpandManager_currentPageNum.set(this, NaN);
_CustomLzlExpandManager_pageSize.set(this, NaN);
_CustomLzlExpandManager_originItemNodeList.set(this, void 0);
_CustomLzlExpandManager_sampleItemNode.set(this, void 0);
_CustomLzlExpandManager_lzTagHTML.set(this, "");
_CustomLzlExpandManager_data_v_a.set(this, "");
_CustomLzlExpandManager_data_v_b.set(this, "");
_CustomLzlExpandManager_pid.set(this, "");
_CustomLzlExpandManager_floorNum.set(this, "");
_CustomLzlExpandManager_expandNum.set(this, NaN);
_CustomLzlExpandManager_floorNode.set(this, void 0);
_CustomLzlExpandManager_lzlNode.set(this, void 0);
_CustomLzlExpandManager_expandBtnNode.set(this, void 0);
_CustomLzlExpandManager_expandBtnTextNode.set(this, void 0);
_CustomLzlExpandManager_expandTimeoutTimer.set(this, void 0);
ASSERT(floorNode, "floorNode is null");
ASSERT(expandBtnNode, "expandBtnNode is null");
let thisClass = this;
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_enable, true, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_currentPageNum, 1, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_pageSize, ((_b = SETTINGS_DATA.eachExpandSize) === null || _b === void 0 ? void 0 : _b.value) < 10 ? 10 : (_c = SETTINGS_DATA.eachExpandSize) === null || _c === void 0 ? void 0 : _c.value, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_floorNode, floorNode, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_expandBtnNode, expandBtnNode, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_lzlNode, __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_floorNode, "f").querySelector("div.lzl-post"), "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_originItemNodeList, __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_lzlNode, "f").getElementsByClassName("lzl-post-item"), "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_sampleItemNode, __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_originItemNodeList, "f")[0].cloneNode(true), "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_floorNum, floorNum, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_pid, pid, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_expandNum, 0, "f");
let dvList = [];
for (let dv in (_e = (_d = __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_originItemNodeList, "f")[0]) === null || _d === void 0 ? void 0 : _d.querySelector(".thread-text")) === null || _e === void 0 ? void 0 : _e.dataset) {
dvList.push(`data-v-${dv.slice(1).replace('-', '')}`);
}
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_data_v_a, "lines-v-a", "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_data_v_b, "lines-v-b", "f");
AUTO_CATCH_ERROR(() => {
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_data_v_a, dvList[0], "f");
});
AUTO_CATCH_ERROR(() => {
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_data_v_b, dvList[1], "f");
});
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_lzTagHTML, `<svg ${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_data_v_b, "f")}="" class="landlord"><use xlink:href="#icon_landlord"></use></svg>`, "f");
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_expandBtnTextNode, document.createElement("span"), "f");
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnTextNode, "f").className = "open-app-text-real";
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnTextNode, "f").innerHTML = __classPrivateFieldGet(CustomLzlExpandManager, _a, "f", _CustomLzlExpandManager_STR_NEWOPENLZLTEXT);
let clickFunc = ((_f = SETTINGS_DATA.isClickToExpandLzlPage) === null || _f === void 0 ? void 0 : _f.value) ? thisClass.expandLzl.bind(thisClass) : thisClass.openLzlPage.bind(thisClass);
let longClickFunc = ((_g = SETTINGS_DATA.isLongClickToExpandLzlPage) === null || _g === void 0 ? void 0 : _g.value) ? thisClass.expandLzl.bind(thisClass) : thisClass.openLzlPage.bind(thisClass);
let timeOutEvent;
const TIME_OUT = 500;
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").ontouchstart = function () {
timeOutEvent = setTimeout(function () {
timeOutEvent = 0;
longClickFunc();
}, TIME_OUT);
return false;
};
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").ontouchend = function () {
clearTimeout(timeOutEvent);
if (timeOutEvent !== 0) {
clickFunc();
}
return false;
};
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").ontouchmove = function () {
clearTimeout(timeOutEvent);
timeOutEvent = 0;
};
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").insertBefore(__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnTextNode, "f"), __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").children[0]);
if ((_h = SETTINGS_DATA.isAutoExpand) === null || _h === void 0 ? void 0 : _h.value) {
DEBUGLOG(__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_floorNum, "f"), "AutoExpand");
thisClass.expandLzl();
}
}
expandLzl(isTheLast = false, waitFinishFunc) {
const thisClass = this;
ASSERT(__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_enable, "f"), `尝试展开不存在的评论区,楼层号${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_floorNum, "f")}`);
DEBUGLOG(__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_floorNum, "f"), "expandLzl");
let someKey = mainPage.storagePageData.someKey;
let url = `${window.origin}/mg/o/getFloorData?pn=${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_currentPageNum, "f")}&rn=${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_pageSize, "f")}&tid=${someKey.tid}&pid=${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_pid, "f")}`;
function onerror() {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_endExpandAnimation).call(thisClass);
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_showError).call(thisClass, true);
void 0;
}
let abortFunc = GM_xmlhttpRequest({
method: "GET",
url: url,
onload: function (details) {
var _b, _c, _d, _e;
var _f, _g, _h, _j;
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_endExpandAnimation).call(thisClass);
let floorData = undefined;
let subPostList = undefined;
try {
floorData = JSON.parse(details.responseText);
subPostList = floorData.data.sub_post_list;
ASSERT(subPostList && subPostList.length !== 0, "sub_post_list为空");
}
catch (e) {
void 0;
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_showError).call(thisClass, true);
return;
}
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_showError).call(thisClass, false);
if (__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_currentPageNum, "f") === 1 && __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_originItemNodeList, "f") && __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_lzlNode, "f")) {
for (let i = __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_originItemNodeList, "f").length - 1; i > -1; i--) {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_lzlNode, "f").removeChild(__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_originItemNodeList, "f")[i]);
}
}
subPostList.forEach(function (subpost) {
var _b, _c;
let contentHTML = "";
subpost.content.forEach(function (subContent) {
let itemHTML;
switch (subContent.type) {
case __classPrivateFieldGet(CustomLzlExpandManager, _a, "f", _CustomLzlExpandManager_LZL_CONTENT_TYPE).EMOJI:
itemHTML = `<img ${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_data_v_a, "f")}="" src="${subContent.src}" alt="${subContent.text}"class="emotion-img">`;
break;
case __classPrivateFieldGet(CustomLzlExpandManager, _a, "f", _CustomLzlExpandManager_LZL_CONTENT_TYPE).USERNAME:
if (subContent.uid === mainPage.storagePageData.lzId) {
itemHTML = `<span ${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_data_v_b, "f")}="" class="link username"> ${subContent.text} ${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_lzTagHTML, "f")} </span>`;
}
else {
itemHTML = `<span ${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_data_v_a, "f")}="" class="user rich-link-disabled"> ${subContent.text} </span>`;
}
break;
case __classPrivateFieldGet(CustomLzlExpandManager, _a, "f", _CustomLzlExpandManager_LZL_CONTENT_TYPE).TEXT:
default:
itemHTML = `<span ${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_data_v_a, "f")}="" class="text-content">${subContent.text}</span>`;
break;
}
contentHTML += itemHTML;
});
let newItemNode = (_b = __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_sampleItemNode, "f")) === null || _b === void 0 ? void 0 : _b.cloneNode(true);
if (newItemNode && __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f")) {
newItemNode.querySelector(".username").innerHTML = `${subpost.author.show_nickname} ${(mainPage.storagePageData.lzId === subpost.author.id) ? __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_lzTagHTML, "f") : ""}:`;
newItemNode.querySelector(".thread-text").innerHTML = contentHTML;
(_c = __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_lzlNode, "f")) === null || _c === void 0 ? void 0 : _c.insertBefore(newItemNode, __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f"));
}
});
let pageinfo = floorData.data.page;
let total_page = parseInt(pageinfo.total_page);
if (total_page > __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_currentPageNum, "f")) {
__classPrivateFieldSet(_f = thisClass, _CustomLzlExpandManager_currentPageNum,
(_g = __classPrivateFieldGet(_f, _CustomLzlExpandManager_currentPageNum, "f"), _g++, _g), "f");
let total_num = parseInt(pageinfo.total_num);
let remaind_num = total_num - __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_pageSize, "f") * (__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_currentPageNum, "f") - 1);
if (__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f")) {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").children[0].innerHTML = __classPrivateFieldGet(CustomLzlExpandManager, _a, "f", _CustomLzlExpandManager_STR_REMAINDOPENLZLTEXT).call(CustomLzlExpandManager, remaind_num);
}
if (((_b = SETTINGS_DATA.isRemaindAutoExpand) === null || _b === void 0 ? void 0 : _b.value) && ((_c = SETTINGS_DATA.remaindAutoExpandSize) === null || _c === void 0 ? void 0 : _c.value) > remaind_num) {
if (!isTheLast) {
thisClass.expandLzl(true);
}
}
else if (((_d = SETTINGS_DATA.isAutoExpand) === null || _d === void 0 ? void 0 : _d.value) && __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandNum, "f") < ((_e = SETTINGS_DATA.autoExpandNum) === null || _e === void 0 ? void 0 : _e.value)) {
thisClass.expandLzl();
}
}
else {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_destroy).apply(thisClass);
}
__classPrivateFieldSet(_h = thisClass, _CustomLzlExpandManager_expandNum, (_j = __classPrivateFieldGet(_h, _CustomLzlExpandManager_expandNum, "f"), _j++, _j), "f");
},
onerror: onerror,
onabort: onerror,
ontimeout: onerror,
});
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_startExpandAnimation).call(thisClass, abortFunc.abort);
}
openLzlPage() {
const thisClass = this;
let someKey = mainPage.storagePageData.someKey;
if (!someKey.tid || !someKey.postAuthorId || !someKey.forumId) {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_showError).call(thisClass);
return;
}
`#/lzlPage?tid=${someKey.tid}&pid=${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_pid, "f")}&floor=${__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_floorNum, "f")}&postAuthorId=${someKey.postAuthorId}&forumId=${someKey.forumId}`;
}
}
_a = CustomLzlExpandManager, _CustomLzlExpandManager_enable = new WeakMap(), _CustomLzlExpandManager_currentPageNum = new WeakMap(), _CustomLzlExpandManager_pageSize = new WeakMap(), _CustomLzlExpandManager_originItemNodeList = new WeakMap(), _CustomLzlExpandManager_sampleItemNode = new WeakMap(), _CustomLzlExpandManager_lzTagHTML = new WeakMap(), _CustomLzlExpandManager_data_v_a = new WeakMap(), _CustomLzlExpandManager_data_v_b = new WeakMap(), _CustomLzlExpandManager_pid = new WeakMap(), _CustomLzlExpandManager_floorNum = new WeakMap(), _CustomLzlExpandManager_expandNum = new WeakMap(), _CustomLzlExpandManager_floorNode = new WeakMap(), _CustomLzlExpandManager_lzlNode = new WeakMap(), _CustomLzlExpandManager_expandBtnNode = new WeakMap(), _CustomLzlExpandManager_expandBtnTextNode = new WeakMap(), _CustomLzlExpandManager_expandTimeoutTimer = new WeakMap(), _CustomLzlExpandManager_instances = new WeakSet(), _CustomLzlExpandManager_showError = function _CustomLzlExpandManager_showError(isError = true) {
var _b, _c;
const thisClass = this;
if (isError) {
(_b = __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnTextNode, "f")) === null || _b === void 0 ? void 0 : _b.classList.add("error");
}
else {
(_c = __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnTextNode, "f")) === null || _c === void 0 ? void 0 : _c.classList.remove("error");
}
}, _CustomLzlExpandManager_startExpandAnimation = function _CustomLzlExpandManager_startExpandAnimation(abortFunc) {
const thisClass = this;
if (__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f")) {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").disabled = true;
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").classList.add("loading");
}
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_expandTimeoutTimer, setTimeout(function () {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_endExpandAnimation).call(thisClass);
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_instances, "m", _CustomLzlExpandManager_showError).call(thisClass, true);
void 0;
abortFunc();
}, 5000), "f");
}, _CustomLzlExpandManager_endExpandAnimation = function _CustomLzlExpandManager_endExpandAnimation() {
const thisClass = this;
if (__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f")) {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").disabled = false;
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").classList.remove("loading");
}
if (__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandTimeoutTimer, "f")) {
clearTimeout(__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandTimeoutTimer, "f"));
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_expandTimeoutTimer, undefined, "f");
}
}, _CustomLzlExpandManager_destroy = function _CustomLzlExpandManager_destroy() {
var _b;
const thisClass = this;
try {
__classPrivateFieldSet(thisClass, _CustomLzlExpandManager_enable, false, "f");
if (__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f")) {
__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").style.display = "none";
(_b = __classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f").parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(__classPrivateFieldGet(thisClass, _CustomLzlExpandManager_expandBtnNode, "f"));
}
}
finally {
}
};
_CustomLzlExpandManager_STR_NEWOPENLZLTEXT = { value: "展开评论" };
_CustomLzlExpandManager_STR_REMAINDOPENLZLTEXT = { value: function (num) {
return `剩余${num}个评论`;
} };
_CustomLzlExpandManager_LZL_CONTENT_TYPE = { value: {
TEXT: 0,
EMOJI: 2,
USERNAME: 4,
} };
(function main() {
switch (MainPage.GET_PAGE_TYPE()) {
case PAGE_TYPE.MAINPAGE:
HIDE_MAIN_PAGE(true);
INSERT_CSS(CSS_REMOVE + CSS_BAIDU);
mainPage = new MainPage();
mainPage.tryGetFirstFloorAndGoPostPage();
mainPage.listenReady(() => {
REGISTER_MENUCOMMAND();
});
mainPage.onEnterFinalPage = () => {
WAIT_ELEMENT_LOADED(".nav-bar-top", (navbar) => {
const id = "VOEOC-ID-SETTINGBTNNODE";
if (document.getElementById(id)) {
return;
}
let settingBtnNode = document.createElement("div");
settingBtnNode.id = id;
settingBtnNode.className = "lzl-nav-btn";
settingBtnNode.style.cssText = "position:fixed;margin: 0.1rem;";
settingBtnNode.innerHTML = HTML_SVG_SETTING_BTN;
settingBtnNode.onclick = function () {
settingDialog === null || settingDialog === void 0 ? void 0 : settingDialog.open();
};
navbar.appendChild(settingBtnNode);
HIDE_MAIN_PAGE(false);
VoeocDialog.initHistoryStateManager();
settingDialog = new SettingsDialog(document.body, SETTINGS_DATA);
});
};
mainPage.onNewFloorAdded = (floorNode) => {
if (floorNode.classList.contains(STR_VOEOCMARK)) {
return;
}
floorNode.classList.add(STR_VOEOCMARK);
AUTO_CATCH_ERROR(() => {
var _b;
let expandBtnNode = floorNode.querySelector(".open-app-guide");
if (expandBtnNode) {
let floorinfoNode = floorNode.querySelector(".floor-info");
if (!floorinfoNode) {
throw new Error("楼层数节点不存在");
}
let floorNum = MATCH_REG(RegExp(/第(\d+)楼/, 'i'), floorinfoNode.innerHTML);
if (!floorNum) {
throw new Error("无法获取楼层数");
}
let floorPid = (_b = mainPage.storagePageData.floorDataList.get(floorNum)) === null || _b === void 0 ? void 0 : _b.id;
new CustomLzlExpandManager(floorNode, expandBtnNode, floorNum, floorPid !== null && floorPid !== void 0 ? floorPid : "");
}
});
};
break;
case PAGE_TYPE.POSTPAGE:
HIDE_MAIN_PAGE(true);
MainPage.REPLACE_HASH("");
break;
case PAGE_TYPE.LZLPAGE:
break;
}
})();
})();