summaryrefslogtreecommitdiff
path: root/src/node/utils
diff options
context:
space:
mode:
authorStéphane Alnet <stephane@shimaore.net>2015-05-22 12:27:08 +0200
committerStéphane Alnet <stephane@shimaore.net>2015-05-22 12:27:08 +0200
commit0b3216ecb6def2dd052b2c5b0f1588339b389dea (patch)
tree3d4df927da755918733e2c72ccec4fba9c213d0c /src/node/utils
parent757ad765d3d7fca4e94347962423cb65b1a598d4 (diff)
downloadetherpad-lite-0b3216ecb6def2dd052b2c5b0f1588339b389dea.zip
Do not extend Array.prototype
Diffstat (limited to 'src/node/utils')
-rw-r--r--src/node/utils/toolbar.js24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/node/utils/toolbar.js b/src/node/utils/toolbar.js
index f040fb88..eaa1d421 100644
--- a/src/node/utils/toolbar.js
+++ b/src/node/utils/toolbar.js
@@ -7,7 +7,16 @@ var _ = require("underscore")
, Button
, ButtonsGroup
, Separator
- , defaultButtonAttributes;
+ , defaultButtonAttributes
+ , removeItem;
+
+removeItem = function(array,what) {
+ var ax;
+ while ((ax = array.indexOf(what)) !== -1) {
+ array.splice(ax, 1);
+ }
+ return array;
+};
defaultButtonAttributes = function (name, overrides) {
return {
@@ -244,7 +253,7 @@ module.exports = {
buttons = []
}else{
// Remove Save Revision from the right menu
- buttons[0].removeItem("savedrevision");
+ removeItem(buttons[0],"savedrevision");
}
}
@@ -254,14 +263,3 @@ module.exports = {
return groups.join(this.separator());
}
};
-
-Array.prototype.removeItem = function() {
- var what, a = arguments, L = a.length, ax;
- while (L && this.length) {
- what = a[--L];
- while ((ax = this.indexOf(what)) !== -1) {
- this.splice(ax, 1);
- }
- }
- return this;
-};