diff --git a/plugins/cockpit/ui/requestView.js b/plugins/cockpit/ui/requestView.js
index 24458a46..8e21d3ca 100644
--- a/plugins/cockpit/ui/requestView.js
+++ b/plugins/cockpit/ui/requestView.js
@@ -37,16 +37,14 @@
define(function(require, exports, module) {
-
-var util = require('pilot/util');
-
-var requestViewCss = require("text!cockpit/ui/requestView.css");
var dom = require("pilot/dom");
-dom.importCssString(requestViewCss);
-
+var event = require("pilot/event");
var requestViewHtml = require("text!cockpit/ui/requestView.html");
var Templater = require("pilot/domtemplate").Templater;
+var requestViewCss = require("text!cockpit/ui/requestView.css");
+dom.importCssString(requestViewCss);
+
/**
* Pull the HTML into the DOM, but don't add it to the document
*/
@@ -102,24 +100,24 @@ RequestView.prototype = {
hideOutput: function(ev) {
this.output.style.display = 'none';
- util.addClass(this.hide, 'cmd_hidden');
- util.removeClass(this.show, 'cmd_hidden');
+ dom.addCssClass(this.hide, 'cmd_hidden');
+ dom.removeCssClass(this.show, 'cmd_hidden');
- ev.stopPropagation();
+ event.stopPropagation(ev);
},
showOutput: function(ev) {
this.output.style.display = 'block';
- util.removeClass(this.hide, 'cmd_hidden');
- util.addClass(this.show, 'cmd_hidden');
+ dom.removeCssClass(this.hide, 'cmd_hidden');
+ dom.addCssClass(this.show, 'cmd_hidden');
- ev.stopPropagation();
+ event.stopPropagation(ev);
},
remove: function(ev) {
this.cliView.output.removeChild(this.rowin);
this.cliView.output.removeChild(this.rowout);
- ev.stopPropagation();
+ event.stopPropagation(ev);
},
onRequestChange: function(ev) {
@@ -140,7 +138,7 @@ RequestView.prototype = {
}, this);
this.cliView.scrollOutputToBottom();
- util.setClass(this.output, 'cmd_error', this.request.error);
+ dom.setCssClass(this.output, 'cmd_error', this.request.error);
this.throb.style.display = this.request.completed ? 'none' : 'block';
}
diff --git a/plugins/pilot/dom.js b/plugins/pilot/dom.js
index 99d51636..585ec820 100644
--- a/plugins/pilot/dom.js
+++ b/plugins/pilot/dom.js
@@ -51,12 +51,30 @@ exports.hasCssClass = function(el, name) {
return classes.indexOf(name) !== -1;
};
+/**
+* Add a CSS class to the list of classes on the given node
+*/
exports.addCssClass = function(el, name) {
if (!exports.hasCssClass(el, name)) {
el.className += " " + name;
}
};
+/**
+ * Add or remove a CSS class from the list of classes on the given node
+ * depending on the value of include
+ */
+exports.setCssClass = function(node, className, include) {
+ if (include) {
+ exports.addCssClass(node, className);
+ } else {
+ exports.removeCssClass(node, className);
+ }
+};
+
+/**
+* Remove a CSS class from the list of classes on the given node
+*/
exports.removeCssClass = function(el, name) {
var classes = el.className.split(/\s+/g);
while (true) {
diff --git a/plugins/pilot/util.js b/plugins/pilot/util.js
index 9ce05809..bb1550e3 100644
--- a/plugins/pilot/util.js
+++ b/plugins/pilot/util.js
@@ -480,53 +480,6 @@ exports.formatDate = function (date) {
*/
exports.formatDate.shortMonths = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
-/**
- * Add a CSS class to the list of classes on the given node
- */
-exports.addClass = function(node, className) {
- var parts = className.split(/\s+/);
- var cls = " " + node.className + " ";
- for (var i = 0, len = parts.length, c; i < len; ++i) {
- c = parts[i];
- if (c && cls.indexOf(" " + c + " ") < 0) {
- cls += c + " ";
- }
- }
- node.className = cls.trim();
-};
-
-/**
- * Remove a CSS class from the list of classes on the given node
- */
-exports.removeClass = function(node, className) {
- var cls;
- if (className !== undefined) {
- var parts = className.split(/\s+/);
- cls = " " + node.className + " ";
- for (var i = 0, len = parts.length; i < len; ++i) {
- cls = cls.replace(" " + parts[i] + " ", " ");
- }
- cls = cls.trim();
- } else {
- cls = "";
- }
- if (node.className != cls) {
- node.className = cls;
- }
-};
-
-/**
- * Add or remove a CSS class from the list of classes on the given node
- * depending on the value of include
- */
-exports.setClass = function(node, className, include) {
- if (include) {
- exports.addClass(node, className);
- } else {
- exports.removeClass(node, className);
- }
-};
-
/**
* Is the passed object either null or undefined (using ===)
*/