Grab JavaScript changes from master branch

This commit is contained in:
Jeff Parsons 2015-12-14 11:32:25 -08:00
commit 8df04c55da
3 changed files with 19 additions and 14 deletions

View file

@ -349,19 +349,20 @@ MarkOut.prototype.convertMD = function(sIndent)
sMD = sMD.replace(/<!--[\s\S]*?-->/g, "");
/*
* If the Markdown begins with a triple-dash, we assume there's a "Front Matter" header at the
* top of the file that we don't want to output, either. One wrinkle: we assume that if a
* "title" element exists in the Front Matter, then we should auto-generate a top-level heading
* with the same value.
* If the Markdown begins with a triple-dash, see if there's a "Front Matter" header at the
* top of the file that we should suppress.
*/
if (sMD.substr(0, 3) == "---") {
aMatch = sMD.match(/^---([\s\S]*?)---[ \t]*\n*/);
if (aMatch) {
sMD = sMD.replace(aMatch[0], "");
aMatch = aMatch[1].match(/title:\s*(.*?)\s*?\n/);
if (aMatch) {
sMD = aMatch[1] + "\n---\n\n" + sMD;
}
/*
* If a "title" element existed in the Front Matter, then you can enable this code to
* auto-generate a top-level heading with the same value.
*
* aMatch = aMatch[1].match(/title:\s*(.*?)\s*?\n/);
* if (aMatch) sMD = aMatch[1] + "\n---\n\n" + sMD;
*/
}
}

View file

@ -1403,7 +1403,7 @@ FDC.prototype.doneLoadDiskette = function onFDCLoadNotify(drive, disk, sDiskette
FDC.prototype.addDiskette = function(sName, sPath)
{
var controlDisks = this.bindings["listDisks"];
if (controlDisks) {
if (controlDisks && controlDisks.options) {
for (var i = 0; i < controlDisks.options.length; i++) {
if (controlDisks.options[i].value == sPath) return;
}
@ -1433,7 +1433,7 @@ FDC.prototype.displayDiskette = function(iDrive, fUpdateDrive)
/*
* Next, make sure controls for both drives and disks exist.
*/
if (controlDisks && controlDrives) {
if (controlDisks && controlDrives && controlDisks.options && controlDrives.options) {
/*
* Next, make sure the drive whose disk we're updating is the currently selected drive.
*/

View file

@ -403,15 +403,19 @@ function embedMachine(sName, sVersion, idElement, sXMLFile, sXSLFile, sStateFile
xsltProcessor['importStylesheet'](xsl);
var eFragment = xsltProcessor['transformToFragment'](xml, window.document);
if (eFragment) {
/*
* This fails in Microsoft Edge...
*
var machine = eFragment.getElementById(idElement);
if (!machine) {
displayError("machine generation failed: " + idElement);
}
else if (!eMachine.parentNode) {
displayError("invalid machine element: " + idElement);
} else {
} else
*/
if (eMachine.parentNode) {
eMachine.parentNode.replaceChild(eFragment, eMachine);
doneMachine();
} else {
displayError("invalid machine element: " + idElement);
}
} else {
displayError("transformToFragment failed");