Skip to content

Instantly share code, notes, and snippets.

@avelardi
Last active May 28, 2025 00:14
Show Gist options
  • Save avelardi/02abd8abbe91844095f90f1d666dfd93 to your computer and use it in GitHub Desktop.
Save avelardi/02abd8abbe91844095f90f1d666dfd93 to your computer and use it in GitHub Desktop.
gg.deals fanatical redirect link resolver to bypass jdoqocy blocked links

gg.deals.jdoqocy.fix.user.js

This is on GreasyFork - Link Here

Changelog

1.0.2 - 2025.05.27

  • Initial fixed release to be compatible with auto-updates
// ==UserScript==
// @name gg.deals - jdoqocy link rewrite
// @namespace http://tampermonkey.net/
// @version 1.0.2
// @license MIT
// @description Simple deals.gg script to bypass jdoqocy links because my adblocker blocks them
// @author avelardi
// @match https://gg.deals/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @installURL https://gist.github.com/avelardi/02abd8abbe91844095f90f1d666dfd93/raw/gg.deals.jdoqocy.fix.user.js
// @downloadURL https://gist.github.com/avelardi/02abd8abbe91844095f90f1d666dfd93/raw/gg.deals.jdoqocy.fix.user.js
// @updateURL https://gist.github.com/avelardi/02abd8abbe91844095f90f1d666dfd93/raw/gg.deals.jdoqocy.fix.user.js
// ==/UserScript==
//This was hacked together and probably coded poorly, but it works for me.
//Note you may need to click one fanatical link once first then reload?
function replaceAllHrefs(node, newHref) {
const elementsWithHref = node.querySelectorAll('[href]');
elementsWithHref.forEach(element => {
element.setAttribute('href', newHref);
});
}
$( document ).ready(function() {
const shop_links = document.getElementsByClassName("shop-link");
var fanatical_img_div = undefined;
for (let i=0;i<shop_links.length;i++){
if(shop_links.item(i).querySelector('img') !== null){
if(shop_links.item(i).querySelector('img').hasAttribute('alt')){
if(shop_links.item(i).querySelector('img').getAttribute('alt') == "Fanatical"){
fanatical_img_div = shop_links.item(i);
}
}
}
}
$.ajax({
url: fanatical_img_div.href,
type: 'GET',
success: function(data){
const parser = new DOMParser();
const redirect_html = parser.parseFromString(data, 'text/html');
//console.log(redirect_html.getElementsByClassName('redirection-actions')[0].querySelector('a').href);
var actual_url = decodeURIComponent(redirect_html.getElementsByClassName('redirection-actions')[0].querySelector('a').href).split('url=')[1];
replaceAllHrefs(fanatical_img_div.parentNode.parentNode,actual_url);
},
error: function(data) {
console.log('Error! Something went wrong');
console.log(data);
}})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment