Merge adjacent scripts.
parent
a7bea30d83
commit
71a7c00abc
118
static/js/ace.js
118
static/js/ace.js
|
@ -196,26 +196,62 @@ function Ace2Editor()
|
|||
info.ace_replaceRange(start, end, text);
|
||||
});
|
||||
|
||||
function sortFilesByEmbeded(files) {
|
||||
var embededFiles = [];
|
||||
var remoteFiles = [];
|
||||
|
||||
// calls to these functions ($$INCLUDE_...) are replaced when this file is processed
|
||||
// and compressed, putting the compressed code from the named file directly into the
|
||||
// source here.
|
||||
var $$INCLUDE_CSS = function(fileName) {
|
||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[fileName]) {
|
||||
return '<style type="text/css">' + Ace2Editor.EMBEDED[fileName] + '<\/style>';
|
||||
if (Ace2Editor.EMBEDED) {
|
||||
for (var i = 0, ii = files.length; i < ii; i++) {
|
||||
var file = files[i];
|
||||
if (Object.prototype.hasOwnProperty.call(Ace2Editor.EMBEDED, file)) {
|
||||
embededFiles.push(file);
|
||||
} else {
|
||||
remoteFiles.push(file);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '<link rel="stylesheet" type="text/css" href="' + fileName + '"\/>';
|
||||
remoteFiles = files;
|
||||
}
|
||||
|
||||
return {embeded: embededFiles, remote: remoteFiles};
|
||||
}
|
||||
function pushScriptTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
var embededFiles = sorted.embeded;
|
||||
var remoteFiles = sorted.remote;
|
||||
|
||||
if (embededFiles.length > 0) {
|
||||
buffer.push('<script type="text/javascript">');
|
||||
for (var i = 0, ii = embededFiles.length; i < ii; i++) {
|
||||
var file = embededFiles[i];
|
||||
buffer.push(Ace2Editor.EMBEDED[file].replace(/<\//g, '<\\/'));
|
||||
buffer.push(';\n');
|
||||
}
|
||||
buffer.push('<\/script>');
|
||||
}
|
||||
for (var i = 0, ii = remoteFiles.length; i < ii; i++) {
|
||||
var file = remoteFiles[i];
|
||||
buffer.push('<script type="application/javascript" src="' + file + '"><\/script>');
|
||||
}
|
||||
}
|
||||
var $$INCLUDE_JS = function(fileName) {
|
||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[fileName]) {
|
||||
return '<script type="text/javascript">' + Ace2Editor.EMBEDED[fileName].replace(/<\//g, '<\\/') + '<\/script>';
|
||||
} else {
|
||||
return '<script type="text/javascript" src="' + fileName + '"><\/script>';
|
||||
};
|
||||
function pushStyleTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
var embededFiles = sorted.embeded;
|
||||
var remoteFiles = sorted.remote;
|
||||
|
||||
if (embededFiles.length > 0) {
|
||||
buffer.push('<style type="text/css">');
|
||||
for (var i = 0, ii = embededFiles.length; i < ii; i++) {
|
||||
var file = embededFiles[i];
|
||||
buffer.push(Ace2Editor.EMBEDED[file].replace(/<\//g, '<\\/'));
|
||||
}
|
||||
buffer.push('<\/style>');
|
||||
}
|
||||
for (var i = 0, ii = remoteFiles.length; i < ii; i++) {
|
||||
var file = remoteFiles[i];
|
||||
buffer.push('<link rel="stylesheet" type="text/css" href="' + file + '"\/>');
|
||||
}
|
||||
}
|
||||
var $$INCLUDE_JS_DEV = $$INCLUDE_JS;
|
||||
var $$INCLUDE_CSS_DEV = $$INCLUDE_CSS;
|
||||
|
||||
editor.destroy = pendingInit(function()
|
||||
{
|
||||
|
@ -257,22 +293,32 @@ function Ace2Editor()
|
|||
iframeHTML[i] = JSON.parse(iframeHTML[i]);
|
||||
}
|
||||
|
||||
// calls to these functions ($$INCLUDE_...) are replaced when this file is processed
|
||||
// and compressed, putting the compressed code from the named file directly into the
|
||||
// source here.
|
||||
// these lines must conform to a specific format because they are passed by the build script:
|
||||
iframeHTML.push($$INCLUDE_CSS("../static/css/iframe_editor.css"));
|
||||
iframeHTML.push($$INCLUDE_CSS("../static/css/pad.css"));
|
||||
iframeHTML.push($$INCLUDE_CSS("../static/custom/pad.css"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/ace2_common.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/skiplist.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/virtual_lines.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/easysync2.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/cssmanager.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/colorutils.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/undomodule.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/contentcollector.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/changesettracker.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/linestylefilter.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/domline.js"));
|
||||
iframeHTML.push($$INCLUDE_JS("../static/js/ace2_inner.js"));
|
||||
var includedCSS = [];
|
||||
var $$INCLUDE_CSS = function(filename) {includedCSS.push(filename)};
|
||||
$$INCLUDE_CSS("../static/css/iframe_editor.css");
|
||||
$$INCLUDE_CSS("../static/css/pad.css");
|
||||
$$INCLUDE_CSS("../static/custom/pad.css");
|
||||
pushStyleTagsFor(iframeHTML, includedCSS);
|
||||
|
||||
var includedJS = [];
|
||||
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)};
|
||||
$$INCLUDE_JS("../static/js/ace2_common.js");
|
||||
$$INCLUDE_JS("../static/js/skiplist.js");
|
||||
$$INCLUDE_JS("../static/js/virtual_lines.js");
|
||||
$$INCLUDE_JS("../static/js/easysync2.js");
|
||||
$$INCLUDE_JS("../static/js/cssmanager.js");
|
||||
$$INCLUDE_JS("../static/js/colorutils.js");
|
||||
$$INCLUDE_JS("../static/js/undomodule.js");
|
||||
$$INCLUDE_JS("../static/js/contentcollector.js");
|
||||
$$INCLUDE_JS("../static/js/changesettracker.js");
|
||||
$$INCLUDE_JS("../static/js/linestylefilter.js");
|
||||
$$INCLUDE_JS("../static/js/domline.js");
|
||||
$$INCLUDE_JS("../static/js/ace2_inner.js");
|
||||
pushScriptTagsFor(iframeHTML, includedJS);
|
||||
|
||||
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
||||
iframeHTML.push('</head><body id="innerdocbody" class="syntax" spellcheck="false"> </body></html>');
|
||||
|
@ -280,10 +326,18 @@ function Ace2Editor()
|
|||
var outerScript = 'editorId = "' + info.id + '"; editorInfo = parent.' + thisFunctionsName + '.registry[editorId]; ' + 'window.onload = function() ' + '{ window.onload = null; setTimeout' + '(function() ' + '{ var iframe = document.createElement("IFRAME"); ' + 'iframe.scrolling = "no"; var outerdocbody = document.getElementById("outerdocbody"); ' + 'iframe.frameBorder = 0; iframe.allowTransparency = true; ' + // for IE
|
||||
'outerdocbody.insertBefore(iframe, outerdocbody.firstChild); ' + 'iframe.ace_outerWin = window; ' + 'readyFunc = function() { editorInfo.onEditorReady(); readyFunc = null; editorInfo = null; }; ' + 'var doc = iframe.contentWindow.document; doc.open(); var text = (' + JSON.stringify(iframeHTML.join('\n')) + ');doc.write(text); doc.close(); ' + '}, 0); }';
|
||||
|
||||
var outerHTML = [doctype, '<html><head>', $$INCLUDE_CSS("../static/css/iframe_editor.css"), $$INCLUDE_CSS("../static/css/pad.css"), $$INCLUDE_CSS("../static/custom/pad.css"),
|
||||
var outerHTML = [doctype, '<html><head>']
|
||||
|
||||
var includedCSS = [];
|
||||
var $$INCLUDE_CSS = function(filename) {includedCSS.push(filename)};
|
||||
$$INCLUDE_CSS("../static/css/iframe_editor.css");
|
||||
$$INCLUDE_CSS("../static/css/pad.css");
|
||||
$$INCLUDE_CSS("../static/custom/pad.css");
|
||||
pushStyleTagsFor(outerHTML, includedCSS);
|
||||
|
||||
// bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly
|
||||
// (throbs busy while typing)
|
||||
'<link rel="stylesheet" type="text/css" href="data:text/css,"/>', '\x3cscript>\n', outerScript.replace(/<\//g, '<\\/'), '\n\x3c/script>', '</head><body id="outerdocbody"><div id="sidediv"><!-- --></div><div id="linemetricsdiv">x</div><div id="overlaysdiv"><!-- --></div></body></html>'];
|
||||
outerHTML.push('<link rel="stylesheet" type="text/css" href="data:text/css,"/>', '\x3cscript>\n', outerScript.replace(/<\//g, '<\\/'), '\n\x3c/script>', '</head><body id="outerdocbody"><div id="sidediv"><!-- --></div><div id="linemetricsdiv">x</div><div id="overlaysdiv"><!-- --></div></body></html>');
|
||||
|
||||
if (!Array.prototype.map) Array.prototype.map = function(fun)
|
||||
{ //needed for IE
|
||||
|
|
Loading…
Reference in New Issue