Fork of Blabadude's Fork with preset search parameters of Deedit's Script for SBC instead of SBB without preset search parameters
-
-
Save Krashgamer/07ab062aabbb3c84a143792961795abe to your computer and use it in GitHub Desktop.
sb.ltn.fi userscripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name SBC Page Link | |
// @namespace mchang.name | |
// @version 1.0.0 | |
// @description Open corresponding sbc-browse-videoID link from YouTube | |
// @author Deedit, michael@mchang.name | |
// @match https://www.youtube.com/* | |
// @icon https://www.google.com/s2/favicons?domain=youtube.com | |
// @grant none | |
// @run-at document-idle | |
// ==/UserScript== | |
(function() { | |
var intv = setInterval(function() { | |
const x = document.getElementById('center'); | |
if (x === null) return false; | |
//when element is found, clear the interval. | |
setupButton(); | |
clearInterval(intv); | |
}, 100); | |
})(); | |
// custom filters for SBB | |
const customFilters = new URLSearchParams({ | |
"votes_min": 0, | |
"views_min": 1, | |
"sort": "starttime" | |
}) | |
document.body.addEventListener("yt-navigate-finish", function(event) { | |
setupButton(); | |
}); | |
function setupButton() { | |
'use strict'; | |
if (document.getElementById("sbc/video/-SBC-Opener-Button") === null) { | |
const x = document.getElementById('center'); | |
const buttonEl = document.createElement('Button'); | |
buttonEl.id = "sbc/video/-SBC-Opener-Button"; | |
buttonEl.textContent = 'SBC'; | |
buttonEl.style.color = '#888888'; | |
buttonEl.style.background = '#202020'; | |
buttonEl.style.borderStyle = 'solid'; | |
buttonEl.style.borderColor = '#303030'; | |
buttonEl.style.borderWidth = '1px'; | |
buttonEl.style.cursor = 'pointer'; | |
x.prepend(buttonEl); | |
buttonEl.onclick = () => { | |
const currentID = new URL(document.URL).searchParams.get("v"); | |
const targetURL = new URL("https://mruy.github.io/sponsorBlockControl-sveltekit/browse/?videoID=" + currentID) | |
window.open(targetURL); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment