Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to createTab command the option position=end/start/after/before #2895

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions background_scripts/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ TabOperations =
openUrlInNewTab: (request, callback = (->)) ->
tabConfig =
url: Utils.convertToUrl request.url
index: request.tab.index + 1
active: true
windowId: request.tab.windowId
{ position } = request
unless position == "end"
tabConfig.index =
if position == "start"
0
else
request.tab.index + if position == "before" then 0 else 1
tabConfig.active = request.active if request.active?
# Firefox does not support "about:newtab" in chrome.tabs.create.
delete tabConfig["url"] if tabConfig["url"] == Settings.defaults.newTabUrl
Expand Down Expand Up @@ -197,9 +203,10 @@ BackgroundCommands =
chrome.windows.create windowConfig, -> callback request
else
urls = request.urls[..].reverse()
position = request.registryEntry.options.position
do openNextUrl = (request) ->
if 0 < urls.length
TabOperations.openUrlInNewTab (extend request, {url: urls.pop()}), openNextUrl
TabOperations.openUrlInNewTab (extend request, {url: urls.pop(), position}), openNextUrl
else
callback request
duplicateTab: mkRepeatCommand (request, callback) ->
Expand Down