Skip to content

Commit 6f6958f

Browse files
authored
v3.1.3-
- improved overflow check to prevent words from being broken across lines, except in rare cases with long words - when a new item is added to the bottom of a note, focus shifts to the bottom of the note, rather than the top - removed unused JS variables and functions - corrected scroll position on undelete
1 parent 2118157 commit 6f6958f

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

_note.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ button[disabled]:hover {
4949
line-height: 1.1em;
5050
margin-bottom: 0.4em;
5151
hyphen: auto;
52-
word-wrap: break-word;
52+
word-wrap: normal;
5353
word-break: break-word;
5454
}
5555
.optionsColumn {

_note.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ var coords = document.getElementById('coords');
1515
var undeleteButton = document.getElementById('undeleteButton');
1616
var statusBar = document.getElementById('statusBar');
1717
var statusBarText = document.getElementById('statusBarText');
18-
var defSize = document.getElementById('defSize');
1918
var localFontDiv = [
2019
document.getElementById('localFontDiv0'),
2120
document.getElementById('localFontDiv1'),
@@ -64,7 +63,8 @@ var uFont = ['', '', '', ''];
6463
var delItem = {
6564
text: '',
6665
num: '',
67-
note: '' }
66+
note: '',
67+
scroll: 0 }
6868
var xElBeg = "<button class='x smallFont moveButtons' onclick='DelLine(this)' id='X";
6969
var xElEnd = "'>X</button>";
7070
var renButtonHTML = "<button class='upperRightButton' onclick='RenameThisNote()'>Rename</button>";
@@ -85,7 +85,6 @@ var lastScrollPos = 0;
8585
var firstCall = true;
8686
var currentNote, dummyVar, bgColor, i, currentX, currentY, oldX, oldY, offsetX, offsetY;
8787
var lastLine, itemToEdit, itemTotal, statusTimer, prevNote;
88-
var done;
8988

9089

9190
// ------- declare functions ----------
@@ -401,18 +400,7 @@ function getLines(thisNote) {
401400
function onSubmitted(tempVar) {
402401
event.returnValue = false;
403402
AddNote(tempVar)
404-
}
405-
406-
function showX(self) {
407-
// show X to right of each item, on mouseover
408-
thisX = "X" + self.id.slice(4);
409-
document.getElementById(thisX).style.visibility = 'visible';
410-
}
411-
412-
function hideX(self) {
413-
// hide X on mouseout
414-
thisX = "X" + self.id.slice(4);
415-
document.getElementById(thisX).style.visibility = 'hidden';
403+
noteBody.scrollTop = noteBody.scrollHeight;
416404
}
417405

418406
function showNewNoteBox() {
@@ -675,7 +663,19 @@ function getTime() {
675663
function checkOverflow(thisLine) {
676664
// check to see if just-added line causes horizontal scroll
677665
if (noteBody.scrollWidth >= noteBody.offsetWidth) {
678-
document.getElementById(thisLine).className = document.getElementById(thisLine).className + " overflowClass";
666+
// loop through line, if not a group of 10 or more chars w/o a space or hyphen, don't add overflowClass
667+
var strLength = 0;
668+
var thisLineText = document.getElementById(thisLine).innerText;
669+
for (var aa = 6; aa < thisLineText.length; aa++) {
670+
if ((thisLineText.slice(aa, aa + 1) == " ") || (thisLineText.slice(aa, aa + 1) == "-")) {
671+
strLength = 0;
672+
}
673+
else { strLength++; }
674+
if (strLength > 19) {
675+
document.getElementById(thisLine).className = document.getElementById(thisLine).className + " overflowClass";
676+
break;
677+
}
678+
}
679679
}
680680
}
681681

_note.vbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ Sub DelLine(ThisLine)
401401
delItem.text = document.getElementById(TempEl).innerText
402402
delItem.num = LineNum
403403
delItem.note = currentNote
404+
delItem.scroll = noteBody.scrollTop
404405
undeleteButton.disabled = false
405406
OpenRFile(currentNote)
406407
TempFile = MakeTempFile
@@ -566,6 +567,7 @@ Sub Undelete
566567
WriteModifiedFile int(delItem.num), -1
567568
undeleteButton.disabled = true
568569
showNotes(currentNote)
570+
noteBody.scrollTop = delItem.scroll
569571
highlight(delItem.num)
570572
showStatus("Restored item #" & (int(delItem.num)+1) & ", " & AbbrevText(delItem.text) & ", to " &_
571573
AbbrevText(delItem.note))

note.hta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,4 @@
155155
<script language='javascript' src='_temp.js'></script>
156156

157157
</body>
158-
</html>
158+
</html>

0 commit comments

Comments
 (0)