Archive for the ‘Google’ Category

 

useragent changer タブ毎にユーザーエージェントを変更出来る chrome extension

9月 18th, 2012

タブ毎にユーザーエージェントを変更出来る chrome extensionを作成しました。 スマートフォン開発などにご利用ください。 chrome webstore chrome webstoreよりインストールしてご利用ください。 リストから選択するだけでタブ毎にユーザーエージェントを設定して利用出来ます。 ご自身のリストも追加可能です。 御意見・御要望等御座いましたらお気軽にご連絡ください。 インストールはこちら chrome webstoreよりインストールしてご利用ください。

Read full article | コメントは受け付けていません。

javascript setTimeout setIntervalは、PCがスリープするとどうなるのか?

9月 15th, 2012

chrome extension で background の setInterval は問題なく動きました。 http://stackoverflow.com/questions/6032429/chrome-timeouts-interval-suspended-in-background-tabs アクティブじゃないタブのとき遅くなる?という話もありますが。 とりあえず動くみたいですね。 止まったらどうしようかなと。 独り言。 何かのタイミングでsetintervalを再実行しようかな とりあえず、ユーザーが明示的に clearinterval(preId) ⇒ setinterval でrefreshできるようにしておこうか

Read full article | コメントは受け付けていません。

javascript で internet 接続を確認する for offline apps

9月 14th, 2012

http://www.w3.org/TR/offline-webapps/ In addition to those APIs HTML 5 also defines an onLine attribute on the Navigator object so you can determine whether you are currently online: var online = navigator.onLine; ということでnavigator.onLineのtrue/falseで接続確認が出来ました。

Read full article | コメントは受け付けていません。

chrome extension popup height

9月 11th, 2012

popup.htmlの高さが可変になっていないとき htmlの先頭に <!DOCTYPE html> が入っているかを確認。この定義が入っていると自動的に高さが調整されます。

Read full article | コメントは受け付けていません。

oauth で google plus api 使ってみる。APIs consoleとか

9月 2nd, 2012

https://developers.google.com/+/api/oauth https://developers.google.com/accounts/docs/OAuth2#basicsteps APIs consoleに登録してみる API Access To prevent abuse, Google places limits on API requests. Using a valid OAuth token or API key allows you to exceed anonymous limits by connecting requests back to your project. Authorized API Access OAuth 2.0 allows users to share specific data with you (for example, contact lists) while keeping […]

Read full article | コメントは受け付けていません。

Migrating to the High Replication Datastore. datastore master/slave to HRD | appengine

8月 24th, 2012

なんか・・・datastoreが古い mastar/slaveだから HRDに変えろと催促メールが来た・・・ データ移行し終わったら使わない予定だけど。まだ消せないからとりあえず手順を試しておく。 https://developers.google.com/appengine/docs/python/tools/uploadinganapp まずは、コードを保存してみる。 /usr/local/google_appengine/appcfg.py appcfg.py download_app -A -V デフォルトは403エラーになるそうで。。。 developer consoleのPermissionのところに Note: code downloads are prohibited.と書いてある You can permanently disable code downloads from the Versions screen in your development web server. On that page, click permanently prohibit code downloads: と書いてあるけど、そんなのありませんがー。ー? コードはあるからとりあえず。。。 https://developers.google.com/appengine/docs/adminconsole/migration# ■ Duplicating Your Application Administration > Application Settings > Duplicate […]

Read full article | コメントは受け付けていません。

外部URLからリソースを使うには? | chrome extension

7月 28th, 2012

外部からリンクしてもエラーになるので・・・ようやくわかりました。 This webpage is not available The webpage at chrome-extension://invalid/ might be temporarily down or it may have moved permanently to a new web address. Error 2 (net::ERR_FAILED): Unknown error. Canaryだとちゃんとエラーが出るそうです・・・ Denying load of chrome-extension://…html. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension. GET […]

Read full article | コメントは受け付けていません。

chrome extension で twitter oauth.

7月 27th, 2012

いろいろ修正しました。 重要追記:現時点では、リンクから chrome-extension:// を開けない仕様になっていることを確認しました。 手動で貼付ける場合は大丈夫ですが、外部URL内のリンクからは開けません. * これも間違いでした。。。登録するとリンクも利用出来ます。次のエントリーに書きます。。。 1つ目の方法は、javascriptに, consumer key , consumer secretを埋め込む方法。 こちらの方法は、丸見えなので、悪意のある人(開発者)が使うと twitterから制限されてしまいます。 2つ目は、サーバー側で取得した物をextensionに渡す。 http://www.eisbahn.jp/yoichiro/2011/10/chrome-extension-oauth.html 最初は、accesstokenをサーバー側で取得して渡すことを考えてしまったのですが、取得前のtokenを渡して javascript側でaccess_tokenを取りにいくので、問題ありませんでした。(1と同じ) 3つ目はすべてサーバー側。サーバーにログインさせる手間が発生するが、キー関連はサーバー側にあるので、取られることはない。 すべてを包括するアカウントが必要という・・・ chromeだからgoogle idでログインさせておけば良いかな。全部サーバー側でやらないといけないので微妙。 webRequest apiはxmlhttprequestはバグ?で取得出来ないみたいだけど。 http://code.google.com/chrome/extensions/tut_oauth.html * この辺も同じくリンクは開けない仕様に変わっている。 * manifest で追加設定が必要でした。 javascript内のconsumer key/secretが読まれてしまうが、これは定期的に更新したりすることで不正利用を回避。 なんとなく見えてきました。

Read full article | コメントは受け付けていません。

badgeを表示 | chrome extension

7月 25th, 2012

desktop notificationも良いけど。バッヂでかなりアピールできるので http://code.google.com/chrome/extensions/browserAction.html Badge Browser actions can optionally display a badge — a bit of text that is layered over the icon. Badges make it easy to update the browser action to display a small amount of information about the state of the extension. Because the badge has limited space, it should have 4 characters […]

Read full article | コメントは受け付けていません。

closure compilerでconsole.logなどデバッグコードを削除する方法は?

7月 25th, 2012

http://stackoverflow.com/questions/2934509/exclude-debug-javascript-code-during-minification セミコロン3つの人が人気ですね。 console.logに名前をかぶせて、new Errorでファイル名や行数をとって、コンパイルのときはその関数を無効にするという方法にしようと思ったり。 結果変なことをしないでclosure compilerを通す前にスクリプトで削除することにしました。 perl -p -i -e ‘s/console.log/\/\/ console.log/’ ../release/”+base+”/js/*.js compileスクリプトのはじめにこんな感じのコマンドを実行させてから、closure compilerを実行するとコメントを削除するので消えます。 chrome extensionのリリース用zip生成スクリプトは 1. 必要なソースをreleaseディレクトリーにコピー 2. jsのconsole.logをコメント 3. compilerでmini 4. zip作成 という感じにしています。 バージョンは手で変えてます。

Read full article | コメントは受け付けていません。