Skip to content

Instantly share code, notes, and snippets.

@goliver79
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save goliver79/9365043 to your computer and use it in GitHub Desktop.

Select an option

Save goliver79/9365043 to your computer and use it in GitHub Desktop.
[JAVASCRIPT] Code for bookmarlet. Change current ebay page EBAY.ES <--> EBAY.COM
var loc = self.parent.location;
var url = loc.href;
var ebaycom = ".ebay.com/";
var ebayes = ".ebay.es/";
var origin, destination;
origin = "";
if (url.indexOf(ebaycom) >= 0) {
origin = ebaycom;
destination = ebayes;
} else if (url.indexOf(ebayes) >= 0) {
origin = ebayes;
destination = ebaycom;
}
if (origin != "") {
var destUrl = url.replace(origin, destination);
self.parent.location = destUrl;
}else{
alert("Not in ebay pages??");
}
//for bookmarlet in Firefox, create new bookmark from any page
//and then change "Properties->Address" with this line
javascript:var%20loc%20=%20self.parent.location;var%20url%20=%20loc.href;var%20ebaycom%20=%20".ebay.com/";var%20ebayes%20=%20".ebay.es/";var%20origin,%20destination;origin%20=%20"";if%20(url.indexOf(ebaycom)%20>=%200)%20{origin%20=%20ebaycom;destination%20=%20ebayes;}%20else%20if%20(url.indexOf(ebayes)%20>=%200)%20{origin%20=%20ebayes;destination%20=%20ebaycom;}if%20(origin%20!=%20"")%20{var%20destUrl%20=%20url.replace(origin,%20destination);self.parent.location%20=%20destUrl;}else{alert("Not%20in%20ebay%20pages??");}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment