%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/vacivi36/intranet.vacivitta.com.br/assets/ec177d08/
Upload File :
Create Path :
Current File : //home2/vacivi36/intranet.vacivitta.com.br/assets/ec177d08/humhub.mail.messenger.bundle.min.js

humhub.module("mail.ConversationView",function(r,t,o){var s=t("ui.widget").Widget,a=t("ui.loader"),c=t("client"),n=t("ui.additions"),e=t("util.object"),i=t("mail.notification"),l=t("ui.view"),u=s.extend();u.prototype.init=function(){n.observe(this.$);var e=this;window.onresize=function(t){e.updateSize(!0)},this.getActiveMessageId()||this.setActiveMessageId(s.instance("#inbox").getFirstMessageId()),this.reload(),this.$.on("mouseenter",".mail-conversation-entry",function(){o(this).find(".conversation-menu").show()}).on("mouseleave",".mail-conversation-entry",function(){o(this).find(".conversation-menu").hide()})},u.prototype.loader=function(t){!1!==t?a.set(this.$):a.reset(this.$)},u.prototype.markSeen=function(t){c.post(this.options.markSeenUrl,{data:{id:t}}).then(function(t){e.isDefined(t.messageCount)&&i.setMailMessageCount(t.messageCount)}).catch(function(t){r.log.error(t)})},u.prototype.loadUpdate=function(){var t=this.$.find(".mail-conversation-entry:not(.own):last").data("entry-id"),t={id:this.getActiveMessageId(),from:t},e=this;c.get(this.options.loadUpdateUrl,{data:t}).then(function(t){t.html&&o(t.html).each(function(){e.appendEntry(o(this))})})},u.prototype.reply=function(e){var n=this;c.submit(e).then(function(t){t.success?n.appendEntry(t.content).then(function(){n.$.find(".time").timeago();var t=n.getReplyRichtext();t&&t.$.trigger("clear"),n.scrollToBottom(),l.isSmall()||n.focus(),s.instance("#inbox").updateEntries([n.getActiveMessageId()]),n.setLivePollInterval()}):r.log.error(t,!0)}).catch(function(t){r.log.error(t,!0)}).finally(function(t){a.reset(o(".reply-button")),e.finish()})},u.prototype.setLivePollInterval=function(){t("live").setDelay(5)},u.prototype.getReplyRichtext=function(){return s.instance(this.$.find(".ProsemirrorEditor"))},u.prototype.focus=function(t){var e=this.getReplyRichtext();e&&e.focus()},u.prototype.canLoadMore=function(){return!this.options.isLast},u.prototype.reload=function(){this.getActiveMessageId()&&this.loadMessage(this.getActiveMessageId())},u.prototype.addUser=function(t){var e=this;c.submit(t).then(function(t){t.result?e.$.find("#mail-conversation-header").html(t.result):t.error&&r.log.error(t,!0)}).catch(function(t){r.log.error(t,!0)})},u.prototype.appendEntry=function(t){var n=this,t=o(t);if(n.$.find('[data-entry-id="'+t.data("entryId")+'"]').length)return Promise.resolve();var i=t.not("script, link").filter(function(){return 1===this.nodeType});return i.css("opacity",0),this.getListNode().append(t),new Promise(function(t,e){i.css("opacity",1).fadeIn("fast",function(){n.onUpdate(),setTimeout(function(){n.scrollToBottom()},100),t()})})},u.prototype.loadMessage=function(n){var i=e.isNumber(n)?n:n.$trigger.data("message-id"),o=this;this.loader(),c.get(this.options.loadMessageUrl,{data:{id:i}}).then(function(t){o.setActiveMessageId(i),o.options.isLast=!1;var e=s.instance("#inbox");return e.updateActiveItem(),e.hide(),n.$trigger&&history&&history.replaceState&&((e=n.$trigger.data("action-url"))&&history.replaceState(null,null,e)),o.$.css("visibility","hidden"),o.updateContent(t.html)}).then(function(){return o.initScroll()}).catch(function(t){r.log.error(t,!0)}).finally(function(){o.loader(!1),o.$.css("visibility","visible"),o.initReplyRichText()})},u.prototype.initReplyRichText=function(){var t,e,n=this;window.ResizeObserver&&(t=new ResizeObserver(function(t){n.updateSize(n.isScrolledToBottom(100))}),(e=n.getReplyRichtext())&&t.observe(e.$[0])),n.focus()},u.prototype.isScrolledToBottom=function(t){if(!this.getListNode().length)return!1;t=t||0;var e=this.getListNode()[0];return e.scrollHeight-e.offsetHeight-e.scrollTop<=t},u.prototype.initScroll=function(){if(window.IntersectionObserver){var e=this.$.find(".conversation-entry-list"),t=o('<div class="conversation-stream-end"></div>');e.prepend(t);var n=this,i=new IntersectionObserver(function(t){n.preventScrollLoading()||t.length&&t[0].isIntersecting&&(a.prepend(e),n.loadMore().finally(function(){a.reset(e)}))},{root:e[0],rootMargin:"50px"});return this.assureScroll().then(function(){i.observe(t[0]),l.isLarge()&&n.getListNode().niceScroll({cursorwidth:"7",cursorborder:"",cursorcolor:"#555",cursoropacitymax:"0.2",nativeparentscrolling:!1,railpadding:{top:0,right:0,left:0,bottom:0}})})}},u.prototype.loadMore=function(){var n=this,t={id:this.getActiveMessageId(),from:this.$.find(".mail-conversation-entry:first").data("entryId")};return c.get(this.options.loadMoreUrl,{data:t}).then(function(t){var e;t.result&&(e=o(t.result).hide(),n.$.find(".conversation-entry-list").find(".conversation-stream-end").after(e),e.fadeIn()),n.options.isLast=!t.result||t.isLast}).catch(function(t){r.log.error(t,!0)})},u.prototype.preventScrollLoading=function(){return this.scrollLock||!this.canLoadMore()},u.prototype.canLoadMore=function(){return!this.options.isLast},u.prototype.assureScroll=function(){var t=this,e=this.$.find(".conversation-entry-list");return e[0].offsetHeight>=e[0].scrollHeight&&this.canLoadMore()?this.loadMore().then(function(){return t.assureScroll()}).catch(function(){return Promise.resolve()}):t.scrollToBottom()},u.prototype.updateContent=function(e){var n=this;return new Promise(function(t){n.$.html(e),t()})},u.prototype.getActiveMessageId=function(){return this.options.messageId},u.prototype.setActiveMessageId=function(t){this.options.messageId=t},u.prototype.scrollToBottom=function(){var n=this;return new Promise(function(e){setTimeout(function(){n.$.imagesLoaded(function(){var t=n.getListNode();t.length&&n.updateSize(!1).then(function(){t[0].scrollTop=t[0].scrollHeight,e()})})})})},u.prototype.updateSize=function(o){var r=this;return new Promise(function(i){setTimeout(function(){var t,e,n=r.$.find(".conversation-entry-list");n.length&&(e=(t=r.getReplyRichtext())?t.$.innerHeight():0,n.css("margin-bottom",e+5+"px"),t=r.$.find(".conversation-entry-list").offset().top,e=window.innerHeight-t-e-(l.isSmall()?20:30)+"px",n.css("height",e),n.css("max-height",e),!1!==o&&r.scrollToBottom(),i())},100)})},u.prototype.getListNode=function(){return this.$.find(".conversation-entry-list")},u.prototype.onUpdate=function(){l.isLarge()&&this.getListNode().getNiceScroll().resize()},r.export=u}),humhub.module("mail.ConversationEntry",function(t,e,i){e=e("ui.widget").Widget.extend();e.prototype.replace=function(t){var e=this,n=i(t).hide();this.$.fadeOut(function(){i(this).replaceWith(n),e.$=n,e.$.fadeIn("slow")})},e.prototype.remove=function(){this.$.fadeToggle("slow",function(){i(this).remove()})},t.export=e}),humhub.module("mail.inbox",function(o,t,r){var e=t("ui.widget").Widget,n=t("ui.filter").Filter,i=t("ui.view"),s=t("ui.loader"),a=t("client"),t=n.extend();t.prototype.triggerChange=function(){this.super("triggerChange"),this.updateFilterCount()},t.prototype.updateFilterCount=function(){var t=this.getActiveFilterCount(),e=this.$.find("#conversation-filter-link"),n=e.find(".filterCount");t?(n=!n.length?r('<small class="filterCount"></small>').insertBefore(e.find(".caret")):n).html(" <b>("+t+")</b> "):n.length&&n.remove()};n=e.extend();n.prototype.init=function(){this.filter=e.instance("#mail-filter-root"),this.initScroll();var t=this;this.filter.off("afterChange.inbox").on("afterChange.inbox",function(){t.reload().then(function(){t.updateActiveItem()})}),i.isLarge()&&this.$.niceScroll({cursorwidth:"7",cursorborder:"",cursorcolor:"#555",cursoropacitymax:"0.2",nativeparentscrolling:!1,railpadding:{top:0,right:3,left:0,bottom:0}}),this.$.on("click",".entry",function(){t.$.find(".entry").removeClass("selected"),r(this).addClass("selected")})},n.prototype.updateEntries=function(t){var n=this;t.length&&a.get(this.options.updateEntriesUrl,{data:{ids:t}}).then(function(t){t.result&&(r.each(t.result,function(t,e){t=n.getEntry(t);t.length?t.replaceWith(e):r(e).prependTo(n.$)}),n.updateActiveItem())}).catch(function(t){o.log.error(t)})},n.prototype.getEntry=function(t){return this.$.find('[data-message-preview="'+t+'"]')},n.prototype.initScroll=function(){var t,e,n;window.IntersectionObserver&&(t=r('<div class="inbox-stream-end"></div>'),this.$.append(t),e=this,n=new IntersectionObserver(function(t){e.preventScrollLoading()||t.length&&t[0].isIntersecting&&(s.append(e.$),e.loadMore().finally(function(){s.reset(e.$)}))},{root:this.$[0],rootMargin:"50px"}),this.assureScroll().then(function(){n.observe(t[0])}))},n.prototype.assureScroll=function(){var t=this;return this.$[0].offsetHeight>=this.$[0].scrollHeight&&this.canLoadMore()?this.loadMore().then(function(){return t.assureScroll()}).catch(function(){return Promise.resolve()}):Promise.resolve()},n.prototype.loadMore=function(){var i=this;return new Promise(function(e,n){var t=i.filter.getFilterMap();t.from=i.getLastMessageId(),a.get(i.options.loadMoreUrl,{data:t}).then(function(t){t.result&&(r(t.result).insertBefore(".inbox-stream-end"),i.$.find(".inbox-stream-end").append()),i.options.isLast=!t.result||t.isLast,i.updateActiveItem(),e()}).catch(function(t){o.log.error(t,!0),n()}).finally(function(){i.scrollLock=!1})})},n.prototype.preventScrollLoading=function(){return this.scrollLock||!this.canLoadMore()},n.prototype.canLoadMore=function(){return!this.options.isLast},n.prototype.getReloadOptions=function(){return{data:this.filter.getFilterMap()}},n.prototype.updateActiveItem=function(){var t=e.instance("#mail-conversation-root").getActiveMessageId();this.$.find(".entry").removeClass("selected"),this.$.find(".entry.selected").find(".new-message-badge").hide(),this.$.find(".entry").removeClass("selected");t=this.$.find('[data-message-preview="'+t+'"]');t.length&&t.removeClass("unread").addClass("selected").find(".new-message-badge").hide()},n.prototype.getFirstMessageId=function(){return this.$.find(".entry:first").data("messagePreview")},n.prototype.getLastMessageId=function(){return this.$.find(".entry:last").data("messagePreview")},n.prototype.hide=function(){return new Promise(function(t){i.isSmall()&&r(".inbox-wrapper").slideUp(function(){r("#mail-conversation-root").length&&e.instance("#mail-conversation-root").updateSize(),t()}),t()})},n.prototype.show=function(){return new Promise(function(t){i.isSmall()&&r(".inbox-wrapper").slideDown(function(){r("#mail-conversation-root").length&&e.instance("#mail-conversation-root").updateSize(),t()}),t()})};o.export({ConversationList:n,Filter:t,setTagFilter:function(t){e.instance("#inbox").show().then(function(){r("#mail-filter-menu").collapse("show"),e.instance("#inbox-tag-picker").setSelection([{id:t.$trigger.data("tagId"),text:t.$trigger.data("tagName"),image:t.$trigger.data("tagImage")}])})},toggleInbox:function(){i.isSmall()&&r(".inbox-wrapper").slideToggle(function(){e.instance("#mail-conversation-root").updateSize()})}})}),humhub.module("mail.conversation",function(i,t,r){function o(t){return s.instance('.mail-conversation-entry[data-entry-id="'+t+'"]')}var s=t("ui.widget").Widget,a=t("ui.modal"),n=t("client"),e=t("event"),c=t("mail.notification"),l=t("user");i.export({init:function(){e.on("humhub:modules:mail:live:NewUserMessage",function(t,e){var n,i,o;r("#inbox").length&&(n=s.instance("#mail-conversation-root"),i=!1,o=[],e.forEach(function(t){var e=t.data.user_guid==l.guid();o.push(t.data.message_id),!i&&n&&n.options.messageId==t.data.message_id?(n.loadUpdate(),i=!0,n.markSeen(t.data.message_id)):!e&&n&&(t=t.data.message_id,(t=r("#mail-conversation-overview").find('[data-message-preview="'+t+'"]')).is(".selected")||t.find(".new-message-badge").show())}),s.instance("#inbox").updateEntries(o))}).on("humhub:modules:mail:live:UserMessageDeleted",function(t,e,n){r("#inbox").length&&e.forEach(function(t){var e=o(t.data.entry_id);e&&e.remove(),c.setMailMessageCount(t.data.count)})})},leave:function(t){n.post(t).then(function(t){t.redirect&&n.pjax.redirect(t.redirect)}).catch(function(t){i.log.error(t,!0)})},submitEditEntry:function(n){a.submit(n).then(function(t){var e;t.success?(e=o(n.$trigger.data("entry-id")))&&setTimeout(function(){e.replace(t.content)},300):i.log.error(null,!0)}).catch(function(t){i.log.error(t,!0)})},deleteEntry:function(t){var e=o(t.$trigger.data("entry-id"));e?n.post(e.options.deleteUrl).then(function(t){a.global.close(),t.success&&setTimeout(function(){e.remove()},1e3)}).catch(function(t){i.log.error(t,!0)}):i.log.error(null,!0)}})});

Zerion Mini Shell 1.0