mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
Merge pull request #2678 from shimaore/patch-2
Do not extend Array.prototype
This commit is contained in:
commit
bfb34ff806
1 changed files with 11 additions and 13 deletions
|
@ -7,7 +7,16 @@ var _ = require("underscore")
|
||||||
, Button
|
, Button
|
||||||
, ButtonsGroup
|
, ButtonsGroup
|
||||||
, Separator
|
, 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) {
|
defaultButtonAttributes = function (name, overrides) {
|
||||||
return {
|
return {
|
||||||
|
@ -244,7 +253,7 @@ module.exports = {
|
||||||
buttons = []
|
buttons = []
|
||||||
}else{
|
}else{
|
||||||
// Remove Save Revision from the right menu
|
// 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());
|
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;
|
|
||||||
};
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue