Skip to content

Commit

Permalink
Added not listening command to disable extension
Browse files Browse the repository at this point in the history
  • Loading branch information
rjfc committed Mar 11, 2020
1 parent e74aa02 commit a36cef6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"manifest_version": 2,

"name": "NaviVoice",
"name": "NaviVoice: Voice Input Productivity Assistant",
"short_name": "NaviVoice",
"description": "Surf the web with just your voice!",
"version": "0.2.1",
"version": "0.2.3",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",

"browser_action": {
Expand Down
10 changes: 10 additions & 0 deletions scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ else {
else if (event.results[i][0].transcript.toLowerCase().trim() == ("chrome")) {
utterance = new SpeechSynthesisUtterance(whatResponses[Math.floor(Math.random()*whatResponses.length)]);
}
else if (event.results[i][0].transcript.toLowerCase().trim().includes("stop listening")) {
chrome.management.getSelf(function(result) {
chrome.management.setEnabled(result.id, false)
});
}
else {
utterance = new SpeechSynthesisUtterance("I don't understand " + event.results[i][0].transcript);
}
Expand Down Expand Up @@ -657,6 +662,11 @@ else {
});
utterance = new SpeechSynthesisUtterance("Showing you your downloads.");
}
else if (event.results[i][0].transcript.toLowerCase().trim().includes("stop listening")) {
chrome.management.getSelf(function(result) {
chrome.management.setEnabled(result.id, false)
});
}
// if voice variable is set to on
var voice = "";
chrome.storage.sync.get('voice', function (result) {
Expand Down
12 changes: 6 additions & 6 deletions scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ chrome.runtime.getBackgroundPage(function(bg) {
if (prefix == "on") {
chrome.tabs.create({
active: true,
url: 'http:https://www.navivoice.org/commands.html'
url: 'http:https://www.getnavivoice.com/commands.html'
}, null);
}
else if (prefix == "off")
{
chrome.tabs.create({
active: true,
url: 'http:https://www.navivoice.org/commandsNoPrefix.html'
url: 'http:https://www.getnavivoice.com/commandsNoPrefix.html'
}, null);
}
});
Expand All @@ -42,8 +42,8 @@ chrome.runtime.getBackgroundPage(function(bg) {
url: 'settings.html'
}, null);
});
/*
var toggleListen = $("#toggleListen");

/*var toggleListen = $("#toggleListen");
toggleListen.click(function () {
if (toggleListen.hasClass("not-listening")) {
toggleListen.addClass("listening");
Expand All @@ -55,7 +55,7 @@ chrome.runtime.getBackgroundPage(function(bg) {
});
}
else if (toggleListen.hasClass("listening")) {
chrome.runtime.reload();
// chrome.runtime.reload();
}
});
Expand All @@ -76,4 +76,4 @@ chrome.runtime.getBackgroundPage(function(bg) {
toggleListen.css("background-color", "#53AC56");
}
});*/
})
});

0 comments on commit a36cef6

Please sign in to comment.