Skip to content

Commit 535146e

Browse files
committed
fixed bug for the site contains port
sometimes the *.user.js contains the site port, just like localhost:5678, but greasyfork.org don't include the site port, domain will be show as 'localhost', so we need hostname field to get the right domain name. Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
1 parent 1fb54b9 commit 535146e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var FetchUserjs = function () {
4646

4747
this.homeUrl = 'https://greasyfork.org/zh-CN/scripts/24508';
4848
this.api = 'https://greasyfork.org/en/scripts/by-site/{host}.json';
49-
this.host = location.host.split('.').splice(-2).join('.');
49+
this.host = location.hostname.split('.').splice(-2).join('.');
5050
this.showTime = 10;
5151
this.quietKey = 'jae_fetch_userjs_quiet';
5252
this.cacheKey = 'jae_fetch_userjs_cache';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var FetchUserjs = function () {
4646

4747
this.homeUrl = 'https://greasyfork.org/zh-CN/scripts/24508';
4848
this.api = 'https://greasyfork.org/en/scripts/by-site/{host}.json';
49-
this.host = location.host.split('.').splice(-2).join('.');
49+
this.host = location.hostname.split('.').splice(-2).join('.');
5050
this.showTime = 10;
5151
this.quietKey = 'jae_fetch_userjs_quiet';
5252
this.cacheKey = 'jae_fetch_userjs_cache';

userscript/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class FetchUserjs {
22
constructor() {
33
this.homeUrl = 'https://greasyfork.org/zh-CN/scripts/24508';
44
this.api = 'https://greasyfork.org/en/scripts/by-site/{host}.json';
5-
this.host = location.host.split('.').splice(-2).join('.');
5+
this.host = location.hostname.split('.').splice(-2).join('.');
66
this.showTime = 10;
77
this.quietKey = 'jae_fetch_userjs_quiet';
88
this.cacheKey = 'jae_fetch_userjs_cache';

0 commit comments

Comments
 (0)