Skip to content

Commit

Permalink
fix userscript to not use GM config
Browse files Browse the repository at this point in the history
  • Loading branch information
mchangrh committed Oct 17, 2022
1 parent e2c25bd commit 8e01ba0
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ function defaultMerge(minify = true) {

function userscript() {
const header = fs.readFileSync(headerFile, "utf8")
const gmConfig = fs.readFileSync("src/gm_config.js", "utf8")
const settings = fs.readFileSync(settingsFile, "utf8")
const body = fs.readFileSync(bodyFile, "utf8")
fs.writeFileSync("docs/sb.user.js", header + gmConfig + body)
fs.writeFileSync("docs/sb.user.js", header + settings + body)
console.log("userscript done")
}

Expand Down
2 changes: 1 addition & 1 deletion build/header.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @namespace mchang.name
// @homepage https://github.com/mchangrh/sb.js
// @icon https://mchangrh.github.io/sb.js/icon.png
// @version 1.3.0
// @version 1.3.1
// @license LGPL-3.0-or-later
// @match https://www.youtube.com/watch*
// @connect sponsor.ajay.app
Expand Down
2 changes: 1 addition & 1 deletion build/loader-header.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @namespace mchang.name
// @homepage https://github.com/mchangrh/sb.js
// @icon https://mchangrh.github.io/sb.js/icon.png
// @version 1.3.0
// @version 1.3.1
// @license LGPL-3.0-or-later
// @match https://www.youtube.com/watch*
// @connect sponsor.ajay.app
Expand Down
2 changes: 1 addition & 1 deletion docs/sb-loader.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @namespace mchang.name
// @homepage https://github.com/mchangrh/sb.js
// @icon https://mchangrh.github.io/sb.js/icon.png
// @version 1.3.0
// @version 1.3.1
// @license LGPL-3.0-or-later
// @match https://www.youtube.com/watch*
// @connect sponsor.ajay.app
Expand Down
30 changes: 22 additions & 8 deletions docs/sb.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,34 @@
// @namespace mchang.name
// @homepage https://github.com/mchangrh/sb.js
// @icon https://mchangrh.github.io/sb.js/icon.png
// @version 1.3.0
// @version 1.3.1
// @license LGPL-3.0-or-later
// @match https://www.youtube.com/watch*
// @connect sponsor.ajay.app
// @grant none
// ==/UserScript==
const getJSONSetting = async (key, fallback) => JSON.parse(await GM_getValue(key, fallback))
/* START OF SETTINGS */

const categories = await getJSONSetting("categories", `["sponsor","selfpromo","interaction","intro","outro","preview","music_offtopic","exclusive_access","poi_highlight"]`)
const actionTypes = await getJSONSetting("actionTypes", `["skip","mute","full","poi"]`)
const skipThreshold = await getJSONSetting("skipThreshold", `[0.2,1]`)
const serverEndpoint = await GM_getValue("serverEndpoint","https://sponsor.ajay.app")
const skipTracking = await GM_getValue("skipTracking", true)
const highlightKey = await GM_getValue("highlightKey", "Enter")
// https://wiki.sponsor.ajay.app/w/Types
const categories = [
"sponsor",
"selfpromo",
"interaction",
"intro",
"outro",
"preview",
"music_offtopic",
"exclusive_access",
"poi_highlight",
]
const actionTypes = ["skip", "mute", "full", "poi"]
const skipThreshold = [0.2, 1] // skip from between time-[0] and time+[1]
const serverEndpoint = "https://sponsor.ajay.app"
const skipTracking = true
const highlightKey = "Enter"
// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values

/* END OF SETTINGS */
/* sb.js - SponsorBlock for restrictive environments - by mchangrh
https://github.com/mchangrh/sb.js
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mchangrh/sb.js",
"version": "1.3.0",
"version": "1.3.1",
"description": "SponsorBlock userscript/bookmarklet clients",
"main": "docs/sb.min.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.3.0"
"version": "1.3.1"
}

0 comments on commit 8e01ba0

Please sign in to comment.