Skip to content

Commit

Permalink
Version 6.5.4 Addendum
Browse files Browse the repository at this point in the history
* Fixed the disabling of translation mode on ugoira sample videos when using the forced "view sample" URL.
  • Loading branch information
Moebius-Strip committed Jan 8, 2015
1 parent 2489558 commit a8ccae9
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions better-better-booru.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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.
Expand All @@ -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);
}
}
Expand Down

0 comments on commit a8ccae9

Please sign in to comment.