Make annotation table and meta table visible only once
Change-Id: I6bcf44eeb95bfff85e9be992270bf6e719b51387
diff --git a/dev/js/src/match/info.js b/dev/js/src/match/info.js
index a54c8a0..a72b66f 100644
--- a/dev/js/src/match/info.js
+++ b/dev/js/src/match/info.js
@@ -38,6 +38,8 @@
*/
_init : function (match) {
this._match = match;
+ this._visibleTable = false;
+ this._visibleMeta = false;
this.opened = false;
return this;
},
@@ -271,6 +273,13 @@
// Add meta information to match
showMeta : function () {
+
+ // Already visible
+ if (this._visibleMeta)
+ return;
+
+ this._visibleMeta = true;
+
var metaTable = document.createElement('div');
metaTable.classList.add('metatable', 'loading');
this.element().appendChild(metaTable);
@@ -281,6 +290,8 @@
if (metaInfo)
metaInfo = JSON.parse(metaInfo);
+ var that = this;
+
// There is metainfo
if (metaInfo) {
@@ -294,6 +305,7 @@
// Add button
this._addButton('close', metaTable, function (e) {
this.parentNode.removeChild(this);
+ that._visibleMeta = false;
e.halt();
});
};
@@ -306,12 +318,19 @@
// Add table
showTable : function () {
+ // Already visible
+ if (this._visibleTable)
+ return;
+
+ this._visibleTable = true;
+
// Append default table
var matchtable = d.createElement('div');
matchtable.classList.add('matchtable', 'loading');
var info = this.element();
info.appendChild(matchtable);
+ var that = this;
// TODO:
// Create try-catch-exception-handling
@@ -330,6 +349,7 @@
// Add button
this._addButton('close', matchtable, function (e) {
this.parentNode.removeChild(this);
+ that._visibleTable = false;
e.halt();
});