From 72d7ba0f313eb1c72d11f5a8406acb41aa844588 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 10 Oct 2016 20:33:17 +0800 Subject: [PATCH] Update to remind note max length limit on the status bar length div --- public/js/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/public/js/index.js b/public/js/index.js index 5681dcf3..57658d69 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -677,7 +677,18 @@ function updateStatusBar() { statusCursor.text(cursorText); var fileText = ' — ' + editor.lineCount() + ' Lines'; statusFile.text(fileText); - statusLength.text('Length ' + editor.getValue().length); + var docLength = editor.getValue().length; + statusLength.text('Length ' + docLength); + if (docLength > (docmaxlength * 0.95)) { + statusLength.css('color', 'red'); + statusLength.attr('title', 'Your almost reach note max length limit.'); + } else if (docLength > (docmaxlength * 0.8)) { + statusLength.css('color', 'orange'); + statusLength.attr('title', 'You nearly fill the note, consider to make more pieces.'); + } else { + statusLength.css('color', 'white'); + statusLength.attr('title', 'You could write up to ' + docmaxlength + ' characters in this note.'); + } } //ui vars