diff --git a/app/assets/javascripts/paginator.js b/app/assets/javascripts/paginator.js
index 9ec777bae..0e6c9c68e 100644
--- a/app/assets/javascripts/paginator.js
+++ b/app/assets/javascripts/paginator.js
@@ -2,7 +2,6 @@
Danbooru.Paginator = {};
Danbooru.Paginator.next_page = function() {
- console.log("next");
if ($('.paginator li span').parent().next().length) {
window.location = $('.paginator li span').parent().next().find('a').attr('href');
}
@@ -16,7 +15,9 @@
})();
$(function() {
- $(document).bind("keydown.right", Danbooru.Paginator.next_page);
- $(document).bind("keydown.left", Danbooru.Paginator.prev_page);
+ if ($(".paginator").length) {
+ $(document).bind("keydown.right", Danbooru.Paginator.next_page);
+ $(document).bind("keydown.left", Danbooru.Paginator.prev_page);
+ }
});
diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js
index bc14de13c..b28068160 100644
--- a/app/assets/javascripts/posts.js
+++ b/app/assets/javascripts/posts.js
@@ -2,6 +2,7 @@
Danbooru.Post = {};
Danbooru.Post.pending_update_count = 0;
+ Danbooru.Post.scroll_top = 0;
Danbooru.Post.initialize_all = function() {
this.initialize_titles();
@@ -21,6 +22,7 @@
this.initialize_post_image_resize_to_window_link();
this.initialize_similar();
this.place_jlist_ads();
+ this.center_pool_nav();
if (Danbooru.meta("always-resize-images") === "true") {
$("#image-resize-to-window-link").click();
@@ -60,6 +62,28 @@
$("#post_tag_string").trigger("focus");
e.preventDefault();
});
+
+ $(document).bind("keydown.left", function(e) {
+ location.href = $("#pool-nav a.active[rel=prev]").attr("href");
+ e.preventDefault();
+ });
+
+ $(document).bind("keydown.right", function(e) {
+ location.href = $("#pool-nav a.active[rel=next]").attr("href");
+ e.preventDefault();
+ });
+
+ $(document).bind("keydown.space", function() {
+ Danbooru.Post.scroll_top = Danbooru.Post.scroll_top + 800;
+
+ if (Danbooru.Post.scroll_top > $("#image").height() + $("#image").offset().top + 100) {
+ location.href = $("#pool-nav a.active[rel=next]").attr("href");
+ }
+
+ $('html, body').animate({
+ scrollTop: Danbooru.Post.scroll_top
+ }, 500);
+ })
}
}
@@ -111,6 +135,7 @@
Danbooru.Note.Box.scale_all();
$("#image-resize-notice").hide();
Danbooru.Post.place_jlist_ads();
+ Danbooru.Post.center_pool_nav();
e.preventDefault();
});
}
@@ -139,6 +164,7 @@
Danbooru.Note.Box.scale_all();
Danbooru.Post.place_jlist_ads()
+ Danbooru.Post.center_pool_nav();
e.preventDefault();
});
}
@@ -276,6 +302,17 @@
}
}
}
+
+ Danbooru.Post.center_pool_nav = function() {
+ var width = $("#image").width();
+ if (width > 1000) {
+ width = 1000;
+ }
+ if (width < 400) {
+ $("#pool-nav li").css("textAlign", "left");
+ }
+ $("#pool-nav").width(width);
+ }
})();
$(document).ready(function() {
diff --git a/app/assets/stylesheets/specific/posts.css.scss b/app/assets/stylesheets/specific/posts.css.scss
index 0359af93f..8037f4867 100644
--- a/app/assets/stylesheets/specific/posts.css.scss
+++ b/app/assets/stylesheets/specific/posts.css.scss
@@ -176,16 +176,16 @@ div#c-posts {
}
div#a-show {
+ .active {
+ font-weight: bold;
+ }
+
menu#post-sections {
margin: 0;
font-size: $h3_size;
li {
padding: 0 1em 0 0;
-
- &.active {
- font-weight: bold;
- }
}
div.share a {
@@ -204,6 +204,19 @@ div#c-posts {
span.quick-mod {
float: right;
}
+
+ .pool-name {
+ margin: 0 1em;
+ }
+
+ #pool-nav {
+ margin: 1em 0;
+
+ li {
+ text-align: center;
+ height: 1.5em;
+ }
+ }
}
div#quick-edit-div {
diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb
index b40ffba36..d691b7b73 100644
--- a/app/presenters/post_presenter.rb
+++ b/app/presenters/post_presenter.rb
@@ -115,27 +115,31 @@ class PostPresenter < Presenter
if options[:include_rel]
prev_rel = "prev"
next_rel = "next"
+ klass = "active"
else
prev_rel = nil
next_rel = nil
+ klass = ""
end
if pool.neighbors(@post).previous
- pool_html << template.link_to("«prev".html_safe, template.post_path(pool.neighbors(@post).previous, :pool_id => pool.id), :rel => prev_rel)
+ pool_html << template.link_to("«prev".html_safe, template.post_path(pool.neighbors(@post).previous, :pool_id => pool.id), :rel => prev_rel, :class => klass)
match_found = true
else
pool_html << "«prev"
end
+ pool_html << ' '
+ pool_html << template.link_to("Pool: #{pool.pretty_name}", template.pool_path(pool))
+ pool_html << ' '
+
if pool.neighbors(@post).next
- pool_html << template.link_to("next»".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => next_rel)
+ pool_html << template.link_to("next»".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => next_rel, :class => klass)
match_found = true
else
pool_html << "next»"
end
- pool_html << " "
- pool_html << template.link_to(pool.pretty_name, template.pool_path(pool))
pool_html << ""
if match_found
diff --git a/app/views/posts/partials/show/_pools.html.erb b/app/views/posts/partials/show/_pools.html.erb
new file mode 100644
index 000000000..c5e0951c9
--- /dev/null
+++ b/app/views/posts/partials/show/_pools.html.erb
@@ -0,0 +1,3 @@
+
diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb
index 23364fc5b..5aad3c113 100644
--- a/app/views/posts/show.html.erb
+++ b/app/views/posts/show.html.erb
@@ -5,13 +5,6 @@
<%= render_advertisement("vertical") %>
- <% if @post.pools.active.any? %>
-
- <% end %>
-