Replaced some ace files with minified, removed clippy etc code from js file

master
Ondřej Hruška 9 years ago
parent a4e21eb7dd
commit c2229cbffc
  1. 18505
      ace/ace.js
  2. 5
      ace/ext-language_tools.js
  3. 106
      ace/theme-monokai.js
  4. 7023
      ace/worker-php.js
  5. 1
      index.php
  6. 91
      php-console.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,105 +1 @@
define("ace/theme/monokai",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-monokai";
exports.cssText = ".ace-monokai .ace_gutter {\
background: #2F3129;\
color: #8F908A\
}\
.ace-monokai .ace_print-margin {\
width: 1px;\
background: #555651\
}\
.ace-monokai {\
background-color: #272822;\
color: #F8F8F2\
}\
.ace-monokai .ace_cursor {\
color: #F8F8F0\
}\
.ace-monokai .ace_marker-layer .ace_selection {\
background: #49483E\
}\
.ace-monokai.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px #272822;\
}\
.ace-monokai .ace_marker-layer .ace_step {\
background: rgb(102, 82, 0)\
}\
.ace-monokai .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #49483E\
}\
.ace-monokai .ace_marker-layer .ace_active-line {\
background: #202020\
}\
.ace-monokai .ace_gutter-active-line {\
background-color: #272727\
}\
.ace-monokai .ace_marker-layer .ace_selected-word {\
border: 1px solid #49483E\
}\
.ace-monokai .ace_invisible {\
color: #52524d\
}\
.ace-monokai .ace_entity.ace_name.ace_tag,\
.ace-monokai .ace_keyword,\
.ace-monokai .ace_meta.ace_tag,\
.ace-monokai .ace_storage {\
color: #F92672\
}\
.ace-monokai .ace_punctuation,\
.ace-monokai .ace_punctuation.ace_tag {\
color: #fff\
}\
.ace-monokai .ace_constant.ace_character,\
.ace-monokai .ace_constant.ace_language,\
.ace-monokai .ace_constant.ace_numeric,\
.ace-monokai .ace_constant.ace_other {\
color: #AE81FF\
}\
.ace-monokai .ace_invalid {\
color: #F8F8F0;\
background-color: #F92672\
}\
.ace-monokai .ace_invalid.ace_deprecated {\
color: #F8F8F0;\
background-color: #AE81FF\
}\
.ace-monokai .ace_support.ace_constant,\
.ace-monokai .ace_support.ace_function {\
color: #66D9EF\
}\
.ace-monokai .ace_fold {\
background-color: #A6E22E;\
border-color: #F8F8F2\
}\
.ace-monokai .ace_storage.ace_type,\
.ace-monokai .ace_support.ace_class,\
.ace-monokai .ace_support.ace_type {\
font-style: italic;\
color: #66D9EF\
}\
.ace-monokai .ace_entity.ace_name.ace_function,\
.ace-monokai .ace_entity.ace_other,\
.ace-monokai .ace_entity.ace_other.ace_attribute-name,\
.ace-monokai .ace_variable {\
color: #A6E22E\
}\
.ace-monokai .ace_variable.ace_parameter {\
font-style: italic;\
color: #FD971F\
}\
.ace-monokai .ace_string {\
color: #E6DB74\
}\
.ace-monokai .ace_comment {\
color: #75715E\
}\
.ace-monokai .ace_indent-guide {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y\
}";
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
define("ace/theme/monokai",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-monokai",t.cssText=".ace-monokai .ace_gutter {background: #2F3129;color: #8F908A}.ace-monokai .ace_print-margin {width: 1px;background: #555651}.ace-monokai {background-color: #272822;color: #F8F8F2}.ace-monokai .ace_cursor {color: #F8F8F0}.ace-monokai .ace_marker-layer .ace_selection {background: #49483E}.ace-monokai.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #272822;}.ace-monokai .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-monokai .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #49483E}.ace-monokai .ace_marker-layer .ace_active-line {background: #202020}.ace-monokai .ace_gutter-active-line {background-color: #272727}.ace-monokai .ace_marker-layer .ace_selected-word {border: 1px solid #49483E}.ace-monokai .ace_invisible {color: #52524d}.ace-monokai .ace_entity.ace_name.ace_tag,.ace-monokai .ace_keyword,.ace-monokai .ace_meta.ace_tag,.ace-monokai .ace_storage {color: #F92672}.ace-monokai .ace_punctuation,.ace-monokai .ace_punctuation.ace_tag {color: #fff}.ace-monokai .ace_constant.ace_character,.ace-monokai .ace_constant.ace_language,.ace-monokai .ace_constant.ace_numeric,.ace-monokai .ace_constant.ace_other {color: #AE81FF}.ace-monokai .ace_invalid {color: #F8F8F0;background-color: #F92672}.ace-monokai .ace_invalid.ace_deprecated {color: #F8F8F0;background-color: #AE81FF}.ace-monokai .ace_support.ace_constant,.ace-monokai .ace_support.ace_function {color: #66D9EF}.ace-monokai .ace_fold {background-color: #A6E22E;border-color: #F8F8F2}.ace-monokai .ace_storage.ace_type,.ace-monokai .ace_support.ace_class,.ace-monokai .ace_support.ace_type {font-style: italic;color: #66D9EF}.ace-monokai .ace_entity.ace_name.ace_function,.ace-monokai .ace_entity.ace_other,.ace-monokai .ace_entity.ace_other.ace_attribute-name,.ace-monokai .ace_variable {color: #A6E22E}.ace-monokai .ace_variable.ace_parameter {font-style: italic;color: #FD971F}.ace-monokai .ace_string {color: #E6DB74}.ace-monokai .ace_comment {color: #75715E}.ace-monokai .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)})

File diff suppressed because one or more lines are too long

@ -102,6 +102,7 @@ if (isset($_POST['code'])) {
<script src="ace/ace.js"></script>
<script src="ace/theme-monokai.js"></script>
<script src="ace/mode-php.js"></script>
<script src="ace/ext-language_tools.js"></script>
<script src="php-console.js"></script>
<script>

@ -3,21 +3,22 @@
/**
* PHP Console
*
* A web-based php debug console
* A web-based php sandbox
*
* Copyright (C) 2010, Jordi Boggiano
* http://seld.be/ - j.boggiano@seld.be
* Copyright (C)
* 2010, Jordi Boggiano <j.boggiano@seld.be>
* 2015, Ondřej Hruška <ondra@ondrovo.com>
*
* Licensed under the new BSD License
* See the LICENSE file for details
*
* Source on Github http://github.com/Seldaek/php-console
* Source on Github http://github.com/MightyPork/php-sandbox
*/
(function (require, $, ace) {
"use strict";
var updateStatusBar, prepareClippyButton, refreshKrumoState, handleSubmit, initializeAce, handleAjaxError,
options, editor;
var updateStatusBar, handleSubmit, initializeAce, handleAjaxError, options, editor;
options = {
tabsize: 4,
editor: 'editor'
@ -31,36 +32,6 @@
$('.statusbar .position').text('Line: ' + (1 + cursor_position.row) + ', Column: ' + cursor_position.column);
};
/**
* prepares a clippy button for clipboard access
*/
prepareClippyButton = function (e) {
var selection = editor.getSession().doc.getTextRange(editor.getSelectionRange());
if (!selection) {
$('.statusbar .copy').hide();
return;
}
$('#clippy embed').attr('FlashVars', 'text=' + selection);
$('#clippy param[name="FlashVars"]').attr('value', 'text=' + selection);
$('.statusbar .copy').html($('.statusbar .copy').html()).show();
};
/**
* adds a toggle button to expand/collapse all krumo sub-trees at once
*/
refreshKrumoState = function () {
if ($('.krumo-expand').length > 0) {
$('<a class="expand" href="#">Toggle all</a>')
.click(function (e) {
$('div.krumo-element.krumo-expand').each(function (idx, el) {
window.krumo.toggle(el);
});
e.preventDefault();
})
.prependTo('.output');
}
};
/**
* does an async request to eval the php code and displays the result
*/
@ -73,36 +44,6 @@
localStorage.setItem('phpCode', editor.getSession().getValue());
}
var controlChars = {
'NUL' : /\x00/g, // Null char
'SOH' : /\x01/g, // Start of Heading
'STX' : /\x02/g, // Start of Text
'ETX' : /\x03/g, // End of Text
'EOT' : /\x04/g, // End of Transmission
'ENQ' : /\x05/g, // Enquiry
'ACK' : /\x06/g, // Acknowledgment
'BEL' : /\x07/g, // Bell
'BS' : /\x08/g, // Back Space
'SO' : /\x0E/g, // Shift Out / X-On
'SI' : /\x0F/g, // Shift In / X-Off
'DLE' : /\x10/g, // Data Line Escape
'DC1' : /\x11/g, // Device Control 1 (oft. XON)
'DC2' : /\x12/g, // Device Control 2
'DC3' : /\x13/g, // Device Control 3 (oft. XOFF)
'DC4' : /\x14/g, // Device Control 4
'NAK' : /\x15/g, // Negative Acknowledgement
'SYN' : /\x16/g, // Synchronous Idle
'ETB' : /\x17/g, // End of Transmit Block
'CAN' : /\x18/g, // Cancel
'EM' : /\x19/g, // End of Medium
'SUB' : /\x1A/g, // Substitute
'ESC' : /\x1B/g, // Escape
'FS' : /\x1C/g, // File Separator
'GS' : /\x1D/g, // Group Separator
'RS' : /\x1E/g, // Record Separator
'US' : /\x1F/g // Unit Separator
};
// eval server-side
$.post('?js=1', { code: editor.getSession().getValue() }, function (res, status, jqXHR) {
var mem = jqXHR.getResponseHeader("X-Memory-Usage") || "",
@ -116,21 +57,15 @@
if (res.match(/#end-php-console-output#$/)) {
var result = res.substring(0, res.length - 24);
// $.each(controlChars, function (identifier, regex) {
// result = result.replace(regex, '<span class="control-char">' + identifier + '</span>');
// });
$('div.output').text(result); // or html?
} else {
$('div.output').text(res + "\n\n*** Script ended unexpectedly. ***");
// $('div.output').text(res + "<br /><br /><em>Script ended unexpectedly.</em>");
}
refreshKrumoState();
});
};
handleAjaxError = function (event, jqxhr, settings, exception) {
$('div.output').html("<em>Error occured while posting your code.</em>");
refreshKrumoState();
};
initializeAce = function () {
@ -154,9 +89,12 @@
editor.focus();
editor.gotoLine(3, 0);
editor.setTheme("ace/theme/monokai");
editor.setOption('showPrintMargin', false);
editor.setOption('fontSize', '18px');
editor.setOption('fontFamily', 'Source Code Pro');
editor.setOptions({
showPrintMargin: false,
fontSize: '18px',
enableBasicAutocompletion: true,
fontFamily: 'Source Code Pro'
});
// set mode
PhpMode = require("ace/mode/php").Mode;
@ -172,9 +110,6 @@
// events
editor.getSession().selection.on('changeCursor', updateStatusBar);
if (window.navigator.userAgent.indexOf('Opera/') === 0) {
editor.getSession().selection.on('changeSelection', prepareClippyButton);
}
// reset button
if (window.localStorage) {

Loading…
Cancel
Save