Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created June 14, 2009 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitode909/129639 to your computer and use it in GitHub Desktop.
Save hitode909/129639 to your computer and use it in GitHub Desktop.
Append anchor tag to ZOZORESORT search result.
// ==UserScript==
// @name ZOZORESORT Append Anchor
// @namespace http://www.hatena.ne.jp/hitode909/
// @description Append anchor tag to ZOZORESORT search result.
// @include http://zozo.jp/*
// ==/UserScript==
(function () {
function append (doc) {
var items = doc.getElementsByClassName('image');
for (var i=0; i<items.length; i++) {
var item = items[i];
var path = item.getAttribute('onclick').match(/location\.href=\'(.*)\'/).pop();
item.removeAttribute('onclick');
var anchor = document.createElement('a');
anchor.setAttribute('href', path);
item.parentNode.replaceChild(anchor, item);
anchor.appendChild(item);
}
}
append(document);
if (window.AutoPagerize) window.AutoPagerize.addFilter(function(docs){
for (var i = 0,l = docs.length;i < l;i++) append(docs[i]);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment