diff --git a/README.md b/README.md
index 4d8f652..360a679 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,9 @@ Features
* Fixed sidebar - Fix/stick the sidebar to the left side of the page and prevent it from vertically scrolling out of view.
* Collapsible sidebar - Allow sections of the sidebar to be minimized and expanded.
* Fixed paginator - Fix/stick the paginator to the bottom of the window and prevent it from scrolling out of view.
- * Move save search - Move the "save this search" button into the sidebar.
+ * Hide favorite button - Remove the button below post content.
+ * Add random link - Allow random post access from each post.
+ * Add popular link - Allow easier popular post listing access from most post pages.
* Various options for easily modifying status borders to your liking and creating your own secondary custom borders that match images based on your criteria.
* Various options for customizing the majority of notices by either altering or hiding them.
* Several other miscellaneous options:
diff --git a/better-better-booru.user.js b/better-better-booru.user.js
index d0b835f..f472f97 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.0.2
+// @version 8.1
// @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/*
@@ -169,8 +169,15 @@ function bbbScript() { // Wrapper for injecting the script into the document.
return this.getAttribute("data-" + name);
else if (this.bbbHasClass("post-preview"))
return scrapeThumb(this);
- else
- return scrapePost(this);
+ else {
+ // Always try to send the HTML element in order to provide the most information.
+ var parent = this;
+
+ while (parent.parentNode)
+ parent = parent.parentNode;
+
+ return scrapePost(parent);
+ }
};
document.bbbInfo = function(name, value) {
@@ -315,7 +322,9 @@ 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.0.2",
+ bbb_version: "8.1",
+ 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."),
autohide_sidebar: newOption("dropdown", "none", "Auto-hide Sidebar", "Hide the sidebar for posts, favorites listings, and/or searches until the mouse comes close to the left side of the window or the sidebar gains focus.TipsBy using Danbooru's hotkey for the letter \"Q\" to place focus on the search box, you can unhide the sidebar.
Use the \"thumbnail count\" option to get the most out of this feature on search listings.", {txtOptions:["Disabled:none", "Favorites:favorites", "Posts:post", "Searches:search", "Favorites & Posts:favorites post", "Favorites & Searches:favorites search", "Posts & Searches:post search", "All:favorites post search"]}),
autoscroll_post: newOption("dropdown", "none", "Auto-scroll Post", "Automatically scroll a post to a particular point. Below Header: Scroll the window down until the header is no longer visible or scrolling is no longer possible. Post Content: Position the post content as close as possible to the left and top edges of the window viewport when initially loading a post. Using this option will also scroll past any notices above the content.", {txtOptions:["Disabled:none", "Below Header:header", "Post Content:post"]}),
@@ -353,6 +362,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
fixed_sidebar: newOption("dropdown", "none", "Fixed Sidebar", "Make the sidebar never completely vertically scroll out of view for posts, favorites listings, and/or searches by fixing it to the top or bottom of the window when it would normally start scrolling out of view. NoteThe \"auto-hide sidebar\" option will override this option if both try to modify the same page. TipDepending on the available height in the browser window and the Danbooru location being modified, the \"tag scrollbars\", \"collapsible sidebar\", and/or \"remove tag headers\" options may be needed for best results.", {txtOptions:["Disabled:none", "Favorites:favorites", "Posts:post", "Searches:search", "Favorites & Posts:favorites post", "Favorites & Searches:favorites search", "Posts & Searches:post search", "All:favorites post search"]}),
hide_ban_notice: newOption("checkbox", false, "Hide Ban Notice", "Hide the Danbooru ban notice."),
hide_comment_notice: newOption("checkbox", false, "Hide Comment Guide Notice", "Hide the Danbooru comment guide notice."),
+ hide_fav_button: newOption ("checkbox", false, "Hide Favorite Button", "Hide the favorite button below post content."),
hide_pool_notice: newOption("checkbox", false, "Hide Pool Guide Notice", "Hide the Danbooru pool guide notice."),
hide_sign_up_notice: newOption("checkbox", false, "Hide Sign Up Notice", "Hide the Danbooru account sign up notice."),
hide_tag_notice: newOption("checkbox", false, "Hide Tag Guide Notice", "Hide the Danbooru tag guide notice."),
@@ -421,7 +431,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
notices: newSection("general", ["show_resized_notice", "minimize_status_notices", "hide_sign_up_notice", "hide_upgrade_notice", "hide_hidden_notice", "hide_tos_notice", "hide_comment_notice", "hide_tag_notice", "hide_upload_notice", "hide_pool_notice", "hide_ban_notice"], "Notices"),
sidebar: newSection("general", ["remove_tag_headers", "post_tag_scrollbars", "search_tag_scrollbars", "autohide_sidebar", "fixed_sidebar", "collapse_sidebar"], "Tag Sidebar"),
misc: newSection("general", ["direct_downloads", "track_new", "clean_links", "post_tag_titles", "search_add", "page_counter", "comment_score", "quick_search"], "Misc."),
- misc_layout: newSection("general", ["fixed_paginator"], "Misc."),
+ misc_layout: newSection("general", ["fixed_paginator", "hide_fav_button", "add_popular_link", "add_random_post_link"], "Misc."),
script_settings: newSection("general", ["bypass_api", "manage_cookies", "enable_status_message", "enable_menu_autocomplete", "resize_link_style", "override_blacklist", "override_resize", "override_sample", "disable_tagged_filenames", "thumbnail_count_default"], "Script Settings"),
status_borders: newSection("border", "status_borders", "Custom Status Borders", "When using custom status borders, the borders can be edited here. For easy color selection, use one of the many free tools on the internet like this one."),
tag_borders: newSection("border", "tag_borders", "Custom Tag Borders", "When using custom tag borders, the borders can be edited here. For easy color selection, use one of the many free tools on the internet like this one.")
@@ -489,6 +499,9 @@ function bbbScript() { // Wrapper for injecting the script into the document.
var disable_tagged_filenames = bbb.user.disable_tagged_filenames;
var track_new = bbb.user.track_new;
+ var add_popular_link = bbb.user.add_popular_link;
+ var add_random_post_link = bbb.user.add_random_post_link;
+ var hide_fav_button = bbb.user.hide_fav_button;
var show_resized_notice = bbb.user.show_resized_notice;
var hide_sign_up_notice = bbb.user.hide_sign_up_notice;
var hide_upgrade_notice = bbb.user.hide_upgrade_notice;
@@ -555,6 +568,8 @@ function bbbScript() { // Wrapper for injecting the script into the document.
thumbInfo();
+ addPopularLink();
+
removeTagHeaders();
searchAdd();
@@ -804,6 +819,9 @@ function bbbScript() { // Wrapper for injecting the script into the document.
// Enable the "Toggle Notes", "Random Post", and "Find similar" options for logged out users.
fixOptionsSection();
+ // Add the random post link.
+ addRandomPostLink();
+
// Replace the "resize to window" link with new resize links.
modifyResizeLink();
@@ -823,6 +841,9 @@ function bbbScript() { // Wrapper for injecting the script into the document.
// Fix the post links in the sidebar.
fixPostDownloadLinks();
+ // Add the random post link.
+ addRandomPostLink();
+
// Replace the "resize to window" link with new resize links.
modifyResizeLink();
@@ -1388,32 +1409,32 @@ function bbbScript() { // Wrapper for injecting the script into the document.
var postEl = postContent.el;
var postTag = (postEl ? postEl.tagName : undefined);
- var flags = imgContainer.getAttribute("data-flags");
+ var flags = imgContainer.getAttribute("data-flags") || "";
var imgInfo = {
- md5: imgContainer.getAttribute("data-md5"),
- file_ext: imgContainer.getAttribute("data-file-ext"),
- file_url: imgContainer.getAttribute("data-file-url"),
- large_file_url: imgContainer.getAttribute("data-large-file-url"),
- preview_file_url: imgContainer.getAttribute("data-preview-file-url"),
+ md5: imgContainer.getAttribute("data-md5") || "",
+ file_ext: imgContainer.getAttribute("data-file-ext") || "",
+ file_url: imgContainer.getAttribute("data-file-url") || "",
+ large_file_url: imgContainer.getAttribute("data-large-file-url") || "",
+ preview_file_url: imgContainer.getAttribute("data-preview-file-url") || "",
has_large: undefined,
- id: Number(imgContainer.getAttribute("data-id")),
+ id: Number(imgContainer.getAttribute("data-id")) || 0,
pixiv_id: Number(imgContainer.getAttribute("data-pixiv-id")) || null,
- fav_count: Number(imgContainer.getAttribute("data-fav-count")),
+ fav_count: Number(imgContainer.getAttribute("data-fav-count")) || 0,
has_children: (imgContainer.getAttribute("data-has-children") === "true"),
has_active_children: (postTag === "IMG" || postTag === "CANVAS" ? postEl.getAttribute("data-has-active-children") === "true" : !!target.getElementsByClassName("notice-parent")[0]),
fav_string: getMeta("favorites", docEl),
parent_id: (imgContainer.getAttribute("data-parent-id") ? Number(imgContainer.getAttribute("data-parent-id")) : null),
- rating: imgContainer.getAttribute("data-rating"),
- score: Number(imgContainer.getAttribute("data-score")),
- source: imgContainer.getAttribute("data-source"),
- tag_string: imgContainer.getAttribute("data-tags"),
+ rating: imgContainer.getAttribute("data-rating") || "",
+ score: Number(imgContainer.getAttribute("data-score")) || 0,
+ source: imgContainer.getAttribute("data-source") || "",
+ tag_string: imgContainer.getAttribute("data-tags") || "",
tag_string_artist: scrapePostTags("artist", target),
tag_string_character: scrapePostTags("character", target),
tag_string_copyright: scrapePostTags("copyright", target),
tag_string_general: scrapePostTags("general", target),
- pool_string: imgContainer.getAttribute("data-pools"),
- uploader_name: imgContainer.getAttribute("data-uploader"),
+ pool_string: imgContainer.getAttribute("data-pools") || "",
+ uploader_name: imgContainer.getAttribute("data-uploader") || "",
approver_id: imgContainer.getAttribute("data-approver-id") || null,
is_deleted: (flags.indexOf("deleted") > -1),
is_flagged: (flags.indexOf("flagged") > -1),
@@ -1472,7 +1493,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
function scrapeThumb(post) {
// Retrieve info from a thumbnail and return it as API styled info. Mainly for remaking thumbnails.
- var flags = post.getAttribute("data-flags");
+ var flags = post.getAttribute("data-flags") || "";
var imgInfo = {
md5: post.getAttribute("data-md5") || "",
file_ext: post.getAttribute("data-file-ext") || "",
@@ -1481,19 +1502,19 @@ function bbbScript() { // Wrapper for injecting the script into the document.
preview_file_url: post.getAttribute("data-preview-file-url") || "",
file_url_desc: post.getAttribute("data-file-url-desc") || undefined,
has_large: undefined,
- id: Number(post.getAttribute("data-id")),
+ id: Number(post.getAttribute("data-id")) || 0,
pixiv_id: Number(post.getAttribute("data-pixiv-id")) || null,
- fav_count: Number(post.getAttribute("data-fav-count")),
+ fav_count: Number(post.getAttribute("data-fav-count")) || 0,
has_children: (post.getAttribute("data-has-children") === "true"),
has_active_children: post.bbbHasClass("post-status-has-children"), // Assumption. Basically a flag for the children class.
fav_string: (post.getAttribute("data-is-favorited") === "true" ? "fav:" + getMeta("current-user-id") : ""), // Faked since thumbnails don't provide the full list of favorites.
parent_id: (post.getAttribute("data-parent-id") ? Number(post.getAttribute("data-parent-id")) : null),
- rating: post.getAttribute("data-rating"),
- score: Number(post.getAttribute("data-score")),
- source: post.getAttribute("data-source"),
- tag_string: post.getAttribute("data-tags"),
- pool_string: post.getAttribute("data-pools"),
- uploader_name: post.getAttribute("data-uploader"),
+ rating: post.getAttribute("data-rating") || "",
+ score: Number(post.getAttribute("data-score")) || 0,
+ source: post.getAttribute("data-source") || "",
+ tag_string: post.getAttribute("data-tags") || "",
+ pool_string: post.getAttribute("data-pools") || "",
+ uploader_name: post.getAttribute("data-uploader") || "",
approver_id: post.getAttribute("data-approver-id") || null,
is_deleted: (flags.indexOf("deleted") > -1),
is_flagged: (flags.indexOf("flagged") > -1),
@@ -1985,7 +2006,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
helpPage.className = "bbb-page";
scrollDiv.appendChild(helpPage);
- helpPage.bbbTextSection('Thumbnail Matching Rules', 'For creating thumbnail matching rules, please consult the following examples:
- tag1 - Match posts with tag1.
- tag1 tag2 - Match posts with tag1 AND tag2.
- -tag1 - Match posts without tag1.
- tag1 -tag2 - Match posts with tag1 AND without tag2.
- ~tag1 ~tag2 - Match posts with tag1 OR tag2.
- ~tag1 ~-tag2 - Match posts with tag1 OR without tag2.
- tag1 ~tag2 ~tag3 - Match posts with tag1 AND either tag2 OR tag3.
Wildcards can be used with any of the above methods:- ~tag1* ~-*tag2 - Match posts with tags starting with tag1 or posts without tags ending with tag2.
Multiple match rules can be specified by using commas or separate lines when possible:- tag1 tag2, tag3 tag4 - Match posts with tag1 AND tag2 or posts with tag3 AND tag4.
- tag1 ~tag2 ~tag3, tag4 - Match posts with tag1 AND either tag2 OR tag3 or posts with tag4.
Tags can be nested/grouped together by using parentheses that only have spaces or commas next to them:- ( ~tag1 ~tag2 ) ( ~tag3 ~tag3 ) - Match posts with either tag1 OR tag2 AND either tag3 OR tag4.
- tag1 ( tag2, tag3 tag4 ) - Match posts with tag1 AND tag2 or posts with tag1 AND tag3 AND tag4.
- tag1 -( tag2 tag3 ) - Match posts with tag1 AND without tag2 AND tag3.
- tag1 ~tag2 ~( tag3 tag4 ) - Match posts with tag1 and either tag2 OR tag3 AND tag4.
The following metatags are supported:- rating:safe - Match posts rated safe. Accepted values include safe, explicit, and questionable.
- status:pending - Match pending posts. Accepted values include active, pending, flagged, banned, and deleted. Note that flagged posts also count as active posts.
- user:albert - Match posts made by the user Albert.
- isfav:true - Match posts favorited under your current account. Accepted values include true and false.
- group:hidden or g:hidden - Match posts that match the tags in your group named \"hidden\".
- pool:1 - Match posts that are in the pool with an ID number of 1. Accepted values include pool ID numbers, "series" for posts in series category pools, "collection" for posts in collection category pools, "any" for posts in any pool, "none" for posts not in a pool, "active" for posts in an active (not deleted) pool, and "inactive" for posts only in an inactive (deleted) pool.
- parent:1 - Match posts that have the post with an ID number of 1 as a parent. Accepted values include post ID numbers, "any" for any posts with a parent, and "none" for posts without a parent.
- child:any - Match any posts that have children. Accepted values include "any" for any posts with children and "none" for posts without children.
- id:1 - Match posts with an ID number of 1.
- score:1 - Match posts with a score of 1.
- favcount:1 - Match posts with a favorite count of 1.
- height:1 - Match posts with a height of 1.
- width:1 - Match posts with a width of 1.
The id, score, favcount, width, and height metatags can also use number ranges for matching:- score:<5 - Match posts with a score less than 5.
- score:>5 - Match posts with a score greater than 5.
- score:<=5 or score:..5 - Match posts with a score equal to OR less than 5.
- score:>=5 or score:5.. - Match posts with a score equal to OR greater than 5.
- score:1..5 - Match posts with a score equal to OR greater than 1 AND equal to OR less than 5.
');
+ helpPage.bbbTextSection('Thumbnail Matching Rules', 'For creating thumbnail matching rules, please consult the following examples:- tag1 - Match posts with tag1.
- tag1 tag2 - Match posts with tag1 AND tag2.
- -tag1 - Match posts without tag1.
- tag1 -tag2 - Match posts with tag1 AND without tag2.
- ~tag1 ~tag2 - Match posts with tag1 OR tag2.
- ~tag1 ~-tag2 - Match posts with tag1 OR without tag2.
- tag1 ~tag2 ~tag3 - Match posts with tag1 AND either tag2 OR tag3.
Wildcards can be used with any of the above methods:- ~tag1* ~-*tag2 - Match posts with tags starting with tag1 or posts without tags ending with tag2.
Multiple match rules can be specified by using commas or separate lines when possible:- tag1 tag2, tag3 tag4 - Match posts with tag1 AND tag2 or posts with tag3 AND tag4.
- tag1 ~tag2 ~tag3, tag4 - Match posts with tag1 AND either tag2 OR tag3 or posts with tag4.
Tags can be nested/grouped together by using parentheses that only have spaces or commas next to them:- ( ~tag1 ~tag2 ) ( ~tag3 ~tag3 ) - Match posts with either tag1 OR tag2 AND either tag3 OR tag4.
- tag1 ( tag2, tag3 tag4 ) - Match posts with tag1 AND tag2 or posts with tag1 AND tag3 AND tag4.
- tag1 -( tag2 tag3 ) - Match posts with tag1 AND without tag2 AND tag3.
- tag1 ~tag2 ~( tag3 tag4 ) - Match posts with tag1 and either tag2 OR tag3 AND tag4.
The following metatags are supported:- rating:safe - Match posts rated safe. Accepted values include safe, explicit, and questionable.
- status:pending - Match pending posts. Accepted values include active, pending, flagged, banned, and deleted. Note that flagged posts also count as active posts.
- user:albert - Match posts made by the user Albert. Note that this tag will only work when viewing posts since Danbooru doesn\'t provide uploader information for thumbnail listings.
- isfav:true - Match posts favorited under your current account. Accepted values include true and false.
- group:hidden or g:hidden - Match posts that match the tags in your group named \"hidden\".
- pool:1 - Match posts that are in the pool with an ID number of 1. Accepted values include pool ID numbers, "series" for posts in series category pools, "collection" for posts in collection category pools, "any" for posts in any pool, "none" for posts not in a pool, "active" for posts in an active (not deleted) pool, and "inactive" for posts only in an inactive (deleted) pool.
- parent:1 - Match posts that have the post with an ID number of 1 as a parent. Accepted values include post ID numbers, "any" for any posts with a parent, and "none" for posts without a parent.
- child:any - Match any posts that have children. Accepted values include "any" for any posts with children and "none" for posts without children.
- id:1 - Match posts with an ID number of 1.
- score:1 - Match posts with a score of 1.
- favcount:1 - Match posts with a favorite count of 1.
- height:1 - Match posts with a height of 1.
- width:1 - Match posts with a width of 1.
The id, score, favcount, width, and height metatags can also use number ranges for matching:- score:<5 - Match posts with a score less than 5.
- score:>5 - Match posts with a score greater than 5.
- score:<=5 or score:..5 - Match posts with a score equal to OR less than 5.
- score:>=5 or score:5.. - Match posts with a score equal to OR greater than 5.
- score:1..5 - Match posts with a score equal to OR greater than 1 AND equal to OR less than 5.
');
helpPage.bbbTextSection('Hotkeys', 'Posts- B - Open BBB menu.
- 1 - Resize to window.
- 2 - Resize to window width.
- 3 - Resize to window height.
- 4 - Reset/remove resizing.
Note: Numbers refer to the main typing keypad and not the numeric keypad.
General- B - Open BBB menu.
- E - Toggle endless pages.
- F - Open quick search.
- Shift + F - Reset quick search.
');
helpPage.bbbTextSection('Questions, Suggestions, or Bugs?', 'If you have any questions, please use the Greasy Fork feedback forums located here. If you\'d like to report a bug or make a suggestion, please create an issue on GitHub here.');
helpPage.bbbTocSection();
@@ -3345,11 +3366,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
deleteData("bbb_thumb_cache");
case "8.0":
case "8.0.1":
- if (reason !== "backup") {
- cleanLocalStorage("autocomplete");
- localStorage.bbbSetItem("bbb_settings", JSON.stringify(bbb.user));
- bbbNotice("Upon the release of Firefox 57 and the move over to Greasemonkey 4, BBB will not be able to fully support Greasemonkey due to decisions the developers have made about loading and saving data. Greasemonkey users will have to revert back to using an older storage method that will still work while suffering a few disadvantages. Those disadvantages include: 1) A much more limited amount of space for storage. 2) The inability to have your settings persist across all Danbooru subdomains and during private browsing. If you are reading this, a copy of your settings has already been saved using the old method, but it is advised that you create a separate backup before updating to Firefox 57 to collect any new changes and/or guard against any unforeseen problems.", 0);
- }
+ case "8.0.2":
break;
}
@@ -3796,6 +3813,35 @@ function bbbScript() { // Wrapper for injecting the script into the document.
optionsSection.innerHTML = 'Options
';
}
+ function addRandomPostLink() {
+ // Add the random post link and hotkey back to posts.
+ var optionListItem = document.getElementById("add-to-pool-list") || document.getElementById("add-notes-list") || document.getElementById("add-artist-commentary-list");
+
+ if (!optionListItem || !add_random_post_link || gLoc !== "post")
+ return;
+
+ // Create the link.
+ var searchTags = getVar("tags");
+
+ var randomListItem = document.createElement("li");
+ randomListItem.id = "random-post-list";
+
+ var randomLink = document.createElement("a");
+ randomLink.id = "random-post";
+ randomLink.href = "/posts/random" + (searchTags ? "?tags=" + searchTags : "");
+ randomLink.innerHTML = "Random post";
+ randomListItem.appendChild(randomLink);
+
+ optionListItem.parentNode.insertBefore(randomListItem, optionListItem);
+
+ // Create the hotkey.
+ function randomHotkey() {
+ location.href = randomLink.href;
+ }
+
+ createHotkey("82", randomHotkey); // R
+ }
+
function fixPostDownloadLinks() {
// Fix the "size" and "download" links in the sidebar by creating the download link for logged out users (when able) and handling tagged filenames as necessary for all users.
var postInfo = bbb.post.info;
@@ -6324,7 +6370,9 @@ function bbbScript() { // Wrapper for injecting the script into the document.
function postFileUrlDesc(postInfo) {
// Create/return the file URL desc property.
- if (typeof(postInfo.file_url_desc) === "string")
+ if (gLoc !== "post") // Danbooru doesn't provide this information for thumbnail listings.
+ return "";
+ else if (typeof(postInfo.file_url_desc) === "string")
return postInfo.file_url_desc;
else if (postInfo.file_url.indexOf("__") > -1)
return "__" + postInfo.file_url.split("__")[1] + "__";
@@ -6341,8 +6389,8 @@ function bbbScript() { // Wrapper for injecting the script into the document.
postInfo.large_file_img_src = postInfo.large_file_url.replace(postInfo.file_url_desc, "");
}
else if (!disable_tagged_filenames && postInfo.file_url.indexOf("__") < 0) {
- postInfo.file_img_src = postInfo.file_url.replace(/\/(?=[\w\_]+\.\w+$)/, "/" + postInfo.file_url_desc);
- postInfo.large_file_img_src = postInfo.large_file_url.replace(/\/(?=[\w\_]+\.\w+$)/, "/" + postInfo.file_url_desc);
+ postInfo.file_img_src = postInfo.file_url.replace(/\/(?=[\w\-]+\.\w+$)/, "/" + postInfo.file_url_desc);
+ postInfo.large_file_img_src = postInfo.large_file_url.replace(/\/(?=[\w\-]+\.\w+$)/, "/" + postInfo.file_url_desc);
}
else {
postInfo.file_img_src = postInfo.file_url;
@@ -7084,7 +7132,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
if (string.indexOf("BBBPARENS") < 0) {
// Replace parentheses that are not part of a tag with placeholders.
- var parensRegex = /(?:^|([\s,]))([-~])*\(%?(?=$|[\s,])|(?:^|([\s,]))%?\)(?=$|[\s,])/;
+ var parensRegex = /(?:^|([\s,]))([-~]*)\(%?(?=$|[\s,])|(?:^|([\s,]))%?\)(?=$|[\s,])/;
if (!parensRegex.test(string))
return {search: string, groups: []};
@@ -7104,7 +7152,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
// Remove unpaired opening parentheses near the end of the search.
while (parens[parens.length - 1] === "BBBPARENSOPEN") {
- searchString = searchString.replace(/^(.*\s)?[~-]*\BBBPARENSOPEN/, "$1");
+ searchString = searchString.replace(/^(.*\s)?[~-]*BBBPARENSOPEN/, "$1");
parens.pop();
}
@@ -7139,7 +7187,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
groups.push(groupMatch.substring(13, groupMatch.length - 14));
}
else if (!nextParen && startCount > 0 && endCount === 0 ) // Remove leftover unpaired opening parentheses.
- searchString = searchString.replace(/^(.*\s)?[~-]*\BBBPARENSOPEN/, "$1");
+ searchString = searchString.replace(/^(.*\s)?[~-]*BBBPARENSOPEN/, "$1");
}
return {search: searchString, groups: groups};
@@ -7792,6 +7840,9 @@ function bbbScript() { // Wrapper for injecting the script into the document.
if (hide_hidden_notice)
styles += '.hidden-posts-notice {display: none !important;}';
+ if (hide_fav_button)
+ styles += '.fav-buttons {display: none !important;}';
+
customStyles.innerHTML = styles;
document.getElementsByTagName("head")[0].appendChild(customStyles);
}
@@ -9403,6 +9454,24 @@ function bbbScript() { // Wrapper for injecting the script into the document.
event.preventDefault();
}
+ 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");
+
+ if (!subListItem || !add_popular_link)
+ return;
+
+ var popularListItem = document.createElement("li");
+ popularListItem.id = "secondary-links-posts-popular";
+
+ var popularLink = document.createElement("a");
+ popularLink.href = "/explore/posts/popular";
+ popularLink.innerHTML = "Popular";
+ popularListItem.appendChild(popularLink);
+
+ subListItem.parentNode.insertBefore(popularListItem, subListItem);
+ }
+
function eraseSettingDialog() {
// Open a dialog box for erasing various BBB information.
var options = [
@@ -9988,6 +10057,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
Danbooru.Autocomplete.static_metatags.group = Danbooru.Autocomplete.static_metatags.g = groups;
Danbooru.Autocomplete.static_metatags.parent = ["any", "none"];
Danbooru.Autocomplete.static_metatags.isfav = ["true", "false"];
+ Danbooru.Autocomplete.static_metatags.pool = ["series", "collection", "any", "none", "active", "inactive"];
// Counter normal autocomplete getting turned back on after submitting an input.
document.body.addEventListener("focus", function(event) {
@@ -10064,6 +10134,7 @@ function bbbScript() { // Wrapper for injecting the script into the document.
case "group":
case "g":
case "isfav":
+ case "pool":
Danbooru.Autocomplete.static_metatag_source(term, resp, metatag);
return;
}
@@ -10187,4 +10258,4 @@ function bbbInit() {
window.setTimeout(function() { document.body.removeChild(script); }, 0);
}
-bbbInit();
\ No newline at end of file
+bbbInit();
diff --git a/changelog.md b/changelog.md
index 1542c83..865d3f5 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,14 @@
Changelog
----------
+* Version 8.1:
+ * Added a "hide favorite button" layout option for hiding the button underneath post content.
+ * Added an "add random link" layout option for placing a link to a random post in the sidebar options menu of posts.
+ * Added an "add popular link" layout option for placing a link to the popular listing in the submenu of the posts section.
+ * Added the custom pool metatag values ("active", etc.) to tag autocomplete.
+ * Updated to support Danbooru removing uploader names from thumbnail listings ("user" metatag will no longer work on them).
+ * Updated to support Danbooru removing description tags from thumbnail listing information.
+ * Fixed the insertion of description tags into sample post URLs.
+ * Fixed the operators for the "group" metatag so that both "or" (~) and "exclude" (-) can be used at the same time.
* Version 8.0.2:
* Updated to notify Greasemonkey users about the upcoming changes Firefox 57 and Greasemonkey 4 will bring.
* Version 8.0.1: