forked from jae-jae/Userscript-Plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow-site-all-userjs.user.js
More file actions
155 lines (136 loc) · 7.8 KB
/
Copy pathshow-site-all-userjs.user.js
File metadata and controls
155 lines (136 loc) · 7.8 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// ==UserScript==
// @name Userscript+ : Show Site All UserJS
// @name:zh Userscript+ : 显示当前网站所有可用的UserJS脚本 Jaeger
// @name:zh-CN Userscript+ : 显示当前网站所有可用的UserJS脚本 Jaeger
// @name:zh-TW Userscript+ : 顯示當前網站所有可用的UserJS腳本 Jaeger
// @name:ja Userscript +:現在のサイトの利用可能なすべてのUserJSスクリプトを表示するJaeger
// @namespace https://github.com/jae-jae/Userscript-Plus
// @version 2.3.0
// @description Show current site all UserJS,The easier way to install UserJs for Tampermonkey.
// @description:zh 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
// @description:zh-CN 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
// @description:zh-TW 顯示當前網站的所有可用UserJS(Tampermonkey)腳本,交流QQ群:104267383
// @description:ja 現在のサイトで利用可能なすべてのUserJS(Tampermonkey)スクリプトを表示します。
// @author Jaeger <JaegerCode@gmail.com>
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3ggEBCQHM3fXsAAAAVdJREFUOMudkz2qwkAUhc/goBaGJBgUtBCZyj0ILkpwAW7Bws4yO3AHLiCtEFD8KVREkoiFxZzX5A2KGfN4F04zMN+ce+5c4LMUgDmANYBnrnV+plBSi+FwyHq9TgA2LQpvCiEiABwMBtzv95RSfoNEHy8DYBzHrNVqVEr9BWKcqNFoxF6vx3a7zc1mYyC73a4MogBg7vs+z+czO50OW60Wt9stK5UKp9Mpj8cjq9WqDTBHnjAdxzGQZrPJw+HA31oulzbAWgLoA0CWZVBKIY5jzGYzdLtdE9DlcrFNrY98zobqOA6TJKHW2jg4nU5sNBpFDp6mhVe5rsvVasUwDHm9Xqm15u12o+/7Hy0gD8KatOd5vN/v1FozTVN6nkchxFuI6hsAAIMg4OPxMJCXdtTbR7JJCMEgCJhlGUlyPB4XfumozInrupxMJpRSRtZlKoNYl+m/6/wDuWAjtPfsQuwAAAAASUVORK5CYII=
// @include *
// @exclude http://www.dev/Show-Site-All-UserJS/ui.html
// @require https://raw.githubusercontent.com/jae-jae/l.js/master/userjs/l.userjs.min.js
// @require https://gist.githubusercontent.com/jae-jae/35a1833079d26e6c9d9c6d5bed982353/raw/userjs-base.js
// @resource ui https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.html?_=1521784041818
// @resource uiJs https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.js?_=1521784041818
// @resource count https://greasyfork.org/scripts/by-site.json
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_setValue
// @grant unsafeWindow
// @noframes
// @connect cdn.bootcss.com
// @connect raw.githubusercontent.com
// @connect gist.githubusercontent.com
// @connect greasyfork.org
// @run-at document-end
// ==/UserScript==
unsafeWindow.GmAjax = GM_xmlhttpRequest;
(function() {
'use strict';
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; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var FetchUserjs = function () {
function FetchUserjs() {
_classCallCheck(this, FetchUserjs);
this.host = window.location.hostname.split('.').splice(-2).join('.');
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>';
}
_createClass(FetchUserjs, [{
key: 'getCountData',
value: function getCountData(host) {
var countData = GM_getResourceText('count');
countData = JSON.parse(countData);
var count = countData[host];
sessionStorage.setItem(this.countKey, count);
return count;
}
}, {
key: 'setSize',
value: function setSize(w, h) {
$('.jae-userscript').css({
width: w,
height: h
});
}
}, {
key: 'addEventListener',
value: function addEventListener(eventName, handler) {
document.getElementById('jae_userscript_box').addEventListener(eventName, handler);
}
}, {
key: 'bindEvent',
value: function bindEvent() {
var _this = this;
this.timeId = setTimeout(function () {
$('#jae_userscript_box').remove();
}, this.showTime * 1000);
this.addEventListener('max', function () {
_this.setSize(860, 492);
$('.jae-userscript').addClass('jae-userscript-shadow');
clearTimeout(_this.timeId);
});
this.addEventListener('min', function () {
setTimeout(function () {
$('.jae-userscript').removeClass('jae-userscript-shadow');
_this.setSize(370, 56);
}, 500);
});
this.addEventListener('close', function () {
sessionStorage.setItem(_this.quietKey, 1);
$('#jae_userscript_box').remove();
});
this.addEventListener('loading', function () {
clearTimeout(_this.timeId);
});
}
}, {
key: 'execFrameJs',
value: function execFrameJs(frameWindow) {
var uiJs = GM_getResourceText('uiJs');
return function (jsStr) {
frameWindow.eval(jsStr);
}.call(frameWindow, uiJs);
}
}, {
key: 'render',
value: function render() {
if (!this.isQuiet) {
var count = this.getCountData(this.host);
if (count) {
$('body').append(this.tplBox);
var ui = GM_getResourceText('ui');
var 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();
}
}
}
}, {
key: 'isQuiet',
get: function get() {
var quiet = sessionStorage.getItem(this.quietKey);
return quiet ? true : false;
}
}]);
return FetchUserjs;
}();
ljs.exec(['jQuery', 'iframe'], function () {
var fu = new FetchUserjs();
fu.render();
});
})();