Commit ea1a9ba8 authored by Xiaowu Zhang's avatar Xiaowu Zhang

add remove functionnality in audioplayer

parent 66adf726
...@@ -205,6 +205,15 @@ ...@@ -205,6 +205,15 @@
return; return;
} }
if (options.id === "delete") {
io.removeIO(options.page)
.then(function () {
list.initList(playlist);
// list.display();
});
return;
}
error.noDisplay(); error.noDisplay();
list.noDisplay(); list.noDisplay();
io.noDisplay(); io.noDisplay();
......
...@@ -32,6 +32,18 @@ ...@@ -32,6 +32,18 @@
return "jio getIO error : " + response.target.result; return "jio getIO error : " + response.target.result;
}); });
}) })
.declareMethod('removeIO', function (attachment) {
var gadget = this;
return gadget.jio.removeAttachment({
"_id": gadget.key,
"_attachment": attachment
}).then(function () {
gadget.playlist.splice(gadget.playlist.indexOf(attachment), 1);
gadget.sendPlaylist(gadget.playlist);
}).fail(function (response) {
return "jio removeIO error : " + response.target.result;
});
})
.declareMethod('display', function (attachment) { .declareMethod('display', function (attachment) {
input_context.style.display = ""; input_context.style.display = "";
}) })
...@@ -87,7 +99,7 @@ ...@@ -87,7 +99,7 @@
for (index = 0; index < input_context.files.length; index += 1) { for (index = 0; index < input_context.files.length; index += 1) {
found = false; found = false;
for (tmp = 0; tmp < g.playlist.length; tmp += 1) { for (tmp = 0; tmp < g.playlist.length; tmp += 1) {
if (g.playlist[tmp].name === input_context.files[index].name) { if (g.playlist[tmp] === input_context.files[index].name) {
found = true; found = true;
break; break;
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<body> <body>
<div data-role="content"> <div data-role="content">
<ul data-role="listview" data-autodividers="true" data-filter="true" data-split-icon="gear" data-split-theme="d"> <ul data-role="listview" data-autodividers="true" data-filter="true" data-split-icon="delete" data-split-theme="d">
</ul> </ul>
</div> </div>
</body> </body>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
+ "</a> " + "</a> "
+ " <a href=#page=" + " <a href=#page="
+ array[i] + array[i]
+ "delete " + "&id=delete "
+ "data-rel=popup " + "data-rel=popup "
+ "data-position-to=window " + "data-position-to=window "
+ "</a>"; + "</a>";
......
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