FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Userscript-Plus/userscript/main.js at master · zxysm/Userscript-Plus · GitHub
zxysm
/
Userscript-Plus
Public
forked from
jae-jae/Userscript-Plus
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Userscript-Plus
/
userscript
/
main.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
99 lines (82 loc) · 3.69 KB
Breadcrumbs
Userscript-Plus
/
userscript
/
main.js
Copy path
File metadata and controls
99 lines (82 loc) · 3.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
class
FetchUserjs
{
constructor
(
)
{
this
.
host
=
this
.
getMainHost
(
)
;
this
.
showTime
=
10
;
this
.
quietKey
=
'jae_fetch_userjs_quiet'
;
this
.
countKey
=
'jae_fetch_userjs_count'
;
this
.
tplBox
=
'<div id="jae_userscript_box"><style>.jae-userscript{position:fixed;width:370px;bottom:10px;right:20px;z-index:9999999999;height:56px}.jae-userscript-shadow{box-shadow:0 1px 4px rgba(0,0,0,.3),\\t\\t\\t\\t0px 0 20px rgba(0,0,0,.1) inset}.jae-userscript-shadow::before,.jae-userscript-shadow::after{content:"";position:absolute;z-index:-1}.jae-userscript-shadow::before,.jae-userscript-shadow::after{content:"";position:absolute;z-index:-1;bottom:15px;left:10px;width:50%;height:20%}.jae-userscript-shadow::before,.jae-userscript-shadow::after{content:"";position:absolute;z-index:-1;bottom:15px;left:10px;width:50%;height:20%;box-shadow:0 15px 10px rgba(0,0,0,.7);transform:rotate(-3deg)}.jae-userscript-shadow::after{right:10px;left:auto;transform:rotate(3deg)}</style><div class="jae-userscript" class=""></div></div>'
;
}
getMainHost
(
)
{
let
host
=
window
.
location
.
hostname
return
psl
.
get
(
host
)
||
host
.
split
(
'.'
)
.
splice
(
-
2
)
.
join
(
'.'
)
}
getCountData
(
host
)
{
let
countData
=
GM_getResourceText
(
'count'
)
countData
=
JSON
.
parse
(
countData
)
let
count
=
countData
[
host
]
sessionStorage
.
setItem
(
this
.
countKey
,
count
)
return
count
}
setSize
(
w
,
h
)
{
$
(
'.jae-userscript'
)
.
css
(
{
width
:
w
,
height
:
h
}
)
}
addEventListener
(
eventName
,
handler
)
{
document
.
getElementById
(
'jae_userscript_box'
)
.
addEventListener
(
eventName
,
handler
)
}
bindEvent
(
)
{
this
.
timeId
=
setTimeout
(
(
)
=>
{
$
(
'#jae_userscript_box'
)
.
remove
(
)
;
}
,
this
.
showTime
*
1000
)
;
this
.
addEventListener
(
'max'
,
(
)
=>
{
this
.
setSize
(
860
,
492
)
$
(
'.jae-userscript'
)
.
addClass
(
'jae-userscript-shadow'
)
clearTimeout
(
this
.
timeId
)
;
}
)
this
.
addEventListener
(
'min'
,
(
)
=>
{
setTimeout
(
(
)
=>
{
$
(
'.jae-userscript'
)
.
removeClass
(
'jae-userscript-shadow'
)
this
.
setSize
(
370
,
56
)
}
,
500
)
}
)
this
.
addEventListener
(
'close'
,
(
)
=>
{
sessionStorage
.
setItem
(
this
.
quietKey
,
1
)
;
$
(
'#jae_userscript_box'
)
.
remove
(
)
;
}
)
this
.
addEventListener
(
'loading'
,
(
)
=>
{
clearTimeout
(
this
.
timeId
)
;
}
)
}
execFrameJs
(
frameWindow
)
{
let
uiJs
=
GM_getResourceText
(
'uiJs'
)
;
return
function
(
jsStr
)
{
frameWindow
.
eval
(
jsStr
)
;
}
.
call
(
frameWindow
,
uiJs
)
;
}
get
isQuiet
(
)
{
let
quiet
=
sessionStorage
.
getItem
(
this
.
quietKey
)
;
return
quiet
?
true
:
false
;
}
render
(
)
{
if
(
!
this
.
isQuiet
)
{
let
count
=
this
.
getCountData
(
this
.
host
)
if
(
count
)
{
$
(
'body'
)
.
append
(
this
.
tplBox
)
;
let
ui
=
GM_getResourceText
(
'ui'
)
;
let
dom
=
document
.
getElementsByClassName
(
'jae-userscript'
)
[
0
]
var
tpl
=
'<iframe name="jaeFetchUserJSFrame" src="about:blank" style="width:100%;height:100%;border:0px;display: block!important;" allowTransparency="true"></iframe>'
;
dom
.
innerHTML
=
tpl
;
var
iframeDom
=
dom
.
children
[
0
]
;
iframe
.
write
(
iframeDom
,
ui
)
;
this
.
execFrameJs
(
jaeFetchUserJSFrame
.
window
)
;
this
.
bindEvent
(
)
;
}
}
}
}
ljs
.
exec
(
[
'jQuery'
,
'iframe'
,
'psl'
]
,
(
)
=>
{
let
fu
=
new
FetchUserjs
(
)
;
fu
.
render
(
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL