Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
g1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
76
Issues
76
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cto
g1
Commits
5f407404
Commit
5f407404
authored
Aug 09, 2018
by
S Anand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create scaffolding
parent
498381d5
Pipeline
#57576
failed with stage
in 1 minute and 15 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
12 deletions
+119
-12
index-speechplayer.js
index-speechplayer.js
+7
-0
index.js
index.js
+1
-0
rollup.config.js
rollup.config.js
+20
-12
src/speechplayer.js
src/speechplayer.js
+37
-0
test/test-speechplayer.html
test/test-speechplayer.html
+54
-0
No files found.
index-speechplayer.js
0 → 100644
View file @
5f407404
import
{
speechplayer
}
from
'
./src/speechplayer.js
'
if
(
typeof
jQuery
!=
'
undefined
'
)
{
jQuery
.
extend
(
jQuery
.
fn
,
{
speechplayer
:
speechplayer
})
}
index.js
View file @
5f407404
...
...
@@ -6,6 +6,7 @@ export { datafilter } from './index-datafilter.js'
export
{
sanddance
}
from
'
./src/sanddance.js
'
import
'
./index-highlight.js
'
import
'
./index-template.js
'
import
'
./index-speechplayer.js
'
import
'
./index-formhandler.js
'
import
'
./index-dropdown.js
'
import
'
./index-event.js
'
...
...
rollup.config.js
View file @
5f407404
...
...
@@ -53,6 +53,11 @@ export default [
plugins
:
[
uglify
()],
output
:
{
file
:
"
dist/template.min.js
"
,
format
:
"
umd
"
,
name
:
"
g1
"
}
},
{
input
:
"
index-speechplayer
"
,
plugins
:
[
uglify
()],
output
:
{
file
:
"
dist/speechplayer.min.js
"
,
format
:
"
umd
"
,
name
:
"
g1
"
}
},
{
input
:
"
index-event
"
,
plugins
:
[
uglify
()],
...
...
@@ -65,11 +70,12 @@ export default [
},
{
input
:
"
index-mapviewer
"
,
plugins
:
[
resolve
(),
commonjs
(),
babel
(
babelrc
({
config
:
babelConfig
,
exclude
:
'
node_modules/**
'
})),
process
.
env
.
npm_lifecycle_event
==
'
dev
'
?
''
:
uglify
()
],
plugins
:
[
resolve
(),
commonjs
(),
babel
(
babelrc
({
config
:
babelConfig
,
exclude
:
'
node_modules/**
'
})),
process
.
env
.
npm_lifecycle_event
==
'
dev
'
?
''
:
uglify
()
],
output
:
{
file
:
"
dist/mapviewer.min.js
"
,
format
:
"
umd
"
,
name
:
"
g1
"
,
globals
:
{
leaflet
:
'
L
'
,
...
...
@@ -91,13 +97,15 @@ export default [
},
{
input
:
"
index-dropdown
"
,
plugins
:
[
resolve
(),
commonjs
(),
htmlparts
(
'
src/dropdown.template.html
'
)],
plugins
:
[
resolve
(),
commonjs
(),
htmlparts
(
'
src/dropdown.template.html
'
)
],
output
:
{
file
:
"
dist/dropdown.min.js
"
,
format
:
"
umd
"
,
name
:
"
g1
"
}
file
:
"
dist/dropdown.min.js
"
,
format
:
"
umd
"
,
name
:
"
g1
"
}
}
]
src/speechplayer.js
0 → 100644
View file @
5f407404
export
function
speechplayer
(
options
)
{
options
=
options
||
{}
var
synth
=
window
.
speechSynthesis
if
(
!
synth
)
throw
new
Error
(
'
SpeechSynthesis not supported on this browser
'
)
// playlist is a list of {text: ..., node: ...}. node: is optional
var
playlist
=
[]
var
speech
=
{}
speech
.
text
=
function
(
text
)
{
playlist
.
splice
(
0
,
playlist
.
length
)
// Add text as an array
if
(
Array
.
isArray
(
text
))
text
.
forEach
(
function
(
item
)
{
playlist
.
push
({
text
:
item
})
})
else
playlist
.
push
({
text
:
text
})
return
speech
}
speech
.
node
=
function
(
selector
)
{
playlist
.
splice
(
0
,
playlist
.
length
)
var
nodes
=
Array
.
prototype
.
slice
.
call
(
document
.
querySelectorAll
(
selector
))
nodes
.
forEach
(
function
(
node
)
{
playlist
.
push
({
text
:
node
.
textContent
,
node
:
node
})
})
return
speech
}
speech
.
playlist
=
playlist
speech
.
play
=
function
()
{
// TODO
}
return
speech
}
test/test-speechplayer.html
0 → 100644
View file @
5f407404
<!DOCTYPE html>
<html>
<head>
<title>
speechplayer tests
</title>
<script
src=
"../node_modules/jquery/dist/jquery.min.js"
></script>
<script
src=
"../dist/speechplayer.min.js"
></script>
<script
src=
"tape.js"
></script>
</head>
<body>
<script>
tape
.
onFinish
(
function
()
{
window
.
renderComplete
=
true
})
</script>
<div
class=
"player"
>
<div
class=
"play"
>
▶
</div>
</div>
<div
class=
"test-node"
>
This is a single sentence that will be played.
</div>
<script>
var
speech
=
$
(
'
.player
'
).
speechplayer
()
tape
(
'
speech stores text as a single array element
'
,
function
(
t
)
{
var
text
=
'
Set the text to be played explicitly.
'
speech
.
text
(
text
)
t
.
equal
(
speech
.
playlist
.
length
,
1
)
t
.
equal
(
speech
.
playlist
[
0
].
text
,
text
)
t
.
end
()
})
tape
(
'
speech stores text as multiple array element
'
,
function
(
t
)
{
speech
.
text
([
'
One
'
,
'
Two
'
,
'
Three
'
])
t
.
equal
(
speech
.
playlist
.
length
,
3
)
t
.
equal
(
speech
.
playlist
[
0
].
text
,
'
One
'
)
t
.
equal
(
speech
.
playlist
[
1
].
text
,
'
Two
'
)
t
.
equal
(
speech
.
playlist
[
2
].
text
,
'
Three
'
)
t
.
end
()
})
tape
(
'
speech stores single node content
'
,
function
(
t
)
{
speech
.
node
(
'
.test-node
'
)
var
node
=
document
.
querySelector
(
'
.test-node
'
)
t
.
equal
(
speech
.
playlist
.
length
,
1
)
t
.
equal
(
speech
.
playlist
[
0
].
text
,
node
.
textContent
)
t
.
equal
(
speech
.
playlist
[
0
].
node
,
node
)
t
.
end
()
})
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment