Skip to content

Instantly share code, notes, and snippets.

@mariomadproductions
Created October 8, 2022 19:47
Show Gist options
  • Save mariomadproductions/21a3f2c1866299161a6c983e2d9260e1 to your computer and use it in GitHub Desktop.
Save mariomadproductions/21a3f2c1866299161a6c983e2d9260e1 to your computer and use it in GitHub Desktop.
Redump Disc Page
// ==UserScript==
// @name Redump Disc Page
// @description Shows dat names, unhides dumpers/comments/contents sections
// @namespace Starshadow, Edness
// @include http://redump.org/disc/*
// @version 2.1
// @grant GM.xmlHttpRequest
// ==/UserScript==
style = document.createElement("style");
style.textContent = "\
#submenu100 { display: none !important; }\
#submenu101 { display: block !important; }\
#submenu120 { display: none !important; }\
#submenu121 { display: block !important; }\
#submenu130 { display: none !important; }\
#submenu131 { display: block !important; }\
"; // Does submenu 110/111 exist too?
head = document.getElementsByTagName("head");
head[0].appendChild(style);
// Greasemonkey-only(?) issue where it would create duplicates
var datNameExists = document.getElementsByClassName("datname");
if (datNameExists.length == 0) {
var datNameElement = document.createElement("p");
datNameElement.setAttribute("class","datname"); // see above
datNameElement.setAttribute("style","margin: 5px 25px;");
datNameElement.textContent = "Loading Dat Name...";
var gameDiv = document.getElementsByClassName("game")[0];
var parentDiv = gameDiv.parentNode;
parentDiv.insertBefore(datNameElement,gameDiv);
}
GM.xmlHttpRequest({
method: "GET",
url: document.location + "/sfv/",
onload: function(res) {
var datName = res.responseText.substr(0,res.responseText.indexOf("\r"));
datName = datName.replace(/(\(Track [0-9]+\))?\.[a-z]{3} [a-f0-9]{8}$/,"");
datNameElement.textContent = datName;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment