annyang 2.6.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +69 -44
  3. package/dist/annyang.cjs +354 -0
  4. package/dist/annyang.cjs.map +1 -0
  5. package/dist/annyang.d.cts +288 -0
  6. package/dist/annyang.d.ts +288 -0
  7. package/dist/annyang.iife.min.js +1 -0
  8. package/dist/annyang.js +296 -670
  9. package/dist/annyang.js.map +1 -1
  10. package/package.json +54 -34
  11. package/.editorconfig +0 -13
  12. package/.github/ISSUE_TEMPLATE.md +0 -32
  13. package/.github/PULL_REQUEST_TEMPLATE.md +0 -29
  14. package/.jshintrc +0 -31
  15. package/.npmignore +0 -6
  16. package/.travis.yml +0 -22
  17. package/CONTRIBUTING.md +0 -74
  18. package/Gruntfile.js +0 -142
  19. package/bower.json +0 -25
  20. package/demo/css/main.css +0 -152
  21. package/demo/css/main.min.css +0 -1
  22. package/demo/images/flickr.png +0 -0
  23. package/demo/images/footer_background.jpg +0 -0
  24. package/demo/images/icon_js.png +0 -0
  25. package/demo/images/icon_speech.png +0 -0
  26. package/demo/images/icon_user.png +0 -0
  27. package/demo/images/mini_icon_say.png +0 -0
  28. package/demo/images/palette.png +0 -0
  29. package/demo/images/tpscover.jpg +0 -0
  30. package/demo/index.html +0 -233
  31. package/demo/vendor/css/default.css +0 -135
  32. package/demo/vendor/css/github.css +0 -127
  33. package/demo/vendor/css/tomorrow.css +0 -49
  34. package/demo/vendor/html/github-btn.html +0 -243
  35. package/demo/vendor/js/highlight.pack.js +0 -1
  36. package/dist/annyang.min.js +0 -7
  37. package/docs/FAQ.md +0 -186
  38. package/docs/README.md +0 -336
  39. package/sites/README.md +0 -6
  40. package/sites/facebook.js +0 -123
  41. package/sites/facebook.min.js +0 -12
  42. package/sites/geektime.js +0 -108
  43. package/sites/geektime.min.js +0 -12
  44. package/src/annyang.js +0 -680
  45. package/test/SpecRunner.html +0 -41
  46. package/test/init_corti.js +0 -1
  47. package/test/spec/.jshintrc +0 -40
  48. package/test/spec/BasicSpec.js +0 -1616
  49. package/test/spec/IssuesSpec.js +0 -41
  50. package/test/vendor/corti.js +0 -202
