Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit ca39d31

Browse files
author
mattpass
committed
Tidy, no space after v, less PHP, nicer system display, remove old game DIV container
1 parent 352c8c1 commit ca39d31

File tree

1 file changed

+52
-57
lines changed

1 file changed

+52
-57
lines changed

editor.php

Lines changed: 52 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,36 @@
55
?>
66
<!DOCTYPE html>
77

8-
<html style="margin: 0" onmousedown="parent.ICEcoder.mouseDown = true; parent.ICEcoder.resetAutoLogoutTimer()" onMouseUp="parent.ICEcoder.mouseDown = false; parent.ICEcoder.mouseDownInCM = false; parent.ICEcoder.resetAutoLogoutTimer(); if (!parent.ICEcoder.overCloseLink) {parent.ICEcoder.tabDragEnd()}" onmousemove="if(parent.ICEcoder) {parent.ICEcoder.getMouseXY(event, 'editor'); parent.ICEcoder.functionArgsTooltip(event, 'editor'); parent.ICEcoder.resetAutoLogoutTimer(); parent.ICEcoder.canResizeFilesW()}" ondrop="if(parent.ICEcoder) {parent.ICEcoder.getMouseXY(event, 'editor')}">
8+
<html style="margin: 0" onmousedown="parent.ICEcoder.mouseDown = true; parent.ICEcoder.resetAutoLogoutTimer()" onmouseup="parent.ICEcoder.mouseDown = false; parent.ICEcoder.mouseDownInCM = false; parent.ICEcoder.resetAutoLogoutTimer(); if (!parent.ICEcoder.overCloseLink) {parent.ICEcoder.tabDragEnd()}" onmousemove="if (parent.ICEcoder) {parent.ICEcoder.getMouseXY(event, 'editor'); parent.ICEcoder.functionArgsTooltip(event, 'editor'); parent.ICEcoder.resetAutoLogoutTimer(); parent.ICEcoder.canResizeFilesW()}" ondrop="if (parent.ICEcoder) {parent.ICEcoder.getMouseXY(event, 'editor')}">
99
<head>
10-
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> editor</title>
10+
<title>ICEcoder v<?php echo $ICEcoder["versionNo"];?> editor</title>
1111
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
1212
<meta name="robots" content="noindex, nofollow">
1313
<link rel="stylesheet" href="assets/css/codemirror.css?microtime=<?php echo microtime(true);?>">
1414
<link rel="stylesheet" href="assets/css/show-hint.css?microtime=<?php echo microtime(true);?>">
1515
<link rel="stylesheet" href="assets/css/lint.css?microtime=<?php echo microtime(true);?>">
1616
<!--
1717
codemirror-compressed.js
18-
incls: codemirror
19-
modes: clike, coffeescript, css, erlang, go, htmlmixed, javascript, julia, lua, markdown, perl, php, python, ruby, sass, sql, xml, yaml
20-
addon: brace-fold, closebrackets, closetag, css-hint, foldcode, foldgutter, html-hint, javascript-hint, javascript-lint, lint, match-highlighter, matchbrackets, runmode, searchcursor, show-hint, simplescrollbars, sql-hint, trailingspace, xml-fold, xml-hint
18+
- incls: codemirror
19+
- modes: clike, coffeescript, css, erlang, go, htmlmixed, javascript, julia, lua, markdown, perl, php, python, ruby, sass, sql, xml, yaml
20+
- addon: brace-fold, closebrackets, closetag, css-hint, foldcode, foldgutter, html-hint, javascript-hint, javascript-lint, lint, match-highlighter, matchbrackets, runmode, searchcursor, show-hint, simplescrollbars, sql-hint, trailingspace, xml-fold, xml-hint
2121
//-->
2222
<script src="assets/js/codemirror-compressed.js?microtime=<?php echo microtime(true);?>"></script>
2323
<?php
24-
if (true === file_exists(dirname(__FILE__)."/plugins/jshint/jshint-2.5.6.min.js")) {
25-
echo '<script src="http://github.com/plugins/%3C/span%3Ejshint/jshint-2.5.6.min.js%3Cspan%20class="x x-first">?microtime=' . microtime(true) . '"></script>';
26-
};
27-
28-
if (true === file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) {
29-
echo '<script src="http://github.com/plugins/emmet/emmet.min.js?microtime=%3C/span%3E%3Cspan%20class="x">' . microtime(true) . '"></script>';
30-
};
24+
$pluginFiles = [
25+
"jshint/jshint-2.5.6.min.js",
26+
"emmet/emmet.min.js",
27+
"pesticide/pesticide.js",
28+
"stats.js/stats.min.js",
29+
"responsive-helper/responsive-helper.js"
30+
];
3131

