fully implement ugoira js player, upgrade jquery and jquery-ui
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//= require jquery-1.10.1.min.js
|
||||
//= require jquery-ui-1.10.2.min.js
|
||||
//= require jquery-1.11.1.min.js
|
||||
//= require jquery-ui-1.11.2.min.js
|
||||
//= require jquery.hotkeys.js
|
||||
//= require jquery.timeout.js
|
||||
//= require jquery-ui-autocomplete-custom.js
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
*= require "jquery-ui-1.10.3.min.css"
|
||||
*= require "jquery-ui-1.11.2.min.css"
|
||||
*= require_tree "./common"
|
||||
*= require_tree "./specific"
|
||||
*/
|
||||
|
||||
@@ -95,7 +95,7 @@ class Post < ActiveRecord::Base
|
||||
|
||||
def large_file_url
|
||||
if has_large?
|
||||
"/data/sample/#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.jpg"
|
||||
"/data/sample/#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.#{large_file_ext}"
|
||||
else
|
||||
file_url
|
||||
end
|
||||
@@ -146,7 +146,7 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def has_preview?
|
||||
is_image? || is_video?
|
||||
is_image? || is_video? || is_ugoira?
|
||||
end
|
||||
|
||||
def has_dimensions?
|
||||
@@ -168,7 +168,7 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def has_large?
|
||||
is_image? && image_width.present? && image_width > Danbooru.config.large_image_width
|
||||
is_ugoira? || (is_image? && image_width.present? && image_width > Danbooru.config.large_image_width)
|
||||
end
|
||||
|
||||
def has_large
|
||||
|
||||
@@ -355,7 +355,6 @@ class Upload < ActiveRecord::Base
|
||||
self.file_path = destination_path
|
||||
download = Downloads::File.new(source, destination_path, :is_ugoira => has_ugoira_tag?)
|
||||
download.download!
|
||||
self.source = download.source
|
||||
ugoira_service.load(download.data)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<%= content_tag(:canvas, nil, :width => post.image_width, :height => post.image_height, :id => "ugoira-canvas") %>
|
||||
|
||||
<div id="progressbar"></div>
|
||||
|
||||
<p>
|
||||
<%= link_to "Play", "#", :id => "ugoira-play" %>
|
||||
| <%= link_to "Pause", "#", :id => "ugoira-pause" %>
|
||||
@@ -34,10 +36,30 @@
|
||||
|
||||
$(function() {
|
||||
Danbooru.Ugoira.create_player();
|
||||
$("#ugoira-play").click(function() {Danbooru.Ugoira.player.play();})
|
||||
$("#ugoira-pause").click(function() {Danbooru.Ugoira.player.pause();})
|
||||
$("#ugoira-rewind").click(function() {Danbooru.Ugoira.player.rewind();})
|
||||
$("#ugoira-stop").click(function() {Danbooru.Ugoira.player.stop();})
|
||||
$(Danbooru.Ugoira.player).on("loadProgress", function(ev, progress) {
|
||||
$("#progressbar").progressbar({value: progress * 100});
|
||||
});
|
||||
$(Danbooru.Ugoira.player).on("loadingStateChanged", function(ev, state) {
|
||||
if (state === 2) {
|
||||
$("#progressbar").remove();
|
||||
}
|
||||
});
|
||||
$("#ugoira-play").click(function(e) {
|
||||
Danbooru.Ugoira.player.play();
|
||||
e.preventDefault();
|
||||
})
|
||||
$("#ugoira-pause").click(function(e) {
|
||||
Danbooru.Ugoira.player.pause();
|
||||
e.preventDefault();
|
||||
});
|
||||
$("#ugoira-rewind").click(function(e) {
|
||||
Danbooru.Ugoira.player.rewind();
|
||||
e.preventDefault();
|
||||
});
|
||||
$("#ugoira-stop").click(function(e) {
|
||||
Danbooru.Ugoira.player.stop();
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<%= content_tag(:video, nil, :width => post.image_width, :height => post.image_height, :autoplay => true, :loop => true, :src => post.file_url) %>
|
||||
|
||||
<p><%= link_to "Save this video (right click and save)", post.file_url %></p>
|
||||
<p><%= link_to "Save this video (right click and save)", post.large_file_url %></p>
|
||||
|
||||
Reference in New Issue
Block a user