-
-
Save FlaminSarge/cb133336f9ade95f0dbd102549ba4413 to your computer and use it in GitHub Desktop.
DLH Fixer
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 DLH Fixer | |
// @namespace https://gist.github.com/FlaminSarge/cb133336f9ade95f0dbd102549ba4413 | |
// @version 0.1 | |
// @description Fixes issues with DLH.net | |
// @author FlaminSarge | |
// @match https://www.dlh.net/* | |
// @require https://www.dlh.net/_application/modules/Standard/Layout/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// ==/UserScript== | |
waitForKeyElements('.clearfix', steamKeysFunc); | |
waitForKeyElements('.formRegisterHide', keyAssignFunc); | |
function steamKeysFunc(jNode) { | |
if (document.location.href.includes('steam-keys.html')) { | |
var hideBtn = document.querySelectorAll('.hide.btn'); | |
Array.prototype.forEach.call(hideBtn, function(el, i){ | |
el.style.display = 'block'; | |
}); | |
var keyUnlock = document.querySelectorAll('.keyUnlock3'); | |
Array.prototype.forEach.call(keyUnlock, function(el, i){ | |
el.setAttribute('href', '/ajax/keyassign.php?gameid=' + el.getAttribute('data-gameid')); | |
}); | |
} | |
} | |
function keyAssignFunc(jNode) { | |
if (document.location.href.includes('keyassign.php')) { | |
var formRegisterHide = document.querySelectorAll('.formRegisterHide'); | |
Array.prototype.forEach.call(formRegisterHide, function(el, i){ | |
el.style.display = 'block'; | |
}); | |
var clickdot = document.getElementById('clickdot'); | |
if (clickdot) { | |
clickdot.style.display = 'none'; | |
} | |
var start2 = document.getElementById('start2'); | |
if (start2) { | |
start2.textContent = 'Please Wait...'; | |
//Wait for refUrlPlain to get set (TODO investigate whether it can be pulled from script text directly) | |
setTimeout(function() { | |
start2.textContent = 'Get your Steam Game'; | |
start2.onclick = function() {}; //avoid DLH's error | |
start2.setAttribute('href', unsafeWindow.refUrlPlain); | |
}, 1500); | |
} | |
} | |
} | |
(function(){ | |
if (document.location.href.includes('keyassign.php?stv=')) { | |
setTimeout(function() { window.close(); }, 3000); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment