はてなキーワード: borderとは
http://childs.squares.net/murahatebu/village_peopleより。
## 村長(むらおさ)
Asay
Blue-Period
Hamachiya2
HolyGrail
Masao_hate
NATROM
SeiSaguru
TakahashiMasaki
TsumuRi
activecute
angmar
## 要注意(要注意)
anigoka
aozora21
brainparasite
ch1248
complex_cat
ekken
feather_angel
feita
fromdusktildawn
fut573
gnt
guldeen
hatayasan
inumash
jt_noSke
kanimaster
katoyuu
kobeni_08
kyo_ju
laddertothemoon
lakehill
lastline
letterdust
mame-tanuki
mereco
mgkiller
mizukik
mkusunok
n-styles
nekora
nitino
ones-inch
ooo0_temaki_0ooo
p_shirokuma
rAdio
raf00
rgfx
rikuo
ruku
shibata616
surumeno13
torin
torly
toya
triggerhappysundaymorning
tsugo-tsugo
tt_clown
ululun
umeten
watapoco
wetfootdog
white_rose
wideangle
yamifuu
ymScott
ymrl
yuiseki
zaikabou
zu2
houyhnhm
fellows
mongrelP
Midas
setofuumi
anzenchan
fk_2000
repon
mind
citron_908
laiso
nkoz
blackdragon
tari-G
pollyanna
hiro_y
junkMA
kashmir108
matakimika
Lhankor_Mhy
yugui
mosshm
yukitanuki
atawi
nisemono_san
WinterMute
f-shin
CrowClaw
enemyoffreedom
cloverleaf24
kananaka
mobanama
lisagasu
suVene
sionsuzukaze
lovecall
kotorikotoriko
kowyoshi
dododod
hebomegane_sun
Louis
bigburn
Delete_All
Lobotomy
wanderingdj
tuya
Mu_KuP
yokomichisizuka
tailtame
r_kurain
hyaknihyak
rakusupu
highcampus
steel_eel
hexol
zakinco
sorano_k
raitu
fladdict
Mamipeko
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
yteppei
nakamurabashi
koizuka
HiromitsuTakagi
ockeghem
elm200
kawango
pc_nagomu
k_wizard
parallel-world
retlet
Naruhodius
buhikun
machida77
flagburner
nadegata
mashori
keiseiryoku
keishut725
ak9
kaeru-no-tsura
TakamoriTarou
kagioo2uma
A410
YAK
K-Ono
## う~ん
maname
hkn
kiku-chan
T-3don
mattn
tyage
mae-9
tetzl
yudai214
doramao
beautymaquia
kubohashi
nasunori
kalmalogy
dal
wacking
shibuyan730
rikzen
yuhka-uno
yu-kubo
toshi20
westerndog
kusigahama
akiyan
nagaichi
kaitoster
## あとで入れる二軍(笑い)の人たち
## temtan
## jingi469
## logi
## Nihonjin
## Mash
## s-tomo
## Islecape
## sabro
## kash06
## nagayan111
## Okaz
## ezk
## border-dweller
## junta1999
## era1978
## meme-o
## yuyol
## garamani1983
## iru35711
## ketudan
## Griffin
## emiladamas
## harumomo2006
## w03wwww
## crosscrow
## mesotaro
## sucrose
## kakei
## yoshi1207
## microgravity
## airj12
## tomnyanko
## hatanaoki
## ysync
## superpuma
## MINi
## aoiro_moon
## catha
## otchy210
## spade9970
## touhousintyaku
## tuisumi
## migiri
## pQrs
## kokoronoyami
## dagama
## phallusia
## rindenlab
## nyoron0128
## T_Tachibana
## mitukiii
## takobue
## moerrari
## gan2
## sakura-sakasuyo
## niryo0113
## komatzy
## 入れない(入れたくない)
## Francesco3
## xevra
## hiroyukiegami
## Chikirin
## yaneurao
web製作に関しては素人なので用語などわからぬことも多いのですがご容赦くださいませ。
最近スマートフォンを買いまして、android 2.3.3ちゃん可愛いなあペロペロという生活をしています。
<!DOCTYPE html> <html lang="ja" xmlns:fb="http://www.facebook.com/2008/fbml"> <head><title>サイトタイトル</title></head> <body> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({appId : 'xxxxxx', status : true, cookie : true, xfbml : true }); </script> <div style="border:1px red solid;"> <fb:comments href="example.com" num_posts="2" width="500"></fb:comments> </div> </body></html>
こんな感じのコードをスマホのブラウザから表示すると、赤い枠がどんどん拡張していくのですが何故でしょう?
https://developers.facebook.com/docs/plugins/
ここにあるプラグインのうちいくつかはandroidブラウザでも正常に動き、
いくつかは縦にどんどん伸びていくし、いくつかは横にどんどん伸びていくみたいです。
このあたりの動作の影響なのか、スマホで閲覧ができないサイトが、一部ではクラッシュまでしてしまうサイトもあるようです。
あるサイトXでは横幅・縦幅がどんどん大きくなっていくので、
文章の入ったコンテナ部分がどこか遠くに行ってしまい読みようがないのです。
あるサイトYでは、FBその他のプラグインを大量に張っており、相性の問題もあるのか
私が検証した範囲では、
Opera mini:問題なし
でした。
これって私だけ?
どうもこんにちは。重度知的障害者の兄貴です(7/27「まとめ」に一部追記。「自分の苦労を他人に押しつけるな」という「書いていないことを読み取る」コメントにくたびれたので。別に自分が理不尽なほどの苦労をしたとは思ってない)。この記事とブクマみて血圧上がってます。
出生前診断で異常発見し中絶、10年間に倍増 : 科学 : YOMIURI ONLINE(読売新聞)
http://www.yomiuri.co.jp/science/news/20110722-OYT1T00585.htm
http://b.hatena.ne.jp/entry/www.yomiuri.co.jp/science/news/20110722-OYT1T00585.htm
まずこれ読もうね。
T4作戦(テーフィアさくせん、独: Aktion T4、英: T4 Euthanasia Program)は、ナチス・ドイツにおいて優生学思想に基づき1939年10月から1941年8月にかけて行われた安楽死政策を指す。名称は本部の所在地、ベルリンのティーアガルテン通4番地 (Tiergartenstraße 4) に基づき第2次世界大戦後に付けられた名称である。一次資料には E-Aktion(エーアクツィオーン、E作戦), もしくは Eu-Aktion の名称が残されている。この政策により、20万人以上が犠牲になったと見積もられている(ニュルンベルク裁判の検察側による見積もり)。(略)
この政策の目的は、ドイツ国民の「遺伝的な純粋性」を守るためのものであり、また身体障害者や精神障害者を組織的に根絶するというものであった。障害のある子供たちは、普通の病院と違う特別な病院に入れられた。障害を持つ成人に関しては、すでに 「Gesetz zur Verhütung erbkranken Nachwuchses」の結果として強制的不妊手術の対象となっていたが、この政策の対象にも含まれた。
読んだら次にいってみよう。君らが1930年代のドイツにいたとして、自分が「ナチスに投票した4割」と「投票しなかった6割」のどちらだったか、よく自問自答しながら下を読んでくれ。
まず、こういうことが罷り通るってこと自体、日本が法治国家としてダメダメってことなんだけどね。これを読もう。
第十四条 都道府県の区域を単位として設立された公益社団法人たる医師会の指定する医師(以下「指定医師」という。)は、次の各号の一に該当する者に対して、本人及び配偶者の同意を得て、人工妊娠中絶を行うことができる。
一 妊娠の継続又は分娩が身体的又は経済的理由により母体の健康を著しく害するおそれのあるもの
二 暴行若しくは脅迫によつて又は抵抗若しくは拒絶することができない間に姦淫されて妊娠したもの
2 前項の同意は、配偶者が知れないとき若しくはその意思を表示することができないとき又は妊娠後に配偶者がなくなつたときには本人の同意だけで足りる。
子供に障害があるからって中絶できるなんて書いてないよね?母体に危険がある場合か、貧乏で育てられないか、レイプ被害の場合のみだよ。日本は中絶は無原則に自由とか思ってるの、それ完全に間違い。つまりDQNカップルとかが避妊もしないでできちゃった子供を中絶するのって違法ですからね。堕胎罪ですから。一年以下の懲役ですから。覚えとけよ。
中絶する親は被害者なんかじゃない。法律的には間違いなく加害者。
そして倫理的にもそうだよ。胎児とはいえ命は命。まさにレイプとか母体の危険とか経済的理由とか、そういう「緊急避難」的なものでなければ圧殺していいはずがない。違うか?良心の呵責ぐらい持てよというのはおかしなことか?こういう連中を「被害者」呼ばわりできるとか、どんだけ世の中なめてるの?
皆さん好き勝手に、「障害者を育てるなんて無理」とか色々言ってくれるけど、言われた方がどう思うかわかってるの?中絶する両親には同情しても、中絶される障害胎児には同情しないんだね。ふーん。
もっと馬鹿げてるのが、先天的に障害がなければ障害とは無縁だとか思ってること。あのね、人間はいつでも障害者になります。事故とか病気とかね。統合失調症とか一番わかりやすいと思うけど。そうなったら「育てるの無理」とか「生きていけない」とか下らん御託言ってられなくなるよ。とにかく育てなきゃいけない、生きなきゃいけない。そこに現実があるからにはね。やってもみもせずに「できない」とか、何を甘っちょろいこと言ってるのかね?
うちの例でいうと、弟は生後僅かな間は「健常児」だったよ。ところが詳細は省くが医療ミスで脳出血起こして、それでその後遺症で知的能力のほか色々障害を負った。そんじょそこらの先天性の軽度障害者なんかよりよっぽど重いのをね。そういうことが起こりうるってわかってるのかな?出生前診断と中絶で問題を「なかったこと」にできるとか思ってる君ら、本当におめでたいよね。それとも我が家みたいなのは弟を間引けるようにすればよいとでも思ってるのかな?すごいね、まさにT4作戦だよ。ハイル・ヒットラー!君も将来歳を取って認知症になったときはアウシュヴィッツで「人道的」な「安楽死」を迎えることができると思うよ。
ちなみに、メガネ・コンタクト族の皆さん、君らの多くは近代以前だったら生存能力のない「視覚障害者」だからね。そこ覚えておくように。社会制度や技術で少なからず「障害」は「障害」でなくすることができるんだよ。育てられないとか生きていけないとか、そういうことやって見てから言ってるのかね?
で、ブクマに書いてあるので多いのは「障害者は生きていても不幸だ」みたいな話。すごいね。まさに「生きるに値しない命」だよね。ハイル・ヒットラー!
ヘレン・ケラーから乙武洋匡にいたるまで、いろんな人がそんなの迷信だ、とどれだけ説いてもわからない人はわからないんだね。確かに障害者は生きて行くに「不利」があるよ。でもそれは絶望的なものってわけじゃない。
それこそ上に書いたみたいな目の話をするならさ、メガネ族・コンタクト族は既にパイロットや宇宙飛行士になる夢は絶たれている。矯正可能な近視・遠視・乱視だって立派な「身体障害」であることの証明だね。しかし、あなたそれで人生に絶望する?しないよね。程度の差はあれ障害者の人生って同じことだよ。そしてその「不利」の程度を弱めていくのは「健常者」のつとめだよ。あなた自身やあなたの親兄弟や子供がいつ障害者になるかわかったもんじゃないんだから、それは「保険」と同じようなものだ。それを問題視するならT4作戦発動するしかないね。ハイル・ヒットラー!
あと、ブクマに目立ったのが「この日本の国で障害者を育てる事なんてできましぇ~ん」みたいなの。ふざけるな。
みんな育ててるんだよ。多かれ少なかれ苦労してな。別に同情なんていらん。だがな、その「苦労」の中身にはお前らみたいな連中の無理解と偏見が少なからぬ比率で混じってることぐらい覚えておけよ。
でな、「日本の国」の制度が悪いのは(7/27追記:本当にそこまで悪いとは思わないが、まあ完璧ではないので一応「悪い」として)誰のせいか知ってるか?お前らのせいなんだよ。曲がりなりにもこの国は民主主義国家だ。主権者は国民だ。この国の制度は国民が作るんだよ。それをやってこなかったツケが回ってきてるんだよ。
ただし勿論、当事者でなければわからないことは色々ある。例えば世の中のエスカレーターは大抵は「上り」ばっかりだが、足の悪い人にとっては「下り」こそが重要だというのは自分がケガしたり身内に足腰弱った老人がいないことにはわからんだろう。逆に言えば、当事者が声を上げるというのは民主主義国家における国民の権利であり、義務でさえある。そういうことを石頭のお役人やら政治家やらに硬軟とりまぜて教え込んでいくことで、障害者が生きやすい環境というのは少しずつ整備されていくんだよ。
何?この国は民主主義でもなんでもないって?そうだね、すべてはアカとユダヤの陰謀なんだ。ハイル・ヒットラー!
長々書いたが、俺の言いたいことは要するにこういうことだ。
この辺のことをよく考えた上で、諸君がナチス的な思想をさっさと卒業してくれることを祈るばかりだ。
はてなの連中は普段リベラルぶってるくせに障害者問題になると本当に差別的でカスだと思ってきたが、本当になんとカスの多い事よ。
なんでそこまで先天性の障害が特別だと思ってるんだ?お前の子供が病気や事故に遭わないとなんでわかる?「健常者」であっても犯罪者や引きこもりやニートにならないとなんでわかる?その覚悟なしに子供を生み育てようとか思ってるわけ?それ、ほとんど確率の問題だぞ。
大抵の障害児はそんなケースに比べりゃずっと楽だぞ。障害児なんて育てられないというんだったら、病気や事故に遭った子供、あるいはDQNやニートが親の子供も育てられないから育児放棄して殺してもいいって話になる。お前らが言ってるのは要するにそういうことだ。なんでその程度の想像力もないの?
要するにお前らの「育てられない」なんてのは「ボクちゃん、こわいの、できないの~」って子供がダダをこねてるのと同レベルなんだよ。子供に先天的な障害がなくたって四苦八苦。親になるってことはそれだけ大変なことなんだよ。その覚悟を持て。
以下、目立ったブコメに返信(7/27追記 以下、ブクマの傾向を見て適宜加筆・修正・削除する)。
md2tak 障害というか知障ね。理性なき者は社会合意できないから社会の倫理に委ねられる。「俺ができるんだからお前もできる」はマッチョな意見。少なくとも社会保障の議論を。コストの話になると経済的理由が適用できちゃう 2011/07/25
「知障」とか差別用語使いやがってカスが。だいたい読売の元記事は知的障害に限った話じゃないだろう。
ああ?何がマッチョだぁ?ふざけるな。うちの場合みたいに後天的に障害を負うことだってあるんだよ。そんなとき「ボクちゃん、こわいの、できないの~」って言ったらどうなるんだ。育児放棄、児童虐待、殺人だ。違うか!違うなら言ってみろコラ。社会保障なんて曲がりなりにも日本にはあるわいボケ。調べもせんとなにを贅沢ぬかしとんじゃカス。障害者の親が全員金持ちだとでも思ってるのか。障害児を養うと明日の飯に困るような貧窮なんてないわ。
sankaseki だからと言って、本人に「障害を持ち人生を歩む」と 親に「障害を持つ子供の親」という重責の強制はできないと思うがな。ややもすると「自分がやっているから他人もやれ」という押し付けに見える
じゃあ、うちみたいな後天的障害の場合はどうするの?「押しつけ」だとか能書き垂れて育児放棄とかできるわけ?だいたい「親」であること自体が超絶的な重責なんだよ。障害があるかないかなんてそれに比べたら微々たる差でしかないだろうが。つーかうちの親をはじめ障害者の親なんて別に「重責」に耐えた偉人なんかじゃないぞ。その辺のオッサンオバサンだよ。その辺のオッサンオバサンができることをやれというのが過重な重責なんかだとは思えない。
自分の子供を殺してまで守る家庭なんて守る価値なんかないわ。しかも「良心的」とかどこまでカスなんだお前は。それは「ポア」の思想だよ。
p__o__n 私は障害者になりたくないし、子供が障害者として生まれて欲しくないし、可能な限り障害が治れば良いと思う。これを優性思想だと言われればそれはしょうがないです。 2011/07/25
いや、それはそういうもんでしょう。社会を生きて行くに不利があるからこそ「障害」なわけで。矯正可能な近視がもはや障害とは呼べないのと同様に、「障害」は克服できるもんだし、そうすべきなんだという話ですよ。
虐殺の考え方も人類の中で脈々と受け継がれてきたものだね。これはもっと受け継ぐべきだね。ハイル・ヒットラー!
egpehcbd 西原の夫が「もし障害児だったら?沢山産めばいい、そうすれば弟妹が助けてくれる」と語ったというハナシがあったと思うが、あれはたいしたものだなと思った。
いえ、それは結構微妙です。障害児の兄弟にもそれぞれの人生があるわけで、親から「助けてくれる」ことを期待されると非常に辛いです。元々子供なんて親に全面的に「助けてもらう」存在なわけで、自分のことで精一杯なわけですから。
私の場合は余りそういうことはなかったですが、それでも無意識のうちに「親に負担を掛けないように」と過剰に空気を読む癖がついたりで色々苦労がなかったわけでもありません。これに親の過剰期待が加わっていたらと思うとぞっとします。
とにかく、特定の子供に他の子供を奉仕させるというような考え方はよくないです。これは障害の有無に限ったことではありませんが。
tikani_nemuru_M 個人レベルの優生思想と共同体レベルの優生思想は異なる。また、経済的理由による中絶が認められていることで、現実には「どんな理由で中絶してもいいよ」といっているのと同じ。 2011/07/25
そんなわけがない。例えばビル・ゲイツが「経済的理由」を持ち出せば当然しばき倒されるべきだろう。また、個人レベルであろうとそれが共同体内で容認されるなら同じこと。胎児どうこうでその意味がわからないのなら「寝たきり老人を介護なんてとても無理だから姥捨て山に放り込んでもよい」という法律ができたとしたらどうなるか考えてみればよい。それをナチス的と呼ばないとすればそいつの頭の構造こそがナチス的だろう。
産む前からそんなに信頼できないことがわかっている男の子供なんて最初から産もうと思うなというだけの話だし、母親だけに責任を押しつけているわけでもないし。
tswi (略)生命倫理について何ら学問していた形跡が見えず、反射的に自分が正しいと思うことを書きなぐっているだけという印象。 2011/07/26
そんな「学問」様を語ってるつもりはないんでね。こちらは当事者としての率直な実感を述べている。それを蹂躙する「学問」様ならば、実験事実を無視する「科学」と同様無価値だろうよ。
mujin これは完全に同意。イヌのときは「病気になって育てられないならイヌを飼う資格はない」って言われて、なんで人間のときは「育てきれないなら仕方ない」「生まないほうが子どものため」になるのか。森岡正博を読め。 2011/07/2
愕然としました。確かに、犬や猫の話なら普通にわかってもらえますね。要するにみんなそこまで子供が嫌いなんですね…。
annoncita うちは中間所得層のちょっと下だと思うけど、日本では結構やっていけるものですよ?重度障害児がいても。(略)
全くその通りですね。日本で「障害児を抱えてやっていけない」なんてのは大嘘。
junmk2 この問題については障害者側の人よりも、本当の本当のそもそも論を考える側の人の方が、社会的に不利で意見を表明できない。(略)
じゃあその「そもそも論」というやつを述べてみろよ。この件で「障害者を差別するな」以上に「そもそも」なことがあるものか。あるわけがない。
つまり、生きるためにコストを払うのではなく、コストを払えなければ死ねということですね。ハイル・ヒットラー!
自分が親として「普通の人」以下だと思うなら子供を持たなきゃいいんです。でなきゃ「普通の人」並に慣れるように努力しなさい。障害云々と関係なく当たり前でしょそんなの。
yoko-hirom 増田は自分の記事をご両親に読んでもらって意見を聞いてみては?/増田は幸せそうに見えないし,出産前に挫ける人がいても仕方ない/健康面の問題で心中や自殺を選ぶ人もいる。増田はそれらの人を非難するか? 2011/07/26
それ以前に出生前診断の話なんてガキの頃から家庭内で頻出の話で、「論外」という共通認識。そんな話ができないような家庭環境どころか、親の方が俺を教育しようと熱心だったよ。それから俺は十分すぎるほど幸せだ。まあ、こんな断片的な文章から俺の人生の幸不幸を推し量れると思い上がったあんたが俺の増田記事(障害ネタはこの一件だけ)にことごとくアホなコメントしてくれるのは全然想定外でも何でもないが。そして自殺は自分が死ぬだけだが他人を巻き込む心中は非難されて当然。
Crone 増田の怒りも分かる。でもただでさえ不安定な中、自分のせいかもと苦悩する妊婦さんへの共感なしには届かない。(略)
「自分のせい」とかいまどき思う人がいるとしたら勉強が足りないの一言でしょう。
閲覧注意!!!
http://d.hatena.ne.jp/dsplwsosss/
http://d.hatena.ne.jp/aivofkdgklt/
http://d.hatena.ne.jp/cymwxlfswtr/
上記のようなスパムダイアリーが何者かにより乱造されているようです。
特徴は以下の通り。
<script src="http://gmodules.com/ig/ifr?url=http://gimite.net/rails/iframe_gadget/xml%3Fscrolling%3Dfalse%26url%3Dhttp://okorino.okicocomoskxde.obijime.net/&amp;synd=open&amp;w=400&amp;h=600&amp;title=&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
以下のようなソースを埋め込み。機械的に生成した文章、それも意味を成していない文章である。
<p>篠崎元志だけではない。</p> <p>キリスト看板ということなので、</p> <p>宇宙幻想がいなくても生きるのは、</p> <p>タイガース検定する前に</p> <p>ぎょうざの満洲ということなので、</p> <p>カール・ツァイスですが、</p> <p>板尾創路になりました。</p> <p>ビアスに生きて</p> <p>おでかけ!でもそうだった。</p> <p>デュメリルオオトカゲからは馬鹿にされ、</p> <p>二戸駅なら良かったが、</p> <p>そごう大阪店ということなのだ。</p> <p>マーク・キーファーおよび</p> <p>日本アームしなければならない。</p> <p>久下橋がいなくても生きるのは、</p> <p>祝日_(曖昧さ回避)ということだ。</p> <p>かごされるばかり。</p> <p>国道389号じゃん。</p> <p>フランソワ_(アンジュー公)を</p> <p>Bit/平方ミリメートルの</p> <p>福島交通相馬営業所でした。</p> <p>阿部保をお届けします。</p> <p>天使のすみかなら良かったが、</p> <p>オテロ郡_(コロラド州)でした。</p>
http://d.hatena.ne.jp/aivofkdgklt/
http://x8.ebo-shi.com/bin/gg?135862701
アクセスなど解析して何をしたいのだろうか。
http://anond.hatelabo.jp/20081020054933
1つめ!!
1つは、タグをエスケープしわすれている箇所がある点
↑これは勉強になる!実際にやってみます!
変更前
//変更前 echo $server_id."/".$id."_".$secret."_s.jpg' border=0 title=$title alt=$title />"; echo $server_id."/".$id."_".$secret."_s.jpg' border=0 title=nl2br(htmlspecialchars($title, ENT_QUOTES)) alt=nl2br(htmlspecialchars($title, ENT_QUOTES)) />"; //変更後
2つめ!!
もう1つが、htmlの属性値(alt=ナントカとか)をクオートでくくってない点
↑これは勉強になる!実際にやってみます!
変更前
//変更前 echo $server_id."/".$id."_".$secret."_s.jpg' border=0 title=$title alt=$title />"; $title = nl2br(htmlspecialchars($title, ENT_QUOTES)); echo $server_id."/".$id."_".$secret."_s.jpg' border=0 title='\"$title\"' alt='\"$title\"' />"; //変更後
このソースがの中で書かれてるのでちゃんち「"」の前の「\」をつけて「\"」って言うのが忘れかけてて危なかったです!(えへ)
完璧やないかーい!
http://flickr2.in/fli.html?data=%3Cscript%3Ejavascript%3Aalert(%27xss%27)%3B%3C%2Fscript%3E
ちゃんとソースも
<a href='http://farm4.static.flickr.com/3022/2930297659_dc20386697.jpg' rel=lightbox><img src='http://farm4.static.flickr.com/3022/2930297659_dc20386697_s.jpg' border=0 title='"XSS session 1"' alt='"XSS session 1"' /></a>
とうまく表示されてます!
本当に有難う御座います!!
簡単に言うと
↓
nl2br(htmlspecialchars($hensuu, ENT_QUOTES)) と出力のところで囲んであげて
↓
"nl2br(htmlspecialchars($hensuu, ENT_QUOTES))" 更に"とかで囲んであげる
簡単に言うと、この数十個の文字で変数で囲んということだったのですか??
この数文字の魔法を教えてもらってたらすぐ実践してたんですか・・・。
でも、もしかしたら実はもっとXSSの脆弱性って色々深い事があるんですかね!?
それだけエガミくんの生み出すものが注目されているってことだよ。目立つとどうしても悪い人も寄ってきちゃうから困るよね。
なるほど!!!こういってもらえると、凄く嬉しいです!!!
はいこんにちは! Hamachiya2だよ。
alertでなくなったね。こんな短時間ですごい。
エガミくん飲み込みはやい感じだね…。
ええと、あとは、下の方の画像で、どうもマーキータグ(marquee)が埋め込まれてるみたいってことだよね。
うん。もう一回、htmlソースを表示ってして確認してみたよ。
こんなのが埋め込まれてた。
<img src='http://farm4.static.flickr.com/3120/2784053843_b7a7d07c9a_s.jpg' border=0 title=<marquee>test XSS</marquee> alt=<marquee>test XSS</marquee> />
これは問題点が二つあってね、
1つは、タグをエスケープしわすれている箇所がある点
もう1つが、htmlの属性値(alt=ナントカとか)をクオートでくくってない点
この二つを直していこうか!
phpのプログラムの中のどこかで、<img>タグを出そうとしている部分があるはずだよ。
まずはそれを探そう。
そしたらきっと、その部分は、imgにphpの変数を色々埋め込んで出そうとしているはず。
たとえばこんな風に。
echo "<img src='xxxxxx" . $hensuu1 "' title=" . $hensuu2 . " />";
これの$hennsuuも全てhtmlspecialchars()してあげる感じかな。
echo "<img src='xxxxxx" . htmlspecialchars($hensuu1, ENT_QUOTES) "' title=" . htmlspecialchars($hensuu2, ENT_QUOTES) . " />";
こうだね。
そうすればmarqueeタグが埋め込まれていても、
<img src="xxxxxxxx" title=<marquee>test xss</marquee> />
こんな風にmarqueeとかがタグじゃなくなるので防げる。
でも完全じゃないんだこれ。
さっきも言った、属性値のクオートが足りてないから、ちょっと工夫すればxssやられちゃう。
詳細は長くなるので今は省くけど。
だから上の対処に加えて、titleとかaltとかの中身が、htmlでみた時に、ダブルクオートかシングルクオートで
くくられているようにしてやれば、いい感じになるよ!
<img src="xxxxx" title=ぺろぺろ alt=ぺろぺろ />
こうじゃなくて
<img src="xxxxx" title="ぺろぺろ" alt="ぺろぺろ" />
こうなるようにしよう。
(追記)
ちなみに、何で悪い大人の人はXSSの脆弱性を突いてきて悪い事をするんですかー??
それだけエガミくんの生み出すものが注目されているってことだよ。
目立つとどうしても悪い人も寄ってきちゃうから困るよね。
http://anond.hatelabo.jp/20081020051835
ブラウザから「htmlのソースを表示」ってしてみてくれるかな。
とアドバイスを貰って
http://flickr2.in/fli.html?data=%3Cscript%3Ejavascript%3Aalert(%27xss%27)%3B%3C%2Fscript%3E
のソースを見てみたよ!
<title> htmlspecialchars(<script>javascript:alert('xss');</script>, ENT_QUOTES)の画像一覧 - flickr2.in </title>
あ・・・!さっきのhtmlspecialcharsがうまくいってなかったんだ・・・!
なるほど、じゃぁ今後は絶対
エラーが出ている → エラーの出ているページのソースで何処が問題が確認
と言う事を心がけます!
勉強になるなぁ・・・。
<title> <?php $query = $_GET["data"]; echo nl2br(htmlspecialchars($query, ENT_QUOTES)); echo "の画像一覧"; ?> - flickr2.in </title>
↑のように何箇所が出力箇所があって、全部しらみつぶしに直してみたよ!
一箇所だけ直してて、他は・・・となってたんだけど先生に教えてもらった方法を使ったら
凄く簡単に問題点が分かって凄く早く問題解決できた!
http://flickr2.in/fli.html?data=%3Cscript%3Ejavascript%3Aalert(%27xss%27)%3B%3C%2Fscript%3E
わーいわーい!!!!
<img src='http://farm4.static.flickr.com/3135/2896115083_333bcb8862_s.jpg' border=0 title=test pilot of a show alt=test pilot of a show />
の箇所が治ってない!!!
え・・・!?コレはどういう事!?
なるほどーーー!!!徹夜ですかー!
さすが先生!!!参考になりやす!
ちなみに、何で悪い大人の人はXSSの脆弱性を突いてきて悪い事をするんですかー??
凄く、僕は寂しいです。
例えば「 はてなキーワードが嫌いになった理由 - 将来が不安」とか、最近、はてなキーワードがだめとか何とか、そういう話題がかまびすしかったわけですが、いやいや、今更言うのもなんですが、はてなキーワードはすごいんですよ?
キーワードページからそのキーワードを含む日記が解る。こういう機能、なかなか無いです。
でも、そのキーワードを使っているはてな以外の日記も見たい時があるかもしれません。
テクノラティなら、はてなに限らず、色々なブログサービスの、そのキーワードを含む記事を探すことができます。
でも、日記のキーワードリンクからダイレクトに飛べないと、いちいち見る気になりません。なので、そういうGreasemonkeyスクリプトを書いてみました。はてダの記事中のキーワードリンクの、リンク先をテクノラティにします。
// ==UserScript== // @name Keyword to Technorati // @namespace http://anond.hatelabo.jp/ // @include http://d.hatena.ne.jp/* // ==/UserScript== var keywords = document.getElementsByClassName("keyword"); for(var i=0; i<keywords.length; i++){ keywords.item(i).href = "http://www.technorati.jp/search/" + keywords.item(i).textContent; }
でも、これもちょっと不便です。キーワードリンクで、そのキーワードの意味を知りたい時もあるからです。
はてなキーワードの素晴らしいところは、キーワードを含む日記とキーワードの意味、どちらも一つのページで確認できる事です!まぁキーワードの説明とWikipedia、どっちか片方でも良いような気もしますがf(^ ^;)
そこで、テクノラティのキーワード検索結果ページにも、そのキーワードの意味が表示されれば便利です。
(余談ですけど、Wikipediaの記事があるなら、Wikipediaの記事だけ表示すれば十分かなぁとか思っちゃったり?概してWikipediaの記述の方が優れてるし…)
// ==UserScript== // @name Technorati with Wikipedia or ?keyword // @namespace http://anond.hatelabo.jp/ // @description Add Wikipedia in Technorati search page // @include http://www.technorati.jp/search/* // ==/UserScript== var keyword = (decodeURIComponent(document.URL).split("?")[0]+" ").slice("http://www.technorati.jp/search/".length, -1); function appendKeyword(title,body,url){ var div = document.createElement("div"); div.style.border = "inset gray thin"; div.style.padding = "5px 14px"; var h2 = document.createElement("h2"); h2.innerHTML = title.link(url); h2.style.fontSize = "2em"; div.appendChild(h2); var content = document.createElement("div"); content.innerHTML = body; div.appendChild(content); div.appendChild(document.createElement("hr")); var foot = document.createElement("div"); foot.innerHTML = "["+decodeURIComponent(url).link(url)+"]"; foot.style.textAlign = "right"; div.appendChild(foot); //document.getElementById("main").insertBefore(div, document.getElementById("main").firstChild); document.getElementById("extra").insertBefore(div, document.getElementById("extra").firstChild); } GM_xmlhttpRequest({ method: "GET", url: "http://wikipedia.simpleapi.net/api?output=json&keyword="+keyword, onload: function(response){ var wp = eval(response.responseText); if(wp){ appendKeyword(wp[0].title, wp[0].body, "http://ja.wikipedia.org/wiki/"+encodeURIComponent(wp[0].title)); }else{ GM_xmlhttpRequest({ method: "GET", url: "http://d.hatena.ne.jp/keyword?mode=rss&ie=utf8&word="+encodeURIComponent(keyword), onload: function(response){ var hk = (new DOMParser).parseFromString(response.responseText, "text/xml"); appendKeyword(keyword, hk.getElementsByTagName("description").item(1).textContent, "http://d.hatena.ne.jp/keyword/"+keyword ); } }); } } });
これで、はてダのキーワードリンクで飛んだ先に、その単語の説明とはてな以外も含めたブログ記事が表示されます。やったね\(^o^)/
追記
用語の説明は、検索結果の上に表示するより、サイドバー(広告が表示されてる)にあった方が便利かなーとか思ったので、コードをちょぴっと変更しました。既にインスコしちゃってた人、ごめんね!
ところでテクノラティ検索結果のAutopagerize、なんか1頁目ばっかり継ぎ足される気がするけど、ボクだけかな?
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
_________________ここから下は古い情報▼__________________________________________________
今、自分のブログをスクラッチしているので、こちらで。→2008/9/28 スクラッチ完了!BLACK-OUT.CSS公式ページ
作りました
要は、LynxのようなシンプルWebに世界がなればいいのになと思っている方。
そして、どんなサイトでも目線は左右に動かしたくない!スクロールは上下だけで済ませたい!
と、強く考えておられる方むけの情報です。
私はテキストブラウザのLynxを時々使っているのですが、これでサイトを見るとシンプルに見れるのですごく良いんですよね。
ただ、LynxはFlashとか画像が見れないし、マウスが使えないのはいざって時にちょっと不便。
で、Firefoxをテキストブラウザ化できないかなあと、ふと思いまして、思いつきで作ってしまいました。
私めもwebデザイナーやっとるんですが、上記のように、昨今のwebデザインなんて普段はなくていいって思っている奴でして。
仕事じゃ3カラムのサイトとか作りますが自分はそんなん好きじゃないです。色がサイトごとに違うってのも理解できない。
必要なのは情報であってデザイナーのデザインなんてどうでもいいんですよ。
そんな訳で、どんなサイトでもテキストブラウザ状態で閲覧できるFirefox用の拡張cssを作りました(やっつけだけど)。
ただ、ニュースサイトで画像が見れないと困る時もあるので、普段は小さなサムネイルで、カーソルを合わせた時だけ大きく表示されるようにしています。
@このcssはコンセプト実証モデルです。思いつきで作ってるのでちょっと問題もあります。フィードバックとか意見など頂けると嬉しいかも。
@将来的には、グリモンでjsも組み合わせてもっとコンソールのような感覚でブラウジングできるようにしたい
@(参考用)私のよく見るサイト・・・ニコ動、wikipedia、スラッシュドットジャパン、2nn.jp(2ch)、mixi、はてなでホッテントリに上がっているブログ各種
ちなみに、こんなん使うな、既にこんないいのあるわいってのをご存知の方は教えてくれると嬉しいです。
それなりに探したのだけど、見当たらなくて・・・だから自作したので。
/* * ---------------------------- * black-out.css * author zamamin.com * build 2008.8.09 15:03 * version 0.0.31 * fix @namespaceを書いてなかったので追加 * ---------------------------- * */ @namespace url(http://www.w3.org/1999/xhtml); /* 全てのエレメントをリセット */ body,body * { background-image:none !important; background-color:#000 !important; border-color:#333 !important; text-decoration:none !important; color:#aaa !important; /*<- テキスト色 */ font-size:16px !important; /*<- 文字サイズ */ font-weight:normal !important; padding:0.15em !important; margin:0 !important; line-height:1.25em !important; text-align:left !important; text-indent:0 !important; font-family:Arial,Helvetica,Verdana,'ヒラギノ角ゴPro W3','Hiragino Kaku Gothic Pro',Osaka,'メイリオ',Meiryo,'MS Pゴシック',sans-serif !important; float:none !important; clear:both !important; position:relative !important; width:auto !important; height:auto !important; } body { background-color:#000 !important; padding:0.5em !important; } body * p, body * div, body * h1, body * h2, body * h3, body * h4, body * h5, body * h6{ margin-bottom:0.3em !important; float:left !important; clear:both !important; } /* リンク色 */ body * a, body * a *{ color:#a50 !important; } /* アクセス済みのリンク色 */ body * a:visited{ color:#a50 !important; } /* カーソルを合わせた時のリンク色 */ body * a:hover, body * a:hover *{ color:#0aa !important; background-color:#609 !important; } /* 画像は普段は小さくサムネイル表示。鬱陶しいので薄く表示 */ body * img{ opacity:0.3 !important; height:15px !important; width:15px !important; } /* 画像はマウスカーソルもっていけば原寸サイズになる */ body * img:hover{ opacity:0.9 !important; height:auto !important; width:auto !important; } button, input, select, option, textarea{ color:#f00 !important; padding:0.05em !important; height:auto !important; } /* テーブルのスタイル */ table{ border:none; } table td, table th{ border:none; border-right:1px dashed #999 !important; border-bottom:1px dashed #999 !important; } /* for 2ch(暫定) */ body * dt{ font-weight:bold !important; } /* 二コ動 */ embed#flvplayer{ height:540px !important; width:952px !important; }
<ul id="menu"> <li><a href="#">だらだら</a></li> <li><a href="#">だらだら</a></li> <li><a href="#">だらだら</a><ul><li>だらだら</li><li>だらだらだらだらだらだら</ul></li> <li><a href="#">ゆっくり</a><ul><li>していってね!</li></ul></li> </ul>
こんな感じのリストに
#menu li{
display:block;
float:left;
margin-left:0;
padding-left:0;
margin-right:1em;
border:1px dashed red;
}
#menu li ul{
position:absolute;
display:block;
margin-left:0;
padding-left:0;
border:1px dashed black;
}
#menu li li{
list-style:none;
border:0 none;
float:none;
width:auto;
}
こんな感じのスタイル書いて
window.onload=function(){
var li=document.getElementById("menu").childNodes;
for(var i=0;i<li.length;i++){
if(li[i].childNodes[1]){
var submenu=li[i].childNodes[1];
li[i].onmouseover=function(){
this.childNodes[1].style.display="block";
}
li[i].onmouseout=function(){
this.childNodes[1].style.display="none";
}
}
}
};
wordpressを設置して1年。
放置しっぱなしのドメインがあって、そういえば明日で期限が切れるとおもって見に行った。
ウイルスバスターが反応した。
警告
ウイルスが見つかりました
ファイル名 wp-stats[1].htm
JS_PSYME.XP
概 要 対応方法 感染状況
参 照
別 名: Downloader (Symantec), TR/Dldr.HTML.Agent.IS (Avira),
感染報告の有無 : なし
言語: English
危険度: 低
感染報告: 低
ダメージ度: 低
感染力: 低
特 徴: Worm generic description
ざっと管理画面からどこか改変されてないかみてみたが見当たらなかった。
プラグインのせいだろうか?
いやそもそもこのSymantecの文字が気になる。
気になる事があるとすれば、
購読者 - (Subscriber)が7名いること。
ユーザー登録してなんになるんだろう。
runPHP狙いだろうか。Subscriberには権限を与えていないので意味がないはずだとおもう。
コメント投稿狙いだろうか。
Akismetがんばったね!!
ま、明日さくっと消しておこう。。。
わかった。記事の内容が書き換えられていた。
書き換えられていた記事は最後の書き込み。
ニコニコ動画のiframeの本来のタグを無効化して違うところを参照するifreameを書いてござった。
<iframe width="312" height="176" src="http://www.nicovideo.jp/thumb/XXXXXX" scrolling="no" style="border:solid 1px #CCC;" frameborder="0"><a href="http://www.nicovideo.jp/watch/XXXXXXX">【ニコニコ動画】XXXXXXXX</a></iframe> <iframe width="312" height="176" src="http://www.nicovideo.jp/thumb/XXXXXX" scrolling="no" style="border:solid 1px #CCC;" frameborder="0"><a href="http://www.nicovideo.jp/watch/XXXXXXX">【ニコニコ動画】XXXXXXXX</a></iframe>
これが
<iframe width="312" height="176" <noscript>XXXX(なんかスペイン語っぽい言葉) <a href="XXXXX">XXXXXXXX</a> XXXXXX</noscript> src="<a href="http://www.nicovideo.jp/thumb/XXXXX">http://www.nicovideo.jp/thumb/XXXXX</a>" scrolling="no" <noscript> XXXXXXXX(上と違う内容) <a href="XXXXXXX">XXXXXXX</a> XXXXXXXX </noscript> style="border:solid 1px #CCC;" frameborder="0"><a href=" <a href="http://www.nicovideo.jp/watch/XXXXXX"> http://www.nicovideo.jp/watch/XXXXXX</a> ">【ニコニコ動画】XXXXXX(1/2)</a></iframe> <p><iframe width="312" height="176" src=" <a href="http://www.nicovideo.jp/thumb/XXXX">http://www.nicovideo.jp/thumb/XXXXXX</a> "<!-- Traffic Statistics --> <iframe src=XXXXXXXX/wp-stats.php width=1 height=1 frameborder=0></iframe> <!-- End Traffic Statistics --> scrolling="no" style="border:solid 1px #CCC;" frameborder="0"><a href="<a href="http://www.nicovideo.jp/watch/XXXX">http://www.nicovideo.jp/watch/XXXX</a> ">【ニコニコ動画】XXXXXXXX(2/2)</a></iframe>
なにがしたいのかわからないが、
なんかもしかしたら3回ぐらい同じ系統で書き換えられてるのかもしれない。
やりかたはさっぱり想像できない。
でも、ここまで記事の内容が差し替えられるのだとしたら、管理者アカウントをのっとっちゃうのが一番てっとりばやいかな。
で、新しく記事が投稿されたのか監視するために購読者登録っと。
そんなところじゃないだろうか。。。
<html><head><title>Hello JavaScript World!</title><style type="text/css"> <!-- .select { margin-left: 30px; padding: 0 2px; width: 6em; border: dotted 1px; } .select p { margin: 2px; } --> </style></head><body><script type="text/javascript"> <!-- // step 1 : output text document.write("Hello world!"); // step 2 : output html document.write("<br/><b>Hello javascript world!</b>"); // step 3 : manipulate DOM var p1 = document.createElement("p"); p1.appendChild(document.createTextNode("Hello DOM world!")); document.body.appendChild(p1); // step 3 : interactive, using function, event handler function solid() { this.style.borderStyle="solid"; } var p2 = document.createElement("p"); p2.appendChild(document.createTextNode("Hello interactive world!")); document.body.appendChild(p2); p2.addEventListener("click", solid, false); // not solid() // step 4 : using object, prototype, closure function P(str) { this.str = str; } P.prototype.regist = function(parent){ this.elem = document.createElement("p"); this.elem.appendChild(document.createTextNode(this.str)); parent.appendChild(this.elem); var self = this; this.elem.addEventListener("click", function(){self.act()}, false); // otherwise // this.elem.helloworld = this; // this.elem.addEventListener("click", function(){this.helloworld.act()}, false); // bad way // this.elem.addEventListener("click", this.act, false); // this.elem.addEventListener("click", function(){this.act()}, false); }; P.prototype.act = function(){}; var p3 = new P("Hello prototype world!"); p3.act = function(){ if (this.elem.style.borderStyle == ""){ this.elem.style.borderStyle = "solid"; } else { this.elem.style.borderStyle = ""; } }; p3.regist(document.body); // step 5 : inheritance function SELECT(parent, str) { this.str = str; this.regist(parent); } SELECT.prototype = new P(); SELECT.prototype.act = function(){ p4.elem.style.borderStyle = this.str; p4.div.style.display = "none"; } var p4 = new P("Hello world!"); p4.div = document.createElement("div"); p4.div.className = "select"; p4.div.style.display = "none"; p4.select = [ new SELECT(p4.div, "none"), new SELECT(p4.div, "dotted"), new SELECT(p4.div, "solid") ]; p4.act = function(){ p4.div.style.display = "block"; }; p4.regist(document.body); document.body.appendChild(p4.div); //--> </script></body></html>
/* 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
KEREM SHALOM, Israel, July 11 ?? Real life has a way of intruding into the airy absolutes of the Israeli-Palestinian conflict. Each side may deny the other’s historical legitimacy, or plot the other’s demise, but somehow, the gritty business of coexistence marches on.
Skip to next paragraph
Enlarge This Image
Rina Castelnuovo for The New York Times
An Israeli man signaled for a truck to move toward Gaza at Sufa on Wednesday. Commerce continues despite the Hamas takeover.
The New York Times
For the past month, since the Islamic militants of Hamas took over the Gaza Strip, Israel has kept the main commercial crossing point at Karni shuttered, squeezing the life out of the limp Gazan economy. Israel bans contact with Hamas, and Hamas seeks Israel’s destruction, making border crossing etiquette more precarious than elsewhere.
Yet at this small crossing near the Egyptian border on Wednesday, between mortar attacks by Hamas and other militants, about 20 truckloads of milk products, meat, medicines and eggs passed from Israel into Gaza, part of the effort to keep basic commodities reaching the 1.5 million Palestinians of the largely isolated strip. Most of the supplies are not humanitarian relief, but are ordered by Palestinian merchants from Israeli suppliers, relying on contacts built up over years.
The mechanics of the crossover manage to answer Israel’s security needs while avoiding contact with Hamas. At Kerem Shalom, Israeli trucks transfer their goods to what Israeli military officials describe as a “sterile” Palestinian truck. Driven by a carefully vetted Palestinian driver, the truck never leaves the terminal, carrying the goods to the Palestinian side, where they are transferred onto ordinary Palestinian trucks that drive into Gaza.
Kerem Shalom, which means “vineyard of peace,” is surrounded by fences and concrete barriers. It can process only about 20 trucks a day, so it is reserved for products that require refrigeration.
The hardier goods, which make up the bulk of the supplies, go through another crossing, at Sufa, to the north. About 100 Israeli trucks a day come from Israel, swirling up clouds of dust before dumping thousands of tons of dry products, bales of straw and crates of fruit on “the platform,” a fenced-in patch of baked earth. At 3 p.m. the Israeli suppliers leave. Like drug dealers picking up a “drop,” the Gaza merchants send in trucks from a gate on the other side and take the products away.
Other products make their way into Gaza with virtually no human interaction. At the fuel depot at Nahal Oz, Israeli tankers pour diesel, gasoline and cooking gas into Gaza through pipes that run beneath the border. And even at Karni, the main crossing that closed for normal operations on June 12, the Israelis have adapted a 650-foot-long conveyor belt, which was previously used for gravel, to send in grain.
“It is better all around from a security point of view that commodities go in,” said Maj. Peter Lerner of the Coordination and Liaison Administration, the Israeli military agency that deals with the civilian aspects of the Gaza border. “More despair doesn’t serve anyone.”
Israeli officials cite security reasons for having shut Karni, the only crossing equipped to send containers into Gaza, or to handle exports out of the strip. “Karni was based on the concept of two sides operating together,” said Col. Nir Press, the head of the coordination agency.
Colonel Press noted that in April 2006, a vehicle loaded with half a ton of explosives got through three of four checkpoints on the Palestinian side of Karni, and was stopped at the last security position by members of the American-backed Presidential Guard, loyal to the Palestinian president, Mahmoud Abbas of Fatah.
But the Presidential Guard is no longer there, having been routed, along with all other Fatah forces in Gaza, by Hamas.
Instead, the military wing of Hamas and other Palestinian factions have been firing mortar shells at Kerem Shalom. On Tuesday, 10 of them landed in and around the terminal as two trucks of milk were passing. The crossing was closed for the rest of the day. [Another barrage of mortar shells hit areas around Kerem Shalom on Thursday.]
Hamas suspects that Israel wants to use Kerem Shalom to replace the Rafah crossing on the Egypt-Gaza border, which has been closed since June 9. The Palestinians had symbolic control at Rafah. At Kerem Shalom, Israel can better supervise who ?? and what ?? is going in and out of the strip.
“Kerem Shalom is a military post, a place from which Israeli tanks begin their incursions into Gaza,” said Fawzi Barhoum, a Hamas spokesman, justifying the mortar attacks. “How can we consider it a safe and legitimate crossing to replace Rafah?”
But when it comes to food, rather than principle, Hamas is proving itself pragmatic as well. On Sunday, Palestinian merchants, trying to press Israel to reopen Karni, told the Israelis that Hamas had barred the import of Israeli fruit. But by Wednesday, the Israeli fruit was ordered again. “Hamas does not want to lose the private sector,” a Gaza businessman explained.
Tellingly, the exposed Sufa crossing, through which most of the food comes, has not been attacked with mortars so far. Without Karni, however, and with the smaller crossings operating on a one-way basis, Gaza can barely subsist. With hardly any raw materials going in, and no products from Gazan farms, greenhouses and factories so far allowed out, Gaza’s tiny industrial base is on the verge of collapse.
Hamas officials say they want to start negotiations with Israel about reopening the formal crossings. Major Lerner said that Hamas had “a few things to do” first, including recognizing Israel’s right to exist and freeing Gilad Shalit, the Israeli soldier captured and taken to Gaza in a raid more than a year ago.
But the ultimate test of pragmatism may come in September when the Hebrew calendar enters what is known in Jewish law as a “shmita” year. Then the fields of Israel are supposed to lie fallow, and observant Jews seek agricultural products grown elsewhere. Before the Hamas takeover, Israel’s rabbis had reached agreements with Palestinians to import vegetables from Gaza, Major Lerner said. Given the needs of both sides, it may still happen.
LiveDoor認証がでたらしいので、とりあえず寝際にちゃちゃっと書こうとしたのだけどなんかうまくいかない。
「ログインURLの有効期限が切れています」とかでちゃうんだ。
なにか間違ってるかな?
<?php // LiveDoor認証に必要なリンクの生成 // 定数がクラス内に切ってあるので環境にあわせ変更してください include_once('authlivedoor.class.php'); // Livedoor認証用クラス $obj_auth = new AuthLiveDoor(LIVEDOOR_APIKEY, LIVEDOOR_SECRET); $livedoorloginurl = $obj_auth->getLoginUrl(); ?> <div style="border:solid 1px #666666;"> <a href="<?= $livedoorloginurl ?>">ライブドア認証を利用してログインする<br /> <img src="http://auth.livedoor.com/img/cmn/head_livedoor.gif" border="0"> <img src="http://auth.livedoor.com/img/cmn/head_logo.gif" border="0"> </a><br />
<?php // this code is writen by utf-8 & lf //http://auth.livedoor.com/login/?app_key=<app_key>&perms=<perms>&t=<time>&v=1.0&userdata=<userdata>&sig=<sig> // LiveDoor外部認証APIを利用する // キーは各開発者ごとに取得が必要です。 http://auth.livedoor.com/ ここより取得できます。 // コールバックURLには authlivedoor.php を指定してください // --- 下記宣言を環境に合わせて変更してください。 --- define("LIVEDOOR_APIKEY" ,""); // アプリケーションキー define("LIVEDOOR_SECRET" ,""); // LiveDoor認証秘密キー // --- ここまで --- class AuthLiveDoor { const LIVEDOOR_AUTH_PORT = 80; // ポート const LIVEDOOR_AUTH_TIMEOUT = 10; // タイムアウト const LIVEDOOR_AUTH_VERSION = '1.0'; // 認証APIのプロトコルバージョン const LIVEDOOR_AUTH_PERMS = 'id'; // 認証APIのアクセス権 const LIVEDOOR_AUTH_FORMAT = 'xml'; // 認証APIの取得フォーマット const LIVEDOOR_AUTHURL = "auth.livedoor.com"; // LiveDoor認証URL private $login_state = false; private $login_id = ""; private $err_msg = ""; private $apikey = ""; private $secret = ""; public function __construct($apikey, $secret) { $this->apikey = $apikey; $this->secret = $secret; } // // $cert = $_GET['token']; public function getAuth($token) { if ($token == "" ) { return; } $api_time = date('U'); // エポック秒で $param_ary = array($this->apikey ,AuthLiveDoor::LIVEDOOR_AUTH_FORMAT ,$token ,api_time ,AuthLiveDoor::LIVEDOOR_AUTH_VERSION ); sort($param_ary); $api_sig = hash_hmac('sha1',implode('',$param_ary),$this->secret); $param = "app_key=".$this->apikey ."&format=".AuthLiveDoor::LIVEDOOR_AUTH_FORMAT ."&token=".$token ."&t=".$api_time ."&v=".AuthLiveDoor::LIVEDOOR_AUTH_VERSION ."&sig=".$api_sig; $fp = fsockopen(AuthLiveDoor::LIVEDOOR_AUTHURL , AuthLiveDoor::LIVEDOOR_AUTH_PORT , $errno , $errstr , AuthLiveDoor::LIVEDOOR_AUTH_TIMEOUT); if (!$fp) { $this->err_msg = "$errstr ($errno)<br />\n"; } else { $out = "POST /rpc/auth?$param HTTP/1.1\r\n"; $out .= "Host: auth.livedoor.com\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $ret = ""; while (!feof($fp)) { $ret .= fgets($fp, 2048); } fclose($fp); } // LiveDoorの認証XMLのパターン $pattern = '/(\s*<livedoor_id>)(.*)(<\/livedoor_id>)/'; preg_match_all($pattern,$ret,$getAry); $livedooruserid = $getAry[2][0]; // ユーザーIDを取得できた場合 if ($livedooruserid != "") { // ログイン成功 $this->login_state = true; $this->login_id = $livedooruserid; return ture; } } public function getLoginState(){ return $this->login_state; } public function getLoginId(){ return $this->login_id; } public function getLoginUrl() { # http://auth.livedoor.com/guide/ # http://auth.livedoor.com/login/?app_key=<app_key>&perms=<perms>&t=<time>&v=1.0&userdata=<userdata>&sig=<sig> # app_key 必須 登録時に発行されたアプリケーションキー # perms 必須 要求するアクセス権、現状userhashとidの2種類がある # t 必須 URLが生成された時間をエポック秒で表したもの # v 必須 プロトコルバージョン、現在は1.0で固定 # userdata 任意 コールバックURLに引き継ぎたい値を255バイトまで自由に設定できる # sig 必須 このURLの正当性を確認するためのシグネチャ // ログインURLの有効期限が切れています // ヾ(。o、゜)ノ ここらへんがわからん!! // $api_time = time()+32400; // エポック秒で $api_time = date('U')+32400; // エポック秒で // $api_time = date('U'); // エポック秒??もしかして、それはポエティック病ではありませんか? $param_ary = array($this->apikey ,AuthLiveDoor::LIVEDOOR_AUTH_PERMS ,api_time ,AuthLiveDoor::LIVEDOOR_AUTH_VERSION // ,data ); sort($param_ary); $api_sig = hash_hmac('sha1',implode('',$param_ary),$this->secret); $loginurl = "http://auth.livedoor.com/login/" ."?app_key=".$this->apikey ."&perms=".AuthLiveDoor::LIVEDOOR_AUTH_PERMS ."&t=".$api_time ."&v=".AuthLiveDoor::LIVEDOOR_AUTH_VERSION // ."&userdata=" ."&sig=".$api_sig; return $loginurl; } }
もう疲れたので寝る。ライブドアなんてーーーー!!!
訂正。
秘密キーとか、そのままのっけちゃった (ーωー|||)
そしてなかなか訂正できなくてあせった。。
http://anond.hatelabo.jp/20070317135224
一部MUAのように引用領域の左端にタテ傍線がつくとかもじら表示系のように単にインデントされるとか
そんな君のためのスタイルシート
<style type="text/css"> blockquote { border:none; padding-left:20px; background-image:url(/images/common/icon-arrow.gif); /*なんか>な画像*/ background-repeat:repeat-y; } </style>
あれ、もしかしてここに書けば効く様になるのかな?
てすとてすと。
<style type="text/css"></p> <p>blockquote {</p> <p>border:none;</p> <p>padding-left:20px;</p> <p>background-image:url(/images/common/icon-arrow.gif); /*なんか>な画像*/</p> <p>background-repeat:repeat-y;</p> <p>}</p> <p></style>
*{ margin : 0 }はもう古い!? | Emotional Web
はてなブックマーク - *{ margin : 0 }はもう古い!? | Emotional Web
はてなが酷い。
base.cssとかcommon.cssとかを書いて読み込ませるのは、何のためだったか考えてみよう。古い新しいの問題じゃないと気づくだろうか。少なくとも、レンダリング時間なんて完全に後付けだと洞察できるはずだ(あなたたちはjs大好きだよね)。
さて、真っ新なとこからCSS書いてくとき、どんなデザインにしろほぼ毎回指定する要素が出てくる。a img{border:none;}とかhtml,body{margin:0; padding:0;}とかだ。それなら始めにa img{border:none;}とかを羅列したファイルを用意しておけば、余計な手間が省けるじゃないか。たぶん根本の動機はこんなとこだろう。
それがいつの間にかデフォルトで適用されるスタイルをキャンセルするっていう方向へ迷走し、*{margin:0; padding:0;}なんて表現が生まれた。この指定は言うまでもなく有害で、著名なのはフォームのボタンが縮こまったり、liのネストが判別できないなどの副作用が生まれる。あまりにもすべてがキャンセルされるため、わざわざひとつずつ要素のスタイルを定義しなければならなくなって、ファイルサイズは増え可読性は下がり、冒頭で言うようにレンダリングにも時間が掛かるようになる。FireBugがない時代、この要素のスタイルはどのファイルのどの部分で指定されてるのか調べるのは本当に大変だった。*.cssをgrepしたとしても、単にul li{}とか書かれてるのがカスケーディングしてたらお手上げ。
これらのデメリットを認識したとき、はて*{margin:0; padding:0;}のメリットはなんだろうと考える。あ、特にないよね。じゃあやめよ。←いまここ
こんなのは実際にCSSを書いてたら気づくことだ。海外とか時代とか関係ない。元記事の趣旨は「*{margin:0;}は古い」じゃなくて「どんなCSSが効率的か Part2」だ。レンダリング重いから*{margin:0;}やめようなんてコピペ脳丸出しじゃ、いつまで経っても効率的なCSSなんぞ書けんよ。
*原理主義者が「(例えば数十年後にリリースされた)UAがどんなスタイルを適用するかわからないので、最初にリセットするのは永続性完全性の観点から意味がある」と言うけども、未知のUA(というかデフォルトスタイル)まで考えてCSSを書くのはあまりに大変だ。それに、そんなことになれば、たぶん、compat.user.cssみたいなのが流行るはず。デフォルトスタイルに頼った表現がしょせん実装依存なのは認めるけど、ちょっと非現実的すぎるので、考慮から外させてもらう。俺はいま実務の話をしたいんだ。
で、元記事では、じゃあどんなCSSがいいのかって点がついで程度にしか触れられていないので、俺なりに考えてみた。
これは外せない。aの中のimgにborder付けたいってほうがイレギュラーなので、わざわざa.logo img{border:1px solid #333;}なんて書き直すのも苦にならない。例外には手作業でもって対応すべき。
ほとんどの場合、隙間を空けたいよりも隙間を空けたくない。キャンパスはフルに使いたい。
印刷時にはそうでもないので、@media print {body{padding:1cm;}}なんてのがあってもいいけど、それはまた別の話。あとそういうのは印刷するユーザー側で指定すべきだとも思う。理想論だけど。
lang="ja"な文章において斜体は不要。どうせあなたはemとかaddressとかにfont-style:normal;付けるんだから。
preやcodeがsans-serifだとイラっと来ますよね。
やられるとイラっとくるもの。個人的。
俺はページをメイリオやヒラギノやM+ FONTやVLゴシックで見たいんだよ! お前の趣味を押しつけんな! あと最後に一般名(sans-serifとか)くらい書け!
でもpre.2ch-ascii-art{font-family: "MS Pゴシック";}なんてのはやさしさが溢れていてとても好ましいと思う。部分的にfont-family指定するのは別にいいけど、全体のデフォルトフォントをいじられるのは不愉快でしかない。
まあ仕方ないのはわかる。解決法も知らない。けどホイールでスクロールしてるとき興味のないサンプルコードで引っかかるのはとてもムカつくんだ。俺は君のサイトが崩れてるかどうかより、いつも通りのスクロールに関心がある。
pre以外にグラフィック目的でoverflow:auto;を指定するのは論外。
「CSSは個々人のスタイルを反映してるということでしかないんじゃないの」
「そうですね」
スタイルシート ソース理解クイズ - [ホームページ作成]All About
まあ「仕様書で規定されていない部分については、IEおよびFirefoxの実装に従うものとします」などといった注意書きをもっとしっかりつけてくれれば大体は間違ってない。
しかし、Q7に関しては明らかに間違っている。選択肢の中に正解がない。
'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + scrollbar width (if any) = width of containing block
CSS 2.1では通常フローにあるブロックレベル非置換要素の幅の算出に上の等式が使われる。しかし、問題の例では、この等式の左辺のすべての項がauto以外の算出値を持っている。この状態を「制約しすぎ」(over-constrained)であるといい、(包含ブロックのdirectionプロパティの値がltrならば)margin-rightプロパティの指定値が無視され、上の等式を基にmargin-rightの値が再計算される。よって正解は「包含ブロックの幅に等しいピクセル数」だ。
それから、Q9にも大きな不備がある。「同じ位置」「移動する」と回答中にあるが、これらが何に対してなのかが明言されていないのだ。固定配置の要素はスクリーンメディアにおいて、表示領域に対しては同じ位置にあるが、通常フローの要素に対してはスクロールに応じて移動するといえるので、このままでは正解をひとつに絞りきれない。
CSSを切手と交換してくれるというので、交換所に列ができていた。
列に並んでいる人はみんな、おじいさんも若いおねえさんも、紙粘土の塊のようなものを手に持っていて、それがCSSであるらしかった。僕も家に帰って、いつか作ったきりでほうりっぱなしにしていたCSSを取ってきて、列に加わった。
僕の番になった。机の上には野菜くずが散らばっていた。交換所の人にCSSを渡すと、キャベツをくれた。とてもいきいきとしていてみずみずしくて、桃太郎のように中からキャベツ太郎が生まれてきそうなくらいにエネルギーいっぱいのキャベツだった。僕はその元気なキャベツを両手で抱えて帰った。
帰り道、道の両側の白い塀に「border-bottom:solid;」だとか「display:none;」などといったCSSが落書きされていた。最近はこんな単語を書くのが流行っているのだろうか。それとも書いた人はこの塀のスタイルを変えようとしたのだろうか。