notes: move js initialization into initialize_all function.

This commit is contained in:
evazion
2017-07-03 22:07:11 -05:00
parent 0bc55bec74
commit c2e62b77fa

View File

@@ -778,17 +778,29 @@ Danbooru.Note = {
Danbooru.Note.Box.resize_inner_border($(note_box));
});
}
}
}
},
$(function() {
if ($("#c-posts").length && $("#a-show").length && $("#image").length && !$("video#image").length) {
initialize_all: function() {
if ($("#c-posts #a-show #image").length == 0 || $("video#image").length) {
return;
}
Danbooru.Note.embed = (Danbooru.meta("post-has-embedded-notes") === "true");
Danbooru.Note.load_all();
this.initialize_shortcuts();
},
initialize_shortcuts: function() {
if ($("#note-locked-notice").length == 0) {
$("#translate").click(Danbooru.Note.TranslationMode.toggle);
Danbooru.keydown("n", "translation_mode", Danbooru.Note.TranslationMode.toggle);
}
Danbooru.Note.embed = (Danbooru.meta("post-has-embedded-notes") === "true");
Danbooru.Note.load_all();
$("#image").click(Danbooru.Note.Box.toggle_all);
}
},
}
$(function() {
Danbooru.Note.initialize_all();
});