1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-03 07:44:13 +01:00

Make Statusline#updateBufferPosition a little more readable.

This commit is contained in:
Doug Kearns
2010-11-05 09:01:53 +11:00
parent 53925580db
commit 0d20e9ffc7

View File

@@ -231,25 +231,25 @@ const StatusLine = Module("statusline", {
let win = document.commandDispatcher.focusedWindow;
if (!win)
return;
win.scrollY;
win.scrollY; // intentional - see Kris
percent = win.scrollY == 0 ? 0 : // This prevents a forced rendering
win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY;
}
let bufferPositionStr = "";
percent = Math.round(percent * 100);
if (percent < 0)
bufferPositionStr = "All";
else if (percent == 0)
bufferPositionStr = "Top";
else if (percent >= 100)
bufferPositionStr = "Bot";
else if (percent < 10)
bufferPositionStr = " " + percent + "%";
else
bufferPositionStr = percent + "%";
this.widgets.bufferposition.value = bufferPositionStr;
if (percent < 0)
var position = "All";
else if (percent == 0)
position = "Top";
else if (percent >= 100)
position = "Bot";
else if (percent < 10)
position = " " + percent + "%";
else
position = percent + "%";
this.widgets.bufferposition.value = position;
},
/**