mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
updateByte Display and showDisplay functions
byteDisplay added as DOM elem ref updateByteDisplay added which sets the inner HTML to be the length of the content spilt by commas on thousands showDisplay function added to toggle between the 2 displays Call updateByteDisplay on switching tabs
This commit is contained in:
@@ -32,7 +32,7 @@ var ICEcoder = {
|
||||
|
||||
// Set our aliases
|
||||
initAliases: function() {
|
||||
var aliasArray = ["header","files","account","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","system","nestValid","nestDisplay","charDisplay"];
|
||||
var aliasArray = ["header","files","account","fmLock","filesFrame","editor","tabsBar","findBar","content","footer","system","nestValid","nestDisplay","charDisplay","byteDisplay"];
|
||||
|
||||
// Create our ID aliases
|
||||
for (var i=0;i<aliasArray.length;i++) {
|
||||
@@ -1127,6 +1127,17 @@ var ICEcoder = {
|
||||
ICEcoder.charDisplay.innerHTML = ICEcoder.caretLocType + ", Line: " + (cM.getCursor().line+1) + ", Char: " + cM.getCursor().ch;
|
||||
},
|
||||
|
||||
// Update the byte display
|
||||
updateByteDisplay: function() {
|
||||
ICEcoder.byteDisplay.innerHTML = ICEcoder.getcMInstance().getValue().length.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " bytes";
|
||||
},
|
||||
|
||||
// Toggle the char/byte display
|
||||
showDisplay: function(show) {
|
||||
top.ICEcoder.byteDisplay.style.display = show == "byte" ? "inline-block" : "none";
|
||||
top.ICEcoder.charDisplay.style.display = show == "char" ? "inline-block" : "none";
|
||||
},
|
||||
|
||||
// Determine which area of the document we're in
|
||||
caretLocationType: function() {
|
||||
var cM, caretLocType, caretChunk, fileName;
|
||||
@@ -1704,6 +1715,7 @@ var ICEcoder = {
|
||||
// Finally, update the cursor display
|
||||
top.ICEcoder.getCaretPosition();
|
||||
top.ICEcoder.updateCharDisplay();
|
||||
top.ICEcoder.updateByteDisplay();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user