From a8ccae9426ea6aacd018acc3721cba0fedccc425 Mon Sep 17 00:00:00 2001 From: Moebius-Strip Date: Thu, 8 Jan 2015 03:25:01 -0500 Subject: [PATCH] Version 6.5.4 Addendum * Fixed the disabling of translation mode on ugoira sample videos when using the forced "view sample" URL. --- better-better-booru.user.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/better-better-booru.user.js b/better-better-booru.user.js index 34ce2c8..414669a 100644 --- a/better-better-booru.user.js +++ b/better-better-booru.user.js @@ -1767,8 +1767,8 @@ function bbbScript() { // This is needed to make this script work in Chrome. itemFrag.appendChild(item); break; default: - console.log("Better Better Booru Error: Unexpected object type. Type: " + optionObject.type); - break; + danbNotice('Better Better Booru: Unexpected menu object type for "' + optionObject.label + '". (Type: ' + optionObject.type + ')', "error"); + return label; } inputSpan.appendChild(itemFrag); @@ -2773,6 +2773,7 @@ function bbbScript() { // This is needed to make this script work in Chrome. } else if (targetTag === "EMBED") { var secondaryTarget = postContent.secEl; + secondaryTarget.height = target.height = targetHeight * ratio; secondaryTarget.width = target.width = targetWidth * ratio; } @@ -4524,6 +4525,25 @@ function bbbScript() { // This is needed to make this script work in Chrome. return urlParts[0] + "?" + urlQuery; } + function removeDanbHotkey(key) { + // Remove a jQuery hotkey without a namespace from Danbooru. + try { + var jkp = $._data(document, "events").keypress; + + for (var i = 0, il = jkp.length; i < il; i++) { + if (jkp[i].data.keys === key) { + jkp[i].namespace = "bbbdiekey"; + $(document).unbind("keypress.bbbdiekey"); + i--; + il--; + } + } + } + catch (error) { + return; + } + } + function bbbStatusInit() { // Insert the status message container and prep the request tracking. var statusDiv = document.createElement("div"); @@ -4774,8 +4794,11 @@ function bbbScript() { // This is needed to make this script work in Chrome. }; Danbooru.Note.Edit.show = Danbooru.Note.TranslationMode.toggle; - if (translateLink) + if (translateLink) { + removeDanbHotkey("n"); + $(translateLink).unbind(); translateLink.addEventListener("click", Danbooru.Note.TranslationMode.toggle, false); + } } } else if (translateLink) { // If the translate link exists on webm videos or flash, provide a warning. @@ -4784,6 +4807,8 @@ function bbbScript() { // This is needed to make this script work in Chrome. event.preventDefault(); }; Danbooru.Note.Edit.show = Danbooru.Note.TranslationMode.toggle; + removeDanbHotkey("n"); + $(translateLink).unbind(); translateLink.addEventListener("click", Danbooru.Note.TranslationMode.toggle, false); } }