32-
if (true === file_exists(dirname(__FILE__)."/plugins/pesticide/pesticide.js")) {
33-
echo '<script src="plugins/pesticide/pesticide.js?microtime=' . microtime(true) . '"></script>';
34-
};
35-
36-
if (true === file_exists(dirname(__FILE__)."/plugins/stats.js/stats.min.js")) {
37-
echo '<script src="plugins/stats.js/stats.min.js?microtime=' . microtime(true) . '"></script>';
38-
};
39-
40-
if (true === file_exists(dirname(__FILE__)."/plugins/responsive-helper/responsive-helper.js")) {
41-
echo '<script src="plugins/responsive-helper/responsive-helper.js?microtime=' . microtime(true) . '"></script>';
42-
};?>
32+
for ($i = 0; $i < count($pluginFiles); $i++) {
33+
if (true === file_exists(dirname(__FILE__) . "/plugins/" . $pluginFiles[$i])) {
34+
echo '<script src="plugins/' . $pluginFiles[$i] . '?microtime=' . microtime(true) . '"></script>' . PHP_EOL;
35+
}
36+
}
37+
?>
4338
<link rel="stylesheet" href="<?php
4439
echo dirname(basename(__DIR__)) . '/assets/css/theme/';
4540
echo "default" === $ICEcoder["theme"] ? 'icecoder.css' : $ICEcoder["theme"] . '.css';
@@ -73,8 +68,8 @@
7368
background-position: bottom left;
7469
background-repeat: repeat-x;
7570
}
76-
.code-zoomed-out { font-size: 2px }
77-
.CodeMirror-foldmarker {font-family: arial; line-height: .3; color: #b00; cursor: pointer;
71+
.code-zoomed-out {font-size: 2px}
72+
.CodeMirror-foldmarker {font-family: arial; line-height: 0.3; color: #b00; cursor: pointer;
7873
text-shadow: #fff 1px 1px 2px, #fff -1px -1px 2px, #fff 1px -1px 2px, #fff -1px 1px 2px;
7974
}
8075
.CodeMirror-foldgutter {display: inline-block; width: 13px}
@@ -84,14 +79,16 @@
8479
.CodeMirror-foldgutter-folded {background: #800; color: #ddd}
8580
.CodeMirror-foldgutter-folded:after {position: relative; top: -3px}
8681
h2 {color: rgba(0,198,255,0.7)}
87-
.heading {color:#888}
82+
.heading {color: #888}
8883
.cm-s-diff {left: 50%}
8984
.diffGreen {background: #0b0 !important; color: #000 !important}
9085
.diffRed {background: #800 !important; color: #fff !important}
9186
.diffGrey {background: #444 !important; color: #fff !important}
9287
.diffGreyLighter {background: #888 !important; color: #1d1d1b !important}
9388
.diffNone {}
9489
.info {font-size: 10px; color: rgba(0,198,255,0.7); cursor: help}
90+
.dataItems {float: left; line-height: 14px}
91+
.dataItems span {line-height: 21px}
9592
</style>
9693
<link rel="stylesheet" href="assets/css/file-types.css?microtime=<?php echo microtime(true);?>">
9794
<link rel="stylesheet" href="assets/css/file-type-icons.css?microtime=<?php echo microtime(true);?>">
@@ -102,12 +99,12 @@
10299
<div style="display: none; margin: 32px 43px 0 43px; padding: 10px; width: 500px; font-family: arial; font-size: 10px; color: #ddd; background: #333" id="dataMessage"></div>
103100

104101
<div style="margin: 20px 43px 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
105-
<div style="float: left; width: 300px; margin-right: 50px">
102+
<div class="dataItems" style="width: 300px; margin-right: 50px">
106103
<h2><?php echo $t['server'];?></h2>
107104
<span class="heading"><?php echo $t['Server name, OS...'];?></span><br>
108105
<?php
109106
$serverAddr = $_SERVER['SERVER_ADDR'] ?? "1";
110-
if ($serverAddr == "1" || $serverAddr == "::1") {
107+
if ("1" == $serverAddr || "::1" == $serverAddr) {
111108
$serverAddr = "127.0.0.1";
112109
}
113110
echo
@@ -125,15 +122,15 @@
125122
<span id="serverDT"></span><br><br>
126123
<h2><?php echo $t['your device'];?></h2>
127124
<span class="heading"><?php echo $t['Browser'];?></span><br>
128-
<?php echo xssClean($_SERVER['HTTP_USER_AGENT'],"html");?><br><br>
125+
<?php echo xssClean($_SERVER['HTTP_USER_AGENT'], "html");?><br><br>
129126
<span class="heading"><?php echo $t['Your IP'];?></span><br>
130127
<?php echo getUserIP();?><br><br>
131128
</div>
132129

133-
<div style="float: left">
130+
<div class="dataItems">
134131
<h2><?php echo $t['files'];?></h2>
135132
<span class="heading"><?php echo $t['Last 10 files...'];?></span><br>
136-
<ul class="fileManager" id="last10Files" style="margin-left: 0; line-height: 20px"><?php
133+
<ul class="fileManager" id="last10Files" style="margin-top: 5px; margin-left: 0; line-height: 21px"><?php
137134
if (empty($ICEcoder["last10Files"])) {
138135
echo '<div style="display: inline-block; margin-left: -39px; margin-top: -4px">' . $t['none'] . '</div><br>';
139136
} else {
@@ -142,8 +139,8 @@
142139
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
143140
$ext = "ext-" . pathinfo($docRoot . $iceRoot . $fileFolderName, PATHINFO_EXTENSION);
144141
echo '<li class="pft-file ' . strtolower($ext) . '" style="margin-left: -21px">';
145-
echo '<a style="cursor:pointer" onClick="parent.ICEcoder.openFile(\'' . str_replace($docRoot, "", str_replace("|", "/", $ICEcoder["last10Files"][$i])) . '\')">';
146-
echo str_replace($docRoot, "", str_replace("|", "/", $ICEcoder["last10Files"][$i]));
142+
echo '<a style="position: relative; top: -2px; left: 5px; cursor: pointer" onclick="parent.ICEcoder.openFile(\'' . str_replace($docRoot, "", str_replace("|", "/", $ICEcoder["last10Files"][$i])) . '\')">';
143+
echo preg_replace("/^\//", "", str_replace($docRoot, "", str_replace("|", "/", $ICEcoder["last10Files"][$i])));
147144
echo '</a></li>';
148145
if ($i > 0) {
149146
echo PHP_EOL;
@@ -164,9 +161,9 @@
164161

165162
<div style="clear: both"></div>
166163
<script>
167-
var nDT = <?php echo time() * 1000;?>;
164+
let nDT = <?php echo time() * 1000;?>;
168165
setInterval(function(){
169-
var s = (new Date(nDT += 1e3) + '').split(' '),
166+
let s = (new Date(nDT += 1e3) + '').split(' '),
170167
d = s[2] * 1,
171168
t = s[4].split(':'),
172169
p = t[0] > 11 ? 'pm' : 'am',
@@ -184,7 +181,7 @@
184181
"Tab": function(cm) {
185182
return cm.somethingSelected()
186183
? (parent.ICEcoder.indentAuto
187-
? cm.execCommand("indentAuto") // Honour our own setting indentAuto
184+
? cm.execCommand("indentAuto") // Honor our own setting indentAuto
188185
: cm.indentSelection("add") // Add indent (this is default handler in CodeMirror)
189186
)
190187
: CodeMirror.Pass // Falls through to default or Emmet plugin
@@ -199,7 +196,7 @@
199196
};
200197

201198
// CodeMirror does not honor indentWithTabs = false properly when handling Tab key
202-
// Marijn said that it is by design, so we need to make a workaround of our own
199+
// It does this by design, so we need to make a workaround of our own
203200
(function(){
204201
// let's back up original insertTab function which actually puts
205202
var originalInsertTabFunction = CodeMirror.commands.insertTab;
@@ -244,8 +241,8 @@ function createNewCMInstance(num) {
244241
};
245242

246243
// Start editor instances, main and diff
247-
window['cM'+num] = CodeMirror(document.body, cMOptions);
248-
window['cM'+num+'diff'] = CodeMirror(document.body, cMOptions);
244+
window['cM' + num] = CodeMirror(document.body, cMOptions);
245+
window['cM' + num + 'diff'] = CodeMirror(document.body, cMOptions);
249246

250247
// Define actions for those...
251248
createNewCMInstanceEvents(num, '');
@@ -257,29 +254,27 @@ function createNewCMInstance(num) {
257254
};
258255

259256
function createNewCMInstanceEvents(num, pane) {
260-
window['cM'+num+pane].on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM, 'cM' + num + pane)});
261-
window['cM'+num+pane].on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM, 'cM' + num + pane)});
262-
window['cM'+num+pane].on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM, 'cM' + num + pane)});
263-
window['cM'+num+pane].on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM, 'cM' + num + pane)});
264-
window['cM'+num+pane].on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;});
265-
window['cM'+num+pane].on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM, 'cM' + num + pane, changeObj, CodeMirror)});
266-
window['cM'+num+pane].on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM, 'cM' + num + pane, changeObj, CodeMirror)});
267-
window['cM'+num+pane].on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM, 'cM' + num + pane)});
268-
window['cM'+num+pane].on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM, 'cM' + num + pane)});
269-
window['cM'+num+pane].on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM, 'cM' + num + pane)});
270-
window['cM'+num+pane].on("gutterClick", function(thisCM,line,gutter,evt) {parent.ICEcoder.cMonGutterClick(thisCM, line, gutter, evt, 'cM' + num + pane)});
271-
window['cM'+num+pane].on("mousedown", function(thisCM,evt) {parent.ICEcoder.cMonMouseDown(thisCM, 'cM' + num + pane, evt)});
272-
window['cM'+num+pane].on("paste", function(thisCM,evt) {parent.ICEcoder.cMonPaste(thisCM, 'cM' + num + pane, evt, (evt.clipboardData || window.clipboardData))});
273-
window['cM'+num+pane].on("contextmenu", function(thisCM,evt) {parent.ICEcoder.cMonContextMenu(thisCM, 'cM' + num + pane, evt)});
274-
window['cM'+num+pane].on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM, event, 'cM' + num + pane)});
275-
window['cM'+num+pane].on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM, 'cM' + num + pane, line, element)});
257+
window['cM' + num + pane].on("focus", function(thisCM) {parent.ICEcoder.cMonFocus(thisCM, 'cM' + num + pane)});
258+
window['cM' + num + pane].on("blur", function(thisCM) {parent.ICEcoder.cMonBlur(thisCM, 'cM' + num + pane)});
259+
window['cM' + num + pane].on("keyup", function(thisCM) {parent.ICEcoder.cMonKeyUp(thisCM, 'cM' + num + pane)});
260+
window['cM' + num + pane].on("cursorActivity", function(thisCM) {parent.ICEcoder.cMonCursorActivity(thisCM, 'cM' + num + pane)});
261+
window['cM' + num + pane].on("beforeSelectionChange", function(thisCM, changeObj) {parent.ICEcoder.prevLine = thisCM.getCursor().line;});
262+
window['cM' + num + pane].on("change", function(thisCM, changeObj) {parent.ICEcoder.cMonChange(thisCM, 'cM' + num + pane, changeObj, CodeMirror)});
263+
window['cM' + num + pane].on("beforeChange", function(thisCM, changeObj) {parent.ICEcoder.cMonBeforeChange(thisCM, 'cM' + num + pane, changeObj, CodeMirror)});
264+
window['cM' + num + pane].on("scroll", function(thisCM) {parent.ICEcoder.cMonScroll(thisCM, 'cM' + num + pane)});
265+
window['cM' + num + pane].on("update", function(thisCM) {parent.ICEcoder.cMonUpdate(thisCM, 'cM' + num + pane)});
266+
window['cM' + num + pane].on("inputRead", function(thisCM) {parent.ICEcoder.cMonInputRead(thisCM, 'cM' + num + pane)});
267+
window['cM' + num + pane].on("gutterClick", function(thisCM, line, gutter, evt) {parent.ICEcoder.cMonGutterClick(thisCM, line, gutter, evt, 'cM' + num + pane)});
268+
window['cM' + num + pane].on("mousedown", function(thisCM, evt) {parent.ICEcoder.cMonMouseDown(thisCM, 'cM' + num + pane, evt)});
269+
window['cM' + num + pane].on("paste", function(thisCM, evt) {parent.ICEcoder.cMonPaste(thisCM, 'cM' + num + pane, evt, (evt.clipboardData || window.clipboardData))});
270+
window['cM' + num + pane].on("contextmenu", function(thisCM, evt) {parent.ICEcoder.cMonContextMenu(thisCM, 'cM' + num + pane, evt)});
271+
window['cM' + num + pane].on("dragover", function(thisCM) {parent.ICEcoder.cMonDragOver(thisCM, event, 'cM' + num + pane)});
272+
window['cM' + num + pane].on("renderLine", function(thisCM, line, element) {parent.ICEcoder.cMonRenderLine(thisCM, 'cM' + num + pane, line, element)});
276273
}
277274
</script>
278275

279276
<div style="position: absolute; display: none; width: 12px; height: 100%; top: 0; right: 0; overflow: hidden; pointer-events: none; z-index: 2" id="resultsBar"></div>
280277

281-
<div style="position: absolute; display: none; height: 100%; width: 100%; top: 0; padding: 3px 0 0 60px; line-height: 16px; font-family: monospace; font-size: 13px; z-index: 2147483647" id="game"></div>
282-
283278
<script>
284279
CodeMirror.commands.autocomplete = function(cM) {
285280
let langType = parent.ICEcoder.caretLocType;

0 commit comments

Comments
 (0)