From a95d309868036239d193e332c6dfb06818756f2c Mon Sep 17 00:00:00 2001 From: shen yin Date: Sat, 8 Jan 2022 11:02:36 +0800 Subject: [PATCH] fix: userscript --- Stay.xcodeproj/project.pbxproj | 16 ++++++++-------- Stay/stay/userscript/stay-google.user.js | 2 +- Stay/stay/userscript/stay-zhihu.user.js | 17 +++++------------ 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Stay.xcodeproj/project.pbxproj b/Stay.xcodeproj/project.pbxproj index 933dbb54..df451b3c 100755 --- a/Stay.xcodeproj/project.pbxproj +++ b/Stay.xcodeproj/project.pbxproj @@ -1187,7 +1187,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Stay Extension/Stay Extension.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = J25G7D7AL3; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Stay Extension/Info.plist"; @@ -1201,7 +1201,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; OTHER_LDFLAGS = ( "-framework", SafariServices, @@ -1219,7 +1219,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "Stay Extension/Stay Extension.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = J25G7D7AL3; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Stay Extension/Info.plist"; @@ -1233,7 +1233,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; OTHER_LDFLAGS = ( "-framework", SafariServices, @@ -1255,7 +1255,7 @@ CODE_SIGN_ENTITLEMENTS = Stay/Stay.entitlements; CODE_SIGN_STYLE = Automatic; COPY_HEADERS_RUN_UNIFDEF = NO; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 19; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = J25G7D7AL3; GCC_PREFIX_HEADER = "$(SRCROOT)/Stay/PrefixHeader.pch"; @@ -1276,7 +1276,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.dajiu.stay.pro; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1298,7 +1298,7 @@ CODE_SIGN_ENTITLEMENTS = Stay/Stay.entitlements; CODE_SIGN_STYLE = Automatic; COPY_HEADERS_RUN_UNIFDEF = NO; - CURRENT_PROJECT_VERSION = 16; + CURRENT_PROJECT_VERSION = 19; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = J25G7D7AL3; GCC_PREFIX_HEADER = "$(SRCROOT)/Stay/PrefixHeader.pch"; @@ -1319,7 +1319,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.dajiu.stay.pro; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Stay/stay/userscript/stay-google.user.js b/Stay/stay/userscript/stay-google.user.js index 38431d45..35ab08d0 100644 --- a/Stay/stay/userscript/stay-google.user.js +++ b/Stay/stay/userscript/stay-google.user.js @@ -72,7 +72,7 @@ function banBottomBanner(){ } function replaceDirectUrl(){ - let divs = document.querySelectorAll('div[data-sokoban-grid]'); + let divs = document.querySelectorAll("a[href*='zhihu'],a[href*='tieba.baidu'],a[href*='xiaohongshu'],a[href*='bilibili']"); for (var i = 0; i < divs.length; i++){ let div = divs[i]; let a = div.querySelector('a'); diff --git a/Stay/stay/userscript/stay-zhihu.user.js b/Stay/stay/userscript/stay-zhihu.user.js index 53763935..190daca6 100644 --- a/Stay/stay/userscript/stay-zhihu.user.js +++ b/Stay/stay/userscript/stay-zhihu.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 知乎@AutoExpend // @namespace http://stay.app/ -// @version 0.0.1 +// @version 0.0.2 // @description 自动展开回答,支持知乎桌面版 // @author Stay² // @match *://*.zhihu.com/* @@ -110,6 +110,10 @@ function supportDesktopBrowsingIfNeeded(){ document.documentElement.appendChild(node); } } + else{ + let tasks = [removeChoosePanel,removeAppJump,replaceDirectUrl,unfold]; + Stay_Inject.run(tasks,100,30,false).then((data) => {}); + } } if (document.readyState !== "loading"){ @@ -121,17 +125,6 @@ else{ }); } -window.onload = function(){ - console.log("console log window.onload"); - GM_log("gmlog window.onload"); - if (!/Macintosh/.test(window.navigator.userAgent)){ - - let tasks = [removeChoosePanel,removeAppJump,replaceDirectUrl,unfold]; - Stay_Inject.run(tasks,100,30,false).then((data) => {}); - } - -} - document.addEventListener("scroll", function(event) { if (!/Macintosh/.test(window.navigator.userAgent)){ let guide = document.querySelector('div.DownloadGuide');