Merge branch 'master' into mobile-mode-default-image-size

This commit is contained in:
evazion
2020-07-23 16:22:37 -05:00
committed by GitHub
267 changed files with 5414 additions and 4398 deletions

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<%# https://support.google.com/webmasters/answer/178636 %>
<%# https://support.google.com/webmasters/answer/80471 %>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<% @posts.each do |post| %>
<url>
<loc><%= post_url(post) %></loc>
<lastmod><%= post.updated_at.iso8601 %></lastmod>
<% if post.visible? %>
<% if post.is_image? %>
<image:image>
<image:loc><%= post.file_url %></image:loc>
</image:image>
<% elsif post.is_video? %>
<video:video>
<video:thumbnail_loc><%= post.preview_file_url %></video:thumbnail_loc>
<video:content_loc><%= post.file_url %></video:content_loc>
<video:publication_date><%= post.created_at.iso8601 %></video:publication_date>
<video:title><%= "Post ##{post.id}" %></video:title>
<video:description><%= post.tag_string %></video:description>
<video:family_friendly><%= post.rating == "s" ? "yes" : "no" %></video:family_friendly>
</video:video>
<% end %>
<% end %>
</url>
<% end %>
</urlset>

View File

@@ -16,8 +16,10 @@
<%= render "tag_relationships/alias_and_implication_list", tag: artist.tag %>
<p class="links">
<%= link_to "View wiki", artist.wiki_page %> |
<%= link_to "View artist", artist_path(artist.id) %>
<% if artist.wiki_page.present? %>
<%= link_to "View wiki", artist.wiki_page, id: "view-wiki-link" %> |
<% end %>
<%= link_to "View artist", artist, id: "view-artist-link" %>
</p>
</div>
<% end %>
@@ -32,7 +34,7 @@
<%= render "tag_relationships/alias_and_implication_list", tag: wiki_page.tag %>
<p class="links">
<%= link_to_wiki "View wiki", wiki_page.title %>
<%= link_to_wiki "View wiki", wiki_page.title, id: "view-wiki-link" %>
</p>
</div>
<% end %>
@@ -61,7 +63,7 @@
</h4>
Creator: <%= link_to_user post_set.favgroup.creator %>
<% elsif post_set.has_blank_wiki? %>
<p>There is currently no wiki page for the tag <%= link_to_wiki post_set.tag.pretty_name %>. You can <%= link_to "create one", new_wiki_page_path(wiki_page: { title: post_set.tag.name }) %>.</p>
<p>There is currently no wiki page for the tag <%= link_to_wiki post_set.tag.pretty_name %>. You can <%= link_to "create one", new_wiki_page_path(wiki_page: { title: post_set.tag.name }), rel: "nofollow" %>.</p>
<%= render "tag_relationships/alias_and_implication_list", tag: post_set.tag %>
<% end %>

View File

@@ -5,19 +5,15 @@
<li id="secondary-links-posts-hot"><%= link_to "Hot", posts_path(:tags => "order:rank") %></li>
<li id="secondary-links-posts-popular"><%= link_to "Popular", popular_explore_posts_path %></li>
<li id="secondary-links-posts-curated"><%= link_to "Curated", curated_explore_posts_path %></li>
<% if PopularSearchService.enabled? %>
<li><%= link_to "Searches", searches_explore_posts_path %></li>
<% end %>
<% if PostViewCountService.enabled? %>
<li><%= link_to "Viewed", viewed_explore_posts_path %></li>
<% end %>
<li><%= link_to "Searches", searches_explore_posts_path %></li>
<li><%= link_to "Viewed", viewed_explore_posts_path %></li>
<% end %>
<li><%= link_to "Deleted", posts_path(tags: "#{params[:tags]} status:deleted") %></li>
<li><%= link_to "Random", random_posts_path(tags: params[:tags]), id: "random-post", "data-shortcut": "r" %></li>
<li><%= link_to "Deleted", posts_path(tags: "#{params[:tags]} status:deleted"), rel: "nofollow" %></li>
<li><%= link_to "Random", random_posts_path(tags: params[:tags]), id: "random-post", "data-shortcut": "r", rel: "nofollow" %></li>
<% if post_set.query.is_simple_tag? %>
<li><%= link_to "History", post_versions_path(search: { changed_tags: params[:tags] }) %></li>
<li><%= link_to "History", post_versions_path(search: { changed_tags: params[:tags] }), rel: "nofollow" %></li>
<% end %>
<li><%= link_to "Count", posts_counts_path(:tags => params[:tags]) %></li>
<li><%= link_to "Count", posts_counts_path(tags: params[:tags]), rel: "nofollow" %></li>
</ul>
</section>

