Merge "Pass a name to widgets"
diff --git a/dev/demo/plugin-server.html b/dev/demo/plugin-server.html
index c032c33..0d4a454 100644
--- a/dev/demo/plugin-server.html
+++ b/dev/demo/plugin-server.html
@@ -16,7 +16,7 @@
<ol>
<li class="active">
<div id="container"></div>
- <a onclick="KorAP.Plugin.addWidget(document.getElementById('container'), 'http://localhost:3003/demo/plugin-client.html')">Open widget</a>
+ <a onclick="KorAP.Plugin.addWidget(document.getElementById('container'), 'Example', 'http://localhost:3003/demo/plugin-client.html')">Open widget</a>
</li>
</ol>
</div>
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();
diff --git a/dev/scss/main/kwic.scss b/dev/scss/main/kwic.scss
index 6950559..58257b5 100644
--- a/dev/scss/main/kwic.scss
+++ b/dev/scss/main/kwic.scss
@@ -456,6 +456,10 @@
font-family: "FontAwesome";
content: $fa-info;
}
+ &.plugin::after {
+ font-family: "FontAwesome";
+ content: $fa-plugin;
+ }
}
}
}
diff --git a/dev/scss/util.scss b/dev/scss/util.scss
index fcc4206..16cea3e 100644
--- a/dev/scss/util.scss
+++ b/dev/scss/util.scss
@@ -249,4 +249,5 @@
// $fa-metadata: "\f067";
$fa-metadata: "\f055";
$fa-to-query: "\f102";
-$fa-cut: "\f0c4";
\ No newline at end of file
+$fa-cut: "\f0c4";
+$fa-plugin: "\f1e6";
\ No newline at end of file