mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-12-16 08:09:03 +00:00
Major refactor of the console screen, game code rewritten in Typescript, users can now change their passwords
This commit is contained in:
6
mar/editor.min.js
vendored
6
mar/editor.min.js
vendored
@@ -14,4 +14,8 @@ function parseInstruction(a,c,b){a=removeComment(a);a=removeLabel(a);var d=getTo
|
||||
getOperandType(d,c);var f=getOperandType(a,c);e===OPERAND_INVALID?c.annotations.push({row:b,column:0,text:"Invalid operand: "+d,type:"error"}):f===OPERAND_INVALID?c.annotations.push({row:b,column:0,text:"Invalid operand: "+a,type:"error"}):e===OPERAND_IMM&&c.annotations.push({row:b,column:0,text:"Destination operand can't be an immediate value",type:"error"})}else c.annotations.push({row:b,column:0,text:e+" instruction with 2 operands is illegal",type:"error"});else 1<d.length?(d=a.substring(a.indexOf(e)+
|
||||
e.length).trim(),/\b(?:push|mul|pop|div|neg|call|jnz|jg|jl|jge|jle|hwi|hwq|jz|js|jns|ret|jmp|not|jc|jnc|jo|jno|inc|dec)\b/.test(e.toLowerCase())?getOperandType(d,c)===OPERAND_INVALID&&c.annotations.push({row:b,column:0,text:"Invalid operand: "+d,type:"error"}):c.annotations.push({row:b,column:0,text:e+" instruction with 1 operand is illegal",type:"error"})):/\b(?:ret|brk|nop)\b/.test(e.toLowerCase())||c.annotations.push({row:b,column:0,text:e+" instruction with no operand is illegal",type:"error"});
|
||||
else c.annotations.push({row:b,column:0,text:"Unknown mnemonic: "+e,type:"error"})}function parse(){for(var a=ace.edit("editor").getValue().split("\n"),c={labels:[],annotations:[]},b=0;b<a.length;b++)checkForLabel(a[b],c);for(b=0;b<a.length;b++)checkForSegmentDeclaration(a[b])||checkForEQUInstruction(a[b],c,b)||checkForORGInstruction(a[b],c,b)||parseInstruction(a[b],c,b);editor.getSession().setAnnotations(c.annotations)}
|
||||
function gameClick(){document.getElementById("editorBtns").setAttribute("style","display: none");document.getElementById("gameBtns").setAttribute("style","")}function editorClick(){document.getElementById("editorBtns").setAttribute("style","");document.getElementById("gameBtns").setAttribute("style","display: none")}editor.on("change",parse);
|
||||
function gameClick(){document.getElementById("editorBtns").setAttribute("style","display: none");document.getElementById("gameBtns").setAttribute("style","")}function editorClick(){document.getElementById("editorBtns").setAttribute("style","");document.getElementById("gameBtns").setAttribute("style","display: none")}var editorStorage;editorStorage="undefined"!==typeof window.localStorage?window.localStorage:!1;
|
||||
var editorThemeOptions={available:"theme/ambiance theme/chaos theme/chrome theme/clouds theme/clouds_midnight theme/cobalt theme/crimson_editor theme/dawn theme/dracula theme/dreamweaver theme/eclipse theme/github theme/gob theme/gruvbox theme/idle_fingers theme/iplastic theme/katzenmilch theme/kr_theme theme/kuroir theme/merbivore theme/merbivore_soft theme/mono_industrial theme/monokai theme/pastel_on_dark theme/solarized_dark theme/solarized_light theme/sqlserver theme/terminal theme/textmate theme/tomorrow theme/tomorrow_night_blue theme/tomorrow_night_bright theme/tomorrow_night_eighties theme/tomorrow_night theme/twilight theme/vibrant_ink theme/xcode".split(" "),defaultTheme:"theme/tomorrow"};
|
||||
if(editorStorage){var storedTheme=editorStorage.getItem("editorTheme");null!==storedTheme&&-1!==editorThemeOptions.available.indexOf(storedTheme)&&(editorThemeOptions.defaultTheme=storedTheme)}var editorThemeSelectElement=document.getElementById("editorTheme");
|
||||
function editorOnThemeChange(){if(null===editorThemeSelectElement)console.error("editorOnThemeChange() :: editorThemeSelectElement seems to be 'null'");else{var a=editorThemeSelectElement;a=a.options[a.selectedIndex];-1===editorThemeOptions.available.indexOf(a.value)?console.error("editorOnThemeChange() :: user somehow selected an invalid theme : '"+a.value+"' for '"+a.text+"'"):(editorStorage&&editorStorage.setItem("editorTheme",a.value),editor.setTheme("ace/"+a.value))}}
|
||||
editorThemeSelectElement.addEventListener("change",editorOnThemeChange);editorThemeOptions.available.forEach(function(a){var c=document.createElement("option");c.value=a;c.text=a.substring(6);a===editorThemeOptions.defaultTheme&&(c.selected=!0);editorThemeSelectElement.appendChild(c)});editorOnThemeChange();editor.getSession().setMode("ace/mode/mar");editor.setFontSize(16);editor.setDisplayIndentGuides(!1);document.getElementById("editor").style.fontFamily="fixedsys";editor.on("change",parse);
|
||||
|
||||
Reference in New Issue
Block a user