View File

@@ -1,6 +1,6 @@
<% if @post_set.query.is_empty_search? %>
<% page_title("#{Danbooru.config.app_name}: Anime Image Board", suffix: nil) %>
<% meta_description("#{Danbooru.config.canonical_app_name} is the original anime image 'booru. Find over 3.75 million anime pictures categorized by over 100 million tags.") %>
<% meta_description site_description %>
<% atom_feed_tag "Posts", posts_url(format: :atom) %>
<% else %>
@@ -10,6 +10,10 @@
<% atom_feed_tag "Posts: #{@post_set.tag_string}", posts_url(tags: @post_set.tag_string, format: :atom) %>
<% end %>
<% if params[:tags].blank? && @post_set.current_page == 1 %>
<% canonical_url root_url(host: Danbooru.config.hostname) %>
<% end %>
<% if @post_set.hide_from_crawler? %>
<meta name="robots" content="nofollow,noindex">
<% end %>
@@ -18,8 +22,6 @@
<meta name="rating" content="adult">
<% end %>
<%= tag.meta name: "canonical", content: posts_url(tags: params[:tags], host: Danbooru.config.hostname, protocol: "https") %>
<% if @post_set.best_post.present? %>
<%= tag.meta property: "og:image", content: @post_set.best_post.open_graph_image_url %>
<%= tag.meta name: "twitter:image", content: @post_set.best_post.open_graph_image_url %>

View File

@@ -1,4 +1,4 @@
This post has <%= link_to pluralize(children.length, "child"), posts_path(tags: "parent:#{parent.id}") %>
This post has <%= link_to pluralize(children.length, "child"), posts_path(tags: "parent:#{parent.id}"), rel: "nofollow" %>
(<%= link_to_wiki "learn more", "help:post_relationships" %>)
<%= link_to("« hide", "#", id: "has-children-relationship-preview-link") %>

View File

@@ -7,9 +7,9 @@
<%= render "sources/info" %>
<%= edit_form_for(post, html: { id: "form" }) do |f| %>
<%= hidden_field_tag :tags_query, params[:q] %>
<%= hidden_field_tag :pool_id, params[:pool_id] %>
<%= hidden_field_tag :favgroup_id, params[:favgroup_id] %>
<%= f.input :tags_query, as: :hidden, input_html: { id: nil, name: "tags_query", value: params[:q] } %>
<%= f.input :pool_id, as: :hidden, input_html: { id: nil, name: "pool_id", value: params[:pool_id] } %>
<%= f.input :favgroup_id, as: :hidden, input_html: { id: nil, name: "favgroup_id", value: params[:favgroup_id] } %>
<%= f.input :old_tag_string, as: :hidden, input_html: { value: post.tag_string } %>
<%= f.input :old_parent_id, as: :hidden, input_html: { value: post.parent_id } %>
<%= f.input :old_source, as: :hidden, input_html: { value: post.source } %>

View File

@@ -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, itemprop: "contentUrl", 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", "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) %>
<% end -%>
<% end %>

View File

