mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Add rudimentary per-tab history navigation
This commit is contained in:
parent
76b1247998
commit
4bd7e64251
4 changed files with 52 additions and 2 deletions
10
addon/content.coffee
Normal file
10
addon/content.coffee
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Just a test
|
||||
#
|
||||
#
|
||||
|
||||
console.log("hello")
|
||||
|
||||
historyHandler = (message) ->
|
||||
window.history.go(message.number)
|
||||
|
||||
browser.runtime.onMessage.addListener(historyHandler)
|
|
@ -77,9 +77,20 @@ tabByIndex = (index) ->
|
|||
desiredTab = tab for tab in tabs when tab.index == desIndex
|
||||
)
|
||||
|
||||
goHistory = (n) ->
|
||||
browser.tabs.query({active:true}).then(
|
||||
(tabs) ->
|
||||
activeTab = tabs[0]
|
||||
browser.tabs.executeScript(activeTab.id, {file:"content.js"})
|
||||
# We could use null in executeScript, and it would default to active tab
|
||||
# but I think that is less readable
|
||||
browser.tabs.sendMessage(activeTab.id,{number:n})
|
||||
)
|
||||
|
||||
|
||||
|
||||
Number.prototype.mod = (n) ->
|
||||
((this%n)+n)%n
|
||||
# Javascript doens't understand maths
|
||||
# Lots of people use myFunc: ()-> \\ rather than \\ myFunc = () -> \\ do we care?
|
||||
|
||||
console.log("Loaded Tridactyl")
|
||||
|
|
|
@ -11,6 +11,30 @@
|
|||
"browser_action": {
|
||||
"default_title": "Tridactyl",
|
||||
"browser_style": true
|
||||
}
|
||||
},
|
||||
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
"alarms",
|
||||
"bookmarks",
|
||||
"contextMenus",
|
||||
"cookies",
|
||||
"downloads",
|
||||
"downloads.open",
|
||||
"history",
|
||||
"identity",
|
||||
"idle",
|
||||
"management",
|
||||
"nativeMessaging",
|
||||
"notifications",
|
||||
"sessions",
|
||||
"storage",
|
||||
"tabs",
|
||||
"topSites",
|
||||
"webNavigation",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"<all_urls>"
|
||||
]
|
||||
|
||||
}
|
||||
|
|
5
ideas.md
5
ideas.md
|
@ -65,5 +65,10 @@ Loading into firefox doesn't give any errors / doesn't seem to expose any functi
|
|||
|
||||
# Other stuff
|
||||
Would be nice to have self-writing documentation, for autocmd use etc?
|
||||
Could use .litcoffee for markdown comments in code.
|
||||
|
||||
History seems to be window.history.go(), presumably in a content script?
|
||||
|
||||
https://news.ycombinator.com/item?id=10120773 -- people complaining, could be handy
|
||||
|
||||
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/executeScript -- we aren't allowed to inject JS into, e.g. about: pages. This means no searching, no back/forward, no commandline: a user navigating to such a page would get trapped.
|
||||
|
|
Loading…
Add table
Reference in a new issue