Archive for the ‘Google’ Category

 

google plus for business

7月 25th, 2012

http://www.google.com/+/business/ google page作ってみた。 https://plus.google.com/u/0/b/105328434872720282524/ よくわからない。。。 ログインしてる人しか見れないのかな?

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

chrome.tags.getでエラーが出るので、onRemovedで先にチェックする

7月 24th, 2012

http://code.google.com/chrome/extensions/tabs.html chrome.tabs.get(tab.id ,function(tab){              if( typeof(tab)===’undefined’){ // not found              }else{              } }); Error during tabs.get: No tab with id: 2187. sendRequest:20 chromeHidden.handleResponse undefinedの時は、タブが無いということで問題なく処理出来るのですが、(例外にもなりません。) consoleにメッセージがでるので、先に使えないIDをチェックします。 grBk.tabsに適当なタブのオブジェクトが入っていてtab.idでタブのIDを保持しています。 chrome.tabs.onRemoved.addListener(function( tabId,  removeInfo) {  // check active tab  for( i in grBk.tabs ){ […]

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

エラーじゃないけど、function, lineNumberを取得する : javascript

7月 24th, 2012

開発中にエラーじゃないけど、エラー時のように関数、行番号を取得する。  console.log( (new Error()).stack ); Error    at Object.init (chrome-extension://—/js/webdb.js:17:32)    at chrome-extension://—/js/background.js:41:6 な感じになります。

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

goo.gl shortener api

7月 10th, 2012

https://developers.google.com/url-shortener/v1/getting_started OAuth 2.0で使えるようです。 or apikey or 何も無し。 とりあえず。何も無しで使ってみます。 $api = ‘https://www.googleapis.com/urlshortener/v1/url'; $post_data = json_encode(array(‘longUrl’ => $url )); curl_setopt($ch, CURLOPT_URL, $api ); curl_setopt($ch,CURLOPT_HTTPHEADER,array (“Content-Type: application/json” )); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 2); $json = curl_exec($ch); curl_close($ch); jsonデータをpostするだけです。 { “kind”: “urlshortener#url”, “id”: “http://goo.gl/xSJmh”, “longUrl”: “http://blog.bbtune.com/” } 無事、こんなデータが。 で戻すときは Expand […]

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

chrome extensionを早く更新したいので、起動オプションを。for mac

4月 25th, 2012

本番にアップしてもすぐに更新できないので、chromeにオプションを付けて起動して一回更新してみる オプションの付け方は、こんな感じで、1は1分なので、1分前の更新を反映と言う感じでしょうか? open /Applications/Google\ Chrome.app –args –extensions-update-frequency=1 ( windows : chrome.exe –extensions-update-frequency=1 更新されたら、オプション無しで、再起動します。

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

chrome webstore テストアカウントに公開した後、一般公開する方法 | chrome extension

4月 17th, 2012

https://developers.google.com/chrome/web-store/docs/publish#testaccounts Note: To publish to the world after publishing to test accounts, you first need to unpublish the app. 一度非公開にする。

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

chrome ユーザー機能 複数ユーザーとして同時に利用してみる。

4月 16th, 2012

Settings > Personal Stuff > Users でユーザーを追加したりできます。 すると右上にこんな人が出てきて切り替えできたりします。 設定やブックマーク、extensionやら別々に管理できます。 人をクリックして別ユーザーを選択すると新しいwindowが開いて全く違う設定で利用できます。 2つのユーザーとして同時にブラウザを利用できます。 twitterやブログやSNSなど 仕事用とプライベート用など両方立ち上げたい人には便利な機能ですね。

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

Refused to evaluate script because of Content-Security-Policy. | chrome extension

4月 15th, 2012

setTimeout で Refused to evaluate script because of Content-Security-Policy. のエラーメッセージ。 setTimeoutをどうやって表現するかと と思っていたら、ただ書き間違えていただけでした・・・ evalは使えませんが、普通に書く分には問題ないようです。

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

javascript closure compiler

4月 15th, 2012

複数ファイルを複数ファイルに出来ないのかな・・・?と思い。 compilerをダウンロード https://developers.google.com/closure/compiler/ $ cd compiler-latest/ COPYING README compiler.jar 複数ファイルを一つにするには、READMEに書いてある通り java -jar compiler.jar –js=in1.js –js=in2.js … –js_output_file=out.js .js:55: WARNING – Suspicious code. This code lacks side-effects. Is there a bug? reutrn; 普通に使うとエラー検出も出来て便利です。 levelを変更してみる java -jar ../../compiler-latest/compiler.jar –compilation_level ADVANCED_OPTIMIZATIONS –js=dev1.js –js=menu.js –js_output_file=out.js function p(a){var b=[a],c=0;$.b(m,function(g,f){if(f.domain!=a.domain||f.path!=a.path)c++,100<c?reutrn:(b.push(f),console.log(f))});m=b;localStorage.l=JSON.stringify(b);n()}var q=[]; function r(){var a=$(“div#history_thread”),b=”gt;”,c=0;$.b(q,function(a,f){“undefined”!==typeof f.title&&(c++,b+=’gt;gt;’+f.title+”gt;gt;”)});b+=”gt;”;a.c(b);$(“div#history_thread a”).b(function(){$(this).click(function(){var a={domain:$(this).a(“domain”),path:$(this).a(“path”),title:$(this).a(“title”),d:$(this).a(“dat”)};s(a)})});0

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

ajaxのhttp headerを書き換える。webrequest API | chrome extension

4月 13th, 2012

普通にxhrを弄る場合は http://www.w3.org/TR/XMLHttpRequest/ http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method mimetypeなどは beforeSend: function(xhr){ xhr.overrideMimeType(“text/plain;charset=Shift_JIS”); // A xhr.setRequestHeader(“Content-type”,”text/plain;charset=Shift_JIS”); // B }, はAかBで更新できたのですが、この辺はダメで Accept-Charset Accept-Encoding Access-Control-Request-Headers Access-Control-Request-Method Connection Content-Length Cookie Cookie2 Content-Transfer-Encoding Date Expect Host Keep-Alive Origin Referer TE Trailer Transfer-Encoding Upgrade User-Agent Via さてどうしようかと webRequest API の登場です。 http://code.google.com/chrome/extensions/trunk/webRequest.html#event-onBeforeSendHeaders * onBeforeSendHeaders (optionally synchronous) Fires when a request is about to occur and the initial […]

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