OLD | NEW |
(Empty) | |
| 1 var notifyParent = document.getElementById('notification'); |
| 2 notifyParent.setAttribute('onClick', 'notifyHide()'); |
| 3 |
| 4 function notify(title, text) { |
| 5 var back = document.createElement('div'); |
| 6 notifyParent.appendChild(back); |
| 7 |
| 8 var popup = document.createElement('div'); |
| 9 var titleElement = document.createElement('h2'); |
| 10 titleElement.appendChild(document.createTextNode(title)); |
| 11 popup.appendChild(titleElement); |
| 12 |
| 13 var textElement = document.createElement('p'); |
| 14 textElement.appendChild(document.createTextNode(text)); |
| 15 popup.appendChild(textElement); |
| 16 notifyParent.appendChild(popup); |
| 17 |
| 18 window.setTimeout("notifyParent.setAttribute('onClick', 'notifyHide()');
", 800); //Avoid accidentally closing the popup |
| 19 } |
| 20 function notifyHide() { |
| 21 notifyParent.setAttribute('onClick', ''); //Avoid accidentally closing t
he popup |
| 22 |
| 23 var elements = notifyParent.getElementsByTagName('div'); |
| 24 elements[0].setAttribute('style', 'animation: notify_back_animate_out 1.
2s ease-in;'); |
| 25 elements[1].setAttribute('style', 'animation: notify_popup_animate_out 1
.2s ease-in;'); |
| 26 window.setTimeout("notifyParent.innerHTML = ''", 620); |
| 27 } |
OLD | NEW |