@@ -1,14 +1,11 @@
<ul>
<li id="post-info-id">ID: <%= post.id %></li>
<% if policy(post).can_view_uploader? %>
<li id="post-info-uploader">
Uploader: <%= link_to_user(post.uploader) %>
<%= link_to "»", posts_path(tags: "user:#{post.uploader.name}") %>
</li>
<% end %>
<li id="post-info-uploader">
Uploader: <%= link_to_user(post.uploader) %>
<%= link_to "»", posts_path(tags: "user:#{post.uploader.name}") %>
</li>
<li id="post-info-date">
Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(tags: "date:#{post.created_at.to_date}") %>
<meta itemprop="uploadDate" content="<%= post.created_at.iso8601 %>">
</li>
<% if post.approver %>
<li id="post-info-approver">
@@ -17,9 +14,9 @@
</li>
<% end %>
<li id="post-info-size">
Size: <%= link_to_if policy(post).visible?, number_to_human_size(post.file_size), post.tagged_file_url %>
Size: <%= link_to_if policy(post).visible?, "#{number_to_human_size(post.file_size)} .#{post.file_ext}", post.tagged_file_url %>
<% if post.has_dimensions? %>
(<span itemprop="width"><%= post.image_width %></span>x<span itemprop="height"><%= post.image_height %></span>)
(<%= post.image_width %>x<%= post.image_height %>)
<% end %>
</li>
<li id="post-info-source">Source: <%= post_source_tag(post.source, post.normalized_source) %></li>

View File

@@ -1,8 +1,8 @@
This post belongs to a <%= link_to "parent", posts_path(tags: "parent:#{parent.id}") %> <% "(deleted)" if parent.is_deleted? %>
This post belongs to a <%= link_to "parent", posts_path(tags: "parent:#{parent.id}"), rel: "nofollow" %> <% "(deleted)" if parent.is_deleted? %>
<% children.length.tap do |children_count| %>
<% if children_count > 1 %>
and has <%= link_to pluralize(children_count - 1, "sibling"), posts_path(tags: "parent:#{parent.id}") %>
and has <%= link_to pluralize(children_count - 1, "sibling"), posts_path(tags: "parent:#{parent.id}"), rel: "nofollow" %>
<% end %>
<% end %>

View File

@@ -1,40 +1,39 @@
<div class="post-tooltip-header">
<span class="post-tooltip-header-left">
<% if policy(@post).can_view_uploader? %>
<%= link_to_user @post.uploader %>
<% end %>
<%= link_to_user @post.uploader %>
<span class="post-tooltip-favorites post-tooltip-info">
<span><%= @post.fav_count %></span>
<i class="far fa-heart fa-xs"></i>
</span>
<span class="post-tooltip-score post-tooltip-info">
<span><%= @post.score %></span>
<i class="far fa-thumbs-up fa-xs"></i>
</span>
<% if @post.last_commented_at.present? %>
<span class="post-tooltip-comments post-tooltip-info">
<span><%= @post.comments.count %></span>
<i class="far fa-comments fa-xs"></i>
</span>
<% end %>
<%= link_to posts_path(tags: "date:#{@post.created_at.strftime("%Y-%m-%d")}"), class: "post-tooltip-date post-tooltip-info" do %>
<%= time_ago_in_words_tagged(@post.created_at, compact: true) %> ago
<% end %>
<span class="post-tooltip-favorites post-tooltip-info">
<span><%= @post.fav_count %></span>
<i class="far fa-heart fa-xs"></i>
</span>
<span class="post-tooltip-header-right">
<%= link_to @post.source_domain, @post.normalized_source, class: "post-tooltip-source post-tooltip-info" if @post.source_domain.present? %>
<%= link_to "#{@post.pretty_rating.downcase}", posts_path(tags: "rating:#{@post.rating}"), class: "post-tooltip-rating post-tooltip-info" %>
<%= link_to "#{@post.image_width}x#{@post.image_height}", @post.file_url, class: "post-tooltip-dimensions post-tooltip-info" %>
<%= link_to "#", class: "post-tooltip-disable", title: "Disable enhanced tooltips" do %>
<i class="fas fa-times-circle"></i>
<% end %>
<span class="post-tooltip-score post-tooltip-info">
<span><%= @post.score %></span>
<i class="far fa-thumbs-up fa-xs"></i>
</span>
<% if @post.last_commented_at.present? %>
<span class="post-tooltip-comments post-tooltip-info">
<span><%= @post.comments.count %></span>
<i class="far fa-comments fa-xs"></i>
</span>
<% end %>
<%= link_to posts_path(tags: "date:#{@post.created_at.strftime("%Y-%m-%d")}"), class: "post-tooltip-date post-tooltip-info" do %>
<%= time_ago_in_words_tagged(@post.created_at, compact: true) %> ago
<% end %>
<% if @post.source_domain.present? %>
<%= link_to @post.source_domain, @post.normalized_source, class: "post-tooltip-source post-tooltip-info" %>
<% else %>
<%= link_to "no source", posts_path(tags: "source:none"), class: "post-tooltip-source post-tooltip-info" %>
<% end %>
<%= link_to "#{@post.rating.upcase}", posts_path(tags: "rating:#{@post.pretty_rating}"), class: "post-tooltip-rating post-tooltip-info" %>
<%= link_to "#{@post.image_width}x#{@post.image_height}", @post.file_url, class: "post-tooltip-dimensions post-tooltip-info" %>
<%= link_to "#", class: "post-tooltip-disable", title: "Disable enhanced tooltips" do %>
<i class="fas fa-times-circle"></i>
<% end %>
</div>
<div class="post-tooltip-body <%= "has-preview" if params[:preview].truthy? %>">

