Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
1ef1d213
Commit
1ef1d213
authored
May 27, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete audioplayer
parent
0a294037
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
45 deletions
+64
-45
src/audioplayer/audioplayer.js
src/audioplayer/audioplayer.js
+59
-30
src/audioplayer/index.html
src/audioplayer/index.html
+1
-3
src/audioplayer_animation/animation.js
src/audioplayer_animation/animation.js
+3
-3
src/audioplayer_log_message/log.js
src/audioplayer_log_message/log.js
+0
-8
src/audioplayer_title/title.js
src/audioplayer_title/title.js
+1
-1
No files found.
src/audioplayer/audioplayer.js
View file @
1ef1d213
/*global window, rJS, RSVP, console */
/*global window, rJS, RSVP, console
, $, jQuery
*/
/*jslint nomen: true*/
(
function
(
window
,
rJS
)
{
(
function
(
window
,
rJS
,
$
)
{
"
use strict
"
;
function
AnimationClass
(
control
)
{
this
.
canvas
=
null
;
...
...
@@ -86,9 +86,6 @@
),
g
.
getDeclaredGadget
(
"
title
"
),
g
.
getDeclaredGadget
(
"
log
"
)
])
.
then
(
function
(
all_param
)
{
...
...
@@ -97,15 +94,65 @@
time
=
all_param
[
2
],
volume
=
all_param
[
3
],
title
=
all_param
[
4
],
log
=
all_param
[
5
],
animationObject
=
new
AnimationClass
(
control
);
window
.
setInterval
(
function
()
{
//double click to play
control
.
getCurrentTime
()
.
then
(
function
(
e
)
{
time
.
setValue
(
e
);
});
},
1000
);
volume
.
setMax
(
3
);
function
nextToPlay
()
{
g
.
currentPlayId
=
Math
.
floor
(
Math
.
random
()
*
g
.
playlist
.
length
);
control
.
setSong
(
g
.
playlist
[
g
.
currentPlayId
]);
control
.
playSong
();
animation
.
showAnimation
();
title
.
setMessage
(
g
.
playlist
[
g
.
currentPlayId
].
name
);
control
.
getTotalTime
()
.
then
(
function
(
e
)
{
time
.
setMax
(
e
);
});
}
input_context
.
onchange
=
function
()
{
var
tmp
;
for
(
tmp
=
0
;
tmp
<
input_context
.
files
.
length
;
tmp
+=
1
)
{
g
.
playlist
.
push
(
input_context
.
files
[
tmp
]);
var
tmp
,
index
,
found
;
for
(
index
=
0
;
index
<
input_context
.
files
.
length
;
index
+=
1
)
{
found
=
false
;
for
(
tmp
=
0
;
tmp
<
g
.
playlist
.
length
;
tmp
+=
1
)
{
if
(
g
.
playlist
[
tmp
].
name
===
input_context
.
files
[
index
].
name
)
{
found
=
true
;
break
;
}
}
if
(
found
===
false
)
{
g
.
playlist
.
push
(
input_context
.
files
[
index
]);
}
}
};
//time configure
time
.
setAction
(
'
onclick
'
,
function
(
e
)
{
time
.
getPositionValue
(
e
).
then
(
function
(
value
)
{
control
.
setCurrentTime
(
value
);
time
.
setValue
(
value
);
});
});
//volume configure
volume
.
setMax
(
3
);
volume
.
setAction
(
'
onclick
'
,
function
(
e
)
{
volume
.
getPositionValue
(
e
).
then
(
function
(
value
)
{
volume
.
setValue
(
value
);
control
.
setVolume
(
value
);
});
});
//control configure
control
.
onended
(
nextToPlay
);
//animation configure
animation
.
setAnimation
(
animationObject
);
animation
.
setAction
(
'
onclick
'
,
function
()
{
control
.
isPaused
()
...
...
@@ -117,28 +164,10 @@
}
});
});
animation
.
setAction
(
'
ondblclick
'
,
function
()
{
g
.
currentPlayId
=
Math
.
floor
(
Math
.
random
()
*
g
.
playlist
.
length
);
control
.
setSong
(
g
.
playlist
[
g
.
currentPlayId
]);
control
.
playSong
();
animation
.
showAnimation
();
title
.
setMessage
(
g
.
playlist
[
g
.
currentPlayId
].
name
);
window
.
setInterval
(
function
()
{
//double click to play
control
.
getCurrentTime
()
.
then
(
function
(
e
)
{
time
.
setValue
(
e
);
});
},
1000
);
control
.
getTotalTime
()
.
then
(
function
(
e
)
{
time
.
setMax
(
e
);
});
});
log
.
showMessage
(
volume
);
animation
.
setAction
(
'
ondblclick
'
,
nextToPlay
);
})
.
fail
(
function
(
e
)
{
console
.
log
(
"
[ERROR]:
"
+
e
);
});
});
}(
window
,
rJS
));
}(
window
,
rJS
,
jQuery
));
src/audioplayer/index.html
View file @
1ef1d213
...
...
@@ -7,6 +7,7 @@
<!-- renderjs -->
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquery.relative_dest %>"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"./audioplayer.js"
type=
"text/javascript"
></script>
...
...
@@ -36,9 +37,6 @@
<div
class =
"title"
data-gadget-url=
"../audioplayer_title/index.html"
data-gadget-scope=
"title"
>
</div>
<div
class =
"logmessgae"
data-gadget-url=
"../audioplayer_log_message/index.html"
data-gadget-scope=
"log"
>
</div>
</body>
</html>
src/audioplayer_animation/animation.js
View file @
1ef1d213
/*global window, rJS, RSVP, console, document, JSON, Uint8Array */
/*jslint
maxlen:80,
nomen: true */
/*jslint nomen: true */
(
function
(
window
,
rJS
)
{
...
...
@@ -16,10 +16,10 @@
.
declareMethod
(
'
stopAnimation
'
,
function
()
{
this
.
animation
.
stop
();
})
.
declareMethod
(
'
setAction
'
,
function
(
type
,
A
ction
)
{
.
declareMethod
(
'
setAction
'
,
function
(
type
,
a
ction
)
{
var
that
=
this
;
that
.
canvas
[
type
]
=
function
()
{
A
ction
.
call
(
that
);
a
ction
.
call
(
that
);
that
.
showAnimation
();
};
});
...
...
src/audioplayer_log_message/log.js
View file @
1ef1d213
...
...
@@ -34,13 +34,5 @@
gk
.
ready
(
function
(
g
)
{
g
.
log
=
g
.
__element
.
getElementsByTagName
(
'
div
'
)[
0
];
var
node
=
document
.
createElement
(
"
pre
"
);
node
.
setAttribute
(
"
style
"
,
"
background-color:
"
+
logGetColor
()
+
"
;margin:0;padding:0;
"
);
node
.
textContent
=
"
use for show message
"
;
g
.
log
.
appendChild
(
node
);
});
}(
window
,
rJS
));
src/audioplayer_title/title.js
View file @
1ef1d213
...
...
@@ -7,7 +7,7 @@
var
gk
=
rJS
(
window
),
scroll
;
function
BannerObject
()
{
this
.
msg
=
"
it's a test
"
;
this
.
msg
=
"
"
;
this
.
out
=
"
"
;
this
.
Position
=
50
;
this
.
pos
=
this
.
Position
;
...
...
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