From c567d7d043b689d72eabbd671eab8ae8805dadc1 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 3 Jun 2015 11:23:29 +0100 Subject: Fix marks (incl. global marks)... Fixes #1712: - Make global marks work. - Add mode indicator. - Don't fail for global marks on background page if mark is not set. - Give HUD warning for global marks if global mark is not set. (The diff is big but, which the exception of infrastructure refactoring, the main change is to not exit on , thereby fixing #1712). --- background_scripts/marks.coffee | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/marks.coffee b/background_scripts/marks.coffee index 15d41205..db9c4ae2 100644 --- a/background_scripts/marks.coffee +++ b/background_scripts/marks.coffee @@ -23,12 +23,18 @@ removeMarksForTab = (id) -> root.goto = (req, sender) -> mark = marks[req.markName] - chrome.tabs.update mark.tabId, selected: true - chrome.tabs.sendMessage mark.tabId, - name: "setScrollPosition" - scrollX: mark.scrollX - scrollY: mark.scrollY - chrome.tabs.sendMessage mark.tabId, - name: "showHUDforDuration", - text: "Jumped to global mark '#{req.markName}'" - duration: 1000 + if mark? + chrome.tabs.update mark.tabId, selected: true + chrome.tabs.sendMessage mark.tabId, + name: "setScrollPosition" + scrollX: mark.scrollX + scrollY: mark.scrollY + chrome.tabs.sendMessage mark.tabId, + name: "showHUDforDuration", + text: "Jumped to global mark '#{req.markName}'." + duration: 1000 + else + chrome.tabs.sendMessage sender.tab.id, + name: "showHUDforDuration", + text: "Global mark not set: '#{req.markName}'." + duration: 1000 -- cgit v1.2.3