View File

@@ -1,7 +1,8 @@
<% page_title @post.presenter.humanized_essential_tag_string %>
<% meta_description "View this #{@post.image_width}x#{@post.image_height} #{number_to_human_size(@post.file_size)} image" %>
<% canonical_url post_url(@post, host: Danbooru.config.hostname) %>
<% atom_feed_tag "Comments for post ##{@post.id}", comments_url(:atom, search: { post_id: @post.id }) %>
<%= render "posts/partials/common/secondary_links" %>
<% content_for(:sidebar) do %>
@@ -61,25 +62,17 @@
<% end %>
<section id="mark-as-translated-section" style="display: none;">
<%= form_tag(mark_as_translated_post_path(@post), :class => "simple_form", :method => :put) do |f| %>
<%= hidden_field_tag :tags_query, params[:q] %>
<%= hidden_field_tag :pool_id, params[:pool_id] %>
<%= edit_form_for(@post, url: mark_as_translated_post_path(@post), method: :put) do |f| %>
<%= f.input :tags_query, as: :hidden, input_html: { id: nil, name: "tags_query", value: params[:q] } %>
<%= f.input :pool_id, as: :hidden, input_html: { id: nil, name: "pool_id", value: params[:pool_id] } %>
<%= f.input :favgroup_id, as: :hidden, input_html: { id: nil, name: "favgroup_id", value: params[:favgroup_id] } %>
<fieldset>
<label for="post_check_translation">
<%= check_box "post", "check_translation", :checked => @post.has_tag?("check_translation") %>
Check translation
</label>
<label for="post_partially_translated">
<%= check_box "post", "partially_translated", :checked => @post.has_tag?("partially_translated") %>
Partially translated
</label>
<fieldset class="inline-fieldset">
<%= f.input :check_translation, as: :boolean, input_html: { checked: @post.has_tag?("check_translation") } %>
<%= f.input :partially_translated, as: :boolean, input_html: { checked: @post.has_tag?("partially_translated") } %>
</fieldset>
<div class="input">
<%= submit_tag "Mark as translated" %>
</div>
<%= f.submit "Mark as translated" %>
<% end %>
</section>
@@ -154,9 +147,11 @@
<% if policy(@post).visible? %>
<%= tag.meta property: "og:image", content: @post.open_graph_image_url %>
<% end %>
<%= tag.meta name: "canonical", content: post_url(@post, host: Danbooru.config.hostname, protocol: "https") %>
<% if @post.is_video? %>
<%= json_ld_video_data(@post) %>
<% end %>
<% end %>
<% if @post.twitter_card_supported? %>
<meta name="twitter:card" content="summary_large_image">

View File

@@ -1,8 +1,5 @@
<% if @post.valid? %>
var $post = $("#post_<%= @post.id %>");
<% if !CurrentUser.disable_post_tooltips %>
$post.find("img").qtip("destroy", true);
<% end %>
var $new_post = $("<%= j PostPresenter.preview(@post, show_deleted: true) %>");
Danbooru.Blacklist.apply_post($new_post.get(0));
$("#post_<%= @post.id %>").replaceWith($new_post);