blob: f34fde8429bf72f1dd5befd1f594d8641a0e2d4a [file] [log] [blame]
Akron00cd4d12016-05-31 21:01:11 +02001/**
2 * Hint menu alert
3 */
4define(function () {
5 "use strict";
6 return {
7 create : function (msg) {
8 return Object.create(this)._init(msg);
9 },
10 _init : function (msg) {
Akron02360e42016-06-07 13:41:12 +020011 this._type = 'alert';
Akron00cd4d12016-05-31 21:01:11 +020012 this.active = false;
13 this._element = document.createElement('div');
14 this._element.style.opacity = 0;
15 this._element.classList.add('alert', 'hint');
16 return this;
17 },
18 show : function (msg) {
19 this._element.textContent = msg;
20 this.active = true;
21 this._element.style.opacity = 1;
22 },
23
Akron02360e42016-06-07 13:41:12 +020024 hide : function () {
Akron00cd4d12016-05-31 21:01:11 +020025 if (!this.active)
26 return false;
27 this._element.style.opacity = 0;
28 this.active = false;
29 return true;
30 },
31
32 element : function () {
33 return this._element;
34 }
35 }
36});