From 02f24b533f5935fc221b7c7a6675af96ab180678 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 30 Jan 2015 13:23:48 -0800 Subject: [PATCH] lower opacity of note box when editing --- app/assets/javascripts/notes.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 7a28b4343..8842e7622 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -5,7 +5,7 @@ Danbooru.Note = { $inner_border.addClass("note-box-inner-border"); var opacity = 0; - if (Danbooru.meta("post-has-embedded-notes") === "true") { + if (Danbooru.Note.embed) { opacity = 0.9 } else { opacity = 0.5 @@ -276,7 +276,7 @@ Danbooru.Note = { set_text: function($note_body, $note_box, text) { Danbooru.Note.Body.display_text($note_body, text); - if (Danbooru.meta("post-has-embedded-notes") === "true") { + if (Danbooru.Note.embed) { Danbooru.Note.Body.display_text($note_box.children("div"), text); } Danbooru.Note.Body.resize($note_body); @@ -331,6 +331,10 @@ Danbooru.Note = { $(".note-box").resizable("disable"); $(".note-box").draggable("disable"); + if (Danbooru.Note.embed) { + $(".note-box").css("opacity", "0.5"); + } + $textarea = $(''); $textarea.css({ width: "97%", @@ -372,6 +376,10 @@ Danbooru.Note = { Danbooru.Note.editing = false; $(".note-box").resizable("enable"); $(".note-box").draggable("enable"); + + if (Danbooru.Note.embed) { + $(".note-box").css("opacity", "0.9"); + } }); $textarea.selectEnd(); @@ -672,7 +680,7 @@ Danbooru.Note = { $note_body.data("original-body", text); Danbooru.Note.Box.scale($note_box); Danbooru.Note.Body.display_text($note_body, text); - if (Danbooru.meta("post-has-embedded-notes") === "true") { + if (Danbooru.Note.embed) { Danbooru.Note.Body.display_text($note_box.children("div"), text); } }, @@ -726,6 +734,7 @@ $(function() { $("#translate").bind("click", Danbooru.Note.TranslationMode.toggle); $(document).bind("keypress", "n", Danbooru.Note.TranslationMode.toggle); } + Danbooru.Note.embed = (Danbooru.meta("post-has-embedded-notes") === "true"); Danbooru.Note.load_all(); $("#image").bind("click", Danbooru.Note.Box.toggle_all); }