forked from shenruisi/Stay
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxhs-content.js
57 lines (49 loc) · 1.65 KB
/
xhs-content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function removeTopBanner(){
let app = document.querySelector("#app");
if (app){
let navbar = app.querySelector(".normal-launch-app-container");
if (navbar){
navbar.style.display = "none";
return COMPLETE;
}
}
return CONTINUE;
}
function removeAppJump(){
let app = document.querySelector("#app");
if (app){
let bottombar = app.querySelector(".bottom-bar");
if (bottombar){
bottombar.remove();
var url = window.location.href;
return new App()
.id("xhs")
.title(app.querySelector(".title").innerText || "小红书")
.icon("https://is4-ssl.mzstatic.com/image/thumb/Purple125/v4/06/00/2f/06002f58-01e1-4d98-5ae2-5807eb4c059f/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/230x0w.png")
.url("xhsdiscover://item/"+url.substring(url.lastIndexOf('/')+1))
.data();
}
}
return CONTINUE;
}
function unfold(){
let app = document.querySelector("#app");
if (app){
let checkmore = app.querySelector(".check-more");
if (checkmore){
checkmore.style.display = "none";
let content = app.querySelector(".content");
if (content){
content.style.height = null;
return COMPLETE;
}
}
}
return CONTINUE;
}
window.onload = function() {
let tasks = [removeTopBanner,removeAppJump,unfold];
Inject.run(tasks,100,30,false).then((data) => {
browser.runtime.sendMessage({from:"content",operate:"saveAppList",data:data})
});
}