package/docs/README.md DELETED
@@ -1,336 +0,0 @@
1
-
2
-
3
- <!-- Start src/annyang.js -->
4
-
5
- # Quick Tutorial, Intro and Demos
6
-
7
- The quickest way to get started is to visit the [annyang homepage](https://www.talater.com/annyang/).
8
-
9
- For a more in-depth look at annyang, read on.
10
-
11
- # API Reference
12
-
13
- ## init(commands, [resetCommands=true])
14
-
15
- Initialize annyang with a list of commands to recognize.
16
-
17
- #### Examples:
18
- ````javascript
19
- var commands = {'hello :name': helloFunction};
20
- var commands2 = {'hi': helloFunction};
21
-
22
- // initialize annyang, overwriting any previously added commands
23
- annyang.init(commands, true);
24
- // adds an additional command without removing the previous commands
25
- annyang.init(commands2, false);
26
- ````
27
- As of v1.1.0 it is no longer required to call init(). Just start() listening whenever you want, and addCommands() whenever, and as often as you like.
28
-
29
- **Deprecated**
30
-
31
- See: [Commands Object](#commands-object)
32
-
33
- ### Params:
34
-
35
- * **Object** *commands* - Commands that annyang should listen to
36
- * **boolean** *[resetCommands=true]* - Remove all commands before initializing?
37
-
38
- ## start([options])
39
-
40
- Start listening.
41
- It's a good idea to call this after adding some commands first, but not mandatory.
42
-
43
- Receives an optional options object which supports the following options:
44
-
45
- - `autoRestart` (boolean, default: true) Should annyang restart itself if it is closed indirectly, because of silence or window conflicts?
46
- - `continuous` (boolean) Allow forcing continuous mode on or off. Annyang is pretty smart about this, so only set this if you know what you're doing.
47
- - `paused` (boolean, default: true) Start annyang in paused mode.
48
-
49
- #### Examples:
50
- ````javascript
51
- // Start listening, don't restart automatically
52
- annyang.start({ autoRestart: false });
53
- // Start listening, don't restart automatically, stop recognition after first phrase recognized
54
- annyang.start({ autoRestart: false, continuous: false });
55
- ````
56
-
57
- ### Params:
58
-
59
- * **Object** *[options]* - Optional options.
60
-
61
- ## abort()
62
-
63
- Stop listening, and turn off mic.
64
-
65
- Alternatively, to only temporarily pause annyang responding to commands without stopping the SpeechRecognition engine or closing the mic, use pause() instead.
66
-
67
- See: [pause()](#pause)
68
-
69
- ## pause()
70
-
71
- Pause listening. annyang will stop responding to commands (until the resume or start methods are called), without turning off the browser's SpeechRecognition engine or the mic.
72
-
73
- Alternatively, to stop the SpeechRecognition engine and close the mic, use abort() instead.
74
-
75
- See: [abort()](#abort)
76
-
77
- ## resume()
78
-
79
- Resumes listening and restores command callback execution when a result matches.
80
- If SpeechRecognition was aborted (stopped), start it.
81
-
82
- ## debug([newState=true])
83
-
84
- Turn on output of debug messages to the console. Ugly, but super-handy!
85
-
86
- ### Params:
87
-
88
- * **boolean** *[newState=true]* - Turn on/off debug messages
89
-
90
- ## setLanguage(language)
91
-
92
- Set the language the user will speak in. If this method is not called, defaults to 'en-US'.
93
-
94
- See: [Languages](https://github.com/TalAter/annyang/blob/master/docs/FAQ.md#what-languages-are-supported)
95
-
96
- ### Params:
97
-
98
- * **String** *language* - The language (locale)
99
-
100
- ## addCommands(commands)
101
-
102
- Add commands that annyang will respond to. Similar in syntax to init(), but doesn't remove existing commands.
103
-
104
- #### Examples:
105
- ````javascript
106
- var commands = {'hello :name': helloFunction, 'howdy': helloFunction};
107
- var commands2 = {'hi': helloFunction};
108
-
109
- annyang.addCommands(commands);
110
- annyang.addCommands(commands2);
111
- // annyang will now listen to all three commands
112
- ````
113
-
114
- See: [Commands Object](#commands-object)
115
-
116
- ### Params:
117
-
118
- * **Object** *commands* - Commands that annyang should listen to
119
-
120
- ## removeCommands([commandsToRemove])
121
-
122
- Remove existing commands. Called with a single phrase, array of phrases, or methodically. Pass no params to remove all commands.
123
-
124
- #### Examples:
125
- ````javascript
126
- var commands = {'hello': helloFunction, 'howdy': helloFunction, 'hi': helloFunction};
127
-
128
- // Remove all existing commands
129
- annyang.removeCommands();
130
-
131
- // Add some commands
132
- annyang.addCommands(commands);
133
-
134
- // Don't respond to hello
135
- annyang.removeCommands('hello');
136
-
137
- // Don't respond to howdy or hi
138
- annyang.removeCommands(['howdy', 'hi']);
139
- ````
140
-
141
- ### Params:
142
-
143
- * **String|Array|Undefined** *[commandsToRemove]* - Commands to remove
144
-
145
- ## addCallback(type, callback, [context])
146
-
147
- Add a callback function to be called in case one of the following events happens:
148
-
149
- * `start` - Fired as soon as the browser's Speech Recognition engine starts listening
150
- * `soundstart` - Fired as soon as any sound (possibly speech) has been detected.
151
- This will fire once per Speech Recognition starting. See https://is.gd/annyang_sound_start
152
- * `error` - Fired when the browser's Speech Recogntion engine returns an error, this generic error callback will be followed by more accurate error callbacks (both will fire if both are defined)
153
- Callback function will be called with the error event as the first argument
154
- * `errorNetwork` - Fired when Speech Recognition fails because of a network error
155
- Callback function will be called with the error event as the first argument
156
- * `errorPermissionBlocked` - Fired when the browser blocks the permission request to use Speech Recognition.
157
- Callback function will be called with the error event as the first argument
158
- * `errorPermissionDenied` - Fired when the user blocks the permission request to use Speech Recognition.
159
- Callback function will be called with the error event as the first argument
160
- * `end` - Fired when the browser's Speech Recognition engine stops
161
- * `result` - Fired as soon as some speech was identified. This generic callback will be followed by either the `resultMatch` or `resultNoMatch` callbacks.
162
- Callback functions for to this event will be called with an array of possible phrases the user said as the first argument
163
- * `resultMatch` - Fired when annyang was able to match between what the user said and a registered command
164
- Callback functions for this event will be called with three arguments in the following order:
165
- * The phrase the user said that matched a command
166
- * The command that was matched
167
- * An array of possible alternative phrases the user might have said
168
- * `resultNoMatch` - Fired when what the user said didn't match any of the registered commands.
169
- Callback functions for this event will be called with an array of possible phrases the user might've said as the first argument
170
-
171
- #### Examples:
172
- ````javascript
173
- annyang.addCallback('error', function() {
174
- $('.myErrorText').text('There was an error!');
175
- });
176
-
177
- annyang.addCallback('resultMatch', function(userSaid, commandText, phrases) {
178
- console.log(userSaid); // sample output: 'hello'
179
- console.log(commandText); // sample output: 'hello (there)'
180
- console.log(phrases); // sample output: ['hello', 'halo', 'yellow', 'polo', 'hello kitty']
181
- });
182
-
183
- // pass local context to a global function called notConnected
184
- annyang.addCallback('errorNetwork', notConnected, this);
185
- ````
186
-
187
- ### Params:
188
-
189
- * **String** *type* - Name of event that will trigger this callback
190
- * **Function** *callback* - The function to call when event is triggered
191
- * **Object** *[context]* - Optional context for the callback function
192
-
193
- ## removeCallback(type, callback)
194
-
195
- Remove callbacks from events.
196
-
197
- - Pass an event name and a callback command to remove that callback command from that event type.
198
- - Pass just an event name to remove all callback commands from that event type.
199
- - Pass undefined as event name and a callback command to remove that callback command from all event types.
200
- - Pass no params to remove all callback commands from all event types.
201
-
202
- #### Examples:
203
- ````javascript
204
- annyang.addCallback('start', myFunction1);
205
- annyang.addCallback('start', myFunction2);
206
- annyang.addCallback('end', myFunction1);
207
- annyang.addCallback('end', myFunction2);
208
-
209
- // Remove all callbacks from all events:
210
- annyang.removeCallback();
211
-
212
- // Remove all callbacks attached to end event:
213
- annyang.removeCallback('end');
214
-
215
- // Remove myFunction2 from being called on start:
216
- annyang.removeCallback('start', myFunction2);
217
-
218
- // Remove myFunction1 from being called on all events:
219
- annyang.removeCallback(undefined, myFunction1);
220
- ````
221
-
222
- ### Params:
223
-
224
- * *type* Name of event type to remove callback from
225
- * *callback* The callback function to remove
226
-
227
- ### Return:
228
-
229
- * undefined
230
-
231
- ## isListening()
232
-
233
- Returns true if speech recognition is currently on.
234
- Returns false if speech recognition is off or annyang is paused.
235
-
236
- ### Return:
237
-
238
- * boolean true = SpeechRecognition is on and annyang is listening
239
-
240
- ## getSpeechRecognizer()
241
-
242
- Returns the instance of the browser's SpeechRecognition object used by annyang.
243
- Useful in case you want direct access to the browser's Speech Recognition engine.
244
-
245
- ### Return:
246
-
247
- * SpeechRecognition The browser's Speech Recognizer currently used by annyang
248
-
249
- ## trigger(string|array)
250
-
251
- Simulate speech being recognized. This will trigger the same events and behavior as when the Speech Recognition
252
- detects speech.
253
-
254
- Can accept either a string containing a single sentence, or an array containing multiple sentences to be checked
255
- in order until one of them matches a command (similar to the way Speech Recognition Alternatives are parsed)
256
-
257
- #### Examples:
258
- ````javascript
259
- annyang.trigger('Time for some thrilling heroics');
260
- annyang.trigger(
261
- ['Time for some thrilling heroics', 'Time for some thrilling aerobics']
262
- );
263
- ````
264
-
265
- ### Params:
266
-
267
- * *string|array* sentences A sentence as a string or an array of strings of possible sentences
268
-
269
- ### Return:
270
-
271
- * undefined
272
-
273
- # Good to Know
274
-
275
- ## Commands Object
276
-
277
- Both the [init()]() and addCommands() methods receive a `commands` object.
278
-
279
- annyang understands commands with `named variables`, `splats`, and `optional words`.
280
-
281
- * Use `named variables` for one word arguments in your command.
282
- * Use `splats` to capture multi-word text at the end of your command (greedy).
283
- * Use `optional words` or phrases to define a part of the command as optional.
284
-
285
- #### Examples:
286
- ````html
287
- <script>
288
- var commands = {
289
- // annyang will capture anything after a splat (*) and pass it to the function.
290
- // e.g. saying "Show me Batman and Robin" will call showFlickr('Batman and Robin');
291
- 'show me *tag': showFlickr,
292
-
293
- // A named variable is a one word variable, that can fit anywhere in your command.
294
- // e.g. saying "calculate October stats" will call calculateStats('October');
295
- 'calculate :month stats': calculateStats,
296
-
297
- // By defining a part of the following command as optional, annyang will respond
298
- // to both: "say hello to my little friend" as well as "say hello friend"
299
- 'say hello (to my little) friend': greeting
300
- };
301
-
302
- var showFlickr = function(tag) {
303
- var url = 'http://api.flickr.com/services/rest/?tags='+tag;
304
- $.getJSON(url);
305
- }
306
-
307
- var calculateStats = function(month) {
308
- $('#stats').text('Statistics for '+month);
309
- }
310
-
311
- var greeting = function() {
312
- $('#greeting').text('Hello!');
313
- }
314
- </script>
315
- ````
316
-
317
- ### Using Regular Expressions in commands
318
- For advanced commands, you can pass a regular expression object, instead of
319
- a simple string command.
320
-
321
- This is done by passing an object containing two properties: `regexp`, and
322
- `callback` instead of the function.
323
-
324
- #### Examples:
325
- ````javascript
326
- var calculateFunction = function(month) { console.log(month); }
327
- var commands = {
328
- // This example will accept any word as the "month"
329
- 'calculate :month stats': calculateFunction,
330
- // This example will only accept months which are at the start of a quarter
331
- 'calculate :quarter stats': {'regexp': /^calculate (January|April|July|October) stats$/, 'callback': calculateFunction}
332
- }
333
- ````
334
-
335
- <!-- End src/annyang.js -->
336
-
package/sites/README.md DELETED
@@ -1,6 +0,0 @@
1
- annyang samples
2
- ===============
3
-
4
- Sample script files to control popular sites with voice commands. Intended as inspiration.
5
-
6
- To try it, run the site's minified source code in the web developer console.
package/sites/facebook.js DELETED
@@ -1,123 +0,0 @@
1
- //! annyang - facebook.com
2
- //! version : 0.1.0
3
- //! author : Tal Ater @TalAter
4
- //! license : MIT
5
- //! https://www.TalAter.com/annyang/
6
-
7
- (function () {
8
- /*global annyang,$ */
9
- "use strict";
10
- var root = this;
11
-
12
- if (annyang) {
13
- var chatToggle = function() {
14
- root.Chat.toggleSidebar();
15
- };
16
-
17
- var chatOnline = function() {
18
- root.ChatVisibility.goOnline();
19
- };
20
-
21
- var chatOffline = function() {
22
- root.ChatVisibility.goOffline();
23
- };
24
-
25
- var searchMore = function(term) {
26
- root.goURI('/search/more/?q='+term);
27
- };
28
-
29
- var gotoPage = function(term) {
30
- root.goURI('/'+term.replace(/[^\w]/ig, ''));
31
- };
32
-
33
- var stream = function() {
34
- root.goURI('/');
35
- };
36
-
37
- var appcenter = function() {
38
- root.goURI('/appcenter');
39
- };
40
-
41
- var messages = function() {
42
- root.goURI('/messages');
43
- };
44
-
45
- var friendRequests = function() {
46
- root.goURI('/friends/requests');
47
- };
48
-
49
- var friends = function() {
50
- root.goURI('/friends');
51
- };
52
-
53
- var profile = function() {
54
- root.goURI('/me');
55
- };
56
-
57
- var events = function() {
58
- root.goURI('/events/list');
59
- };
60
-
61
- var calendar = function() {
62
- root.goURI('/events/calendar');
63
- };
64
-
65
- var photos = function(name) {
66
- root.goURI('/'+(name || 'me').replace(/[^\w]/ig, '')+'/photos');
67
- };
68
-
69
- var albums = function(name) {
70
- root.goURI('/'+(name || 'me').replace(/[^\w]/ig, '')+'/photos_albums');
71
- };
72
-
73
- var goBack = function() {
74
- history.back();
75
- };
76
-
77
- var pageScroll = function(direction) {
78
- if (direction === 'up') {
79
- window.scrollBy(0, -(window.innerHeight-$('pageHead').offsetHeight));
80
- } else {
81
- window.scrollBy(0, window.innerHeight-$('pageHead').offsetHeight);
82
- }
83
- };
84
-
85
- annyang.addCommands({
86
- 'back': goBack,
87
- 'go back': goBack,
88
- 'go home': stream,
89
- 'home': stream,
90
- 'news': stream,
91
- 'profile': profile,
92
- 'me': profile,
93
- 'games': appcenter,
94
- 'apps': appcenter,
95
- 'messages': messages,
96
- 'inbox': messages,
97
- 'mail': messages,
98
- 'email': messages,
99
- 'events': events,
100
- 'calendar': calendar,
101
- 'photos': photos,
102
- 'photos *page': photos,
103
- 'albums': albums,
104
- 'albums *page': albums,
105
- 'friend requests': friendRequests,
106
- 'friends': friends,
107
- 'chat': chatToggle,
108
- 'chat online': chatOnline,
109
- 'go online': chatOnline,
110
- 'chat offline': chatOffline,
111
- 'go offline': chatOffline,
112
- 'scroll': pageScroll,
113
- 'scroll :direction': pageScroll,
114
- 'find *term': searchMore,
115
- 'search for *term': searchMore,
116
- 'search *term': searchMore,
117
- 'go to *page': gotoPage,
118
- 'go *page': gotoPage,
119
- });
120
- annyang.start();
121
- }
122
-
123
- }).call(this);
@@ -1,12 +0,0 @@
1
- "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};
2
- //! annyang
3
- //! version : 2.6.0
4
- //! author : Tal Ater @TalAter
5
- //! license : MIT
6
- //! https://www.TalAter.com/annyang/
7
- !function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.annyang=b(a)}):"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=b(a):a.annyang=b(a)}("undefined"!=typeof window?window:void 0,function(a,b){var c,d=a.SpeechRecognition||a.webkitSpeechRecognition||a.mozSpeechRecognition||a.msSpeechRecognition||a.oSpeechRecognition;if(!d)return null;var e,f,g=[],h={start:[],error:[],end:[],soundstart:[],result:[],resultMatch:[],resultNoMatch:[],errorNetwork:[],errorPermissionBlocked:[],errorPermissionDenied:[]},i=0,j=0,k=!1,l="font-weight: bold; color: #00f;",m=!1,n=!1,o=/\s*\((.*?)\)\s*/g,p=/(\(\?:[^)]+\))\?/g,q=/(\(\?)?:\w+/g,r=/\*\w+/g,s=/[\-{}\[\]+?.,\\\^$|#]/g,t=function(a){return a=a.replace(s,"\\$&").replace(o,"(?:$1)?").replace(q,function(a,b){return b?a:"([^\\s]+)"}).replace(r,"(.*?)").replace(p,"\\s*$1?\\s*"),new RegExp("^"+a+"$","i")},u=function(a){for(var b=arguments.length,c=Array(b>1?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];a.forEach(function(a){a.callback.apply(a.context,c)})},v=function(){return e!==b},w=function(a,b){a.indexOf("%c")!==-1||b?console.log(a,b||l):console.log(a)},x=function(){v()||c.init({},!1)},y=function(a,b,c){g.push({command:a,callback:b,originalPhrase:c}),k&&w("Command successfully loaded: %c"+c,l)},z=function(a){u(h.result,a);for(var b,c=0;c<a.length;c++){b=a[c].trim(),k&&w("Speech recognized: %c"+b,l);for(var d=0,e=g.length;d<e;d++){var f=g[d],i=f.command.exec(b);if(i){var j=i.slice(1);return k&&(w("command matched: %c"+f.originalPhrase,l),j.length&&w("with parameters",j)),f.callback.apply(this,j),void u(h.resultMatch,b,f.originalPhrase,a)}}}u(h.resultNoMatch,a)};return c={init:function(l){var o=!(arguments.length>1&&arguments[1]!==b)||arguments[1];e&&e.abort&&e.abort(),e=new d,e.maxAlternatives=5,e.continuous="http:"===a.location.protocol,e.lang="en-US",e.onstart=function(){n=!0,u(h.start)},e.onsoundstart=function(){u(h.soundstart)},e.onerror=function(a){switch(u(h.error,a),a.error){case"network":u(h.errorNetwork,a);break;case"not-allowed":case"service-not-allowed":f=!1,(new Date).getTime()-i<200?u(h.errorPermissionBlocked,a):u(h.errorPermissionDenied,a)}},e.onend=function(){if(n=!1,u(h.end),f){var a=(new Date).getTime()-i;j+=1,j%10===0&&k&&w("Speech Recognition is repeatedly stopping and starting. See http://is.gd/annyang_restarts for tips."),a<1e3?setTimeout(function(){c.start({paused:m})},1e3-a):c.start({paused:m})}},e.onresult=function(a){if(m)return k&&w("Speech heard, but annyang is paused"),!1;for(var b=a.results[a.resultIndex],c=[],d=0;d<b.length;d++)c[d]=b[d].transcript;z(c)},o&&(g=[]),l.length&&this.addCommands(l)},start:function(a){x(),a=a||{},m=a.paused!==b&&!!a.paused,f=a.autoRestart===b||!!a.autoRestart,a.continuous!==b&&(e.continuous=!!a.continuous),i=(new Date).getTime();try{e.start()}catch(a){k&&w(a.message)}},abort:function(){f=!1,j=0,v()&&e.abort()},pause:function(){m=!0},resume:function(){c.start()},debug:function(){var a=!(arguments.length>0&&arguments[0]!==b)||arguments[0];k=!!a},setLanguage:function(a){x(),e.lang=a},addCommands:function(b){var c;x();for(var d in b)if(b.hasOwnProperty(d))if(c=a[b[d]]||b[d],"function"==typeof c)y(t(d),c,d);else{if(!("object"===("undefined"==typeof c?"undefined":_typeof(c))&&c.regexp instanceof RegExp)){k&&w("Can not register command: %c"+d,l);continue}y(new RegExp(c.regexp.source,"i"),c.callback,d)}},removeCommands:function(a){a===b?g=[]:(a=Array.isArray(a)?a:[a],g=g.filter(function(b){for(var c=0;c<a.length;c++)if(a[c]===b.originalPhrase)return!1;return!0}))},addCallback:function(c,d,e){var f=a[d]||d;"function"==typeof f&&h[c]!==b&&h[c].push({callback:f,context:e||this})},removeCallback:function(a,c){var d=function(a){return a.callback!==c};for(var e in h)h.hasOwnProperty(e)&&(a!==b&&a!==e||(c===b?h[e]=[]:h[e]=h[e].filter(d)))},isListening:function(){return n&&!m},getSpeechRecognizer:function(){return e},trigger:function(a){return c.isListening()?(Array.isArray(a)||(a=[a]),void z(a)):void(k&&w(n?"Speech heard, but annyang is paused":"Cannot trigger while annyang is aborted"))}}}),//! annyang - facebook.com
8
- //! version : 0.1.0
9
- //! author : Tal Ater @TalAter
10
- //! license : MIT
11
- //! https://www.TalAter.com/annyang/
12
- function(){var a=this;if(annyang){var b=function(){a.Chat.toggleSidebar()},c=function(){a.ChatVisibility.goOnline()},d=function(){a.ChatVisibility.goOffline()},e=function(b){a.goURI("/search/more/?q="+b)},f=function(b){a.goURI("/"+b.replace(/[^\w]/gi,""))},g=function(){a.goURI("/")},h=function(){a.goURI("/appcenter")},i=function(){a.goURI("/messages")},j=function(){a.goURI("/friends/requests")},k=function(){a.goURI("/friends")},l=function(){a.goURI("/me")},m=function(){a.goURI("/events/list")},n=function(){a.goURI("/events/calendar")},o=function(b){a.goURI("/"+(b||"me").replace(/[^\w]/gi,"")+"/photos")},p=function(b){a.goURI("/"+(b||"me").replace(/[^\w]/gi,"")+"/photos_albums")},q=function(){history.back()},r=function(a){"up"===a?window.scrollBy(0,-(window.innerHeight-$("pageHead").offsetHeight)):window.scrollBy(0,window.innerHeight-$("pageHead").offsetHeight)};annyang.addCommands({back:q,"go back":q,"go home":g,home:g,news:g,profile:l,me:l,games:h,apps:h,messages:i,inbox:i,mail:i,email:i,events:m,calendar:n,photos:o,"photos *page":o,albums:p,"albums *page":p,"friend requests":j,friends:k,chat:b,"chat online":c,"go online":c,"chat offline":d,"go offline":d,scroll:r,"scroll :direction":r,"find *term":e,"search for *term":e,"search *term":e,"go to *page":f,"go *page":f}),annyang.start()}}.call(this);
package/sites/geektime.js DELETED
@@ -1,108 +0,0 @@
1
- //! annyang - Geektime.co.il
2
- //! version : 0.1.0
3
- //! author : Tal Ater @TalAter
4
- //! license : MIT
5
- //! https://www.TalAter.com/annyang/
6
-
7
- (function () {
8
- /*global annyang,jQuery */
9
- "use strict";
10
- var root = this;
11
-
12
- if (annyang) {
13
- annyang.debug();
14
- annyang.setLanguage('he');
15
-
16
- var nextPage = function() {
17
- root.location.href = jQuery('.next-page a').attr("href") || '/';
18
- };
19
-
20
- var prevPage = function() {
21
- root.location.href = jQuery('.prev-page a').attr("href") || '/';
22
- };
23
-
24
- var gotoHome = function() {
25
- root.location.href = '/';
26
- };
27
-
28
- var gotoGadgets = function() {
29
- root.location.href = '/category/gadgets/';
30
- };
31
-
32
- var gotoStartup = function() {
33
- root.location.href = '/category/startup/';
34
- };
35
-
36
- var gotoDevelopment = function() {
37
- root.location.href = '/category/development/';
38
- };
39
-
40
- var gotoInternet = function() {
41
- root.location.href = '/category/internet/';
42
- };
43
-
44
- var gotoHitech = function() {
45
- root.location.href = '/category/hi-tech/';
46
- };
47
-
48
- var gotoGames = function() {
49
- root.location.href = '/category/games1/';
50
- };
51
-
52
- var gotoScience = function() {
53
- root.location.href = '/category/science/';
54
- };
55
-
56
- var gotoEvents = function() {
57
- root.location.href = '/eventsboard/';
58
- };
59
-
60
- var gotoJobs = function() {
61
- root.location.href = 'http://geekjob.co.il/';
62
- };
63
-
64
- var gotoSearch = function(search) {
65
- root.location.href = '/?s='+search;
66
- };
67
-
68
- var scrollToTop = function() {
69
- jQuery("html, body").animate({ scrollTop: 0 }, 1500);
70
- return false;
71
- };
72
-
73
- annyang.addCommands({
74
- '(דף) (ה)בית': gotoHome,
75
- '(דף) הבא': nextPage,
76
- '(דף) (ה)קודם': prevPage,
77
-
78
- 'גאג׳טים*etc': gotoGadgets,
79
- 'מובייל*etc': gotoGadgets,
80
- 'mobile*etc': gotoGadgets,
81
-
82
- 'סטארט אפ*etc': gotoStartup,
83
- ':etc סיכון': gotoStartup,
84
-
85
- 'פיתוח*etc': gotoDevelopment,
86
-
87
- 'אינטרנט*etc': gotoInternet,
88
-
89
- 'היי טק*etc': gotoHitech,
90
-
91
- 'משחקים*etc': gotoGames,
92
-
93
- 'מדע*etc': gotoScience,
94
-
95
- 'אירוע*etc': gotoEvents,
96
-
97
- 'משרות*etc': gotoJobs,
98
- 'דרושים*etc': gotoJobs,
99
-
100
- ':geek me up scotty': scrollToTop,
101
-
102
- 'חפש *etc': gotoSearch,
103
- 'חפס *etc': gotoSearch,
104
- });
105
- annyang.start();
106
- }
107
-
108
- }).call(this);
@@ -1,12 +0,0 @@
1
- "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};
2
- //! annyang
3
- //! version : 2.6.0
4
- //! author : Tal Ater @TalAter
5
- //! license : MIT
6
- //! https://www.TalAter.com/annyang/
7
- !function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.annyang=b(a)}):"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=b(a):a.annyang=b(a)}("undefined"!=typeof window?window:void 0,function(a,b){var c,d=a.SpeechRecognition||a.webkitSpeechRecognition||a.mozSpeechRecognition||a.msSpeechRecognition||a.oSpeechRecognition;if(!d)return null;var e,f,g=[],h={start:[],error:[],end:[],soundstart:[],result:[],resultMatch:[],resultNoMatch:[],errorNetwork:[],errorPermissionBlocked:[],errorPermissionDenied:[]},i=0,j=0,k=!1,l="font-weight: bold; color: #00f;",m=!1,n=!1,o=/\s*\((.*?)\)\s*/g,p=/(\(\?:[^)]+\))\?/g,q=/(\(\?)?:\w+/g,r=/\*\w+/g,s=/[\-{}\[\]+?.,\\\^$|#]/g,t=function(a){return a=a.replace(s,"\\$&").replace(o,"(?:$1)?").replace(q,function(a,b){return b?a:"([^\\s]+)"}).replace(r,"(.*?)").replace(p,"\\s*$1?\\s*"),new RegExp("^"+a+"$","i")},u=function(a){for(var b=arguments.length,c=Array(b>1?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];a.forEach(function(a){a.callback.apply(a.context,c)})},v=function(){return e!==b},w=function(a,b){a.indexOf("%c")!==-1||b?console.log(a,b||l):console.log(a)},x=function(){v()||c.init({},!1)},y=function(a,b,c){g.push({command:a,callback:b,originalPhrase:c}),k&&w("Command successfully loaded: %c"+c,l)},z=function(a){u(h.result,a);for(var b,c=0;c<a.length;c++){b=a[c].trim(),k&&w("Speech recognized: %c"+b,l);for(var d=0,e=g.length;d<e;d++){var f=g[d],i=f.command.exec(b);if(i){var j=i.slice(1);return k&&(w("command matched: %c"+f.originalPhrase,l),j.length&&w("with parameters",j)),f.callback.apply(this,j),void u(h.resultMatch,b,f.originalPhrase,a)}}}u(h.resultNoMatch,a)};return c={init:function(l){var o=!(arguments.length>1&&arguments[1]!==b)||arguments[1];e&&e.abort&&e.abort(),e=new d,e.maxAlternatives=5,e.continuous="http:"===a.location.protocol,e.lang="en-US",e.onstart=function(){n=!0,u(h.start)},e.onsoundstart=function(){u(h.soundstart)},e.onerror=function(a){switch(u(h.error,a),a.error){case"network":u(h.errorNetwork,a);break;case"not-allowed":case"service-not-allowed":f=!1,(new Date).getTime()-i<200?u(h.errorPermissionBlocked,a):u(h.errorPermissionDenied,a)}},e.onend=function(){if(n=!1,u(h.end),f){var a=(new Date).getTime()-i;j+=1,j%10===0&&k&&w("Speech Recognition is repeatedly stopping and starting. See http://is.gd/annyang_restarts for tips."),a<1e3?setTimeout(function(){c.start({paused:m})},1e3-a):c.start({paused:m})}},e.onresult=function(a){if(m)return k&&w("Speech heard, but annyang is paused"),!1;for(var b=a.results[a.resultIndex],c=[],d=0;d<b.length;d++)c[d]=b[d].transcript;z(c)},o&&(g=[]),l.length&&this.addCommands(l)},start:function(a){x(),a=a||{},m=a.paused!==b&&!!a.paused,f=a.autoRestart===b||!!a.autoRestart,a.continuous!==b&&(e.continuous=!!a.continuous),i=(new Date).getTime();try{e.start()}catch(a){k&&w(a.message)}},abort:function(){f=!1,j=0,v()&&e.abort()},pause:function(){m=!0},resume:function(){c.start()},debug:function(){var a=!(arguments.length>0&&arguments[0]!==b)||arguments[0];k=!!a},setLanguage:function(a){x(),e.lang=a},addCommands:function(b){var c;x();for(var d in b)if(b.hasOwnProperty(d))if(c=a[b[d]]||b[d],"function"==typeof c)y(t(d),c,d);else{if(!("object"===("undefined"==typeof c?"undefined":_typeof(c))&&c.regexp instanceof RegExp)){k&&w("Can not register command: %c"+d,l);continue}y(new RegExp(c.regexp.source,"i"),c.callback,d)}},removeCommands:function(a){a===b?g=[]:(a=Array.isArray(a)?a:[a],g=g.filter(function(b){for(var c=0;c<a.length;c++)if(a[c]===b.originalPhrase)return!1;return!0}))},addCallback:function(c,d,e){var f=a[d]||d;"function"==typeof f&&h[c]!==b&&h[c].push({callback:f,context:e||this})},removeCallback:function(a,c){var d=function(a){return a.callback!==c};for(var e in h)h.hasOwnProperty(e)&&(a!==b&&a!==e||(c===b?h[e]=[]:h[e]=h[e].filter(d)))},isListening:function(){return n&&!m},getSpeechRecognizer:function(){return e},trigger:function(a){return c.isListening()?(Array.isArray(a)||(a=[a]),void z(a)):void(k&&w(n?"Speech heard, but annyang is paused":"Cannot trigger while annyang is aborted"))}}}),//! annyang - Geektime.co.il
8
- //! version : 0.1.0
9
- //! author : Tal Ater @TalAter
10
- //! license : MIT
11
- //! https://www.TalAter.com/annyang/
12
- function(){var a=this;if(annyang){annyang.debug(),annyang.setLanguage("he");var b=function(){a.location.href=jQuery(".next-page a").attr("href")||"/"},c=function(){a.location.href=jQuery(".prev-page a").attr("href")||"/"},d=function(){a.location.href="/"},e=function(){a.location.href="/category/gadgets/"},f=function(){a.location.href="/category/startup/"},g=function(){a.location.href="/category/development/"},h=function(){a.location.href="/category/internet/"},i=function(){a.location.href="/category/hi-tech/"},j=function(){a.location.href="/category/games1/"},k=function(){a.location.href="/category/science/"},l=function(){a.location.href="/eventsboard/"},m=function(){a.location.href="http://geekjob.co.il/"},n=function(b){a.location.href="/?s="+b},o=function(){return jQuery("html, body").animate({scrollTop:0},1500),!1};annyang.addCommands({"(דף) (ה)בית":d,"(דף) הבא":b,"(דף) (ה)קודם":c,"גאג׳טים*etc":e,"מובייל*etc":e,"mobile*etc":e,"סטארט אפ*etc":f,":etc סיכון":f,"פיתוח*etc":g,"אינטרנט*etc":h,"היי טק*etc":i,"משחקים*etc":j,"מדע*etc":k,"אירוע*etc":l,"משרות*etc":m,"דרושים*etc":m,":geek me up scotty":o,"חפש *etc":n,"חפס *etc":n}),annyang.start()}}.call(this);