Skip to content

Commit e96e03c

Browse files
committed
reworking dir
Signed-off-by: magicoflolis <magicoflolis@gmail.com>
1 parent 1c27ca8 commit e96e03c

17 files changed

Lines changed: 2202 additions & 812 deletions

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
language: node_js
2-
node_js: 9
2+
node_js: 15
33
before_script:
44
- npm install yarn webpack -g
55
- git checkout master
6-
- cd crx
6+
- cd webextension
77
- yarn
88
- cd ..
99
- yarn
1010

1111
script:
1212
- yarn build
13-
- cd crx
13+
- cd webextension
1414
- yarn build
1515
- cd ..
1616

build/userscript.js

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
1-
var babel = require("babel-core");
2-
var fs = require("fs");
3-
var tpl = fs.readFileSync('./userscript/tpl.js').toString();
4-
var code = babel.transformFileSync("./userscript/main.js").code;
1+
let babel = require("babel-core"),
2+
fs = require("fs"),
3+
tpl = fs.readFileSync("./userscript/tpl.js").toString(),
4+
code = babel.transformFileSync("./userscript/main.js").code;
55

66
var nano = function(template, data) {
7-
return template.replace(/\{([\w\.]*)\}/g, function(str, key) {
8-
let keys = key.split("."),
9-
v = data[keys.shift()];
10-
for (let i = 0, l = keys.length; i < l; i++) v = v[keys[i]];
11-
return (typeof v !== "undefined" && v !== null) ? v : "";
12-
});
7+
return template.replace(/\{([\w\.]*)\}/g, function(str, key) {
8+
let keys = key.split("."),
9+
v = data[keys.shift()];
10+
for (let i = 0, l = keys.length; i < l; i++) v = v[keys[i]];
11+
return typeof v !== "undefined" && v !== null ? v : "";
12+
});
1313
};
1414

