From aff2b8080c1f45dc33b8fe7c6dc9c74601bebdc3 Mon Sep 17 00:00:00 2001 From: Justin Noah Date: Sun, 12 May 2013 19:00:46 -0700 Subject: [PATCH 1/2] speech-search: new plugin speech search This is webkit only since no other browser currently supports speech input --- plugins/speech-search.user.js | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 plugins/speech-search.user.js diff --git a/plugins/speech-search.user.js b/plugins/speech-search.user.js new file mode 100644 index 00000000..3eeb8dbc --- /dev/null +++ b/plugins/speech-search.user.js @@ -0,0 +1,50 @@ +// ==UserScript== +// @id iitc-plugin-speech-search +// @name IITC Plugin: Speech Search +// @version 0.0.1.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Allow speech input for location search (webkit only for now) +// @include https://www.ingress.com/intel* +// @include http://www.ingress.com/intel* +// @match https://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// ==/UserScript== + +function wrapper() { + // ensure plugin framework is there, even if iitc is not yet loaded + if (typeof window.plugin !== 'function') window.plugin = function() {}; + + // PLUGIN START //////////////////////////////////////////////////////// + + // use own namespace for plugin + window.plugin.speechSearch = function() {}; + + window.plugin.speechSearch.setup = function() { + // Give the search input the speech attribute + $("#geosearch").attr("x-webkit-speech", ""); + // Immediately search without further input + $("#geosearch").bind("webkitspeechchange", function() { + $("#geosearch").trigger($.Event("keypress", {keyCode: 13})); + }); + }; + + var setup = window.plugin.speechSearch.setup; + + // PLUGIN END ////////////////////////////////////////////////////////// + + if(window.iitcLoaded && typeof setup === 'function') { + setup(); + } else { + if(window.bootPlugins) + window.bootPlugins.push(setup); + else + window.bootPlugins = [setup]; + } +} // wrapper end + +// inject code into site context +var script = document.createElement('script'); +script.appendChild(document.createTextNode('('+ wrapper +')();')); +(document.body || document.head || document.documentElement).appendChild(script); From 2990e938a6ebb182de4ff32ee1c3e04c2abc3a76 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Tue, 14 May 2013 18:16:00 +0100 Subject: [PATCH 2/2] fixed indentation on speech-search plugin to match the others updated description to be clear it isn't for firefox --- plugins/speech-search.user.js | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/plugins/speech-search.user.js b/plugins/speech-search.user.js index 3eeb8dbc..81d1e2bd 100644 --- a/plugins/speech-search.user.js +++ b/plugins/speech-search.user.js @@ -5,7 +5,7 @@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ -// @description [@@BUILDNAME@@-@@BUILDDATE@@] Allow speech input for location search (webkit only for now) +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Allow speech input for location search (webkit only for now - NOT Firefox) // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* @@ -13,37 +13,37 @@ // ==/UserScript== function wrapper() { - // ensure plugin framework is there, even if iitc is not yet loaded - if (typeof window.plugin !== 'function') window.plugin = function() {}; - - // PLUGIN START //////////////////////////////////////////////////////// - - // use own namespace for plugin - window.plugin.speechSearch = function() {}; +// ensure plugin framework is there, even if iitc is not yet loaded +if (typeof window.plugin !== 'function') window.plugin = function() {}; - window.plugin.speechSearch.setup = function() { - // Give the search input the speech attribute - $("#geosearch").attr("x-webkit-speech", ""); - // Immediately search without further input - $("#geosearch").bind("webkitspeechchange", function() { - $("#geosearch").trigger($.Event("keypress", {keyCode: 13})); - }); - }; - - var setup = window.plugin.speechSearch.setup; - - // PLUGIN END ////////////////////////////////////////////////////////// - - if(window.iitcLoaded && typeof setup === 'function') { - setup(); - } else { - if(window.bootPlugins) - window.bootPlugins.push(setup); - else - window.bootPlugins = [setup]; - } + +// PLUGIN START //////////////////////////////////////////////////////// + +// use own namespace for plugin +window.plugin.speechSearch = function() {}; + +window.plugin.speechSearch.setup = function() { + // Give the search input the speech attribute + $("#geosearch").attr("x-webkit-speech", ""); + // Immediately search without further input + $("#geosearch").bind("webkitspeechchange", function() { + $("#geosearch").trigger($.Event("keypress", {keyCode: 13})); + }); +}; + +var setup = window.plugin.speechSearch.setup; + +// PLUGIN END ////////////////////////////////////////////////////////// + +if(window.iitcLoaded && typeof setup === 'function') { + setup(); +} else { + if(window.bootPlugins) + window.bootPlugins.push(setup); + else + window.bootPlugins = [setup]; +} } // wrapper end - // inject code into site context var script = document.createElement('script'); script.appendChild(document.createTextNode('('+ wrapper +')();'));