From 623cbea827a8644230838651f02db713bbfbdd90 Mon Sep 17 00:00:00 2001 From: overflowerror Date: Fri, 23 May 2014 23:19:39 +0200 Subject: [PATCH] I fixed @J0N45 's fix for the cursor --- Emulator.js | 20 +++++++++----------- index.html | 15 +++++++-------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Emulator.js b/Emulator.js index c2fa42c..b4298fe 100644 --- a/Emulator.js +++ b/Emulator.js @@ -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 diff --git a/index.html b/index.html index abdbd8b..461e202 100644 --- a/index.html +++ b/index.html @@ -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; - }