はてなキーワード: hideとは
の他サイト。
http://lifehack-japan.biz/?p=29
http://anond.hatelabo.jp/20110107214632
713648.com
asahi-studio.com
child-clothes.net
docodemotv.jp
eastlandcorp.com
hiro-sekkei.com
musou3.com
sen-z.com
waffen.jp
www.713648.com
www.novganon.com
http://sanpoapril.blog104.fc2.com/blog-entry-167.html
http://d.hatena.ne.jp/saebou/20120102/p1
Mステは原語表示の下に日本語訳がつく。CD付属のとほぼ同じ内容。
日本とかJAPANとか出てくるのは、その番組では言い替えて歌ったから。
| スマスマ | 紅白 | Mステ |
|---|---|---|
| あなたが彼を愛そうと、キリストを愛そうと関係ない | ||
| みんなで手を挙げて | ||
| それがあなたの生まれ持った宿命なんだもの | ||
| 小さい頃 よくママが言ってた | My Mama told me when I was young 私が若い頃 ママが言ってた |
|
| 人はみな 生まれたときはスーパースター | We are all born superstars 「みんな生まれたときからスーパースターよ」 |
|
| 化粧台の鏡の前 | She rolled my hair and put my lipstick on 髪をまくり上げて 口紅を塗ってくれた |
|
| 私の髪をカールし 口紅をつけながら | In the glass of her boudoir ガラス張りのブードワで |
|
| 自分を愛するのはいいこと | "There's nothing wrong with lovin' who you are" 「ありのままの自分を愛せばいい」ママが言ったわ |
|
| 神はあなたをパーフェクトにつくったの | She said, "Cause he made you perfect, babe." 「そのままで完璧なあなたを 神は創ったの」 |
|
| くよくよしないでいれば きっと成功する | "So hold your head up girl and you'll go far, 「だから顔を上げていれば 遠くまで行けるわ" |
|
| 私の言葉を 信じなさい | Listen to me when I say" これから言うこと よく聞いて」 |
|
| 私には自分なりの美しさがある だって神様に間違いはないから | I'm beautiful in my way Cause God makes no mistakes 自分らしいままで美しい だって神には一寸のブレもない |
|
| 私は正しい道を進んでいる こうなるように生まれてきたの | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
|
| 後悔の殻に閉じこもらないで 自分を愛せば うまくいく | Don't hide yourself in regret Just love yourself and you're set 悔いに身を隠さないで ただ自分を愛せばそれでO.K. |
|
| 私は正しい道を進んでいる 私はこう生まれてきた | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
|
| ほかの生き方なんてない | Ooo there ain't no other way Ooo そのほかの道なんてない |
|
| こうなるように生まれてきたの | Baby I was born this way ベイビー 私はこの運命のもとに生まれてきた |
|
| ほかの道はない こうして生まれてきたんだから | Ooo there ain't no other way Ooo そのほかの道なんてない |
|
| Baby I was born this way ベイビー 私はこの運命のもとに生まれてきた |
||
| 私は正しい道を進んでいる 私はこう生まれてきたから | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
|
| Don't be a drag, just be a queen ドラッグ・クイーンじゃなくて クイーンになればいい |
||
| Don't be! なればいい! |
||
| 分別をわきまえて、友を愛しなさい | Give yourself prudence And love your friends 自分の体を尊重して 友だちを愛するの |
|
| 日本のみんな、真実を喜びなさい | Subway kid, rejoice your truth 「サブウェイ・キッズ、真実を祝え」 |
|
| 自信が持てない者達の信仰のために | In the religion of the insecure I must be myself, respect my youth 弱者のための宗教では 自分らしくいて 若さに敬意をしめす |
|
| 私は自分を見失わず、若さを大事にする | ||
| 誰を愛しても、それは罪ではない | A different lover is not a sin Believe capital H-I-M (hey hey hey) 恋人が“ヘン”だからって罪にならないわ 信じて大文字の“H-I-M”(神)を |
|
| 主なるイエスを信じなさい | ||
| 私は自分の人生を愛しているし、この曲も愛している | I love my life I love this record and Mi amore vole fe yah (love needs faith) この人生もこのレコードも愛してる(愛には信じる心が不可欠) |
|
| 愛することは確信することよ | ||
| 私は私のままで美しい | I'm beautiful in my way Cause God makes no mistakes 自分らしいままで美しい だって神には一寸のブレもない |
|
| だって神様は間違えたりしないから | ||
| 私の生き方は間違っていない、これが私の生まれ持った宿命 | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
|
| 悲嘆に本当の自分を隠さないで | Don't hide yourself in regret Just love yourself and you're set 悔いに身を隠さないで ただ自分を愛せばそれでO.K. |
|
| 自分自身を愛せば大丈夫 | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
|
| 私の生き方は間違っていない、これが私の生まれ持った宿命 | Ooo there ain't no other way Ooo そのほかの道なんてない |
|
| Baby I was born this way ベイビー 私はこの運命のもとに生まれてきた |
||
| 他の生き方なんてできない | Ooo there ain't no other way Ooo そのほかの道なんてない |
|
| これが私の生まれ持った宿命 | Baby I was born this way ベイビー 私はこの運命のもとに生まれてきた |
|
| 私の生き方は間違っていない、これが私の生まれ持った宿命 | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
|
| 野暮なこと言わず、女王でいればいいのよ | ぼやいてないで いっそ女王になろう | Don't be a drag, just be a queen ドラッグ・クイーンじゃなくて クイーンになればいい |
| あなたが貧乏でも、お金持ちでも | 貧富の差も 肌の色も 国籍も関係ない | Whether you're broke or evergreen あなたが貧乏でも 恵まれていても |
| 黒人でも、白人でも、ベージュ肌でも、ラテン系でも | You're black, white, beige chola descent 黒人でも 白人でも ベージュ肌でも インディオ系でも |
|
| レバノン生まれでも、東洋系でも | You're Lebanese, You're Orient あなたがレバノン生まれでも 東洋系でも |
|
| 障害を負って、仲間外れにされて、イジメられたり、からかわれても | 人生で困難があっても いじめられ からかわれても | Whether life's disabilities Left you outcast, bullied or teased 人生で障害を負って 仲間外れにされて イジメられて からかわれても |
| 自分を讃え、愛してあげなさい | 自分を信じ 愛してあげよう | Rejoice and love yourself today 今日いる自分を愛して そしてお祝いして |
| だってそれがあなたの生まれ持った宿命だから | それがあなたの人生だから | Cause baby you we're born this way だってベイビー あなたはこの運命のもとに生まれてきた |
| たとえゲイでも、ストレートでも、バイでも | 性的好みなんてどうでもいい | No matter gay, straight, or bi Lesbian, transgendered life たとえゲイでもストレートでもバイでも レズビアンでもトランス・ジェンダーでも |
| レズビアンでも、性同一性障害であっても、関係ないわ | ||
| 私の生き方は間違ってない、ベイビー | 私は正しい道を進んでいる どんな困難も乗り越える | I'm on the right track baby I was born to survive まちがってなんかいないよ ベイビー 生きるため産まれてきた |
| 私は生き抜くために 生まれてきたの | ||
| 黒人でも、白人でも、ベージュ肌でも、ラテン系でも、東洋系でも | 肌の色や国籍なんて関係ない | No matter black, white or beige Chola or Orient made 黒人でも 白人でも ベージュ肌でも ラテン系でも 東洋系でも |
| I'm on the right track baby I was born to be brave このまま進めばいい ベイビー 勇敢になるために産まれてきた |
||
| そう 歌おうJAPAN! | ||
| 私はこのままで美しい | 私には自分なりの美しさがある だって神様に間違いはないから | I'm beautiful in my way Cause God makes no mistakes 自分らしいままで美しい だって神には一寸のブレもない |
| だって神様は間違えたりしないから | ||
| 私の生き方は間違っていない、これが私の生まれ持った宿命 | 私は正しい道を進んでいる 私らしく生きている | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
| 自分自身を愛せば大丈夫 | 後悔の殻に閉じこもらないで 自分を素直に愛せばそれでいい | Don't hide yourself in regret Just love yourself and you're set 悔いに身を隠さないで ただ自分を愛せばそれでO.K. |
| 私の生き方は間違っていない、これが私の生まれ持った宿命 | 私は正しい道を進んでいる 私はこう生まれてきたから | I'm on the right track baby I was born this way このまま進めばいいのよ ベイビー 私はこの運命のもとに生まれてきた |
| 他の生き方なんてできない | ほかの道はない | Ooo there ain't no other way Ooo そのほかの道なんてない |
| これが私の生まれ持った宿命 | こうして生まれてきたんだから | Baby I was born this way ベイビー 私はこの運命のもとに生まれてきた |
| ほかの道はない | Ooo there ain't no other way Ooo そのほかの道なんてない |
|
| こうして生まれてきたんだから | Baby I was born this way ベイビー 私はこの運命のもとに生まれてきた |
|
| I was born this way hey! 私はこの運命のもとに生まれてきた |
||
| 私の生き方は間違っていない、これが私の生まれ持った宿命 | 私は正しい道を進んでいる こう生まれてきたから | I'm on the right track baby I was born this way このまま進めばいい ベイビー 私はこの運命のもとに生まれてきた |
| これが私の生まれ持った宿命 | 私はこう生まれてきたから | I was born this way hey! 私はこの運命のもとに生まれてきた |
| 私の生き方は間違っていない、これが私の生まれ持った宿命 | 私は正しい道を進んでいる こう生まれてきたから | I'm on the right track baby I was born this way hey! このまま進めばいい ベイビー 私はこの運命のもとに生まれてきた |
| 同じ遺伝子 |
Google Readerをリスト表示で使っており、タイトルの先頭にPRとかADとか入ってるエントリを見えなくしたい人。
次のGreasemonkeyを使用する。まずはグリモン本体と右記をインストール。Google Reader Remove Ads for Greasemonkey
このままではエラーが出て動かないのでスクリプトを修正する。修正するにはFirefoxの右上にある猿(Greasemonkey)のアイコンの右にある下矢印をクリック→「ユーザスクリプトの管理」をクリック→「Google Reader Remove Ads」の「設定」をクリック→「このユーザスクリプトを編集します」をクリックするとエディタで「Google Reader Remove Ads」のスクリプトが表示されるのでそれを編集する。
以下に修正点を示す。個々の修正点のタイトルはその行が何行目にあるかを示している。
なおこの修正では、Google Reader Remove Adsの機能の内切り捨てているものもある。そのことをご了承の上、お使いいただきたい。
var title_anc = div.getElementsByClassName('entry-title-link')[0];
to
var title_anc = div.getElementsByClassName('entry-title')[0];
if (title_anc.text.search(title_prefixes[i]) == 0) {
to
if (title_anc.textContent.search(title_prefixes[i]) == 0) {
var msg = 'Hide "' + title_anc.text + '(' + title_anc.href + ')"';
to
var msg = 'Hide "' + title_anc.textContent;// + '(' + title_anc.href + ')"';
check_body(divs.snapshotItem(i));
to
//check_body(divs.snapshotItem(i));
さてどこから消すか
上下の歯が離れてる状態で閉じた唇の形が嫌で嫌で、なるたけ奥歯を少し噛むようにこころがけていた。ちょっとでも厚い唇がごまかせるように、立派なあごが目立たないように。
そしたらなんかいつのまにか、歯を食いしばるのが癖になっていた。首と肩がものすごい凝ってて辛い。ひどいときだと、自分の頭の重みが耐えられない。けども、口元が緩んでる自分の顔見るとあうあうあーってなるから嫌。何か解決案はないものか。美容整形以外で。
そして今、頭がすごく重くて取り外したい。整形外科のリハビリ室で、軽く首つりになってた人たちの気持ちがわかったよ。あとどうしてHIDEがドアノブとタオルで肩こり解消しようとしていたのかも。
安普請のドアノブに頭引っかけたら取れそうで嫌なので、寝よう! そうしよう。あと、いい枕買おう。
以下は映画「アポロ13」でエド・ハリスが演じた、アポロ計画の運用管制主任、ジーン・クランツ氏の仕事に対する姿勢を示した「10か条」です。
http://www.pmaj.or.jp/online/0710/message3.html
1. Be Proactive . (先を見越してうごけ)
2. Take Responsibility (自分の担当は自ら責任をもて)
3. Play Flat-out (きれいになるまでやりとうせ)
4. Ask Questions (不確実なものはその場で質問をして把握せよ)
5. Test and Validate All Assumption (考えられることはすべて試し、確認せよ)
6. Write it Down (連絡も記録もすべて書きだせ)
7. Don‘t hide mistakes (ミスを隠すな、仲間の教訓にもなる)
8. Know your system thoroughly (システム全体を掌握せよ)
9. Think ahead (常に、先を意識せよ)
10. Respect your Teammates (仲間を尊重し、信頼せよ)
素敵過ぎる。
クラシック; バッハ, マーラー ,ワーグナー,モーツァルト J POP: Mr.Children、サザンオールスターズ
R&B: Mary J Blige、Chris Brown、Aaliyah アンビエント: Brian Eno Tangerine Dream
エレクトロニカ: Fennesz、boards of canada ブルース: Jimi Hendrix B.B.king
カントリー: Hank Williams、Johnny Cash ゲームBGM: MOTHERシリーズ、テトリス、東方
サイケ: 1200Mics、Boredoms ジャズ: Bill Evans、John Coltrane 、Miles Davis
ポケモン; 初代のラストのライバル戦BGM ファンク: Sly、JB、the new master sounds
ブレイクコア; XANOPTICON, Jason Forrest,kid606 スカ: スカパラ, Specials、The Skatalites
ダブ :Lee "Scratch" Perry、King Tubby テクノ: Jeff mills、Derrick May,Orbital
トランス: Tiesto、Paul van Dyk、Goa Gil ニューウェーブ: XTC、Depeche Mode 、New Order
フォーク: Simon & Garfunkel さだまさし プログレ: Yes、EL&P King Crimson, pink floyd
ニューエイジ: Enya、zabadak ハードコア: Bad Brains、Suicidal Tendencies,
ハウス: Masters At Work、Daft Punk、Deep Dish パンク: Sex Pistols CLASH , iggy pop, あぶらだこ, スターリン
ヒップホップ: 2pac、Nas、de la soul, JURASSIC 5 オルタナ: Nirvana Sonic Youth, Pearl JAM
フュージョン: Weather Report Brecker Brothers パフューム; 断然のっち
ジブリ; 君を乗せて, 風になる, 心オナニー ロキノン; BUMP OF CHICKEN, RADWIMPS, 相対性理論
ポストロック: Mogwai、65dos miceparade メタル: Iron Maiden、Megadeth、Slipknot
メロコア: Green Day、Blink-182 ハイスタ レゲエ: Bob Marley 卍ライン
ノイズ; ノイバウテン、灰野 レアグルーヴ; The Wooden Glass 和田アキ子
エレクトロ; justice,Boys Noize ドラムンベース; 4Hero , Makoto、kabuki
ロック: The Beatles、Led Zeppelin、Queen、Rolling Stones 演歌: 氷川きよし, 北島三郎, ジェロ
現代音楽; ライヒ、クセナキス ジョンケージ グラス トリップホップ; Massive Attack, Portishead
V系; hide、黒夢、ガゼット, dir en grey ソウル: Stevie Wonder、 Marvin Gaye
最近Perl界隈ではMoose、MooseってなんかMooseってのが流行ってるらしい。
自分自身のブログでは、さもずっと前からMoose知ってたかのように振舞うために、増田で先に放出しておく。てへへ。
プログラマ層が限りなく低い増田にこんなこと書いてもだれも見てくれない気はするけど。
初めてのMoose - Mooseのすすめ - はてな#hide-k
meta object protocol について考えてみる - TokuLog 改めChumbyとどきました日記
YappoLogs: Moose のコードを探索して理解を深めた
Mooseってのは結局のところClass::MOPのラッパーみたいなもんだと。
で、Class::MOPってのは何だ?ってことだけど、メタなんとかプログラミング?え?プロトコル?まーどっちでもいい。
よくよく読んでいくとメタなんとかとか大層な名前が付いてるけど、結局のところPerlのpackageそのものの操作をオブジェクティブ扱えるようにしたものみたいだ。
つまりだな、例えばpackageに対して動的に(静的ではなく!)メソッドを追加したい場合、今までなら
package Foo; **Foo::method = sub { return 'hoge'; }; print Foo->method;
のように型グロブに関数のリファレンスを突っ込むということをしなければなかったが
use Class::MOP; my $class = Class::MOP::Class->create('Foo'); $class->add_method('method',sub { return 'hoge'; }); print Foo->method;
みたいな感じでかっこよく追加できるってわけさ。ま、これはほんの一例だけどな。(他にもメソッドを削除したりフックしたり色々できる。その辺は今回省略。)
本来なら「package Foo」とするところを「my $class = Class::MOP::Class->create('Foo');」と書ける。
これの何が良いのかというと、$classというオブジェクト経由でFooパッケージを色々操作できるところにつきる。
型グロブを使用したり「no (warnings|strict)」をしたりパッケージを操作する処理っていうのはPerlのキチャナイ構文が多かったのだが、Class::MOPのおかげでスッキリ綺麗に書けるようになったってこった。
で、次にMooseだが、これは結局のところClass::MOPのパッケージ管理の部分に+αしただけのラッパーだ。
でもその+αってのが結構凄かったりする。
もうこの辺の話はさんざん既出だが、例えばhasという関数を使ってアクセサや型定義が出来たり
package Foo; use Moose; has 'method' => ( is => 'rw', isa => 'Int' , default => '10' ); my $obj = Foo->new; print $obj->method; # 10 $obj->method(50); print $obj->method; # 50 $obj->method('hoge') # Int型じゃないのでエラー
Moose::Roleを使ってRubyのMixinみたいなことができたりする。
でも実はこれらの処理ってのは本当は別に凄くもなんとも無い。
アクセサ生成なんてClass::Accessorがあるし、関数の引数の型チェックなんてのもParams::Validate等昔から存在してるし、Mixinに関してはもともとPerlは多重継承できるので最初からできるし。
じゃあなんでみんなMoose、Moose言ってるのかっていうと、それはやはりClass::MOPの存在が大きいであろう。
綺麗且つ柔軟にパッケージの操作が出来るClass::MOPが土台にあって、今まで別々の役割として存在してきたモジュール達を統合し、よりわかりやすく、より柔軟に、そしてより強力なPerlのオブジェクト指向を構築できるようにした。それがMooseなのだ。
・・・しかし、小生。
Mooseについて調べていくうちに一つ残念に思ったことがある。
オブジェクトにメソッドを追加する機構がないのだ。
オブジェクトにメソッドを追加する、だ。パッケージにではなく、オブジェクトに、だ。
具体例をあげる。
package Foo; use Moose; my $obj = Foo->new; $obj->meta->add_method('hoge', sub { return 'hoge' }); print $obj->hoge; # hoge
ちなみに$obj->metaというのはFooパッケージを管理するClass::MOPへのアクセサだ。
ということは上記の処理はFooに対してhogeというメソッドを追加していることになる。
では次の例。
package Foo; use Moose; my $obj = Foo->new; $obj->meta->add_method('hoge', sub { return 'hoge' }); print $obj->hoge; # hoge my $obj_2 = Foo->new; print $obj_2->hoge; # hoge
$obj_2->hogeが呼べてしまうわけだ。
$obj->metaは結局のところFooパッケージなのだから、そこにメソッドを追加しているので当然の結果である。
$objだけにメソッドを追加することは、Mooseではできないのだ。
非常に残念である。ああ、残念だ。
・・・しかし、小生。
これでもプログラマの端くれである。こんなことでめげていてはMooserを名乗れないのである。(あ、MooserってのはMoose使いの人の俗称ね。今僕が考えたの)
なのでオブジェクトにメソッドを追加できるように拡張して見せよう。
package Foo; use Moose; use Class::Object; my $class_object = Class::Object->can('new'); override new => sub { ref($class_object->(shift))->SUPER::new(@_) }; my $obj = Foo->new; $obj->meta->add_method('hoge', sub { return 'hoge' }); print $obj->hoge; # hoge my $obj_2 = Foo->new; print $obj_2->hoge; # エラー
たった3行追加するだけで実現できる。さすがMoose。
ただし、Class::Objectを利用しているのでFoo->newで返ってくるパッケージがFoo::0といったようにFooではなくなってしまっているのでrefとかでパッケージ名の比較ができなくなってしまう問題が発生する。
でもこれも継承順をいじったりと本気で頑張れば、表向きに見せるパッケージ名をFooすることも可能だろう。
その添削の役目はどこかのハッカーに任せるとして、今日のところはこの辺で終了としたい。
Moooooooooooooose!と叫ぶのが流行ってるみたいなので、もっとも長くMooooooooooooooose!と叫んだ最初の男となるべく下記の処理を残しておく。
length q chdir uc and print chr ord uc q rmdir and do { print chr ord q xor x while $a++ < 0xffffffff } or print chr ord qw q sin q and print chr ord q ne sin and print chr hex length q q shift shmread bless q;
美輪明宏さんの五箇条
[ 美輪さんの言葉 ]
1 男女関係に注意
2 暴飲暴食に注意
4 約束事を守る
5 人間関係は腹六分
Amazon.co.jp??F ??J??X??^??}??[??????r??????[: ????????????????????@????
世に流出する小説も映画もドラマも大半は熱く濃い人間関係を描いている。
(そうしないとお話にならないからね)
一般的にも「友情に厚い人=善き人」とされていて、
公共電波で美輪さんのような発言をする人はいなかった。
Beautysalon HAPPY・hideのblog:2007年09月 - livedoor Blog(ブログ)
十年以上ファンをやってるけど、今回はどうかと思った。
技術面だと、ドラムが適当(単純化)しすぎな上に、他の楽器を引っ張っていくような
前のめりなキレがなくなった。もたついてた。明らかに練習不足
ピアノもそう。Art of Lifeを楽譜めくりながら弾いてたときは悲しかった。手もぎこちなかったし。どんだけ練習不足だよ。
Toshiは変なビブラート覚えて、声を伸ばし終わったあとぶった切ったように途切れるし。もっとすーっと消える感じだったのに。
pataは、生演奏でもCDと同じ音出せるくらい安定感のある人だったのに、今日は別人のようにぐだぐだだった。
でも技術なんてどうでもいい。元からある方じゃないし。ロックは魂だから。
その魂が入ってなかった。
なんつーかもう、みんな他人事なんだよな
よっちゃんのやりたいことに付き合うはめになって仕方なく、って感じ。
当のよっちゃんは相変わらずマイペースだし、Pataも練習してこねーし
toshiも心ここにあらずな感じというか、カラオケしてるのと変わらんし。
みんな自分達のライブを「自分」が盛り上げようという気がない。他人事。ファンに
悪いとか、真剣には考えていない。まいっか俺関係ねーしって感じ。
どうにかがんばらなきゃって意気込みを感じた。
セットも昔はもっと金かけてたよ。ドラム浮いてったり。水しぶきあげたり、紙ふぶき使ったり、火使ったり。
すんげー普通のセットだったよね。
ブックマークのタグは普通の人はあまり数をつかってないんじゃないか?
タグで5000って、ブックマークが1000超えてる人がただの廃人な気がする。
それよりも問題ははてなスター。
ホットエントリーのブクマコメをちらりと見ようとしたときにスターがいっぱいあると固まる。
もうどうしょうもないほど処理が持っていかれる。
裏で流してる作業用ニコニコが止まるじゃないか。
javascriptってsleepみたいのないの?
↓
http://aligach.net/diary/20060504.html
var failure_notice = '
失敗しますた!';Element.hide( obj );
new Insertion.After( obj.id, failure_notice ); // メッセージを表示
setTimeout( function() {
Element.show( obj.id + '-edit' ); // 編集画面を表示
Element.hide( obj.id + '-failure' ); // メッセージを消去
}, 1500 );
こ、これは・・・。あたまいい。
他にもjavascriptでsleepって探すといろいろでてくるけど、
タグとか、はてなスターってきっとオブジェクト表示させたままで読み込みさせてるところが処理もってってるんだよね。
違うかな?
非表示コード入ってなかった気がするよ。
はいってたっけ?
新人研修とかでDB参照のプログラムを書かせると表示させたままスプレッドシートとかに吐き出そうとして固まるのはありがちだけど、javascriptでもInsertionで回避できるんだったらこれに越したことは無いよね。
/* Ten */
if (typeof(Ten) == 'undefined') {
Ten = {};
}
Ten.NAME = 'Ten';
Ten.VERSION = 0.06;
/* Ten.Class */
Ten.Class = function(klass, prototype) {
if (klass && klass.initialize) {
var c = klass.initialize;
} else if(klass && klass.base) {
var c = function() { return klass.base[0].apply(this, arguments) };
} else {
var c = function() {};
}
c.prototype = prototype || {};
c.prototype.constructor = c;
Ten.Class.inherit(c, klass);
if (klass && klass.base) {
for (var i = 0; i < klass.base.length; i++) {
var parent = klass.base[i];
if (i == 0) {
c.SUPER = parent;
c.prototype.SUPER = parent.prototype;
}
Ten.Class.inherit(c, parent);
Ten.Class.inherit(c.prototype, parent.prototype);
}
}
return c;
}
Ten.Class.inherit = function(child,parent) {
for (var prop in parent) {
if (typeof(child[prop]) != 'undefined' || prop == 'initialize') continue;
child[prop] = parent[prop];
}
}
/*
// Basic Ten Classes
**/
/* Ten.JSONP */
Ten.JSONP = new Ten.Class({
initialize: function(uri,obj,method) {
if (Ten.JSONP.Callbacks.length) {
setTimeout(function() {new Ten.JSONP(uri,obj,method)}, 500);
return;
}
var del = uri.match(/\?/) ? '&' : '?';
uri += del + 'callback=Ten.JSONP.callback';
if (!uri.match(/timestamp=/)) {
uri += '&' + encodeURI(new Date());
}
if (obj && method) Ten.JSONP.addCallback(obj,method);
this.script = document.createElement('script');
this.script.src = uri;
this.script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(this.script);
},
addCallback: function(obj,method) {
Ten.JSONP.Callbacks.push({object: obj, method: method});
},
callback: function(args) {
// alert('callback called');
var cbs = Ten.JSONP.Callbacks;
for (var i = 0; i < cbs.length; i++) {
var cb = cbs[i];
cb.object[cb.method].call(cb.object, args);
}
Ten.JSONP.Callbacks = [];
},
MaxBytes: 8000,
Callbacks: []
});
/* Ten.XHR */
Ten.XHR = new Ten.Class({
initialize: function(uri,opts,obj,method) {
if (!uri) return;
this.request = Ten.XHR.getXMLHttpRequest();
this.callback = {object: obj, method: method};
var xhr = this;
var prc = this.processReqChange;
this.request.onreadystatechange = function() {
prc.apply(xhr, arguments);
}
var method = opts.method || 'GET';
this.request.open(method, uri, true);
if (method == 'POST') {
this.request.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
}
var data = opts.data ? Ten.XHR.makePostData(opts.data) : null;
this.request.send(data);
},
getXMLHttpRequest: function() {
var xhr;
var tryThese = [
function () { return new XMLHttpRequest(); },
function () { return new ActiveXObject('Msxml2.XMLHTTP'); },
function () { return new ActiveXObject('Microsoft.XMLHTTP'); },
function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); },
];
for (var i = 0; i < tryThese.length; i++) {
var func = tryThese[i];
try {
xhr = func;
return func();
} catch (e) {
//alert(e);
}
}
return xhr;
},
makePostData: function(data) {
var pairs = [];
var regexp = /%20/g;
for (var k in data) {
var v = data[k].toString();
var pair = encodeURIComponent(k).replace(regexp,'+') + '=' +
encodeURIComponent(v).replace(regexp,'+');
pairs.push(pair);
}
return pairs.join('&');
}
},{
processReqChange: function() {
var req = this.request;
if (req.readyState == 4) {
if (req.status == 200) {
var cb = this.callback;
cb.object[cb.method].call(cb.object, req);
} else {
alert("There was a problem retrieving the XML data:\n" +
req.statusText);
}
}
}
});
/* Ten.Observer */
Ten.Observer = new Ten.Class({
initialize: function(element,event,obj,method) {
var func = obj;
if (typeof(method) == 'string') {
func = obj[method];
}
this.element = element;
this.event = event;
this.listener = function(event) {
return func.call(obj, new Ten.Event(event || window.event));
}
if (this.element.addEventListener) {
if (this.event.match(/^on(.+)$/)) {
this.event = RegExp.$1;
}
this.element.addEventListener(this.event, this.listener, false);
} else if (this.element.attachEvent) {
this.element.attachEvent(this.event, this.listener);
}
}
},{
stop: function() {
if (this.element.removeEventListener) {
this.element.removeEventListener(this.event,this.listener,false);
} else if (this.element.detachEvent) {
this.element.detachEvent(this.event,this.listener);
}
}
});
/* Ten.Event */
Ten.Event = new Ten.Class({
initialize: function(event) {
this.event = event;
},
keyMap: {
8:"backspace", 9:"tab", 13:"enter", 19:"pause", 27:"escape", 32:"space",
33:"pageup", 34:"pagedown", 35:"end", 36:"home", 37:"left", 38:"up",
39:"right", 40:"down", 44:"printscreen", 45:"insert", 46:"delete",
112:"f1", 113:"f2", 114:"f3", 115:"f4", 116:"f5", 117:"f6", 118:"f7",
119:"f8", 120:"f9", 121:"f10", 122:"f11", 123:"f12",
144:"numlock", 145:"scrolllock"
}
},{
mousePosition: function() {
if (!this.event.clientX) return;
return Ten.Geometry.getMousePosition(this.event);
},
isKey: function(name) {
var ecode = this.event.keyCode;
if (!ecode) return;
var ename = Ten.Event.keyMap[ecode];
if (!ename) return;
return (ename == name);
},
targetIsFormElements: function() {
var target = this.event.target;
if (!target) return;
var T = (target.tagName || '').toUpperCase();
return (T == 'INPUT' || T == 'SELECT' || T == 'OPTION' ||
T == 'BUTTON' || T == 'TEXTAREA');
},
stop: function() {
var e = this.event;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
} else {
e.cancelBubble = true;
e.returnValue = false;
}
}
});
/* Ten.DOM */
Ten.DOM = new Ten.Class({
getElementsByTagAndClassName: function(tagName, className, parent) {
if (typeof(parent) == 'undefined') {
parent = document;
}
var children = parent.getElementsByTagName(tagName);
if (className) {
var elements = [];
for (var i = 0; i < children.length; i++) {
var child = children[i];
var cls = child.className;
if (!cls) {
continue;
}
var classNames = cls.split(' ');
for (var j = 0; j < classNames.length; j++) {
if (classNames[j] == className) {
elements.push(child);
break;
}
}
}
return elements;
} else {
return children;
}
},
removeEmptyTextNodes: function(element) {
var nodes = element.childNodes;
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) {
node.parentNode.removeChild(node);
}
}
},
nextElement: function(elem) {
do {
elem = elem.nextSibling;
} while (elem && elem.nodeType != 1);
return elem;
},
prevElement: function(elem) {
do {
elem = elem.previousSibling;
} while (elem && elem.nodeType != 1);
return elem;
},
scrapeText: function(node) {
var rval = [];
(function (node) {
var cn = node.childNodes;
if (cn) {
for (var i = 0; i < cn.length; i++) {
arguments.callee.call(this, cn[i]);
}
}
var nodeValue = node.nodeValue;
if (typeof(nodeValue) == 'string') {
rval.push(nodeValue);
}
})(node);
return rval.join('');
},
onLoadFunctions: [],
loaded: false,
timer: null,
addEventListener: function(event,func) {
if (event != 'load') return;
Ten.DOM.onLoadFunctions.push(func);
Ten.DOM.checkLoaded();
},
checkLoaded: function() {
var c = Ten.DOM;
if (c.loaded) return true;
if (document && document.getElementsByTagName &&
document.getElementById && document.body) {
if (c.timer) {
clearInterval(c.timer);
c.timer = null;
}
for (var i = 0; i < c.onLoadFunctions.length; i++) {
c.onLoadFunctions[i]();
}
c.onLoadFunctions = [];
c.loaded = true;
} else {
c.timer = setInterval(c.checkLoaded, 13);
}
}
});
/* Ten.Style */
Ten.Style = new Ten.Class({
applyStyle: function(elem, style) {
for (prop in style) {
elem.style[prop] = style[prop];
}
}
});
/* Ten.Geometry */
Ten.Geometry = new Ten.Class({
initialize: function() {
if (Ten.Geometry._initialized) return;
var func = Ten.Geometry._functions;
var de = document.documentElement;
if (window.innerWidth) {
func.getWindowWidth = function() { return window.innerWidth; }
func.getWindowHeight = function() { return window.innerHeight; }
func.getXScroll = function() { return window.pageXOffset; }
func.getYScroll = function() { return window.pageYOffset; }
} else if (de && de.clientWidth) {
func.getWindowWidth = function() { return de.clientWidth; }
func.getWindowHeight = function() { return de.clientHeight; }
func.getXScroll = function() { return de.scrollLeft; }
func.getYScroll = function() { return de.scrollTop; }
} else if (document.body.clientWidth) {
func.getWindowWidth = function() { return document.body.clientWidth; }
func.getWindowHeight = function() { return document.body.clientHeight; }
func.getXScroll = function() { return document.body.scrollLeft; }
func.getYScroll = function() { return document.body.scrollTop; }
}
Ten.Geometry._initialized = true;
},
_initialized: false,
_functions: {},
getScroll: function() {
if (!Ten.Geometry._initialized) new Ten.Geometry;
return {
x: Ten.Geometry._functions.getXScroll(),
y: Ten.Geometry._functions.getYScroll()
};
},
getMousePosition: function(pos) {
// pos should have clientX, clientY same as mouse event
if ((navigator.userAgent.indexOf('Safari') > -1) &&
(navigator.userAgent.indexOf('Version/') < 0)) {
return {
x: pos.clientX,
y: pos.clientY
};
} else {
var scroll = Ten.Geometry.getScroll();
return {
x: pos.clientX + scroll.x,
y: pos.clientY + scroll.y
};
}
},
getElementPosition: function(e) {
return {
x: e.offsetLeft,
y: e.offsetTop
};
},
getWindowSize: function() {
if (!Ten.Geometry._initialized) new Ten.Geometry;
return {
w: Ten.Geometry._functions.getWindowWidth(),
h: Ten.Geometry._functions.getWindowHeight()
};
}
});
/* Ten.Position */
Ten.Position = new Ten.Class({
initialize: function(x,y) {
this.x = x;
this.y = y;
},
subtract: function(a,b) {
return new Ten.Position(a.x - b.x, a.y - b.y);
}
});
/*
// require Ten.js
**/
/* Ten.SubWindow */
Ten.SubWindow = new Ten.Class({
initialize: function() {
var c = this.constructor;
if (c.singleton && c._cache) {
return c._cache;
}
var div = document.createElement('div');
Ten.Style.applyStyle(div, Ten.SubWindow._baseStyle);
Ten.Style.applyStyle(div, c.style);
this.window = div;
this.addContainerAndCloseButton();
document.body.appendChild(div);
if (c.draggable) {
this._draggable = new Ten.Draggable(div, this.handle);
}
if (c.singleton) c._cache = this;
return this;
},
_baseStyle: {
color: '#000',
position: 'absolute',
display: 'none',
zIndex: 2,
left: 0,
top: 0,
backgroundColor: '#fff',
border: '1px solid #bbb'
},
style: {
padding: '2px',
textAlign: 'center',
borderRadius: '6px',
MozBorderRadius: '6px',
width: '100px',
height: '100px'
},
handleStyle: {
position: 'absolute',
top: '0px',
left: '0px',
backgroundColor: '#f3f3f3',
borderBottom: '1px solid #bbb',
width: '100%',
height: '30px'
},
containerStyle: {
margin: '32px 0 0 0',
padding: '0 10px'
},
// closeButton: 'close.gif',
closeButton: 'http://s.hatena.com/images/close.gif',
closeButtonStyle: {
position: 'absolute',
top: '8px',
right: '10px',
cursor: 'pointer'
},
_baseScreenStyle: {
position: 'absolute',
top: '0px',
left: '0px',
display: 'none',
zIndex: 1,
overflow: 'hidden',
width: '100%',
height: '100%'
},
screenStyle: {},
showScreen: true,
singleton: true,
draggable: true,
_cache: null
},{
screen: null,
windowObserver: null,
visible: false,
addContainerAndCloseButton: function() {
var win = this.window;
var c = this.constructor;
var div = document.createElement('div');
win.appendChild(div);
Ten.Style.applyStyle(div, c.containerStyle);
this.container = div;
if (c.handleStyle) {
var handle = document.createElement('div');
Ten.Style.applyStyle(handle, c.handleStyle);
win.appendChild(handle);
this.handle = handle;
}
if (c.closeButton) {
var btn = document.createElement('img');
btn.src = c.closeButton;
btn.alt = 'close';
Ten.Style.applyStyle(btn, c.closeButtonStyle);
win.appendChild(btn);
new Ten.Observer(btn, 'onclick', this, 'hide');
this.closeButton = btn;
}
if (c.showScreen) {
var screen = document.createElement('div');
Ten.Style.applyStyle(screen, Ten.SubWindow._baseScreenStyle);
Ten.Style.applyStyle(screen, c.screenStyle);
document.body.appendChild(screen);
this.screen = screen;
new Ten.Observer(screen, 'onclick', this, 'hide');
}
},
show: function(pos) {
pos = (pos.x && pos.y) ? pos : {x:0, y:0};
with (this.window.style) {
display = 'block';
left = pos.x + 'px';
top = pos.y + 'px';
}
if (this.screen) {
with (this.screen.style) {
display = 'block';
left = Ten.Geometry.getScroll().x + 'px';
top = Ten.Geometry.getScroll().y + 'px';
}
}
this.windowObserver = new Ten.Observer(document.body, 'onkeypress', this, 'handleEscape');
this.visible = true;
},
handleEscape: function(e) {
if (!e.isKey('escape')) return;
this.hide();
},
hide: function() {
if (this._draggable) this._draggable.endDrag();
this.window.style.display = 'none';
if (this.screen) this.screen.style.display = 'none';
if (this.windowObserver) this.windowObserver.stop();
this.visible = false;
}
});
/* Ten.Draggable */
Ten.Draggable = new Ten.Class({
initialize: function(element,handle) {
this.element = element;
this.handle = handle || element;
this.startObserver = new Ten.Observer(this.handle, 'onmousedown', this, 'startDrag');
this.handlers = [];
}
},{
startDrag: function(e) {
if (e.targetIsFormElements()) return;
this.delta = Ten.Position.subtract(
e.mousePosition(),
Ten.Geometry.getElementPosition(this.element)
);
this.handlers = [
new Ten.Observer(document, 'onmousemove', this, 'drag'),
new Ten.Observer(document, 'onmouseup', this, 'endDrag'),
new Ten.Observer(this.element, 'onlosecapture', this, 'endDrag')
];
e.stop();
},
drag: function(e) {
var pos = Ten.Position.subtract(e.mousePosition(), this.delta);
Ten.Style.applyStyle(this.element, {
left: pos.x + 'px',
top: pos.y + 'px'
});
e.stop();
},
endDrag: function(e) {
for (var i = 0; i < this.handlers.length; i++) {
this.handlers[i].stop();
}
if(e) e.stop();
}
});
/* Hatena */
if (typeof(Hatena) == 'undefined') {
Hatena = {};
}
/* Hatena.User */
Hatena.User = new Ten.Class({
initialize: function(name) {
this.name = name;
},
getProfileIcon: function(name) {
if (!name) name = 'user';
var pre = name.match(/^[\w-]{2}/)[0];
var img = document.createElement('img');
img.src = 'http://www.hatena.ne.jp/users/' + pre + '/' + name + '/profile_s.gif';
img.alt = name;
img.setAttribute('class', 'profile-icon');
img.setAttribute('width','16px');
img.setAttribute('height','16px');
with (img.style) {
margin = '0 3px';
border = 'none';
verticalAlign = 'middle';
}
return img;
}
}, {
profileIcon: function() {
return Hatena.User.getProfileIcon(this.name);
}
});
/* Hatena.Star */
if (typeof(Hatena.Star) == 'undefined') {
Hatena.Star = {};
}
/*
// Hatena.Star.* classes //
**/
if (window.location && window.location.host.match(/hatena\.com/)) {
Hatena.Star.BaseURL = 'http://s.hatena.com/';
} else {
Hatena.Star.BaseURL = 'http://s.hatena.ne.jp/';
}
Hatena.Star.Token = null;
/* Hatena.Star.User */
Hatena.Star.User = new Ten.Class({
base: [Hatena.User],
initialize: function(name) {
if (Hatena.Star.User._cache[name]) {
return Hatena.Star.User._cache[name];
} else {
this.name = name;
Hatena.Star.User._cache[name] = this;
return this;
}
},
_cache: {}
},{
userPage: function() {
return Hatena.Star.BaseURL + this.name + '/';
}
});
/* Hatena.Star.Entry */
Hatena.Star.Entry = new Ten.Class({
initialize: function(e) {
this.entry = e;
this.uri = e.uri;
this.title = e.title;
this.star_container = e.star_container;
this.comment_container = e.comment_container;
this.stars = [];
this.comments = [];
},
maxStarCount: 11
},{
flushStars: function() {
this.stars = [];
this.star_container.innerHTML = '';
},
bindStarEntry: function(se) {
this.starEntry = se;
for (var i = 0; i < se.stars.length; i++) {
if (typeof(se.stars[i]) == 'number') {
this.stars.push(new Hatena.Star.InnerCount(se.stars[i],this));
} else {
this.stars.push(new Hatena.Star.Star(se.stars[i]));
}
}
if (se.comments && !this.comments.length) {
for (var i = 0; i < se.comments.length; i++) {
this.comments.push(new Hatena.Star.Comment(se.comments[i]));
}
}
this.can_comment = se.can_comment;
},
setCanComment: function(v) {
this.can_comment = v;
},
showButtons: function() {
this.addAddButton();
this.addCommentButton();
},
addAddButton: function() {
if (this.star_container) {
this.addButton = new Hatena.Star.AddButton(this);
this.star_container.appendChild(this.addButton);
}
},
addCommentButton: function() {
if (this.comment_container) {
this.commentButton = new Hatena.Star.CommentButton(this);
this.comment_container.appendChild(this.commentButton.img);
}
},
showStars: function() {
var klass = this.constructor;
// if (this.stars.length > klass.maxStarCount) {
// var ic = new Hatena.Star.InnerCount(this.stars.slice(1,this.stars.length));
// this.star_container.appendChild(this.stars[0]);
// this.star_container.appendChild(ic);
// this.star_container.appendChild(this.stars[this.stars.length - 1]);
// } else {
for (var i = 0; i < this.stars.length; i++) {
this.star_container.appendChild(this.stars[i]);
}
},
showCommentButton: function() {
if (this.can_comment) {
this.commentButton.show();
if (this.comments.length) this.commentButton.activate();
} else {
// this.commentButton.hide();
}
},
addStar: function(star) {
this.stars.push(star);
this.star_container.appendChild(star);
},
addComment: function(com) {
if (!this.comments) this.comments = [];
if (this.comments.length == 0) {
this.commentButton.activate();
}
this.comments.push(com);
},
showCommentCount: function() {
this.comment_container.innerHTML += this.comments.length;
}
});
/* Hatena.Star.Button */
Hatena.Star.Button = new Ten.Class({
createButton: function(args) {
var img = document.createElement('img');
img.src = args.src;
img.alt = img.title = args.alt;
with (img.style) {
cursor = 'pointer';
margin = '0 3px';
padding = '0';
border = 'none';
verticalAlign = 'middle';
}
return img;
}
});
/* Hatena.Star.AddButton */
Hatena.Star.AddButton = new Ten.Class({
base: ['Hatena.Star.Button'],
initialize: function(entry) {
this.entry = entry;
this.lastPosition = null;
var img = Hatena.Star.Button.createButton({
src: Hatena.Star.AddButton.ImgSrc,
alt: 'Add Star'
});
this.observer = new Ten.Observer(img,'onclick',this,'addStar');
this.img = img;
return img;
},
ImgSrc: Hatena.Star.BaseURL + 'images/add.gif'
},{
addStar: function(e) {
this.lastPosition = e.mousePosition();
var uri = Hatena.Star.BaseURL + 'star.add.json?uri=' + encodeURIComponent(this.entry.uri) +
'&title=' + encodeURIComponent(this.entry.title);
if (Hatena.Star.Token) {
uri += '&token=' + Hatena.Star.Token;
}
new Ten.JSONP(uri, this, 'receiveResult');
},
receiveResult: function(args) {
var name = args ? args.name : null;
if (name) {
this.entry.addStar(new Hatena.Star.Star({name: name}));
//alert('Succeeded in Adding Star ' + args);
} else if (args.errors) {
var pos = this.lastPosition;
pos.x -= 10;
pos.y += 25;
var scroll = Ten.Geometry.getScroll();
var scr = new Hatena.Star.AlertScreen();
var alert = args.errors[0];
scr.showAlert(alert, pos);
}
}
});
/* Hatena.Star.CommentButton */
Hatena.Star.CommentButton = new Ten.Class({
base: ['Hatena.Star.Button'],
initialize: function(entry) {
this.entry = entry;
this.lastPosition = null;
var img = Hatena.Star.Button.createButton({
src: Hatena.Star.CommentButton.ImgSrc,
alt: 'Comments'
});
img.style.display = 'none';
this.observer = new Ten.Observer(img,'onclick',this,'showComments');
this.img = img;
},
ImgSrc: Hatena.Star.BaseURL + 'images/comment.gif',
ImgSrcActive: Hatena.Star.BaseURL + 'images/comment_active.gif'
},{
showComments: function(e) {
if (!this.screen) this.screen = new Hatena.Star.CommentScreen();
this.screen.bindEntry(this.entry);
var pos = e.mousePosition();
pos.y += 25;
this.screen.showComments(this.entry, pos);
},
hide: function() {
this.img.style.display = 'none';
},
show: function() {
this.img.style.display = 'inline';
},
activate: function() {
this.show();
this.img.src = Hatena.Star.CommentButton.ImgSrcActive;
}
});
/* Hatena.Star.Star */
Hatena.Star.Star = new Ten.Class({
initialize: function(args) {
if (args.img) {
this.img = args.img;
this.name = this.img.getAttribute('alt');
} else {
this.name = args.name;
var img = document.createElement('img');
img.src = Hatena.Star.Star.ImgSrc;
img.alt = this.name;
with (img.style) {
padding = '0';
border = 'none';
}
this.img = img;
}
new Ten.Observer(this.img,'onmouseover',this,'showName');
new Ten.Observer(this.img,'onmouseout',this,'hideName');
if (this.name) {
this.user = new Hatena.Star.User(this.name);
this.img.style.cursor = 'pointer';
new Ten.Observer(this.img,'onclick',this,'goToUserPage');
}
if (args.count && args.count > 1) {
var c = document.createElement('span');
c.setAttribute('class', 'hatena-star-inner-count');
Ten.Style.applyStyle(c, Hatena.Star.InnerCount.style);
c.innerHTML = args.count;
var s = document.createElement('span');
s.appendChild(img);
s.appendChild(c);
return s;
} else {
return this.img;
}
},
ImgSrc: Hatena.Star.BaseURL + 'images/star.gif'
},{
showName: function(e) {
if (!this.screen) this.screen = new Hatena.Star.NameScreen();
var pos = e.mousePosition();
pos.x += 10;
pos.y += 25;
this.screen.showName(this.name, pos);
},
hideName: function() {
if (!this.screen) return;
this.screen.hide();
},
goToUserPage: function() {
window.location = this.user.userPage();
}
});
/* Hatena.Star.InnerCount */
Hatena.Star.InnerCount = new Ten.Class({
initialize: function(count, e) {
this.count = count;
this.entry = e;
var c = document.createElement('span');
c.setAttribute('class', 'hatena-star-inner-count');
Ten.Style.applyStyle(c, Hatena.Star.InnerCount.style);
c.style.cursor = 'pointer';
c.innerHTML = count;
new Ten.Observer(c,'onclick',this,'showInnerStars');
this.container = c;
return c;
},
style: {
color: '#f4b128',
fontWeight: 'bold',
fontSize: '80%',
fontFamily: '"arial", sans-serif',
margin: '0 2px'
}
},{
showInnerStars: function() {
var url = Hatena.Star.BaseURL + 'entry.json?uri=' +
encodeURIComponent(this.entry.uri);
new Ten.JSONP(url, this, 'receiveStarEntry');
},
receiveStarEntry: function(res) {
var se = res.entries[0];
var e = this.entry;
if (encodeURIComponent(se.uri) != encodeURIComponent(e.uri)) return;
e.flushStars();
e.bindStarEntry(se);
e.addAddButton();
e.showStars();
}
});
/* Hatena.Star.Comment */
Hatena.Star.Comment = new Ten.Class({
initialize: function(args) {
this.name = args.name;
this.body = args.body;
}
},{
asElement: function() {
var div = document.createElement('div');
with (div.style) {
margin = '0px 0';
padding = '5px 0';
borderBottom = '1px solid #ddd';
}
var ico = Hatena.User.getProfileIcon(this.name);
div.appendChild(ico);
var span = document.createElement('span');
with(span.style) {
fontSize = '90%';
}
span.innerHTML = this.body;
div.appendChild(span);
return div;
}
});
/* Hatena.Star.NameScreen */
Hatena.Star.NameScreen = new Ten.Class({
base: [Ten.SubWindow],
style: {
padding: '2px',
textAlign: 'center'
},
containerStyle: {
margin: 0,
padding: 0
},
handleStyle: null,
showScreen: false,
closeButton: null,
draggable: false
},{
showName: function(name, pos) {
this.container.innerHTML = '';
this.container.appendChild(Hatena.User.getProfileIcon(name));
this.container.appendChild(document.createTextNode(name));
this.show(pos);
}
});
/* Hatena.Star.AlertScreen */
Hatena.Star.AlertScreen = new Ten.Class({
base: [Ten.SubWindow],
style: {
padding: '2px',
textAlign: 'center',
borderRadius: '6px',
MozBorderRadius: '6px',
width: '240px',
height: '120px'
},
handleStyle: {
position: 'absolute',
top: '0px',
left: '0px',
backgroundColor: '#f3f3f3',
borderBottom: '1px solid #bbb',
width: '100%',
height: '30px',
borderRadius: '6px 6px 0 0',
MozBorderRadius: '6px 6px 0 0'
}
},{
showAlert: function(msg, pos) {
this.container.innerHTML = msg;
var win = Ten.Geometry.getWindowSize();
var scr = Ten.Geometry.getScroll();
var w = parseInt(this.constructor.style.width) + 20;
if (pos.x + w > scr.x + win.w) pos.x = win.w + scr.x - w;
this.show(pos);
}
});
/* Hatena.Star.CommentScreen */
Hatena.Star.CommentScreen = new Ten.Class({
base: [Ten.SubWindow],
initialize: function() {
var self = this.constructor.SUPER.call(this);
if (!self.commentsContainer) self.addCommentsContainer();
return self;
},
style: {
width: '280px',
height: '280px',
overflowY: 'auto',
padding: '2px',
textAlign: 'center',
borderRadius: '6px',
MozBorderRadius: '6px'
},
handleStyle: {
position: 'absolute',
top: '0px',
left: '0px',
backgroundColor: '#f3f3f3',
borderBottom: '1px solid #bbb',
width: '100%',
height: '30px',
borderRadius: '6px 6px 0 0',
MozBorderRadius: '6px 6px 0 0'
},
containerStyle: {
margin: '32px 0 0 0',
textAlign: 'left',
padding: '0 10px'
},
getLoadImage: function() {
var img = document.createElement('img');
img.src = Hatena.Star.BaseURL + 'images/load.gif';
img.setAttribute('alt', 'Loading');
with (img.style) {
verticalAlign = 'middle';
margin = '0 2px';
}
return img;
}
},{
addCommentsContainer: function() {
var div = document.createElement('div');
with (div.style) {
marginTop = '-3px';
}
this.container.appendChild(div);
this.commentsContainer = div;
},
showComments: function(e, pos) {
var comments = e.comments;
if (!comments) comments = [];
this.commentsContainer.innerHTML = '';
for (var i=0; i<comments.length; i++) {
this.commentsContainer.appendChild(comments[i].asElement());
}
if (e.starEntry && !e.can_comment) {
this.hideCommentForm();
} else {
this.addCommentForm();
}
var win = Ten.Geometry.getWindowSize();
var scr = Ten.Geometry.getScroll();
var w = parseInt(this.constructor.style.width) + 20;
if (pos.x + w > scr.x + win.w) pos.x = win.w + scr.x - w;
this.show(pos);
},
bindEntry: function(e) {
this.entry = e;
},
sendComment: function(e) {
if (!e.isKey('enter')) return;
var body = this.commentInput.value;
if (!body) return;
this.commentInput.disabled = 'true';
this.showLoadImage();
var url = Hatena.Star.BaseURL + 'comment.add.json?body=' + encodeURIComponent(body) +
'&uri=' + encodeURIComponent(this.entry.uri) +
'&title=' + encodeURIComponent(this.entry.title);
new Ten.JSONP(url, this, 'receiveResult');
},
receiveResult: function(args) {
if (!args.name || !args.body) return;
this.commentInput.value = '';
this.commentInput.disabled = '';
this.hideLoadImage();
var com = new Hatena.Star.Comment(args);
this.entry.addComment(com);
this.commentsContainer.appendChild(com.asElement());
},
showLoadImage: function() {
if (!this.loadImage) return;
this.loadImage.style.display = 'inline';
},
hideLoadImage: function() {
if (!this.loadImage) return;
this.loadImage.style.display = 'none';
},
hideCommentForm: function() {
if (!this.commentForm) return;
this.commentForm.style.display = 'none';
},
addCommentForm: function() {
if (this.commentForm) {
this.commentForm.style.display = 'block';
return;
}
var form = document.createElement('div');
this.container.appendChild(form);
this.commentForm = form;
with (form.style) {
margin = '0px 0';
padding = '5px 0';
// borderTop = '1px solid #ddd';
}
//if (Hatena.Visitor) {
// form.appendChild(Hatena.Visitor.profileIcon());
//} else {
// form.appendChild(Hatena.User.getProfileIcon());
//}
var input = document.createElement('input');
input.type = 'text';
with (input.style) {
width = '215px';
border = '1px solid #bbb';
padding = '3px';
}
form.appendChild(input);
this.commentInput = input;
var img = this.constructor.getLoadImage();
this.loadImage = img;
this.hideLoadImage();
form.appendChild(img);
new Ten.Observer(input,'onkeypress',this,'sendComment');
}
});
/* Hatena.Star.EntryLoader */
Hatena.Star.EntryLoader = new Ten.Class({
initialize: function() {
var entries = Hatena.Star.EntryLoader.loadEntries();
this.entries = [];
for (var i = 0; i < entries.length; i++) {
var e = new Hatena.Star.Entry(entries[i]);
e.showButtons();
this.entries.push(e);
}
this.getStarEntries();
},
createStarContainer: function() {
var sc = document.createElement('span');
sc.setAttribute('class', 'hatena-star-star-container');
sc.style.marginLeft = '1px';
return sc;
},
createCommentContainer: function() {
var cc = document.createElement('span');
cc.setAttribute('class', 'hatena-star-comment-container');
cc.style.marginLeft = '1px';
return cc;
},
scrapeTitle: function(node) {
var rval = [];
(function (node) {
if (node.tagName == 'SPAN' &&
(node.className == 'sanchor' ||
node.className == 'timestamp')) {
return;
} else if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) {
return;
}
var cn = node.childNodes;
if (cn) {
for (var i = 0; i < cn.length; i++) {
arguments.callee.call(this, cn[i]);
}
}
var nodeValue = node.nodeValue;
if (typeof(nodeValue) == 'string') {
rval.push(nodeValue);
}
})(node);
return rval.join('');
},
headerTagAndClassName: ['h3',null],
getHeaders: function() {
var t = Hatena.Star.EntryLoader.headerTagAndClassName;
return Ten.DOM.getElementsByTagAndClassName(t[0],t[1],document);
},
loadEntries: function() {
var entries = [];
//var headers = document.getElementsByTagName('h3');
var c = Hatena.Star.EntryLoader;
var headers = c.getHeaders();
for (var i = 0; i < headers.length; i++) {
var header = headers[i];
var a = header.getElementsByTagName('a')[0];
if (!a) continue;
var uri = a.href;
var title = '';
// Ten.DOM.removeEmptyTextNodes(header);
var cns = header.childNodes;
title = c.scrapeTitle(header);
var cc = c.createCommentContainer();
header.appendChild(cc);
var sc = c.createStarContainer();
header.appendChild(sc);
entries.push({
uri: uri,
title: title,
star_container: sc,
comment_container: cc
});
}
return entries;
}
},{
getStarEntries: function() {
var url = Hatena.Star.BaseURL + 'entries.json?';
for (var i = 0; i < this.entries.length; i++) {
if (url.length > Ten.JSONP.MaxBytes) {
new Ten.JSONP(url, this, 'receiveStarEntries');
url = Hatena.Star.BaseURL + 'entries.json?';
}
url += 'uri=' + encodeURIComponent(this.entries[i].uri) + '&';
}
new Ten.JSONP(url, this, 'receiveStarEntries');
},
receiveStarEntries: function(res) {
var entries = res.entries;
if (!entries) entries = [];
for (var i = 0; i < this.entries.length; i++) {
var e = this.entries[i];
for (var j = 0; j < entries.length; j++) {
var se = entries[j];
if (!se.uri) continue;
if (encodeURIComponent(se.uri) == encodeURIComponent(e.uri)) {
e.bindStarEntry(se);
entries.splice(j,1);
break;
}
}
if (typeof(e.can_comment) == 'undefined') {
e.setCanComment(res.can_comment);
}
e.showStars();
e.showCommentButton();
}
}
});
/* Hatena.Star.WindowObserver */
Hatena.Star.WindowObserver = new Ten.Class({
initialize: funct
20070629230000改定
20070702125800バグ発見:スクリプト中にある「&&」が、「&&」になっている。増田の仕様らしい。
20070827224900改定
// ==UserScript== // @name anond pickup // @namespace http://anond.hatelabo.jp/20070608230645 // @description pickup trackback tree top section at Hatelabo::AnonymousDiary // @include http://anond.hatelabo.jp/* // ==/UserScript== (function() { var threshold_bm = 1; var threshold_tb = 1; var ignoreList = { "/20070801172335": 33, "/20070806163721": 10, }; var firstPager_l = document.evaluate("//div[@class='pager-l']",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue; function Hide(){} Hide.prototype.setup = function() { this.style = document.createElement("style"); this.style.id = "hide"; this.style.type = "text/css"; document.getElementsByTagName("head")[0].appendChild(this.style); var self = this; this.a = new Object(); this.a.visible = document.createElement("a"); this.a.visible.id = "visible"; this.a.visible.href = "#"; this.a.visible.innerHTML = "visible hide section"; // this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: block}';document.getElementById('visible').style.display = 'none';document.getElementById('unvisible').style.display = 'inline';"); this.a.visible.addEventListener("click", function(){self.visible()}, false); firstPager_l.parentNode.insertBefore(this.a.visible, firstPager_l); this.a.unvisible = document.createElement("a"); this.a.unvisible.id = "unvisible"; this.a.unvisible.href = "#"; this.a.unvisible.innerHTML = "unvisible hide section"; // this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: none}';document.getElementById('visible').style.display = 'inline';document.getElementById('unvisible').style.display = 'none';"); this.a.unvisible.addEventListener("click", function(){self.unvisible()}, false); firstPager_l.parentNode.insertBefore(this.a.unvisible, firstPager_l); if (GM_getValue("visible", 0)) { this.visible(); } else { this.unvisible(); } } Hide.prototype.visible = function() { this.style.innerHTML = "div.hide {display: block}"; this.a.visible.style.display = "none"; this.a.unvisible.style.display = "inline"; GM_setValue("visible", 1); } Hide.prototype.unvisible = function() { this.style.innerHTML = "div.hide {display: none}"; this.a.visible.style.display = "inline"; this.a.unvisible.style.display = "none"; GM_setValue("visible", 0); } Hide.prototype.append = function(section) { if (section.className.match(/hide/)) { return; } section.className += " hide"; } Hide.prototype.clear = function(section) { section.className = section.className.replace(/ hide/g, ""); } Hide.prototype.is = function(section) { return section.className.match(/hide/); } var hide = new Hide(); hide.setup(); var target = document.evaluate( "//div[@class='section' and child::*[not(@class='sectionfooter') and descendant::a[starts-with(@href,'http://anond.hatelabo.jp/2') or starts-with(@href,'/2') and not(child::span[@class='sanchor'])]]]", document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i=0; i<target.snapshotLength; i++) { hide.append(target.snapshotItem(i)); } var tbs = document.evaluate( "//p[@class='sectionfooter']/a[2]", document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i=0; i<tbs.snapshotLength; i++) { var tb = tbs.snapshotItem(i); if (tb.innerHTML == "\u30c8\u30e9\u30c3\u30af\u30d0\u30c3\u30af(0)") { // hide.append(tb.parentNode.parentNode); bookmark(tb, 0); } else if (! hide.is(tb.parentNode.parentNode)) { trackback(tb, 1); } else { bookmark(tb, 1); } } function trackback(tb, callback) { GM_xmlhttpRequest({ method: "GET", url: "http://anond.hatelabo.jp/" + tb.pathname.match(/\d{14}/), onload: function(result) { var link = result.responseText.match(/<a name="tb">(.|\s)*/)[0].match(/<li>\s*<a href="http:\/\/anond.hatelabo.jp\/\d{14}"/g); var n = link.length; for (var l in link) { var m = "/" + link[l].match(/\d{14}/); if (m in ignoreList) { n -= ignoreList[m]; } } if (n < threshold_tb) { tb.innerHTML = tb.innerHTML.replace(/\)$/, "/"+n+")"); if (callback) { bookmark(tb); } } else { tb.innerHTML = tb.innerHTML.replace(/\)$/, '/<span style="color: red;">'+n+"</span>)"); } } }); } function bookmark(tb, callback){ GM_xmlhttpRequest({ method: "GET", url: "http://b.hatena.ne.jp/entry/rss/http://anond.hatelabo.jp/" + tb.pathname.match(/\d{14}/), onload: function(result) { var r = result.responseText.match(/<rdf:li rdf:resource=/g); if (r && r.length >= threshold_bm){ hide.clear(tb.parentNode.parentNode); if (callback) { trackback(tb); } } else { hide.append(tb.parentNode.parentNode); } } }); } })();
今はスッキリしているのは古いやつ
/// ==UserScript== // @name anond pickup // @namespace http://anond.hatelabo.jp/20070608230645 // @description pickup trackback tree top section at Hatelabo::AnonymousDiary // @include http://anond.hatelabo.jp/*?page=* // ==/UserScript== (function() { var target = document.evaluate( "//div[@class='section' and child::*[not(@class='sectionfooter') and descendant::a[starts-with(@href,'http://anond.hatelabo.jp/2') or starts-with(@href,'/2') and not(child::span[@class='sanchor'])]]]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0; i<target.snapshotLength; i++) { target.snapshotItem(i).style.display = "none"; } var trackback = document.evaluate( "//p[@class='sectionfooter']/a[2]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0; i<trackback.snapshotLength; i++) { if (trackback.snapshotItem(i).innerHTML == "\u30c8\u30e9\u30c3\u30af\u30d0\u30c3\u30af(0)") { trackback.snapshotItem(i).parentNode.parentNode.style.display = "none"; } else if (trackback.snapshotItem(i).parentNode.parentNode.style.display != "none") { count(trackback.snapshotItem(i)); } } function count(tb) { GM_xmlhttpRequest({ method: "GET", url: "http://anond.hatelabo.jp/" + tb.getAttribute("href").match(/[0-9]{14}/), onload: function(result) { var n = result.responseText.replace(/\n/g,"").match(/<a name="tb">.*/)[0].match(/<li>/g).length; if (n < 10) { tb.innerHTML = tb.innerHTML.replace(/\)$/,"/"+n+")"); } else { tb.innerHTML = tb.innerHTML.replace(/\)$/,'/<span style="color: red;">'+n+"</span>)"); } } }); } })();
以下の二つに留意、つまり乱用禁止。
取説未満
// ==UserScript== // @name anond pickup of the day // @namespace http://anond.hatelabo.jp/ // @description pickup section of the day at Hatelabo::AnonymousDiary // @include http://anond.hatelabo.jp/2* // ==/UserScript== (function(){ var trackbackThreshold = 10; var ignoreList = { "/20070801172335": 33, "/20070806163721": 10, }; // only section of the day if (! location.pathname.match(/^\/\d{8}$/)) { return; } // regist ancher that kick main routine var a = document.createElement("a"); a.href = "#"; a.innerHTML = "pickup of the day"; a.addEventListener("click", grab, false); var firstPager_l = document.evaluate("//div[@class='pager-l']",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue; firstPager_l.appendChild(a); function Outline() { this.outline = document.createElement("ul"); this.text = document.createElement("textarea"); this.text.style.overflow = "auto"; this.text.style.width = "100%"; this.text.style.height = "15em"; this.text.innerHTML = "</ul><\n><ul>\n"; this.list = new Array(); } Outline.prototype.setup = function() { var parent = document.getElementById("body"); parent.insertBefore(this.outline, parent.firstChild); parent.insertBefore(this.text, parent.firstChild); } Outline.prototype.append = function(section) { var h3 = section.getElementsByTagName("h3")[0]; var sectionName = h3.firstChild.pathname.replace(/\//,""); var sectionText = h3.textContent.replace(/\s*$/,""); if (sectionText == "\u25a0") { sectionText = sectionName; } this.text.innerHTML += '<h2>[http://anond.hatelabo.jp/'+sectionName+ ":title="+sectionText.replace(/^\u25a0/,"").replace(/]/g,"&#93;")+"] "+ '<a href="http://b.hatena.ne.jp/entry/http://anond.hatelabo.jp/'+sectionName+'">'+ '<img src="http://b.hatena.ne.jp/entry/image/http://anond.hatelabo.jp/'+sectionName+'">'+ "</a></h2>\n"; h3.firstChild.name = sectionName; var li = document.createElement("li"); li.innerHTML = '<a href="#'+sectionName+'">' + sectionText.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">") + "</a>"; var nextSibling = 0; for (var i in this.list) { if (nextSibling < i && i < sectionName) { nextSibling = i; } } if (nextSibling) { this.outline.insertBefore(li, this.list[nextSibling]); } else { this.outline.appendChild(li); } this.list[sectionName] = li; } var outline = new Outline(); function CC(day) { this.li = document.createElement("li"); this.li.innerHTML = '<a href="/'+day+'" target="_blank">' + day + "</a>"; this.day = day; this.n = new Array(); } CC.prototype.pp = function(id) { this.n.push(id); if (this.n.length > 10) { this.li.innerHTML = '<a href="/'+this.day+'" target="_blank">' + this.day + "</a> " + this.n.length; } else { this.li.innerHTML += ' <a href="/'+id+'" target="_blank">*</a>'; } } function Count() { this.count = document.createElement("ul"); this.list = new Array(); } Count.prototype.setup = function() { var parent = document.getElementById("body"); parent.insertBefore(this.count, parent.firstChild); } Count.prototype.append = function(day, id) { var nextSibling = 0; for (var i in this.list) { if (nextSibling < i && i <= day) { nextSibling = i; } } if (nextSibling == day) { this.list[nextSibling].pp(id); } else { var cc = new CC(day); if (nextSibling) { this.count.insertBefore(cc.li, this.list[nextSibling].li); } else { this.count.appendChild(cc.li); } this.list[day] = cc; cc.pp(id); } } Count.prototype.appendSection = function(section) { var id = section.getElementsByTagName("h3")[0].firstChild.pathname.replace(/\//,""); var today = id.match(/\d{8}/)[0]; var anchors = section.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { if (anchors[i].href && anchors[i].host == "anond.hatelabo.jp" && anchors[i].pathname.match(/\/(\d{8})\d{6}/) && RegExp.$1 != today) { this.append(RegExp.$1, id); } } } var count = new Count(); function Hide(){} Hide.prototype.setup = function() { this.style = document.createElement("style"); this.style.id = "hide"; this.style.type = "text/css"; document.getElementsByTagName("head")[0].appendChild(this.style); var self = this; this.a = new Object(); this.a.visible = document.createElement("a"); this.a.visible.id = "visible"; this.a.visible.href = "#"; this.a.visible.innerHTML = "visible hide section"; // this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: block}';document.getElementById('visible').style.display = 'none';document.getElementById('unvisible').style.display = 'inline';"); this.a.visible.addEventListener("click", function(){self.visible()}, false); firstPager_l.parentNode.insertBefore(this.a.visible, firstPager_l); this.a.unvisible = document.createElement("a"); this.a.unvisible.id = "unvisible"; this.a.unvisible.href = "#"; this.a.unvisible.innerHTML = "unvisible hide section"; // this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: none}';document.getElementById('visible').style.display = 'inline';document.getElementById('unvisible').style.display = 'none';"); this.a.unvisible.addEventListener("click", function(){self.unvisible()}, false); firstPager_l.parentNode.insertBefore(this.a.unvisible, firstPager_l); this.unvisible(); } Hide.prototype.visible = function() { this.style.innerHTML = "div.hide {display: block}"; this.a.visible.style.display = "none"; this.a.unvisible.style.display = "inline"; } Hide.prototype.unvisible = function() { this.style.innerHTML = "div.hide {display: none}"; this.a.visible.style.display = "inline"; this.a.unvisible.style.display = "none"; } Hide.prototype.append = function(section) { if (section.className.match(/hide/)) { return; } section.className += " hide"; count.appendSection(section); } Hide.prototype.is = function(section) { return section.className.match(/hide/); } var hide = new Hide(); // main routine function grab(){ if (! document.body.innerHTML.match(/<div class="pager-r">(\d+)/)) { return; } var pages = RegExp.$1 -0; if (pages <= 0 || pages > 40) { // check error and limit 1000 entry return; } //pages = 2; firstPager_l.style.display = "none"; outline.setup(); hide.setup(); count.setup(); var mainbody = document.evaluate("//div[@class='body']", document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue; mainbody.innerHTML = "\n"; for (var i=1; i<=pages; i++) { cat(mainbody, i); } } // page load and concatenate function cat(container, page) { container.innerHTML += "<!-- page " + page + " -->\n"; GM_xmlhttpRequest({ method: "GET", url: "http://anond.hatelabo.jp" + location.pathname + "?page=" + page, onload: function(result) { result.responseText.match(/<div class="body">((.|\s)*?)\s*<\/div>\s*<\/div>\s*<div class="pager-l">/); container.innerHTML = container.innerHTML.replace("<!-- page " + page + " -->", RegExp.$1); if (! container.innerHTML.match(/<!-- page \d+ -->/)) { // document.documentElement.innerHTML = document.documentElement.innerHTML.replace(/(src|href)=\"\//mg, "$1=\"http://anond.hatelabo.jp/"); pickup(); } } }); } // pickup section at last cat() concatenate after function pickup() { var target = document.evaluate( "//div[@class='section' and child::*[not(@class='sectionfooter') and descendant::a[starts-with(@href,'http://anond.hatelabo.jp/2') or starts-with(@href,'/2') and not(child::span[@class='sanchor'])]]]", document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i=0; i<target.snapshotLength; i++) { hide.append(target.snapshotItem(i)); } var tbs = document.evaluate( "//p[@class='sectionfooter']/a[2]", document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i=0; i<tbs.snapshotLength; i++) { var tb = tbs.snapshotItem(i); if (tb.innerHTML == "\u30c8\u30e9\u30c3\u30af\u30d0\u30c3\u30af(0)") { hide.append(tb.parentNode.parentNode); } else if (! hide.is(tb.parentNode.parentNode)) { trackback(tb); } } } // count trackbacks function trackback(tb) { GM_xmlhttpRequest({ method: "GET", url: "http://anond.hatelabo.jp/" + tb.pathname.match(/\d{14}/), onload: function(result) { var link = result.responseText.match(/<a name="tb">(.|\s)*/)[0].match(/<li>\s*<a href="http:\/\/anond.hatelabo.jp\/\d{14}"/g); var n = link.length; for (var l in link) { var m = "/" + link[l].match(/\d{14}/); if (m in ignoreList) { n -= ignoreList[m]; } } if (n < trackbackThreshold) { hide.append(tb.parentNode.parentNode); } else { tb.innerHTML = tb.innerHTML.replace(/\)$/, "/"+n+")"); outline.append(tb.parentNode.parentNode); } } }); } })();