Skip to content

Commit 0146222

Browse files
committed
feat:add Support
1 parent 10662c0 commit 0146222

14 files changed

Lines changed: 149 additions & 40 deletions

File tree

crx/extension.crx

387 Bytes
Binary file not shown.

crx/extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"name": "Userscript+ for Tampermonkey",
55
"description": "Show current site all UserJS,The easier way to install UserJs for Tampermonkey.",
6-
"version": "1.3",
6+
"version": "1.4",
77
"author": "Jaeger <[email protected]>",
88
"homepage_url": "https://github.com/jae-jae/Userscript-Plus",
99
"icons": {

crx/extension/popup.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crx/src/common/js/tools.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,13 @@ export default {
116116
}
117117
rt = rt.filter((a) => a.score !== 0).sort((a, b) => b.score - a.score).map((a) => a.item)
118118
return rt
119+
},
120+
121+
isZH () {
122+
let nlang = navigator.language.toLowerCase()
123+
if (nlang === 'zh') {
124+
nlang = 'zh-cn'
125+
}
126+
return nlang.search('zh-') === 0
119127
}
120128
}

crx/src/components/Support.vue

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<template>
2+
<div class="support-box" v-if="showSupportBox">
3+
<Carousel v-model="curIndex" autoplay loop dots="none" arrow="never" :autoplay-speed="10000">
4+
<a v-for="item in goods" :key="item.url" :href="item.url" target="_blank">
5+
<CarouselItem class="carouse-item">
6+
{{item.title}}
7+
</CarouselItem>
8+
</a>
9+
</Carousel>
10+
</div>
11+
</template>
12+
13+
<script>
14+
import Tools from '../common/js/tools'
15+
export default {
16+
data () {
17+
return {
18+
curIndex: 0,
19+
goods: []
20+
}
21+
},
22+
mounted () {
23+
window.fetch('https://api.jae.sh/userscript-plus')
24+
.then((r) => {
25+
return r.json()
26+
}).then((json) => {
27+
this.goods = json
28+
this.curIndex = this.random(0,json.length - 1)
29+
})
30+
},
31+
computed: {
32+
showSupportBox () {
33+
return this.goods.length > 0 && Tools.isZH()
34+
}
35+
},
36+
methods: {
37+
random (min, max) {
38+
return (Math.random() * (max - min + 1) | 0) + min
39+
}
40+
}
41+
}
42+
</script>
43+
44+
<style>
45+
.support-box {
46+
height: 28px;
47+
line-height: 28px;
48+
}
49+
.carouse-item {
50+
background-color: #ffffff;
51+
}
52+
</style>

crx/src/components/Table.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@
3333
</Button>
3434
</Tooltip>
3535

36-
<Tooltip content="GreasyFork" placement="bottom">
36+
<Tooltip v-if="isZH" content="吾爱油猴" placement="bottom">
37+
<Button type="dashed" @click="open('https://52youhou.com/userscript/userjs-a3dmr?from=userscript-plus')">
38+
<Icon type="fork"></Icon>
39+
</Button>
40+
</Tooltip>
41+
42+
<Tooltip v-if="!isZH" content="GreasyFork" placement="bottom">
3743
<Button type="dashed" @click="open('https://greasyfork.org/zh-CN/scripts/24508')">
3844
<Icon type="fork"></Icon>
3945
</Button>
@@ -56,6 +62,9 @@
5662
<transition name="custom-classes-transition" enter-active-class="animated lightSpeedIn" leave-active-class="animated bounceOutRight">
5763
<div>
5864
<Table highlight-row :columns="columns" :data="data"></Table>
65+
<div class="table-footer">
66+
<Support />
67+
</div>
5968
</div>
6069
</transition>
6170
</Card>
@@ -102,8 +111,9 @@
102111
/* global Event */
103112
import Tools from '../common/js/tools'
104113
import Info from './Info.vue'
114+
import Support from './Support.vue'
105115
export default {
106-
components: { Info },
116+
components: { Info, Support },
107117
mounted: function () {
108118
this.$Spin.show()
109119
Tools.getData((json) => {
@@ -116,6 +126,7 @@
116126
},
117127
data: function () {
118128
return {
129+
isZH: Tools.isZH(),
119130
showSearchInput: false,
120131
searchInput: '',
121132
showBody: false,
@@ -274,7 +285,17 @@
274285
}
275286
276287
.ivu-table-body {
277-
height: 400px;
288+
height: 418px;
278289
overflow-x: hidden;
279290
}
291+
.table-footer {
292+
position: fixed;
293+
bottom: 0 ;
294+
padding-left: 10px;
295+
width: 100%;
296+
background-color: #fff;
297+
}
298+
.table-footer a {
299+
color: #ed3f14;
300+
}
280301
</style>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// @name:ru-RU Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
88
// @name:ru Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
99
// @namespace https://github.com/jae-jae/Userscript-Plus
10-
// @version 2.3.1
10+
// @version 2.3.2
1111
// @description Show current site all UserJS,The easier way to install UserJs for Tampermonkey.
1212
// @description:zh 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
1313
// @description:zh-CN 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
@@ -21,8 +21,8 @@
2121
// @exclude http://www.dev/Show-Site-All-UserJS/ui.html
2222
// @require https://greasyfork.org/scripts/23419-l-js/code/ljs.js
2323
// @require https://greasyfork.org/scripts/23420-userjs-base-js/code/userjs-basejs.js
24-
// @resource ui https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.html?_=1537873942980
25-
// @resource uiJs https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.js?_=1537873942980
24+
// @resource ui https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.html?_=1537950324015
25+
// @resource uiJs https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.js?_=1537950324015
2626
// @resource count https://greasyfork.org/scripts/by-site.json
2727
// @grant GM_xmlhttpRequest
2828
// @grant GM_getResourceText

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// @name:ru-RU Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
88
// @name:ru Userscript+ : Показать пользовательские скрипты (UserJS) для сайта. Jaeger
99
// @namespace https://github.com/jae-jae/Userscript-Plus
10-
// @version 2.3.1
10+
// @version 2.3.2
1111
// @description Show current site all UserJS,The easier way to install UserJs for Tampermonkey.
1212
// @description:zh 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
1313
// @description:zh-CN 显示当前网站的所有可用UserJS(Tampermonkey)脚本,交流QQ群:104267383
@@ -21,8 +21,8 @@
2121
// @exclude http://www.dev/Show-Site-All-UserJS/ui.html
2222
// @require https://raw.githubusercontent.com/jae-jae/l.js/master/userjs/l.userjs.min.js
2323
// @require https://gist.githubusercontent.com/jae-jae/35a1833079d26e6c9d9c6d5bed982353/raw/userjs-base.js
24-
// @resource ui https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.html?_=1537873942980
25-
// @resource uiJs https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.js?_=1537873942980
24+
// @resource ui https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.html?_=1537950324014
25+
// @resource uiJs https://raw.githubusercontent.com/jae-jae/Show-Site-All-UserJS/master/dist/ui.js?_=1537950324014
2626
// @resource count https://greasyfork.org/scripts/by-site.json
2727
// @grant GM_xmlhttpRequest
2828
// @grant GM_getResourceText

dist/ui.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Show current site all UserJS,The easier way to install UserJs for Tampermonkey.",
55
"scripts": {
66
"build": "webpack && node build-userscript.js",
7+
"watch:ui": "webpack --watch",
78
"standard": "standard --plugin html 'src/**/*.{js,vue}' --fix"
89
},
910
"repository": {

0 commit comments

Comments
 (0)