Code cleanup

This commit is contained in:
Jeff Parsons 2016-02-11 15:44:10 -08:00
commit b6cf972131
36 changed files with 561 additions and 227 deletions

View file

@ -5379,7 +5379,7 @@ ChipSet.aPortOutput5170 = {
*/
ChipSet.init = function()
{
var aeChipSet = Component.getElementsByClass(window.document, PCJSCLASS, "chipset");
var aeChipSet = Component.getElementsByClass(document, PCJSCLASS, "chipset");
for (var iChip = 0; iChip < aeChipSet.length; iChip++) {
var eChipSet = aeChipSet[iChip];
var parmsChipSet = Component.getComponentParms(eChipSet);

View file

@ -344,7 +344,7 @@ Computer.prototype.getMachineID = function()
*
* @param {string} sParm
* @param {Object} [parmsComponent]
* @return {Object|number|string|boolean|null|undefined}
* @return {string|null}
*/
Computer.prototype.getMachineParm = function(sParm, parmsComponent)
{
@ -1371,7 +1371,7 @@ Computer.init = function()
*/
if (!COMPILED && XMLVERSION) Computer.APPVERSION = XMLVERSION;
var aeMachines = Component.getElementsByClass(window.document, PCJSCLASS + "-machine");
var aeMachines = Component.getElementsByClass(document, PCJSCLASS + "-machine");
for (var iMachine = 0; iMachine < aeMachines.length; iMachine++) {
@ -1421,7 +1421,7 @@ Computer.init = function()
*/
Computer.show = function()
{
var aeComputers = Component.getElementsByClass(window.document, PCJSCLASS, "computer");
var aeComputers = Component.getElementsByClass(document, PCJSCLASS, "computer");
for (var iComputer = 0; iComputer < aeComputers.length; iComputer++) {
var eComputer = aeComputers[iComputer];
var parmsComputer = Component.getComponentParms(eComputer);
@ -1470,7 +1470,7 @@ Computer.show = function()
*/
Computer.exit = function()
{
var aeComputers = Component.getElementsByClass(window.document, PCJSCLASS, "computer");
var aeComputers = Component.getElementsByClass(document, PCJSCLASS, "computer");
for (var iComputer = 0; iComputer < aeComputers.length; iComputer++) {
var eComputer = aeComputers[iComputer];
var parmsComputer = Component.getComponentParms(eComputer);

View file

@ -8131,7 +8131,7 @@ if (DEBUGGER) {
*/
Debugger.init = function()
{
var aeDbg = Component.getElementsByClass(window.document, PCJSCLASS, "debugger");
var aeDbg = Component.getElementsByClass(document, PCJSCLASS, "debugger");
for (var iDbg = 0; iDbg < aeDbg.length; iDbg++) {
var eDbg = aeDbg[iDbg];
var parmsDbg = Component.getComponentParms(eDbg);

View file

@ -592,7 +592,7 @@ FDC.prototype.powerUp = function(data, fRepower)
}
controlDrives.textContent = "";
for (var iDrive = 0; iDrive < this.nDrives; iDrive++) {
var controlOption = window.document.createElement("option");
var controlOption = document.createElement("option");
controlOption['value'] = iDrive;
/*
* TODO: This conversion of drive number to drive letter, starting with A:, is very simplistic
@ -1416,7 +1416,7 @@ FDC.prototype.addDiskette = function(sName, sPath)
for (var i = 0; i < controlDisks.options.length; i++) {
if (controlDisks.options[i].value == sPath) return;
}
var controlOption = window.document.createElement("option");
var controlOption = document.createElement("option");
controlOption['value'] = sPath;
controlOption.textContent = sName;
controlDisks.appendChild(controlOption);
@ -2518,7 +2518,7 @@ FDC.aPortOutput = {
* any associated HTML controls to the new component.
*/
FDC.init = function() {
var aeFDC = Component.getElementsByClass(window.document, PCJSCLASS, "fdc");
var aeFDC = Component.getElementsByClass(document, PCJSCLASS, "fdc");
for (var iFDC = 0; iFDC < aeFDC.length; iFDC++) {
var eFDC = aeFDC[iFDC];
var parmsFDC = Component.getComponentParms(eFDC);

View file

@ -3001,7 +3001,7 @@ HDC.aATCPortOutput = {
*/
HDC.init = function()
{
var aeHDC = Component.getElementsByClass(window.document, PCJSCLASS, "hdc");
var aeHDC = Component.getElementsByClass(document, PCJSCLASS, "hdc");
for (var iHDC = 0; iHDC < aeHDC.length; iHDC++) {
var eHDC = aeHDC[iHDC];
var parmsHDC = Component.getComponentParms(eHDC);

View file

@ -2312,7 +2312,7 @@ Keyboard.prototype.keySimulate = function(simCode, fDown)
*/
Keyboard.init = function()
{
var aeKbd = Component.getElementsByClass(window.document, PCJSCLASS, "keyboard");
var aeKbd = Component.getElementsByClass(document, PCJSCLASS, "keyboard");
for (var iKbd = 0; iKbd < aeKbd.length; iKbd++) {
var eKbd = aeKbd[iKbd];
var parmsKbd = Component.getComponentParms(eKbd);

View file

@ -717,7 +717,7 @@ Mouse.prototype.notifyMCR = function(bMCR)
*/
Mouse.init = function()
{
var aeMouse = Component.getElementsByClass(window.document, PCJSCLASS, "mouse");
var aeMouse = Component.getElementsByClass(document, PCJSCLASS, "mouse");
for (var iMouse = 0; iMouse < aeMouse.length; iMouse++) {
var eMouse = aeMouse[iMouse];
var parmsMouse = Component.getComponentParms(eMouse);

View file

@ -294,13 +294,13 @@ Panel.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
this.cxDump = this.cxReg;
this.cyDump = ((this.canvas.height * Panel.LIVEDUMP.CY) / Panel.LIVECANVAS.CY) | 0;
this.canvasLiveMem = window.document.createElement("canvas");
this.canvasLiveMem = document.createElement("canvas");
this.canvasLiveMem.width = Panel.LIVEMEM.CX;
this.canvasLiveMem.height = Panel.LIVEMEM.CY;
this.contextLiveMem = this.canvasLiveMem.getContext("2d");
this.imageLiveMem = this.contextLiveMem.createImageData(this.canvasLiveMem.width, this.canvasLiveMem.height);
this.canvasLiveRegs = window.document.createElement("canvas");
this.canvasLiveRegs = document.createElement("canvas");
this.canvasLiveRegs.width = Panel.LIVEREGS.CX;
this.canvasLiveRegs.height = Panel.LIVEREGS.CY;
this.contextLiveRegs = this.canvasLiveRegs.getContext("2d");
@ -969,7 +969,7 @@ Panel.prototype.centerText = function(sText)
Panel.init = function()
{
var fReady = false;
var aePanels = Component.getElementsByClass(window.document, PCJSCLASS, "panel");
var aePanels = Component.getElementsByClass(document, PCJSCLASS, "panel");
for (var iPanel=0; iPanel < aePanels.length; iPanel++) {
var ePanel = aePanels[iPanel];
var parmsPanel = Component.getComponentParms(ePanel);

View file

@ -503,7 +503,7 @@ ParallelPort.aPortOutput = {
*/
ParallelPort.init = function()
{
var aeParallel = Component.getElementsByClass(window.document, PCJSCLASS, "parallel");
var aeParallel = Component.getElementsByClass(document, PCJSCLASS, "parallel");
for (var iParallel = 0; iParallel < aeParallel.length; iParallel++) {
var eParallel = aeParallel[iParallel];
var parmsParallel = Component.getComponentParms(eParallel);

View file

@ -266,7 +266,7 @@ RAM.prototype.restore = function(data)
*/
RAM.init = function()
{
var aeRAM = Component.getElementsByClass(window.document, PCJSCLASS, "ram");
var aeRAM = Component.getElementsByClass(document, PCJSCLASS, "ram");
for (var iRAM = 0; iRAM < aeRAM.length; iRAM++) {
var eRAM = aeRAM[iRAM];
var parmsRAM = Component.getComponentParms(eRAM);

View file

@ -405,7 +405,7 @@ ROM.prototype.cloneROM = function(addr)
*/
ROM.init = function()
{
var aeROM = Component.getElementsByClass(window.document, PCJSCLASS, "rom");
var aeROM = Component.getElementsByClass(document, PCJSCLASS, "rom");
for (var iROM = 0; iROM < aeROM.length; iROM++) {
var eROM = aeROM[iROM];
var parmsROM = Component.getComponentParms(eROM);

View file

@ -897,7 +897,7 @@ SerialPort.aPortOutput = {
*/
SerialPort.init = function()
{
var aeSerial = Component.getElementsByClass(window.document, PCJSCLASS, "serial");
var aeSerial = Component.getElementsByClass(document, PCJSCLASS, "serial");
for (var iSerial = 0; iSerial < aeSerial.length; iSerial++) {
var eSerial = aeSerial[iSerial];
var parmsSerial = Component.getComponentParms(eSerial);

View file

@ -3232,7 +3232,7 @@ Video.prototype.onFocusChange = function(fFocus)
*
* if (fFocus) {
* window.scrollTo(0, 0);
* window.document.body.scrollTop = 0;
* document.body.scrollTop = 0;
* }
*/
this.fHasFocus = fFocus;
@ -4221,7 +4221,7 @@ Video.prototype.createFontColor = function(font, iColor, rgbColor, nDouble, offD
* We still have to use putImageData() to build the font canvas, but that's a one-time operation.
*/
var rgbOff = [0x00, 0x00, 0x00, 0x00];
var canvasFont = window.document.createElement("canvas");
var canvasFont = document.createElement("canvas");
canvasFont.width = font.cxCell << 4;
canvasFont.height = (font.cyCell << 4);
var contextFont = canvasFont.getContext("2d");
@ -4780,7 +4780,7 @@ Video.prototype.setDimensions = function()
* Allocate the off-screen buffers
*/
this.imageScreenBuffer = this.contextScreen.createImageData(this.cxBuffer, this.cyBuffer);
this.canvasScreenBuffer = window.document.createElement("canvas");
this.canvasScreenBuffer = document.createElement("canvas");
this.canvasScreenBuffer.width = this.cxBuffer;
this.canvasScreenBuffer.height = this.cyBuffer;
this.contextScreenBuffer = this.canvasScreenBuffer.getContext("2d");
@ -7116,12 +7116,12 @@ Video.aVGAPortOutput = {
*/
Video.init = function()
{
var aeVideo = Component.getElementsByClass(window.document, PCJSCLASS, "video");
var aeVideo = Component.getElementsByClass(document, PCJSCLASS, "video");
for (var iVideo = 0; iVideo < aeVideo.length; iVideo++) {
var eVideo = aeVideo[iVideo];
var parmsVideo = Component.getComponentParms(eVideo);
var eCanvas = window.document.createElement("canvas");
var eCanvas = document.createElement("canvas");
if (eCanvas === undefined || !eCanvas.getContext) {
eVideo.innerHTML = "<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";
return;
@ -7176,14 +7176,14 @@ Video.init = function()
* clearly see the overlaid semi-transparent input field, but none of the input characters were passed along,
* with the exception of the "Go" (Enter) key.
*
* var eInput = window.document.createElement("input");
* var eInput = document.createElement("input");
* eInput.setAttribute("type", "password");
* eInput.setAttribute("style", "position:absolute; left:0; top:0; width:100%; height:100%; opacity:0.5");
* eVideo.appendChild(eInput);
*
* See this Chromium issue for more information: https://code.google.com/p/chromium/issues/detail?id=118639
*/
var eTextArea = window.document.createElement("textarea");
var eTextArea = document.createElement("textarea");
/*
* As noted in keyboard.js, the keyboard on an iOS device tends to pop up with the SHIFT key depressed,

View file

@ -4358,7 +4358,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles)
*/
X86CPU.init = function()
{
var aeCPUs = Component.getElementsByClass(window.document, PCJSCLASS, "cpu");
var aeCPUs = Component.getElementsByClass(document, PCJSCLASS, "cpu");
for (var iCPU = 0; iCPU < aeCPUs.length; iCPU++) {
var eCPU = aeCPUs[iCPU];
var parmsCPU = Component.getComponentParms(eCPU);

View file

@ -3363,7 +3363,7 @@ X86FPU.afnPreserveExceptions = [
*/
X86FPU.init = function()
{
var aeFPUs = Component.getElementsByClass(window.document, PCJSCLASS, "fpu");
var aeFPUs = Component.getElementsByClass(document, PCJSCLASS, "fpu");
for (var iFPU = 0; iFPU < aeFPUs.length; iFPU++) {
var eFPU = aeFPUs[iFPU];
var parmsFPU = Component.getComponentParms(eFPU);