Refactoring

This commit is contained in:
Julia Radzhabova 2022-07-29 13:27:09 +03:00
parent 00b63283bd
commit f5065e33b9
2 changed files with 14 additions and 14 deletions

View file

@ -162,8 +162,8 @@ define([
this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this)); this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this));
this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this)); this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this));
this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this)); this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this));
this.api.asc_registerCallback('asc_onPluginShowButton', _.bind(this.onPluginsShowButton, this)); this.api.asc_registerCallback('asc_onPluginShowButton', _.bind(this.onPluginShowButton, this));
this.api.asc_registerCallback('asc_onPluginHideButton', _.bind(this.onPluginsHideButton, this)); this.api.asc_registerCallback('asc_onPluginHideButton', _.bind(this.onPluginHideButton, this));
this.loadPlugins(); this.loadPlugins();
} }
@ -464,12 +464,12 @@ define([
this.parsePlugins(pluginsdata) this.parsePlugins(pluginsdata)
}, },
onPluginsShowButton: function(type) { onPluginShowButton: function(id) {
this.pluginDlg && this.pluginDlg.showButton(type); this.pluginDlg && this.pluginDlg.showButton(id);
}, },
onPluginsHideButton: function(type) { onPluginHideButton: function(id) {
this.pluginDlg && this.pluginDlg.hideButton(type); this.pluginDlg && this.pluginDlg.hideButton(id);
}, },
runAutoStartPlugins: function() { runAutoStartPlugins: function() {

View file

@ -185,14 +185,14 @@ define([
} }
}, },
showButton: function(type) { showButton: function(id) {
var header = this.$window.find('.header .tools.left'); var header = this.$window.find('.header .tools.left');
if (type=='back') { if (id=='back') {
var btn = header.find('#id-plugindlg-' + type); var btn = header.find('#id-plugindlg-' + id);
if (btn.length<1) { if (btn.length<1) {
btn = $('<div id="id-plugindlg-' + type + '" class="tool help" style="font-size:20px;">←</div>'); btn = $('<div id="id-plugindlg-' + id + '" class="tool help" style="font-size:20px;">←</div>');
btn.on('click', _.bind(function() { btn.on('click', _.bind(function() {
this.fireEvent('header:click',type); this.fireEvent('header:click',id);
}, this)); }, this));
header.prepend(btn); header.prepend(btn);
} }
@ -201,10 +201,10 @@ define([
} }
}, },
hideButton: function(type) { hideButton: function(id) {
var header = this.$window.find('.header .tools.left'); var header = this.$window.find('.header .tools.left');
if (type=='back') { if (id=='back') {
var btn = header.find('#id-plugindlg-' + type); var btn = header.find('#id-plugindlg-' + id);
if (btn.length>0) { if (btn.length>0) {
btn.hide(); btn.hide();
} }