aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2015-02-02 16:39:11 +0100
committerMilo Casagrande <milo.casagrande@linaro.org>2015-02-02 16:39:11 +0100
commitc707e1308b42d5f1a5770e15fa1a50f713f465a2 (patch)
tree2fe3793ebf3fce4004b37335e7ea996475b88581
parenteee0a4807eec91f80cc7190a96184d38e5e3009a (diff)
Add new function.
Change-Id: I366db000f28a38e4725132d8ebb9d84e3b7062b8
-rw-r--r--app/dashboard/static/js/linaro-base-1.0.6.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/app/dashboard/static/js/linaro-base-1.0.6.js b/app/dashboard/static/js/linaro-base-1.0.6.js
index 6a36c30..e559d38 100644
--- a/app/dashboard/static/js/linaro-base-1.0.6.js
+++ b/app/dashboard/static/js/linaro-base-1.0.6.js
@@ -113,13 +113,13 @@ var JSBase = (function() {
.fadeIn('slow', 'linear');
}
- // Remove CSS class from the specified element.
+ // Remove CSS class from the specified DOM element ID.
// `elementID`: The ID of the element.
// `cssClass`: The CSS class to remove or an Array of classes as string.
function removeCssClassForID(elementID, cssClass) {
var realID = checkIfID(elementID);
if (cssClass.constructor === Array) {
- cssClass.forEach(function(element, index, arra) {
+ cssClass.forEach(function(element) {
$(realID).removeClass(element);
});
} else {
@@ -127,6 +127,20 @@ var JSBase = (function() {
}
}
+ // Add CSS class to the specified DOM element ID.
+ // `elementID`: The ID of the element.
+ // `cssClass`: The CSS class to add or an Array of classes as string.
+ function addCssClassForID(elementID, cssClass) {
+ var realID = checkIfID(elementID);
+ if (cssClass.constructor === Array) {
+ cssClass.forEach(function(element) {
+ $(realID).addClass(element);
+ });
+ } else {
+ $(realID).addClass(cssClass);
+ }
+ }
+
// Return an ajax promise.
// `url`: The URL for the ajax call.
// `method`: The type of ajax call, default to 'GET'.
@@ -439,14 +453,15 @@ var JSBase = (function() {
}
return {
+ addCssClassForID: addCssClassForID,
collectObjects: collectObjects,
createDeferredCall: createDeferredCall,
createLargeModalDialog: createLargeModalDialog,
init: init,
loadHTMLContent: loadHTMLContent,
populateSideBarNav: populateSideBarNav,
- removeElementByID: removeElementByID,
removeCssClassForID: removeCssClassForID,
+ removeElementByID: removeElementByID,
replaceContentByClass: replaceContentByClass,
replaceContentByID: replaceContentByID,
setErrorAlert: setErrorAlert,