Skip to content

Instantly share code, notes, and snippets.

@anthony1x6000
Last active July 5, 2023 01:26
Show Gist options
  • Save anthony1x6000/b6ea0b6d6166f3442a8c2088293dba17 to your computer and use it in GitHub Desktop.
Save anthony1x6000/b6ea0b6d6166f3442a8c2088293dba17 to your computer and use it in GitHub Desktop.
1.12.2 curseforge button
// ==UserScript==
// @name 1.12.2
// @namespace http://tampermonkey.net/
// @version 0.21
// @description direct to 1.12.2 page if exists
// @author You
// @match https://legacy.curseforge.com/minecraft/mc-mods/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=curseforge.com
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
// press [Z] to download topmost item on a 1.12.2 all files filtered page.
'use strict';
var divContainer = document.createElement("div");
divContainer.classList.add('px-1');
var div = document.createElement("div");
var URL = document.querySelector('meta[property="og:url"]').content;
console.log(URL);
const filterAdded = "/files/all?filter-game-version=2020709689%3A6756";
var downloadLink = URL + filterAdded;
div.classList.add('button', 'button--hollow');
div.id = "buttondiv";
var selectorButtonDiv = document.getElementById("buttondiv");
div.innerHTML = `<a href=${downloadLink}>1.12.2</a>`;
var grouppath = document.querySelector("body > div.flex.flex-col.min-h-full.min-h-screen > main > div.z-0 > header > div.container.mx-auto.mt-auto.flex.justify-between.flex-col.lg\\:flex-row > div.flex.mt-4.lg\\:ml-2.lg\\:mt-0 > div > div");
// selectorButtonDiv.addEventListener("click", setTrue());
grouppath.appendChild(divContainer);
divContainer.appendChild(div);
divContainer = document.createElement("div");
divContainer.classList.add('px-1');
div = document.createElement("div");
URL = document.querySelector('meta[property="og:url"]').content;
console.log(URL);
var ninfilterAdded = "/files/all?filter-game-version=2020709689%3A9366";
downloadLink = URL + ninfilterAdded;
div.classList.add('button', 'button--hollow');
div.id = "buttondiv";
selectorButtonDiv = document.getElementById("buttondiv");
div.innerHTML = `<a href=${downloadLink}>1.19.2</a>`;
grouppath = document.querySelector("body > div.flex.flex-col.min-h-full.min-h-screen > main > div.z-0 > header > div.container.mx-auto.mt-auto.flex.justify-between.flex-col.lg\\:flex-row > div.flex.mt-4.lg\\:ml-2.lg\\:mt-0 > div > div");
// selectorButtonDiv.addEventListener("click", setTrue());
grouppath.appendChild(divContainer);
divContainer.appendChild(div);
//Autodownload
document.addEventListener("keydown", function(event) {
if (event.code === "KeyZ") {
var DLink = document.querySelector("body > div.flex.flex-col.min-h-full.min-h-screen > main > div.z-0 > div.mx-auto.container.pb-5 > section > div > div > div > section > div.listing-container.listing-container-table > div > table > tbody > tr:nth-child(1) > td:nth-child(7) > div > a.button.button--hollow.mr-2.button--icon-only").href;
if (window.location.href.indexOf("2020709689") > -1) {
console.log(DLink);
window.open(DLink, "_self");
}
}
});
})();
// ==UserScript==
// @name 1.12.2
// @namespace http://tampermonkey.net/
// @version 0.21
// @description direct to 1.12.2 page if exists
// @author You
// @match https://legacy.curseforge.com/minecraft/mc-mods/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=curseforge.com
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
// press [Z] to download topmost item on a 1.12.2 all files filtered page.
'use strict';
var divContainer = document.createElement("div");
divContainer.classList.add('px-1');
var div = document.createElement("div");
var URL = document.querySelector('meta[property="og:url"]').content;
console.log(URL);
const filterAdded = "/files/all?filter-game-version=2020709689%3A6756";
var downloadLink = URL + filterAdded;
div.classList.add('button', 'button--hollow');
div.id = "buttondiv";
var selectorButtonDiv = document.getElementById("buttondiv");
div.innerHTML = `<a href=${downloadLink}>1.12.2</a>`;
var grouppath = document.querySelector("body > div.flex.flex-col.min-h-full.min-h-screen > main > div.z-0 > header > div.container.mx-auto.mt-auto.flex.justify-between.flex-col.lg\\:flex-row > div.flex.mt-4.lg\\:ml-2.lg\\:mt-0 > div > div");
// selectorButtonDiv.addEventListener("click", setTrue());
grouppath.appendChild(divContainer);
divContainer.appendChild(div);
//Autodownload
document.addEventListener("keydown", function(event) {
if (event.code === "KeyZ") {
var DLink = document.querySelector("body > div.flex.flex-col.min-h-full.min-h-screen > main > div.z-0 > div.mx-auto.container.pb-5 > section > div > div > div > section > div.listing-container.listing-container-table > div > table > tbody > tr:nth-child(1) > td:nth-child(7) > div > a.button.button--hollow.mr-2.button--icon-only").href;
if (window.location.href.indexOf("2020709689") > -1) {
console.log(DLink);
window.open(DLink, "_self");
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment