7
7
// @name :ru-RU Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
8
8
// @name :ru Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
9
9
// @namespace https://github.com/jae-jae/Userscript-Plus
10
- // @version 2.3.8
10
+ // @version 2.3.9
11
11
// @description Show current site all UserJS,The easier way to install UserJs for Tampermonkey.
12
12
// @description :zh 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
13
13
// @description :zh-CN 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
18
18
// @author Jaeger <JaegerCode@gmail.com>
19
19
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3ggEBCQHM3fXsAAAAVdJREFUOMudkz2qwkAUhc/goBaGJBgUtBCZyj0ILkpwAW7Bws4yO3AHLiCtEFD8KVREkoiFxZzX5A2KGfN4F04zMN+ce+5c4LMUgDmANYBnrnV+plBSi+FwyHq9TgA2LQpvCiEiABwMBtzv95RSfoNEHy8DYBzHrNVqVEr9BWKcqNFoxF6vx3a7zc1mYyC73a4MogBg7vs+z+czO50OW60Wt9stK5UKp9Mpj8cjq9WqDTBHnjAdxzGQZrPJw+HA31oulzbAWgLoA0CWZVBKIY5jzGYzdLtdE9DlcrFNrY98zobqOA6TJKHW2jg4nU5sNBpFDp6mhVe5rsvVasUwDHm9Xqm15u12o+/7Hy0gD8KatOd5vN/v1FozTVN6nkchxFuI6hsAAIMg4OPxMJCXdtTbR7JJCMEgCJhlGUlyPB4XfumozInrupxMJpRSRtZlKoNYl+m/6/wDuWAjtPfsQuwAAAAASUVORK5CYII=
20
20
// @include *
21
- // @require https://cdn.jsdelivr.net/gh/jae-jae/l.js/userjs/l.userjs.min.js
22
- // @require https://greasyfork.org/scripts/23420-userjs-base -js/code/userjs-basejs .js
21
+ // @require https://cdn.jsdelivr.net/gh/jae-jae/l.js/userjs/l.userjs.min.js
22
+ // @require https://greasyfork.org/scripts/429994-l-lib -js/code/l-libjs .js
23
23
// @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.js?_=1620545416123
24
24
// @resource ui https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.html?_=1620545416123
25
25
// @resource count https://greasyfork.org/scripts/by-site.json
@@ -42,125 +42,125 @@ unsafeWindow.GmAjax = GM_xmlhttpRequest;
42
42
43
43
( function ( ) {
44
44
45
- 'use strict' ;
46
-
47
- var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
48
-
49
- function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
50
-
51
- var FetchUserjs = function ( ) {
52
- function FetchUserjs ( ) {
53
- _classCallCheck ( this , FetchUserjs ) ;
54
-
55
- this . host = this . getMainHost ( ) ;
56
- this . showTime = 10 ;
57
- this . quietKey = 'jae_fetch_userjs_quiet' ;
58
- this . countKey = 'jae_fetch_userjs_count' ;
59
- 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>' ;
60
- }
61
-
62
- _createClass ( FetchUserjs , [ {
63
- key : 'getMainHost' ,
64
- value : function getMainHost ( ) {
65
- var host = window . location . hostname ;
66
- return psl . get ( host ) || host . split ( '.' ) . splice ( - 2 ) . join ( '.' ) ;
67
- }
68
- } , {
69
- key : 'getCountData' ,
70
- value : function getCountData ( host ) {
71
- var countData = GM_getResourceText ( 'count' ) ;
72
- countData = JSON . parse ( countData ) ;
73
- var count = countData [ host ] ;
74
- sessionStorage . setItem ( this . countKey , count ) ;
75
- return count ;
76
- }
77
- } , {
78
- key : 'setSize' ,
79
- value : function setSize ( w , h ) {
80
- $ ( '.jae-userscript' ) . css ( {
81
- width : w ,
82
- height : h
83
- } ) ;
84
- }
85
- } , {
86
- key : 'addEventListener' ,
87
- value : function addEventListener ( eventName , handler ) {
88
- document . getElementById ( 'jae_userscript_box' ) . addEventListener ( eventName , handler ) ;
89
- }
90
- } , {
91
- key : 'bindEvent' ,
92
- value : function bindEvent ( ) {
93
- var _this = this ;
94
-
95
- this . timeId = setTimeout ( function ( ) {
96
- $ ( '#jae_userscript_box' ) . remove ( ) ;
97
- } , this . showTime * 1000 ) ;
98
-
99
- this . addEventListener ( 'max' , function ( ) {
100
- _this . setSize ( 860 , 492 ) ;
101
- $ ( '.jae-userscript' ) . addClass ( 'jae-userscript-shadow' ) ;
102
- clearTimeout ( _this . timeId ) ;
103
- } ) ;
104
-
105
- this . addEventListener ( 'min' , function ( ) {
106
- setTimeout ( function ( ) {
107
- $ ( '.jae-userscript' ) . removeClass ( 'jae-userscript-shadow' ) ;
108
- _this . setSize ( 370 , 56 ) ;
109
- } , 500 ) ;
110
- } ) ;
111
-
112
- this . addEventListener ( 'close' , function ( ) {
113
- sessionStorage . setItem ( _this . quietKey , 1 ) ;
114
- $ ( '#jae_userscript_box' ) . remove ( ) ;
115
- } ) ;
116
-
117
- this . addEventListener ( 'loading' , function ( ) {
118
- clearTimeout ( _this . timeId ) ;
119
- } ) ;
120
- }
121
- } , {
122
- key : 'execFrameJs' ,
123
- value : function execFrameJs ( frameWindow ) {
124
- var uiJs = GM_getResourceText ( 'uiJs' ) ;
125
- return function ( jsStr ) {
126
- frameWindow . eval ( jsStr ) ;
127
- } . call ( frameWindow , uiJs ) ;
128
- }
129
- } , {
130
- key : 'render' ,
131
- value : function render ( ) {
132
- if ( ! this . isQuiet ) {
133
- var count = this . getCountData ( this . host ) ;
134
- if ( count ) {
135
- $ ( 'body' ) . append ( this . tplBox ) ;
136
-
137
- var ui = GM_getResourceText ( 'ui' ) ;
138
- var dom = document . getElementsByClassName ( 'jae-userscript' ) [ 0 ] ;
139
- var tpl = '<iframe name="jaeFetchUserJSFrame" src="about:blank" style="width:100%;height:100%;border:0px;display: block!important;" allowTransparency="true"></iframe>' ;
140
- dom . innerHTML = tpl ;
141
- var iframeDom = dom . children [ 0 ] ;
142
- iframe . write ( iframeDom , ui ) ;
143
-
144
- this . execFrameJs ( jaeFetchUserJSFrame . window ) ;
145
-
146
- this . bindEvent ( ) ;
147
- }
148
- }
149
- }
150
- } , {
151
- key : 'isQuiet' ,
152
- get : function get ( ) {
153
- var quiet = sessionStorage . getItem ( this . quietKey ) ;
154
- return quiet ? true : false ;
155
- }
156
- } ] ) ;
157
-
158
- return FetchUserjs ;
159
- } ( ) ;
160
-
161
- ljs . exec ( [ 'jQuery' , 'iframe' , 'psl' ] , function ( ) {
162
- var fu = new FetchUserjs ( ) ;
163
- fu . render ( ) ;
45
+ 'use strict' ;
46
+
47
+ var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
48
+
49
+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
50
+
51
+ var FetchUserjs = function ( ) {
52
+ function FetchUserjs ( ) {
53
+ _classCallCheck ( this , FetchUserjs ) ;
54
+
55
+ this . host = this . getMainHost ( ) ;
56
+ this . showTime = 10 ;
57
+ this . quietKey = 'jae_fetch_userjs_quiet' ;
58
+ this . countKey = 'jae_fetch_userjs_count' ;
59
+ 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>' ;
60
+ }
61
+
62
+ _createClass ( FetchUserjs , [ {
63
+ key : 'getMainHost' ,
64
+ value : function getMainHost ( ) {
65
+ var host = window . location . hostname ;
66
+ return psl . get ( host ) || host . split ( '.' ) . splice ( - 2 ) . join ( '.' ) ;
67
+ }
68
+ } , {
69
+ key : 'getCountData' ,
70
+ value : function getCountData ( host ) {
71
+ var countData = GM_getResourceText ( 'count' ) ;
72
+ countData = JSON . parse ( countData ) ;
73
+ var count = countData [ host ] ;
74
+ sessionStorage . setItem ( this . countKey , count ) ;
75
+ return count ;
76
+ }
77
+ } , {
78
+ key : 'setSize' ,
79
+ value : function setSize ( w , h ) {
80
+ $ ( '.jae-userscript' ) . css ( {
81
+ width : w ,
82
+ height : h
83
+ } ) ;
84
+ }
85
+ } , {
86
+ key : 'addEventListener' ,
87
+ value : function addEventListener ( eventName , handler ) {
88
+ document . getElementById ( 'jae_userscript_box' ) . addEventListener ( eventName , handler ) ;
89
+ }
90
+ } , {
91
+ key : 'bindEvent' ,
92
+ value : function bindEvent ( ) {
93
+ var _this = this ;
94
+
95
+ this . timeId = setTimeout ( function ( ) {
96
+ $ ( '#jae_userscript_box' ) . remove ( ) ;
97
+ } , this . showTime * 1000 ) ;
98
+
99
+ this . addEventListener ( 'max' , function ( ) {
100
+ _this . setSize ( 860 , 492 ) ;
101
+ $ ( '.jae-userscript' ) . addClass ( 'jae-userscript-shadow' ) ;
102
+ clearTimeout ( _this . timeId ) ;
103
+ } ) ;
104
+
105
+ this . addEventListener ( 'min' , function ( ) {
106
+ setTimeout ( function ( ) {
107
+ $ ( '.jae-userscript' ) . removeClass ( 'jae-userscript-shadow' ) ;
108
+ _this . setSize ( 370 , 56 ) ;
109
+ } , 500 ) ;
110
+ } ) ;
111
+
112
+ this . addEventListener ( 'close' , function ( ) {
113
+ sessionStorage . setItem ( _this . quietKey , 1 ) ;
114
+ $ ( '#jae_userscript_box' ) . remove ( ) ;
115
+ } ) ;
116
+
117
+ this . addEventListener ( 'loading' , function ( ) {
118
+ clearTimeout ( _this . timeId ) ;
119
+ } ) ;
120
+ }
121
+ } , {
122
+ key : 'execFrameJs' ,
123
+ value : function execFrameJs ( frameWindow ) {
124
+ var uiJs = GM_getResourceText ( 'uiJs' ) ;
125
+ return function ( jsStr ) {
126
+ frameWindow . eval ( jsStr ) ;
127
+ } . call ( frameWindow , uiJs ) ;
128
+ }
129
+ } , {
130
+ key : 'render' ,
131
+ value : function render ( ) {
132
+ if ( ! this . isQuiet ) {
133
+ var count = this . getCountData ( this . host ) ;
134
+ if ( count ) {
135
+ $ ( 'body' ) . append ( this . tplBox ) ;
136
+
137
+ var ui = GM_getResourceText ( 'ui' ) ;
138
+ var dom = document . getElementsByClassName ( 'jae-userscript' ) [ 0 ] ;
139
+ var tpl = '<iframe name="jaeFetchUserJSFrame" src="about:blank" style="width:100%;height:100%;border:0px;display: block!important;" allowTransparency="true"></iframe>' ;
140
+ dom . innerHTML = tpl ;
141
+ var iframeDom = dom . children [ 0 ] ;
142
+ iframe . write ( iframeDom , ui ) ;
143
+
144
+ this . execFrameJs ( jaeFetchUserJSFrame . window ) ;
145
+
146
+ this . bindEvent ( ) ;
147
+ }
148
+ }
149
+ }
150
+ } , {
151
+ key : 'isQuiet' ,
152
+ get : function get ( ) {
153
+ var quiet = sessionStorage . getItem ( this . quietKey ) ;
154
+ return quiet ? true : false ;
155
+ }
156
+ } ] ) ;
157
+
158
+ return FetchUserjs ;
159
+ } ( ) ;
160
+
161
+ ljs . exec ( [ 'jQuery' , 'iframe' , 'psl' ] , function ( ) {
162
+ var fu = new FetchUserjs ( ) ;
163
+ fu . render ( ) ;
164
164
} ) ;
165
165
166
- } ) ( ) ;
166
+ } ) ( ) ;
0 commit comments