Created
July 25, 2008 11:57
-
-
Save os0x/2424 to your computer and use it in GitHub Desktop.
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 replace star by profile icon | |
// @namespace http://ss-o.net/ | |
// @description replace star by profile icon (for Firefox3) | |
// @include http://*.hatena.ne.jp/* | |
// @version 1.3 | |
// ==/UserScript== | |
location.href = 'javascript:(' + function(){ | |
var COLOR = true; | |
if (this.Hatena && this.Hatena.Star){ | |
Array.prototype.slice.call(document.getElementsByClassName('hatena-star-star')).forEach(function(img){ | |
var color; | |
if (/^[a-zA-Z][-\w]{1,30}[a-zA-Z\d]$/.test(img.alt)) { | |
if (COLOR && (color = (/star-(\w+)\.gif/.exec(s.src)||[])[1])) | |
img.style.border = '2px solid ' + color; | |
img.src = Hatena.User.getProfileIcon(img.alt).src; | |
} | |
}); | |
var pushStars = Hatena.Star.Entry.prototype.pushStars; | |
Hatena.Star.Entry.prototype.pushStars = function(stars, color){ | |
stars = stars.map(function(star) { | |
var image = Hatena.User.getProfileIcon(star.name); | |
image.alt = star.name; | |
if (COLOR && color) image.style.outline = '2px solid ' + color; | |
star.img = image; | |
return star; | |
}); | |
pushStars.call(this, stars, color); | |
}; | |
var showName = Hatena.Star.Star.prototype.showName; | |
Hatena.Star.Star.prototype.showName = function(e){ | |
this.screen_name = this.name; | |
showName.call(this,e); | |
}; | |
} | |
}.toString() + ')();'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment