diff options
author | Robin <robin@Amaya.(none)> | 2010-04-04 16:50:04 +0200 |
---|---|---|
committer | Robin <robin@Amaya.(none)> | 2010-04-04 16:50:04 +0200 |
commit | 7657926a602a524cf651e7e2b95a3369261fbde1 (patch) | |
tree | 1462f20e771e417a17421b1f9d2f8b36ca1742d7 /js/lib_notification.js | |
parent | e658a0025895d5aecc2c067234c5120cc21a63a2 (diff) | |
download | nextcloud-server-7657926a602a524cf651e7e2b95a3369261fbde1.tar.gz nextcloud-server-7657926a602a524cf651e7e2b95a3369261fbde1.zip |
some cleanup in ajax fronted, give error message before starting an upload that is to big
Diffstat (limited to 'js/lib_notification.js')
-rwxr-xr-x | js/lib_notification.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/js/lib_notification.js b/js/lib_notification.js new file mode 100755 index 00000000000..7c19a04b58e --- /dev/null +++ b/js/lib_notification.js @@ -0,0 +1,48 @@ +/** + * StarLight - A client side webpage framework + * + * @package StarLight + * @author Icewind <icewind (at) derideal (dot) com> + * @copyright 2009 + * @license http://www.gnu.org/licenses/gpl.html GNU Public License + * @url http://blacklight.metalwarp.com/starlight + * @version 0.1 + */ + +OCNotification=function(text,time){ + this.text=text; + this.time=(time)?time:0; + this.notify(); +} + +OCNotification.prototype={ + notify:function(){ + this.holder=document.getElementById('OCNotificationHolder'); + if (!this.holder){ + this.holder=document.createElement('div'); + this.holder.className='OCNotificationHolder'; + this.holder.setAttribute('class','OCNotificationHolder'); + this.holder.setAttribute('id','OCNotificationHolder'); + document.getElementsByTagName('body').item(0).appendChild(this.holder); + } + this.notification=document.createElement('div'); + this.notification.className='OCNotification'; + this.notification.setAttribute('class','OCNotification'); + if (document.documentElement.innerHTML){ + this.notification.innerHTML=this.text; + }else{ + var text=document.createTextNode(this.text); + this.notification.appendChild(text); + } + this.holder.insertBefore(this.notification,this.holder.firstChild); + this.notification.addEvent('onclick',new callBack(this.removeNotification,this)); + if (this.time>0){ + this.timer = new OCTimer(this.removeNotification, this.time,false,this); + } + }, + removeNotification:function(){ + if(this.notification){ + this.holder.removeChild(this.notification); + } + } +}
\ No newline at end of file |