console.log等でobjectを出力するとコンソールには出力した時点のobjectではなく一連の処理が終わった後のobjectがでるのでちゃんと確認するならconsole.debug(obj.toSource())する。JSON.stringifyもあり#JSdebug
console.log等でobjectを出力するとコンソールには出力した時点のobjectではなく一連の処理が終わった後のobjectがでるのでちゃんと確認するならconsole.debug(obj.toSource())する。JSON.stringifyもあり#JSdebug
最近のJavaScript熱は凄いものがあります。 去年まで僕がいたお仕事の世界では、「JavaScript=Webアプリケーションで背景をちょっと変えたりする言語モドキ」として非常に扱いが低かったと記憶しております。それでもjQueryのプラグインなどで実現出来るカックイイUIなんかをユーザの人にリクエストされたりという事はありましたし、その為にjQueryの中身を覗いて「きんもー☆」って思ったりせっかく調べてドヤ顔でサンプルとか作ってみたのに「OSSってヤバイじゃん?」とヤバイご指摘で秒殺されたりしたのも、今となっては良い思い出です。 さらに、最近はやりのSmartPhoneでは結局Flashがどうなっちゃうんだかって状況が続いておりまして、折しもHTML5なんて目新しい話題も盛り上がってきている事からしても、これはもうiPhoneでもAndroidでもWebブラウザでも使えるJava
本日行われた Shibuya.js の発表資料をアップしました。 さいきんの JavaScript テスト / Test.js - Shibuya.js 発表資料 View more presentations from hotchpotch JS のテスティングフレームワークのおおざっぱな説明や JavaScript テストにおける問題、それについての解決方法の一つ、CUI でのテスト、Envjs、エンドツーエンドテストにおける JS / Ajax のテスト、終わりにちらっと Phantomjs の話があります。 スライドの最後にあるように、やはりまだコレだ!という JS のテスティングフレームワークは存在しなく、今後 JS のテストは『僕らが書きたいテスト』をどれだけ簡単に書ける・書く手法が確立されるかによって流行廃りは決まってくるんじゃないかなぁ、と思ってます。そのうちの一つがスライ
JavaScriptリンク要素のアドレスなどをユーザーが訪れたことがあるか否かをJavaScriptから知る方法を以前調べたがわからなかった。多分、プライバシーの問題の絡みで存在しないのだと勝手に合点した。今日、CSS(display:none) + 擬似セレクタ(:hover) + 要素の高さ(offsetHeight) の組み合わせを思いつき書いた。 function isVisited(link){ if(!isVisited.initialized){ isVisited.initialized = true; addRule("#check_visited:visited", "display:none"); } var a = document.createElement("a"); a.href = link; a.id = "check_visited"; documen
経緯 id:kazuhooku さんが一年前にやってたことですが Kazuho@Cybozu Labs: JavaScript/1.7 で協調的マルチスレッド 今日やっと挙動が理解できたのと、 Weave のソースを読んでいたらこのテクニックをバリバリ使っていて「ちょwwおまwww」ってなったので、自分でも作ってみようと思いました。 ほとんど id:kazuhooku さんのと同じものなので、既出です><本当にありがとうございました>< まず、 yield とは何か yield とは、 JavaScript 1.7 から導入された機能です。 以下に yield の細かい挙動を示しておきます。 function f() { // なんかの処理 yield; // ... (1) // なんかの処理 yield; // ... (2) // なんかの処理 } var g = f(); // こ
自分なんぞがオブジェクト指向とはなんぞと語るなんておこがましく、「オブジェクトっぽい話」でいいかなーと思っていたのですが、ブックマークするときに「オブジェクト」でタグ付けてる人がいたので、これはいかんと思い、こっそりタイトルを直しました。 2回目の今回は、複数のインスタンスをまとめて操作する方法について書きます。 まんじゅうマネージャー 前回、クラス作ってインスタンスを作ると便利だというところで終わりましたが、便利な点としてはまず、「複数のインスタンスをまとめて操作したり、作ったりできることができる」という点があります。どういうことかというと、とりあえず、以下のサンプルを見てみてください。 まんじゅうマネージャーサンプル まんじゅうを一気に作ったり、隠したりすることができます。 これで賞味期限が切れたりしても大丈夫なはずです。 この機能を作れと言われたら、前回の知識だけは結構厳しいのではな
趣旨 インプレース編集を可能とする in_place_editor_field。prototype.js 系はアレなので、jQuery 版を作ってみた。といっても、完全互換ではない。mouse hover がらみの処理は省略。みなさんなりの実装をするときの参考にしてもらえれば幸いです。 使い方 下のソースコードを見て config/environment.rb を修正し、public/javascripts/ajax_in_place_editor.js を新たに作る。 コントローラ・ビューを下のように設定する。 コントローラ (app/controllers/blog_controller.rb) class BlogController < ApplicationController in_place_edit_for :post, :title def update_in_place
経緯 今まで色々なプレゼン資料を usrb.in ドメイン以下に置かせていただいていたのですが、そのマシンを別の用途に使うことになったらしいので、すべての資料を移動させることになりました。 対象の URL http://usrb.in/amachang/static 以下の URL は基本的にすべてですが、主な URL は以下のものです。 http://usrb.in/amachang/static/gaiax01/ http://usrb.in/amachang/static/cssstudy/200701/ http://usrb.in/amachang/static/cssstudy/200701/haihu.html http://usrb.in/amachang/static/shibuyaes/ http://usrb.in/amachang/static/devsum/ ht
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-eq
こんにちは、太田です。前々回はJSONP、前回はXMLHttpRequestについて解説しました。今回は、ここまでの12回で取り上げた内容を使って簡単なアプリケーションを作成してみます。 アプリケーションの設計 第9回で取り上げたTwitter検索を行うJavaScriptをベースに、簡易Twitter検索クライアントを実装してみましょう。 機能は以下のとおりです。 任意のキーワードで検索 60秒おきに自動で新しい検索結果を取得 @ユーザー名はTwitterにリンク URLと思われるところはリンクに ハッシュタグをクリックしたときはそのハッシュタグで検索 短縮されたURLを展開 なお、機能的にはIE 6~8もほかのブラウザと同等の実装にしますが、見た目について(具体的には角丸)はIEでは再現しません。 検索の骨組み まずは任意のキーワードで検索する部分を見ていきましょう。まずはHTMLです
羊毛布団を洗濯機にかけられないことを知りました。ago(@kyo_ago)です。 意外と知られていない機能が多い!?Firebugの使い方を見て、プログラマ向けも欲しくなったので書いてみました。 1. ショートカット一覧 以下のページでFirebugのショートカット一覧が公開されています。 http://getfirebug.com/wiki/index.php/Keyboard_and_Mouse_Shortcuts 取り合えず以下の二つだけでも覚えておくと効率的かもしれません。 F12でFirebugの有効、無効の切り替え 広いコマンドラインモード時にCtrl+Enterでコードを実行 また、以下のメニューからショートカットの変更も行えるので、他の拡張等とショートカットがかぶった場合でも別のキーで使用することが出来ます。 2. Firefox本体のツールバーに「要素を調査」ボタン Fi
わんくまでは珍しいJavaを中心とした日記です 目次 ホーム 連絡をする RSS Login Blog 利用状況 投稿数 - 218 記事 - 0 コメント - 14579 トラックバック - 28 書庫 2008年7月 (1) 2008年2月 (2) 2008年1月 (10) 2007年12月 (9) 2007年11月 (5) 2007年10月 (27) 2007年9月 (25) 2007年8月 (27) 2007年7月 (29) 2007年6月 (15) 2007年5月 (23) 2007年4月 (37) 2007年3月 (8) 日記カテゴリ Java (rss) JavaScript (rss) SQL (rss) WEB (rss) その他 (rss) いろいろリンク The Herringroe Projects(Javaで色々) わんくまトップ 古い方のブログ 次はJavaSc
JavaScript Advent Calendar 2010 8日目担当のid:os0xです。 JavaScriptネタは案外範囲が広くて色んなネタがあるので、毎回が楽しみですね。 さて、私はデバッグをネタにしたいと思います。テストではなくデバッグです。誰かが書いたコードをメンテナンスしなきゃー、とか。jQueryプラグイン導入しようとしたけど、なんかうまく動かないーみたいなケースのおはなしです。 JavaScriptのデバッグは大変なので、多くの方が日々苦労されていると思います。なぜJavaScriptのデバッグが大変なのか少し整理してみましょう。 ブラウザ依存 まず、なんといってもJavaScriptはウェブブラウザ上で実行されるので、環境が一定ではありません。特定の環境だけを対象にJavaScriptを書くことは滅多にありません。PC向けではIE、Firefox、Chrome、Sa
Firebugでインデントつきのソースを書くのは厳しいことに気づいた。 ある程度長いプログラムを書くときはエディタでやろうと思い、エディタってどんなものがあるのかなーと調べたら、vimというのがかっこよかったので、インストールした。 さらに調べ、autocomplpop.vim - vimグループというものを見つけた。 JavaScriptではomni補完ができないので、辞書ファイルを用意したのだが、あまり賢くなかった。 ので、ソースをいじってJavaScriptでもomni補完をできるようにした。 vimには詳しくないので手探り。もっといい方法があるかも。 まず、autocomplpop.vimの371行目あたりに、 \ 'ruby' : [ という行があるので、その前の行に \ 'javascript' : [ \ { \ 'command' : "\<C-n>", \ 'patter
ここ2週間ほどGreasemonkeyのスクリプトを毎日書き続けてる。 まじめにJavaScriptを書いたのが今回が初めてなので色々作法がわからずつまずいたところとかがあったのでまとめておく。解決した項目も未解決の項目も・・・長文になりそうだ 最初にJavaScriptの第一印象なんだけど、なんというか自由な言語。好き勝手できるし、しちゃうと収拾が付かなくなる。最初に作られた仕様の拡張拡張でここまできちゃってもうぐちゃぐちゃなのかな~という感じ こんな言語で高度で複雑なものなんか作れるわけ無いと最初は思ってたけど色々使ってるうちに意外といける気もしてたり・・・コーディングに自分なりの制約をかけてやればちゃんと使えるのかな? まず、Greasemonkeyを使うにあたっての開発環境だけど、ブラウザはFireFox3 アドオンにもちろんGreasemonkey、あとFireBug、これが無い
はてなグループの終了日を2020年1月31日(金)に決定しました 以下のエントリの通り、今年末を目処にはてなグループを終了予定である旨をお知らせしておりました。 2019年末を目処に、はてなグループの提供を終了する予定です - はてなグループ日記 このたび、正式に終了日を決定いたしましたので、以下の通りご確認ください。 終了日: 2020年1月31日(金) エクスポート希望申請期限:2020年1月31日(金) 終了日以降は、はてなグループの閲覧および投稿は行えません。日記のエクスポートが必要な方は以下の記事にしたがって手続きをしてください。 はてなグループに投稿された日記データのエクスポートについて - はてなグループ日記 ご利用のみなさまにはご迷惑をおかけいたしますが、どうぞよろしくお願いいたします。 2020-06-25 追記 はてなグループ日記のエクスポートデータは2020年2月28
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く