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;
}
});
@eapiova
Copy link

eapiova commented Feb 4, 2025

When I load a http://redump.org/disc/* page I get Loading Dat Name... but it gets stuck there

@mariomadproductions
Copy link
Author

When I load a http://redump.org/disc/* page I get Loading Dat Name... but it gets stuck there

Hi. I just tried it, using the ViolentMonkey userscript extension in Chrome, and it still works for me. Could you tell me what browser (and userscript extension if applicable) you are using?

(And if possible, see if there are any errors displayed in the "console" in your browsers devtools while the userscript is active - open the redump page, open the console and then refresh the page and see if anything has appeared.)

@eapiova
Copy link

eapiova commented Feb 5, 2025

I'm sorry for wasting your time, it seems there is something broken with my profile on Firefox (even without other extensions enabled).

Clean Firefox profiles and Chrome do work correctly.

I get no errors, just these lines:

HTTPS-Only Mode: Not upgrading insecure request “http://redump.org/javascript/ajax.js” because it is exempt. ajax.js
HTTPS-Only Mode: Not upgrading insecure request “http://redump.org/javascript/disc.js” because it is exempt. disc.js
HTTPS-Only Mode: Not upgrading insecure request “http://redump.org/javascript/display.js” because it is exempt. display.js
HTTPS-Only Mode: Not upgrading insecure request “http://redump.org/images/status/blue.png” because it is exempt. blue.png
HTTPS-Only Mode: Not upgrading insecure request “http://redump.org/favicon.ico” because it is exempt. favicon.ico

Thank you.

@mariomadproductions
Copy link
Author

No problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment