Added close button to meta data
Change-Id: I5f94e275d40fe90271a7dfea25a3d81b313bb450
diff --git a/dev/js/src/match/meta.js b/dev/js/src/match/meta.js
index 33d5461..02da3dc 100644
--- a/dev/js/src/match/meta.js
+++ b/dev/js/src/match/meta.js
@@ -102,7 +102,30 @@
};
};
+ this.addButton('close', function (e) {
+ var el = this.element();
+ el.parentNode.removeChild(el);
+ e.halt();
+ });
+
return this._element;
- }
+ },
+
+ // TODO: This should be a method by all matchinfo objects
+ addButton : function (buttonType, cb) {
+ // TODO: Unless existent
+ var actions = document.createElement('ul');
+ actions.classList.add('action', 'image');
+ var button = actions.addE('li');
+ button.className = buttonType;
+ button.addE('span').addT(buttonType);
+ button.addEventListener(
+ 'click', cb.bind(this)
+ );
+
+ this.element().appendChild(actions);
+ return actions;
+ },
+
};
});