Skip to content

Commit

Permalink
Version 6.5
Browse files Browse the repository at this point in the history
* Made the swapImage function not work on ugoira posts when the swap hotkey ("v") is pressed.
* Added a test for the direct download links used with misc. files in the scrapePost function.
  • Loading branch information
Moebius-Strip committed Nov 25, 2014
1 parent 2377b5a commit a47f485
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions better-better-booru.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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. Including the viewing of hidden/censored images on non-upgraded accounts and more.
// @version 6.4
// @version 6.5
// @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 http://*.donmai.us/*
Expand Down Expand Up @@ -63,7 +63,7 @@ function bbbScript() { // This is needed to make this script work in Chrome.
translationMode: false
},
options: { // Setting options and data.
bbb_version: "6.4",
bbb_version: "6.5",
alternate_image_swap: new Option("checkbox", false, "Alternate Image Swap", "Switch between the sample and original image by clicking the image. Notes can be toggled by using the link in the sidebar options section."),
arrow_nav: new Option("checkbox", false, "Arrow Navigation", "Allow the use of the left and right arrow keys to navigate pages. Has no effect on individual posts."),
autohide_sidebar: new Option("dropdown", "none", "Auto-hide Sidebar", "Hide the sidebar for individual posts and/or searches until the mouse comes close to the left side of the window or the sidebar gains focus.<br><br><u>Tips</u><br>By using Danbooru's keyboard shortcut for the letter \"Q\" to place focus on the search box, you can unhide the sidebar.<br><br>Use the thumbnail count option to get the most out of this feature on search listings.", {txtOptions:["Disabled:none", "Searches:search", "Posts:post", "Searches & Posts:post search"]}),
Expand Down Expand Up @@ -395,6 +395,7 @@ function bbbScript() { // This is needed to make this script work in Chrome.
var object = imgContainer.getElementsByTagName("object")[0];
var webmVid = imgContainer.getElementsByTagName("video")[0];
var ugoira = imgContainer.getElementsByTagName("canvas")[0];
var other = document.evaluate('.//a[starts-with(@href, "/data/")]', imgContainer, null, 9, null).singleNodeValue;
var dataInfo = [imgContainer.getAttribute("data-file-url"), imgContainer.getAttribute("data-md5"), imgContainer.getAttribute("data-file-ext")];
var directLink = getId("image-resize-link", target, "a") || document.evaluate('.//section[@id="post-information"]/ul/li/a[starts-with(@href, "/data/")]', target, null, 9, null).singleNodeValue;
var twitterInfo = fetchMeta("twitter:image:src", target);
Expand Down Expand Up @@ -427,7 +428,7 @@ function bbbScript() { // This is needed to make this script work in Chrome.
is_banned: (imgContainer.getAttribute("data-flags").indexOf("banned") < 0 ? false : true),
image_height: imgHeight || null,
image_width: imgWidth || null,
is_hidden: (img || object || webmVid ? false : true)
is_hidden: (img || object || webmVid || ugoira || other ? false : true)
};

// Try to extract the file's name and extension.
Expand Down Expand Up @@ -456,7 +457,7 @@ function bbbScript() { // This is needed to make this script work in Chrome.
}
}

var isUgoira = (ugoira || (ext === "zip" && /\bugoira\b/.test(imgInfo.tag_string)));
var isUgoira = ugoira || (ext === "zip" && /\bugoira\b/.test(imgInfo.tag_string));

if (isUgoira) {
if (ugoira) {
Expand Down Expand Up @@ -2494,6 +2495,7 @@ function bbbScript() { // This is needed to make this script work in Chrome.
case "6.3":
case "6.3.1":
case "6.3.2":
case "6.4":
break;
}

Expand Down Expand Up @@ -2826,7 +2828,7 @@ function bbbScript() { // This is needed to make this script work in Chrome.
var swapLink = bbb.el.swapLink;
var ratio = (post.image_width > 850 ? 850 / post.image_width : 1);

if (!post.has_large)
if (!post.has_large || (post.file_ext === "zip" && /\bugoira\b/.test(post.tag_string)))
return;

if (bbbLoader.src !== "about:blank") {
Expand Down

0 comments on commit a47f485

Please sign in to comment.