Modernize panel scripts
Change-Id: I36b37cc1816213c72ddbd9a8f8e5b163c9e2b87f
diff --git a/dev/js/src/panel/match.js b/dev/js/src/panel/match.js
index 99f7366..603a230 100644
--- a/dev/js/src/panel/match.js
+++ b/dev/js/src/panel/match.js
@@ -3,6 +3,8 @@
*
* @author Nils Diewald
*/
+"use strict";
+
define([
'panel',
'match/treeitem',
@@ -34,11 +36,11 @@
this._match = match;
- var a = this.actions;
+ const a = this.actions;
// TODO:
// Ugly hack!
- var cl= a.element().classList;
+ const cl = a.element().classList;
cl.remove('matchinfo');
cl.add('button-matchinfo');
@@ -66,7 +68,7 @@
KorAP.TreeMenu.element().setAttribute('id', 'treeMenu');
};
- var tm = KorAP.TreeMenu;
+ const tm = KorAP.TreeMenu;
// Set panel
tm.panel(this);
@@ -83,7 +85,7 @@
// If plugins are enabled, add all buttons for the match panel
if (KorAP.Plugin) {
- var matchButtons = KorAP.Plugin.buttonGroup("match");
+ const matchButtons = KorAP.Plugin.buttonGroup("match");
if (matchButtons) {
// Add all matchbuttons in order
@@ -99,10 +101,12 @@
* Add meta view to panel
*/
addMeta : function () {
- if (this._metaView && this._metaView.shown())
+ const t = this;
+ if (t._metaView && t._metaView.shown())
return;
- this._metaView = metaView.create(this._match);
- this.add(this._metaView);
+
+ t._metaView = metaView.create(t._match);
+ t.add(t._metaView);
},
@@ -110,12 +114,14 @@
* Add table view to panel
*/
addTable : function () {
- if (this._tableView && this._tableView.shown())
+ const t = this;
+ if (t._tableView && t._tableView.shown())
return;
- this._tableView = tableView.create(this._match);
- this.add(this._tableView);
+ t._tableView = tableView.create(t._match);
+ t.add(t._tableView);
},
+
/**
* Add Tree view to panel
*/
@@ -133,15 +139,12 @@
if (this._menuList)
return this._menuList;
- var match = this._match;
-
// Join spans and relations
- var treeLayers = []
- var spans = match.getSpans();
- var rels = match.getRels();
-
- spans.forEach(i => treeLayers.push(i));
- rels.forEach(i => treeLayers.push(i));
+ let treeLayers = []
+
+ const match = this._match;
+ match.getSpans().forEach(i => treeLayers.push(i));
+ match.getRels().forEach(i => treeLayers.push(i));
// Get spans
treeLayers = treeLayers.sort(
@@ -161,7 +164,7 @@
return 0;
});
- var menuList = [];
+ let menuList = [];
// Show tree views
treeLayers.forEach(