15-
var renderOut = function(outFile,ljs){
16-
var ujs = nano(tpl, {
17-
ljs: ljs,
18-
code: code,
19-
time: (+new Date())
20-
});
21-
22-
fs.writeFile(outFile, ujs, function(err) {
23-
if (err) {
24-
return console.log(err);
25-
}
26-
return console.log('build-out:' + outFile);
27-
});
15+
var renderOut = function(outFile, ljs) {
16+
var ujs = nano(tpl, {
17+
ljs: ljs,
18+
code: code,
19+
time: +new Date(),
20+
});
21+
22+
fs.writeFile(outFile, ujs, function(err) {
23+
if (err) {
24+
return console.log(err);
25+
}
26+
return console.log("build-out:" + outFile);
27+
});
2828
};
2929

30-
var time = (+new Date());
30+
var time = +new Date();
3131

32-
var ljs = `// @require https://cdn.jsdelivr.net/gh/jae-jae/l.js/userjs/l.userjs.min.js
32+
// let ljs = `// @require https://cdn.jsdelivr.net/gh/jae-jae/l.js/userjs/l.userjs.min.js
33+
// // @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
34+
// // @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.js?_=${time}`,
35+
// ljs_GF = `// @require https://greasyfork.org/scripts/23419-l-js/code/ljs.js
36+
// // @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
37+
// // @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.gf.js?_=${time}`;
38+
let ljs = `// @require https://cdn.jsdelivr.net/gh/jae-jae/l.js/userjs/l.userjs.min.js
3339
// @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
34-
// @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.js?_=${time}`;
35-
36-
var ljs_GF = `// @require https://greasyfork.org/scripts/23419-l-js/code/ljs.js
40+
// @resource uiJs https://cdn.jsdelivr.net/gh/magicoflolis/Userscript-Plus/dist/ui.js?_=${time}`,
41+
ljs_GF = `// @require https://greasyfork.org/scripts/23419-l-js/code/ljs.js
3742
// @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
38-
// @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.gf.js?_=${time}`;
39-
43+
// @resource uiJs https://cdn.jsdelivr.net/gh/magicoflolis/Userscript-Plus/dist/ui.gf.js?_=${time}`;
4044

41-
renderOut('./dist/magic-userjs.user.js',ljs);
45+
renderOut("./dist/magic-userjs.user.js", ljs);
4246
//greasyfork version
43-
renderOut('./dist/magic-userjs.gf.user.js',ljs_GF);
47+
renderOut("./dist/magic-userjs.gf.user.js", ljs_GF);

build/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var webpack = require('webpack');
2-
var CopyWebpackPlugin = require('copy-webpack-plugin');
1+
let webpack = require('webpack'),
2+
CopyWebpackPlugin = require('copy-webpack-plugin');
33

44
module.exports = {
55
entry: {

build/webpack.gf.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var webpack = require('webpack');
2-
var CopyWebpackPlugin = require('copy-webpack-plugin');
1+
let webpack = require('webpack'),
2+
CopyWebpackPlugin = require('copy-webpack-plugin');
33

44
module.exports = {
55
entry: {

dist/magic-userjs.gf.user.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
// @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
5151
// @require https://greasyfork.org/scripts/23419-l-js/code/ljs.js
5252
// @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
53+
// @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.gf.js?_=1616636095054
54+
// @resource ui https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.html?_=1616636095055
5555
// @resource count https://greasyfork.org/scripts/by-site.json
5656
// @resource adult https://sleazyfork.org/scripts/by-site.json
5757
// @grant GM_xmlhttpRequest
@@ -60,6 +60,7 @@
6060
// @grant GM_setValue
6161
// @grant unsafeWindow
6262
// @noframes
63+
// @noframe
6364
// @connect cdn.bootcss.com
6465
// @connect raw.githubusercontent.com
6566
// @connect gist.githubusercontent.com
@@ -81,7 +82,8 @@ unsafeWindow.GmAjax = GM_xmlhttpRequest;
8182
this.quietKey = 'jae_fetch_userjs_quiet';
8283
this.countKey = 'jae_fetch_userjs_count';
8384
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+
this.tplBox = '<div id="jae_userscript_box"><div class="jae-userscript" class=""></div></div>';
86+
//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>';
8587
}
8688

8789
getMainHost() {
@@ -94,7 +96,11 @@ unsafeWindow.GmAjax = GM_xmlhttpRequest;
9496
countData = JSON.parse(countData);
9597
let count = countData[host];
9698
sessionStorage.setItem(this.countKey, count);
97-
return count;
99+
let adultData = GM_getResourceText('adult');
100+
adultData = JSON.parse(adultData);
101+
let adult = adultData[host];
102+
sessionStorage.setItem(this.adultKey, adult);
103+
return count && adult;
98104
}
99105

100106
getAdultData(host) {
@@ -159,14 +165,13 @@ unsafeWindow.GmAjax = GM_xmlhttpRequest;
159165
render() {
160166
if (!this.isQuiet) {
161167
let count = this.getCountData(this.host);
162-
let adult = this.getAdultData(this.host);
163-
if (count || adult) {
168+
if (count) {
164169
$('body').append(this.tplBox);
165170

166171
let ui = GM_getResourceText('ui');
167172
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;
173+
//ar tpl = '<iframe name="jaeFetchUserJSFrame" src="about:blank" style="width:100%;height:100%;border:0px;display: block!important;" allowTransparency="true"></iframe>';
174+
dom.innerHTML = '<iframe name="jaeFetchUserJSFrame" src="about:blank" allowTransparency="true"></iframe>';
170175
var iframeDom = dom.children[0];
171176
iframe.write(iframeDom, ui);
172177

dist/magic-userjs.user.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
// @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
5151
// @require https://cdn.jsdelivr.net/gh/jae-jae/l.js/userjs/l.userjs.min.js
5252
// @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.js?_=1616632403423
54-
// @resource ui https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.html?_=1616632403423
53+
// @resource uiJs https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.js?_=1616636095054
54+
// @resource ui https://cdn.jsdelivr.net/gh/jae-jae/Userscript-Plus/dist/ui.html?_=1616636095054
5555
// @resource count https://greasyfork.org/scripts/by-site.json
5656
// @resource adult https://sleazyfork.org/scripts/by-site.json
5757
// @grant GM_xmlhttpRequest
@@ -60,6 +60,7 @@
6060
// @grant GM_setValue
6161
// @grant unsafeWindow
6262
// @noframes
63+
// @noframe
6364
// @connect cdn.bootcss.com
6465
// @connect raw.githubusercontent.com
6566
// @connect gist.githubusercontent.com
@@ -81,7 +82,8 @@ unsafeWindow.GmAjax = GM_xmlhttpRequest;
8182
this.quietKey = 'jae_fetch_userjs_quiet';
8283
this.countKey = 'jae_fetch_userjs_count';
8384
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+
this.tplBox = '<div id="jae_userscript_box"><div class="jae-userscript" class=""></div></div>';
86+
//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>';
8587
}
8688

8789
getMainHost() {
@@ -94,7 +96,11 @@ unsafeWindow.GmAjax = GM_xmlhttpRequest;
9496
countData = JSON.parse(countData);
9597
let count = countData[host];
9698
sessionStorage.setItem(this.countKey, count);
97-
return count;
99+
let adultData = GM_getResourceText('adult');
100+
adultData = JSON.parse(adultData);
101+
let adult = adultData[host];
102+
sessionStorage.setItem(this.adultKey, adult);
103+
return count && adult;
98104
}
99105

100106
getAdultData(host) {
@@ -159,14 +165,13 @@ unsafeWindow.GmAjax = GM_xmlhttpRequest;
159165
render() {
160166
if (!this.isQuiet) {
161167
let count = this.getCountData(this.host);
162-
let adult = this.getAdultData(this.host);
163-
if (count || adult) {
168+
if (count) {
164169
$('body').append(this.tplBox);
165170

166171
let ui = GM_getResourceText('ui');
167172
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;
173+
//ar tpl = '<iframe name="jaeFetchUserJSFrame" src="about:blank" style="width:100%;height:100%;border:0px;display: block!important;" allowTransparency="true"></iframe>';
174+
dom.innerHTML = '<iframe name="jaeFetchUserJSFrame" src="about:blank" allowTransparency="true"></iframe>';
170175
var iframeDom = dom.children[0];
171176
iframe.write(iframeDom, ui);
172177

dist/ui.gf.js

Lines changed: 967 additions & 151 deletions
Large diffs are not rendered by default.

dist/ui.js

Lines changed: 967 additions & 151 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,15 @@
1010
],
1111
"author": "Magic Of Lolis",
1212
"license": "MIT",
13-
"webExt": {
14-
"sourceDir": "./extension/",
15-
"artifactsDir": "./web-ext/"
16-
},
1713
"bugs": {
1814
"url": "https://github.com/magicoflolis/Userscript-Plus/issues"
1915
},
2016
"homepage": "https://github.com/magicoflolis/Userscript-Plus#userscript-for-firefox",
2117
"scripts": {
22-
"build": "webpack --config=build/webpack.config.js",
2318
"build:all": "webpack --config=build/webpack.config.js && webpack --config=build/webpack.gf.config.js && node build/userscript.js",
19+
"build:default": "webpack --config=build/webpack.config.js",
2420
"build:user": "webpack --config=build/webpack.gf.config.js && node build/userscript.js",
25-
"watch": "webpack --watch"
21+
"watch:ui": "webpack --watch --config=build/webpack.config.js"
2622
},
2723
"devDependencies": {
2824
"@fortawesome/fontawesome-free": "^5.15.2",
@@ -42,14 +38,14 @@
4238
"webpack": "^3.5.5"
4339
},
4440
"dependencies": {
45-
"animate.css": "^4.1.1",
41+
"animate.css": "^3.5.2",
4642
"fuzzy.js": "^0.1.0",
4743
"iview": "2.12.0",
44+
"psl": "^1.1.31",
4845
"timeago.js": "^3.0.2",
4946
"view-design": "^4.5.0",
5047
"vue": "^2.4.2",
51-
"vue-i18n": "7.2.0",
52-
"vuetify": "^2.3.15"
48+
"vue-i18n": "7.2.0"
5349
},
5450
"standard": {
5551
"ignore": [

src/App.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616
</script>
1717

1818
<style>
19-
@import './common/css/default.css';
20-
/* @import './common/css/dark.css'; */
19+
@import './components/default.css';
2120
</style>

0 commit comments

Comments
 (0)