posts: remove data-* attributes from #image element.
These attributes can be found on the `.image-container` element instead.
This commit is contained in:
@@ -339,7 +339,6 @@ class Note {
|
||||
|
||||
// Rescale font sizes of embedded notes when the image is resized.
|
||||
static scale_all() {
|
||||
let $image = $("#image");
|
||||
let $container = $(".note-container");
|
||||
|
||||
if ($container.length === 0) {
|
||||
@@ -348,8 +347,8 @@ class Note {
|
||||
|
||||
Note.Body.hide_all();
|
||||
|
||||
let large_width = parseFloat($image.data('large-width'));
|
||||
let ratio = $image.width() / large_width;
|
||||
let large_width = parseFloat($container.data("large-width"));
|
||||
let ratio = $container.width() / large_width;
|
||||
let font_percentage = ratio * 100;
|
||||
|
||||
$container.css('font-size', font_percentage + '%');
|
||||
|
||||
@@ -307,10 +307,11 @@ Post.view_original = function(e = null) {
|
||||
}
|
||||
|
||||
var $image = $("#image");
|
||||
var $post = $(".image-container");
|
||||
$image.attr("src", $(".image-view-original-link").attr("href"));
|
||||
$image.css("filter", "blur(8px)");
|
||||
$image.width($image.data("original-width"));
|
||||
$image.height($image.data("original-height"));
|
||||
$image.width($post.data("width"));
|
||||
$image.height($post.data("height"));
|
||||
$image.on("load.danbooru", function() {
|
||||
$image.css("animation", "sharpen 0.5s forwards");
|
||||
});
|
||||
@@ -326,10 +327,11 @@ Post.view_large = function(e = null) {
|
||||
}
|
||||
|
||||
var $image = $("#image");
|
||||
var $post = $(".image-container");
|
||||
$image.attr("src", $(".image-view-large-link").attr("href"));
|
||||
$image.css("filter", "blur(8px)");
|
||||
$image.width($image.data("large-width"));
|
||||
$image.height($image.data("large-height"));
|
||||
$image.width($post.data("large-width"));
|
||||
$image.height($post.data("large-height"));
|
||||
$image.on("load.danbooru", function() {
|
||||
$image.css("animation", "sharpen 0.5s forwards");
|
||||
});
|
||||
|
||||
@@ -116,6 +116,8 @@ class PostPresenter
|
||||
"data-pools" => post.pool_string,
|
||||
"data-approver-id" => post.approver_id,
|
||||
"data-rating" => post.rating,
|
||||
"data-large-width" => post.large_image_width,
|
||||
"data-large-height" => post.large_image_height,
|
||||
"data-width" => post.image_width,
|
||||
"data-height" => post.image_height,
|
||||
"data-flags" => post.status_flags,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% if policy(post).visible? %>
|
||||
<%= content_tag(:picture) do -%>
|
||||
<%= tag.source media: "(max-width: 660px)", srcset: post.tagged_large_file_url -%>
|
||||
<%= tag.img width: post.image_width_for(CurrentUser.user), height: post.image_height_for(CurrentUser.user), id: "image", class: "fit-width", "data-original-width": post.image_width, "data-original-height": post.image_height, "data-large-width": post.large_image_width, "data-large-height": post.large_image_height, "data-tags": post.tag_string, alt: post.presenter.humanized_essential_tag_string, "data-uploader": post.uploader.name, "data-rating": post.rating, "data-flags": post.status_flags, "data-parent-id": post.parent_id, "data-has-children": post.has_children?, "data-has-active-children": post.has_active_children?, "data-score": post.score, "data-fav-count": post.fav_count, src: post.file_url_for(CurrentUser.user) %>
|
||||
<%= tag.img width: post.image_width_for(CurrentUser.user), height: post.image_height_for(CurrentUser.user), id: "image", class: "fit-width", alt: post.presenter.humanized_essential_tag_string, src: post.file_url_for(CurrentUser.user) %>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
@@ -5,19 +5,6 @@
|
||||
:class => "fit-width",
|
||||
:width => post.image_width,
|
||||
:height => post.image_height,
|
||||
"data-original-width" => post.image_width,
|
||||
"data-original-height" => post.image_height,
|
||||
"data-large-width" => post.image_width,
|
||||
"data-large-height" => post.image_height,
|
||||
"data-tags" => post.tag_string,
|
||||
"data-uploader" => post.uploader.name,
|
||||
"data-rating" => post.rating,
|
||||
"data-flags" => post.status_flags,
|
||||
"data-parent-id" => post.parent_id,
|
||||
"data-has-children" => post.has_children?,
|
||||
"data-has-active-children" => post.has_active_children?,
|
||||
"data-score" => post.score,
|
||||
"data-fav-count" => post.fav_count,
|
||||
"data-ugoira-frames" => post.pixiv_ugoira_frame_data.data.to_json,
|
||||
"data-ugoira-content-type" => post.pixiv_ugoira_frame_data.content_type.to_json,
|
||||
) %>
|
||||
|
||||
Reference in New Issue
Block a user