Created
January 20, 2009 15:48
-
-
Save ino46/49529 to your computer and use it in GitHub Desktop.
新はてブの省略されたエントリータイトルをフルタイトルに。
This file contains hidden or 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 HateB Full Title | |
// @namespace http://d.hatena.ne.jp/ino46/ | |
// @include http://b.hatena.ne.jp/ | |
// @include http://b.hatena.ne.jp/hotentry* | |
// @include http://b.hatena.ne.jp/entrylist | |
// @include http://b.hatena.ne.jp/t/* | |
// @include http://b.hatena.ne.jp/news* | |
// @description 新はてブの省略されたエントリータイトルをフルタイトルに。 | |
// @require http://gist.github.com/3242.txt | |
// ==/UserScript== | |
// | |
// auther ino46 | |
// website http://d.hatena.ne.jp/ino46/ | |
// version 0.0.5.0 (2009-01-21T00:37:34+09:00) | |
// defaulticon | |
// copyright | |
// | |
// wrapper function | |
// simple dollar X http://d.hatena.ne.jp/os0x/20080730/1217395310 | |
// | |
// special thanks to | |
// 原案 http://blog.fkoji.com/2008/11300905.html | |
// はてブ Autopager 対応 http://d.hatena.ne.jp/os0x/20081203/1228328040 | |
// | |
var full_titll = function() { | |
$X('id("main")/div/ul[contains(concat(" ",normalize-space(@class)," "), " hotentry ")][last()]/li/div/h3/a[substring(text(),string-length(text()) - string-length("...") + 1 ) = "..."]').forEach(function(a){ | |
//フルタイトルをエントリーのタイトルへ | |
a.textContent = a.title; | |
}); | |
} | |
full_titll(); | |
// 実行して問題ないかベタに調査。。しなくても大丈夫なんだけど、一応。 | |
if ( | |
unsafeWindow.Hatena && | |
unsafeWindow.Hatena.Bookmark && | |
unsafeWindow.Hatena.Bookmark.AutoPagerize && | |
unsafeWindow.Hatena.Bookmark.AutoPagerize.instance | |
) { | |
// Hatena.Bookmark.AutoPagerize.instanceにnewしたObjectが入っているので、それでAddEventListenerする | |
var autopager = unsafeWindow.Hatena.Bookmark.AutoPagerize.instance; | |
// oldAddEventListenerはaddEventListenerのショートカットみたいなの | |
autopager.oldAddEventListener('complete',function(){ | |
// サイト側のイベントからGreasemonkey側の関数を呼ぶ場合はsetTimeoutを挟む | |
setTimeout(full_titll(),10); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment