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

Move the vomnibar to an iframe #1139

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
*.sublime*
node_modules/*
dist
jscoverage.json
tags
39 changes: 23 additions & 16 deletions background_scripts/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ root.addExcludedUrl = (url) ->
continue
# And just keep everything else.
newExcludedUrls.push(spec)

Settings.set("excludedUrls", newExcludedUrls.join("\n"))

chrome.tabs.query({ windowId: chrome.windows.WINDOW_ID_CURRENT, active: true },
Expand Down Expand Up @@ -635,30 +635,37 @@ getCurrFrameIndex = (frames) ->
return i if frames[i].id == focusedFrame
frames.length + 1

# Send message back to the tab unchanged. This allows different frames from the same tab to message eachother
# while avoiding security concerns such as eavesdropping or message spoofing.
echo = (request, sender) ->
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please describe what this is useful for in the comment

delete request.handler # No need to send this information
chrome.tabs.sendMessage(sender.tab.id, request)

# Port handler mapping
portHandlers =
keyDown: handleKeyDown,
settings: handleSettings,
filterCompleter: filterCompleter

sendRequestHandlers =
getCompletionKeys: getCompletionKeysRequest,
getCurrentTabUrl: getCurrentTabUrl,
openUrlInNewTab: openUrlInNewTab,
openUrlInIncognito: openUrlInIncognito,
openUrlInCurrentTab: openUrlInCurrentTab,
openOptionsPageInNewTab: openOptionsPageInNewTab,
registerFrame: registerFrame,
frameFocused: handleFrameFocused,
upgradeNotificationClosed: upgradeNotificationClosed,
updateScrollPosition: handleUpdateScrollPosition,
copyToClipboard: copyToClipboard,
isEnabledForUrl: isEnabledForUrl,
saveHelpDialogSettings: saveHelpDialogSettings,
selectSpecificTab: selectSpecificTab,
getCompletionKeys: getCompletionKeysRequest
getCurrentTabUrl: getCurrentTabUrl
openUrlInNewTab: openUrlInNewTab
openUrlInIncognito: openUrlInIncognito
openUrlInCurrentTab: openUrlInCurrentTab
openOptionsPageInNewTab: openOptionsPageInNewTab
registerFrame: registerFrame
frameFocused: handleFrameFocused
upgradeNotificationClosed: upgradeNotificationClosed
updateScrollPosition: handleUpdateScrollPosition
copyToClipboard: copyToClipboard
isEnabledForUrl: isEnabledForUrl
saveHelpDialogSettings: saveHelpDialogSettings
selectSpecificTab: selectSpecificTab
refreshCompleter: refreshCompleter
createMark: Marks.create.bind(Marks),
createMark: Marks.create.bind(Marks)
gotoMark: Marks.goto.bind(Marks)
echo: echo

# Convenience function for development use.
window.runTests = -> open(chrome.runtime.getURL('tests/dom_tests/dom_tests.html'))
Expand Down
124 changes: 9 additions & 115 deletions content_scripts/vimium.css
Original file line number Diff line number Diff line change
Expand Up @@ -266,136 +266,30 @@ div.vimiumHUD a.close-button:hover {

body.vimiumFindMode ::selection {
background: #ff9632;
};
}

/* Vomnibar CSS */
/* Vomnibar Frame CSS */

#vomnibar ol, #vomnibar ul {
list-style: none;
display: block;
}
iframe.vomnibarFrame {
background-color: transparent;
padding: 0px;
overflow: hidden;

#vomnibar {
display: block;
position: fixed;
width: 80%;
width: calc(80% + 20px); /* same adjustment as in pages/vomnibar.coffee */
min-width: 400px;
height: calc(100% - 70px);
top: 70px;
left: 50%;
margin: 0 0 0 -40%;
border: none;
font-family: sans-serif;

background: #F1F1F1;
text-align: left;
border-radius: 4px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.8);
border: 1px solid #aaa;
/* One less than hint markers and the help dialog. */
z-index: 99999996;
}

#vomnibar input {
color: #000;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 20px;
height: 34px;
margin-bottom: 0;
padding: 4px;
background-color: white;
border-radius: 3px;
border: 1px solid #E8E8E8;
box-shadow: #444 0px 0px 1px;
width: 100%;
outline: none;
box-sizing: border-box;
}

#vomnibar .vomnibarSearchArea {
display: block;
padding: 10px;
background-color: #F1F1F1;
border-radius: 4px 4px 0 0;
border-bottom: 1px solid #C6C9CE;
}

#vomnibar ul {
background-color: white;
border-radius: 0 0 4px 4px;
list-style: none;
padding: 10px 0;
padding-top: 0;
}

#vomnibar li {
border-bottom: 1px solid #ddd;
line-height: 1.1em;
padding: 7px 10px;
font-size: 16px;
color: black;
position: relative;
display: list-item;
margin: auto;
}

#vomnibar li:last-of-type {
border-bottom: none;
}

#vomnibar li .vomnibarTopHalf, #vomnibar li .vomnibarBottomHalf {
display: block;
overflow: hidden;
}

#vomnibar li .vomnibarBottomHalf {
font-size: 15px;
margin-top: 3px;
padding: 2px 0;
}

#vomnibar li .vomnibarSource {
color: #777;
margin-right: 4px;
}
#vomnibar li .vomnibarRelevancy {
position: absolute;
right: 0;
top: 0;
padding: 5px;
background-color: white;
color: black;
font-family: monospace;
width: 100px;
overflow: hidden;
}

#vomnibar li .vomnibarUrl {
white-space: nowrap;
color: #224684;
}

#vomnibar li .vomnibarMatch {
font-weight: bold;
color: black;
}

#vomnibar li em, #vomnibar li .vomnibarTitle {
color: black;
margin-left: 4px;
font-weight: normal;
}
#vomnibar li em { font-style: italic; }
#vomnibar li em .vomnibarMatch, #vomnibar li .vomnibarTitle .vomnibarMatch {
color: #333;
text-decoration: underline;
}

#vomnibar li.vomnibarSelected {
background-color: #BBCEE9;
font-weight: normal;
}



div#vimiumFlash {
box-shadow: 0px 0px 4px 2px #4183C4;
padding: 1px;
Expand Down
2 changes: 2 additions & 0 deletions content_scripts/vimium_frontend.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ initializePreDomReady = ->
getActiveState: -> { enabled: isEnabledForUrl, passKeys: passKeys }
setState: setState
currentKeyQueue: (request) -> keyQueue = request.keyQueue
vomnibarShow: -> Vomnibar.show()
vomnibarClose: -> Vomnibar.close()

chrome.runtime.onMessage.addListener (request, sender, sendResponse) ->
# In the options page, we will receive requests from both content and background scripts. ignore those
Expand Down
Loading