Commit 5ba0532c authored by Xiaowu Zhang's avatar Xiaowu Zhang

add mute notify

parent 89d5f937
...@@ -248,7 +248,8 @@ ...@@ -248,7 +248,8 @@
bar_context.max = g.audio.duration; bar_context.max = g.audio.duration;
return RSVP.all([ return RSVP.all([
g.plEnablePage(), g.plEnablePage(),
g.plGive("loop") g.plGive("loop"),
g.plGive("mute")
]); ]);
}) })
.push(function (list) { .push(function (list) {
...@@ -258,13 +259,20 @@ ...@@ -258,13 +259,20 @@
} else { } else {
loop_context.innerHTML = "loop off"; loop_context.innerHTML = "loop off";
} }
if (list[2] !== undefined) {
g.gain.gain.value = list[2];
mute_context.innerHTML = list[2] ? "mute off" : "mute on";
}
time_context.style.left = bar_context.style.left; time_context.style.left = bar_context.style.left;
$(time_context).offset().top = $(bar_context).offset().top + 3; $(time_context).offset().top = $(bar_context).offset().top + 3;
time_context.innerHTML = timeFormat(g.audio.duration); time_context.innerHTML = timeFormat(g.audio.duration);
return RSVP.any([ return RSVP.any([
playSong.call(g), playSong.call(g),
loopEventListener(mute_context, "click", false, function () { loopEventListener(mute_context, "click", false, function () {
mute_context.innerHTML = g.gain.gain.value ?
"mute on" : "mute off";
g.gain.gain.value = (g.gain.gain.value + 1) % 2; g.gain.gain.value = (g.gain.gain.value + 1) % 2;
return g.plSave({"mute": g.gain.gain.value});
}), }),
loopEventListener(g.audio, "ended", false, function () { loopEventListener(g.audio, "ended", false, function () {
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<div data-role="footer" data-position="fixed" data-theme="b"> <div data-role="footer" data-position="fixed" data-theme="b">
<div data-role="navbar"> <div data-role="navbar">
<ul> <ul>
<li><a data-role="button" class="mute" data-icon="info" >mute</a></li> <li><a data-role="button" class="mute" data-icon="info" >mute off</a></li>
<li><a data-role="button" class="command" data-icon="gear">stop</a></li> <li><a data-role="button" class="command" data-icon="gear">stop</a></li>
<li><a data-role="button" class="next" data-icon="arrow-r">next</a></li> <li><a data-role="button" class="next" data-icon="arrow-r">next</a></li>
<li><a data-role="button" class="share" data-icon="star" target="_blank">share</a></li> <li><a data-role="button" class="share" data-icon="star" target="_blank">share</a></li>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment