Greasemonkey - AutoPagerize SITEINFO for warsow & Civilization Fanatics'
Firefoxの拡張機能GreasemonkeyのスクリプトAutoPagerizeのSITEINFOを作ってみました。作ったのは次の2サイトのもの。
<h2>Warsow Forum View Thred</h2>
<textarea class="autopagerize_data" readonly="readonly">
url: http://www\.warsow\.net/forum/viewtopic.+
nextLink: //div[@class="postlinksb"]/div[@class="inbox"]/p[@class="pagelink conl"]/strong/following-sibling::a[1]
pageElement: //div[contains(concat(" ",normalize-space(@class)," "), " blockpost ")]
insertBefore: //div[@class="postlinksb"]
exampleUrl: http://www.warsow.net/forum/viewtopic.php?id=8272&p=2
</textarea>
<h2>Warsow Forum View forum</h2>
<textarea class="autopagerize_data" readonly="readonly">
url: http://www.warsow.net/forum/viewforum.+
nextLink: //div[@class="linksb"]/div[@class="inbox"]/p[@class="pagelink conl"]/strong/following-sibling::a[1]
pageElement: //div[@id="punviewforum"]/div[@id="vf"]/div[@class="box"]/div[@class="inbox"]/table
insertBefore: //div[@id="punviewforum"]/div[@id="vf"]/div[@class="box"]/div[@class="inbox"]/table/following-sibling::node()
exampleUrl: http://www.warsow.net/forum/viewforum.php?id=5
</textarea>
<h2>Civilization Fanatics' Forums view thred</h2>
<textarea class="autopagerize_data" readonly="readonly">
url: http://forums\.civfanatics\.com/showthread.+
nextLink: //a[text()=">"]
pageElement: //div[@id="posts"]/div/div/parent::node()
insertBefore: //div[@id="posts"]/div[@id="lastpost"]
exampleUrl: http://forums.civfanatics.com/showthread.php?t=193359
</textarea>
<h2>Civilization Fanatics' Forums view forums</h2>
<textarea class="autopagerize_data" readonly="readonly">
url: http://forums\.civfanatics\.com/forumdisplay.+
nextLink: //a[text()=">"]
pageElement: //table[@id="threadslist"]
insertBefore: //table[@id="threadslist"]/following-sibling::node()
exampleUrl: http://forums.civfanatics.com/forumdisplay.php?f=158
</textarea>AutoPagerizeについては Redirect をご覧ください:)
このSITEINFOの適用方法は、http://labs.gmo.jp/blog/ku/2007/07/autopagerizexpath_autopagerize_ide.htmlを参考。
簡単に書くと、
- WebサイトにHTMLを設置して、autopagerize.user.jsのvar SITEINFO_IMPORT_URLSにそのURLを追加
- textarea class="autopagerize_data" readonly="readonly" タグの中を読んでくれるようです
- あるいは、autopagerize.user.js のvar SITEINFOに直接書く。
- サンプルが書いてあるので、その形で書く
という感じです。
しばらく使って問題無さそうなら、temp - SITEINFOに投稿しようと思います。
Have fun :)