| Index: common/notification.js |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/common/notification.js |
| @@ -0,0 +1,27 @@ |
| +var notifyParent = document.getElementById('notification'); |
| +notifyParent.setAttribute('onClick', 'notifyHide()'); |
| + |
| +function notify(title, text) { |
| + var back = document.createElement('div'); |
| + notifyParent.appendChild(back); |
| + |
| + var popup = document.createElement('div'); |
| + var titleElement = document.createElement('h2'); |
| + titleElement.appendChild(document.createTextNode(title)); |
| + popup.appendChild(titleElement); |
| + |
| + var textElement = document.createElement('p'); |
| + textElement.appendChild(document.createTextNode(text)); |
| + popup.appendChild(textElement); |
| + notifyParent.appendChild(popup); |
| + |
| + window.setTimeout("notifyParent.setAttribute('onClick', 'notifyHide()');", 800); //Avoid accidentally closing the popup |
| +} |
| +function notifyHide() { |
| + notifyParent.setAttribute('onClick', ''); //Avoid accidentally closing the popup |
| + |
| + var elements = notifyParent.getElementsByTagName('div'); |
| + elements[0].setAttribute('style', 'animation: notify_back_animate_out 1.2s ease-in;'); |
| + elements[1].setAttribute('style', 'animation: notify_popup_animate_out 1.2s ease-in;'); |
| + window.setTimeout("notifyParent.innerHTML = ''", 620); |
| +} |