From 535146e3fcd76b5bbb19b9421556e58cf3dbf1d2 Mon Sep 17 00:00:00 2001 From: Jackie Liu Date: Thu, 2 Nov 2017 12:25:42 +0800 Subject: [PATCH] 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 --- dist/show-site-all-userjs.gf.user.js | 2 +- dist/show-site-all-userjs.user.js | 2 +- userscript/main.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/show-site-all-userjs.gf.user.js b/dist/show-site-all-userjs.gf.user.js index 3ad765c..0031a46 100644 --- a/dist/show-site-all-userjs.gf.user.js +++ b/dist/show-site-all-userjs.gf.user.js @@ -46,7 +46,7 @@ var FetchUserjs = function () { this.homeUrl = 'https://greasyfork.org/zh-CN/scripts/24508'; this.api = 'https://greasyfork.org/en/scripts/by-site/{host}.json'; - this.host = location.host.split('.').splice(-2).join('.'); + this.host = location.hostname.split('.').splice(-2).join('.'); this.showTime = 10; this.quietKey = 'jae_fetch_userjs_quiet'; this.cacheKey = 'jae_fetch_userjs_cache'; diff --git a/dist/show-site-all-userjs.user.js b/dist/show-site-all-userjs.user.js index c8cd385..2aa1392 100644 --- a/dist/show-site-all-userjs.user.js +++ b/dist/show-site-all-userjs.user.js @@ -46,7 +46,7 @@ var FetchUserjs = function () { this.homeUrl = 'https://greasyfork.org/zh-CN/scripts/24508'; this.api = 'https://greasyfork.org/en/scripts/by-site/{host}.json'; - this.host = location.host.split('.').splice(-2).join('.'); + this.host = location.hostname.split('.').splice(-2).join('.'); this.showTime = 10; this.quietKey = 'jae_fetch_userjs_quiet'; this.cacheKey = 'jae_fetch_userjs_cache'; diff --git a/userscript/main.js b/userscript/main.js index f8b426f..bbcd4e3 100644 --- a/userscript/main.js +++ b/userscript/main.js @@ -2,7 +2,7 @@ class FetchUserjs { constructor() { this.homeUrl = 'https://greasyfork.org/zh-CN/scripts/24508'; this.api = 'https://greasyfork.org/en/scripts/by-site/{host}.json'; - this.host = location.host.split('.').splice(-2).join('.'); + this.host = location.hostname.split('.').splice(-2).join('.'); this.showTime = 10; this.quietKey = 'jae_fetch_userjs_quiet'; this.cacheKey = 'jae_fetch_userjs_cache';