remove jQuery dependency and improve folder structure
This commit is contained in:
parent
f60e2214ba
commit
31d4121098
15 changed files with 66 additions and 33211 deletions
10
copy.sh
Executable file
10
copy.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
rm -rf libs
|
||||
mkdir -p libs/purecss/
|
||||
mkdir -p libs/ace/
|
||||
cp node_modules/purecss/build/*.css libs/purecss/
|
||||
for i in ace mode-javascript theme-chrome theme-tomorrow worker-javascript
|
||||
do
|
||||
cp node_modules/ace-builds/src/${i}.js libs/ace/
|
||||
done
|
||||
cp node_modules/ace-builds/LICENSE node_modules/ace-builds/README.md libs/ace/
|
|
@ -3,16 +3,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
var popup = {
|
||||
key: 'popup',
|
||||
el: {
|
||||
popup: $('#customjs'),
|
||||
popupForm: $('#popup-form'),
|
||||
hostSelect: $('#host'),
|
||||
hostGoToLink: $('#goto-host'),
|
||||
enableCheck: $('#enable'),
|
||||
sourceEditor: $('#ace-editor'),
|
||||
saveBtn: $('#save'),
|
||||
resetBtn: $('#reset'),
|
||||
draftRemoveLink: $('#draft-remove'),
|
||||
error: $('#error')
|
||||
popup: document.getElementById("customjs"),
|
||||
popupForm: document.getElementById("popup-form"),
|
||||
hostSelect: document.getElementById("host"),
|
||||
hostGoToLink: document.getElementById("goto-host"),
|
||||
enableCheck: document.getElementById("enable"),
|
||||
sourceEditor: document.getElementById("ace-editor"),
|
||||
saveBtn: document.getElementById("save"),
|
||||
resetBtn: document.getElementById("reset"),
|
||||
draftRemoveLink: document.getElementById("draft-remove"),
|
||||
error: document.getElementById("error")
|
||||
},
|
||||
title: {
|
||||
include: {
|
||||
|
@ -22,11 +22,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
draft: "This is a draft, click to remove it"
|
||||
},
|
||||
applyTitles: function() {
|
||||
this.el.hostSelect.attr('title', chrome.i18n.getMessage("select_host_title"));
|
||||
this.el.hostGoToLink.attr('title', chrome.i18n.getMessage("select_host_goto"));
|
||||
this.el.hostSelect.setAttribute('title', chrome.i18n.getMessage("select_host_title"));
|
||||
this.el.hostGoToLink.setAttribute('title', chrome.i18n.getMessage("select_host_goto"));
|
||||
|
||||
this.el.saveBtn.attr('title', this.title.save);
|
||||
this.el.draftRemoveLink.attr('title', this.title.draft);
|
||||
this.el.saveBtn.setAttribute('title', this.title.save);
|
||||
this.el.draftRemoveLink.setAttribute('title', this.title.draft);
|
||||
},
|
||||
host: undefined,
|
||||
emptyDataPattern: {
|
||||
|
@ -42,7 +42,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
defaultValue: chrome.i18n.getMessage("placeholder_javascript"),
|
||||
value: '',
|
||||
init: function() {
|
||||
var editor = this.editorInstance = ace.edit(popup.el.sourceEditor[0]);
|
||||
var editor = this.editorInstance = ace.edit(popup.el.sourceEditor);
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.getSession().setMode("ace/mode/javascript");
|
||||
// editor.setHighlightActiveLine(false);
|
||||
|
@ -141,7 +141,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
var data = this._getData();
|
||||
delete data[key];
|
||||
|
||||
if ($.isEmptyObject(data)) {
|
||||
if (Object.keys(data).length === 0) {
|
||||
this.remove();
|
||||
}
|
||||
else {
|
||||
|
@ -194,7 +194,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
if (host === url) {
|
||||
option.setAttribute('selected', 'selected');
|
||||
}
|
||||
popup.el.hostSelect.append(option);
|
||||
popup.el.hostSelect.appendChild(option);
|
||||
});
|
||||
|
||||
// Store host (current included in array) if customjs is defined
|
||||
|
@ -252,7 +252,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
applyData: function(data, notDraft) {
|
||||
|
||||
if (data && !notDraft) {
|
||||
this.el.draftRemoveLink.removeClass('is-hidden');
|
||||
this.el.draftRemoveLink.classList.remove('is-hidden');
|
||||
}
|
||||
|
||||
data = data || this.data;
|
||||
|
@ -262,7 +262,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
}
|
||||
|
||||
// Set enable checkbox
|
||||
popup.el.enableCheck.prop('checked', data.config.enable);
|
||||
popup.el.enableCheck.checked = data.config.enable;
|
||||
|
||||
// Apply source into editor
|
||||
popup.editor.apply(data.source);
|
||||
|
@ -270,7 +270,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
getCurrentData: function() {
|
||||
return {
|
||||
config: {
|
||||
enable: popup.el.enableCheck.prop('checked')
|
||||
enable: popup.el.enableCheck.checked
|
||||
},
|
||||
source: popup.editor.editorInstance.getValue()
|
||||
};
|
||||
|
@ -280,20 +280,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
popup.storage.remove('draft');
|
||||
|
||||
popup.applyData();
|
||||
popup.el.draftRemoveLink.addClass('is-hidden');
|
||||
popup.el.draftRemoveLink.classList.add('is-hidden');
|
||||
},
|
||||
save: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Is allowed to save?
|
||||
if (popup.el.saveBtn.hasClass('pure-button-disabled')) {
|
||||
if (popup.el.saveBtn.classList.contains('pure-button-disabled')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = popup.getCurrentData();
|
||||
|
||||
// Transform source for correct apply
|
||||
data.config.extra = data.config.extra.replace("\n", ';');
|
||||
data.source = popup.generateScriptDataUrl(data.source);
|
||||
|
||||
// Send new data to apply
|
||||
|
@ -307,7 +306,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
popup.removeDraft();
|
||||
|
||||
// Close popup
|
||||
// window.close();
|
||||
window.close();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
@ -315,7 +314,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
e.preventDefault();
|
||||
|
||||
// Is allowed to reset?
|
||||
if (popup.el.resetBtn.hasClass('pure-button-disabled')) {
|
||||
if (popup.el.resetBtn.classList.contains('pure-button-disabled')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -348,8 +347,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
return false;
|
||||
},
|
||||
error: function() {
|
||||
popup.el.popup.addClass('customjs--error');
|
||||
popup.el.error.removeClass('is-hidden');
|
||||
popup.el.popup.classList.add('customjs--error');
|
||||
popup.el.error.classList.remove('is-hidden');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -363,9 +362,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
|
||||
|
||||
/**
|
||||
* Click to goTo host link
|
||||
* Click to goTo host link //TODO: JQUERY
|
||||
*/
|
||||
popup.el.hostGoToLink.on('click', function() {
|
||||
popup.el.hostGoToLink.addEventListener('click', function() {
|
||||
var link = popup.el.hostSelect.val();
|
||||
chrome.tabs.sendRequest(popup.tabId, {method: "goTo", link: link, reload: false});
|
||||
window.close();
|
||||
|
@ -400,8 +399,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
popup.storage.set('draft', draft);
|
||||
|
||||
// Auto switch 'enable checkbox' on source edit
|
||||
if (!popup.el.enableCheck.hasClass('not-auto-change')) {
|
||||
popup.el.enableCheck.prop('checked', true);
|
||||
if (!popup.el.enableCheck.classList.contains('not-auto-change')) {
|
||||
popup.el.enableCheck.checked = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -412,8 +411,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
* Change host by select
|
||||
*/
|
||||
|
||||
popup.el.hostSelect.on('change', function(e) {
|
||||
var host = $(this).val(),
|
||||
popup.el.hostSelect.addEventListener('change', function(e) {
|
||||
var host = this.value,
|
||||
hostData = JSON.parse(localStorage.getItem(popup.key + '-' + host), true);
|
||||
|
||||
|
||||
|
@ -422,12 +421,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
clearInterval(draftAutoSaveInterval);
|
||||
|
||||
// Show goto link
|
||||
popup.el.hostGoToLink.removeClass('is-hidden');
|
||||
popup.el.hostGoToLink.classList.remove('is-hidden');
|
||||
|
||||
// Hide controls
|
||||
popup.el.saveBtn.addClass('pure-button-disabled');
|
||||
popup.el.resetBtn.addClass('pure-button-disabled');
|
||||
popup.el.draftRemoveLink.addClass('is-hidden');
|
||||
popup.el.saveBtn.classList.add('pure-button-disabled');
|
||||
popup.el.resetBtn.classList.add('pure-button-disabled');
|
||||
popup.el.draftRemoveLink.classList.add('is-hidden');
|
||||
|
||||
// Apply other host data
|
||||
try {
|
||||
|
@ -443,13 +442,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
draftAutoSaveInterval = setInterval(draftAutoSave, 2000);
|
||||
|
||||
// Hide goto link
|
||||
popup.el.hostGoToLink.addClass('is-hidden');
|
||||
popup.el.hostGoToLink.classList.add('is-hidden');
|
||||
|
||||
// Show controls
|
||||
popup.el.saveBtn.removeClass('pure-button-disabled');
|
||||
popup.el.resetBtn.removeClass('pure-button-disabled');
|
||||
popup.el.saveBtn.classList.remove('pure-button-disabled');
|
||||
popup.el.resetBtn.classList.remove('pure-button-disabled');
|
||||
if (popup.storage.get('draft')) {
|
||||
popup.el.draftRemoveLink.removeClass('is-hidden');
|
||||
popup.el.draftRemoveLink.classList.remove('is-hidden');
|
||||
}
|
||||
|
||||
// Apply current host data
|
||||
|
@ -461,28 +460,28 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
/**
|
||||
* Protect 'enable checkbox' if was manually modified
|
||||
*/
|
||||
popup.el.enableCheck.on('click', function() {
|
||||
$(this).addClass('not-auto-change');
|
||||
popup.el.enableCheck.addEventListener('click', function() {
|
||||
this.classList.add('not-auto-change');
|
||||
});
|
||||
|
||||
/**
|
||||
* Save script
|
||||
*/
|
||||
|
||||
popup.el.saveBtn.on('click', popup.save);
|
||||
popup.el.saveBtn.addEventListener('click', popup.save);
|
||||
|
||||
/**
|
||||
* Reset script
|
||||
*/
|
||||
|
||||
popup.el.resetBtn.on('click', popup.reset);
|
||||
popup.el.resetBtn.addEventListener('click', popup.reset);
|
||||
|
||||
|
||||
/**
|
||||
* Remove draft
|
||||
*/
|
||||
|
||||
popup.el.draftRemoveLink.on('click', popup.removeDraft);
|
||||
popup.el.draftRemoveLink.addEventListener('click', popup.removeDraft);
|
||||
|
||||
|
||||
}, false);
|
|
@ -1,24 +0,0 @@
|
|||
Copyright (c) 2010, Ajax.org B.V.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Ajax.org B.V. nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,22 +0,0 @@
|
|||
Ace (Ajax.org Cloud9 Editor)
|
||||
============================
|
||||
[![CDNJS](https://img.shields.io/cdnjs/v/ace.svg)](https://cdnjs.com/libraries/ace)
|
||||
|
||||
Ace is a code editor written in JavaScript.
|
||||
|
||||
This repository has only generated files.
|
||||
If you want to work on ace please go to https://github.com/ajaxorg/ace instead.
|
||||
|
||||
|
||||
here you can find pre-built files for convenience of embedding.
|
||||
it contains 4 versions
|
||||
* [src](https://github.com/ajaxorg/ace-builds/tree/master/src) concatenated but not minified
|
||||
* [src-min](https://github.com/ajaxorg/ace-builds/tree/master/src-min) concatenated and minified with uglify.js
|
||||
* [src-noconflict](https://github.com/ajaxorg/ace-builds/tree/master/src-noconflict) uses ace.require instead of require
|
||||
* [src-min-noconflict](https://github.com/ajaxorg/ace-builds/tree/master/src-min-noconflict) concatenated, minified with uglify.js, and uses ace.require instead of require
|
||||
|
||||
|
||||
For a simple way of embedding ace into webpage see [editor.html](https://github.com/ajaxorg/ace-builds/blob/master/editor.html) or list of other [simple examples](https://github.com/ajaxorg/ace-builds/tree/master/demo)
|
||||
To see ace in action go to [kitchen-sink-demo](http://ajaxorg.github.com/ace-builds/kitchen-sink.html), [scrollable-page-demo](http://ajaxorg.github.com/ace-builds/demo/scrollable-page.html) or [minimal demo](http://ajaxorg.github.com/ace-builds/editor.html),
|
||||
|
||||
|
19560
lib/ace/ace.js
19560
lib/ace/ace.js
File diff suppressed because it is too large
Load diff
|
@ -1,789 +0,0 @@
|
|||
define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var DocCommentHighlightRules = function() {
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "comment.doc.tag",
|
||||
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||
},
|
||||
DocCommentHighlightRules.getTagRule(),
|
||||
{
|
||||
defaultToken : "comment.doc",
|
||||
caseInsensitive: true
|
||||
}]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||
|
||||
DocCommentHighlightRules.getTagRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc.tag.storage.type",
|
||||
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
|
||||
};
|
||||
}
|
||||
|
||||
DocCommentHighlightRules.getStartRule = function(start) {
|
||||
return {
|
||||
token : "comment.doc", // doc comment
|
||||
regex : "\\/\\*(?=\\*)",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
DocCommentHighlightRules.getEndRule = function (start) {
|
||||
return {
|
||||
token : "comment.doc", // closing comment
|
||||
regex : "\\*\\/",
|
||||
next : start
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||||
|
||||
});
|
||||
|
||||
define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
|
||||
|
||||
var JavaScriptHighlightRules = function(options) {
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"variable.language":
|
||||
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
|
||||
"Namespace|QName|XML|XMLList|" + // E4X
|
||||
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
||||
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
|
||||
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
|
||||
"SyntaxError|TypeError|URIError|" +
|
||||
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
|
||||
"isNaN|parseFloat|parseInt|" +
|
||||
"JSON|Math|" + // Other
|
||||
"this|arguments|prototype|window|document" , // Pseudo
|
||||
"keyword":
|
||||
"const|yield|import|get|set|async|await|" +
|
||||
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
||||
"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
|
||||
"__parent__|__count__|escape|unescape|with|__proto__|" +
|
||||
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
|
||||
"storage.type":
|
||||
"const|let|var|function",
|
||||
"constant.language":
|
||||
"null|Infinity|NaN|undefined",
|
||||
"support.function":
|
||||
"alert",
|
||||
"constant.language.boolean": "true|false"
|
||||
}, "identifier");
|
||||
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
|
||||
|
||||
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
||||
"u[0-9a-fA-F]{4}|" + // unicode
|
||||
"u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
|
||||
"[0-2][0-7]{0,2}|" + // oct
|
||||
"3[0-7][0-7]?|" + // oct
|
||||
"[4-7][0-7]?|" + //oct
|
||||
".)";
|
||||
|
||||
this.$rules = {
|
||||
"no_regex" : [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
comments("no_regex"),
|
||||
{
|
||||
token : "string",
|
||||
regex : "'(?=.)",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"(?=.)',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hexadecimal, octal and binary
|
||||
regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
|
||||
}, {
|
||||
token : "constant.numeric", // decimal integers and floats
|
||||
regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "support.function",
|
||||
"punctuation.operator", "entity.name.function", "text","keyword.operator"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
|
||||
"text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||
"keyword.operator", "text",
|
||||
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"entity.name.function", "text", "punctuation.operator",
|
||||
"text", "storage.type", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : [
|
||||
"text", "text", "storage.type", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : "from(?=\\s*('|\"))"
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||
next : "start"
|
||||
}, {
|
||||
token : ["support.constant"],
|
||||
regex : /that\b/
|
||||
}, {
|
||||
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||
regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : identifierRe
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : /[.](?![.])/,
|
||||
next : "property"
|
||||
}, {
|
||||
token : "storage.type",
|
||||
regex : /=>/
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : /[?:,;.]/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]/
|
||||
}, {
|
||||
token: "comment",
|
||||
regex: /^#!.*$/
|
||||
}
|
||||
],
|
||||
property: [{
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : [
|
||||
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
||||
"keyword.operator", "text",
|
||||
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
||||
],
|
||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
|
||||
next: "function_arguments"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : /[.](?![.])/
|
||||
}, {
|
||||
token : "support.function",
|
||||
regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||
}, {
|
||||
token : "support.function.dom",
|
||||
regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||
}, {
|
||||
token : "support.constant",
|
||||
regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||
}, {
|
||||
token : "identifier",
|
||||
regex : identifierRe
|
||||
}, {
|
||||
regex: "",
|
||||
token: "empty",
|
||||
next: "no_regex"
|
||||
}
|
||||
],
|
||||
"start": [
|
||||
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||
comments("start"),
|
||||
{
|
||||
token: "string.regexp",
|
||||
regex: "\\/",
|
||||
next: "regex"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+|^$",
|
||||
next : "start"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "no_regex"
|
||||
}
|
||||
],
|
||||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp",
|
||||
regex: "/[sxngimy]*",
|
||||
next: "no_regex"
|
||||
}, {
|
||||
token : "invalid",
|
||||
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
|
||||
}, {
|
||||
token : "constant.language.escape",
|
||||
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
|
||||
}, {
|
||||
token : "constant.language.delimiter",
|
||||
regex: /\|/
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: /\[\^?/,
|
||||
next: "regex_character_class"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "$",
|
||||
next: "no_regex"
|
||||
}, {
|
||||
defaultToken: "string.regexp"
|
||||
}
|
||||
],
|
||||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.charclass.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: "]",
|
||||
next: "regex"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: "-"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "$",
|
||||
next: "no_regex"
|
||||
}, {
|
||||
defaultToken: "string.regexp.charachterclass"
|
||||
}
|
||||
],
|
||||
"function_arguments": [
|
||||
{
|
||||
token: "variable.parameter",
|
||||
regex: identifierRe
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "[, ]+"
|
||||
}, {
|
||||
token: "punctuation.operator",
|
||||
regex: "$"
|
||||
}, {
|
||||
token: "empty",
|
||||
regex: "",
|
||||
next: "no_regex"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
consumeLineEnd : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"|$',
|
||||
next : "no_regex"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
regex : escapedRe
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "\\\\$",
|
||||
consumeLineEnd : true
|
||||
}, {
|
||||
token : "string",
|
||||
regex : "'|$",
|
||||
next : "no_regex"
|
||||
}, {
|
||||
defaultToken: "string"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
if (!options || !options.noES6) {
|
||||
this.$rules.no_regex.unshift({
|
||||
regex: "[{}]", onMatch: function(val, state, stack) {
|
||||
this.next = val == "{" ? this.nextState : "";
|
||||
if (val == "{" && stack.length) {
|
||||
stack.unshift("start", state);
|
||||
}
|
||||
else if (val == "}" && stack.length) {
|
||||
stack.shift();
|
||||
this.next = stack.shift();
|
||||
if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
|
||||
return "paren.quasi.end";
|
||||
}
|
||||
return val == "{" ? "paren.lparen" : "paren.rparen";
|
||||
},
|
||||
nextState: "start"
|
||||
}, {
|
||||
token : "string.quasi.start",
|
||||
regex : /`/,
|
||||
push : [{
|
||||
token : "constant.language.escape",
|
||||
regex : escapedRe
|
||||
}, {
|
||||
token : "paren.quasi.start",
|
||||
regex : /\${/,
|
||||
push : "start"
|
||||
}, {
|
||||
token : "string.quasi.end",
|
||||
regex : /`/,
|
||||
next : "pop"
|
||||
}, {
|
||||
defaultToken: "string.quasi"
|
||||
}]
|
||||
});
|
||||
|
||||
if (!options || options.jsx != false)
|
||||
JSX.call(this);
|
||||
}
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||
|
||||
function JSX() {
|
||||
var tagRegex = identifierRe.replace("\\d", "\\d\\-");
|
||||
var jsxTag = {
|
||||
onMatch : function(val, state, stack) {
|
||||
var offset = val.charAt(1) == "/" ? 2 : 1;
|
||||
if (offset == 1) {
|
||||
if (state != this.nextState)
|
||||
stack.unshift(this.next, this.nextState, 0);
|
||||
else
|
||||
stack.unshift(this.next);
|
||||
stack[2]++;
|
||||
} else if (offset == 2) {
|
||||
if (state == this.nextState) {
|
||||
stack[1]--;
|
||||
if (!stack[1] || stack[1] < 0) {
|
||||
stack.shift();
|
||||
stack.shift();
|
||||
}
|
||||
}
|
||||
}
|
||||
return [{
|
||||
type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
|
||||
value: val.slice(0, offset)
|
||||
}, {
|
||||
type: "meta.tag.tag-name.xml",
|
||||
value: val.substr(offset)
|
||||
}];
|
||||
},
|
||||
regex : "</?" + tagRegex + "",
|
||||
next: "jsxAttributes",
|
||||
nextState: "jsx"
|
||||
};
|
||||
this.$rules.start.unshift(jsxTag);
|
||||
var jsxJsRule = {
|
||||
regex: "{",
|
||||
token: "paren.quasi.start",
|
||||
push: "start"
|
||||
};
|
||||
this.$rules.jsx = [
|
||||
jsxJsRule,
|
||||
jsxTag,
|
||||
{include : "reference"},
|
||||
{defaultToken: "string"}
|
||||
];
|
||||
this.$rules.jsxAttributes = [{
|
||||
token : "meta.tag.punctuation.tag-close.xml",
|
||||
regex : "/?>",
|
||||
onMatch : function(value, currentState, stack) {
|
||||
if (currentState == stack[0])
|
||||
stack.shift();
|
||||
if (value.length == 2) {
|
||||
if (stack[0] == this.nextState)
|
||||
stack[1]--;
|
||||
if (!stack[1] || stack[1] < 0) {
|
||||
stack.splice(0, 2);
|
||||
}
|
||||
}
|
||||
this.next = stack[0] || "start";
|
||||
return [{type: this.token, value: value}];
|
||||
},
|
||||
nextState: "jsx"
|
||||
},
|
||||
jsxJsRule,
|
||||
comments("jsxAttributes"),
|
||||
{
|
||||
token : "entity.other.attribute-name.xml",
|
||||
regex : tagRegex
|
||||
}, {
|
||||
token : "keyword.operator.attribute-equals.xml",
|
||||
regex : "="
|
||||
}, {
|
||||
token : "text.tag-whitespace.xml",
|
||||
regex : "\\s+"
|
||||
}, {
|
||||
token : "string.attribute-value.xml",
|
||||
regex : "'",
|
||||
stateName : "jsx_attr_q",
|
||||
push : [
|
||||
{token : "string.attribute-value.xml", regex: "'", next: "pop"},
|
||||
{include : "reference"},
|
||||
{defaultToken : "string.attribute-value.xml"}
|
||||
]
|
||||
}, {
|
||||
token : "string.attribute-value.xml",
|
||||
regex : '"',
|
||||
stateName : "jsx_attr_qq",
|
||||
push : [
|
||||
{token : "string.attribute-value.xml", regex: '"', next: "pop"},
|
||||
{include : "reference"},
|
||||
{defaultToken : "string.attribute-value.xml"}
|
||||
]
|
||||
},
|
||||
jsxTag
|
||||
];
|
||||
this.$rules.reference = [{
|
||||
token : "constant.language.escape.reference.xml",
|
||||
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||
}];
|
||||
}
|
||||
|
||||
function comments(next) {
|
||||
return [
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
regex : /\/\*/,
|
||||
next: [
|
||||
DocCommentHighlightRules.getTagRule(),
|
||||
{token : "comment", regex : "\\*\\/", next : next || "pop"},
|
||||
{defaultToken : "comment", caseInsensitive: true}
|
||||
]
|
||||
}, {
|
||||
token : "comment",
|
||||
regex : "\\/\\/",
|
||||
next: [
|
||||
DocCommentHighlightRules.getTagRule(),
|
||||
{token : "comment", regex : "$|^", next : next || "pop"},
|
||||
{defaultToken : "comment", caseInsensitive: true}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
|
||||
});
|
||||
|
||||
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\}/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\})/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
return line.match(/^\s*/)[0];
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
});
|
||||
|
||||
define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../../lib/oop");
|
||||
var Range = require("../../range").Range;
|
||||
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||
|
||||
var FoldMode = exports.FoldMode = function(commentRegex) {
|
||||
if (commentRegex) {
|
||||
this.foldingStartMarker = new RegExp(
|
||||
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
||||
);
|
||||
this.foldingStopMarker = new RegExp(
|
||||
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
||||
);
|
||||
}
|
||||
};
|
||||
oop.inherits(FoldMode, BaseFoldMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
|
||||
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
||||
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
||||
this._getFoldWidgetBase = this.getFoldWidget;
|
||||
this.getFoldWidget = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
|
||||
if (this.singleLineBlockCommentRe.test(line)) {
|
||||
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
||||
return "";
|
||||
}
|
||||
|
||||
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
||||
|
||||
if (!fw && this.startRegionRe.test(line))
|
||||
return "start"; // lineCommentRegionStart
|
||||
|
||||
return fw;
|
||||
};
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
||||
var line = session.getLine(row);
|
||||
|
||||
if (this.startRegionRe.test(line))
|
||||
return this.getCommentRegionBlock(session, line, row);
|
||||
|
||||
var match = line.match(this.foldingStartMarker);
|
||||
if (match) {
|
||||
var i = match.index;
|
||||
|
||||
if (match[1])
|
||||
return this.openingBracketBlock(session, match[1], row, i);
|
||||
|
||||
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||
|
||||
if (range && !range.isMultiLine()) {
|
||||
if (forceMultiline) {
|
||||
range = this.getSectionRange(session, row);
|
||||
} else if (foldStyle != "all")
|
||||
range = null;
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
if (foldStyle === "markbegin")
|
||||
return;
|
||||
|
||||
var match = line.match(this.foldingStopMarker);
|
||||
if (match) {
|
||||
var i = match.index + match[0].length;
|
||||
|
||||
if (match[1])
|
||||
return this.closingBracketBlock(session, match[1], row, i);
|
||||
|
||||
return session.getCommentFoldRange(row, i, -1);
|
||||
}
|
||||
};
|
||||
|
||||
this.getSectionRange = function(session, row) {
|
||||
var line = session.getLine(row);
|
||||
var startIndent = line.search(/\S/);
|
||||
var startRow = row;
|
||||
var startColumn = line.length;
|
||||
row = row + 1;
|
||||
var endRow = row;
|
||||
var maxRow = session.getLength();
|
||||
while (++row < maxRow) {
|
||||
line = session.getLine(row);
|
||||
var indent = line.search(/\S/);
|
||||
if (indent === -1)
|
||||
continue;
|
||||
if (startIndent > indent)
|
||||
break;
|
||||
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||||
|
||||
if (subRange) {
|
||||
if (subRange.start.row <= startRow) {
|
||||
break;
|
||||
} else if (subRange.isMultiLine()) {
|
||||
row = subRange.end.row;
|
||||
} else if (startIndent == indent) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
endRow = row;
|
||||
}
|
||||
|
||||
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||||
};
|
||||
this.getCommentRegionBlock = function(session, line, row) {
|
||||
var startColumn = line.search(/\s*$/);
|
||||
var maxRow = session.getLength();
|
||||
var startRow = row;
|
||||
|
||||
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
||||
var depth = 1;
|
||||
while (++row < maxRow) {
|
||||
line = session.getLine(row);
|
||||
var m = re.exec(line);
|
||||
if (!m) continue;
|
||||
if (m[1]) depth--;
|
||||
else depth++;
|
||||
|
||||
if (!depth) break;
|
||||
}
|
||||
|
||||
var endRow = row;
|
||||
if (endRow > startRow) {
|
||||
return new Range(startRow, startColumn, endRow, line.length);
|
||||
}
|
||||
};
|
||||
|
||||
}).call(FoldMode.prototype);
|
||||
|
||||
});
|
||||
|
||||
define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = JavaScriptHighlightRules;
|
||||
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
this.$quotes = {'"': '"', "'": "'", "`": "`"};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start" || state == "no_regex") {
|
||||
var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
} else if (state == "doc-start") {
|
||||
if (endState == "start" || endState == "no_regex") {
|
||||
return "";
|
||||
}
|
||||
var match = line.match(/^\s*(\/?)\*/);
|
||||
if (match) {
|
||||
if (match[1]) {
|
||||
indent += " ";
|
||||
}
|
||||
indent += "* ";
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("annotate", function(results) {
|
||||
session.setAnnotations(results.data);
|
||||
});
|
||||
|
||||
worker.on("terminate", function() {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
|
||||
return worker;
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/javascript";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
|
@ -1,128 +0,0 @@
|
|||
define("ace/theme/chrome",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
|
||||
|
||||
exports.isDark = false;
|
||||
exports.cssClass = "ace-chrome";
|
||||
exports.cssText = ".ace-chrome .ace_gutter {\
|
||||
background: #ebebeb;\
|
||||
color: #333;\
|
||||
overflow : hidden;\
|
||||
}\
|
||||
.ace-chrome .ace_print-margin {\
|
||||
width: 1px;\
|
||||
background: #e8e8e8;\
|
||||
}\
|
||||
.ace-chrome {\
|
||||
background-color: #FFFFFF;\
|
||||
color: black;\
|
||||
}\
|
||||
.ace-chrome .ace_cursor {\
|
||||
color: black;\
|
||||
}\
|
||||
.ace-chrome .ace_invisible {\
|
||||
color: rgb(191, 191, 191);\
|
||||
}\
|
||||
.ace-chrome .ace_constant.ace_buildin {\
|
||||
color: rgb(88, 72, 246);\
|
||||
}\
|
||||
.ace-chrome .ace_constant.ace_language {\
|
||||
color: rgb(88, 92, 246);\
|
||||
}\
|
||||
.ace-chrome .ace_constant.ace_library {\
|
||||
color: rgb(6, 150, 14);\
|
||||
}\
|
||||
.ace-chrome .ace_invalid {\
|
||||
background-color: rgb(153, 0, 0);\
|
||||
color: white;\
|
||||
}\
|
||||
.ace-chrome .ace_fold {\
|
||||
}\
|
||||
.ace-chrome .ace_support.ace_function {\
|
||||
color: rgb(60, 76, 114);\
|
||||
}\
|
||||
.ace-chrome .ace_support.ace_constant {\
|
||||
color: rgb(6, 150, 14);\
|
||||
}\
|
||||
.ace-chrome .ace_support.ace_type,\
|
||||
.ace-chrome .ace_support.ace_class\
|
||||
.ace-chrome .ace_support.ace_other {\
|
||||
color: rgb(109, 121, 222);\
|
||||
}\
|
||||
.ace-chrome .ace_variable.ace_parameter {\
|
||||
font-style:italic;\
|
||||
color:#FD971F;\
|
||||
}\
|
||||
.ace-chrome .ace_keyword.ace_operator {\
|
||||
color: rgb(104, 118, 135);\
|
||||
}\
|
||||
.ace-chrome .ace_comment {\
|
||||
color: #236e24;\
|
||||
}\
|
||||
.ace-chrome .ace_comment.ace_doc {\
|
||||
color: #236e24;\
|
||||
}\
|
||||
.ace-chrome .ace_comment.ace_doc.ace_tag {\
|
||||
color: #236e24;\
|
||||
}\
|
||||
.ace-chrome .ace_constant.ace_numeric {\
|
||||
color: rgb(0, 0, 205);\
|
||||
}\
|
||||
.ace-chrome .ace_variable {\
|
||||
color: rgb(49, 132, 149);\
|
||||
}\
|
||||
.ace-chrome .ace_xml-pe {\
|
||||
color: rgb(104, 104, 91);\
|
||||
}\
|
||||
.ace-chrome .ace_entity.ace_name.ace_function {\
|
||||
color: #0000A2;\
|
||||
}\
|
||||
.ace-chrome .ace_heading {\
|
||||
color: rgb(12, 7, 255);\
|
||||
}\
|
||||
.ace-chrome .ace_list {\
|
||||
color:rgb(185, 6, 144);\
|
||||
}\
|
||||
.ace-chrome .ace_marker-layer .ace_selection {\
|
||||
background: rgb(181, 213, 255);\
|
||||
}\
|
||||
.ace-chrome .ace_marker-layer .ace_step {\
|
||||
background: rgb(252, 255, 0);\
|
||||
}\
|
||||
.ace-chrome .ace_marker-layer .ace_stack {\
|
||||
background: rgb(164, 229, 101);\
|
||||
}\
|
||||
.ace-chrome .ace_marker-layer .ace_bracket {\
|
||||
margin: -1px 0 0 -1px;\
|
||||
border: 1px solid rgb(192, 192, 192);\
|
||||
}\
|
||||
.ace-chrome .ace_marker-layer .ace_active-line {\
|
||||
background: rgba(0, 0, 0, 0.07);\
|
||||
}\
|
||||
.ace-chrome .ace_gutter-active-line {\
|
||||
background-color : #dcdcdc;\
|
||||
}\
|
||||
.ace-chrome .ace_marker-layer .ace_selected-word {\
|
||||
background: rgb(250, 250, 255);\
|
||||
border: 1px solid rgb(200, 200, 250);\
|
||||
}\
|
||||
.ace-chrome .ace_storage,\
|
||||
.ace-chrome .ace_keyword,\
|
||||
.ace-chrome .ace_meta.ace_tag {\
|
||||
color: rgb(147, 15, 128);\
|
||||
}\
|
||||
.ace-chrome .ace_string.ace_regex {\
|
||||
color: rgb(255, 0, 0)\
|
||||
}\
|
||||
.ace-chrome .ace_string {\
|
||||
color: #1A1AA6;\
|
||||
}\
|
||||
.ace-chrome .ace_entity.ace_other.ace_attribute-name {\
|
||||
color: #994409;\
|
||||
}\
|
||||
.ace-chrome .ace_indent-guide {\
|
||||
background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
|
||||
}\
|
||||
";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
dom.importCssString(exports.cssText, exports.cssClass);
|
||||
});
|
|
@ -1,108 +0,0 @@
|
|||
define("ace/theme/tomorrow",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
|
||||
|
||||
exports.isDark = false;
|
||||
exports.cssClass = "ace-tomorrow";
|
||||
exports.cssText = ".ace-tomorrow .ace_gutter {\
|
||||
background: #f6f6f6;\
|
||||
color: #4D4D4C\
|
||||
}\
|
||||
.ace-tomorrow .ace_print-margin {\
|
||||
width: 1px;\
|
||||
background: #f6f6f6\
|
||||
}\
|
||||
.ace-tomorrow {\
|
||||
background-color: #FFFFFF;\
|
||||
color: #4D4D4C\
|
||||
}\
|
||||
.ace-tomorrow .ace_cursor {\
|
||||
color: #AEAFAD\
|
||||
}\
|
||||
.ace-tomorrow .ace_marker-layer .ace_selection {\
|
||||
background: #D6D6D6\
|
||||
}\
|
||||
.ace-tomorrow.ace_multiselect .ace_selection.ace_start {\
|
||||
box-shadow: 0 0 3px 0px #FFFFFF;\
|
||||
}\
|
||||
.ace-tomorrow .ace_marker-layer .ace_step {\
|
||||
background: rgb(255, 255, 0)\
|
||||
}\
|
||||
.ace-tomorrow .ace_marker-layer .ace_bracket {\
|
||||
margin: -1px 0 0 -1px;\
|
||||
border: 1px solid #D1D1D1\
|
||||
}\
|
||||
.ace-tomorrow .ace_marker-layer .ace_active-line {\
|
||||
background: #EFEFEF\
|
||||
}\
|
||||
.ace-tomorrow .ace_gutter-active-line {\
|
||||
background-color : #dcdcdc\
|
||||
}\
|
||||
.ace-tomorrow .ace_marker-layer .ace_selected-word {\
|
||||
border: 1px solid #D6D6D6\
|
||||
}\
|
||||
.ace-tomorrow .ace_invisible {\
|
||||
color: #D1D1D1\
|
||||
}\
|
||||
.ace-tomorrow .ace_keyword,\
|
||||
.ace-tomorrow .ace_meta,\
|
||||
.ace-tomorrow .ace_storage,\
|
||||
.ace-tomorrow .ace_storage.ace_type,\
|
||||
.ace-tomorrow .ace_support.ace_type {\
|
||||
color: #8959A8\
|
||||
}\
|
||||
.ace-tomorrow .ace_keyword.ace_operator {\
|
||||
color: #3E999F\
|
||||
}\
|
||||
.ace-tomorrow .ace_constant.ace_character,\
|
||||
.ace-tomorrow .ace_constant.ace_language,\
|
||||
.ace-tomorrow .ace_constant.ace_numeric,\
|
||||
.ace-tomorrow .ace_keyword.ace_other.ace_unit,\
|
||||
.ace-tomorrow .ace_support.ace_constant,\
|
||||
.ace-tomorrow .ace_variable.ace_parameter {\
|
||||
color: #F5871F\
|
||||
}\
|
||||
.ace-tomorrow .ace_constant.ace_other {\
|
||||
color: #666969\
|
||||
}\
|
||||
.ace-tomorrow .ace_invalid {\
|
||||
color: #FFFFFF;\
|
||||
background-color: #C82829\
|
||||
}\
|
||||
.ace-tomorrow .ace_invalid.ace_deprecated {\
|
||||
color: #FFFFFF;\
|
||||
background-color: #8959A8\
|
||||
}\
|
||||
.ace-tomorrow .ace_fold {\
|
||||
background-color: #4271AE;\
|
||||
border-color: #4D4D4C\
|
||||
}\
|
||||
.ace-tomorrow .ace_entity.ace_name.ace_function,\
|
||||
.ace-tomorrow .ace_support.ace_function,\
|
||||
.ace-tomorrow .ace_variable {\
|
||||
color: #4271AE\
|
||||
}\
|
||||
.ace-tomorrow .ace_support.ace_class,\
|
||||
.ace-tomorrow .ace_support.ace_type {\
|
||||
color: #C99E00\
|
||||
}\
|
||||
.ace-tomorrow .ace_heading,\
|
||||
.ace-tomorrow .ace_markup.ace_heading,\
|
||||
.ace-tomorrow .ace_string {\
|
||||
color: #718C00\
|
||||
}\
|
||||
.ace-tomorrow .ace_entity.ace_name.ace_tag,\
|
||||
.ace-tomorrow .ace_entity.ace_other.ace_attribute-name,\
|
||||
.ace-tomorrow .ace_meta.ace_tag,\
|
||||
.ace-tomorrow .ace_string.ace_regexp,\
|
||||
.ace-tomorrow .ace_variable {\
|
||||
color: #C82829\
|
||||
}\
|
||||
.ace-tomorrow .ace_comment {\
|
||||
color: #8E908C\
|
||||
}\
|
||||
.ace-tomorrow .ace_indent-guide {\
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bdu3f/BwAlfgctduB85QAAAABJRU5ErkJggg==) right repeat-y\
|
||||
}";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
dom.importCssString(exports.cssText, exports.cssClass);
|
||||
});
|
File diff suppressed because it is too large
Load diff
|
@ -9,11 +9,11 @@
|
|||
"128": "img/icon_128.png"
|
||||
},
|
||||
"content_scripts": [ {
|
||||
"js": [ "lib/api.js" ],
|
||||
"js": [ "js/api.js" ],
|
||||
"matches": [ "<all_urls>" ]
|
||||
}, {
|
||||
"all_frames": true,
|
||||
"js": [ "lib/run.js" ],
|
||||
"js": [ "js/run.js" ],
|
||||
"matches": [ "<all_urls>" ]
|
||||
} ],
|
||||
"browser_action": {
|
||||
|
|
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -4,6 +4,11 @@
|
|||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"ace-builds": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.2.8.tgz",
|
||||
"integrity": "sha1-Bi3EV3KwDs5qVHomajCB/ldZEQM="
|
||||
},
|
||||
"purecss": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/purecss/-/purecss-1.0.0.tgz",
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"ace-builds": "^1.2.8",
|
||||
"purecss": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"copy": "rm -rf libs && mkdir -p libs/purecss/ && cp node_modules/purecss/build/*.css libs/purecss/"
|
||||
"copy": "bash copy.sh"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
<link href="css/animate.css" rel="stylesheet">
|
||||
<link href="css/style.css" rel="stylesheet">
|
||||
|
||||
<script src="temp/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/ace/ace.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="libs/ace/ace.js" charset="utf-8"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="customjs" id="customjs">
|
||||
|
@ -54,6 +53,6 @@
|
|||
</div><!-- .error -->
|
||||
|
||||
</div>
|
||||
<script src="lib/popup.js"></script>
|
||||
<script src="js/popup.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Reference in a new issue