Skip to content

Commit 21e91a1

Browse files
committed
fix: Remove the start with // check for 'your own external scripts'
1 parent 75d570d commit 21e91a1

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/js/run.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getHosts, getHostKey, findMatchedHosts } from 'libs'
33

44
const baseURL = chrome.runtime.getURL('base.js')
55

6-
const catchErr = e => {
6+
const catchErr = (e) => {
77
console.error('Failed to inject scripts:', e)
88
}
99

@@ -42,36 +42,36 @@ const extractScripts = (customjs, injections) => {
4242
// Extra include
4343
;(extra || '')
4444
.split(';')
45-
.map(x => x.trim())
46-
.forEach(line => {
47-
if (line && line.startsWith('//')) {
45+
.map((x) => x.trim())
46+
.forEach((line) => {
47+
if (line) {
4848
injections.add(line)
4949
}
5050
})
5151

5252
return source
5353
}
5454

55-
const loadScripts = async location => {
55+
const loadScripts = async (location) => {
5656
const hosts = await getHosts()
5757
const matchedHosts = findMatchedHosts(hosts, location)
5858
const injections = new Set()
5959
Promise.all(
60-
matchedHosts.map(async host => {
60+
matchedHosts.map(async (host) => {
6161
const hostKey = getHostKey(host)
6262
const obj = await chrome.storage.sync.get(hostKey)
6363
return extractScripts(obj[hostKey], injections)
6464
})
6565
)
66-
.then(values => values.filter(x => x))
67-
.then(values => {
66+
.then((values) => values.filter((x) => x))
67+
.then((values) => {
6868
if (values.length) {
6969
console.info(
7070
'Custom JavaScript for websites enabled.\nPlease visit https://xcv58.xyz/inject-js if you have any issue.'
7171
)
7272
}
7373
return Promise.all(
74-
[...injections].map(src => {
74+
[...injections].map((src) => {
7575
if (src) {
7676
return injectScriptPromise(src)
7777
}
@@ -80,7 +80,7 @@ const loadScripts = async location => {
8080
.then(() => values)
8181
.catch(catchErr)
8282
})
83-
.then(values => values.map(src => injectScriptPromise(src, 'body')))
83+
.then((values) => values.map((src) => injectScriptPromise(src, 'body')))
8484
.catch(catchErr)
8585
}
8686

src/js/stores/IncludeStore.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { action, computed, observable } from 'mobx'
22
import Store from 'stores'
33

44
const hint =
5-
'# Uncomment address of script below or type your own (one per line and must end with ;)'
5+
'# Uncomment address of script below or type your own (one per line)'
66
const underscore =
77
'# //cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js;'
88

@@ -53,7 +53,7 @@ export default class IncludeStore {
5353
}
5454

5555
@action
56-
onSelect = include => {
56+
onSelect = (include) => {
5757
this.include = include
5858
this.store.AppStore.autoSave()
5959
}

0 commit comments

Comments
 (0)