Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: common/notification.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Patch Set: Created Oct. 8, 2012, 5:58 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/header.js ('k') | config.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « common/header.js ('k') | config.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld