posts: factor out post navbar into component.

* Factor out the post navbar into a component. The post navbar is the
  part of the post containing the current search, the list of pools, and
  the list of favgroups, along with next/prev navigation links.

* Change navbar markup: remove various unused CSS classes/IDs, change
  pools to use same markup as favgroups, replace nested <div>'s with
  flat <ul>/<li> list.

* Use CSS to truncate long searches/pool names/favgroup names if they're
  too wide for the screen (especially on mobile).
This commit is contained in:
evazion
2021-01-29 18:36:15 -06:00
parent 151a9b026e
commit 1e778dbbf6
16 changed files with 203 additions and 186 deletions

View File

@@ -178,18 +178,8 @@ Post.swipe_prev = function(e) {
Post.nav_prev = function(e) {
var href = "";
if ($("#search-seq-nav").length) {
href = $("#search-seq-nav a[rel~=prev]").attr("href");
if (href) {
location.href = href;
}
} else if ($(".paginator a[rel~=prev]").length) {
if ($(".paginator a[rel~=prev], .post-notice-search a[rel~=prev]").length) {
location.href = $("a[rel~=prev]").attr("href");
} else {
href = $("#pool-nav li[data-selected=true] a[rel=prev], #favgroup-nav li[data-selected=true] a[rel=prev]").attr("href");
if (href) {
location.href = href;
}
}
e.preventDefault();
@@ -198,16 +188,8 @@ Post.nav_prev = function(e) {
Post.nav_next = function(e) {
var href = "";
if ($("#search-seq-nav").length) {
href = $("#search-seq-nav a[rel~=next]").attr("href");
location.href = href;
} else if ($(".paginator a[rel~=next]").length) {
location.href = $(".paginator a[rel~=next]").attr("href");
} else {
href = $("#pool-nav li[data-selected=true] a[rel=next], #favgroup-nav li[data-selected=true] a[rel=next]").attr("href");
if (href) {
location.href = href;
}
if ($(".paginator a[rel~=next], .post-notice-search a[rel~=next]").length) {
location.href = $("a[rel~=next]").attr("href");
}
e.preventDefault();