-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7de7458
commit e1afe88
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
key/* | ||
node_modules/* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!doctype html> | ||
<!-- | ||
This page is shown when the extension button is clicked, because the | ||
"browser_action" field in manifest.json contains the "default_popup" key with | ||
value "popup.html". | ||
--> | ||
<html> | ||
<head> | ||
<title>Voice Web by Launchpad</title> | ||
<style> | ||
body { | ||
font-family: "Segoe UI", "Lucida Grande", Tahoma, sans-serif; | ||
font-size: 100%; | ||
} | ||
#status { | ||
/* avoid an excessively wide status text */ | ||
white-space: pre; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
max-width: 400px; | ||
} | ||
</style> | ||
<script src="index.js"></script> | ||
<script src="tabs.js"></script> | ||
</head> | ||
<body> | ||
<div id="status"></div> | ||
<img id="image-result" hidden> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var debug = true; | ||
|
||
function renderStatus(statusText) { | ||
document.getElementById('status').textContent = statusText; | ||
} | ||
|
||
function log(obj) { | ||
if (debug) console.log(obj); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"manifest_version": 2, | ||
|
||
"name": "Voice Web", | ||
"description": "A Launchpad app that browses the web using your voice", | ||
"version": "1.0", | ||
|
||
"browser_action": { | ||
"default_icon": "favicon-16x16.png", | ||
"default_popup": "index.html" | ||
}, | ||
"permissions": [ | ||
"activeTab", | ||
"tabs", | ||
"extension", | ||
"https://ajax.googleapis.com/" | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
function getCurrentTabUrl(callback) { | ||
var queryInfo = { active: true, currentWindow: true }; | ||
|
||
chrome.tabs.query(queryInfo, function(tabs) { | ||
// get active tab | ||
var tab = tabs[0]; | ||
var url = tab.url; | ||
log(tab); | ||
console.assert(typeof url == 'string', 'tab.url should be a string'); | ||
callback(url); | ||
}); | ||
} | ||
|
||
function openNewTab(props, callback) { | ||
// var props = { | ||
// windowId: 'windowToBeOpenedIn', | ||
// index: 'intendedTabPosition', | ||
// url: url, | ||
// active: true, | ||
// selected: true, | ||
// pinned: false, | ||
// openerTabId: null | ||
// }; | ||
|
||
chrome.tabs.create(props, function(tab) { | ||
callback(tab); | ||
}); | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
getCurrentTabUrl(function(url) { | ||
renderStatus('Current Tab URL: ' + url); | ||
}); | ||
|
||
// API Examples | ||
// openNewTab({url:"http://www.google.com"}, function(tab) { | ||
// log(tab); | ||
// }); | ||
|
||
}); |