diff --git a/resources/js/humhub.mail.notification.js b/resources/js/humhub.mail.notification.js index 0428826d..f5d8de88 100644 --- a/resources/js/humhub.mail.notification.js +++ b/resources/js/humhub.mail.notification.js @@ -25,9 +25,12 @@ humhub.module('mail.notification', function (module, require, $) { currentXhr.abort(); } + const messageLoader = $('#loader_messages'); + const messageList = messageLoader.parent(); + // remove all
  • entries from dropdown - $('#loader_messages').parent().find(':not(#loader_messages)').remove(); - loader.set($('#loader_messages').show()); + messageLoader.parent().find(':not(#loader_messages)').remove(); + loader.set(messageLoader.show()); client.get(module.config.url.list, { beforeSend: function (xhr) { @@ -35,8 +38,16 @@ humhub.module('mail.notification', function (module, require, $) { } }).then(function (response) { currentXhr = undefined; - $('#loader_messages').parent().prepend($(response.html)); - $('#loader_messages').hide(); + messageList.prepend($(response.html)); + messageLoader.hide(); + messageList.niceScroll({ + cursorwidth: '7', + cursorborder: '', + cursorcolor: '#555', + cursoropacitymax: '0.2', + nativeparentscrolling: false, + railpadding: {top: 0, right: 3, left: 0, bottom: 0} + }); }); }); } diff --git a/resources/js/humhub.mail.notification.min.js b/resources/js/humhub.mail.notification.min.js index c6f2bfb8..33c01832 100644 --- a/resources/js/humhub.mail.notification.min.js +++ b/resources/js/humhub.mail.notification.min.js @@ -1 +1 @@ -humhub.module("mail.notification",function(n,e,t){function s(){o.get(n.config.url.count).then(function(e){d(parseInt(e.newMessages))})}var a,o=e("client"),i=e("ui.loader"),u=e("event"),l=e("ui.widget").Widget,r=0,d=(n.initOnPjaxLoad=!0,function(e){var n=t("#badge-messages");e&&0!==parseInt(e)?(r=e,n.empty(),n.append(e),n.fadeIn("fast")):(n.css("display","none"),r=0),u.trigger("humhub:modules:notification:UpdateTitleNotificationCount")});n.export({init:function(e){e||(u.on("humhub:modules:mail:live:NewUserMessage",function(e,n){n=n[n.length-1];d(n.data.count)}).on("humhub:modules:mail:live:UserMessageDeleted",function(e,n){n=n[n.length-1];d(n.data.count)}),t("#icon-messages").click(function(){a&&a.abort(),t("#loader_messages").parent().find(":not(#loader_messages)").remove(),i.set(t("#loader_messages").show()),o.get(n.config.url.list,{beforeSend:function(e){a=e}}).then(function(e){a=void 0,t("#loader_messages").parent().prepend(t(e.html)),t("#loader_messages").hide()})})),s()},loadMessage:function(e){var n=l.instance("#mail-conversation-root");n?(n.loadMessage(e),n.$.closest(".container").addClass("mail-conversation-single-message")):o.redirect(e.url),e.finish()},setMailMessageCount:d,updateCount:s,getNewMessageCount:function(){return r}})}); \ No newline at end of file +humhub.module("mail.notification",function(o,e,i){function n(){s.get(o.config.url.count).then(function(e){l(parseInt(e.newMessages))})}var a,s=e("client"),r=e("ui.loader"),t=e("event"),u=e("ui.widget").Widget,c=0,l=(o.initOnPjaxLoad=!0,function(e){var n=i("#badge-messages");e&&0!==parseInt(e)?(c=e,n.empty(),n.append(e),n.fadeIn("fast")):(n.css("display","none"),c=0),t.trigger("humhub:modules:notification:UpdateTitleNotificationCount")});o.export({init:function(e){e||(t.on("humhub:modules:mail:live:NewUserMessage",function(e,n){n=n[n.length-1];l(n.data.count)}).on("humhub:modules:mail:live:UserMessageDeleted",function(e,n){n=n[n.length-1];l(n.data.count)}),i("#icon-messages").click(function(){a&&a.abort();const n=i("#loader_messages"),t=n.parent();n.parent().find(":not(#loader_messages)").remove(),r.set(n.show()),s.get(o.config.url.list,{beforeSend:function(e){a=e}}).then(function(e){a=void 0,t.prepend(i(e.html)),n.hide(),t.niceScroll({cursorwidth:"7",cursorborder:"",cursorcolor:"#555",cursoropacitymax:"0.2",nativeparentscrolling:!1,railpadding:{top:0,right:3,left:0,bottom:0}})})})),n()},loadMessage:function(e){var n=u.instance("#mail-conversation-root");n?(n.loadMessage(e),n.$.closest(".container").addClass("mail-conversation-single-message")):s.redirect(e.url),e.finish()},setMailMessageCount:l,updateCount:n,getNewMessageCount:function(){return c}})}); \ No newline at end of file