2017-04-24 18:03:30 +00:00
<!doctype html>
< html >
< head >
< meta charset = "utf-8" >
< title > Cloud9< / title >
< link rel = "shortcut icon" type = "image/x-icon" href = "favicon.ico" / >
2018-01-04 20:45:33 +00:00
< link rel = "icon" type = "image/x-icon" href = "/favicon.ico" / >
2017-04-24 18:03:30 +00:00
< / head >
< body >
< link rel = "stylesheet" type = "text/css" href = "./plugins/c9.ide.layout.classic/loading-flat.css" / >
< div id = "loadingcontainer" class = "" >
< div id = "loadingide" >
< div class = "cool-message" > Loading offline ide example< / div >
< div class = "status" style = "display:none" > < div class = "spinner" > < / div > < / div >
< div id = "content" class = "loading-progress" >
< / div >
< div class = "footer" >
< a href = "https://docs.c9.io" > Documentation< / a > |
< a href = "http://status.c9.io" > Server Status< / a > |
< a href = "http://support.c9.io" > Support< / a >
< / div >
< / div >
< / div >
< script >
var loadingIde = document.querySelector("#loadingide");
document.body.className = "loading " + loadingIde.className;
setTimeout(function(){
var s = document.querySelector("#loadingide .status");
if (s) s.style.display = "block";
}, 2000);
window.hideLoader = function(){
var loader = document.getElementById("loadingcontainer");
loader.parentNode.removeChild(loader);
document.body.className = document.body.className.replace("loading " + loadingIde.className, "");
};
< / script >
2017-05-14 11:22:31 +00:00
< script src = "./build/standalone/config/default.js" > < / script >
<!--
< script src = "/static/mini_require.js" > < / script >
< script src = "/configs/require_config.js" > < / script >
-->
2017-04-24 18:03:30 +00:00
< script >
2017-12-07 15:31:24 +00:00
function previewHelper(options, imports, register) {
var fs = imports.fs;
var tabs = imports.tabManager;
2018-01-04 20:45:33 +00:00
if (typeof BroadcastChannel !== "function")
return register();
2017-12-07 15:31:24 +00:00
var bc = new BroadcastChannel("livePreview");
bc.onmessage = function(e) {
var data = e.data;
var action = data & & data.action;
if (action == "getFile") {
var path = data.path;
var tab = tabs.findTab(path);
var value = tab & & tab.document.value;
if (value) return done(null, value);
fs.readFile(path, function(e, value) {
if (e) return done(e);
done(null, value);
});
}
function done(error, value) {
bc.postMessage({
action: "callback",
id: data.id,
value: value,
error: error & & error.code,
});
}
};
register();
}
2017-04-24 18:03:30 +00:00
function offlineConfig(plugins) {
var excludes = [
"plugins/c9.ide.immediate/evaluators/debugnode",
"plugins/c9.ide.test.mocha/mocha",
"plugins/c9.ide.find/find.nak",
"plugins/c9.ide.terminal/terminal",
"plugins/c9.ide.test/all",
"plugins/c9.ide.find/find",
"plugins/c9.ide.terminal/link_handler",
"plugins/c9.ide.test/coverage",
"plugins/c9.ide.test/results",
"plugins/c9.ide.test/testrunner",
"plugins/c9.ide.find.infiles/findinfiles",
"plugins/c9.ide.language.codeintel/codeintel",
"plugins/c9.ide.language.go/go",
"plugins/c9.ide.language.python/python",
"plugins/c9.ide.test/coverageview",
"plugins/c9.cli.bridge/bridge_commands",
2017-12-07 15:31:24 +00:00
];
2017-04-24 18:03:30 +00:00
plugins = plugins.filter(function(p) {
var packagePath = typeof p == "string" ? p : p.packagePath;
if (/\/c9.ide.run/.test(packagePath)) return false;
if (/\/c9.ide.collab/.test(packagePath)) return false;
if (/\/c9.ide.installer/.test(packagePath)) return false;
if (/\/c9.vfs.client/.test(packagePath)) return false;
2017-05-14 11:22:31 +00:00
if (/\/c9.ide.scm/.test(packagePath)) return false;
2017-04-24 18:03:30 +00:00
if (excludes.indexOf(packagePath) != -1) return false;
if (packagePath == "plugins/c9.fs/fs")
p.cli = true;
if (packagePath == "plugins/c9.core/settings")
; // place to modify settings
if (packagePath == "plugins/c9.ide.console/console")
p.defaultState = { type: "pane", nodes: [] }; // prevent console from opening terminal
return true;
});
2017-12-07 04:01:14 +00:00
plugins.push("plugins/c9.vfs.client/vfs_client_mock");
2017-05-14 11:22:31 +00:00
plugins.push({
provides: ["find", "installer"],
consumes: [],
setup: function(options, imports, register) {
function noop() {}
register(null, {
find: { on: noop, once: noop, getFileList: noop },
installer: {},
});
}
});
2017-12-07 15:31:24 +00:00
plugins.push({
provides: [],
consumes: ["fs", "tabManager"],
setup: previewHelper
});
2017-04-24 18:03:30 +00:00
return plugins;
2017-12-07 15:31:24 +00:00
}
2017-05-14 11:22:31 +00:00
var start = Date.now();
2017-12-07 04:01:14 +00:00
/*
var href = "/static";
*/
2017-05-14 11:22:31 +00:00
2017-04-24 18:03:30 +00:00
var href = location.href.split(/[#& ]/)[0].replace(/[^\/]*$/, "");
require.MODULE_LOAD_URL = href + "build/standalone/modules";
2017-05-14 11:22:31 +00:00
require.config({paths: {
configs: href + "configs",
lib: href + "build/static/lib",
}});
2017-04-24 18:03:30 +00:00
var plugins;
2017-12-07 15:31:24 +00:00
require(["lib/architect/architect", "configs/ide/default"], function(architect, defaultConfig) {
plugins = defaultConfig({
2017-04-24 18:03:30 +00:00
staticPrefix: href,
workspaceDir: "/",
workspaceId: "/",
workspaceName: "/",
home: "/",
platform: "linux",
installPath: "/",
manifest: {},
project: {},
user: {},
standalone: true,
2017-12-07 15:31:24 +00:00
previewUrl: "./offline.preview/index.html?u=",
2017-04-24 18:03:30 +00:00
dashboardUrl: "",
2018-03-25 02:56:42 +00:00
defaultTheme: "dark",
2017-05-14 11:22:31 +00:00
/*
themePrefix: "/static/standalone/skin/default",
*/
2017-04-24 18:03:30 +00:00
themePrefix: href + "build/standalone/skin/default",
CORSWorkerPrefix: href + "build/standalone/worker",
2017-05-14 11:22:31 +00:00
2017-04-24 18:03:30 +00:00
});
plugins = offlineConfig(plugins);
plugins.push({
consumes: [],
provides: ["auth.bootstrap"],
setup: function(options, imports, register) {
register(null, {
"auth.bootstrap": {
login: function(callback) { callback(); }
}
});
}
});
architect.resolveConfig(plugins, function (err, config) {
if (err) throw err;
var errored;
2017-12-07 15:31:24 +00:00
var app = architect.createApp(config, function(err, app) {
2017-04-24 18:03:30 +00:00
if (err) {
errored = true;
console.error(err.stack);
alert(err);
}
});
2017-12-07 15:31:24 +00:00
app.on("error", function(err) {
2017-04-24 18:03:30 +00:00
console.error(err.stack);
if (!errored)
alert(err);
});
app.on("service", function(name, plugin, options) {
if (!plugin.name)
plugin.name = name;
});
app.on("ready", function() {
window.app = app.services;
2017-12-07 15:31:24 +00:00
window.app.__defineGetter__("_ace", function() {
2017-04-24 18:03:30 +00:00
return this.tabManager.focussedTab.editor.ace;
});
Object.keys(window.app).forEach(function(n) {
if (/[^\w]/.test(n))
window.app[n.replace(/[^\w]/, "_") + "_"] = window.app[n];
});
done();
});
// For Development only
function done() {
var vfs = app.services.vfs;
var c9 = app.services.c9;
var settings = app.services.settings;
c9.ready();
c9.totalLoadTime = Date.now() - start;
console.warn("Total Load Time: ", Date.now() - start);
if (window.hideLoader) {
var waitVfs = function(fn) {
vfs.connected ? fn() : vfs.once("connect", fn);
};
var waitSettings = function(fn) {
settings.inited ? fn() : settings.once("read", fn);
};
2018-01-04 20:45:33 +00:00
var waitTheme = function(fn) {
var layout = app.services.layout;
if (!layout || layout.hasTheme) return fn();
layout.once("eachTheme", fn);
};
waitSettings(waitTheme.bind(null, window.hideLoader));
2017-04-24 18:03:30 +00:00
}
}
}, function loadError(mod) {
if (mod.id === "plugins/c9.ide.clipboard/html5")
return alert("Unable to load html5.js.\n\nThis may be caused by a false positive in your virus scanner. Please try reloading with ?packed=1 added to the URL.");
});
});
< / script >
< / body >
< / html >
2017-05-14 11:22:31 +00:00