Skip to content

Commit

Permalink
fixbug: play offset shuould reset at EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
yubo committed Mar 16, 2016
1 parent bf3df11 commit 2baa90b
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 18,111 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ etc/
tmp/
var/
tty/resource.go
hterm.js
49 changes: 35 additions & 14 deletions bindata/static/js/demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$("#execBtn").on("click", function(){
var form = document.querySelector('#execForm')
var json = {
action: "exec",
name: $("#execName").val(),
Expand Down Expand Up @@ -37,30 +36,52 @@ $("#sessions").on("click", "button", function(e){
return response.json()
}).then(function(json){
console.log('parsed json', json)
alert("delete success")
window.location.reload();
}).catch(function(ex) {
console.log('parsing failed', action, ex)
})
}
});

$("#recs").on("click", "button", function(e){
var recid = $(e.currentTarget).data("recid");
var action = $(e.currentTarget).data("action")

$("#recPlay").on("click", function(){
var json = {
action: "play",
recid: $("#recid").val(),
repeat: true,
maxwait: 1,
speed: parseFloat($("#recSpeed").val())
};
fetch("/cmd", {
method: 'post',
body: JSON.stringify({ action : action, recid: recid.toString() })
body: JSON.stringify(json)
}).then(function(response){
return response.json()
}).then(function(json){
if(action == "delete"){
console.log('parsed json', json)
alert("delete success")
window.location.reload();
}else if(action == "play"){
window.open("/?name="+json.Key.Name+"&addr="+json.Key.Addr)
}
window.open("/?name="+json.Key.Name+"&addr="+json.Key.Addr)
}).catch(function(ex) {
//console.log('parsing failed', action, ex)
alert(action + ex)
})
});

$("#recDelete").on("click", function(){
var json = {
action: "delete",
recid: $("#recid").val(),
speed: parseFloat($("#recSpeed").val())
};
fetch("/cmd", {
method: 'post',
body: JSON.stringify(json)
}).then(function(response){
return response.json()
}).then(function(json){
console.log('parsed json', json)
alert("delete success")
window.location.reload();
}).catch(function(ex) {
console.log('parsing failed', action, ex)
})
});

})
Loading

0 comments on commit 2baa90b

Please sign in to comment.