Attempt to fix Hint compatibility problem (WIP)
Change-Id: I3016afc2f74b90c223dd4f8f2386b71aab1eedcd
diff --git a/dev/js/src/hint/alert.js b/dev/js/src/hint/alert.js
index 768d719..c8d7696 100644
--- a/dev/js/src/hint/alert.js
+++ b/dev/js/src/hint/alert.js
@@ -1,26 +1,45 @@
/**
- * Hint menu alert
+ * Hint menu alert, positioned at the exact char.
*/
+"use strict";
+
define(function () {
- "use strict";
+
return {
+
+ /**
+ * Construct a new alert object
+ */
create : function (msg) {
return Object.create(this)._init(msg);
},
+
+ // Init
_init : function (msg) {
- this._type = 'alert';
- this.active = false;
- this._element = document.createElement('div');
- this._element.style.display = 'none';
- this._element.classList.add('alert', 'hint');
- return this;
- },
- show : function (msg) {
- this._element.textContent = msg;
- this.active = true;
- this._element.style.display = 'block';
+ const t = this;
+ t._type = 'alert';
+ t.active = false;
+ t._element = document.createElement('div');
+ t._element.style.display = 'none';
+ t._element.classList.add('alert', 'hint');
+ return t;
},
+
+ /**
+ * Show alert.
+ */
+ show : function (msg) {
+ this.active = true;
+ const e = this._element;
+ e.textContent = msg;
+ e.style.display = 'block';
+ },
+
+
+ /**
+ * Hide alert.
+ */
hide : function () {
if (!this.active)
return false;
@@ -29,6 +48,10 @@
return true;
},
+
+ /**
+ * Get alert object.
+ */
element : function () {
return this._element;
}