From 7a81fd03effaf5ae8df5361b76cb1f215ca4d4f9 Mon Sep 17 00:00:00 2001 From: BrokenEagle Date: Tue, 3 Mar 2020 20:54:53 +0000 Subject: [PATCH] Make clicking the box hide the popup note box in responsive mode - This is because the note body of one note box could hide another note box - The only option to hide the note body previously was to double tap the image --- app/javascript/src/javascripts/notes.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/javascript/src/javascripts/notes.js b/app/javascript/src/javascripts/notes.js index d6bc81524..3b2bcec48 100644 --- a/app/javascript/src/javascripts/notes.js +++ b/app/javascript/src/javascripts/notes.js @@ -131,7 +131,7 @@ let Note = { $note_box.on( "mouseover.danbooru mouseout.danbooru", function(e) { - if (Note.dragging) { + if (Note.dragging || Utility.test_max_width(660)) { return; } @@ -163,12 +163,21 @@ let Note = { "click.danbooru", function (event) { const note_id = $note_box.data("id"); - $(".note-box").removeClass("movable"); - if (note_id === Note.move_id) { - Note.move_id = null; + if (!Utility.test_max_width(660)) { + $(".note-box").removeClass("movable"); + if (note_id === Note.move_id) { + Note.move_id = null; + } else { + Note.move_id = note_id; + $note_box.addClass("movable"); + } + } else if ($note_box.hasClass("viewing")) { + Note.Body.hide(note_id); + $note_box.removeClass("viewing"); } else { - Note.move_id = note_id; - $note_box.addClass("movable"); + $(".note-box").removeClass("viewing"); + Note.Body.show(note_id); + $note_box.addClass("viewing"); } } );