blob: a5b43de9fded50f84275838dd3376654db9ba9cc [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) {
11 this.active = false;
12 this._element = document.createElement('div');
13 this._element.style.opacity = 0;
14 this._element.classList.add('alert', 'hint');
15 return this;
16 },
17 show : function (msg) {
18 this._element.textContent = msg;
19 this.active = true;
20 this._element.style.opacity = 1;
21 },
22
23 unshow : function () {
24 if (!this.active)
25 return false;
26 this._element.style.opacity = 0;
27 this.active = false;
28 return true;
29 },
30
31 element : function () {
32 return this._element;
33 }
34 }
35});