From 917fe91526053e7142c4eb7ec6542feb6a45af38 Mon Sep 17 00:00:00 2001 From: MURAOKA Yusuke Date: Thu, 13 Oct 2016 22:28:03 +0900 Subject: [PATCH 1/2] close appropriate tab when opened omnifocus dialog. --- lib/main.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 9466cc4..a548058 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,5 +1,6 @@ var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); +var { setTimeout } = require("sdk/timers"); var button = buttons.ActionButton({ id: "mozilla-link", @@ -16,6 +17,14 @@ function handleClick(state) { var name = "Read - " + tabs.activeTab.title; var selection = require("sdk/selection"); var note = tabs.activeTab.url + (selection.text != undefined ? "\n" + selection.text : ""); - tabs.open('omnifocus:///add?name=' + encodeURIComponent(name) + '¬e=' + encodeURIComponent(note)); - tabs.activeTab.close(); -} \ No newline at end of file + var currentTab = tabs.activeTab; + tabs.open({ + url: 'omnifocus:///add?name=' + encodeURIComponent(name) + '¬e=' + encodeURIComponent(note), + onOpen: function onOpen(tab) { + setTimeout(function() { + tab.close(); + currentTab.activate(); + }); + } + }); +} From c2325a2cfd6000a3257e6e68ab9b01f724807e81 Mon Sep 17 00:00:00 2001 From: MURAOKA Yusuke Date: Thu, 13 Oct 2016 22:43:11 +0900 Subject: [PATCH 2/2] fix to build with latest jpm. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1fc4ec7..38a9ac4 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "addtoomnifocus", "title": "AddToOmnifocus", - "id": "jid1-A8HjG5DBf1hjNw", "description": "a basic add-on", "author": "", + "main": "lib/main.js", "license": "MPL 2.0", - "version": "0.1" + "version": "0.1.1" }