Created
June 14, 2009 11:00
-
-
Save hitode909/129639 to your computer and use it in GitHub Desktop.
Append anchor tag to ZOZORESORT search result.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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