Pass a name to widgets
Change-Id: I1ac7096d263f860f5c5c80115bfd07f8cbe40c0f
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index b0d8f52..d4190fb 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -47,7 +47,7 @@
/**
* Open a new widget as a child to a certain element
*/
- addWidget : function (element, src) {
+ addWidget : function (element, name, src) {
// Is it the first widget?
if (!this._listener) {
@@ -72,7 +72,7 @@
var id = 'id-' + this._randomID();
// Create a new widget
- var widget = widgetClass.create(src, id);
+ var widget = widgetClass.create(name, src, id);
// Store the widget based on the identifier
widgets[id] = widget;
diff --git a/dev/js/src/plugin/widget.js b/dev/js/src/plugin/widget.js
index 1fe417a..338faa3 100644
--- a/dev/js/src/plugin/widget.js
+++ b/dev/js/src/plugin/widget.js
@@ -19,12 +19,13 @@
/**
* Create new widget
*/
- create : function (src, id) {
- return Object.create(this)._init(src, id);
+ create : function (name, src, id) {
+ return Object.create(this)._init(name, src, id);
},
// Initialize widget
- _init : function (src, id) {
+ _init : function (name, src, id) {
+ this.name = name;
this.src = src;
this.id = id;
return this;
@@ -60,6 +61,12 @@
close.classList.add('close');
close.setAttribute('title', loc.CLOSE);
+ // Add info button on plugin
+ var plugin = ul.addE('li');
+ plugin.addE('span').addT(this.name);
+ plugin.classList.add('plugin');
+ plugin.setAttribute('title', this.name);
+
// Close match
close.addEventListener('click', function (e) {
e.halt();