Skip to content

Instantly share code, notes, and snippets.

@morygonzalez
Created September 10, 2011 17:17
Show Gist options
  • Select an option

  • Save morygonzalez/1208537 to your computer and use it in GitHub Desktop.

Select an option

Save morygonzalez/1208537 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Amazon target killer
// @namespace http://tech.portalshit.net/
// @description Kills `target="_blank"` on search result screen
// @author morygonzalez
// @version 0.3
// @include http://www.amazon.co.jp/*
// ==/UserScript==
var targets = document.evaluate('//h3[contains(concat(" ",@class," "), " newaps ")]/a | //div[contains(concat(" ",@class," "), " imageContainer ")]/a', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
for (var i = 0, len = targets.snapshotLength; i < len; i++) {
var link = targets.snapshotItem(i);
link.setAttribute("target", "_self");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment