[All] migrate to lodash

This commit is contained in:
Maxim Kadushkin 2018-07-20 15:28:23 +03:00
parent 4b42e4f524
commit ce28412450
19 changed files with 31 additions and 31 deletions

View file

@ -90,7 +90,7 @@ define([
isSuspendEvents: false, isSuspendEvents: false,
initialize : function(options) { initialize : function(options) {
this.options = this.options ? _({}).extend(this.options, options) : options; this.options = this.options ? _.extend({}, this.options, options) : options;
}, },
setVisible: function(visible) { setVisible: function(visible) {

View file

@ -459,7 +459,7 @@ define([
tip.dontShow = true; tip.dontShow = true;
(tip.tip()).remove(); (tip.tip()).remove();
} }
}, this); });
$(this.el).html(this.template({ $(this.el).html(this.template({
groups: this.groups ? this.groups.toJSON() : null, groups: this.groups ? this.groups.toJSON() : null,
@ -477,10 +477,10 @@ define([
_.each(this.dataViewItems, function(item) { _.each(this.dataViewItems, function(item) {
this.stopListening(item); this.stopListening(item);
item.stopListening(item.model); item.stopListening(item.model);
}, this); }.bind(this));
this.dataViewItems = []; this.dataViewItems = [];
this.store.each(this.onAddItem, this); this.store.each(this.onAddItem.bind(this));
if (this.allowScrollbar) { if (this.allowScrollbar) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({

View file

@ -72,7 +72,7 @@
_.each(this.allocationMap, function(name, key) { _.each(this.allocationMap, function(name, key) {
this[name] = this[name] || {}; this[name] = this[name] || {};
}, this); }.bind(this));
}, },
/** /**
@ -140,7 +140,7 @@
this.buildCollections(); this.buildCollections();
this.controllers[ctrl] = controller; this.controllers[ctrl] = controller;
}, this); }.bind(this));
}, },
/** /**
@ -149,7 +149,7 @@
launchControllers: function() { launchControllers: function() {
_.each(this.controllers, function(ctrl, id) { _.each(this.controllers, function(ctrl, id) {
ctrl.onLaunch(this); ctrl.onLaunch(this);
}, this); }.bind(this));
}, },
/** /**
@ -267,7 +267,7 @@
buildCollections: function() { buildCollections: function() {
_.each(this.collections, function(collection, alias) { _.each(this.collections, function(collection, alias) {
this.getCollection(alias); this.getCollection(alias);
}, this); }.bind(this));
} }
}); });
@ -513,7 +513,7 @@
if(_.isArray(selectors)) { if(_.isArray(selectors)) {
_.each(selectors, function(selector) { _.each(selectors, function(selector) {
this.addListeners(selector, controller); this.addListeners(selector, controller);
}, this) }.bind(this))
} }
else if(_.isObject(selectors)) { else if(_.isObject(selectors)) {
_.each(selectors, function(listeners, selector) { _.each(selectors, function(listeners, selector) {
@ -522,8 +522,8 @@
pool[selector][event] = pool[selector][event] || []; pool[selector][event] = pool[selector][event] || [];
pool[selector][event].push(listener); pool[selector][event].push(listener);
}, this); }.bind(this));
}, this) }.bind(this))
} }
}, },
@ -547,7 +547,7 @@
} }
}, this); }.bind(this));
}, },
getApplication: function() { getApplication: function() {

View file

@ -46,7 +46,7 @@ require.config({
baseUrl: '../../', baseUrl: '../../',
paths: { paths: {
jquery : '../vendor/jquery/jquery', jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore', underscore : '../vendor/lodash/lodash',
backbone : '../vendor/backbone/backbone', backbone : '../vendor/backbone/backbone',
bootstrap : '../vendor/bootstrap/dist/js/bootstrap', bootstrap : '../vendor/bootstrap/dist/js/bootstrap',
text : '../vendor/requirejs-text/text', text : '../vendor/requirejs-text/text',

View file

@ -2057,7 +2057,7 @@ define([
var variationsArr = [], var variationsArr = [],
pluginVisible = false; pluginVisible = false;
item.variations.forEach(function(itemVar){ 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 ( visible ) pluginVisible = true;
if (item.isUICustomizer ) { if (item.isUICustomizer ) {

View file

@ -353,7 +353,7 @@ define([
checked : this.langMenu.saved == item.title, checked : this.langMenu.saved == item.title,
toggleGroup : 'language' toggleGroup : 'language'
}); });
}, this); }.bind(this));
this.langMenu.doLayout(); this.langMenu.doLayout();
if (this.langMenu.items.length>0) { if (this.langMenu.items.length>0) {

View file

@ -2049,11 +2049,11 @@ define([
} }
if (index == 21) { if (index == 21) {
this.mnuColorSchema.addItem({ me.mnuColorSchema.addItem({
caption: '--' caption: '--'
}); });
} else { } else {
this.mnuColorSchema.addItem({ me.mnuColorSchema.addItem({
template: itemTemplate, template: itemTemplate,
cls: 'color-schemas-menu', cls: 'color-schemas-menu',
colors: schemecolors, colors: schemecolors,
@ -2061,7 +2061,7 @@ define([
value: index value: index
}); });
} }
}, this); });
}, },
/** coauthoring begin **/ /** coauthoring begin **/

View file

@ -46,7 +46,7 @@ require.config({
baseUrl: '../../', baseUrl: '../../',
paths: { paths: {
jquery : '../vendor/jquery/jquery', jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore', underscore : '../vendor/lodash/lodash',
backbone : '../vendor/backbone/backbone', backbone : '../vendor/backbone/backbone',
bootstrap : '../vendor/bootstrap/dist/js/bootstrap', bootstrap : '../vendor/bootstrap/dist/js/bootstrap',
text : '../vendor/requirejs-text/text', text : '../vendor/requirejs-text/text',

View file

@ -46,7 +46,7 @@ require.config({
baseUrl: '../../', baseUrl: '../../',
paths: { paths: {
jquery : '../vendor/jquery/jquery', jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore', underscore : '../vendor/lodash/lodash',
backbone : '../vendor/backbone/backbone', backbone : '../vendor/backbone/backbone',
bootstrap : '../vendor/bootstrap/dist/js/bootstrap', bootstrap : '../vendor/bootstrap/dist/js/bootstrap',
text : '../vendor/requirejs-text/text', text : '../vendor/requirejs-text/text',

View file

@ -1814,7 +1814,7 @@ define([
var variationsArr = [], var variationsArr = [],
pluginVisible = false; pluginVisible = false;
item.variations.forEach(function(itemVar){ 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 ( visible ) pluginVisible = true;
if ( item.isUICustomizer ) { if ( item.isUICustomizer ) {

View file

@ -343,7 +343,7 @@ define([
checked : this.langMenu.saved == item.title, checked : this.langMenu.saved == item.title,
toggleGroup : 'language' toggleGroup : 'language'
}); });
}, this); }.bind(this));
this.langMenu.doLayout(); this.langMenu.doLayout();
if (this.langMenu.items.length>0) { if (this.langMenu.items.length>0) {

View file

@ -823,7 +823,7 @@ define([
opts.merge && (controls = _.union(this.lockControls, controls)); opts.merge && (controls = _.union(this.lockControls, controls));
function doLock(cmp, cause) { function doLock(cmp, cause) {
if (_.contains(cmp.options.lock, cause)) { if (_.includes(cmp.options.lock, cause)) {
var index = cmp.keepState.indexOf(cause); var index = cmp.keepState.indexOf(cause);
if (lock) { if (lock) {
if (index < 0) { if (index < 0) {

View file

@ -46,7 +46,7 @@ require.config({
baseUrl: '../../', baseUrl: '../../',
paths: { paths: {
jquery : '../vendor/jquery/jquery', jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore', underscore : '../vendor/lodash/lodash',
backbone : '../vendor/backbone/backbone', backbone : '../vendor/backbone/backbone',
bootstrap : '../vendor/bootstrap/dist/js/bootstrap', bootstrap : '../vendor/bootstrap/dist/js/bootstrap',
text : '../vendor/requirejs-text/text', text : '../vendor/requirejs-text/text',

View file

@ -46,7 +46,7 @@ require.config({
baseUrl: '../../', baseUrl: '../../',
paths: { paths: {
jquery : '../vendor/jquery/jquery', jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore', underscore : '../vendor/lodash/lodash',
xregexp : '../vendor/xregexp/xregexp-all-min', xregexp : '../vendor/xregexp/xregexp-all-min',
sockjs : '../vendor/sockjs/sockjs.min', sockjs : '../vendor/sockjs/sockjs.min',
allfonts : '../../sdkjs/common/AllFonts' allfonts : '../../sdkjs/common/AllFonts'

View file

@ -46,7 +46,7 @@ require.config({
baseUrl: '../../', baseUrl: '../../',
paths: { paths: {
jquery : '../vendor/jquery/jquery', jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore', underscore : '../vendor/lodash/lodash',
backbone : '../vendor/backbone/backbone', backbone : '../vendor/backbone/backbone',
bootstrap : '../vendor/bootstrap/dist/js/bootstrap', bootstrap : '../vendor/bootstrap/dist/js/bootstrap',
text : '../vendor/requirejs-text/text', text : '../vendor/requirejs-text/text',

View file

@ -2001,7 +2001,7 @@ define([
var variationsArr = [], var variationsArr = [],
pluginVisible = false; pluginVisible = false;
item.variations.forEach(function(itemVar){ 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 ( visible ) pluginVisible = true;
if ( item.isUICustomizer ) { if ( item.isUICustomizer ) {

View file

@ -175,7 +175,7 @@ define([
_btn.render( $('#'+item[2])) ; _btn.render( $('#'+item[2])) ;
_btn.on('click', _.bind(this.onBtnBordersClick, this)); _btn.on('click', _.bind(this.onBtnBordersClick, this));
this.lockedControls.push(_btn); this.lockedControls.push(_btn);
}, this); }.bind(this));
this.cmbBorderType = new Common.UI.ComboBorderType({ this.cmbBorderType = new Common.UI.ComboBorderType({
el: $('#cell-combo-border-type'), el: $('#cell-combo-border-type'),

View file

@ -149,7 +149,7 @@ define([
opts.merge && (controls = _.union(this.lockControls,controls)); opts.merge && (controls = _.union(this.lockControls,controls));
function doLock(cmp, cause) { function doLock(cmp, cause) {
if ( cmp && _.contains(cmp.options.lock, cause) ) { if ( cmp && _.includes(cmp.options.lock, cause) ) {
var index = cmp.keepState.indexOf(cause); var index = cmp.keepState.indexOf(cause);
if (lock) { if (lock) {
if (index < 0) { if (index < 0) {
@ -1758,7 +1758,7 @@ define([
value : index value : index
}); });
} }
}, this); }.bind(this));
}, },
onApiCollaborativeChanges: function() { onApiCollaborativeChanges: function() {

View file

@ -46,7 +46,7 @@ require.config({
baseUrl: '../../', baseUrl: '../../',
paths: { paths: {
jquery : '../vendor/jquery/jquery', jquery : '../vendor/jquery/jquery',
underscore : '../vendor/underscore/underscore', underscore : '../vendor/lodash/lodash',
backbone : '../vendor/backbone/backbone', backbone : '../vendor/backbone/backbone',
bootstrap : '../vendor/bootstrap/dist/js/bootstrap', bootstrap : '../vendor/bootstrap/dist/js/bootstrap',
text : '../vendor/requirejs-text/text', text : '../vendor/requirejs-text/text',