From ce28412450b0e3506274bb6d959428c2abd1e181 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Fri, 20 Jul 2018 15:28:23 +0300 Subject: [PATCH] [All] migrate to lodash --- apps/common/main/lib/component/BaseView.js | 2 +- apps/common/main/lib/component/DataView.js | 6 +++--- apps/common/main/lib/core/application.js | 16 ++++++++-------- apps/documenteditor/main/app.js | 2 +- apps/documenteditor/main/app/controller/Main.js | 2 +- apps/documenteditor/main/app/view/Statusbar.js | 2 +- apps/documenteditor/main/app/view/Toolbar.js | 6 +++--- apps/documenteditor/main/app_dev.js | 2 +- apps/presentationeditor/main/app.js | 2 +- .../main/app/controller/Main.js | 2 +- .../main/app/view/Statusbar.js | 2 +- apps/presentationeditor/main/app/view/Toolbar.js | 2 +- apps/presentationeditor/main/app_dev.js | 2 +- apps/presentationeditor/main/app_dev.reporter.js | 2 +- apps/spreadsheeteditor/main/app.js | 2 +- .../main/app/controller/Main.js | 2 +- .../main/app/view/CellSettings.js | 2 +- apps/spreadsheeteditor/main/app/view/Toolbar.js | 4 ++-- apps/spreadsheeteditor/main/app_dev.js | 2 +- 19 files changed, 31 insertions(+), 31 deletions(-) diff --git a/apps/common/main/lib/component/BaseView.js b/apps/common/main/lib/component/BaseView.js index 853631472..48a1ac72b 100644 --- a/apps/common/main/lib/component/BaseView.js +++ b/apps/common/main/lib/component/BaseView.js @@ -90,7 +90,7 @@ define([ isSuspendEvents: false, initialize : function(options) { - this.options = this.options ? _({}).extend(this.options, options) : options; + this.options = this.options ? _.extend({}, this.options, options) : options; }, setVisible: function(visible) { diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 07b629f58..59b6de77b 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -459,7 +459,7 @@ define([ tip.dontShow = true; (tip.tip()).remove(); } - }, this); + }); $(this.el).html(this.template({ groups: this.groups ? this.groups.toJSON() : null, @@ -477,10 +477,10 @@ define([ _.each(this.dataViewItems, function(item) { this.stopListening(item); item.stopListening(item.model); - }, this); + }.bind(this)); this.dataViewItems = []; - this.store.each(this.onAddItem, this); + this.store.each(this.onAddItem.bind(this)); if (this.allowScrollbar) { this.scroller = new Common.UI.Scroller({ diff --git a/apps/common/main/lib/core/application.js b/apps/common/main/lib/core/application.js index 2903aaa1b..f21cfccf9 100644 --- a/apps/common/main/lib/core/application.js +++ b/apps/common/main/lib/core/application.js @@ -72,7 +72,7 @@ _.each(this.allocationMap, function(name, key) { this[name] = this[name] || {}; - }, this); + }.bind(this)); }, /** @@ -140,7 +140,7 @@ this.buildCollections(); this.controllers[ctrl] = controller; - }, this); + }.bind(this)); }, /** @@ -149,7 +149,7 @@ launchControllers: function() { _.each(this.controllers, function(ctrl, id) { ctrl.onLaunch(this); - }, this); + }.bind(this)); }, /** @@ -267,7 +267,7 @@ buildCollections: function() { _.each(this.collections, function(collection, alias) { this.getCollection(alias); - }, this); + }.bind(this)); } }); @@ -513,7 +513,7 @@ if(_.isArray(selectors)) { _.each(selectors, function(selector) { this.addListeners(selector, controller); - }, this) + }.bind(this)) } else if(_.isObject(selectors)) { _.each(selectors, function(listeners, selector) { @@ -522,8 +522,8 @@ pool[selector][event] = pool[selector][event] || []; pool[selector][event].push(listener); - }, this); - }, this) + }.bind(this)); + }.bind(this)) } }, @@ -547,7 +547,7 @@ } - }, this); + }.bind(this)); }, getApplication: function() { diff --git a/apps/documenteditor/main/app.js b/apps/documenteditor/main/app.js index a996e4714..7ffcdbb89 100644 --- a/apps/documenteditor/main/app.js +++ b/apps/documenteditor/main/app.js @@ -46,7 +46,7 @@ require.config({ baseUrl: '../../', paths: { jquery : '../vendor/jquery/jquery', - underscore : '../vendor/underscore/underscore', + underscore : '../vendor/lodash/lodash', backbone : '../vendor/backbone/backbone', bootstrap : '../vendor/bootstrap/dist/js/bootstrap', text : '../vendor/requirejs-text/text', diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 5f4075f1f..e1aa671fc 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -2057,7 +2057,7 @@ define([ var variationsArr = [], pluginVisible = false; item.variations.forEach(function(itemVar){ - var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'word'); + var visible = (isEdit || itemVar.isViewer) && _.includes(itemVar.EditorsSupport, 'word'); if ( visible ) pluginVisible = true; if (item.isUICustomizer ) { diff --git a/apps/documenteditor/main/app/view/Statusbar.js b/apps/documenteditor/main/app/view/Statusbar.js index 454cf3b99..8905afa3e 100644 --- a/apps/documenteditor/main/app/view/Statusbar.js +++ b/apps/documenteditor/main/app/view/Statusbar.js @@ -353,7 +353,7 @@ define([ checked : this.langMenu.saved == item.title, toggleGroup : 'language' }); - }, this); + }.bind(this)); this.langMenu.doLayout(); if (this.langMenu.items.length>0) { diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 4293a236c..8034a0f70 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -2049,11 +2049,11 @@ define([ } if (index == 21) { - this.mnuColorSchema.addItem({ + me.mnuColorSchema.addItem({ caption: '--' }); } else { - this.mnuColorSchema.addItem({ + me.mnuColorSchema.addItem({ template: itemTemplate, cls: 'color-schemas-menu', colors: schemecolors, @@ -2061,7 +2061,7 @@ define([ value: index }); } - }, this); + }); }, /** coauthoring begin **/ diff --git a/apps/documenteditor/main/app_dev.js b/apps/documenteditor/main/app_dev.js index 8742085c0..239ef3722 100644 --- a/apps/documenteditor/main/app_dev.js +++ b/apps/documenteditor/main/app_dev.js @@ -46,7 +46,7 @@ require.config({ baseUrl: '../../', paths: { jquery : '../vendor/jquery/jquery', - underscore : '../vendor/underscore/underscore', + underscore : '../vendor/lodash/lodash', backbone : '../vendor/backbone/backbone', bootstrap : '../vendor/bootstrap/dist/js/bootstrap', text : '../vendor/requirejs-text/text', diff --git a/apps/presentationeditor/main/app.js b/apps/presentationeditor/main/app.js index ba356b5a7..51a1f43ff 100644 --- a/apps/presentationeditor/main/app.js +++ b/apps/presentationeditor/main/app.js @@ -46,7 +46,7 @@ require.config({ baseUrl: '../../', paths: { jquery : '../vendor/jquery/jquery', - underscore : '../vendor/underscore/underscore', + underscore : '../vendor/lodash/lodash', backbone : '../vendor/backbone/backbone', bootstrap : '../vendor/bootstrap/dist/js/bootstrap', text : '../vendor/requirejs-text/text', diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 2107e270f..d2995ee82 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1814,7 +1814,7 @@ define([ var variationsArr = [], pluginVisible = false; item.variations.forEach(function(itemVar){ - var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'slide'); + var visible = (isEdit || itemVar.isViewer) && _.includes(itemVar.EditorsSupport, 'slide'); if ( visible ) pluginVisible = true; if ( item.isUICustomizer ) { diff --git a/apps/presentationeditor/main/app/view/Statusbar.js b/apps/presentationeditor/main/app/view/Statusbar.js index ddad2dda6..a6a4e731c 100644 --- a/apps/presentationeditor/main/app/view/Statusbar.js +++ b/apps/presentationeditor/main/app/view/Statusbar.js @@ -343,7 +343,7 @@ define([ checked : this.langMenu.saved == item.title, toggleGroup : 'language' }); - }, this); + }.bind(this)); this.langMenu.doLayout(); if (this.langMenu.items.length>0) { diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 49b7e3ebf..67537747f 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -823,7 +823,7 @@ define([ opts.merge && (controls = _.union(this.lockControls, controls)); function doLock(cmp, cause) { - if (_.contains(cmp.options.lock, cause)) { + if (_.includes(cmp.options.lock, cause)) { var index = cmp.keepState.indexOf(cause); if (lock) { if (index < 0) { diff --git a/apps/presentationeditor/main/app_dev.js b/apps/presentationeditor/main/app_dev.js index e7fbad44b..19a06cb32 100644 --- a/apps/presentationeditor/main/app_dev.js +++ b/apps/presentationeditor/main/app_dev.js @@ -46,7 +46,7 @@ require.config({ baseUrl: '../../', paths: { jquery : '../vendor/jquery/jquery', - underscore : '../vendor/underscore/underscore', + underscore : '../vendor/lodash/lodash', backbone : '../vendor/backbone/backbone', bootstrap : '../vendor/bootstrap/dist/js/bootstrap', text : '../vendor/requirejs-text/text', diff --git a/apps/presentationeditor/main/app_dev.reporter.js b/apps/presentationeditor/main/app_dev.reporter.js index 75d204e7a..b4b32eeb5 100644 --- a/apps/presentationeditor/main/app_dev.reporter.js +++ b/apps/presentationeditor/main/app_dev.reporter.js @@ -46,7 +46,7 @@ require.config({ baseUrl: '../../', paths: { jquery : '../vendor/jquery/jquery', - underscore : '../vendor/underscore/underscore', + underscore : '../vendor/lodash/lodash', xregexp : '../vendor/xregexp/xregexp-all-min', sockjs : '../vendor/sockjs/sockjs.min', allfonts : '../../sdkjs/common/AllFonts' diff --git a/apps/spreadsheeteditor/main/app.js b/apps/spreadsheeteditor/main/app.js index fdf262dbe..7307d8e92 100644 --- a/apps/spreadsheeteditor/main/app.js +++ b/apps/spreadsheeteditor/main/app.js @@ -46,7 +46,7 @@ require.config({ baseUrl: '../../', paths: { jquery : '../vendor/jquery/jquery', - underscore : '../vendor/underscore/underscore', + underscore : '../vendor/lodash/lodash', backbone : '../vendor/backbone/backbone', bootstrap : '../vendor/bootstrap/dist/js/bootstrap', text : '../vendor/requirejs-text/text', diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 3d5253428..734468a4d 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -2001,7 +2001,7 @@ define([ var variationsArr = [], pluginVisible = false; item.variations.forEach(function(itemVar){ - var visible = (isEdit || itemVar.isViewer) && _.contains(itemVar.EditorsSupport, 'cell'); + var visible = (isEdit || itemVar.isViewer) && _.includes(itemVar.EditorsSupport, 'cell'); if ( visible ) pluginVisible = true; if ( item.isUICustomizer ) { diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index cb10bfcbe..2fd7c29ae 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -175,7 +175,7 @@ define([ _btn.render( $('#'+item[2])) ; _btn.on('click', _.bind(this.onBtnBordersClick, this)); this.lockedControls.push(_btn); - }, this); + }.bind(this)); this.cmbBorderType = new Common.UI.ComboBorderType({ el: $('#cell-combo-border-type'), diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 1b5040f10..079bd3783 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -149,7 +149,7 @@ define([ opts.merge && (controls = _.union(this.lockControls,controls)); function doLock(cmp, cause) { - if ( cmp && _.contains(cmp.options.lock, cause) ) { + if ( cmp && _.includes(cmp.options.lock, cause) ) { var index = cmp.keepState.indexOf(cause); if (lock) { if (index < 0) { @@ -1758,7 +1758,7 @@ define([ value : index }); } - }, this); + }.bind(this)); }, onApiCollaborativeChanges: function() { diff --git a/apps/spreadsheeteditor/main/app_dev.js b/apps/spreadsheeteditor/main/app_dev.js index 51aaafc7c..6d2271cd3 100644 --- a/apps/spreadsheeteditor/main/app_dev.js +++ b/apps/spreadsheeteditor/main/app_dev.js @@ -46,7 +46,7 @@ require.config({ baseUrl: '../../', paths: { jquery : '../vendor/jquery/jquery', - underscore : '../vendor/underscore/underscore', + underscore : '../vendor/lodash/lodash', backbone : '../vendor/backbone/backbone', bootstrap : '../vendor/bootstrap/dist/js/bootstrap', text : '../vendor/requirejs-text/text',