Skip to content

Instantly share code, notes, and snippets.

@standa
Created December 15, 2015 15:06
Show Gist options
  • Save standa/5b098fba7cf7dc655a7b to your computer and use it in GitHub Desktop.
Save standa/5b098fba7cf7dc655a7b to your computer and use it in GitHub Desktop.
Replace ebay.co.uk with national ebay.nl, ebay.pl, etc. domains
/**
* This should replace .co.uk ebay links with the links based on the current hostname
*
* @author standa aardvark
* @version 2015-12-15
*
* Obfuscate via https://javascriptobfuscator.com/Javascript-Obfuscator.aspx
*/
(function () {
if (location.host.indexOf('.co.uk') == -1) {
if (location.host.indexOf('ebay.') > -1) {
// ebay category = top frame
var tld = location.host.substring(location.host.indexOf('ebay.'));
} else {
// ebay iframe = &domain=ebay.nl&
var s = location.search;
s = s.substring(s.indexOf('domain=')+'domain='.length);
var tld = s.substring(0, s.indexOf('&'));
}
var a = document.getElementsByTagName('a');
for (var i = 0; i < a.length; i++) {
var l = a[i].href;
if (l.indexOf('ebay.co.uk') > -1) {
a[i].href = l.replace('ebay.co.uk', tld);
}
}
}
})();
var _0x5824=["\x2E\x63\x6F\x2E\x75\x6B","\x69\x6E\x64\x65\x78\x4F\x66","\x68\x6F\x73\x74","\x65\x62\x61\x79\x2E","\x73\x75\x62\x73\x74\x72\x69\x6E\x67","\x73\x65\x61\x72\x63\x68","\x64\x6F\x6D\x61\x69\x6E\x3D","\x6C\x65\x6E\x67\x74\x68","\x26","\x61","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x68\x72\x65\x66","\x65\x62\x61\x79\x2E\x63\x6F\x2E\x75\x6B","\x72\x65\x70\x6C\x61\x63\x65"];(function(){if(location[_0x5824[2]][_0x5824[1]](_0x5824[0])== -1){if(location[_0x5824[2]][_0x5824[1]](_0x5824[3])> -1){var _0xe537x1=location[_0x5824[2]][_0x5824[4]](location[_0x5824[2]][_0x5824[1]](_0x5824[3]))}else {var _0xe537x2=location[_0x5824[5]];_0xe537x2=_0xe537x2[_0x5824[4]](_0xe537x2[_0x5824[1]](_0x5824[6])+_0x5824[6][_0x5824[7]]);var _0xe537x1=_0xe537x2[_0x5824[4]](0,_0xe537x2[_0x5824[1]](_0x5824[8]));};var _0xe537x3=document[_0x5824[10]](_0x5824[9]);for(var _0xe537x4=0;_0xe537x4<_0xe537x3[_0x5824[7]];_0xe537x4++){var _0xe537x5=_0xe537x3[_0xe537x4][_0x5824[11]];if(_0xe537x5[_0x5824[1]](_0x5824[12])> -1){_0xe537x3[_0xe537x4][_0x5824[11]]=_0xe537x5[_0x5824[13]](_0x5824[12],_0xe537x1)};};}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment