Skip to content

Instantly share code, notes, and snippets.

@boognish-rising
Forked from whomstssecretplayground/bunkr_opener.js
Created November 7, 2025 18:35
Show Gist options
  • Select an option

  • Save boognish-rising/43e24d9f69565a82d919b1af27d2c6b5 to your computer and use it in GitHub Desktop.

Select an option

Save boognish-rising/43e24d9f69565a82d919b1af27d2c6b5 to your computer and use it in GitHub Desktop.
Bunkr-Albums URL Opener/Replacer
// ==UserScript==
// @name Bunkr-Albums URL Opener/Replacer
// @namespace https://github.com/whomstssecretplayground
// @version 1.1.3
// @description try to take over the world!
// @author whomstssecretplayground
// @match https://bunkr-albums.io/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bunkr.red
// @grant GM_openInTab
// @downloadURL https://gist.githubusercontent.com/whomstssecretplayground/9e4493eb2ceb6d30844c5fe02c693fa5/raw/bunkr_opener.js
// @updateURL https://gist.githubusercontent.com/whomstssecretplayground/9e4493eb2ceb6d30844c5fe02c693fa5/raw/bunkr_opener.js
// ==/UserScript==
var replace = true;
var replaced_links = [];
(function() {
var links = document.getElementsByTagName("a"); //array
var from_str = "bunkrrr.org";
var to_str = "bunkr.fi";
var replaced_link = "";
console.log(links)
for (var i=0,imax=links.length; i<imax; i++) {
if (links[i].href.includes("/a/") | links[i].href.includes("/f/") | links[i].href.includes("/v/") | links[i].href.includes("/i/") & links[i].href.includes(from_str)){
console.log(links[i].href.replace(from_str, to_str));
replaced_link = replace ? links[i].href.replace(from_str, to_str) : links[i].href;
replaced_links.push(replaced_link);
}
}
replaced_links.reverse();
replaced_links = [...new Set(replaced_links)];
// console.log(replaced_links);
})();
const iconStyles = "height: 24px; width: 24px; padding-left: 5px;";
const buttonStyles = "margin-right: 10px; line-height: inherit; font-size: 100%; font-weight: 500; padding-left: .75rem; padding-right: .75rem; padding-bottom: .5rem; padding-top: .5rem; border-radius: .375rem; display: flex; cursor: pointer; color: white; background-color: #242424;";
var icon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="${iconStyles}">
<path fill="#FFF" d="M17.984375 2.9863281A1.0001 1.0001 0 0 0 17 4v13h-1.816406c-.568 0-.852219.686844-.449219 1.089844l2.658203 2.658203c.336.336.880797.336 1.216797 0l2.658203-2.658203c.402-.403.115875-1.089844-.453125-1.089844H19V4a1.0001 1.0001 0 0 0-1.015625-1.0136719zM4 3a1.0001 1.0001 0 1 0 0 2h1a1.0001 1.0001 0 1 0 0-2H4zm0 4a1.0001 1.0001 0 1 0 0 2h3a1.0001 1.0001 0 1 0 0-2H4zm0 4a1.0001 1.0001 0 1 0 0 2h5a1.0001 1.0001 0 1 0 0-2H4zm0 4a1.0001 1.0001 0 1 0 0 2h7a1.0001 1.0001 0 1 0 0-2H4zm0 4a1.0001 1.0001 0 1 0 0 2h9a1.0001 1.0001 0 1 0 0-2H4z"/>
</svg>`
const buildButton = (name, style, title, icon = "") => `<button ${name} style="${style}">${title}<span>${icon}</span></button>`;
const buttons = {
name: buildButton("open_links", buttonStyles, "open links"),
}
const openButton = {
link: {
element: buttons.name
}
};
const container = document.querySelector("nav");
const openLinkButtonContainer = document.createElement("div");
openLinkButtonContainer.style.display = "flex";
openLinkButtonContainer.style["justify-content"] = "center";
openLinkButtonContainer.style["margin-bottom"] = "25px";
openLinkButtonContainer.style["margin-top"] = "-15px";
openLinkButtonContainer.innerHTML = openButton.link.element
container.parentNode.insertBefore(openLinkButtonContainer, container);
var page_buttons = document.getElementsByClassName("btn"), i;
var next_button = null;
for (i in page_buttons){
if ((typeof page_buttons[i] !== 'undefined') && (typeof page_buttons[i].className !== 'undefined')){
console.log(page_buttons[i].className);
if (page_buttons[i].className.includes("ic-arrow-right")){
console.log("!!Found " + page_buttons[i].className);
next_button = page_buttons[i];
}
}
}
console.log(next_button);
console.log(replaced_links);
const openButtonName = document.querySelector("button[open_links]");
openButtonName.addEventListener("click", () => {
replaced_links.forEach((url) => GM_openInTab(url, {active: true}));
next_button.click();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment