1+ // ==UserScript==
2+ // @name Magic Userscript+ : Show Site All UserJS
3+ // @name :zh Magic Userscript+ : 显示当前网站所有可用的UserJS脚本 Jaeger
4+ // @name :zh-CN Magic Userscript+ : 显示当前网站所有可用的UserJS脚本 Jaeger
5+ // @name :zh-TW Magic Userscript+ : 顯示當前網站所有可用的UserJS腳本 Jaeger
6+ // @name :ja Magic Userscript+ : 現在のサイトの利用可能なすべてのUserJSスクリプトを表示するJaeger
7+ // @name :ru-RU Magic Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
8+ // @name :ru Magic Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
9+ // @namespace https://github.com/magicoflolis/Userscript-Plus
10+ // @version 2.3.11
11+ // @description Show current site all UserJS,The easier way to install UserJs for Tampermonkey.
12+ // @description :zh 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
13+ // @description :zh-CN 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
14+ // @description :zh-TW 顯示當前網站的所有可用UserJS(Tampermonkey)腳本,交流QQ群:104267383
15+ // @description :ja 現在のサイトで利用可能なすべてのUserJS(Tampermonkey)スクリプトを表示します。
16+ // @description :ru-RU Показывает пользовательские скрипты (UserJS) для сайта. Легкий способ установить пользовательские скрипты для Tampermonkey.
17+ // @description :ru Показывает пользовательские скрипты (UserJS) для сайта. Легкий способ установить пользовательские скрипты для Tampermonkey.
18+ // @author Magic of Lolis <magicoflolis@gmail.com>
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+ // @include *
21+ // @exclude *://mega.nz/*
22+ // @exclude *://*.alipay.com/*
23+ // @exclude *://*.paypal.com/*
24+ // @exclude *://*bank.*/*
25+ // @exclude *://*perfectmoney.*/*
26+ // @exclude *://*stripe.com/*
27+ // @exclude *://*ica.yandex.com/*
28+ // @exclude *://*authorize.net/*
29+ // @exclude *://*2checkout.com/*
30+ // @exclude *://bitpay.com/*
31+ // @exclude *://192.168*
32+ // @exclude *://127.0.0*
33+ // @exclude *://router.*.*/*
34+ // @exclude *://github.com/*
35+ // @exclude *://gitlab.com/*
36+ // @exclude *://10.0.0*
37+ // @exclude *://*skrill.com/*
38+ // @exclude *://*zalo.me/*
39+ // @exclude *://pay.amazon.com/*
40+ // @exclude *://*.opayo.co.uk/*
41+ // @exclude *://*.payza.org/*
42+ // @exclude *://*.bluesnap.com/*
43+ // @exclude *://securionpay.com/*
44+ // @exclude *://*.unionpayintl.*/*
45+ // @exclude *://*.99bill.com/*
46+ // @exclude *://*.yeepay.com/*
47+ // @exclude *://*payoneer.com/*
48+ // @exclude *://*myetherwallet.com/*
49+ // @require https://greasyfork.org/scripts/23419-l-js/code/ljs.js
50+ // @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
51+ // @require https://greasyfork.org/scripts/23419-l-js/code/ljs.js
52+ // @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
53+ // @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.gf.js?_=1616632403423
54+ // @resource ui https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.html?_=1616632403424
55+ // @resource count https://greasyfork.org/scripts/by-site.json
56+ // @resource adult https://sleazyfork.org/scripts/by-site.json
57+ // @grant GM_xmlhttpRequest
58+ // @grant GM_getResourceText
59+ // @grant GM_getValue
60+ // @grant GM_setValue
61+ // @grant unsafeWindow
62+ // @noframes
63+ // @connect cdn.bootcss.com
64+ // @connect raw.githubusercontent.com
65+ // @connect gist.githubusercontent.com
66+ // @connect cdnjs.cloudflare.com
67+ // @connect greasyfork.org
68+ // @connect sleazyfork.org
69+ // @connect cdn.jsdelivr.net
70+ // @run -at document-end
71+ // ==/UserScript==
72+
73+ unsafeWindow . GmAjax = GM_xmlhttpRequest ;
74+
75+ ( function ( ) {
76+
77+ class FetchUserjs {
78+ constructor ( ) {
79+ this . host = this . getMainHost ( ) ;
80+ this . showTime = 10 ;
81+ this . quietKey = 'jae_fetch_userjs_quiet' ;
82+ this . countKey = 'jae_fetch_userjs_count' ;
83+ this . adultKey = 'jae_fetch_userjs_adult' ;
84+ 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>' ;
85+ }
86+
87+ getMainHost ( ) {
88+ let host = window . location . hostname ;
89+ return psl . get ( host ) || host . split ( '.' ) . splice ( - 2 ) . join ( '.' ) ;
90+ }
91+
92+ getCountData ( host ) {
93+ let countData = GM_getResourceText ( 'count' ) ;
94+ countData = JSON . parse ( countData ) ;
95+ let count = countData [ host ] ;
96+ sessionStorage . setItem ( this . countKey , count ) ;
97+ return count ;
98+ }
99+
100+ getAdultData ( host ) {
101+ let adultData = GM_getResourceText ( 'adult' ) ;
102+ adultData = JSON . parse ( adultData ) ;
103+ let adult = adultData [ host ] ;
104+ sessionStorage . setItem ( this . adultKey , adult ) ;
105+ return adult ;
106+ }
107+
108+ setSize ( w , h ) {
109+ $ ( '.jae-userscript' ) . css ( {
110+ width : w ,
111+ height : h
112+ } ) ;
113+ }
114+
115+ addEventListener ( eventName , handler ) {
116+ document . getElementById ( 'jae_userscript_box' ) . addEventListener ( eventName , handler ) ;
117+ }
118+
119+ bindEvent ( ) {
120+ this . timeId = setTimeout ( ( ) => {
121+ $ ( '#jae_userscript_box' ) . remove ( ) ;
122+ } , this . showTime * 1000 ) ;
123+
124+ this . addEventListener ( 'max' , ( ) => {
125+ this . setSize ( 860 , 492 ) ;
126+ $ ( '.jae-userscript' ) . addClass ( 'jae-userscript-shadow' ) ;
127+ clearTimeout ( this . timeId ) ;
128+ } ) ;
129+
130+ this . addEventListener ( 'min' , ( ) => {
131+ setTimeout ( ( ) => {
132+ $ ( '.jae-userscript' ) . removeClass ( 'jae-userscript-shadow' ) ;
133+ this . setSize ( 370 , 56 ) ;
134+ } , 500 ) ;
135+ } ) ;
136+
137+ this . addEventListener ( 'close' , ( ) => {
138+ sessionStorage . setItem ( this . quietKey , 1 ) ;
139+ $ ( '#jae_userscript_box' ) . remove ( ) ;
140+ } ) ;
141+
142+ this . addEventListener ( 'loading' , ( ) => {
143+ clearTimeout ( this . timeId ) ;
144+ } ) ;
145+ }
146+
147+ execFrameJs ( frameWindow ) {
148+ let uiJs = GM_getResourceText ( 'uiJs' ) ;
149+ return function ( jsStr ) {
150+ frameWindow . eval ( jsStr ) ;
151+ } . call ( frameWindow , uiJs ) ;
152+ }
153+
154+ get isQuiet ( ) {
155+ let quiet = sessionStorage . getItem ( this . quietKey ) ;
156+ return quiet ? true : false ;
157+ }
158+
159+ render ( ) {
160+ if ( ! this . isQuiet ) {
161+ let count = this . getCountData ( this . host ) ;
162+ let adult = this . getAdultData ( this . host ) ;
163+ if ( count || adult ) {
164+ $ ( 'body' ) . append ( this . tplBox ) ;
165+
166+ let ui = GM_getResourceText ( 'ui' ) ;
167+ let dom = document . getElementsByClassName ( 'jae-userscript' ) [ 0 ] ;
168+ var tpl = '<iframe name="jaeFetchUserJSFrame" src="about:blank" style="width:100%;height:100%;border:0px;display: block!important;" allowTransparency="true"></iframe>' ;
169+ dom . innerHTML = tpl ;
170+ var iframeDom = dom . children [ 0 ] ;
171+ iframe . write ( iframeDom , ui ) ;
172+
173+ this . execFrameJs ( jaeFetchUserJSFrame . window ) ;
174+
175+ this . bindEvent ( ) ;
176+ }
177+ }
178+ }
179+
180+ }
181+
182+ ljs . exec ( [ 'jQuery' , 'iframe' , 'psl' ] , ( ) => {
183+ let fu = new FetchUserjs ( ) ;
184+ fu . render ( ) ;
185+ } ) ;
186+
187+ } ) ( ) ;
0 commit comments