diff --git a/CHANGES.md b/CHANGES.md index 81ac0da4..81e6122e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -52,6 +52,8 @@ * Change IPT urls to reduce 301 redirection * Add detection of file-system having no support for link creation (e.g. Unraid shares) * Add catch exceptions when unable to cache a requests response +* Update PNotify to latest master (2014-12-25) for desktop notifications +* Add desktop notifications [develop changelog] * Change uT params from unicode to str.format as magnet URLs worked but sending files in POST bodies failed diff --git a/gui/slick/js/ajaxNotifications.js b/gui/slick/js/ajaxNotifications.js index 92b2fc22..80937167 100644 --- a/gui/slick/js/ajaxNotifications.js +++ b/gui/slick/js/ajaxNotifications.js @@ -7,25 +7,30 @@ PNotify.prototype.options.width = '340px'; PNotify.prototype.options.shadow = false; PNotify.prototype.options.addclass = 'stack-bottomright'; PNotify.prototype.options.stack = {'dir1': 'up', 'dir2': 'left', 'firstpos1': 25, 'firstpos2': 25}; +PNotify.desktop.permission(); function check_notifications() { - if(document.visibilityState == 'visible') { - $.getJSON(message_url, function(data){ - $.each(data, function(name,data){ - new PNotify({ - type: data.type, - hide: data.type == 'notice', - title: data.title, - text: data.message, - history: false - }); - }); - }); - } - - setTimeout(check_notifications, 3000) + if(document.visibilityState == 'visible') { + $.getJSON(message_url, function(data){ + $.each(data, function(name,data){ + new PNotify({ + type: data.type, + hide: data.type == 'notice', + title: data.title, + text: data.message.replace(/<\/?i>/ig, '*'), + history: false, + desktop: { + desktop: true, + icon: '../images/ico/apple-touch-icon-180x180.png' + } + }); + }); + }); + } + + setTimeout(check_notifications, 3000) } $(document).ready(function(){ - check_notifications(); + check_notifications(); }); \ No newline at end of file diff --git a/gui/slick/js/lib/pnotify.custom.min.js b/gui/slick/js/lib/pnotify.custom.min.js index 704c85ae..0d558570 100644 --- a/gui/slick/js/lib/pnotify.custom.min.js +++ b/gui/slick/js/lib/pnotify.custom.min.js @@ -1,42 +1 @@ -/* -PNotify 2.0.1 sciactive.com/pnotify/ -(C) 2014 Hunter Perrin -license GPL/LGPL/MPL -*/ -(function(c){"function"===typeof define&&define.amd?define("pnotify",["jquery"],c):c(jQuery)})(function(c){var p={dir1:"down",dir2:"left",push:"bottom",spacing1:25,spacing2:25,context:c("body")},f,g,h=c(window),m=function(){g=c("body");PNotify.prototype.options.stack.context=g;h=c(window);h.bind("resize",function(){f&&clearTimeout(f);f=setTimeout(function(){PNotify.positionAll(!0)},10)})};PNotify=function(b){this.parseOptions(b);this.init()};c.extend(PNotify.prototype,{version:"2.0.1",options:{title:!1, -title_escape:!1,text:!1,text_escape:!1,styling:"bootstrap3",addclass:"",cornerclass:"",auto_display:!0,width:"300px",min_height:"16px",type:"notice",icon:!0,opacity:1,animation:"fade",animate_speed:"slow",position_animate_speed:500,shadow:!0,hide:!0,delay:8E3,mouse_reset:!0,remove:!0,insert_brs:!0,destroy:!0,stack:p},modules:{},runModules:function(b,a){var c,e;for(e in this.modules)if(c="object"===typeof a&&e in a?a[e]:a,"function"===typeof this.modules[e][b])this.modules[e][b](this,"object"===typeof this.options[e]? -this.options[e]:{},c)},state:"initializing",timer:null,styles:null,elem:null,container:null,title_container:null,text_container:null,animating:!1,timerHide:!1,init:function(){var b=this;this.modules={};c.extend(!0,this.modules,PNotify.prototype.modules);this.styles="object"===typeof this.options.styling?this.options.styling:PNotify.styling[this.options.styling];this.elem=c("
",{"class":"ui-pnotify "+this.options.addclass,css:{display:"none"},mouseenter:function(a){if(b.options.mouse_reset&& -"out"===b.animating){if(!b.timerHide)return;b.cancelRemove()}b.options.hide&&b.options.mouse_reset&&b.cancelRemove()},mouseleave:function(a){b.options.hide&&b.options.mouse_reset&&b.queueRemove();PNotify.positionAll()}});this.container=c("
",{"class":this.styles.container+" ui-pnotify-container "+("error"===this.options.type?this.styles.error:"info"===this.options.type?this.styles.info:"success"===this.options.type?this.styles.success:this.styles.notice)}).appendTo(this.elem);""!==this.options.cornerclass&& -this.container.removeClass("ui-corner-all").addClass(this.options.cornerclass);this.options.shadow&&this.container.addClass("ui-pnotify-shadow");!1!==this.options.icon&&c("
",{"class":"ui-pnotify-icon"}).append(c("",{"class":!0===this.options.icon?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:"success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container);this.title_container= -c("

",{"class":"ui-pnotify-title"}).appendTo(this.container);!1===this.options.title?this.title_container.hide():this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title);this.text_container=c("
",{"class":"ui-pnotify-text"}).appendTo(this.container);!1===this.options.text?this.text_container.hide():this.options.text_escape?this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g, -"
"):this.options.text);"string"===typeof this.options.width&&this.elem.css("width",this.options.width);"string"===typeof this.options.min_height&&this.container.css("min-height",this.options.min_height);PNotify.notices="top"===this.options.stack.push?c.merge([this],PNotify.notices):c.merge(PNotify.notices,[this]);"top"===this.options.stack.push&&this.queuePosition(!1,1);this.options.stack.animation=!1;this.runModules("init");this.options.auto_display&&this.open();return this},update:function(b){var a= -this.options;this.parseOptions(a,b);this.options.cornerclass!==a.cornerclass&&this.container.removeClass("ui-corner-all "+a.cornerclass).addClass(this.options.cornerclass);this.options.shadow!==a.shadow&&(this.options.shadow?this.container.addClass("ui-pnotify-shadow"):this.container.removeClass("ui-pnotify-shadow"));!1===this.options.addclass?this.elem.removeClass(a.addclass):this.options.addclass!==a.addclass&&this.elem.removeClass(a.addclass).addClass(this.options.addclass);!1===this.options.title? -this.title_container.slideUp("fast"):this.options.title!==a.title&&(this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title),!1===a.title&&this.title_container.slideDown(200));!1===this.options.text?this.text_container.slideUp("fast"):this.options.text!==a.text&&(this.options.text_escape?this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g,"
"):this.options.text), -!1===a.text&&this.text_container.slideDown(200));this.options.type!==a.type&&this.container.removeClass(this.styles.error+" "+this.styles.notice+" "+this.styles.success+" "+this.styles.info).addClass("error"===this.options.type?this.styles.error:"info"===this.options.type?this.styles.info:"success"===this.options.type?this.styles.success:this.styles.notice);if(this.options.icon!==a.icon||!0===this.options.icon&&this.options.type!==a.type)this.container.find("div.ui-pnotify-icon").remove(),!1!==this.options.icon&& -c("
",{"class":"ui-pnotify-icon"}).append(c("",{"class":!0===this.options.icon?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:"success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container);this.options.width!==a.width&&this.elem.animate({width:this.options.width});this.options.min_height!==a.min_height&&this.container.animate({minHeight:this.options.min_height});this.options.opacity!== -a.opacity&&this.elem.fadeTo(this.options.animate_speed,this.options.opacity);this.options.hide?a.hide||this.queueRemove():this.cancelRemove();this.queuePosition(!0);this.runModules("update",a);return this},open:function(){this.state="opening";this.runModules("beforeOpen");var b=this;this.elem.parent().length||this.elem.appendTo(this.options.stack.context?this.options.stack.context:g);"top"!==this.options.stack.push&&this.position(!0);"fade"===this.options.animation||"fade"===this.options.animation.effect_in? -this.elem.show().fadeTo(0,0).hide():1!==this.options.opacity&&this.elem.show().fadeTo(0,this.options.opacity).hide();this.animateIn(function(){b.queuePosition(!0);b.options.hide&&b.queueRemove();b.state="open";b.runModules("afterOpen")});return this},remove:function(b){this.state="closing";this.timerHide=!!b;this.runModules("beforeClose");var a=this;this.timer&&(window.clearTimeout(this.timer),this.timer=null);this.animateOut(function(){a.state="closed";a.runModules("afterClose");a.queuePosition(!0); -a.options.remove&&a.elem.detach();a.runModules("beforeDestroy");if(a.options.destroy&&null!==PNotify.notices){var b=c.inArray(a,PNotify.notices);-1!==b&&PNotify.notices.splice(b,1)}a.runModules("afterDestroy")});return this},get:function(){return this.elem},parseOptions:function(b,a){this.options=c.extend(!0,{},PNotify.prototype.options);this.options.stack=PNotify.prototype.options.stack;var n=[b,a],e,f;for(f in n){e=n[f];if("undefined"==typeof e)break;if("object"!==typeof e)this.options.text=e;else for(var d in e)this.modules[d]? -c.extend(!0,this.options[d],e[d]):this.options[d]=e[d]}},animateIn:function(b){this.animating="in";var a;a="undefined"!==typeof this.options.animation.effect_in?this.options.animation.effect_in:this.options.animation;"none"===a?(this.elem.show(),b()):"show"===a?this.elem.show(this.options.animate_speed,b):"fade"===a?this.elem.show().fadeTo(this.options.animate_speed,this.options.opacity,b):"slide"===a?this.elem.slideDown(this.options.animate_speed,b):"function"===typeof a?a("in",b,this.elem):this.elem.show(a, -"object"===typeof this.options.animation.options_in?this.options.animation.options_in:{},this.options.animate_speed,b);this.elem.parent().hasClass("ui-effects-wrapper")&&this.elem.parent().css({position:"fixed",overflow:"visible"});"slide"!==a&&this.elem.css("overflow","visible");this.container.css("overflow","hidden")},animateOut:function(b){this.animating="out";var a;a="undefined"!==typeof this.options.animation.effect_out?this.options.animation.effect_out:this.options.animation;"none"===a?(this.elem.hide(), -b()):"show"===a?this.elem.hide(this.options.animate_speed,b):"fade"===a?this.elem.fadeOut(this.options.animate_speed,b):"slide"===a?this.elem.slideUp(this.options.animate_speed,b):"function"===typeof a?a("out",b,this.elem):this.elem.hide(a,"object"===typeof this.options.animation.options_out?this.options.animation.options_out:{},this.options.animate_speed,b);this.elem.parent().hasClass("ui-effects-wrapper")&&this.elem.parent().css({position:"fixed",overflow:"visible"});"slide"!==a&&this.elem.css("overflow", -"visible");this.container.css("overflow","hidden")},position:function(b){var a=this.options.stack,c=this.elem;c.parent().hasClass("ui-effects-wrapper")&&(c=this.elem.css({left:"0",top:"0",right:"0",bottom:"0"}).parent());"undefined"===typeof a.context&&(a.context=g);if(a){"number"!==typeof a.nextpos1&&(a.nextpos1=a.firstpos1);"number"!==typeof a.nextpos2&&(a.nextpos2=a.firstpos2);"number"!==typeof a.addpos2&&(a.addpos2=0);var e="none"===c.css("display");if(!e||b){var f,d={},k;switch(a.dir1){case "down":k= -"top";break;case "up":k="bottom";break;case "left":k="right";break;case "right":k="left"}b=parseInt(c.css(k).replace(/(?:\..*|[^0-9.])/g,""));isNaN(b)&&(b=0);"undefined"!==typeof a.firstpos1||e||(a.firstpos1=b,a.nextpos1=a.firstpos1);var l;switch(a.dir2){case "down":l="top";break;case "up":l="bottom";break;case "left":l="right";break;case "right":l="left"}f=parseInt(c.css(l).replace(/(?:\..*|[^0-9.])/g,""));isNaN(f)&&(f=0);"undefined"!==typeof a.firstpos2||e||(a.firstpos2=f,a.nextpos2=a.firstpos2); -if("down"===a.dir1&&a.nextpos1+c.height()>(a.context.is(g)?h.height():a.context.prop("scrollHeight"))||"up"===a.dir1&&a.nextpos1+c.height()>(a.context.is(g)?h.height():a.context.prop("scrollHeight"))||"left"===a.dir1&&a.nextpos1+c.width()>(a.context.is(g)?h.width():a.context.prop("scrollWidth"))||"right"===a.dir1&&a.nextpos1+c.width()>(a.context.is(g)?h.width():a.context.prop("scrollWidth")))a.nextpos1=a.firstpos1,a.nextpos2+=a.addpos2+("undefined"===typeof a.spacing2?25:a.spacing2),a.addpos2=0;if(a.animation&& -a.nextpos2a.addpos2&&(a.addpos2=c.height());break;case "left":case "right":c.outerWidth(!0)>a.addpos2&&(a.addpos2=c.width())}if("number"===typeof a.nextpos1)if(a.animation&&(b>a.nextpos1||d.top||d.bottom||d.right|| -d.left))switch(a.dir1){case "down":d.top=a.nextpos1+"px";break;case "up":d.bottom=a.nextpos1+"px";break;case "left":d.right=a.nextpos1+"px";break;case "right":d.left=a.nextpos1+"px"}else c.css(k,a.nextpos1+"px");(d.top||d.bottom||d.right||d.left)&&c.animate(d,{duration:this.options.position_animate_speed,queue:!1});switch(a.dir1){case "down":case "up":a.nextpos1+=c.height()+("undefined"===typeof a.spacing1?25:a.spacing1);break;case "left":case "right":a.nextpos1+=c.width()+("undefined"===typeof a.spacing1? -25:a.spacing1)}}return this}},queuePosition:function(b,a){f&&clearTimeout(f);a||(a=10);f=setTimeout(function(){PNotify.positionAll(b)},a);return this},cancelRemove:function(){this.timer&&window.clearTimeout(this.timer);"closing"===this.state&&(this.elem.stop(!0),this.state="open",this.animating="in",this.elem.css("height","auto").animate({width:this.options.width,opacity:this.options.opacity},"fast"));return this},queueRemove:function(){var b=this;this.cancelRemove();this.timer=window.setTimeout(function(){b.remove(!0)}, -isNaN(this.options.delay)?0:this.options.delay);return this}});c.extend(PNotify,{notices:[],removeAll:function(){c.each(PNotify.notices,function(){this.remove&&this.remove()})},positionAll:function(b){f&&clearTimeout(f);f=null;c.each(PNotify.notices,function(){var a=this.options.stack;a&&(a.nextpos1=a.firstpos1,a.nextpos2=a.firstpos2,a.addpos2=0,a.animation=b)});c.each(PNotify.notices,function(){this.position()})},styling:{jqueryui:{container:"ui-widget ui-widget-content ui-corner-all",notice:"ui-state-highlight", -notice_icon:"ui-icon ui-icon-info",info:"",info_icon:"ui-icon ui-icon-info",success:"ui-state-default",success_icon:"ui-icon ui-icon-circle-check",error:"ui-state-error",error_icon:"ui-icon ui-icon-alert"},bootstrap2:{container:"alert",notice:"",notice_icon:"icon-exclamation-sign",info:"alert-info",info_icon:"icon-info-sign",success:"alert-success",success_icon:"icon-ok-sign",error:"alert-error",error_icon:"icon-warning-sign"},bootstrap3:{container:"alert",notice:"alert-warning",notice_icon:"glyphicon glyphicon-exclamation-sign", -info:"alert-info",info_icon:"glyphicon glyphicon-info-sign",success:"alert-success",success_icon:"glyphicon glyphicon-ok-sign",error:"alert-danger",error_icon:"glyphicon glyphicon-warning-sign"}}});PNotify.styling.fontawesome=c.extend({},PNotify.styling.bootstrap3);c.extend(PNotify.styling.fontawesome,{notice_icon:"fa fa-exclamation-circle",info_icon:"fa fa-info",success_icon:"fa fa-check",error_icon:"fa fa-warning"});document.body?m():c(m);return PNotify}); -(function(c){"function"===typeof define&&define.amd?define("pnotify.buttons",["jquery","pnotify"],c):c(jQuery,PNotify)})(function(c,e){e.prototype.options.buttons={closer:!0,closer_hover:!0,sticker:!0,sticker_hover:!0,labels:{close:"Close",stick:"Stick"}};e.prototype.modules.buttons={myOptions:null,closer:null,sticker:null,init:function(a,b){var d=this;this.myOptions=b;a.elem.on({mouseenter:function(b){!d.myOptions.sticker||a.options.nonblock&&a.options.nonblock.nonblock||d.sticker.trigger("pnotify_icon").css("visibility", -"visible");!d.myOptions.closer||a.options.nonblock&&a.options.nonblock.nonblock||d.closer.css("visibility","visible")},mouseleave:function(a){d.myOptions.sticker_hover&&d.sticker.css("visibility","hidden");d.myOptions.closer_hover&&d.closer.css("visibility","hidden")}});this.sticker=c("
",{"class":"ui-pnotify-sticker",css:{cursor:"pointer",visibility:b.sticker_hover?"hidden":"visible"},click:function(){a.options.hide=!a.options.hide;a.options.hide?a.queueRemove():a.cancelRemove();c(this).trigger("pnotify_icon")}}).bind("pnotify_icon", -function(){c(this).children().removeClass(a.styles.pin_up+" "+a.styles.pin_down).addClass(a.options.hide?a.styles.pin_up:a.styles.pin_down)}).append(c("",{"class":a.styles.pin_up,title:b.labels.stick})).prependTo(a.container);(!b.sticker||a.options.nonblock&&a.options.nonblock.nonblock)&&this.sticker.css("display","none");this.closer=c("
",{"class":"ui-pnotify-closer",css:{cursor:"pointer",visibility:b.closer_hover?"hidden":"visible"},click:function(){a.remove(!1);d.sticker.css("visibility", -"hidden");d.closer.css("visibility","hidden")}}).append(c("",{"class":a.styles.closer,title:b.labels.close})).prependTo(a.container);(!b.closer||a.options.nonblock&&a.options.nonblock.nonblock)&&this.closer.css("display","none")},update:function(a,b){this.myOptions=b;!b.closer||a.options.nonblock&&a.options.nonblock.nonblock?this.closer.css("display","none"):b.closer&&this.closer.css("display","block");!b.sticker||a.options.nonblock&&a.options.nonblock.nonblock?this.sticker.css("display", -"none"):b.sticker&&this.sticker.css("display","block");this.sticker.trigger("pnotify_icon");b.sticker_hover?this.sticker.css("visibility","hidden"):a.options.nonblock&&a.options.nonblock.nonblock||this.sticker.css("visibility","visible");b.closer_hover?this.closer.css("visibility","hidden"):a.options.nonblock&&a.options.nonblock.nonblock||this.closer.css("visibility","visible")}};c.extend(e.styling.jqueryui,{closer:"ui-icon ui-icon-close",pin_up:"ui-icon ui-icon-pin-w",pin_down:"ui-icon ui-icon-pin-s"}); -c.extend(e.styling.bootstrap2,{closer:"icon-remove",pin_up:"icon-pause",pin_down:"icon-play"});c.extend(e.styling.bootstrap3,{closer:"glyphicon glyphicon-remove",pin_up:"glyphicon glyphicon-pause",pin_down:"glyphicon glyphicon-play"});c.extend(e.styling.fontawesome,{closer:"fa fa-times",pin_up:"fa fa-pause",pin_down:"fa fa-play"})}); -(function(e){"function"===typeof define&&define.amd?define("pnotify.desktop",["jquery","pnotify"],e):e(jQuery,PNotify)})(function(e,d){var c,f=function(a,b){f="Notification"in window?function(a,b){return new Notification(a,b)}:"mozNotification"in navigator?function(a,b){return navigator.mozNotification.createNotification(a,b.body,b.icon).show()}:"webkitNotifications"in window?function(a,b){return window.webkitNotifications.createNotification(b.icon,a,b.body)}:function(a,b){return null};return f(a, -b)};d.prototype.options.desktop={desktop:!1,icon:null,tag:null};d.prototype.modules.desktop={tag:null,icon:null,genNotice:function(a,b){this.icon=null===b.icon?"http://sciactive.com/pnotify/includes/desktop/"+a.options.type+".png":!1===b.icon?null:b.icon;if(null===this.tag||null!==b.tag)this.tag=null===b.tag?"PNotify-"+Math.round(1E6*Math.random()):b.tag;a.desktop=f(a.options.title,{icon:this.icon,body:a.options.text,tag:this.tag});"close"in a.desktop||(a.desktop.close=function(){a.desktop.cancel()}); -a.desktop.onclick=function(){a.elem.trigger("click")};a.desktop.onclose=function(){"closing"!==a.state&&"closed"!==a.state&&a.remove()}},init:function(a,b){b.desktop&&(c=d.desktop.checkPermission(),0==c&&this.genNotice(a,b))},update:function(a,b,d){0==c&&b.desktop&&this.genNotice(a,b)},beforeOpen:function(a,b){0==c&&b.desktop&&a.elem.css({left:"-10000px",display:"none"})},afterOpen:function(a,b){0==c&&b.desktop&&(a.elem.css({left:"-10000px",display:"none"}),"show"in a.desktop&&a.desktop.show())}, -beforeClose:function(a,b){0==c&&b.desktop&&a.elem.css({left:"-10000px",display:"none"})},afterClose:function(a,b){0==c&&b.desktop&&(a.elem.css({left:"-10000px",display:"none"}),a.desktop.close())}};d.desktop={permission:function(){"undefined"!==typeof Notification&&"requestPermission"in Notification?Notification.requestPermission():"webkitNotifications"in window&&window.webkitNotifications.requestPermission()},checkPermission:function(){return"undefined"!==typeof Notification&&"permission"in Notification? -"granted"==Notification.permission?0:1:"webkitNotifications"in window?window.webkitNotifications.checkPermission():1}};c=d.desktop.checkPermission()}); +!function(t){"function"==typeof define&&define.amd?define("pnotify",["jquery"],t):t(jQuery)}(function(t){var i,o,s={dir1:"down",dir2:"left",push:"bottom",spacing1:25,spacing2:25,context:t("body")},e=t(window),n=function(){o=t("body"),PNotify.prototype.options.stack.context=o,e=t(window),e.bind("resize",function(){i&&clearTimeout(i),i=setTimeout(function(){PNotify.positionAll(!0)},10)})};return PNotify=function(t){this.parseOptions(t),this.init()},t.extend(PNotify.prototype,{version:"2.0.1",options:{title:!1,title_escape:!1,text:!1,text_escape:!1,styling:"bootstrap3",addclass:"",cornerclass:"",auto_display:!0,width:"300px",min_height:"16px",type:"notice",icon:!0,opacity:1,animation:"fade",animate_speed:"slow",position_animate_speed:500,shadow:!0,hide:!0,delay:8e3,mouse_reset:!0,remove:!0,insert_brs:!0,destroy:!0,stack:s},modules:{},runModules:function(t,i){var o;for(var s in this.modules)o="object"==typeof i&&s in i?i[s]:i,"function"==typeof this.modules[s][t]&&this.modules[s][t](this,"object"==typeof this.options[s]?this.options[s]:{},o)},state:"initializing",timer:null,styles:null,elem:null,container:null,title_container:null,text_container:null,animating:!1,timerHide:!1,init:function(){var i=this;return this.modules={},t.extend(!0,this.modules,PNotify.prototype.modules),this.styles="object"==typeof this.options.styling?this.options.styling:PNotify.styling[this.options.styling],this.elem=t("
",{"class":"ui-pnotify "+this.options.addclass,css:{display:"none"},mouseenter:function(){if(i.options.mouse_reset&&"out"===i.animating){if(!i.timerHide)return;i.cancelRemove()}i.options.hide&&i.options.mouse_reset&&i.cancelRemove()},mouseleave:function(){i.options.hide&&i.options.mouse_reset&&"out"!==i.animating&&i.queueRemove(),PNotify.positionAll()}}),this.container=t("
",{"class":this.styles.container+" ui-pnotify-container "+("error"===this.options.type?this.styles.error:"info"===this.options.type?this.styles.info:"success"===this.options.type?this.styles.success:this.styles.notice)}).appendTo(this.elem),""!==this.options.cornerclass&&this.container.removeClass("ui-corner-all").addClass(this.options.cornerclass),this.options.shadow&&this.container.addClass("ui-pnotify-shadow"),this.options.icon!==!1&&t("
",{"class":"ui-pnotify-icon"}).append(t("",{"class":this.options.icon===!0?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:"success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container),this.title_container=t("

",{"class":"ui-pnotify-title"}).appendTo(this.container),this.options.title===!1?this.title_container.hide():this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title),this.text_container=t("
",{"class":"ui-pnotify-text"}).appendTo(this.container),this.options.text===!1?this.text_container.hide():this.options.text_escape?this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g,"
"):this.options.text),"string"==typeof this.options.width&&this.elem.css("width",this.options.width),"string"==typeof this.options.min_height&&this.container.css("min-height",this.options.min_height),PNotify.notices="top"===this.options.stack.push?t.merge([this],PNotify.notices):t.merge(PNotify.notices,[this]),"top"===this.options.stack.push&&this.queuePosition(!1,1),this.options.stack.animation=!1,this.runModules("init"),this.options.auto_display&&this.open(),this},update:function(i){var o=this.options;return this.parseOptions(o,i),this.options.cornerclass!==o.cornerclass&&this.container.removeClass("ui-corner-all "+o.cornerclass).addClass(this.options.cornerclass),this.options.shadow!==o.shadow&&(this.options.shadow?this.container.addClass("ui-pnotify-shadow"):this.container.removeClass("ui-pnotify-shadow")),this.options.addclass===!1?this.elem.removeClass(o.addclass):this.options.addclass!==o.addclass&&this.elem.removeClass(o.addclass).addClass(this.options.addclass),this.options.title===!1?this.title_container.slideUp("fast"):this.options.title!==o.title&&(this.options.title_escape?this.title_container.text(this.options.title):this.title_container.html(this.options.title),o.title===!1&&this.title_container.slideDown(200)),this.options.text===!1?this.text_container.slideUp("fast"):this.options.text!==o.text&&(this.options.text_escape?this.text_container.text(this.options.text):this.text_container.html(this.options.insert_brs?String(this.options.text).replace(/\n/g,"
"):this.options.text),o.text===!1&&this.text_container.slideDown(200)),this.options.type!==o.type&&this.container.removeClass(this.styles.error+" "+this.styles.notice+" "+this.styles.success+" "+this.styles.info).addClass("error"===this.options.type?this.styles.error:"info"===this.options.type?this.styles.info:"success"===this.options.type?this.styles.success:this.styles.notice),(this.options.icon!==o.icon||this.options.icon===!0&&this.options.type!==o.type)&&(this.container.find("div.ui-pnotify-icon").remove(),this.options.icon!==!1&&t("
",{"class":"ui-pnotify-icon"}).append(t("",{"class":this.options.icon===!0?"error"===this.options.type?this.styles.error_icon:"info"===this.options.type?this.styles.info_icon:"success"===this.options.type?this.styles.success_icon:this.styles.notice_icon:this.options.icon})).prependTo(this.container)),this.options.width!==o.width&&this.elem.animate({width:this.options.width}),this.options.min_height!==o.min_height&&this.container.animate({minHeight:this.options.min_height}),this.options.opacity!==o.opacity&&this.elem.fadeTo(this.options.animate_speed,this.options.opacity),this.options.hide?o.hide||this.queueRemove():this.cancelRemove(),this.queuePosition(!0),this.runModules("update",o),this},open:function(){this.state="opening",this.runModules("beforeOpen");var t=this;return this.elem.parent().length||this.elem.appendTo(this.options.stack.context?this.options.stack.context:o),"top"!==this.options.stack.push&&this.position(!0),"fade"===this.options.animation||"fade"===this.options.animation.effect_in?this.elem.show().fadeTo(0,0).hide():1!==this.options.opacity&&this.elem.show().fadeTo(0,this.options.opacity).hide(),this.animateIn(function(){t.queuePosition(!0),t.options.hide&&t.queueRemove(),t.state="open",t.runModules("afterOpen")}),this},remove:function(i){this.state="closing",this.timerHide=!!i,this.runModules("beforeClose");var o=this;return this.timer&&(window.clearTimeout(this.timer),this.timer=null),this.animateOut(function(){if(o.state="closed",o.runModules("afterClose"),o.queuePosition(!0),o.options.remove&&o.elem.detach(),o.runModules("beforeDestroy"),o.options.destroy&&null!==PNotify.notices){var i=t.inArray(o,PNotify.notices);-1!==i&&PNotify.notices.splice(i,1)}o.runModules("afterDestroy")}),this},get:function(){return this.elem},parseOptions:function(i,o){this.options=t.extend(!0,{},PNotify.prototype.options),this.options.stack=PNotify.prototype.options.stack;for(var s,e=[i,o],n=0;n(i.context.is(o)?e.height():i.context.prop("scrollHeight"))||"up"===i.dir1&&i.nextpos1+s.height()>(i.context.is(o)?e.height():i.context.prop("scrollHeight"))||"left"===i.dir1&&i.nextpos1+s.width()>(i.context.is(o)?e.width():i.context.prop("scrollWidth"))||"right"===i.dir1&&i.nextpos1+s.width()>(i.context.is(o)?e.width():i.context.prop("scrollWidth")))&&(i.nextpos1=i.firstpos1,i.nextpos2+=i.addpos2+("undefined"==typeof i.spacing2?25:i.spacing2),i.addpos2=0),i.animation&&i.nextpos2i.addpos2&&(i.addpos2=s.height());break;case"left":case"right":s.outerWidth(!0)>i.addpos2&&(i.addpos2=s.width())}if("number"==typeof i.nextpos1)if(i.animation&&(c>i.nextpos1||r.top||r.bottom||r.right||r.left))switch(i.dir1){case"down":r.top=i.nextpos1+"px";break;case"up":r.bottom=i.nextpos1+"px";break;case"left":r.right=i.nextpos1+"px";break;case"right":r.left=i.nextpos1+"px"}else s.css(a,i.nextpos1+"px");switch((r.top||r.bottom||r.right||r.left)&&s.animate(r,{duration:this.options.position_animate_speed,queue:!1}),i.dir1){case"down":case"up":i.nextpos1+=s.height()+("undefined"==typeof i.spacing1?25:i.spacing1);break;case"left":case"right":i.nextpos1+=s.width()+("undefined"==typeof i.spacing1?25:i.spacing1)}}return this}},queuePosition:function(t,o){return i&&clearTimeout(i),o||(o=10),i=setTimeout(function(){PNotify.positionAll(t)},o),this},cancelRemove:function(){return this.timer&&window.clearTimeout(this.timer),"closing"===this.state&&(this.elem.stop(!0),this.state="open",this.animating="in",this.elem.css("height","auto").animate({width:this.options.width,opacity:this.options.opacity},"fast")),this},queueRemove:function(){var t=this;return this.cancelRemove(),this.timer=window.setTimeout(function(){t.remove(!0)},isNaN(this.options.delay)?0:this.options.delay),this}}),t.extend(PNotify,{notices:[],removeAll:function(){t.each(PNotify.notices,function(){this.remove&&this.remove(!1)})},positionAll:function(o){if(i&&clearTimeout(i),i=null,PNotify.notices&&PNotify.notices.length)t.each(PNotify.notices,function(){var t=this.options.stack;t&&(t.nextpos1=t.firstpos1,t.nextpos2=t.firstpos2,t.addpos2=0,t.animation=o)}),t.each(PNotify.notices,function(){this.position()});else{var s=PNotify.prototype.options.stack;s&&(delete s.nextpos1,delete s.nextpos2)}},styling:{jqueryui:{container:"ui-widget ui-widget-content ui-corner-all",notice:"ui-state-highlight",notice_icon:"ui-icon ui-icon-info",info:"",info_icon:"ui-icon ui-icon-info",success:"ui-state-default",success_icon:"ui-icon ui-icon-circle-check",error:"ui-state-error",error_icon:"ui-icon ui-icon-alert"},bootstrap2:{container:"alert",notice:"",notice_icon:"icon-exclamation-sign",info:"alert-info",info_icon:"icon-info-sign",success:"alert-success",success_icon:"icon-ok-sign",error:"alert-error",error_icon:"icon-warning-sign"},bootstrap3:{container:"alert",notice:"alert-warning",notice_icon:"glyphicon glyphicon-exclamation-sign",info:"alert-info",info_icon:"glyphicon glyphicon-info-sign",success:"alert-success",success_icon:"glyphicon glyphicon-ok-sign",error:"alert-danger",error_icon:"glyphicon glyphicon-warning-sign"}}}),PNotify.styling.fontawesome=t.extend({},PNotify.styling.bootstrap3),t.extend(PNotify.styling.fontawesome,{notice_icon:"fa fa-exclamation-circle",info_icon:"fa fa-info",success_icon:"fa fa-check",error_icon:"fa fa-warning"}),document.body?n():t(n),PNotify}),function(t){"function"==typeof define&&define.amd?define("pnotify.desktop",["jquery","pnotify"],t):t(jQuery,PNotify)}(function(t,i){var o,s=function(t,i){return(s="Notification"in window?function(t,i){return new Notification(t,i)}:"mozNotification"in navigator?function(t,i){return navigator.mozNotification.createNotification(t,i.body,i.icon).show()}:"webkitNotifications"in window?function(t,i){return window.webkitNotifications.createNotification(i.icon,t,i.body)}:function(){return null})(t,i)};i.prototype.options.desktop={desktop:!1,icon:null,tag:null},i.prototype.modules.desktop={tag:null,icon:null,genNotice:function(t,i){this.icon=null===i.icon?"http://sciactive.com/pnotify/includes/desktop/"+t.options.type+".png":i.icon===!1?null:i.icon,(null===this.tag||null!==i.tag)&&(this.tag=null===i.tag?"PNotify-"+Math.round(1e6*Math.random()):i.tag),t.desktop=s(t.options.title,{icon:this.icon,body:t.options.text,tag:this.tag}),"close"in t.desktop||(t.desktop.close=function(){t.desktop.cancel()}),t.desktop.onclick=function(){t.elem.trigger("click")},t.desktop.onclose=function(){"closing"!==t.state&&"closed"!==t.state&&t.remove()}},init:function(t,s){s.desktop&&(o=i.desktop.checkPermission(),0==o&&this.genNotice(t,s))},update:function(t,i){0==o&&i.desktop&&this.genNotice(t,i)},beforeOpen:function(t,i){0==o&&i.desktop&&t.elem.css({left:"-10000px",display:"none"})},afterOpen:function(t,i){0==o&&i.desktop&&(t.elem.css({left:"-10000px",display:"none"}),"show"in t.desktop&&t.desktop.show())},beforeClose:function(t,i){0==o&&i.desktop&&t.elem.css({left:"-10000px",display:"none"})},afterClose:function(t,i){0==o&&i.desktop&&(t.elem.css({left:"-10000px",display:"none"}),t.desktop.close())}},i.desktop={permission:function(){"undefined"!=typeof Notification&&"requestPermission"in Notification?Notification.requestPermission():"webkitNotifications"in window&&window.webkitNotifications.requestPermission()},checkPermission:function(){return"undefined"!=typeof Notification&&"permission"in Notification?"granted"==Notification.permission?0:1:"webkitNotifications"in window?window.webkitNotifications.checkPermission():1}},o=i.desktop.checkPermission()}),function(t){"function"==typeof define&&define.amd?define("pnotify.buttons",["jquery","pnotify"],t):t(jQuery,PNotify)}(function(t,i){i.prototype.options.buttons={closer:!0,closer_hover:!0,sticker:!0,sticker_hover:!0,labels:{close:"Close",stick:"Stick"}},i.prototype.modules.buttons={myOptions:null,closer:null,sticker:null,init:function(i,o){var s=this;this.myOptions=o,i.elem.on({mouseenter:function(){!s.myOptions.sticker||i.options.nonblock&&i.options.nonblock.nonblock||s.sticker.trigger("pnotify_icon").css("visibility","visible"),!s.myOptions.closer||i.options.nonblock&&i.options.nonblock.nonblock||s.closer.css("visibility","visible")},mouseleave:function(){s.myOptions.sticker_hover&&s.sticker.css("visibility","hidden"),s.myOptions.closer_hover&&s.closer.css("visibility","hidden")}}),this.sticker=t("
",{"class":"ui-pnotify-sticker",css:{cursor:"pointer",visibility:o.sticker_hover?"hidden":"visible"},click:function(){i.options.hide=!i.options.hide,i.options.hide?i.queueRemove():i.cancelRemove(),t(this).trigger("pnotify_icon")}}).bind("pnotify_icon",function(){t(this).children().removeClass(i.styles.pin_up+" "+i.styles.pin_down).addClass(i.options.hide?i.styles.pin_up:i.styles.pin_down)}).append(t("",{"class":i.styles.pin_up,title:o.labels.stick})).prependTo(i.container),(!o.sticker||i.options.nonblock&&i.options.nonblock.nonblock)&&this.sticker.css("display","none"),this.closer=t("
",{"class":"ui-pnotify-closer",css:{cursor:"pointer",visibility:o.closer_hover?"hidden":"visible"},click:function(){i.remove(!1),s.sticker.css("visibility","hidden"),s.closer.css("visibility","hidden")}}).append(t("",{"class":i.styles.closer,title:o.labels.close})).prependTo(i.container),(!o.closer||i.options.nonblock&&i.options.nonblock.nonblock)&&this.closer.css("display","none")},update:function(t,i){this.myOptions=i,!i.closer||t.options.nonblock&&t.options.nonblock.nonblock?this.closer.css("display","none"):i.closer&&this.closer.css("display","block"),!i.sticker||t.options.nonblock&&t.options.nonblock.nonblock?this.sticker.css("display","none"):i.sticker&&this.sticker.css("display","block"),this.sticker.trigger("pnotify_icon"),i.sticker_hover?this.sticker.css("visibility","hidden"):t.options.nonblock&&t.options.nonblock.nonblock||this.sticker.css("visibility","visible"),i.closer_hover?this.closer.css("visibility","hidden"):t.options.nonblock&&t.options.nonblock.nonblock||this.closer.css("visibility","visible")}},t.extend(i.styling.jqueryui,{closer:"ui-icon ui-icon-close",pin_up:"ui-icon ui-icon-pin-w",pin_down:"ui-icon ui-icon-pin-s"}),t.extend(i.styling.bootstrap2,{closer:"icon-remove",pin_up:"icon-pause",pin_down:"icon-play"}),t.extend(i.styling.bootstrap3,{closer:"glyphicon glyphicon-remove",pin_up:"glyphicon glyphicon-pause",pin_down:"glyphicon glyphicon-play"}),t.extend(i.styling.fontawesome,{closer:"fa fa-times",pin_up:"fa fa-pause",pin_down:"fa fa-play"})}); \ No newline at end of file