Skip to content

Commit

Permalink
fix: userscript
Browse files Browse the repository at this point in the history
  • Loading branch information
shenruisi committed Jan 8, 2022
1 parent 3b90730 commit a95d309
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
16 changes: 8 additions & 8 deletions Stay.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -1201,7 +1201,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.0.0;
MARKETING_VERSION = 2.0.1;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -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";
Expand All @@ -1233,7 +1233,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.0.0;
MARKETING_VERSION = 2.0.1;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -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";
Expand All @@ -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)";
Expand All @@ -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";
Expand All @@ -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)";
Expand Down
2 changes: 1 addition & 1 deletion Stay/stay/userscript/stay-google.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
17 changes: 5 additions & 12 deletions Stay/stay/userscript/stay-zhihu.user.js
Original file line number Diff line number Diff line change
@@ -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/*
Expand Down Expand Up @@ -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"){
Expand All @@ -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');
Expand Down

0 comments on commit a95d309

Please sign in to comment.