なんもかけない
ひさしぶりに何か想像を書こうと思ったのだけれど書けなかった……
ひさしぶりに何か想像を書こうと思ったのだけれど書けなかった……
position: absolute で段組されてるところだと document.documentElement.scrollHeight がすごく小くなってしまい、ページがどのぐらい残っているか取得できない。
あと GM_xmlhttprequest をつかうべきじゃないかも。ページングがクロスサイトすることなんてまずないし、無用な特権は行使しないほうがいいよね。
userChrome.js + http://www.ne.jp/asahi/nanto/moon/2006/12/31/copy-url-lite.uc.js + Firebug
{
label: "Copy XPath",
accesskey: "X",
get text () {
return FBL.getElementXPath(document.popupNode);
}
}をつけたして C-n して新しいウィンドウを開く /html/body/div[2]/div[2]/form/div/textarea
ただし、Fx の場合 thead とかが存在しなくても DOM 上では thead を補完するので、そのままでは他のブラウザでとおらないこともあるとおもう (Google のページングとかそうだけど AutoPagerize 的なときに困るのでちゃんと確認してほしい)。
http://d.hatena.ne.jp/keisukefukuda/20071126/p1
Perl と同じように (つまり libxml そのまま) ではありませんが以下のようにしてできます。
require "rubygems"
require "xml/libxml"
require "tempfile"
f = Tempfile.new("xml")
f << <<EOS
<?xml version="1.0" encoding='utf-8'?>
<service xmlns="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom">
<workspace>
<atom:title>Main Site</atom:title>
<collection href="http://example.org/blog/main">
<atom:title>My Blog Entries</atom:title>
<categories href="http://example.com/cats/forMain.cats" />
</collection>
</workspace>
</service>
EOS
f.close
doc = XML::Document.file(f.path)
namespaces = {
"app" => "http://www.w3.org/2007/app",
"atom" => "http://www.w3.org/2005/Atom"
}.to_a
p doc.find('/app:service/app:workspace/app:collection/atom:title', namespaces)
#=> <atom:title>My Blog Entries</atom:title>namespaces にわたすのが配列なのが微妙にひっかかる。(ドキュメントよむと "prefix:uri" みたいな文字列でもわたせるけど圧倒的なキモさなので使わないとおもう)