annyang 2.6.1 → 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.
- package/LICENSE +1 -1
- package/README.md +55 -31
- package/dist/annyang.cjs +354 -0
- package/dist/annyang.cjs.map +1 -0
- package/dist/annyang.d.cts +288 -0
- package/dist/annyang.d.ts +288 -0
- package/dist/annyang.iife.min.js +1 -0
- package/dist/annyang.js +296 -670
- package/dist/annyang.js.map +1 -1
- package/package.json +54 -36
- package/.editorconfig +0 -13
- package/.eslintrc.json +0 -34
- package/.gitattributes +0 -1
- package/.github/ISSUE_TEMPLATE.md +0 -32
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -29
- package/.jshintrc +0 -31
- package/.travis.yml +0 -20
- package/CONTRIBUTING.md +0 -75
- package/Gruntfile.js +0 -144
- package/bower.json +0 -25
- package/demo/css/main.css +0 -152
- package/demo/css/main.min.css +0 -1
- package/demo/images/flickr.png +0 -0
- package/demo/images/footer_background.jpg +0 -0
- package/demo/images/icon_js.png +0 -0
- package/demo/images/icon_speech.png +0 -0
- package/demo/images/icon_user.png +0 -0
- package/demo/images/mini_icon_say.png +0 -0
- package/demo/images/palette.png +0 -0
- package/demo/images/tpscover.jpg +0 -0
- package/demo/index.html +0 -225
- package/demo/vendor/css/default.css +0 -135
- package/demo/vendor/css/github.css +0 -127
- package/demo/vendor/css/tomorrow.css +0 -49
- package/demo/vendor/html/github-btn.html +0 -243
- package/demo/vendor/js/highlight.pack.js +0 -1
- package/dist/annyang.min.js +0 -12
- package/docs/FAQ.md +0 -223
- package/docs/README.md +0 -336
- package/require.js +0 -36
- package/sites/README.md +0 -6
- package/sites/facebook.js +0 -123
- package/sites/facebook.min.js +0 -17
- package/sites/geektime.js +0 -108
- package/sites/geektime.min.js +0 -17
- package/src/annyang.js +0 -680
- package/test/SpecRunner.html +0 -41
- package/test/init_corti.js +0 -1
- package/test/spec/.jshintrc +0 -40
- package/test/spec/BasicSpec.js +0 -1616
- package/test/spec/IssuesSpec.js +0 -41
- package/test/vendor/corti.js +0 -202
- package/yarn.lock +0 -4190
package/Gruntfile.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
module.exports = function(grunt) {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
// Project configuration.
|
|
5
|
-
grunt.initConfig({
|
|
6
|
-
pkg: grunt.file.readJSON('package.json'),
|
|
7
|
-
jshint: {
|
|
8
|
-
all: [
|
|
9
|
-
'Gruntfile.js',
|
|
10
|
-
'src/annyang.js',
|
|
11
|
-
'sites/facebook.js',
|
|
12
|
-
'sites/geektime.js',
|
|
13
|
-
'test/spec/*Spec.js'
|
|
14
|
-
],
|
|
15
|
-
options: {
|
|
16
|
-
jshintrc: true
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
'babel': {
|
|
20
|
-
options: {
|
|
21
|
-
sourceMap: true,
|
|
22
|
-
presets: ['env']
|
|
23
|
-
},
|
|
24
|
-
dist: {
|
|
25
|
-
files: {
|
|
26
|
-
'dist/annyang.js': 'src/annyang.js'
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
watch: {
|
|
31
|
-
files: ['src/*.js', 'sites/*.js', 'demo/css/*.css', 'test/spec/*Spec.js', '!**/node_modules/**'],
|
|
32
|
-
tasks: ['default']
|
|
33
|
-
},
|
|
34
|
-
uglify: {
|
|
35
|
-
options: {
|
|
36
|
-
output: {
|
|
37
|
-
comments: /^\! /
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
all: {
|
|
41
|
-
files: {
|
|
42
|
-
'dist/annyang.min.js': ['dist/annyang.js'],
|
|
43
|
-
'sites/facebook.min.js': ['dist/annyang.js', 'sites/facebook.js'],
|
|
44
|
-
'sites/geektime.min.js': ['dist/annyang.js', 'sites/geektime.js']
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
imagemin: {
|
|
49
|
-
demoimages: { // Target
|
|
50
|
-
options: { // Target options
|
|
51
|
-
},
|
|
52
|
-
files: [{
|
|
53
|
-
expand: true, // Enable dynamic expansion
|
|
54
|
-
cwd: 'demo/images', // Src matches are relative to this path
|
|
55
|
-
src: ['*.{png,jpg,gif}'], // Actual patterns to match
|
|
56
|
-
dest: 'demo/images' // Destination path prefix
|
|
57
|
-
}]
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
cssmin: {
|
|
61
|
-
combine: {
|
|
62
|
-
files: {
|
|
63
|
-
'demo/css/main.min.css': ['demo/css/main.css', 'demo/vendor/css/default.css', 'demo/vendor/css/github.css']
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
markdox: {
|
|
68
|
-
target: {
|
|
69
|
-
files: [
|
|
70
|
-
{src: 'src/annyang.js', dest: 'docs/README.md'}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
connect: {
|
|
75
|
-
server: {
|
|
76
|
-
options: {
|
|
77
|
-
protocol: 'https',
|
|
78
|
-
port: 8443,
|
|
79
|
-
hostname: '*',
|
|
80
|
-
base: '.',
|
|
81
|
-
open: 'https://localhost:8443/demo'
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
jasmine: {
|
|
86
|
-
browserAMD: {
|
|
87
|
-
src: ['dist/annyang.min.js'],
|
|
88
|
-
options: {
|
|
89
|
-
specs: 'test/spec/*Spec.js',
|
|
90
|
-
outfile: 'test/SpecRunner.html',
|
|
91
|
-
vendor: ['test/vendor/corti.js', 'test/init_corti.js'],
|
|
92
|
-
keepRunner: true,
|
|
93
|
-
template: require('grunt-template-jasmine-requirejs'),
|
|
94
|
-
templateOptions: {
|
|
95
|
-
requireConfig: {
|
|
96
|
-
baseUrl: '../dist/'
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
testAndCoverage: {
|
|
102
|
-
src: ['dist/annyang.min.js'],
|
|
103
|
-
options: {
|
|
104
|
-
specs: ['test/spec/*Spec.js'],
|
|
105
|
-
outfile: 'test/SpecRunner.html',
|
|
106
|
-
vendor: ['test/vendor/corti.js', 'test/init_corti.js'],
|
|
107
|
-
keepRunner: true,
|
|
108
|
-
template: require('grunt-template-jasmine-istanbul'),
|
|
109
|
-
templateOptions: {
|
|
110
|
-
coverage: 'test/coverage/coverage.json',
|
|
111
|
-
report: [
|
|
112
|
-
{
|
|
113
|
-
type: 'html',
|
|
114
|
-
options: {
|
|
115
|
-
dir: 'test/coverage'
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
type: 'text'
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
thresholds: {
|
|
123
|
-
statements: 80,
|
|
124
|
-
branches: 65,
|
|
125
|
-
functions: 90,
|
|
126
|
-
lines: 80
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// Load NPM tasks
|
|
135
|
-
require('load-grunt-tasks')(grunt, {
|
|
136
|
-
pattern: ['grunt-*', '!grunt-template-jasmine-istanbul']
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// Register tasks
|
|
140
|
-
grunt.registerTask('default', ['jshint', 'babel', 'uglify', 'cssmin', 'jasmine', 'markdox']);
|
|
141
|
-
grunt.registerTask('dev', ['default', 'connect', 'watch']);
|
|
142
|
-
grunt.registerTask('test', ['default']);
|
|
143
|
-
|
|
144
|
-
};
|
package/bower.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "annyang",
|
|
3
|
-
"description": "A javascript library for adding voice commands to your site, using speech recognition",
|
|
4
|
-
"main": "dist/annyang.min.js",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"annyang",
|
|
7
|
-
"annyang.js",
|
|
8
|
-
"speechrecognition",
|
|
9
|
-
"webkitspeechrecognition",
|
|
10
|
-
"voice",
|
|
11
|
-
"speech",
|
|
12
|
-
"recognition"
|
|
13
|
-
],
|
|
14
|
-
"author": "Tal Ater <tal@talater.com> (https://www.talater.com/)",
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"ignore": [
|
|
17
|
-
"**/.*",
|
|
18
|
-
"node_modules",
|
|
19
|
-
"Gruntfile.js",
|
|
20
|
-
"package.json",
|
|
21
|
-
"bower.json",
|
|
22
|
-
"demo",
|
|
23
|
-
"sites"
|
|
24
|
-
]
|
|
25
|
-
}
|
package/demo/css/main.css
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
background: url('../images/palette.png') repeat-x 0 -2px;
|
|
3
|
-
font: 14px/1.6 helvetica, sans-serif;
|
|
4
|
-
margin: 0 0;
|
|
5
|
-
padding: 0 0;
|
|
6
|
-
color: #333;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.hidden {
|
|
10
|
-
display: none;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
a, a:visited {
|
|
14
|
-
color: #90b8de;
|
|
15
|
-
text-decoration: underline;
|
|
16
|
-
}
|
|
17
|
-
a:hover {
|
|
18
|
-
text-decoration: none;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
h2 {
|
|
22
|
-
font-size: 2em;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
pre code a, pre code a:visited {
|
|
26
|
-
color: #00f;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
#tpsreport {
|
|
30
|
-
position: fixed;
|
|
31
|
-
z-index: 1000;
|
|
32
|
-
bottom: -500px;
|
|
33
|
-
right: 10px;
|
|
34
|
-
-webkit-transform: rotate(-15deg);
|
|
35
|
-
-moz-transform: rotate(-15deg);
|
|
36
|
-
-ms-transform: rotate(-15deg);
|
|
37
|
-
-o-transform: rotate(-15deg);
|
|
38
|
-
transform: rotate(-15deg);
|
|
39
|
-
-webkit-box-shadow: 2px 1px 6px 1px #555;
|
|
40
|
-
box-shadow: 2px 1px 6px 1px #555;
|
|
41
|
-
}
|
|
42
|
-
#section_header h2 {
|
|
43
|
-
margin: 5px 0;
|
|
44
|
-
font-size: 20px;
|
|
45
|
-
line-height: 30px;
|
|
46
|
-
font-weight: 400;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
pre code {
|
|
50
|
-
overflow: scroll;
|
|
51
|
-
padding: 10px 20px!important;
|
|
52
|
-
margin-left: 50px;
|
|
53
|
-
}
|
|
54
|
-
h1 em {
|
|
55
|
-
font-weight: 800;
|
|
56
|
-
margin-right: 9px;
|
|
57
|
-
}
|
|
58
|
-
h1 {
|
|
59
|
-
font-weight: 400;
|
|
60
|
-
font-size: 40px;
|
|
61
|
-
line-height: 41px;
|
|
62
|
-
margin: 25px 0;
|
|
63
|
-
}
|
|
64
|
-
p em {
|
|
65
|
-
font-weight: 600;
|
|
66
|
-
font-size: 23px;
|
|
67
|
-
line-height: 45px;
|
|
68
|
-
}
|
|
69
|
-
p.voice_instructions {
|
|
70
|
-
background: url('../images/mini_icon_say.png') no-repeat 0 6px;
|
|
71
|
-
padding-left: 24px;
|
|
72
|
-
}
|
|
73
|
-
#hello {
|
|
74
|
-
font-size: 2.5em;
|
|
75
|
-
font-weight: 600;
|
|
76
|
-
}
|
|
77
|
-
#flickrLoader p {
|
|
78
|
-
background: url('../images/flickr.png') no-repeat 0 7px;
|
|
79
|
-
padding-left: 39px;
|
|
80
|
-
}
|
|
81
|
-
#flickrLoader {
|
|
82
|
-
height: 40px;
|
|
83
|
-
}
|
|
84
|
-
section {
|
|
85
|
-
padding: 3% 10%;
|
|
86
|
-
font-size: 20px;
|
|
87
|
-
line-height: 30px;
|
|
88
|
-
font-weight: 400;
|
|
89
|
-
}
|
|
90
|
-
#section_header img {
|
|
91
|
-
margin: 30px 50px 0;
|
|
92
|
-
}
|
|
93
|
-
#section_header {
|
|
94
|
-
padding-top: 70px;
|
|
95
|
-
text-align: center;
|
|
96
|
-
}
|
|
97
|
-
#section_hello {
|
|
98
|
-
background-color: #1abc96;
|
|
99
|
-
color: #fff;
|
|
100
|
-
}
|
|
101
|
-
#section_image_search {
|
|
102
|
-
background-color: #407eb8;
|
|
103
|
-
color: #fff;
|
|
104
|
-
}
|
|
105
|
-
#section_biz_use {
|
|
106
|
-
background-color: #95a5a6;
|
|
107
|
-
color: #fff;
|
|
108
|
-
}
|
|
109
|
-
#section_footer {
|
|
110
|
-
background: #000 url('../images/footer_background.jpg') repeat-x top center;
|
|
111
|
-
background-size: auto 100%;
|
|
112
|
-
text-align: center;
|
|
113
|
-
background-color: #34495d;
|
|
114
|
-
color: #fff;
|
|
115
|
-
padding: 2% 10%;
|
|
116
|
-
}
|
|
117
|
-
div.social{
|
|
118
|
-
margin-top: 40px;
|
|
119
|
-
}
|
|
120
|
-
div.copyright{
|
|
121
|
-
margin-top: 50px;
|
|
122
|
-
font-size: 12px;
|
|
123
|
-
line-height: 18px;
|
|
124
|
-
font-weight: 100;
|
|
125
|
-
}
|
|
126
|
-
div#unsupported {
|
|
127
|
-
text-align: center;
|
|
128
|
-
position: fixed;
|
|
129
|
-
bottom: 0;
|
|
130
|
-
width: 100%;
|
|
131
|
-
max-height: 60%;
|
|
132
|
-
color: #b94a48;
|
|
133
|
-
background-color: #f2dede;
|
|
134
|
-
border: 1px solid #eed3d7;
|
|
135
|
-
-webkit-box-shadow: -32px -50px 109px rgba(0, 0, 0, 0.92);
|
|
136
|
-
-moz-box-shadow: -32px -50px 109px rgba(0, 0, 0, 0.92);
|
|
137
|
-
box-shadow: -32px -50px 109px rgba(0, 0, 0, 0.92);
|
|
138
|
-
font-size: 1.3em;
|
|
139
|
-
line-height: 1.4em;
|
|
140
|
-
padding-bottom: 10px;
|
|
141
|
-
}
|
|
142
|
-
div#unsupported a, div#unsupported a:visited {
|
|
143
|
-
color: #b94a48;
|
|
144
|
-
font-weight: bold;
|
|
145
|
-
}
|
|
146
|
-
div#unsupported h4 {
|
|
147
|
-
font-size: 1.5em;
|
|
148
|
-
margin: 15px 0 10px 0;
|
|
149
|
-
}
|
|
150
|
-
div#unsupported p {
|
|
151
|
-
line-height: 20px;
|
|
152
|
-
}
|
package/demo/css/main.min.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
body{background:url(../images/palette.png) repeat-x 0 -2px;font:14px/1.6 helvetica,sans-serif;margin:0 0;padding:0 0;color:#333}.hidden{display:none}a,a:visited{color:#90b8de;text-decoration:underline}a:hover{text-decoration:none}h2{font-size:2em}pre code a,pre code a:visited{color:#00f}#tpsreport{position:fixed;z-index:1000;bottom:-500px;right:10px;-webkit-transform:rotate(-15deg);-moz-transform:rotate(-15deg);-ms-transform:rotate(-15deg);-o-transform:rotate(-15deg);transform:rotate(-15deg);-webkit-box-shadow:2px 1px 6px 1px #555;box-shadow:2px 1px 6px 1px #555}#section_header h2{margin:5px 0;font-size:20px;line-height:30px;font-weight:400}pre code{overflow:scroll;padding:10px 20px!important;margin-left:50px}h1 em{font-weight:800;margin-right:9px}h1{font-weight:400;font-size:40px;line-height:41px;margin:25px 0}p em{font-weight:600;font-size:23px;line-height:45px}p.voice_instructions{background:url(../images/mini_icon_say.png) no-repeat 0 6px;padding-left:24px}#hello{font-size:2.5em;font-weight:600}#flickrLoader p{background:url(../images/flickr.png) no-repeat 0 7px;padding-left:39px}#flickrLoader{height:40px}section{padding:3% 10%;font-size:20px;line-height:30px;font-weight:400}#section_header img{margin:30px 50px 0}#section_header{padding-top:70px;text-align:center}#section_hello{background-color:#1abc96;color:#fff}#section_image_search{background-color:#407eb8;color:#fff}#section_biz_use{background-color:#95a5a6;color:#fff}#section_footer{background:#000 url(../images/footer_background.jpg) repeat-x top center;background-size:auto 100%;text-align:center;background-color:#34495d;color:#fff;padding:2% 10%}div.social{margin-top:40px}div.copyright{margin-top:50px;font-size:12px;line-height:18px;font-weight:100}div#unsupported{text-align:center;position:fixed;bottom:0;width:100%;max-height:60%;color:#b94a48;background-color:#f2dede;border:1px solid #eed3d7;-webkit-box-shadow:-32px -50px 109px rgba(0,0,0,.92);-moz-box-shadow:-32px -50px 109px rgba(0,0,0,.92);box-shadow:-32px -50px 109px rgba(0,0,0,.92);font-size:1.3em;line-height:1.4em;padding-bottom:10px}div#unsupported a,div#unsupported a:visited{color:#b94a48;font-weight:700}div#unsupported h4{font-size:1.5em;margin:15px 0 10px 0}div#unsupported p{line-height:20px}pre code{display:block;padding:.5em;background:#f0f0f0}pre .clojure .built_in,pre .lisp .title,pre .nginx .title,pre .subst,pre .tag .title,pre code{color:#000}pre .addition,pre .aggregate,pre .apache .cbracket,pre .apache .tag,pre .bash .variable,pre .constant,pre .django .variable,pre .erlang_repl .function_or_atom,pre .flow,pre .markdown .header,pre .parent,pre .preprocessor,pre .ruby .symbol,pre .ruby .symbol .string,pre .rules .value,pre .rules .value .number,pre .smalltalk .class,pre .stream,pre .string,pre .tag .value,pre .template_tag,pre .tex .command,pre .tex .special,pre .title{color:#800}pre .annotation,pre .chunk,pre .comment,pre .diff .header,pre .markdown .blockquote,pre .template_comment{color:#888}pre .change,pre .date,pre .go .constant,pre .literal,pre .markdown .bullet,pre .markdown .link_url,pre .number,pre .regexp,pre .smalltalk .char,pre .smalltalk .symbol{color:#080}pre .apache .sqbracket,pre .array,pre .attr_selector,pre .clojure .attribute,pre .coffeescript .property,pre .decorator,pre .deletion,pre .doctype,pre .envvar,pre .erlang_repl .reserved,pre .filter .argument,pre .important,pre .javadoc,pre .label,pre .localvars,pre .markdown .link_label,pre .nginx .built_in,pre .pi,pre .prompt,pre .pseudo,pre .ruby .string,pre .shebang,pre .tex .formula,pre .vhdl .attribute{color:#88f}pre .aggregate,pre .apache .tag,pre .bash .variable,pre .built_in,pre .css .tag,pre .go .typename,pre .id,pre .javadoctag,pre .keyword,pre .markdown .strong,pre .phpdoc,pre .request,pre .smalltalk .class,pre .status,pre .tex .command,pre .title,pre .winutils,pre .yardoctag{font-weight:700}pre .markdown .emphasis{font-style:italic}pre .nginx .built_in{font-weight:400}pre .coffeescript .javascript,pre .javascript .xml,pre .tex .formula,pre .xml .cdata,pre .xml .css,pre .xml .javascript,pre .xml .vbscript{opacity:.5}pre code{display:block;padding:.5em;color:#333;background:#f8f8ff}pre .comment,pre .diff .header,pre .javadoc,pre .template_comment{color:#998;font-style:italic}pre .css .rule .keyword,pre .javascript .title,pre .keyword,pre .nginx .title,pre .request,pre .status,pre .subst,pre .winutils{color:#333;font-weight:700}pre .hexcolor,pre .number,pre .ruby .constant{color:#099}pre .phpdoc,pre .string,pre .tag .value,pre .tex .formula{color:#d14}pre .id,pre .title{color:#900;font-weight:700}pre .clojure .title,pre .javascript .title,pre .lisp .title,pre .subst{font-weight:400}pre .class .title,pre .haskell .type,pre .tex .command,pre .vhdl .literal{color:#458;font-weight:700}pre .django .tag .keyword,pre .rules .property,pre .tag,pre .tag .title{color:navy;font-weight:400}pre .attribute,pre .lisp .body,pre .variable{color:teal}pre .regexp{color:#009926}pre .class{color:#458;font-weight:700}pre .lisp .keyword,pre .prompt,pre .ruby .symbol .string,pre .symbol,pre .tex .special{color:#990073}pre .built_in,pre .clojure .built_in,pre .lisp .title{color:#0086b3}pre .cdata,pre .doctype,pre .pi,pre .preprocessor,pre .shebang{color:#999;font-weight:700}pre .deletion{background:#fdd}pre .addition{background:#dfd}pre .diff .change{background:#0086b3}pre .chunk{color:#aaa}
|
package/demo/images/flickr.png
DELETED
|
Binary file
|
|
Binary file
|
package/demo/images/icon_js.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/demo/images/palette.png
DELETED
|
Binary file
|
package/demo/images/tpscover.jpg
DELETED
|
Binary file
|
package/demo/index.html
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>annyang! Easily add speech recognition to your site</title>
|
|
5
|
-
<meta name="description" content="annyang is a JavaScript SpeechRecognition library that makes adding voice commands to your site super-easy. Let your users control your site with their voice." />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<meta property="og:image" content="https://www.talater.com/annyang/images/icon_speech.png"/>
|
|
8
|
-
<meta property="og:title" content="annyang! Easily add speech recognition to your site"/>
|
|
9
|
-
<meta property="og:url" content="https://www.talater.com/annyang/"/>
|
|
10
|
-
<meta property="og:site_name" content="annyang"/>
|
|
11
|
-
<meta property="fb:admins" content="568390229" />
|
|
12
|
-
<script src="annyang.min.js"></script>
|
|
13
|
-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
|
14
|
-
<script>
|
|
15
|
-
"use strict";
|
|
16
|
-
|
|
17
|
-
// first we make sure annyang started succesfully
|
|
18
|
-
if (annyang) {
|
|
19
|
-
|
|
20
|
-
// define the functions our commands will run.
|
|
21
|
-
var hello = function() {
|
|
22
|
-
$("#hello").slideDown("slow");
|
|
23
|
-
scrollTo("#section_hello");
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
var showFlickr = function(tag) {
|
|
27
|
-
$('#flickrGallery').show();
|
|
28
|
-
$('#flickrLoader p').text('Searching for '+tag).fadeIn('fast');
|
|
29
|
-
var url = '//api.flickr.com/services/rest/?method=flickr.photos.search&api_key=a828a6571bb4f0ff8890f7a386d61975&sort=interestingness-desc&per_page=9&format=json&callback=jsonFlickrApi&tags='+tag;
|
|
30
|
-
$.ajax({
|
|
31
|
-
type: 'GET',
|
|
32
|
-
url: url,
|
|
33
|
-
async: false,
|
|
34
|
-
jsonpCallback: 'jsonFlickrApi',
|
|
35
|
-
contentType: "application/json",
|
|
36
|
-
dataType: 'jsonp'
|
|
37
|
-
});
|
|
38
|
-
scrollTo("#section_image_search");
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
var jsonFlickrApi = function(results) {
|
|
42
|
-
$('#flickrLoader p').fadeOut('slow');
|
|
43
|
-
var photos = results.photos.photo;
|
|
44
|
-
$.each(photos, function(index, photo) {
|
|
45
|
-
$(document.createElement("img"))
|
|
46
|
-
.attr({ src: '//farm'+photo.farm+'.staticflickr.com/'+photo.server+'/'+photo.id+'_'+photo.secret+'_s.jpg' })
|
|
47
|
-
.addClass("flickrGallery")
|
|
48
|
-
.appendTo(flickrGallery);
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var showTPS = function(type) {
|
|
53
|
-
$('#tpsreport').show().animate({
|
|
54
|
-
bottom: '-100px'
|
|
55
|
-
}).delay('2000').animate({
|
|
56
|
-
bottom: '-500px'
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
var getStarted = function() {
|
|
61
|
-
window.location.href = 'https://github.com/TalAter/annyang';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// define our commands.
|
|
65
|
-
// * The key is the phrase you want your users to say.
|
|
66
|
-
// * The value is the action to do.
|
|
67
|
-
// You can pass a function, a function name (as a string), or write your function as part of the commands object.
|
|
68
|
-
var commands = {
|
|
69
|
-
'hello (there)': hello,
|
|
70
|
-
'show me *search': showFlickr,
|
|
71
|
-
'show :type report': showTPS,
|
|
72
|
-
'let\'s get started': getStarted,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// OPTIONAL: activate debug mode for detailed logging in the console
|
|
76
|
-
annyang.debug();
|
|
77
|
-
|
|
78
|
-
// Add voice commands to respond to
|
|
79
|
-
annyang.addCommands(commands);
|
|
80
|
-
|
|
81
|
-
// OPTIONAL: Set a language for speech recognition (defaults to English)
|
|
82
|
-
// For a full list of language codes, see the documentation:
|
|
83
|
-
// https://github.com/TalAter/annyang/blob/master/docs/FAQ.md#what-languages-are-supported
|
|
84
|
-
annyang.setLanguage('en');
|
|
85
|
-
|
|
86
|
-
// Start listening. You can call this here, or attach this call to an event, button, etc.
|
|
87
|
-
annyang.start();
|
|
88
|
-
} else {
|
|
89
|
-
$(document).ready(function() {
|
|
90
|
-
$('#unsupported').fadeIn('fast');
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var scrollTo = function(identifier, speed) {
|
|
95
|
-
$('html, body').animate({
|
|
96
|
-
scrollTop: $(identifier).offset().top
|
|
97
|
-
}, speed || 1000);
|
|
98
|
-
}
|
|
99
|
-
</script>
|
|
100
|
-
<link rel="stylesheet" href="css/main.min.css" />
|
|
101
|
-
</head>
|
|
102
|
-
<body>
|
|
103
|
-
<section id="section_header">
|
|
104
|
-
<h1><em>annyang!</em> SpeechRecognition that just works</h1>
|
|
105
|
-
<h2>annyang is a tiny javascript library that lets your visitors control your site with voice commands.</h2>
|
|
106
|
-
<h2>annyang supports multiple languages, has no dependencies, weighs just 2kb and is free to use.</h2>
|
|
107
|
-
<img src="images/icon_user.png">
|
|
108
|
-
<img src="images/icon_speech.png">
|
|
109
|
-
<img src="images/icon_js.png">
|
|
110
|
-
</section>
|
|
111
|
-
<section id="section_hello">
|
|
112
|
-
<p><em>Go ahead, try it…</em></p>
|
|
113
|
-
<p class="voice_instructions">Say "Hello!"</p>
|
|
114
|
-
<p id="hello" class="hidden">Annyang!</p>
|
|
115
|
-
</section>
|
|
116
|
-
<section id="section_image_search">
|
|
117
|
-
<p><em>Let's try something more interesting…</em></p>
|
|
118
|
-
<p class="voice_instructions">Say "Show me cute kittens!"</p>
|
|
119
|
-
<p class="voice_instructions">Say "Show me Arches National Park!"</p>
|
|
120
|
-
<p class="voice_instructions">Now go wild. Say "Show me…" and make your demands!</p>
|
|
121
|
-
<div id="flickrLoader"><p></p></div>
|
|
122
|
-
<div id="flickrGallery" class="hidden"></div>
|
|
123
|
-
</section>
|
|
124
|
-
<section id="section_biz_use">
|
|
125
|
-
<p><em>That's cool, but in the real world it's not all kittens and hello world.</em></p>
|
|
126
|
-
<p class="voice_instructions">No problem, say "Show TPS report"</p>
|
|
127
|
-
<img src="images/tpscover.jpg" id="tpsreport" class="hidden">
|
|
128
|
-
</section>
|
|
129
|
-
<section id="section_code_sample_1">
|
|
130
|
-
<p><em>How did you do that?</em></p>
|
|
131
|
-
<p>Simple. Here is all the code needed to achieve that:</p>
|
|
132
|
-
<pre><code><script src="<a href="//cdnjs.cloudflare.com/ajax/libs/annyang/2.6.1/annyang.min.js">//cdnjs.cloudflare.com/ajax/libs/annyang/2.6.1/annyang.min.js</a>"></script>
|
|
133
|
-
<script>
|
|
134
|
-
if (annyang) {
|
|
135
|
-
// Let's define our first command. First the text we expect, and then the function it should call
|
|
136
|
-
var commands = {
|
|
137
|
-
'show tps report': function() {
|
|
138
|
-
$('#tpsreport').animate({bottom: '-100px'});
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// Add our commands to annyang
|
|
143
|
-
annyang.addCommands(commands);
|
|
144
|
-
|
|
145
|
-
// Start listening. You can call this here, or attach this call to an event, button, etc.
|
|
146
|
-
annyang.start();
|
|
147
|
-
}
|
|
148
|
-
</script></code></pre>
|
|
149
|
-
</section>
|
|
150
|
-
<section id="section_named_and_splats">
|
|
151
|
-
<p><em>What about more complicated commands?</em></p>
|
|
152
|
-
<p>annyang understands commands with <strong>named variables</strong>, <strong>splats</strong>, and <strong>optional words</strong>.</p>
|
|
153
|
-
<p>Use <strong>named variables</strong> for one word arguments in your command.</p>
|
|
154
|
-
<p>Use <strong>splats</strong> to capture multi-word text at the end of your command (greedy).</p>
|
|
155
|
-
<p>Use <strong>optional words or phrases</strong> to define a part of the command as optional.</p>
|
|
156
|
-
<pre><code><script>
|
|
157
|
-
var commands = {
|
|
158
|
-
// annyang will capture anything after a splat (*) and pass it to the function.
|
|
159
|
-
// e.g. saying "Show me Batman and Robin" is the same as calling showFlickr('Batman and Robin');
|
|
160
|
-
'show me *tag': showFlickr,
|
|
161
|
-
|
|
162
|
-
// A named variable is a one word variable, that can fit anywhere in your command.
|
|
163
|
-
// e.g. saying "calculate October stats" will call calculateStats('October');
|
|
164
|
-
'calculate :month stats': calculateStats,
|
|
165
|
-
|
|
166
|
-
// By defining a part of the following command as optional, annyang will respond to both:
|
|
167
|
-
// "say hello to my little friend" as well as "say hello friend"
|
|
168
|
-
'say hello (to my little) friend': greeting
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
var showFlickr = function(tag) {
|
|
172
|
-
var url = 'http://api.flickr.com/services/rest/?tags='+tag;
|
|
173
|
-
$.getJSON(url);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
var calculateStats = function(month) {
|
|
177
|
-
$('#stats').text('Statistics for '+month);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
var greeting = function() {
|
|
181
|
-
$('#greeting').text('Hello!');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
</script></code></pre>
|
|
185
|
-
</section>
|
|
186
|
-
<section id="section_docs">
|
|
187
|
-
<p><em>What about browser support?</em></p>
|
|
188
|
-
<p>annyang plays nicely with all browsers, progressively enhancing browsers that support SpeechRecognition, while leaving users with older browsers unaffected.</p>
|
|
189
|
-
</section>
|
|
190
|
-
<section id="section_footer">
|
|
191
|
-
<h2>Ready to get started?</h2>
|
|
192
|
-
<p>Grab the latest version of <a href="https://github.com/TalAter/annyang">annyang.min.js</a>, drop it in your html, and start adding commands.</p>
|
|
193
|
-
<p>You can also visit annyang on <a href="https://github.com/TalAter/annyang">GitHub</a>, and read the full <a href="https://github.com/TalAter/annyang/blob/master/docs/README.md">API documentation</a> or <a href="https://github.com/TalAter/annyang/blob/master/docs/FAQ.md">FAQ</a>.</p>
|
|
194
|
-
<div class="social">
|
|
195
|
-
<iframe src="vendor/html/github-btn.html?user=TalAter&repo=annyang&type=watch&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="152px" height="30px"></iframe>
|
|
196
|
-
<span style="margin-left: 25px;"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.annyangjs.com" data-counturl="https://www.talater.com/annyang" data-via="TalAter" data-size="large" data-lang="en" data-count="horizontal" data-text="annyang! A javascript library that lets your users talk to your site, giving it voice commands">Tweet</a></span>
|
|
197
|
-
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
|
198
|
-
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.talater.com%2Fannyang%2F&width=134&layout=button_count&action=like&show_faces=false&share=true&height=46&appId=263514670331109" width="134" height="25" style="border:none;overflow:hidden;margin-left: 30px" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
|
|
199
|
-
</div>
|
|
200
|
-
<div class="copyright">
|
|
201
|
-
<p>© 2016 Tal Ater. All rights reserved. The annyang source code is free to use under the <a href="https://raw.github.com/TalAter/annyang/master/LICENSE">MIT license</a>.</p>
|
|
202
|
-
<p>Tal Ater retains creative control, spin-off rights and theme park approval for Mr. Banana Grabber, Baby Banana Grabber, and any other Banana Grabber family character that might emanate there from.</p>
|
|
203
|
-
</div>
|
|
204
|
-
</section>
|
|
205
|
-
<div id="unsupported" class="hidden">
|
|
206
|
-
<h4>It looks like your browser doesn't support speech recognition.</h4>
|
|
207
|
-
<p>annyang plays nicely with all browsers, progressively enhancing modern browsers that support the SpeechRecognition standard, while leaving users with older browsers unaffected.</p>
|
|
208
|
-
<p>Please visit <a href="http://www.annyangjs.com/">http://www.annyangjs.com/</a> in a desktop browser like Chrome.</p>
|
|
209
|
-
</div>
|
|
210
|
-
<script>
|
|
211
|
-
var _gaq = _gaq || [];
|
|
212
|
-
_gaq.push(['_setAccount', 'UA-24775009-1']);
|
|
213
|
-
_gaq.push(['_trackPageview']);
|
|
214
|
-
(function() {
|
|
215
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
216
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
217
|
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
218
|
-
})();
|
|
219
|
-
</script>
|
|
220
|
-
<script src="./vendor/js/highlight.pack.js"></script>
|
|
221
|
-
<script>
|
|
222
|
-
hljs.initHighlightingOnLoad();
|
|
223
|
-
</script>
|
|
224
|
-
</body>
|
|
225
|
-
</html>
|