-
Notifications
You must be signed in to change notification settings - Fork 27
/
notifications.min.js
1 lines (1 loc) · 1.19 KB
/
notifications.min.js
1
(function(){$.jGrowl.defaults.position="bottom-right";$.jGrowl.defaults.life=6000;var b=null,c={"0":function(d){$.jGrowl('New <a href="'+d.ticket_url+'" target="_blank">Ticket #'+d.ticket_number+"</a> assigned to you")},"1":function(d){$.jGrowl('<a href="'+d.ticket_url+'" target="_blank">Ticket #'+d.ticket_number+"</a> has been changed")},"2":function(d){$.jGrowl('The deadline passed for <a href="'+d.ticket_url+'" target="_blank">Ticket #'+d.ticket_number+"</a>")},"3":function(d){$("#bug-list").yiiListView.update("bug-list")},"4":function(d){$.jGrowl('New comment created on <a href="'+d.ticket_url+'" target="_blank">Ticket #'+d.ticket_number+"</a>.")}};function a(){var g="https://"+window.location.host+":"+(window.notificationsPort||"27000");var d=JSON.parse($("#user_data").text());var e=parseInt(d.user_id,10);var f=parseInt(d.project_id,10);b=io.connect(g+"/notifications",{secure:true});b.on("connect",function(){if(!isNaN(e)){b.on("setUserDataResponse",function(h){});b.emit("setUserData",{user_id:e,project_id:f})}});b.on("notification",function(h){h.forEach(function(i){if(i.message_type&&c[i.message_type]){c[i.message_type](i)}})})}$(window).load(function(){if(typeof io!="undefined"){a()}})})();