Created
November 25, 2010 14:24
-
-
Save Cside/715454 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 Hatebu-FavotterLike | |
// @namespace http://www.hatena.ne.jp/Cside | |
// @description はてブのお気に入りページをふぁぼったーライクに | |
// @include http://b.hatena.ne.jp/* | |
// ==/UserScript== | |
(function () { | |
var lv1 = 4; | |
var lv2 = 5; | |
var lv3 = 6; | |
var lv4 = 7; | |
var lv5 = 8; | |
var addGlobalStyle = function() { | |
var head, style; | |
head = document.getElementsByTagName('head')[0]; | |
if (!head) { | |
return; | |
} | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = [ | |
'.LV5 {', | |
' color: red !important;', | |
' font-size: 20px;', | |
' font-weight: 600;', | |
' line-height: 1.1em;', | |
'}', | |
'.LV4 {', | |
' color: #609 !important;', | |
' font-size: 19px;', | |
' font-weight: 600;', | |
'}', | |
'.LV3 {', | |
' color: #609 !important;', | |
' font-size: 18px;', | |
' font-weight: 600;', | |
'}', | |
'.LV2 {', | |
' color: #090 !important;', | |
' font-size: 16px;', | |
' font-weight: 600;', | |
'}', | |
'.LV1 {', | |
' color: #333 !important;', | |
' font-size: 13px;', | |
'}', | |
].join(''); | |
head.appendChild(style); | |
} | |
if (! location.href.match(/favorite/)) { | |
return; | |
} | |
addGlobalStyle(); | |
Array.prototype.slice.apply(document.querySelectorAll('ul#bookmarked_user > li')).forEach(function (entry) { | |
var favs = entry.querySelector('.comment').querySelectorAll('li').length; | |
var title = entry.querySelector('.entry-link'); | |
if (favs < lv2) { | |
title.className = 'LV1'; | |
} else if (lv2 <= favs && favs < lv3) { | |
title.className = 'LV2'; | |
} else if (lv3 <= favs && favs < lv4) { | |
title.className = 'LV3'; | |
} else if (lv4 <= favs && favs < lv5) { | |
title.className = 'LV4'; | |
} else if (lv5 <= favs) { | |
title.className = 'LV5'; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment