Skip to content

Instantly share code, notes, and snippets.

@mollifier
Created December 5, 2009 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mollifier/249695 to your computer and use it in GitHub Desktop.
Save mollifier/249695 to your computer and use it in GitHub Desktop.
// jetpack feature : info.js
// info ボタンを押すと選択部分を Google で検索し、
// 検索件数を alert する
jetpack.statusBar.append({
html: "<button>info</button>",
width: 60,
onReady: function(widget) {
$(widget).click(function() {
var word = jetpack.tabs.focused.contentWindow.getSelection();
$.get("http://www.google.co.jp/search", {q: word},
function(data) {
var info = $(data, widget).find("#resultStats").text();
jetpack.tabs.focused.contentWindow.alert(info);
});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment