Added hint and vc to collected kalamar assets
diff --git a/public/js/src/util.js b/public/js/src/util.js
index 0f0f114..3adf5a0 100644
--- a/public/js/src/util.js
+++ b/public/js/src/util.js
@@ -31,35 +31,36 @@
(function (KorAP) {
"use strict";
+
+ /**
+ * Initialize user interface elements
+ */
KorAP.init = function () {
/**
* Add actions to match entries
*/
- var inactiveLi = document.querySelectorAll('#search > ol > li:not(.active)');
+ var inactiveLi = document.querySelectorAll(
+ '#search > ol > li:not(.active)'
+ );
var i = 0;
for (i = 0; i < inactiveLi.length; i++) {
- inactiveLi[i].addEventListener('click', function () {
-
- if (this._match !== undefined) {
+ inactiveLi[i].addEventListener('click', function (e) {
+ if (this._match !== undefined)
this._match.open();
- console.log('already open');
- }
- else {
+ else
KorAP.Match.create(this).open();
- console.log('newly open');
- }
-
-
+ e.halt();
});
};
+
/**
* Toggle the alignment (left <=> right)
*/
if (i > 0) {
var br = document.getElementById('button-right');
- if (br !== undefined) {
+ if (br !== null) {
var toggle = document.createElement('a');
toggle.setAttribute('title', 'toggle Alignment');
// Todo: Reuse old alignment from cookie!
@@ -78,57 +79,11 @@
br.appendChild(toggle);
};
};
+
+ /**
+ * Init hint helper
+ */
+ KorAP.Hint.create();
};
- /*
- function _openMatch (e) {
- e.halt();
- this.classList.add("active");
- var matchElement = this;
-
- // Todo: Add object to element
- var ul = document.createElement('ul');
- ul.classList.add('action', 'right');
- matchElement.appendChild(ul);
-
- // Todo:: Localize!
- var close = document.createElement('li');
- close.appendChild(document.createElement('span'))
- .appendChild(document.createTextNode('Close'));
- close.classList.add('close');
- close.setAttribute('title', 'Close');
-
- close.addEventListener('click', function (ie) {
- ie.halt();
- var match = matchElement['_match'];
- match.destroy();
- matchElement.classList.remove('active');
- matchElement.removeChild(ul);
- });
-
- // Todo:: Localize!
- var info = document.createElement('li');
- info.appendChild(document.createElement('span'))
- .appendChild(document.createTextNode('Info'));
- info.classList.add('info');
- info.setAttribute('title', 'Information');
-
- // Add information, unless it already exists
- info.addEventListener('click', function (ie) {
- ie.halt();
- KorAP.Match.create(matchElement).addInfo();
- });
-
- ul.appendChild(close);
- ul.appendChild(info);
- };
-*/
-
- /**
- function _closeMatch (e) {
- e.halt();
- this.parentNode.parentNode.classList.remove("active");
- };
- */
-
}(this.KorAP));