mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-16 08:09:07 +00:00
Editor upload & reload buttons are now working. Floppy upload & download working.
This commit is contained in:
@@ -272,4 +272,44 @@
|
||||
-ms-flex: 0 0 25%;
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
}
|
||||
|
||||
/** https://stackoverflow.com/questions/6410730/ */
|
||||
@-webkit-keyframes rotating /* Safari and Chrome */
|
||||
{
|
||||
from {
|
||||
-webkit-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
-webkit-transform: rotate(360deg);
|
||||
-o-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rotating {
|
||||
from {
|
||||
-ms-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
-ms-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-o-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.rotating {
|
||||
-webkit-animation: rotating 2s linear infinite;
|
||||
-moz-animation: rotating 2s linear infinite;
|
||||
-ms-animation: rotating 2s linear infinite;
|
||||
-o-animation: rotating 2s linear infinite;
|
||||
animation: rotating 2s linear infinite;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -505,7 +505,8 @@ editorOnThemeChange();
|
||||
|
||||
document.getElementById("floppyIn").onchange = function () {
|
||||
|
||||
//document.getElementById("floppyUp").innerHTML = "<i class=\"fa fa-cog fa-spin fa-fw\" aria-hidden=\"true\"></i>";
|
||||
document.getElementById("floppyUp").innerHTML = '<i class="mi rotating">cached</i> Floppy';
|
||||
|
||||
|
||||
var formData = new FormData(document.getElementById("floppyForm"));
|
||||
|
||||
@@ -517,8 +518,6 @@ document.getElementById("floppyIn").onchange = function () {
|
||||
if (xhr.status === 200) {
|
||||
|
||||
if (xhr.responseText === "ok") {
|
||||
//Upload ok, notify the game server
|
||||
mar.client.notifyFloppyUp();
|
||||
alert("Uploaded floppy disk to the drive!")
|
||||
} else {
|
||||
alert(xhr.responseText)
|
||||
@@ -528,7 +527,8 @@ document.getElementById("floppyIn").onchange = function () {
|
||||
alert("Couldn't upload floppy code (" + xhr.status + ")");
|
||||
}
|
||||
|
||||
document.getElementById("floppyUp").innerHTML = "<i class=\"fa fa-long-arrow-up\" aria-hidden=\"true\"></i> <i class=\"fa fa-floppy-o\" aria-hidden=\"true\"></i>";
|
||||
document.getElementById("floppyUp").innerHTML = '<i class="mi">file_upload</i> Floppy';
|
||||
|
||||
};
|
||||
xhr.onerror = function (ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
@@ -667,19 +667,6 @@ var GameClient = (function () {
|
||||
this.socket.send(JSON.stringify({ t: "k", k: key }));
|
||||
}
|
||||
};
|
||||
GameClient.prototype.requestFloppy = function () {
|
||||
document.getElementById("floppyDown").innerHTML = "<i class=\"fa fa-cog fa-spin fa-fw\"></i>";
|
||||
if (DEBUG) {
|
||||
console.log("[MAR] Requesting floppy");
|
||||
}
|
||||
this.socket.send(JSON.stringify({ t: "floppyDown" }));
|
||||
};
|
||||
GameClient.prototype.notifyFloppyUp = function () {
|
||||
if (DEBUG) {
|
||||
console.log("[MAR] Notifying the game server of floppy upload");
|
||||
}
|
||||
this.socket.send(JSON.stringify({ t: "floppyUp" }));
|
||||
};
|
||||
GameClient.prototype.requestObjects = function () {
|
||||
if (DEBUG) {
|
||||
console.log("[MAR] Requesting game objects");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<nav class="navbar navbar-expand-lg bg-primary navbar-light">
|
||||
|
||||
<a class="navbar-brand text-mono hvr-grow" href="/" title="Home"><img src="/images/tmp.png"></img></a>
|
||||
<a class="navbar-brand text-mono hvr-grow" href="/" title="Home"><img src="/images/icon.png"></img></a>
|
||||
|
||||
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<td>Test1</td>
|
||||
<td>Test2</td>
|
||||
</tr>
|
||||
Account - M.A.R
|
||||
<tr>
|
||||
<td>Test1</td>
|
||||
<td>Test2</td>
|
||||
|
||||
@@ -49,51 +49,63 @@
|
||||
|
||||
## EDITOR
|
||||
<div id="editor-tab" style="display: none">
|
||||
#if($session.attribute("username"))
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<select title="Select Theme" class="form-control" id="editorTheme"></select>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button class="btn btn-shadow btn-success text-mono regular-screen" href="#"><i class="mi">file_upload</i>
|
||||
Upload
|
||||
</button>
|
||||
<button class="btn btn-shadow btn-success text-mono small-screen" href="#"><i class="mi">file_upload</i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button class="btn btn-shadow btn-danger text-mono regular-screen" href="#"><i
|
||||
class="mi">replay</i> Reload
|
||||
</button>
|
||||
<button class="btn btn-shadow btn-danger text-mono small-screen" href="#"><i
|
||||
class="mi">replay</i></button>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button id="floppyUp" onclick="document.getElementById('floppyIn').click();"
|
||||
class="btn btn-shadow btn-info text-mono regular-screen" href="#"><i class="mi">file_upload</i>
|
||||
Floppy
|
||||
</button>
|
||||
<button class="btn btn-shadow btn-info text-mono small-screen" href="#"><i class="mi">file_upload</i>
|
||||
</button>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<select title="Select Theme" class="form-control" id="editorTheme"></select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<button onclick="mar.client.uploadCode(ace.edit('editor').getValue())"
|
||||
class="btn btn-shadow btn-success text-mono regular-screen" href="#"><i class="mi">file_upload</i>
|
||||
Upload
|
||||
</button>
|
||||
<button class="btn btn-shadow btn-success text-mono small-screen" href="#"><i class="mi">file_upload</i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button class="btn btn-shadow btn-danger text-mono regular-screen"
|
||||
onclick="mar.client.reloadCode()" href="#"><i
|
||||
class="mi">replay</i> Reload
|
||||
</button>
|
||||
<button class="btn btn-shadow btn-danger text-mono small-screen"
|
||||
onclick="mar.client.reloadCode()" href="#"><i
|
||||
class="mi">replay</i></button>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button id="floppyUp" onclick="document.getElementById('floppyIn').click();"
|
||||
class="btn btn-shadow btn-info text-mono regular-screen" href="#"><i class="mi">file_upload</i>
|
||||
Floppy
|
||||
</button>
|
||||
<button onclick="document.getElementById('floppyIn').click();"
|
||||
class="btn btn-shadow btn-info text-mono small-screen" href="#"><i class="mi">file_upload</i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<button class="btn btn-shadow btn-info text-mono regular-screen"
|
||||
onclick="window.location.assign('floppy_download')"><i class="mi">file_download</i>
|
||||
Floppy
|
||||
</button>
|
||||
<button class="btn btn-shadow btn-info text-mono small-screen"
|
||||
onclick="window.location.assign('floppy_download')"><i class="mi">file_download</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<button class="btn btn-shadow btn-info text-mono regular-screen" href="#"><i class="mi">file_download</i>
|
||||
Floppy
|
||||
</button>
|
||||
<button class="btn btn-shadow btn-info text-mono small-screen" href="#"><i class="mi">file_download</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form id="floppyForm" style="display: none;" enctype='multipart/form-data'>
|
||||
<input id="floppyIn" type="file" name="floppyIn"/>
|
||||
</form>
|
||||
|
||||
<form id="floppyForm" style="display: none;" enctype='multipart/form-data'>
|
||||
<input id="floppyIn" type="file" name="floppyIn"/>
|
||||
</form>
|
||||
<div id="editor"></div>
|
||||
|
||||
<div id="editor"></div>
|
||||
|
||||
<script src="js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
#else
|
||||
<p style="text-align: left"><a href="/account">Login</a> to use the editor</p>
|
||||
#end
|
||||
<script src="js/editor.js"></script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,7 +154,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="noisy">
|
||||
<div id="consoleText" class="piece output noclick ctr-selection ctr-text">Hello World</div>
|
||||
<div id="consoleText" class="piece output noclick ctr-selection ctr-text"></div>
|
||||
<div class="piece scanlines noclick"></div>
|
||||
<div class="piece glow noclick"></div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user