Improve ugoira controls

This commit is contained in:
Toks
2014-10-18 16:15:07 -04:00
committed by r888888888
parent b1d5bb8272
commit 34e3fd45b9
2 changed files with 23 additions and 13 deletions

View File

@@ -521,3 +521,14 @@ div#unapprove-dialog {
width: 100%; width: 100%;
} }
} }
#ugoira-controls {
button {
height: 2em;
width: 5em;
}
#progressbar {
height: 1.5em;
}
}

View File

@@ -16,15 +16,13 @@
"data-score" => post.score, "data-score" => post.score,
"data-fav-count" => post.fav_count) %> "data-fav-count" => post.fav_count) %>
<div id="progressbar"></div> <div id="ugoira-controls">
<div id="progressbar" style="width: <%= post.image_width %>px;"></div>
<p> <%= button_tag "Play", :id => "ugoira-play", :style => "display: none;" %>
<%= link_to "Play", "#", :id => "ugoira-play" %> <%= button_tag "Pause", :id => "ugoira-pause" %>
| <%= link_to "Pause", "#", :id => "ugoira-pause" %> <%= button_tag "Rewind", :id => "ugoira-rewind" %>
| <%= link_to "Rewind", "#", :id => "ugoira-rewind" %> <%= link_to "Save as video (right click and save)", post.large_file_url %>
| <%= link_to "Stop", "#", :id => "ugoira-stop" %> </div>
| <%= link_to "Save as video (right click and save)", post.large_file_url %>
</p>
<% content_for(:html_header) do %> <% content_for(:html_header) do %>
<%= javascript_include_tag "ugoira_player" %> <%= javascript_include_tag "ugoira_player" %>
@@ -60,22 +58,23 @@
$("#progressbar").remove(); $("#progressbar").remove();
} }
}); });
$("#ugoira-play").click(function(e) { $("#ugoira-play").click(function(e) {
Danbooru.Ugoira.player.play(); Danbooru.Ugoira.player.play();
$(this).hide();
$("#ugoira-pause").show();
e.preventDefault(); e.preventDefault();
}) })
$("#ugoira-pause").click(function(e) { $("#ugoira-pause").click(function(e) {
Danbooru.Ugoira.player.pause(); Danbooru.Ugoira.player.pause();
$(this).hide();
$("#ugoira-play").show();
e.preventDefault(); e.preventDefault();
}); });
$("#ugoira-rewind").click(function(e) { $("#ugoira-rewind").click(function(e) {
Danbooru.Ugoira.player.rewind(); Danbooru.Ugoira.player.rewind();
e.preventDefault(); e.preventDefault();
}); });
$("#ugoira-stop").click(function(e) {
Danbooru.Ugoira.player.stop();
e.preventDefault();
});
}); });
</script> </script>
<% end %> <% end %>