I fixed @J0N45 's fix for the cursor

This commit is contained in:
overflowerror 2014-05-23 23:19:39 +02:00
parent bdf52525de
commit 623cbea827
2 changed files with 16 additions and 19 deletions

View file

@ -475,25 +475,23 @@ Emulator.Output.generateMatrix = function() {
Emulator.Output.getCursor = function() {
return Emulator.Output.screen.getElementsByTagName("tr")[Emulator.Output.ypos].getElementsByTagName("td")[Emulator.Output.xpos];
}
Emulator.Output.cursorOff = function() { // fix by Jonas
if(document.getElementById("cursor") != undefined)
document.getElementById("cursor").parentNode.removeChild(document.getElementById("cursor"));
Emulator.Output.cursorOff = function() {
if(document.getElementById("cursor") != undefined) {
document.getElementById("cursor").style.borderColor = Emulator.Output.backgroundColor;
document.getElementById("cursor").id = undefined;
}
}
Emulator.Output.cursorOn = function() { // fix by Jonas
Emulator.Output.cursorOn = function() {
if (Emulator.Output.displayCursor) {
var cursorElement=document.createElement("div");
var att=document.createAttribute("id");
att.value = "cursor";
cursorElement.setAttributeNode(att);
cursorElement.style.background = "#000";
cursorElement.style.border = "1px solid #fff";
Emulator.Output.getCursor().appendChild(cursorElement);
Emulator.Output.getCursor().style.borderColor = Emulator.Output.color;
Emulator.Output.getCursor().id = "cursor";
}
}
Emulator.Output.insert = function(char) {
var cell = Emulator.Output.getCursor();
cell.style.color = Emulator.Output.color;
cell.style.backgroundColor = Emulator.Output.backgroundColor;
cell.style.borderColor = Emulator.Output.backgroundColor;
if (Emulator.Output.bold)
cell.style.fontWeight = "bold";
else

View file

@ -5,17 +5,20 @@
table {
border: 1px solid #fff;
background-color: #000;
border-collapse: collapse;
border-collapse: seperate;
border-spacing: 0px 0px;
}
tr {
}
td {
width: 10px;
min-width: 8px;
max-width: 8px;
overflow: visible;
text-align: center;
height: 20px;
height: 18px;
color: #fff;
font-family: "Courier New", Courier, Monospace;
border-collapse: collapse;
border: 1px solid #000;
}
#input {
z-index: -10;
@ -25,10 +28,6 @@
#output {
z-index: 1000;
}
#cursor{
width:8px;
height:18px;
}
</style>
<script src="Emulator.js"></script>
<script src="KeyCodes.js"></script>