diff --git a/plugins/c9.ide.language/language.js b/plugins/c9.ide.language/language.js index 9bc7d71c..72597839 100644 --- a/plugins/c9.ide.language/language.js +++ b/plugins/c9.ide.language/language.js @@ -296,7 +296,9 @@ define(function(require, exports, module) { path: "project/language/@unusedFunctionArgs", position: 9000 }, - "Ignore Messages Matching Regex": { + "Ignore Messages Matching Regex": { + title: [null, "Ignore Messages Matching ", ["a", { + href: "http://en.wikipedia.org/wiki/Regular_expression", target: "blank"}, "Regex"]], type: "textbox", path: "project/language/@ignoredMarkers", width: 300, @@ -305,7 +307,9 @@ define(function(require, exports, module) { }, "JavaScript Support": { position: 1100, - "Customize JavaScript Warnings With .eslintrc": { + "Customize JavaScript Warnings With .eslintrc": { + title: [null, "Customize JavaScript Warnings With ", ["a", { + href: "http://eslint.org/docs/user-guide/configuring", target: "blank"}, ".eslintrc"]], position: 210, type: "checkbox", path: "project/language/@eslintrc", diff --git a/plugins/c9.ide.ui/forms.js b/plugins/c9.ide.ui/forms.js index 943491c4..eed44c22 100644 --- a/plugins/c9.ide.ui/forms.js +++ b/plugins/c9.ide.ui/forms.js @@ -114,12 +114,10 @@ define(function(require, exports, module) { var heading = headings[name]; if (!heading) { if (!hack) { - var aml = container.appendChild(new apf.bar()); - aml.$int.innerHTML = '
' - + apf.escapeXML((debug - ? "\[" + (position || "") + "\] " - : "") + name) - + '
'; + var aml = container.appendChild(new ui.bar()); + ui.buildDom(["div", { class: "header" }, + ["span"], ["div", (debug ? "[" + (position || "") + "] " : "") + name] + ]); } heading = headings[name] = { @@ -160,15 +158,20 @@ define(function(require, exports, module) { if (options.setting && !options.path) options.path = options.setting; - if (debug) - name = "[" + (position || "") + "] " + name; + name = options.title || name; + var positionMark = debug ? "[" + (position || "") + "] " : ""; + if (typeof name == "string") + name = positionMark + name + ":"; + else + name = [null, positionMark, name, ":"]; var ignoreChange = false; function onAfterChange(e) { if (ignoreChange) return; - if (options.path) - settings.set(options.path, e.value); + var path = e.currentTarget && e.currentTarget.getAttribute("settingPath") || options.path; + if (path) + settings.set(path, e.value); if (options.onchange) options.onchange({ value: e.value, type: e.currentTarget.tagName }); @@ -189,7 +192,7 @@ define(function(require, exports, module) { switch (options.type) { case "checkbox": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), main = new ui.checkbox({ value: options.path ? settings.get(options.path) @@ -203,7 +206,7 @@ define(function(require, exports, module) { break; case "dropdown": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), main = new ui.dropdown({ items: options.items, width: options.width || widths.dropdown, @@ -221,7 +224,7 @@ define(function(require, exports, module) { break; case "spinner": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), main = new ui.spinner({ width: options.width || widths.spinner, value: options.path @@ -242,7 +245,7 @@ define(function(require, exports, module) { ? settings.get(options.checkboxPath) : (options.defaultCheckboxValue || ""), width: width, maxwidth: maxwidth, - label: name + ":", + label: name, skin: "checkbox_black", onafterchange: onAfterChange, settingPath: options.checkboxPath, @@ -276,7 +279,7 @@ define(function(require, exports, module) { break; case "textbox": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), main = new ui.textbox({ skin: skins.textbox || "searchbox", margin: "-3 0 0 0", @@ -293,7 +296,7 @@ define(function(require, exports, module) { break; case "password": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), main = new ui.password({ skin: skins.password || "forminput", width: options.width || widths.password, @@ -306,7 +309,7 @@ define(function(require, exports, module) { break; case "colorbox": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), main = new ui.colorbox({ width: options.width || widths.colorbox, value: options.path @@ -320,7 +323,7 @@ define(function(require, exports, module) { break; case "button": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), new ui.button({ skin: "blackbutton", height: 24, @@ -368,7 +371,7 @@ define(function(require, exports, module) { break; case "textarea": childNodes = [ - new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }), + new ui.label({ width: width, maxwidth: maxwidth, caption: name }), main = new ui.textarea({ width: options.width || widths.textarea, height: options.height || 200, @@ -387,7 +390,7 @@ define(function(require, exports, module) { edge: options.edge || edge, type: options.type, childNodes: [ - new ui.label({ height: 40, caption: name + ":" }), + new ui.label({ height: 40, caption: name }), main = new ui.textarea({ width: options.width || widths.textarea, height: options.height || 200, diff --git a/plugins/c9.ide.ui/lib_apf.js b/plugins/c9.ide.ui/lib_apf.js index 94ed7062..6d1c495e 100644 --- a/plugins/c9.ide.ui/lib_apf.js +++ b/plugins/c9.ide.ui/lib_apf.js @@ -584,7 +584,7 @@ apf.browserDetect(); apf.buildDom = function buildDom(arr, parent) { - if (typeof arr == "string") { + if (typeof arr == "string" && arr) { var txt = document.createTextNode(arr); if (parent) parent.appendChild(txt); @@ -593,20 +593,20 @@ apf.buildDom = function buildDom(arr, parent) { if (!Array.isArray(arr)) return arr; - if (typeof arr[0] == "object") { + if (typeof arr[0] != "string" || !arr[0]) { var els = []; for (var i = 0; i < arr.length; i++) { - var ch = buildDom(arr[i]); - els.push(ch); - if (parent) - parent.appendChild(ch); + var ch = buildDom(arr[i], parent); + ch && els.push(ch); } return els; } var el = document.createElement(arr[0]); var options = arr[1]; - if (options) { + var childIndex = 1; + if (options && typeof options == "object" && !Array.isArray(options)) { + childIndex = 2; Object.keys(options).forEach(function(n) { var val = options[n]; if (n == "class") { @@ -618,7 +618,7 @@ apf.buildDom = function buildDom(arr, parent) { el.setAttribute(n, val); }); } - for (var i = 2; i < arr.length; i++) + for (var i = childIndex; i < arr.length; i++) buildDom(arr[i], el); if (parent) parent.appendChild(el); @@ -13049,7 +13049,10 @@ apf.checkbox = function(struct, tagName) { this.checked = apf.isTrue(value); } - this.updateClass(); + if (this.checked) + apf.setStyleClass(this.$ext, this.$baseCSSname + "Checked"); + else + apf.setStyleClass(this.$ext, "", [this.$baseCSSname + "Checked"]); }; /** @@ -13188,15 +13191,7 @@ apf.checkbox = function(struct, tagName) { this.$notfromext = this.$input && this.$input != this.$ext; this.$setupEvents(); - this.updateClass(); }; - - this.updateClass = function() { - if (this.checked) - apf.setStyleClass(this.$ext, this.$baseCSSname + "Checked"); - else - apf.setStyleClass(this.$ext, "", [this.$baseCSSname + "Checked"]); - } this.$childProperty = "label"; diff --git a/plugins/c9.ide.ui/ui.js b/plugins/c9.ide.ui/ui.js index 97d0488c..7cf5a857 100644 --- a/plugins/c9.ide.ui/ui.js +++ b/plugins/c9.ide.ui/ui.js @@ -81,18 +81,19 @@ define(function(require, module, exports) { } } - oldHandler.call(_self, func(value)); - + if (isDynProp) { + oldHandler.call(_self, func(value)); + settings.on(value, listen); + + this.once("DOMNodeRemovedFromDocument", function() { + settings.off(value, listen); + }); + } function listen() { var v = func(value); if (_self[prop] != v) oldHandler.call(_self, v); } - settings.on(value, listen); - - this.once("DOMNodeRemovedFromDocument", function() { - settings.off(value, listen); - }); }; } wrap(apf.item.prototype, "checked", false);