Add new parameter to addExperiment()

pull/223/head
Lennart kats 2015-11-11 11:59:56 +00:00
rodzic 627e2dd566
commit 213b9da0e1
7 zmienionych plików z 23 dodań i 23 usunięć

Wyświetl plik

@ -106,9 +106,9 @@
"c9.ide.run.build": "#0598fff697",
"c9.ide.run.debug.xdebug": "#61dcbd0180",
"c9.ide.save": "#76cf52ab6d",
"c9.ide.scm": "#f0365ca725",
"c9.ide.scm": "#fde58fbc40",
"c9.ide.terminal.monitor": "#b76f1c9f24",
"c9.ide.test": "#4913e6a0b9",
"c9.ide.test": "#e88cc06a71",
"c9.ide.test.mocha": "#586fb0cdc2",
"c9.ide.theme.flat": "#2de8414db7",
"c9.ide.threewaymerge": "#229382aa0b",

Wyświetl plik

@ -42,7 +42,7 @@ define(function(require, exports, module) {
var plugins = [];
var ENABLED = c9.location.indexOf("debug=2") > -1;
var HASSDK = experimental.addExperiment("sdk=1", "SDK/Load Custom Plugins");;
var HASSDK = experimental.addExperiment("sdk", false, "SDK/Load Custom Plugins");;
var reParts = /^(builders|keymaps|modes|outline|runners|snippets|themes)\/(.*)/;
var reModule = /(?:_highlight_rules|_test|_worker|_fold|_behaviou?r)\.js$/;

Wyświetl plik

@ -27,7 +27,7 @@ define(function(require, exports, module) {
var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();
var HASSDK = experimental.addExperiment("sdk=1", "SDK/Load Custom Plugins");
var HASSDK = experimental.addExperiment("sdk", false, "SDK/Load Custom Plugins");
var installing;

Wyświetl plik

@ -28,8 +28,8 @@ define(function(require, exports, module) {
var plugin = new Plugin("Ajax.org", main.consumes);
// var emit = plugin.getEmitter();
var ENABLED = experimental.addExperiment("plugins=1", "SDK/Load Plugins From Workspace");
var HASSDK = experimental.addExperiment("sdk=1", "SDK/Load Custom Plugins");
var ENABLED = experimental.addExperiment("plugins", false, "SDK/Load Plugins From Workspace");
var HASSDK = experimental.addExperiment("sdk", false, "SDK/Load Custom Plugins");
var plugins = options.plugins;
var loadFromDisk = options.loadFromDisk

Wyświetl plik

@ -106,7 +106,7 @@ define(function(require, exports, module) {
// var emit = plugin.getEmitter();
var ENABLED = c9.location.indexOf("debug=2") > -1;
var MANAGER = experimental.addExperiment("plugin-manager=1", "SDK/Plugin Manager");
var MANAGER = experimental.addExperiment("plugin-manager", false, "SDK/Plugin Manager");
var model, datagrid, filterbox;
var btnUninstall, btnReport, btnReadme, btnCloud9, btnReload;

Wyświetl plik

@ -31,7 +31,7 @@ define(function(require, exports, module) {
var emit = handle.getEmitter();
emit.setMaxListeners(1000);
var HASSDK = experimental.addExperiment("sdk=1", "SDK/Load Custom Plugins");
var HASSDK = experimental.addExperiment("sdk", false, "SDK/Load Custom Plugins");
function focusOpenPackages(){
var pages = tabs.getTabs();

Wyświetl plik

@ -60,13 +60,10 @@ define(function(require, exports, module) {
// =0 means the value should be set to 0 to disable otherwise it is enabled
// =1 means the value should be set to 1 to enable otherwise it is disabled
var found = {};
function addExperiment(query, name){
var key = query.split("=");
var defValue = Number(key[1]);
key = key[0];
var uniqueId = key.replace(/\//g, "-");
function addExperiment(name, defaultValue, caption){
var uniqueId = name.replace(/\//g, "-");
var parts = name.split("/");
var parts = caption.split("/");
var current, obj = { "Experimental": current = {} };
for (var i = 0; i < parts.length; i++) {
current[parts[i]] = current = {};
@ -74,18 +71,18 @@ define(function(require, exports, module) {
current.type = "checkbox";
current.setting = "state/experiments/@" + uniqueId;
if (!found[name])
if (!found[caption])
plugin.add(obj, plugin);
found[name] = true;
found[caption] = true;
settings.setDefaults("state/experiments", [[uniqueId, !defValue]]);
settings.setDefaults("state/experiments", [[uniqueId, Number(defaultValue)]]);
// return value from url if present, otherwise return the setting
var idx = c9.location.indexOf(key + "=");
var idx = c9.location.indexOf(name + "=");
if (idx !== -1) {
if (c9.location.indexOf(key + "=0") != -1)
if (c9.location.indexOf(name + "=0") != -1)
return false;
if (c9.location.indexOf(key + "=1") != -1)
if (c9.location.indexOf(name + "=1") != -1)
return true;
}
@ -119,10 +116,13 @@ define(function(require, exports, module) {
/**
* Define a new experimental feature.
*
* @param {String} query e.g. foo=0 for a feature 'foo' that is enabled by default,
* or bar=1 for a feature 'bar' that is disabled by default
* @param {String} name The internal name of this experiment, e.g. foo
*
* @param {Boolean} defaultValue The default state of this experiment when not configure
*
* @param {String} name the name of this setting in the UI, e.g. SDK/Plugin Manager
* @param {String} caption The name of this setting in the UI, e.g. SDK/Plugin Manager
*
* @return {Boolean} true if this experiment is currently enabled
*/
addExperiment: addExperiment
});