Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Multi-language support and google fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andrenatal committed Sep 2, 2018
1 parent 739415f commit 8282959
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const analytics = new TestPilotGA({
ds: 'addon',
an: 'Voice Fill',
aid: '[email protected]',
av: '1.3.8'
av: '1.4.0'
});

browser.runtime.onMessage.addListener(event => {
Expand Down
15 changes: 9 additions & 6 deletions extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
const SPINNING_ANIMATION = browser.extension.getURL("Spinning.json");
const START_ANIMATION = browser.extension.getURL("Start.json");
const ERROR_ANIMATION = browser.extension.getURL("Error.json");

const LANGUAGE = navigator.language;
const escapeHTML = (str) => {
// Note: string cast using String; may throw if `str` is non-serializable, e.g. a Symbol.
// Most often this is not the case though.
Expand Down Expand Up @@ -228,8 +228,8 @@
case "www.google.co.uk":
case "encrypted.google.com":
return {
input: "lst-ib",
anchor: "sfdiv"
input: "q",
anchor: "RNNXgb"
}
case "duckduckgo.com":
case "start.duckduckgo.com":
Expand Down Expand Up @@ -529,8 +529,8 @@
this.icon.classList.add("stm-hidden");
this.icon.disabled = true;
this.hasAnchor = false;
this.input = document.getElementById(register.input);
this.anchor = document.getElementById(register.anchor);
this.input = document.getElementById(register.input) || document.getElementsByName(register.input)[0];
this.anchor = document.getElementById(register.anchor) || document.getElementsByClassName(register.anchor)[0];

if (this.input.ownerDocument !== document) {
return null;
Expand Down Expand Up @@ -668,7 +668,10 @@
metrics.start_stt();
fetch(STT_SERVER_URL, {
method: "POST",
body: blob
body: blob,
headers: {
"Language": LANGUAGE
}
})
.then(response => {
if (!response.ok) {
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Voice Fill",
"version": "1.3.8",
"version": "1.4.0",
"description": "Adds voice input to popular search pages in Firefox. Learn more about Voice Fill at https://testpilot.firefox.com",
"developer": {
"name": "Emerging Technologies Advanced Dev Team",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "voicefill",
"id": "[email protected]",
"description": "This is a simple WebExtension that adds support to use Speech To Text as an input method in web pages.",
"version": "1.3.8",
"version": "1.4.0",
"author": {
"name": "Andre Natal & Fabrice Desré",
"url": "https://github.com/mozilla/speaktome"
Expand Down

0 comments on commit 8282959

Please sign in to comment.