Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions background_scripts/commands.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ Commands =
"LinkHints.activateModeToOpenInNewTab",
"LinkHints.activateModeToOpenInNewForegroundTab",
"LinkHints.activateModeWithQueue",
"LinkHints.activateModeToOpenInNewWindow",
"LinkHints.activateModeToOpenInNewFullscreenWindow",
"LinkHints.activateModeToDownloadLink",
"Vomnibar.activate",
"Vomnibar.activateInNewTab",
Expand Down Expand Up @@ -165,6 +167,8 @@ Commands =
"Vomnibar.activateEditUrl",
"Vomnibar.activateEditUrlInNewTab",
"LinkHints.activateModeToOpenIncognito",
"LinkHints.activateModeToOpenInNewWindow",
"LinkHints.activateModeToOpenInNewFullscreenWindow",
"goNext",
"goPrevious",
"Marks.activateCreateMode",
Expand Down Expand Up @@ -292,6 +296,8 @@ commandDescriptions =
"LinkHints.activateModeToOpenInNewTab": ["Open a link in a new tab", { noRepeat: true }]
"LinkHints.activateModeToOpenInNewForegroundTab": ["Open a link in a new tab & switch to it", { noRepeat: true }]
"LinkHints.activateModeWithQueue": ["Open multiple links in a new tab", { noRepeat: true }]
"LinkHints.activateModeToOpenInNewWindow": ["Open a link in a new window", { noRepeat: true }]
"LinkHints.activateModeToOpenInNewFullscreenWindow": ["Open a link in a fullscreen window", { noRepeat: true }]
"LinkHints.activateModeToOpenIncognito": ["Open a link in incognito window", { noRepeat: true }]
"LinkHints.activateModeToDownloadLink": ["Download link url", { noRepeat: true }]

Expand Down
13 changes: 12 additions & 1 deletion background_scripts/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,18 @@ openUrlInNewTab = (request) ->
chrome.tabs.getSelected(null, (tab) ->
chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true }))

#
# Opens request.url in new incognito window.
#
openUrlInIncognito = (request) ->
chrome.windows.create({ url: Utils.convertToUrl(request.url), incognito: true})
chrome.windows.create({url: Utils.convertToUrl(request.url), incognito: true})

#
# Opens request.url in new fullscreen window.
#
openUrlInFullscreen = (request) ->
chrome.windows.create({url: Utils.convertToUrl(request.url)}, (window) ->
chrome.windows.update window.id, {state: "fullscreen"})

#
# Called when the user has clicked the close icon on the "Vimium has been updated" message.
Expand Down Expand Up @@ -631,6 +641,7 @@ sendRequestHandlers =
getCurrentTabUrl: getCurrentTabUrl,
openUrlInNewTab: openUrlInNewTab,
openUrlInIncognito: openUrlInIncognito,
openUrlInFullscreen: openUrlInFullscreen,
openUrlInCurrentTab: openUrlInCurrentTab,
openOptionsPageInNewTab: openOptionsPageInNewTab,
registerFrame: registerFrame,
Expand Down
16 changes: 16 additions & 0 deletions content_scripts/link_hints.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ OPEN_WITH_QUEUE = {}
COPY_LINK_URL = {}
OPEN_INCOGNITO = {}
DOWNLOAD_LINK_URL = {}
OPEN_IN_NEW_WINDOW = {}
OPEN_IN_NEW_FULLSCREEN_WINDOW = {}

LinkHints =
hintMarkerContainingDiv: null
Expand Down Expand Up @@ -53,6 +55,8 @@ LinkHints =
activateModeToCopyLinkUrl: -> @activateMode(COPY_LINK_URL)
activateModeWithQueue: -> @activateMode(OPEN_WITH_QUEUE)
activateModeToOpenIncognito: -> @activateMode(OPEN_INCOGNITO)
activateModeToOpenInNewWindow: -> @activateMode(OPEN_IN_NEW_WINDOW)
activateModeToOpenInNewFullscreenWindow: -> @activateMode(OPEN_IN_NEW_FULLSCREEN_WINDOW)
activateModeToDownloadLink: -> @activateMode(DOWNLOAD_LINK_URL)

activateMode: (mode = OPEN_IN_CURRENT_TAB) ->
Expand Down Expand Up @@ -115,6 +119,18 @@ LinkHints =
altKey: true,
ctrlKey: false,
metaKey: false })
else if @mode is OPEN_IN_NEW_FULLSCREEN_WINDOW
HUD.show("Open link in fullscreen window")

@linkActivator = (link) ->
chrome.runtime.sendMessage(
handler: 'openUrlInFullscreen'
url: link.href)
else if @mode is OPEN_IN_NEW_WINDOW
HUD.show("Open link in new window")

@linkActivator = (link) ->
DomUtils.simulateClick(link, {shiftKey: true})
else # OPEN_IN_CURRENT_TAB
HUD.show("Open link in current tab")
@linkActivator = (link) -> DomUtils.simulateClick.bind(DomUtils, link)()
Expand Down