- // ==UserScript==
- // @name 简法主页功能增强
- // @namespace http://tampermonkey.net/
- // @version 0.13
- // @description 在简法主页上增加其他个性化设置
- // @author 那年那兔那些事
- // @match https://www.jianfast.com
- // @match https://www.jianfast.com/?pc=1
- // @match https://www.jianfast.com/m
- // @icon https://s3.bmp.ovh/imgs/2021/08/2a5feb8f5f886e70.png
- // ==/UserScript==
-
- (function() {
- //添加window.onload方法,防止window.onload相互覆盖覆盖
- function addLoadEvent(newOnload) {
- var oldOnload = window.onload;
- if (typeof window.onload != 'function') {
- window.onload = newOnload;
- } else {
- window.onload = function() {
- oldOnload();
- newOnload();
- }
- }
- }
- //store为本地存储功能
- var store = {
- //set方法在localstorage中修改指定JSON数据
- set: function(key, val) {
- if (!val) {
- return;
- }
- try {
- var json = JSON.stringify(val);
- if (typeof JSON.parse(json) === "object") { // 验证一下是否为JSON字符串防止保存错误
- localStorage.setItem(key, json);
- }
- } catch (e) {
- return false;
- }
- },
- //get方法在localstorage中获取指定JSON数据
- get: function(key) {
- if (this.has(key)) {
- return JSON.parse(localStorage.getItem(key));
- }
- },
- //has方法在localstorage中查询指定JSON数据是否存在
- has: function(key) {
- if (localStorage.getItem(key)) {
- return true;
- } else {
- return false;
- }
- },
- //del方法在localstorage中删除指定JSON数据
- del: function(key) {
- localStorage.removeItem(key);
- }
- };
- //settings对象为设置项
- var settings = {
- settingsData: {
- searchEngine: true, //true:当前标签页打开搜索结果;false:新标签页打开搜索结果
- bookMarks: true, //true:当前标签页打开书签网页;false:新标签页打开书签网页
- settingsPurify: true, //true:开启设置页广告净化;false:关闭设置页广告净化
- hideRandBg: true, //true:开启主页随机背景入口隐藏;false:关闭主页随机背景入口隐藏
- serchForcast: true //true:开启搜索栏联想词预测;false:关闭搜索栏联想词预测
- },
- backupData: {}, //用于备份数据
- //get方法获取settings对象settingsData属性
- get: function(key) {
- return this.settingsData[key];
- },
- //get方法获取settings对象settingsData所有属性
- getAll: function() {
- return this.settingsData;
- },
- //getBackup方法获取settings对象backupData所有属性
- getBackup: function() {
- return this.backupData;
- },
- //set方法设置settings对象settingsData属性
- set: function(key, value) {
- if (typeof value === "boolean") {
- this.settingsData[key] = value;
- } else {
- console.log("value错误");
- }
- },
- //initData方法初始化settings对象属性
- initData: function() {
- this.backupData = this.settingsData;
- var localData = store.get("settingsData");
- var settingsData = this.settingsData;
- if (localData) {
- this.settingsData = {
- ...settingsData,
- ...localData
- };
- } else {
- store.set("settingsData", this.settingsData);
- }
- },
- //init方法初始化搜索引擎与书签的打开方式
- init: function() {
- this.initData();
- newSettingsPageFn.init();
- searchEngine.init();
- bookMarks.init();
- serchForcast.init();
- settingsPurify.init();
- hideRandBg.init();
- console.log("简法主页功能增强:初始化完成");
- },
- //monitor方法用于检错、监控修改结果
- monitor: function() {
- var Timer = setInterval(function() {
- searchEngine.monitor();
- bookMarks.monitor();
- serchForcast.monitor();
- settingsPurify.monitor();
- hideRandBg.monitor();
- }, 500);
- console.log("简法主页功能增强:检错程序启动(定时器ID:" + Timer + ")");
- },
- //on方法用于启动整个程序
- on: function() {
- console.log("简法主页功能增强:主程序启动");
- this.init();
- this.monitor();
- }
- }
- //newSettingsPageFn为增强设置页
- var newSettingsPageFn = {
- optData: [{
- tittle: "搜索结果打开方式",
- value: "searchEngine",
- choice: [{
- t: "当前标签页",
- v: true
- }, {
- t: "新标签页",
- v: false
- }]
- }, {
- tittle: "主页书签打开方式",
- value: "bookMarks",
- choice: [{
- t: "当前标签页",
- v: true
- }, {
- t: "新标签页",
- v: false
- }]
- }, {
- tittle: "搜索栏联想词预测",
- value: "serchForcast",
- choice: [{
- t: "开启预测",
- v: true
- }, {
- t: "关闭预测",
- v: false
- }]
- }, {
- tittle: "设置页广告净化",
- value: "settingsPurify",
- choice: [{
- t: "开启净化",
- v: true
- }, {
- t: "关闭净化",
- v: false
- }]
- }, {
- tittle: "随机背景入口隐藏",
- value: "hideRandBg",
- choice: [{
- t: "开启隐藏",
- v: true
- }, {
- t: "关闭隐藏",
- v: false
- }]
- }, {
- tittle: "关于脚本",
- type: "note",
- noteData: [{
- l: "当前版本",
- r: "Version0.13"
- }, {
- l: "版本更新",
- r: "<span id='updateBtn'>GreasyFork</span>"
- }, {
- l: "反馈建议",
- r: "<span id='contactBtn'>点此处反馈</span>"
- }, {
- l: "导入配置",
- r: "<span id='importSetBtn'>点此处导入</span>"
- }, {
- l: "导出配置",
- r: "<span id='exportSetBtn'>点此处导出</span>"
- }, {
- l: "重置配置",
- r: "<span id='recoverSetBtn'>点此处重置</span>"
- }]
- }],
- //clickFn方法为设置选项按钮的点击功能
- clickFn: function(id, key) {
- var Obj = document.getElementById(id);
- var setValue = settings.get(key);
- var optValue = Obj.value;
- if (setValue !== optValue) {
- settings.set(key, optValue);
- var newObj = Obj.parentElement.children;
- for (let i = 0; i < newObj.length; i++) {
- if (newObj[i].id === id) {
- newObj[i].style.border = "1px solid #2c7bf6";
- newObj[i].style.color = "#2c7bf6";
- } else {
- newObj[i].style.border = "1px solid rgba(0, 0, 0, 0.1)";
- newObj[i].style.color = "";
- }
- }
- saveFlag = true;
- var newSaveBox = document.getElementById("new-save-box");
- if (newSaveBox && newSaveBox.style.display === "none") {
- newSaveBox.style.display = "flex";
- }
- var tittleBox = document.getElementById("console-title-box");
- if (tittleBox && tittleBox.style.display !== "none") {
- tittleBox.style.display = "none";
- }
- }
- },
- //createTittle方法创建一个盛放设置标题的元素对象
- createTittle: function(val) {
- var Box = document.createElement("div");
- Box.setAttribute("class", "console-bigTitle");
- Box.innerText = val;
- return Box;
- },
- //createChoiceBtn方法创建一个设置选项按钮对象
- createChoiceBtn: function(choice, id) {
- var Btn = document.createElement("div");
- var BtnID = id + "-" + choice.v;
- var key = id.slice("moreSet-Opt-".length);
- Btn.style =
- "padding: 0 10px;width: 35%;margin: 5px 10px;height: 25px;box-sizing: border-box;line-height: 23px;text-align: center;border-radius: 100px;font-size: 13px;border: 1px solid rgba(0, 0, 0, 0.1);cursor: pointer;user-select: none;transition: all .3s;";
- Btn.innerText = choice.t;
- Btn.value = choice.v;
- Btn.id = BtnID;
- Btn.onclick = function() {
- newSettingsPageFn.clickFn(BtnID, key);
- };
- if (settings.get(key) === choice.v) {
- Btn.style.border = "1px solid #2c7bf6";
- Btn.style.color = "#2c7bf6";
- }
- return Btn;
- },
- //createChoice方法创建一个设置选项按钮对象的集合对象
- createChoice: function(value, choice) {
- var Box = document.createElement("div");
- var BoxID = "moreSet-Opt-" + value;
- Box.style =
- "width:100%;display:flex;justify-content:center;flex-flow:row wrap;margin-top:15px;";
- Box.id = BoxID
- var Btn;
- if (Array.isArray(choice)) {
- for (let i = 0; i < choice.length; i++) {
- Btn = this.createChoiceBtn(choice[i], BoxID);
- Box.appendChild(Btn);
- }
- } else {
- Btn = this.createChoiceBtn(choice, BoxID);
- Box.appendChild(Btn);
- }
- return Box;
- },
- //createOpt方法创建一个完整的设置项对象
- createOpt: function(tittle, value, choice) {
- var ResObj = false;
- if (tittle && value && choice) {
- ResObj = document.createElement("div");
- var newTittle = this.createTittle(tittle);
- var newChoice = this.createChoice(value, choice);
- ResObj.appendChild(newTittle);
- ResObj.appendChild(newChoice);
- }
- return ResObj;
- },
- createNoteText: function(data) {
- var textObj = document.createElement("div");
- textObj.style = "width:100%;margin:5px;";
- textObj.innerHTML = "<span>" + data.l + "</span>";
- if (data.r) {
- textObj.innerHTML += "<span> : </span><span style='color:black'>" + data.r + "</span>";
- }
- return textObj;
- },
- createNoteData: function(noteData) {
- var newNoteBox = document.createElement("div");
- newNoteBox.style =
- "width: 60%;margin:20%;margin-top: 20px; text-align: center; line-height: 23px;";
- var newNoteText;
- if (Array.isArray(noteData)) {
- for (let i = 0; i < noteData.length; i++) {
- newNoteText = this.createNoteText(noteData[i]);
- newNoteBox.appendChild(newNoteText);
- }
- } else {
- newNoteText = this.createNoteText(noteData);
- newNoteBox.appendChild(newNoteText);
- }
- return newNoteBox;
- },
- //createNote方法创建一个文字性的提示对象
- createNote: function(tittle, noteData) {
- var ResObj = false;
- if (tittle && noteData) {
- ResObj = document.createElement("div");
- var newTittle = this.createTittle(tittle);
- var newNote = this.createNoteData(noteData);
- ResObj.appendChild(newTittle);
- ResObj.appendChild(newNote);
- }
- return ResObj;
- },
- //createPage方法创建一个增强设置页
- createPage: function(val) {
- var settingBox = document.createElement("div");
- settingBox.id = "console-moreSet-content";
- settingBox.style =
- "width: 100%;height: 100px;flex-grow: 1;overflow: auto;box-sizing: border-box;padding: 0 25px 0 0;margin: 10px 0;display: none";
- var newOpt;
- for (let i = 0; i < val.length; i++) {
- if (val[i].type) {
- if (val[i].type === "note") {
- newOpt = this.createNote(val[i].tittle, val[i].noteData);
- settingBox.appendChild(newOpt);
- }
- } else {
- newOpt = this.createOpt(val[i].tittle, val[i].value, val[i].choice);
- settingBox.appendChild(newOpt);
- }
- }
- document.getElementById("console-box").appendChild(settingBox);
- },
- //createMenu方法在设置菜单中创建增强设置功能入口
- createMenu: function() {
- var menuBtn = document.createElement("div");
- menuBtn.setAttribute("class", "console-menu-btn");
- menuBtn.id = "moreSetBtn";
- menuBtn.innerText = "增强设置";
- menuBtn.onclick = this.on;
- document.getElementById("console-menu-main").appendChild(menuBtn);
- },
- //createSaveBtn方法创建一个保存按钮对象
- createSaveBtn: function() {
- var oldSaveBox = document.getElementById("save-box");
- var newSaveBox = document.createElement("div");
- newSaveBox.style.display = "none";
- newSaveBox.id = "new-save-box";
- var newSaveBtn = document.createElement("div");
- newSaveBtn.style =
- "font-size: 14px;display: flex;justify-content: center;align-items: center;background-color: #4486f6;color: white;height: 25px;width: 120px;border-radius: 100px;margin-right: 10px;cursor: pointer;";
- var newSaveIcon = document.createElement("img");
- newSaveIcon.style = "width: 13px;height: 13px;margin-right: 5px;";
- newSaveIcon.setAttribute("src", "/static/home/images/console/saveicon.svg");
- var newSaveTittle = document.createElement("span");
- newSaveTittle.innerText = "保存并应用";
- newSaveBtn.onclick = function() {
- if (saveFlag) {
- store.set("settingsData", settings.getAll());
- saveFlag = false;
- console.log("保存增强设置");
- setTimeout(function() {
- var msgBox = document.getElementById("msg-box");
- msgBox.style =
- "opacity:0.8;margin-top:50px;display:inline-block;";
- msgBox.innerText = "增强设置保存成功";
- setTimeout(function() {
- location.reload();
- }, 500);
- }, 300);
- }
- document.getElementById("console-close-btn").click();
- };
- newSaveBtn.appendChild(newSaveIcon);
- newSaveBtn.appendChild(newSaveTittle);
- newSaveBox.appendChild(newSaveBtn);
- oldSaveBox.parentElement.insertBefore(newSaveBox, oldSaveBox);
- },
- //on方法是增强设置页面的启动方法
- on: function() {
- var moreSetPage = document.getElementById("console-moreSet-content");
- if (moreSetPage) {
- document.getElementsByClassName("console-title-img")[0].src =
- "/static/home/images/console/set1.svg";
- document.getElementsByClassName("console-title")[0].innerText = "增强设置";
- document.getElementById("console-menu").style.display = "none";
- moreSetPage.style.display = "block";
- } else {
- console.log("增强设置页不存在");
- }
- },
- //off方法是增强设置页面的关闭/隐藏方法
- off: function() {
- var moreSetPage = document.getElementById("console-moreSet-content");
- var newSaveBox = document.getElementById("new-save-box");
- if (moreSetPage && moreSetPage.style.display !== "none") {
- moreSetPage.style.display = "none";
- }
- if (newSaveBox.style.display !== "none") {
- newSaveBox.style.display = "none";
- }
- },
- //addExtEvent方法用于增加一些额外的事件
- addExtEvent: function() {
- var target;
- //版本更新
- target = document.getElementById("updateBtn");
- if (target) {
- target.onclick = function() {
- location.href = "https://gf.qytechs.cn/zh-CN/scripts/431279";
- }
- target.style.cursor = "pointer";
- }
- //反馈建议
- target = document.getElementById("contactBtn");
- if (target) {
- target.onclick = function() {
- location.href = "https://gf.qytechs.cn/zh-CN/scripts/431279/feedback";
- }
- target.style.cursor = "pointer";
- }
- //导入配置
- target = document.getElementById("importSetBtn");
- if (target) {
- target.onclick = function() {
- var data = prompt("在这粘贴需要导入的配置数据:");
- data = data.trim();
- try {
- if (data !== null && data !== "") {
- data = JSON.parse(data);
- store.set("settingsData", data.settingsData);
- alert("导入配置成功");
- location.reload();
- }
- } catch (e) {
- alert("配置数据错误,导入配置失败");
- }
- }
- target.style.cursor = "pointer";
- }
- //导出配置
- target = document.getElementById("exportSetBtn");
- if (target) {
- target.onclick = function() {
- var exportBox = document.createElement("input");
- exportBox.value = "{'settingsData':" + JSON.stringify(settings.getAll()) + "}";
- document.body.appendChild(exportBox);
- exportBox.select();
- document.execCommand('copy');
- exportBox.remove();
- alert("配置数据已成功导出到剪贴板");
- }
- target.style.cursor = "pointer";
- }
- //重置配置
- target = document.getElementById("recoverSetBtn");
- if (target) {
- target.onclick = function() {
- var msg = "即将重置配置数据\n点击确认开始重置";
- if (confirm(msg)) {
- var data = settings.getBackup();
- if (JSON.stringify(data).trim() !== "{}") {
- store.set("settingsData", data);
- alert("配置数据重置成功");
- location.reload();
- } else {
- msg = "重置配置功能错误,请联系脚本制作者\n点击确认前往反馈";
- if (confirm(msg)) {
- var btn = document.getElementById("contactBtn");
- if (btn) {
- btn.click();
- }
- }
- }
- }
- }
- target.style.cursor = "pointer";
- }
- },
- //initPC方法是针对PC模式的增强设置初始化方法,是增强设置的启动方法
- initPC: function() {
- var consoleBox = document.getElementById("console-box");
- if (consoleBox) {
- var closeBtn = document.getElementById("console-close-btn");
- if (closeBtn) {
- closeBtn.addEventListener("click", newSettingsPageFn.off);
- }
- this.createMenu();
- this.createSaveBtn();
- this.createPage(this.optData);
- this.addExtEvent();
- }
- },
- //initMobile方法是针对Mobile模式的增强设置初始化方法,是增强设置的启动方法
- initMobile: function() {
- var menuWrap = document.getElementById("menu-wrap");
- if (menuWrap) {
- var menuObj = menuWrap.children[1];
- if (menuObj && menuObj.tagName === "UL") {
- var newOpt = document.createElement("li");
- newOpt.style = "cursor:pointer;"
- newOpt.innerHTML = "<img src='/static/home/images/console/set1.svg'/><span>增强设置</span>";
- newOpt.onclick = function() {
- var res = confirm("增强设置请前往电脑版操作,点击确认前往电脑版");
- if (res) {
- location.href = "https://www.jianfast.com/?pc=1";
- }
- }
- menuObj.appendChild(newOpt);
- }
- var menuNotice = document.getElementById("menu-notice");
- var newNotice = "<div>" + menuNotice.children[1].innerText +
- "</div><div>对增强设置进行修改请前往电脑版网页操作</div><div>增强设置-搜索结果打开方式仅对电脑版生效</div>";
- menuNotice.children[1].innerHTML = newNotice;
- }
- },
- //init方法调用initPC方法与initMobile方法初始化增强设置,是对外统一调用的初始化方法
- init: function() {
- this.initPC();
- this.initMobile();
- }
- };
- //searchEngine对象为搜索引擎项
- var searchEngine = {
- //change方法用于改变搜索按钮类型,从而便于覆盖搜索打开方式
- change: function() {
- var searchBtn = document.getElementById("search-btn");
- if (searchBtn) {
- searchBtn.type = "text";
- }
- },
- //click方法用于覆盖原搜索按钮点击方法
- click: function() {
- if (location.href.search("jianfast.com/m") === -1) {
- var searchBar = document.getElementById("search");
- var url = searchBar.getAttribute("data-engine-start");
- var val = searchBar.value;
- if (settings.get("searchEngine")) {
- location.href = url + val;
- } else {
- open(url + val);
- }
- }
- },
- //enter方法用于覆盖原回车搜索方法
- enter: function(event) {
- if (event.keyCode === 13) {
- searchEngine.click();
- }
- },
- //init方法用于初始化搜索引擎,覆盖新方法
- init: function() {
- searchEngine.change();
- var searchBtn = document.getElementById("search-btn");
- if (searchBtn) {
- searchBtn.onclick = this.click;
- }
- var searchBar = document.getElementById("search");
- if (searchBar) {
- searchBar.onkeydown = this.enter;
- }
- },
- //monitor方法用于检错、监控修改结果,若出错则调用init方法重新覆盖
- monitor: function() {
- var searchForm = document.getElementById("search-form");
- var searchBar = document.getElementById("search");
- var searchBtn = document.getElementById("search-btn");
- if ((searchBar && searchBar.onkeydown === null) || (searchBtn && searchBtn.type !== "text") || (
- searchBtn && searchBtn.onclick === null)) {
- this.initSearch();
- }
- }
- }
- //bookMarks对象为主页书签项
- var bookMarks = {
- //change方法用于改变书签打开方式
- change: function(Obj) {
- if (Obj.tagName === "A") {
- if (settings.get("bookMarks") && Obj.target !== "") {
- Obj.target = "";
- } else if (!settings.get("bookMarks") && Obj.target !== "_blank") {
- Obj.target = "_blank";
- }
- }
- },
- //init方法用于遍历书签并调用change方法改变打开方式
- init: function() {
- var siteBox, aBox, aBoxLen;
- var idArray = ["site-box", "site-wrap"];
- for (let i = 0; i < idArray.length; i++) {
- siteBox = document.getElementById(idArray[i])
- if (siteBox) {
- break;
- }
- }
- if (siteBox && siteBox.childElementCount > 0) {
- for (let i = 0; i < siteBox.childElementCount; i++) {
- this.change(siteBox.children[i]);
- }
- }
- },
- //monitor方法用于检错程序
- monitor: function() {
- this.init();
- }
- }
- //serchForcast搜索栏联想词预测相关功能
- var serchForcast = {
- display: function() {
- var keywordBox = document.getElementById("search-keyword-box");
- if (keywordBox && !settings.get("serchForcast")) {
- keywordBox.remove();
- }
- },
- //click方法用于覆盖原联想词点击方法
- click: function(target) {
- var searchBar = document.getElementById("search");
- searchBar.value = target.innerText;
- searchEngine.click();
- },
- //mouseOver方法用于覆盖原联想词鼠标事件(置于上方)方法
- mouseOver: function(target) {
- var targetPare = target.parentElement;
- if (targetPare && targetPare.childElementCount > 0) {
- for (let i = 0; i < targetPare.childElementCount; i++) {
- this.mouseLeave(targetPare.children[i]);
- }
- }
- target.style = "background-color: rgb(241, 241, 241);";
- },
- //mouseLeave方法用于覆盖原联想词鼠标事件(离开)方法
- mouseLeave: function(target) {
- target.style = "background-color: rgba(255, 255, 255, 0.3);";
- },
- //change方法用于改变搜索栏联想词相关功能
- change: function(keywordBox) {
- if (keywordBox) {
- keywordBox.innerHTML = keywordBox.innerHTML; //整体覆盖删除原方法
- var keyword = keywordBox.children;
- if (keyword.length > 0) {
- for (let i = 0; i < keyword.length; i++) { //增加新方法
- keyword[i].onmouseover = function() {
- serchForcast.mouseOver(keyword[i]);
- };
- keyword[i].onmouseleave = function() {
- serchForcast.mouseLeave(keyword[i]);
- };
- keyword[i].onclick = function() {
- serchForcast.click(keyword[i]);
- };
- }
- }
- }
- },
- //close方法用于关闭设置时若未保存重置按键值
- close: function() {
- var localData = store.get("settingsData");
- var localValue = localData.serchForcast;
- var settingValue = settings.get("serchForcast");
- if (typeof localValue === "boolean" && typeof settingValue === "boolean" && localValue !==
- settingValue) {
- var targetBtn = document.getElementById("moreSet-Opt-serchForcast-" + localValue);
- if (targetBtn) {
- targetBtn.click();
- }
- targetBtn = document.getElementById("new-save-box");
- if (targetBtn && targetBtn.style.display !== "none") {
- targetBtn.style.display = "none";
- }
- }
- },
- //init方法用于初始化相关功能
- init: function() {
- addLoadEvent(this.display);
- this.change();
- var closeBtn = document.getElementById("console-close-btn");
- if (closeBtn) {
- closeBtn.addEventListener("click", serchForcast.close);
- }
- },
- //monitor方法用于检错程序
- monitor: function() {
- var keywordBox = document.getElementById("search-keyword-box");
- if (keywordBox && keywordBox.childElementCount > 0) {
- var keywordInitFlag = false;
- var keyword = keywordBox.children;
- for (let i = 0; i < keyword.length; i++) {
- if (keyword[i].onmouseover === null || keyword[i].onmouseleave === null || keyword[i]
- .onclick === null) {
- keywordInitFlag = true;
- break;
- }
- }
- if (keywordInitFlag) {
- this.change(keywordBox);
- }
- }
- }
- };
- //settingsPurify为设置页净化功能
- var settingsPurify = {
- //init方法用于初始化净化广告
- init: function() {
- var adObj = document.getElementsByClassName("console-bottom-ad")[0];
- if (adObj) {
- if (settings.get("settingsPurify") && adObj.style.display !== "none") {
- adObj.style.display = "none";
- } else if (!settings.get("settingsPurify") && adObj.style.display === "none") {
- adObj.style.display = "";
- }
- }
- var bottomBtnBox = document.getElementById("console-bottom-btn-box");
- if (bottomBtnBox) {
- var bottomBtn = bottomBtnBox.children[1];
- if (bottomBtn) {
- if (settings.get("settingsPurify") && bottomBtn.innerText === "设为主页") {
- bottomBtn.innerText = "移动版";
- bottomBtn.href = "/m";
- bottomBtn.target = "";
- } else if (!settings.get("settingsPurify") && bottomBtn.innerText !== "设为主页") {
- bottomBtn.innerText = "设为主页";
- bottomBtn.href = "/zhuye";
- bottomBtn.target = "_blank";
- }
- }
- bottomBtn = bottomBtnBox.children[2];
- if (bottomBtn) {
- if (settings.get("settingsPurify") && bottomBtn.innerText === "关于") {
- bottomBtn.innerText = "问题反馈";
- bottomBtn.href = "/contact";
- bottomBtn.target = "_blank";
- } else if (!settings.get("settingsPurify") && bottomBtn.innerText !== "关于") {
- bottomBtn.innerText = "关于";
- bottomBtn.href = "/about";
- bottomBtn.target = "_blank";
- }
- }
- }
- },
- //monitor方法用于检错程序
- monitor: function() {
- this.init();
- }
- }
- //hideRandBg为主页随机背景入口隐藏功能
- var hideRandBg = {
- //init方法用于初始化入口隐藏
- init: function() {
- var randBgBtn = document.getElementById("rand-bg-btn");
- if (randBgBtn) {
- if (settings.get("hideRandBg") && randBgBtn.style.display !== "none") {
- randBgBtn.style.display = "none";
- } else if (!settings.get("hideRandBg") && randBgBtn.style.display === "none") {
- randBgBtn.style.display = "";
- }
- }
- },
- //monitor方法用于检错程序
- monitor: function() {
- this.init();
- }
- }
- //全局变量配置
- var saveFlag = false; //saveFlag用于判断是否需要保存增强设置
- //启动主程序
- settings.on();
- })();