Skip to content

Instantly share code, notes, and snippets.

// Jetpack Feature : hello-jetpack.js
// ページを開いたら通知する
jetpack.tabs.onReady(function() {
jetpack.notifications.show("Hello Jetpack!");
});
// 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();
// Jetpack feature : disable-hatena-keyword-pageMods.js
// はてなダイアリー (http://d.hatena.ne.jp/) のキーワードを無効化する
// pageMods を使用するバージョン
jetpack.future.import("pageMods");
var callback = function(targetDocument) {
$(targetDocument).find("a.keyword").each(function() {
$(this).replaceWith($(this).html());
});
};
// Jetpack feature : log-url.js
// ページを開いたらそのページの URL をログ表示する
jetpack.tabs.onReady(function(targetDocument) {
// frame, ifreme の場合は何もしない
if (targetDocument.defaultView.frameElement) {
return;
}
console.log(targetDocument.location.href);
// Jetpack Feature : disable-hatena-keyword.js
// はてなダイアリー (http://d.hatena.ne.jp/) の
// キーワードを無効化する
jetpack.tabs.onReady(function(targetDocument) {
if (targetDocument.defaultView.frameElement) {
return;
}
if (targetDocument.location.href.search(/^http:\/\/d.hatena.ne.jp\//) !== -1) {