From 440e0174a64a8ce2f301a108b5d1d2897168249d Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Wed, 29 Aug 2018 20:53:50 -0400 Subject: [PATCH 1/7] Thumb container layout update * Updated to support Danbooru's layout changes and fetch the appropriate parent element for thumbnails. --- better-better-booru.user.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/better-better-booru.user.js b/better-better-booru.user.js index 3f6dace..3b7e9d4 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -1648,15 +1648,13 @@ function bbbScript() { // Wrapper for injecting the script into the document. var target = docEl || document; var container; // If/else variable. - if (mode === "search") { - container = getId("posts", target); - container = (container ? container.getElementsByTagName("div")[0] : undefined); - } + if (mode === "search") + container = getId("posts-container", target); else if (mode === "popular" || mode === "popular_view") - container = getId("a-index", target); + container = getId("a-popular", target); else if (mode === "pool" || mode === "favorite_group") { container = getId("a-show", target); - container = (container ? container.getElementsByTagName("section")[0] : undefined); + container = (container ? container.getElementsByTagName("section")[1] : undefined); } else if (mode === "favorites") container = getId("posts", target); From 3d183fb9e374720115fda68ecf4ee0b4d837605d Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Wed, 29 Aug 2018 21:34:20 -0400 Subject: [PATCH 2/7] Popular link fix & Menu layout update * Fixed the insertion of the popular link into the navigation menu by updating the IDs. * Updated the insertion of other links into the menu by using the new IDs. --- better-better-booru.user.js | 49 +++++++------------------------------ 1 file changed, 9 insertions(+), 40 deletions(-) diff --git a/better-better-booru.user.js b/better-better-booru.user.js index 3b7e9d4..98355ac 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -5213,27 +5213,11 @@ function bbbScript() { // Wrapper for injecting the script into the document. return; // Add the endless link to the menu. - var menu = document.getElementById("top"); - menu = (menu ? menu.getElementsByTagName("menu")[1] : undefined); - - if (menu) { - var menuItems = menu.getElementsByTagName("li"); - var numMenuItems = menu.getElementsByTagName("li").length; - var listingItemSibling = menuItems[1]; - - for (var i = 0; i < numMenuItems; i++) { - var menuLink = menuItems[i]; - var nextLink = menuItems[i + 1]; + var listingItem = document.getElementById("subnav-listing"); - if (menuLink.textContent.indexOf("Listing") > -1) { - if (nextLink) - listingItemSibling = nextLink; - else - listingItemSibling = undefined; - - break; - } - } + if (listingItem) { + var menu = listingItem.parentNode; + var listingItemSibling = listingItem.nextElementSibling; var link = bbb.el.endlessLink = document.createElement("a"); link.href = "#"; @@ -7426,27 +7410,12 @@ function bbbScript() { // Wrapper for injecting the script into the document. return; var activeMenu = header.getElementsByClassName("current")[0]; - var secondMenu = header.getElementsByTagName("menu")[1]; + var listingItem = document.getElementById("subnav-listing"); // Insert new posts link. - if (activeMenu && activeMenu.textContent === "Posts" && secondMenu) { - var menuItems = secondMenu.getElementsByTagName("li"); - var numMenuItems = secondMenu.getElementsByTagName("li").length; - var listingItemSibling = menuItems[1]; - - for (var i = 0; i < numMenuItems; i++) { - var menuLink = menuItems[i]; - var nextLink = menuItems[i + 1]; - - if (menuLink.textContent.indexOf("Listing") > -1) { - if (nextLink) - listingItemSibling = nextLink; - else - listingItemSibling = undefined; - - break; - } - } + if (activeMenu && activeMenu.id === "nav-posts" && listingItem) { + var secondMenu = listingItem.parentNode; + var listingItemSibling = listingItem.nextElementSibling; var link = document.createElement("a"); link.href = "/posts?new_posts=redirect&page=b1"; @@ -9593,7 +9562,7 @@ function bbbScript() { // Wrapper for injecting the script into the document. function addPopularLink() { // Add the popular link back to the posts submenu. - var subListItem = document.getElementById("secondary-links-posts-hot") || document.getElementById("secondary-links-posts-favorites"); + var subListItem = document.getElementById("subnav-hot") || document.getElementById("subnav-favorites"); if (!subListItem || !add_popular_link) return; From 9acea9f436027ed4431c5bdd6a2f466739d983e8 Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Wed, 29 Aug 2018 23:48:07 -0400 Subject: [PATCH 3/7] Menu layout update (cont.) * Added another ID for endless pages in saved searches. --- better-better-booru.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/better-better-booru.user.js b/better-better-booru.user.js index 98355ac..3d5f369 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -5213,7 +5213,7 @@ function bbbScript() { // Wrapper for injecting the script into the document. return; // Add the endless link to the menu. - var listingItem = document.getElementById("subnav-listing"); + var listingItem = document.getElementById("subnav-listing") || document.getElementById("subnav-view-posts"); if (listingItem) { var menu = listingItem.parentNode; From 0bf3f027c817db31038f310cbff1c9e31f302908 Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Tue, 11 Sep 2018 00:26:09 -0400 Subject: [PATCH 4/7] Blacklist link style fix * Added href values to the blacklist links to make the CSS affect them properly. --- better-better-booru.user.js | 1 + 1 file changed, 1 insertion(+) diff --git a/better-better-booru.user.js b/better-better-booru.user.js index 3d5f369..57ef574 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -5737,6 +5737,7 @@ function bbbScript() { // Wrapper for injecting the script into the document. blacklistItem.style.display = "none"; var blacklistLink = document.createElement("a"); + blacklistLink.href = "#"; blacklistLink.innerHTML = (blacklistTag.length < 19 ? blacklistTag + " " : blacklistTag.substring(0, 18).bbbSpaceClean() + "... "); blacklistLink.className = "bbb-blacklist-entry-" + i + (entryDisabled ? " blacklisted-active" : ""); blacklistLink.bbbInfo("bbb-blacklist-entry", i); From c4d0d37414565e8bf061c1480dc681d8aee3f87c Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Thu, 11 Oct 2018 20:37:16 -0400 Subject: [PATCH 5/7] Post resize height adjustment * Adjusted the resize height to leave only 10 pixels free above and below the image. --- better-better-booru.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/better-better-booru.user.js b/better-better-booru.user.js index 57ef574..dff3b47 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -4066,7 +4066,7 @@ function bbbScript() { // Wrapper for injecting the script into the document. var resizeLinkWidth = bbb.el.resizeLinkWidth; var resizeLinkHeight = bbb.el.resizeLinkHeight; var availableWidth = imgContainer.clientWidth || contentDiv.clientWidth - contentDiv.bbbGetPadding().width; - var availableHeight = document.documentElement.clientHeight - 40; + var availableHeight = document.documentElement.clientHeight - 10; var targetCurrentWidth = target.clientWidth || parseFloat(target.style.width) || target.getAttribute("width"); var targetCurrentHeight = target.clientHeight || parseFloat(target.style.height) || target.getAttribute("height"); var useDataDim = targetTag === "EMBED" || targetTag === "VIDEO"; From 0b285b2bb792ff007b59323701e1814bb78459d3 Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Thu, 11 Oct 2018 22:03:30 -0400 Subject: [PATCH 6/7] Normalized source update MKII * Updated to reflect more changes to normalized sources on Danbooru. --- better-better-booru.user.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/better-better-booru.user.js b/better-better-booru.user.js index dff3b47..ba80bcb 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -6468,7 +6468,7 @@ function bbbScript() { // Wrapper for injecting the script into the document. title = urlReg[1].replace(/[^A-Za-z0-9]/g, " ").bbbSpaceClean().replace(/[ ]/g, "-"); artist = urlReg[2].replace(/_/g, "-"); id = parseInt(urlReg[3], 36); - url = "https://" + artist + ".deviantart.com/art/" + title + "-" + id; + url = "https://www.deviantart.com/" + artist + "/art/" + title + "-" + id; } else if (!!(urlReg = source.match(/^https?:\/\/(?:fc|th|pre|orig|img|prnt)\d{2}\.deviantart\.net\/.+\/[a-f0-9]{32}-d([a-z0-9]+)\./i))) { id = parseInt(urlReg[1], 36); @@ -6522,10 +6522,14 @@ function bbbScript() { // Wrapper for injecting the script into the document. url = "http://minus.com/i/" + urlReg[1]; else if (!!(urlReg = source.match(/^https?:\/\/pic0[1-4]\.nijie\.info\/nijie_picture\/(?:diff\/main\/)?\d+_(\d+)_(?:\d{10}|\d+_\d{14})/i))) url = "https://nijie.info/view.php?id=" + urlReg[1]; - else if (!!(urlReg = source.match(/^https?:\/\/(?:ayase\.|yuno\.|files\.)?yande\.re\/(?:sample|image)\/[a-z0-9]{32}\/yande\.re%20([0-9]+)%20/i))) + else if (!!(urlReg = source.match(/^https?:\/\/(?:[^.]+\.)?yande\.re\/(?:image|jpeg|sample)\/[a-f0-9]{32}\/yande\.re%20(\d+)/i))) url = "https://yande.re/post/show/" + urlReg[1]; - else if (!!(urlReg = source.match(/^https?:\/\/(?:ayase\.|yuno\.|files\.)?yande\.re\/(?:image|jpeg|sample)\/([a-z0-9]{32})(?:\/yande\.re.*|\/?\.(?:jpg|png))$/i))) + else if (!!(urlReg = source.match(/^https?:\/\/(?:[^.]+\.)?yande\.re\/(?:image|jpeg|sample)\/([a-f0-9]{32})(?:\/yande\.re.*|\/?\.(?:jpg|png))$/i))) url = "https://yande.re/post?tags=md5:" + urlReg[1]; + else if (!!(urlReg = source.match(/^https?:\/\/(?:[^.]+\.)?konachan\.com\/(?:image|jpeg|sample)\/[a-f0-9]{32}\/Konachan\.com%20-%20(\d+)/i))) + url = "https://konachan.com/post/show/" + urlReg[1]; + else if (!!(urlReg = source.match(/^https?:\/\/(?:[^.]+\.)?konachan\.com\/(?:image|jpeg|sample)\/([a-f0-9]{32})(?:\/Konachan\.com%20-%20.*|\/?\.(?:jpg|png))$/i))) + url = "https://konachan.com/post?tags=md5:" + urlReg[1]; else if (!!(urlReg = source.match(/^https?:\/\/\w+\.artstation.com\/(?:artwork|projects)\/([a-z0-9-]+)$/i))) url = "https://www.artstation.com/artwork/" + urlReg[1]; else if (!!(urlReg = source.match(/^https?:\/\/(?:o|image-proxy-origin)\.twimg\.com\/\d\/proxy\.jpg\?t=(\w+)&/i))) { @@ -6544,6 +6548,10 @@ function bbbScript() { // Wrapper for injecting the script into the document. url = "https://photozou.jp/photo/show/" + urlReg[1] + "/" + urlReg[2]; else if (!!(urlReg = source.match(/^https?:\/\/\w+\.?toranoana\.jp\/(?:popup_(?:bl)?img\d*|ec\/img)\/\d{2}\/\d{4}\/\d{2}\/\d{2}\/(\d+)/i))) url = "https://ec.toranoana.jp/tora_r/ec/item/" + urlReg[1] + "/"; + else if (!!(urlReg = source.match(/^https?:\/\/\w+\.hitomi\.la\/galleries\/(\d+)\/(?:page)?(\d+)\w*\.[a-z]+$/i))) + url = "https://hitomi.la/reader/" + urlReg[1] + ".html#" + parseInt(urlReg[2], 10); + else if (!!(urlReg = source.match(/^https?:\/\/\w+\.hitomi\.la\/galleries\/(\d+)\/\w*\.[a-z]+$/i))) + url = "https://hitomi.la/galleries/" + urlReg[1] + ".html"; else url = source; From ca83a138ce27427c350e4e5cc80a5aa6461ec997 Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Thu, 11 Oct 2018 22:34:58 -0400 Subject: [PATCH 7/7] Version 8.2.3 --- README.md | 2 +- better-better-booru.user.js | 5 +++-- changelog.md | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 360a679..5588d36 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Features * Additional bars - Add a blacklist bar to thumbnail sections without it so that blacklist entries can be toggled as needed. * Video playback - When viewing a blacklisted video post, control whether it pauses and plays based on its hidden status. * Ignore favorites - Exclude your favorited posts from being hidden. - * Added support for wildcards (*), the "or/any" operator (~), nesting/grouping, and additional metatags. + * Added support for wildcards (*), nesting/grouping, and additional metatags. * Multiple options and features for altering post viewing: * Alternate image swap - Swap between the sample and original image by clicking the image. * Resize image mode - Set the initial automatic resizing of an image to be by width, height, or both. diff --git a/better-better-booru.user.js b/better-better-booru.user.js index ba80bcb..30863a8 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -3,7 +3,7 @@ // @namespace https://greasyfork.org/scripts/3575-better-better-booru // @author otani, modified by Jawertae, A Pseudonymous Coder & Moebius Strip. // @description Several changes to make Danbooru much better. -// @version 8.2.2 +// @version 8.2.3 // @updateURL https://greasyfork.org/scripts/3575-better-better-booru/code/better_better_booru.meta.js // @downloadURL https://greasyfork.org/scripts/3575-better-better-booru/code/better_better_booru.user.js // @match *://*.donmai.us/* @@ -358,7 +358,7 @@ function bbbScript() { // Wrapper for injecting the script into the document. swapped: false // Whether the post content has been changed between the original and sample versions. }, options: { // Setting options and data. - bbb_version: "8.2.2", + bbb_version: "8.2.3", add_popular_link: newOption("checkbox", false, "Add Popular Link", "Add a link to the popular listing to the \"posts\" submenu"), add_random_post_link: newOption("checkbox", false, "Add Random Link", "Add a link to a random post to the post sidebar options menu."), alternate_image_swap: newOption("checkbox", false, "Alternate Image Swap", "Switch between the sample and original image by clicking the image. NoteNotes can be toggled by using the link in the sidebar options section."), @@ -3415,6 +3415,7 @@ function bbbScript() { // Wrapper for injecting the script into the document. case "8.1": case "8.2": case "8.2.1": + case "8.2.2": break; } diff --git a/changelog.md b/changelog.md index 6c2d227..c72fffe 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ Changelog ---------- +* Version 8.2.3: + * Updated the post resizing to make it leave less empty vertical space. + * Updated to support Danbooru's normalized source update. + * Fixed endless pages for pools and favorite groups. + * Fixed the "add popular link" option. + * Fixed the blacklist link color. * Version 8.2.2: * Added "filetype" to the script metatags. * Updated to support Danbooru's new orange metatags.