blob: 768d719c93fa19cb0731c6530af46720d8159e9d [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');
Akrond30e2002016-11-07 03:19:58 +010014 this._element.style.display = 'none';
Akron00cd4d12016-05-31 21:01:11 +020015 this._element.classList.add('alert', 'hint');
16 return this;
17 },
18 show : function (msg) {
19 this._element.textContent = msg;
20 this.active = true;
Akrond30e2002016-11-07 03:19:58 +010021 this._element.style.display = 'block';
Akron00cd4d12016-05-31 21:01:11 +020022 },
23
Akron02360e42016-06-07 13:41:12 +020024 hide : function () {
Akron00cd4d12016-05-31 21:01:11 +020025 if (!this.active)
Akrond30e2002016-11-07 03:19:58 +010026 return false;
27 this._element.style.display = 'none';
Akron00cd4d12016-05-31 21:01:11 +020028 this.active = false;
29 return true;
30 },
31
32 element : function () {
33 return this._element;
34 }
35 }
36});