Skip to content

Commit c192724

Browse files
committed
fixed yinyuetai
1 parent eef8d56 commit c192724

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

dist/show-site-all-userjs.user.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,23 @@ var inline_src = (<><![CDATA[
3838
class FetchUserjs{
3939
constructor(){
4040
this.homeUrl = 'https://greasyfork.org/zh-CN/scripts/24508';
41-
this.api = 'https://greasyfork.org/en/scripts/by-site/${host}.json';
41+
this.api = 'https://greasyfork.org/en/scripts/by-site/{host}.json';
4242
this.host = location.host.split('.').splice(-2).join('.');
4343
this.showTime = 10;
4444
this.quietKey = 'jae_fetch_userjs_quiet';
4545
this.cacheKey = 'jae_fetch_userjs_cache';
4646
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>';
4747
}
4848

49+
/* Nano Templates - https://github.com/trix/nano */
50+
nano(template, data) {
51+
return template.replace(/\{([\w\.]*)\}/g, function(str, key) {
52+
let keys = key.split("."), v = data[keys.shift()];
53+
for (let i = 0, l = keys.length; i < l; i++) v = v[keys[i]];
54+
return (typeof v !== "undefined" && v !== null) ? v : "";
55+
});
56+
}
57+
4958
getJSON(url,callback){
5059
GM_xmlhttpRequest({
5160
method:'GET',
@@ -66,7 +75,7 @@ var inline_src = (<><![CDATA[
6675
callback(data);
6776

6877
}else{
69-
let api = juicer(this.api,{host:this.host});
78+
let api = this.nano(this.api,{host:this.host});
7079
this.getJSON(api,(json)=>{
7180
sessionStorage.setItem(this.cacheKey,JSON.stringify(json));
7281
callback(json);
@@ -142,7 +151,7 @@ var inline_src = (<><![CDATA[
142151

143152
}
144153

145-
ljs.exec(['jQuery','juicer','iframe'],()=>{
154+
ljs.exec(['jQuery','iframe'],()=>{
146155
let fu = new FetchUserjs();
147156
fu.render();
148157
});

0 commit comments

Comments
 (0)