From 85142855302bc8fa7c61cce567365b205c0f624f Mon Sep 17 00:00:00 2001 From: tehspede Date: Fri, 7 Nov 2014 06:13:54 +0200 Subject: [PATCH] Update PNotify lib. Make notify close button always visible. Fix issue with multiple tabs. --- CHANGES.md | 3 + gui/slick/css/lib/jquery.pnotify.default.css | 100 ------------------- gui/slick/css/lib/pnotify.custom.min.css | 1 + gui/slick/css/style.css | 13 +++ gui/slick/interfaces/default/inc_top.tmpl | 4 +- gui/slick/js/addShowOptions.js | 8 +- gui/slick/js/ajaxEpSearch.js | 7 +- gui/slick/js/ajaxNotifications.js | 32 +++--- gui/slick/js/lib/jquery.pnotify-1.0.2.min.js | 34 ------- gui/slick/js/lib/jquery.pnotify-1.2.0.min.js | 40 -------- gui/slick/js/lib/pnotify.custom.min.js | 42 ++++++++ 11 files changed, 85 insertions(+), 199 deletions(-) delete mode 100644 gui/slick/css/lib/jquery.pnotify.default.css create mode 100644 gui/slick/css/lib/pnotify.custom.min.css delete mode 100644 gui/slick/js/lib/jquery.pnotify-1.0.2.min.js delete mode 100644 gui/slick/js/lib/jquery.pnotify-1.2.0.min.js create mode 100644 gui/slick/js/lib/pnotify.custom.min.js diff --git a/CHANGES.md b/CHANGES.md index 07db71ca..e3c36848 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -75,6 +75,9 @@ * Fix parsing utf8 data from tvdb and tvrage * Fix display show status and subtitle searches to use new column class names * Fix API response header for JSON content type and the return of JSONP data +* Update PNotify to version [2.0.1] +* Change the notification popups to always show the close button. +* Fix issue where popups did not show if multiple tabs are used. Popups now queue and display when a tab is brought into focus. ### 0.2.1 (2014-10-22 06:41:00 UTC) diff --git a/gui/slick/css/lib/jquery.pnotify.default.css b/gui/slick/css/lib/jquery.pnotify.default.css deleted file mode 100644 index 12abc160..00000000 --- a/gui/slick/css/lib/jquery.pnotify.default.css +++ /dev/null @@ -1,100 +0,0 @@ -/* - Document : jquery.pnotify.default.css - Created on : Nov 23, 2009, 3:14:10 PM - Author : Hunter Perrin - Version : 1.0.0 - Description: - Default styling for Pines Notify jQuery plugin. -*/ - -/* Notice -----------------------------------*/ -.ui-pnotify { - position: fixed; - right: 10px; - bottom: 10px; - /* Ensure that the notices are on top of everything else. */ - z-index: 9999; -} -/* This hides position: fixed from IE6, which doesn't understand it. */ -html > body .ui-pnotify { - position: fixed; -} -.ui-pnotify .ui-widget { - background: none; -} -.ui-pnotify-container { - background-position: 0 0; - border: 1px solid #cccccc; - background-image: -moz-linear-gradient(#fdf0d5, #fff9ee) !important; - background-image: linear-gradient(#fdf0d5, #fff9ee) !important; - background-image: -webkit-linear-gradient(#fdf0d5, #fff9ee) !important; - background-image: -o-linear-gradient(#fdf0d5, #fff9ee) !important; - filter: progid:dximagetransform.microsoft.gradient(startColorstr=#555555, endColorstr=#333333) !important; - -ms-filter: progid:dximagetransform.microsoft.gradient(startColorstr=#555555, endColorstr=#333333) !important; - -moz-border-radius: 7px; - -webkit-border-radius: 7px; - border-radius: 7px; - font-size: 14px; - -moz-box-shadow: 0px 0px 2px #aaaaaa; - -webkit-box-shadow: 0px 0px 2px #aaaaaa; - -o-box-shadow: 0px 0px 2px #aaaaaa; - box-shadow: 0px 0px 2px #aaaaaa; - padding: 7px 10px; - text-align: center; - min-height: 22px; - z-index: 9999; - font-family: "Open Sans", "Trebuchet MS", Helvetica, Arial, sans-serif; - line-height: normal; - filter: alpha(opacity=85); - -moz-opacity: 0.8 !important; - -khtml-opacity: 0.8 !important; - -o-opacity: 0.8 !important; - opacity: 0.8 !important; -} -.ui-pnotify-closer { - float: right; - margin-left: .2em; -} -.ui-pnotify-title { - display: block; - background: none; - font-size: 14px; - font-weight: bold; - font-family: "Open Sans", "Trebuchet MS", Helvetica, Arial, sans-serif; - line-height: normal; -} -.ui-pnotify-text { - display: block; - font-size: 14px; - font-family: "Open Sans", "Trebuchet MS", Helvetica, Arial, sans-serif; - line-height: normal; -} -.ui-pnotify-icon, .ui-pnotify-icon span { - display: block; - float: left; - margin-right: .2em; -} -/* History Pulldown -----------------------------------*/ -.ui-pnotify-history-container { - position: absolute; - top: 0; - right: 18px; - width: 70px; - border-top: none; - /* Ensure that the history container is on top of the notices. */ - z-index: 10000; -} -.ui-pnotify-history-container .ui-pnotify-history-header { - /*padding: 2px;*/ -} -.ui-pnotify-history-container button { - cursor: pointer; - display: block; - width: 100%; -} -.ui-pnotify-history-container .ui-pnotify-history-pulldown { - display: block; - margin: 0 auto; -} diff --git a/gui/slick/css/lib/pnotify.custom.min.css b/gui/slick/css/lib/pnotify.custom.min.css new file mode 100644 index 00000000..1d0fa42e --- /dev/null +++ b/gui/slick/css/lib/pnotify.custom.min.css @@ -0,0 +1 @@ +.ui-pnotify{top:25px;right:25px;position:absolute;height:auto;z-index:9999}html>body>.ui-pnotify{position:fixed}.ui-pnotify .ui-pnotify-shadow{-webkit-box-shadow:0 2px 10px rgba(50,50,50,.5);-moz-box-shadow:0 2px 10px rgba(50,50,50,.5);box-shadow:0 2px 10px rgba(50,50,50,.5)}.ui-pnotify-container{background-position:0 0;padding:.8em;height:100%;margin:0}.ui-pnotify-sharp{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.ui-pnotify-title{display:block;margin-bottom:.4em;margin-top:0}.ui-pnotify-text{display:block}.ui-pnotify-icon,.ui-pnotify-icon span{display:block;float:left;margin-right:.2em}.ui-pnotify.stack-bottomleft,.ui-pnotify.stack-topleft{left:25px;right:auto}.ui-pnotify.stack-bottomleft,.ui-pnotify.stack-bottomright{bottom:25px;top:auto}.ui-pnotify-closer,.ui-pnotify-sticker{float:right;margin-left:.2em} \ No newline at end of file diff --git a/gui/slick/css/style.css b/gui/slick/css/style.css index 4f31b558..a5ca2119 100644 --- a/gui/slick/css/style.css +++ b/gui/slick/css/style.css @@ -3111,4 +3111,17 @@ jquery.confirm.css #confirmBox .red:hover { background-color: #A13331; +} + +/* ======================================================================= +pnotify.css +========================================================================== */ + +.ui-pnotify-sticker { + margin-top: -12px; +} + +.ui-pnotify-closer { + margin-top: -12px; + margin-right: -10px; } \ No newline at end of file diff --git a/gui/slick/interfaces/default/inc_top.tmpl b/gui/slick/interfaces/default/inc_top.tmpl index 1e30f446..f7dd68be 100644 --- a/gui/slick/interfaces/default/inc_top.tmpl +++ b/gui/slick/interfaces/default/inc_top.tmpl @@ -38,7 +38,7 @@ - + @@ -64,7 +64,7 @@ - + diff --git a/gui/slick/js/addShowOptions.js b/gui/slick/js/addShowOptions.js index a6286c5b..ceea7714 100644 --- a/gui/slick/js/addShowOptions.js +++ b/gui/slick/js/addShowOptions.js @@ -21,10 +21,10 @@ $(document).ready(function () { }); $(this).attr('disabled', true); - $.pnotify({ - pnotify_title: 'Saved Defaults', - pnotify_text: 'Your "add show" defaults have been set to your current selections.', - pnotify_shadow: false + new PNotify({ + title: 'Saved Defaults', + text: 'Your "add show" defaults have been set to your current selections.', + shadow: false }); }); diff --git a/gui/slick/js/ajaxEpSearch.js b/gui/slick/js/ajaxEpSearch.js index a33b82e4..acb84eae 100644 --- a/gui/slick/js/ajaxEpSearch.js +++ b/gui/slick/js/ajaxEpSearch.js @@ -1,10 +1,5 @@ var search_status_url = sbRoot + '/getManualSearchStatus'; -$.pnotify.defaults.width = "400px"; -$.pnotify.defaults.styling = "jqueryui"; -$.pnotify.defaults.history = false; -$.pnotify.defaults.shadow = false; -$.pnotify.defaults.delay = 4000; -$.pnotify.defaults.maxonscreen = 5; +PNotify.prototype.options.maxonscreen = 5; $.fn.manualSearches = []; diff --git a/gui/slick/js/ajaxNotifications.js b/gui/slick/js/ajaxNotifications.js index 8f1a12a5..92b2fc22 100644 --- a/gui/slick/js/ajaxNotifications.js +++ b/gui/slick/js/ajaxNotifications.js @@ -1,25 +1,31 @@ var message_url = sbRoot + '/ui/get_messages'; -$.pnotify.defaults.pnotify_width = "340px"; -$.pnotify.defaults.pnotify_history = false; -$.pnotify.defaults.pnotify_delay = 4000; + +PNotify.prototype.options.styling = 'jqueryui'; +PNotify.prototype.options.buttons.closer_hover = false; +PNotify.prototype.options.delay = 4000; +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}; function check_notifications() { - $.getJSON(message_url, function(data){ - $.each(data, function(name,data){ - $.pnotify({ - pnotify_type: data.type, - pnotify_hide: data.type == 'notice', - pnotify_title: data.title, - pnotify_text: data.message + 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) } $(document).ready(function(){ - check_notifications(); - }); \ No newline at end of file diff --git a/gui/slick/js/lib/jquery.pnotify-1.0.2.min.js b/gui/slick/js/lib/jquery.pnotify-1.0.2.min.js deleted file mode 100644 index 99bcfdc9..00000000 --- a/gui/slick/js/lib/jquery.pnotify-1.0.2.min.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * jQuery Pines Notify (pnotify) Plugin 1.0.2 - * - * Copyright (c) 2009-2011 Hunter Perrin - * - * Triple license under the GPL, LGPL, and MPL: - * http://www.gnu.org/licenses/gpl.html - * http://www.gnu.org/licenses/lgpl.html - * http://www.mozilla.org/MPL/MPL-1.1.html - */ -(function(e){var n,j,g,k;e.extend({pnotify_remove_all:function(){var d=g.data("pnotify");d&&d.length&&e.each(d,function(){this.pnotify_remove&&this.pnotify_remove()})},pnotify_position_all:function(){j&&clearTimeout(j);j=null;var d=g.data("pnotify");d&&d.length&&(e.each(d,function(){var c=this.opts.pnotify_stack;if(c){if(!c.nextpos1)c.nextpos1=c.firstpos1;if(!c.nextpos2)c.nextpos2=c.firstpos2;if(!c.addpos2)c.addpos2=0;if(this.css("display")!="none"){var a,e,d={},b;switch(c.dir1){case "down":b="top"; -break;case "up":b="bottom";break;case "left":b="right";break;case "right":b="left"}a=parseInt(this.css(b));isNaN(a)&&(a=0);if(typeof c.firstpos1=="undefined")c.firstpos1=a,c.nextpos1=c.firstpos1;var f;switch(c.dir2){case "down":f="top";break;case "up":f="bottom";break;case "left":f="right";break;case "right":f="left"}e=parseInt(this.css(f));isNaN(e)&&(e=0);if(typeof c.firstpos2=="undefined")c.firstpos2=e,c.nextpos2=c.firstpos2;if(c.dir1=="down"&&c.nextpos1+this.height()>k.height()||c.dir1=="up"&& -c.nextpos1+this.height()>k.height()||c.dir1=="left"&&c.nextpos1+this.width()>k.width()||c.dir1=="right"&&c.nextpos1+this.width()>k.width())c.nextpos1=c.firstpos1,c.nextpos2+=c.addpos2+10,c.addpos2=0;if(c.animation&&c.nextpos2c.addpos2)c.addpos2= -this.height();break;case "left":case "right":if(this.outerWidth(!0)>c.addpos2)c.addpos2=this.width()}if(c.nextpos1)if(c.animation&&(a>c.nextpos1||d.top||d.bottom||d.right||d.left))switch(c.dir1){case "down":d.top=c.nextpos1+"px";break;case "up":d.bottom=c.nextpos1+"px";break;case "left":d.right=c.nextpos1+"px";break;case "right":d.left=c.nextpos1+"px"}else this.css(b,c.nextpos1+"px");(d.top||d.bottom||d.right||d.left)&&this.animate(d,{duration:500,queue:!1});switch(c.dir1){case "down":case "up":c.nextpos1+= -this.height()+10;break;case "left":case "right":c.nextpos1+=this.width()+10}}}}),e.each(d,function(){var c=this.opts.pnotify_stack;if(c)c.nextpos1=c.firstpos1,c.nextpos2=c.firstpos2,c.addpos2=0,c.animation=!0}))},pnotify:function(d){g||(g=e("body"));k||(k=e(window));var c,a;typeof d!="object"?(a=e.extend({},e.pnotify.defaults),a.pnotify_text=d):a=e.extend({},e.pnotify.defaults,d);if(a.pnotify_before_init&&a.pnotify_before_init(a)===!1)return null;var h,l=function(a,c){b.css("display","none");var d= -document.elementFromPoint(a.clientX,a.clientY);b.css("display","block");var f=e(d),g=f.css("cursor");b.css("cursor",g!="auto"?g:"default");if(!h||h.get(0)!=d)h&&(m.call(h.get(0),"mouseleave",a.originalEvent),m.call(h.get(0),"mouseout",a.originalEvent)),m.call(d,"mouseenter",a.originalEvent),m.call(d,"mouseover",a.originalEvent);m.call(d,c,a.originalEvent);h=f},b=e("
",{"class":"ui-pnotify "+a.pnotify_addclass,css:{display:"none"},mouseenter:function(o){a.pnotify_nonblock&&o.stopPropagation(); -a.pnotify_mouse_reset&&c=="out"&&(b.stop(!0),c="in",b.css("height","auto").animate({width:a.pnotify_width,opacity:a.pnotify_nonblock?a.pnotify_nonblock_opacity:a.pnotify_opacity},"fast"));a.pnotify_nonblock&&b.animate({opacity:a.pnotify_nonblock_opacity},"fast");a.pnotify_hide&&a.pnotify_mouse_reset&&b.pnotify_cancel_remove();a.pnotify_closer&&!a.pnotify_nonblock&&b.closer.show()},mouseleave:function(o){a.pnotify_nonblock&&o.stopPropagation();h=null;b.css("cursor","auto");a.pnotify_nonblock&&c!="out"&& -b.animate({opacity:a.pnotify_opacity},"fast");a.pnotify_hide&&a.pnotify_mouse_reset&&b.pnotify_queue_remove();b.closer.hide();e.pnotify_position_all()},mouseover:function(b){a.pnotify_nonblock&&b.stopPropagation()},mouseout:function(b){a.pnotify_nonblock&&b.stopPropagation()},mousemove:function(b){a.pnotify_nonblock&&(b.stopPropagation(),l(b,"onmousemove"))},mousedown:function(b){a.pnotify_nonblock&&(b.stopPropagation(),b.preventDefault(),l(b,"onmousedown"))},mouseup:function(b){a.pnotify_nonblock&& -(b.stopPropagation(),b.preventDefault(),l(b,"onmouseup"))},click:function(b){a.pnotify_nonblock&&(b.stopPropagation(),l(b,"onclick"))},dblclick:function(b){a.pnotify_nonblock&&(b.stopPropagation(),l(b,"ondblclick"))}});b.opts=a;if(a.pnotify_shadow&&!e.browser.msie)b.shadow_container=e("
",{"class":"ui-widget-shadow ui-corner-all ui-pnotify-shadow"}).prependTo(b);b.container=e("
",{"class":"ui-widget ui-widget-content ui-corner-all ui-pnotify-container "+(a.pnotify_type=="error"?"ui-state-error": -"ui-state-highlight")}).appendTo(b);b.pnotify_version="1.0.2";b.pnotify=function(c){var d=a;typeof c=="string"?a.pnotify_text=c:a=e.extend({},a,c);b.opts=a;if(a.pnotify_shadow!=d.pnotify_shadow)a.pnotify_shadow&&!e.browser.msie?b.shadow_container=e("
",{"class":"ui-widget-shadow ui-pnotify-shadow"}).prependTo(b):b.children(".ui-pnotify-shadow").remove();a.pnotify_addclass===!1?b.removeClass(d.pnotify_addclass):a.pnotify_addclass!==d.pnotify_addclass&&b.removeClass(d.pnotify_addclass).addClass(a.pnotify_addclass); -a.pnotify_title===!1?b.title_container.hide("fast"):a.pnotify_title!==d.pnotify_title&&b.title_container.html(a.pnotify_title).show(200);if(a.pnotify_text===!1)b.text_container.hide("fast");else if(a.pnotify_text!==d.pnotify_text){if(a.pnotify_insert_brs)a.pnotify_text=a.pnotify_text.replace(/\n/g,"
");b.text_container.html(a.pnotify_text).show(200)}b.pnotify_history=a.pnotify_history;a.pnotify_type!=d.pnotify_type&&b.container.toggleClass("ui-state-error ui-state-highlight");if(a.pnotify_notice_icon!= -d.pnotify_notice_icon&&a.pnotify_type=="notice"||a.pnotify_error_icon!=d.pnotify_error_icon&&a.pnotify_type=="error"||a.pnotify_type!=d.pnotify_type)if(b.container.find("div.ui-pnotify-icon").remove(),a.pnotify_error_icon&&a.pnotify_type=="error"||a.pnotify_notice_icon)e("
",{"class":"ui-pnotify-icon"}).append(e("",{"class":a.pnotify_type=="error"?a.pnotify_error_icon:a.pnotify_notice_icon})).prependTo(b.container);a.pnotify_width!==d.pnotify_width&&b.animate({width:a.pnotify_width}); -a.pnotify_min_height!==d.pnotify_min_height&&b.container.animate({minHeight:a.pnotify_min_height});a.pnotify_opacity!==d.pnotify_opacity&&b.fadeTo(a.pnotify_animate_speed,a.pnotify_opacity);a.pnotify_hide?d.pnotify_hide||b.pnotify_queue_remove():b.pnotify_cancel_remove();b.pnotify_queue_position();return b};b.pnotify_queue_position=function(){j&&clearTimeout(j);j=setTimeout(e.pnotify_position_all,10)};b.pnotify_display=function(){b.parent().length||b.appendTo(g);a.pnotify_before_open&&a.pnotify_before_open(b)=== -!1||(b.pnotify_queue_position(),a.pnotify_animation=="fade"||a.pnotify_animation.effect_in=="fade"?b.show().fadeTo(0,0).hide():a.pnotify_opacity!=1&&b.show().fadeTo(0,a.pnotify_opacity).hide(),b.animate_in(function(){a.pnotify_after_open&&a.pnotify_after_open(b);b.pnotify_queue_position();a.pnotify_hide&&b.pnotify_queue_remove()}))};b.pnotify_remove=function(){if(b.timer)window.clearTimeout(b.timer),b.timer=null;a.pnotify_before_close&&a.pnotify_before_close(b)===!1||b.animate_out(function(){a.pnotify_after_close&& -a.pnotify_after_close(b)===!1||(b.pnotify_queue_position(),a.pnotify_remove&&b.detach())})};b.animate_in=function(d){c="in";var e;e=typeof a.pnotify_animation.effect_in!="undefined"?a.pnotify_animation.effect_in:a.pnotify_animation;e=="none"?(b.show(),d()):e=="show"?b.show(a.pnotify_animate_speed,d):e=="fade"?b.show().fadeTo(a.pnotify_animate_speed,a.pnotify_opacity,d):e=="slide"?b.slideDown(a.pnotify_animate_speed,d):typeof e=="function"?e("in",d,b):b.effect&&b.effect(e,{},a.pnotify_animate_speed, -d)};b.animate_out=function(d){c="out";var e;e=typeof a.pnotify_animation.effect_out!="undefined"?a.pnotify_animation.effect_out:a.pnotify_animation;e=="none"?(b.hide(),d()):e=="show"?b.hide(a.pnotify_animate_speed,d):e=="fade"?b.fadeOut(a.pnotify_animate_speed,d):e=="slide"?b.slideUp(a.pnotify_animate_speed,d):typeof e=="function"?e("out",d,b):b.effect&&b.effect(e,{},a.pnotify_animate_speed,d)};b.pnotify_cancel_remove=function(){b.timer&&window.clearTimeout(b.timer)};b.pnotify_queue_remove=function(){b.pnotify_cancel_remove(); -b.timer=window.setTimeout(function(){b.pnotify_remove()},isNaN(a.pnotify_delay)?0:a.pnotify_delay)};b.closer=e("
",{"class":"ui-pnotify-closer",css:{cursor:"pointer",display:"none"},click:function(){b.pnotify_remove();b.closer.hide()}}).append(e("",{"class":"ui-icon ui-icon-circle-close"})).appendTo(b.container);if(a.pnotify_error_icon&&a.pnotify_type=="error"||a.pnotify_notice_icon)e("
",{"class":"ui-pnotify-icon"}).append(e("",{"class":a.pnotify_type=="error"?a.pnotify_error_icon: -a.pnotify_notice_icon})).appendTo(b.container);b.title_container=e("
",{"class":"ui-pnotify-title",html:a.pnotify_title}).appendTo(b.container);a.pnotify_title===!1&&b.title_container.hide();if(a.pnotify_insert_brs&&typeof a.pnotify_text=="string")a.pnotify_text=a.pnotify_text.replace(/\n/g,"
");b.text_container=e("
",{"class":"ui-pnotify-text",html:a.pnotify_text}).appendTo(b.container);a.pnotify_text===!1&&b.text_container.hide();typeof a.pnotify_width=="string"&&b.css("width", -a.pnotify_width);typeof a.pnotify_min_height=="string"&&b.container.css("min-height",a.pnotify_min_height);b.pnotify_history=a.pnotify_history;var f=g.data("pnotify");if(f==null||typeof f!="object")f=[];f=a.pnotify_stack.push=="top"?e.merge([b],f):e.merge(f,[b]);g.data("pnotify",f);a.pnotify_after_init&&a.pnotify_after_init(b);if(a.pnotify_history){var i=g.data("pnotify_history");typeof i=="undefined"&&(i=e("
",{"class":"ui-pnotify-history-container ui-state-default ui-corner-bottom",mouseleave:function(){i.animate({top:"-"+ -n+"px"},{duration:100,queue:!1})}}).append(e("
",{"class":"ui-pnotify-history-header",text:"Redisplay"})).append(e("