mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Adds incTab to increment tab, fix JS modulo
This commit is contained in:
parent
53a2317181
commit
76b1247998
2 changed files with 19 additions and 4 deletions
|
@ -57,14 +57,14 @@ displayTab = (tab_id) ->
|
|||
# the real thing.
|
||||
browser.browserAction.onClicked.addListener(handleBrowserAction)
|
||||
|
||||
nextTab = () ->
|
||||
incTab = (inc) ->
|
||||
browser.windows.getCurrent().then(
|
||||
(window) ->
|
||||
browser.tabs.query({windowId:window.id}).then(
|
||||
(tabs) ->
|
||||
active = (tab for tab in tabs when tab.active)[0]
|
||||
nextIndex = (active.index + 1) % tabs.length
|
||||
desiredTab = (tab for tab in tabs when tab.index == nextIndex)[0]
|
||||
activeTab = (tab for tab in tabs when tab.active)[0]
|
||||
desiredIndex = (activeTab.index + inc).mod(tabs.length)
|
||||
desiredTab = (tab for tab in tabs when tab.index == desiredIndex)[0]
|
||||
setTab(desiredTab.id)
|
||||
).catch(console.error)
|
||||
).catch(console.error)
|
||||
|
@ -77,5 +77,9 @@ tabByIndex = (index) ->
|
|||
desiredTab = tab for tab in tabs when tab.index == desIndex
|
||||
)
|
||||
|
||||
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
ideas.md
11
ideas.md
|
@ -56,3 +56,14 @@ Tridactyl (like Pentadactyl, but worse, last cuturally relevant in 2005 like Sal
|
|||
# Features we need less?
|
||||
autocmds?
|
||||
macros?
|
||||
|
||||
|
||||
# Vimium notes
|
||||
Uses descriptors a lot - what even are they?
|
||||
Loading into firefox doesn't give any errors / doesn't seem to expose any functions?
|
||||
|
||||
|
||||
# Other stuff
|
||||
Would be nice to have self-writing documentation, for autocmd use etc?
|
||||
|
||||
History seems to be window.history.go(), presumably in a content script?
|
||||
|
|
Loading…
Add table
Reference in a new issue