Created
May 17, 2013 23:14
-
-
Save dergachev/5602555 to your computer and use it in GitHub Desktop.
omnibox-chrome-extension-demo with bookmarklet support; see https://github.com/dergachev/chrome-bookmark-search/issues/1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This event is fired each time the user updates the text in the omnibox, | |
// as long as the extension's keyword mode is still active. | |
chrome.omnibox.onInputChanged.addListener( | |
function(text, suggest) { | |
console.log('inputChanged: ' + text); | |
suggest([ | |
{content: text + " one", description: "the first one"}, | |
{content: text + " number two", description: "the second entry"} | |
]); | |
}); | |
// This event is fired with the user accepts the input in the omnibox. | |
chrome.omnibox.onInputEntered.addListener( | |
function(text) { | |
console.log('inputEntered: ' + text); | |
alert('You just typed 2 "' + text + '"'); | |
chrome.tabs.executeScript(null, {code:"document.body.innerHTML = 'bobbbb';"}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Omnibox Example", | |
"description" : "To use, type 'omnix' plus a search term into the Omnibox.", | |
"version": "1.1", | |
"background": { | |
"scripts": ["background.js"], | |
"persistent": false | |
}, | |
"omnibox": { "keyword" : "b" }, | |
"permissions": [ | |
"activeTab" | |
], | |
"manifest_version": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment