diff --git a/message/amd/build/message_area_messages.min.js b/message/amd/build/message_area_messages.min.js index 6598cbb9883..62285312f12 100644 --- a/message/amd/build/message_area_messages.min.js +++ b/message/amd/build/message_area_messages.min.js @@ -1 +1 @@ -define(["jquery","core/ajax","core/templates","core/notification","core/custom_interaction_events","core/auto_rows","core_message/message_area_actions","core/modal_factory","core/modal_events","core/str","core_message/message_area_events"],function(a,b,c,d,e,f,g,h,i,j,k){function l(a){this.messageArea=a,this._init()}var m=500,n=50,o={BLOCKTIME:"[data-region='blocktime']",CANCELDELETEMESSAGES:"[data-action='cancel-delete-messages']",CONTACT:"[data-region='contact']",CONVERSATIONS:"[data-region='contacts'][data-region-content='conversations']",DELETEALLMESSAGES:"[data-action='delete-all-messages']",DELETEMESSAGES:"[data-action='delete-messages']",LOADINGICON:".loading-icon",MESSAGE:"[data-region='message']",MESSAGERESPONSE:"[data-region='response']",MESSAGES:"[data-region='messages']",MESSAGESAREA:"[data-region='messages-area']",MESSAGINGAREA:"[data-region='messaging-area']",SENDMESSAGE:"[data-action='send-message']",SENDMESSAGETEXT:"[data-region='send-message-txt']",SHOWCONTACTS:"[data-action='show-contacts']",STARTDELETEMESSAGES:"[data-action='start-delete-messages']"};return l.prototype._isSendingMessage=!1,l.prototype._isLoadingMessages=!1,l.prototype._numMessagesDisplayed=0,l.prototype._numMessagesToRetrieve=20,l.prototype._confirmationModal=null,l.prototype.messageArea=null,l.prototype._init=function(){e.define(this.messageArea.node,[e.events.activate,e.events.up,e.events.down,e.events.enter]),f.init(this.messageArea.node),this.messageArea.onCustomEvent(k.CONVERSATIONSELECTED,this._viewMessages.bind(this)),this.messageArea.onCustomEvent(k.SENDMESSAGE,this._viewMessages.bind(this)),this.messageArea.onCustomEvent(k.CHOOSEMESSAGESTODELETE,this._chooseMessagesToDelete.bind(this)),this.messageArea.onCustomEvent(k.CANCELDELETEMESSAGES,this._hideDeleteAction.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.SENDMESSAGE,this._sendMessage.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.STARTDELETEMESSAGES,this._startDeleting.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.DELETEMESSAGES,this._deleteMessages.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.DELETEALLMESSAGES,this._deleteAllMessages.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.CANCELDELETEMESSAGES,this._triggerCancelMessagesToDelete.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.MESSAGE,this._toggleMessage.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.SHOWCONTACTS,this._hideMessagingArea.bind(this)),this.messageArea.onDelegateEvent(e.events.up,o.MESSAGE,this._selectPreviousMessage.bind(this)),this.messageArea.onDelegateEvent(e.events.down,o.MESSAGE,this._selectNextMessage.bind(this)),this.messageArea.onDelegateEvent("focus",o.SENDMESSAGETEXT,this._setMessaging.bind(this)),this.messageArea.onDelegateEvent("blur",o.SENDMESSAGETEXT,this._clearMessaging.bind(this)),this.messageArea.onDelegateEvent(e.events.enter,o.SENDMESSAGETEXT,this._sendMessageHandler.bind(this)),a(document).on(f.events.ROW_CHANGE,this._adjustMessagesAreaHeight.bind(this));var b=this.messageArea.find(o.MESSAGES);b.length&&this._addScrollEventListener(b.find(o.MESSAGE).length)},l.prototype._viewMessages=function(e,f){this._numMessagesDisplayed=0;var g=b.call([{methodname:"core_message_mark_all_messages_as_read",args:{useridto:this.messageArea.getCurrentUserId(),useridfrom:f}}]),h=0;return c.render("core/loading",{}).then(function(a,b){return c.replaceNodeContents(this.messageArea.find(o.MESSAGESAREA),a,b),g[0]}.bind(this)).then(function(){var b=this.messageArea.find(o.CONVERSATIONS+" "+o.CONTACT+"[data-userid='"+f+"']");return b.hasClass("unread")&&(b.removeClass("unread"),a(document).trigger("messagearea:conversationselected",f)),this._getMessages(f)}.bind(this)).then(function(a){return h=a.messages.length,c.render("core_message/message_area_messages_area",a)}).then(function(a,b){c.replaceNodeContents(this.messageArea.find(o.MESSAGESAREA),a,b),this._addScrollEventListener(h)}.bind(this)).fail(d.exception)},l.prototype._loadMessages=function(){if(this._isLoadingMessages)return!1;this._isLoadingMessages=!0;var b=0;return c.render("core/loading",{}).then(function(a,b){return c.prependNodeContents(this.messageArea.find(o.MESSAGES),"
"+a+"
",b),this._getMessages(this._getUserId())}.bind(this)).then(function(a){return b=a.messages.length,c.render("core_message/message_area_messages",a)}).then(function(d,e){if(this.messageArea.find(o.MESSAGES+" "+o.LOADINGICON).remove(),b>0){var f=this.messageArea.node.find(o.BLOCKTIME+":first"),g=a(d).find(o.BLOCKTIME+":first").addBack();f.html()==g.html()&&f.remove();var h=this.messageArea.find(o.MESSAGES)[0].scrollHeight;c.prependNodeContents(this.messageArea.find(o.MESSAGES),d,e);var i=this.messageArea.find(o.MESSAGES)[0].scrollHeight;this.messageArea.find(o.MESSAGES).scrollTop(i-h),this._numMessagesDisplayed+=b}this._isLoadingMessages=!1}.bind(this)).fail(d.exception)},l.prototype._getMessages=function(a){var c=b.call([{methodname:"core_message_data_for_messagearea_messages",args:{currentuserid:this.messageArea.getCurrentUserId(),otheruserid:a,limitfrom:this._numMessagesDisplayed,limitnum:this._numMessagesToRetrieve,newest:!0}}]);return c[0]},l.prototype._sendMessage=function(){var a=this.messageArea.find(o.SENDMESSAGETEXT),c=a.val();if(""===c.trim())return!1;if(this._isSendingMessage)return!1;this._isSendingMessage=!0;var e=b.call([{methodname:"core_message_send_instant_messages",args:{messages:[{touserid:this._getUserId(),text:c}]}}]);return a.prop("disabled",!0),e[0].then(function(a){if(a.length<0)throw new Error("Invalid response");if(a[0].errormessage)throw new Error(a[0].errormessage);return this.messageArea.trigger(k.MESSAGESENT,[this._getUserId(),c]),this._addMessageToDom()}.bind(this)).then(function(){this._isSendingMessage=!1}.bind(this)).always(function(){a.prop("disabled",!1)}).fail(d.exception)},l.prototype._chooseMessagesToDelete=function(){this.messageArea.find(o.MESSAGESAREA).addClass("editing"),this.messageArea.find(o.MESSAGE).attr("role","checkbox").attr("aria-checked","false")},l.prototype._deleteMessages=function(){var c=this.messageArea.getCurrentUserId(),e=this.messageArea.find(o.MESSAGE+"[aria-checked='true']"),f=[],g=[];e.each(function(b,d){var e=a(d),h=e.data("messageid"),i=e.data("messageread")?1:0;g.push(e),f.push({methodname:"core_message_delete_message",args:{messageid:h,userid:c,read:i}})}),f.length>0?b.call(f)[f.length-1].then(function(){var b=null,c=this.messageArea.find(o.MESSAGE),d=c.last(),e=g[g.length-1];a.each(g,function(a,b){b.remove()}),d.data("id")===e.data("id")&&(b=this.messageArea.find(o.MESSAGE).last()),a.each(g,function(a,b){var c=b.data("blocktime");0===this.messageArea.find(o.MESSAGE+"[data-blocktime='"+c+"']").length&&this.messageArea.find(o.BLOCKTIME+"[data-blocktime='"+c+"']").remove()}.bind(this)),0===this.messageArea.find(o.MESSAGE).length&&this.messageArea.find(o.CONVERSATIONS+" "+o.CONTACT+"[data-userid='"+this._getUserId()+"']").remove(),this.messageArea.trigger(k.MESSAGESDELETED,[this._getUserId(),b])}.bind(this),d.exception):this.messageArea.trigger(k.MESSAGESDELETED,this._getUserId()),this._hideDeleteAction()},l.prototype._addScrollEventListener=function(a){this._scrollBottom(),this._numMessagesDisplayed=a,e.define(this.messageArea.find(o.MESSAGES),[e.events.scrollTop]),this.messageArea.onCustomEvent(e.events.scrollTop,this._loadMessages.bind(this))},l.prototype._deleteAllMessages=function(){this._confirmationModal?this._confirmationModal.show():h.create({type:h.types.CONFIRM,body:j.get_string("deleteallconfirm","message")},this.messageArea.find(o.DELETEALLMESSAGES)).done(function(a){this._confirmationModal=a,a.getRoot().on(i.yes,function(){var a=this._getUserId(),c={methodname:"core_message_delete_conversation",args:{userid:this.messageArea.getCurrentUserId(),otheruserid:a}};b.call([c])[0].then(function(){this.messageArea.find(o.MESSAGESAREA).empty(),this.messageArea.trigger(k.CONVERSATIONDELETED,a),this._hideDeleteAction()}.bind(this),d.exeption)}.bind(this)),a.show()}.bind(this))},l.prototype._hideDeleteAction=function(){this.messageArea.find(o.MESSAGE).removeAttr("role").removeAttr("aria-checked"),this.messageArea.find(o.MESSAGESAREA).removeClass("editing")},l.prototype._triggerCancelMessagesToDelete=function(){this.messageArea.trigger(k.CANCELDELETEMESSAGES)},l.prototype._addMessageToDom=function(){var a=b.call([{methodname:"core_message_data_for_messagearea_get_most_recent_message",args:{currentuserid:this.messageArea.getCurrentUserId(),otheruserid:this._getUserId()}}]);return a[0].then(function(a){return c.render("core_message/message_area_message",a)}).then(function(a,b){c.appendNodeContents(this.messageArea.find(o.MESSAGES),a,b),this.messageArea.find(o.SENDMESSAGETEXT).val("").trigger("input"),this._scrollBottom()}.bind(this)).fail(d.exception)},l.prototype._getUserId=function(){return this.messageArea.find(o.MESSAGES).data("userid")},l.prototype._scrollBottom=function(){var a=this.messageArea.find(o.MESSAGES);0!==a.length&&a.scrollTop(a[0].scrollHeight)},l.prototype._selectPreviousMessage=function(b,c){var d=a(b.target).closest(o.MESSAGE);do d=d.prev();while(d.length&&!d.is(o.MESSAGE));d.focus(),c.originalEvent.preventDefault(),c.originalEvent.stopPropagation()},l.prototype._selectNextMessage=function(b,c){var d=a(b.target).closest(o.MESSAGE);do d=d.next();while(d.length&&!d.is(o.MESSAGE));d.focus(),c.originalEvent.preventDefault(),c.originalEvent.stopPropagation()},l.prototype._setMessaging=function(b){a(b.target).closest(o.MESSAGERESPONSE).addClass("messaging")},l.prototype._clearMessaging=function(b){a(b.target).closest(o.MESSAGERESPONSE).removeClass("messaging")},l.prototype._startDeleting=function(a){var b=new g(this.messageArea);b.chooseMessagesToDelete(),a.preventDefault()},l.prototype._isEditing=function(){return this.messageArea.find(o.MESSAGESAREA).hasClass("editing")},l.prototype._toggleMessage=function(b){if(this._isEditing()){var c=a(b.target).closest(o.MESSAGE);"true"===c.attr("aria-checked")?c.attr("aria-checked","false"):c.attr("aria-checked","true")}},l.prototype._adjustMessagesAreaHeight=function(){var a=this.messageArea.find(o.MESSAGES),b=this.messageArea.find(o.MESSAGERESPONSE),c=b.outerHeight(),d=c-n,e=m-d;a.outerHeight(e)},l.prototype._sendMessageHandler=function(a,b){b.originalEvent.preventDefault(),this._sendMessage()},l.prototype._hideMessagingArea=function(){this.messageArea.find(o.MESSAGINGAREA).removeClass("show-messages").addClass("hide-messages")},l}); \ No newline at end of file +define(["jquery","core/ajax","core/templates","core/notification","core/custom_interaction_events","core/auto_rows","core_message/message_area_actions","core/modal_factory","core/modal_events","core/str","core_message/message_area_events"],function(a,b,c,d,e,f,g,h,i,j,k){function l(a){this.messageArea=a,this._init()}var m=500,n=50,o={BLOCKTIME:"[data-region='blocktime']",CANCELDELETEMESSAGES:"[data-action='cancel-delete-messages']",CONTACT:"[data-region='contact']",CONVERSATIONS:"[data-region='contacts'][data-region-content='conversations']",DELETEALLMESSAGES:"[data-action='delete-all-messages']",DELETEMESSAGES:"[data-action='delete-messages']",LOADINGICON:".loading-icon",MESSAGE:"[data-region='message']",MESSAGERESPONSE:"[data-region='response']",MESSAGES:"[data-region='messages']",MESSAGESAREA:"[data-region='messages-area']",MESSAGINGAREA:"[data-region='messaging-area']",SENDMESSAGE:"[data-action='send-message']",SENDMESSAGETEXT:"[data-region='send-message-txt']",SHOWCONTACTS:"[data-action='show-contacts']",STARTDELETEMESSAGES:"[data-action='start-delete-messages']"};return l.prototype._isSendingMessage=!1,l.prototype._isLoadingMessages=!1,l.prototype._numMessagesDisplayed=0,l.prototype._numMessagesToRetrieve=20,l.prototype._confirmationModal=null,l.prototype.messageArea=null,l.prototype._init=function(){e.define(this.messageArea.node,[e.events.activate,e.events.up,e.events.down,e.events.enter]),a(window).height()<=670&&(m=400),f.init(this.messageArea.node),this.messageArea.onCustomEvent(k.CONVERSATIONSELECTED,this._viewMessages.bind(this)),this.messageArea.onCustomEvent(k.SENDMESSAGE,this._viewMessages.bind(this)),this.messageArea.onCustomEvent(k.CHOOSEMESSAGESTODELETE,this._chooseMessagesToDelete.bind(this)),this.messageArea.onCustomEvent(k.CANCELDELETEMESSAGES,this._hideDeleteAction.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.SENDMESSAGE,this._sendMessage.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.STARTDELETEMESSAGES,this._startDeleting.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.DELETEMESSAGES,this._deleteMessages.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.DELETEALLMESSAGES,this._deleteAllMessages.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.CANCELDELETEMESSAGES,this._triggerCancelMessagesToDelete.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.MESSAGE,this._toggleMessage.bind(this)),this.messageArea.onDelegateEvent(e.events.activate,o.SHOWCONTACTS,this._hideMessagingArea.bind(this)),this.messageArea.onDelegateEvent(e.events.up,o.MESSAGE,this._selectPreviousMessage.bind(this)),this.messageArea.onDelegateEvent(e.events.down,o.MESSAGE,this._selectNextMessage.bind(this)),this.messageArea.onDelegateEvent("focus",o.SENDMESSAGETEXT,this._setMessaging.bind(this)),this.messageArea.onDelegateEvent("blur",o.SENDMESSAGETEXT,this._clearMessaging.bind(this)),this.messageArea.onDelegateEvent(e.events.enter,o.SENDMESSAGETEXT,this._sendMessageHandler.bind(this)),a(document).on(f.events.ROW_CHANGE,this._adjustMessagesAreaHeight.bind(this));var b=this.messageArea.find(o.MESSAGES);b.length&&this._addScrollEventListener(b.find(o.MESSAGE).length)},l.prototype._viewMessages=function(e,f){this._numMessagesDisplayed=0;var g=b.call([{methodname:"core_message_mark_all_messages_as_read",args:{useridto:this.messageArea.getCurrentUserId(),useridfrom:f}}]),h=0;return c.render("core/loading",{}).then(function(a,b){return c.replaceNodeContents(this.messageArea.find(o.MESSAGESAREA),a,b),g[0]}.bind(this)).then(function(){var b=this.messageArea.find(o.CONVERSATIONS+" "+o.CONTACT+"[data-userid='"+f+"']");return b.hasClass("unread")&&(b.removeClass("unread"),a(document).trigger("messagearea:conversationselected",f)),this._getMessages(f)}.bind(this)).then(function(a){return h=a.messages.length,c.render("core_message/message_area_messages_area",a)}).then(function(a,b){c.replaceNodeContents(this.messageArea.find(o.MESSAGESAREA),a,b),this._addScrollEventListener(h)}.bind(this)).fail(d.exception)},l.prototype._loadMessages=function(){if(this._isLoadingMessages)return!1;this._isLoadingMessages=!0;var b=0;return c.render("core/loading",{}).then(function(a,b){return c.prependNodeContents(this.messageArea.find(o.MESSAGES),"
"+a+"
",b),this._getMessages(this._getUserId())}.bind(this)).then(function(a){return b=a.messages.length,c.render("core_message/message_area_messages",a)}).then(function(d,e){if(this.messageArea.find(o.MESSAGES+" "+o.LOADINGICON).remove(),b>0){var f=this.messageArea.node.find(o.BLOCKTIME+":first"),g=a(d).find(o.BLOCKTIME+":first").addBack();f.html()==g.html()&&f.remove();var h=this.messageArea.find(o.MESSAGES)[0].scrollHeight;c.prependNodeContents(this.messageArea.find(o.MESSAGES),d,e);var i=this.messageArea.find(o.MESSAGES)[0].scrollHeight;this.messageArea.find(o.MESSAGES).scrollTop(i-h),this._numMessagesDisplayed+=b}this._isLoadingMessages=!1}.bind(this)).fail(d.exception)},l.prototype._getMessages=function(a){var c=b.call([{methodname:"core_message_data_for_messagearea_messages",args:{currentuserid:this.messageArea.getCurrentUserId(),otheruserid:a,limitfrom:this._numMessagesDisplayed,limitnum:this._numMessagesToRetrieve,newest:!0}}]);return c[0]},l.prototype._sendMessage=function(){var a=this.messageArea.find(o.SENDMESSAGETEXT),c=a.val();if(""===c.trim())return!1;if(this._isSendingMessage)return!1;this._isSendingMessage=!0;var e=b.call([{methodname:"core_message_send_instant_messages",args:{messages:[{touserid:this._getUserId(),text:c}]}}]);return a.prop("disabled",!0),e[0].then(function(a){if(a.length<0)throw new Error("Invalid response");if(a[0].errormessage)throw new Error(a[0].errormessage);return this.messageArea.trigger(k.MESSAGESENT,[this._getUserId(),c]),this._addMessageToDom()}.bind(this)).then(function(){this._isSendingMessage=!1}.bind(this)).always(function(){a.prop("disabled",!1)}).fail(d.exception)},l.prototype._chooseMessagesToDelete=function(){this.messageArea.find(o.MESSAGESAREA).addClass("editing"),this.messageArea.find(o.MESSAGE).attr("role","checkbox").attr("aria-checked","false")},l.prototype._deleteMessages=function(){var c=this.messageArea.getCurrentUserId(),e=this.messageArea.find(o.MESSAGE+"[aria-checked='true']"),f=[],g=[];e.each(function(b,d){var e=a(d),h=e.data("messageid"),i=e.data("messageread")?1:0;g.push(e),f.push({methodname:"core_message_delete_message",args:{messageid:h,userid:c,read:i}})}),f.length>0?b.call(f)[f.length-1].then(function(){var b=null,c=this.messageArea.find(o.MESSAGE),d=c.last(),e=g[g.length-1];a.each(g,function(a,b){b.remove()}),d.data("id")===e.data("id")&&(b=this.messageArea.find(o.MESSAGE).last()),a.each(g,function(a,b){var c=b.data("blocktime");0===this.messageArea.find(o.MESSAGE+"[data-blocktime='"+c+"']").length&&this.messageArea.find(o.BLOCKTIME+"[data-blocktime='"+c+"']").remove()}.bind(this)),0===this.messageArea.find(o.MESSAGE).length&&this.messageArea.find(o.CONVERSATIONS+" "+o.CONTACT+"[data-userid='"+this._getUserId()+"']").remove(),this.messageArea.trigger(k.MESSAGESDELETED,[this._getUserId(),b])}.bind(this),d.exception):this.messageArea.trigger(k.MESSAGESDELETED,this._getUserId()),this._hideDeleteAction()},l.prototype._addScrollEventListener=function(a){this._scrollBottom(),this._numMessagesDisplayed=a,e.define(this.messageArea.find(o.MESSAGES),[e.events.scrollTop]),this.messageArea.onCustomEvent(e.events.scrollTop,this._loadMessages.bind(this))},l.prototype._deleteAllMessages=function(){this._confirmationModal?this._confirmationModal.show():h.create({type:h.types.CONFIRM,body:j.get_string("deleteallconfirm","message")},this.messageArea.find(o.DELETEALLMESSAGES)).done(function(a){this._confirmationModal=a,a.getRoot().on(i.yes,function(){var a=this._getUserId(),c={methodname:"core_message_delete_conversation",args:{userid:this.messageArea.getCurrentUserId(),otheruserid:a}};b.call([c])[0].then(function(){this.messageArea.find(o.MESSAGESAREA).empty(),this.messageArea.trigger(k.CONVERSATIONDELETED,a),this._hideDeleteAction()}.bind(this),d.exeption)}.bind(this)),a.show()}.bind(this))},l.prototype._hideDeleteAction=function(){this.messageArea.find(o.MESSAGE).removeAttr("role").removeAttr("aria-checked"),this.messageArea.find(o.MESSAGESAREA).removeClass("editing")},l.prototype._triggerCancelMessagesToDelete=function(){this.messageArea.trigger(k.CANCELDELETEMESSAGES)},l.prototype._addMessageToDom=function(){var a=b.call([{methodname:"core_message_data_for_messagearea_get_most_recent_message",args:{currentuserid:this.messageArea.getCurrentUserId(),otheruserid:this._getUserId()}}]);return a[0].then(function(a){return c.render("core_message/message_area_message",a)}).then(function(a,b){c.appendNodeContents(this.messageArea.find(o.MESSAGES),a,b),this.messageArea.find(o.SENDMESSAGETEXT).val("").trigger("input"),this._scrollBottom()}.bind(this)).fail(d.exception)},l.prototype._getUserId=function(){return this.messageArea.find(o.MESSAGES).data("userid")},l.prototype._scrollBottom=function(){var a=this.messageArea.find(o.MESSAGES);0!==a.length&&a.scrollTop(a[0].scrollHeight)},l.prototype._selectPreviousMessage=function(b,c){var d=a(b.target).closest(o.MESSAGE);do d=d.prev();while(d.length&&!d.is(o.MESSAGE));d.focus(),c.originalEvent.preventDefault(),c.originalEvent.stopPropagation()},l.prototype._selectNextMessage=function(b,c){var d=a(b.target).closest(o.MESSAGE);do d=d.next();while(d.length&&!d.is(o.MESSAGE));d.focus(),c.originalEvent.preventDefault(),c.originalEvent.stopPropagation()},l.prototype._setMessaging=function(b){a(b.target).closest(o.MESSAGERESPONSE).addClass("messaging")},l.prototype._clearMessaging=function(b){a(b.target).closest(o.MESSAGERESPONSE).removeClass("messaging")},l.prototype._startDeleting=function(a){var b=new g(this.messageArea);b.chooseMessagesToDelete(),a.preventDefault()},l.prototype._isEditing=function(){return this.messageArea.find(o.MESSAGESAREA).hasClass("editing")},l.prototype._toggleMessage=function(b){if(this._isEditing()){var c=a(b.target).closest(o.MESSAGE);"true"===c.attr("aria-checked")?c.attr("aria-checked","false"):c.attr("aria-checked","true")}},l.prototype._adjustMessagesAreaHeight=function(){var a=this.messageArea.find(o.MESSAGES),b=this.messageArea.find(o.MESSAGERESPONSE),c=b.outerHeight(),d=c-n,e=m-d;a.outerHeight(e)},l.prototype._sendMessageHandler=function(a,b){b.originalEvent.preventDefault(),this._sendMessage()},l.prototype._hideMessagingArea=function(){this.messageArea.find(o.MESSAGINGAREA).removeClass("show-messages").addClass("hide-messages")},l}); \ No newline at end of file diff --git a/message/amd/src/message_area_messages.js b/message/amd/src/message_area_messages.js index 59843232a93..0f5e7b5e593 100644 --- a/message/amd/src/message_area_messages.js +++ b/message/amd/src/message_area_messages.js @@ -93,6 +93,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust CustomEvents.events.enter, ]); + // We have a responsive media query based on height that reduces this size on screens shorter than 670. + if ($(window).height() <= 670) { + MESSAGES_AREA_DEFAULT_HEIGHT = 400; + } + AutoRows.init(this.messageArea.node); this.messageArea.onCustomEvent(Events.CONVERSATIONSELECTED, this._viewMessages.bind(this)); diff --git a/theme/boost/scss/moodle/message.scss b/theme/boost/scss/moodle/message.scss index bc3b0595282..6c5305bc9d6 100644 --- a/theme/boost/scss/moodle/message.scss +++ b/theme/boost/scss/moodle/message.scss @@ -53,6 +53,9 @@ .contacts-area { border-right: 1px solid #e3e3e3; height: 600px; + @media (max-height: 670px) { + height: 500px; + } width: 280px; display: inline-block; box-sizing: border-box; @@ -148,6 +151,9 @@ .contacts { height: 500px; + @media (max-height: 670px) { + height: 400px; + } overflow-y: auto; -webkit-overflow-scrolling: touch; @@ -284,6 +290,9 @@ .messages-area { width: calc(100% - 280px); height: 600px; + @media (max-height: 670px) { + height: 500px; + } box-sizing: border-box; margin: 0; position: relative; @@ -324,6 +333,9 @@ padding: 30px; font-size: 16px; height: 600px; + @media (max-height: 670px) { + height: 500px; + } box-sizing: border-box; overflow-y: auto; -webkit-overflow-scrolling: touch; @@ -440,6 +452,9 @@ .messages { height: 500px; + @media (max-height: 670px) { + height: 400px; + } overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; @@ -851,6 +866,9 @@ .notification-area { height: 600px; + @media (max-height: 670px) { + height: 500px; + } box-sizing: border-box; border-radius: 4px; margin-bottom: 30px; @@ -950,6 +968,9 @@ .content { height: 500px; + @media (max-height: 670px) { + height: 400px; + } box-sizing: border-box; overflow: auto; -webkit-overflow-scrolling: touch; @@ -992,6 +1013,9 @@ position: relative; overflow: hidden; height: 600px; + @media (max-height: 670px) { + height: 500px; + } .messages-area { .messages-header { diff --git a/theme/bootstrapbase/less/moodle/message.less b/theme/bootstrapbase/less/moodle/message.less index 44c691f5ca4..d7f9611d572 100644 --- a/theme/bootstrapbase/less/moodle/message.less +++ b/theme/bootstrapbase/less/moodle/message.less @@ -50,6 +50,9 @@ .contacts-area { border-right: 1px solid #e3e3e3; height: 600px; + @media (max-height: 670px) { + height: 500px; + } width: 280px; display: inline-block; box-sizing: border-box; @@ -140,6 +143,9 @@ .contacts { height: 500px; + @media (max-height: 670px) { + height: 400px; + } overflow-y: auto; -webkit-overflow-scrolling: touch; @@ -276,6 +282,9 @@ .messages-area { width: ~"calc(100% - 280px)"; height: 600px; + @media (max-height: 670px) { + height: 500px; + } box-sizing: border-box; margin: 0; position: relative; @@ -316,6 +325,9 @@ padding: 30px; font-size: 16px; height: 600px; + @media (max-height: 670px) { + height: 500px; + } box-sizing: border-box; overflow-y: auto; -webkit-overflow-scrolling: touch; @@ -432,6 +444,9 @@ .messages { height: 500px; + @media (max-height: 670px) { + height: 400px; + } overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; @@ -837,6 +852,9 @@ .notification-area { height: 600px; + @media (max-height: 670px) { + height: 500px; + } box-sizing: border-box; border-radius: 4px; margin-bottom: 30px; @@ -936,6 +954,9 @@ .content { height: 500px; + @media (max-height: 670px) { + height: 400px; + } box-sizing: border-box; overflow: auto; -webkit-overflow-scrolling: touch; @@ -978,6 +999,9 @@ position: relative; overflow: hidden; height: 600px; + @media (max-height: 670px) { + height: 500px; + } .messages-area { .messages-header { diff --git a/theme/bootstrapbase/style/moodle.css b/theme/bootstrapbase/style/moodle.css index 57639a63b21..03339019888 100644 --- a/theme/bootstrapbase/style/moodle.css +++ b/theme/bootstrapbase/style/moodle.css @@ -5842,6 +5842,11 @@ a.ygtvspacer:hover { display: inline-block; box-sizing: border-box; } +@media (max-height: 670px) { + .messaging-area-container .messaging-area .contacts-area { + height: 500px; + } +} .messaging-area-container .messaging-area .contacts-area.searchfilter .searchtextarea { height: 80px; } @@ -5911,6 +5916,11 @@ a.ygtvspacer:hover { overflow-y: auto; -webkit-overflow-scrolling: touch; } +@media (max-height: 670px) { + .messaging-area-container .messaging-area .contacts-area .contacts { + height: 400px; + } +} .messaging-area-container .messaging-area .contacts-area .contacts .nocontacts { padding-top: 20px; text-align: center; @@ -6038,6 +6048,11 @@ a.ygtvspacer:hover { position: relative; float: right; } +@media (max-height: 670px) { + .messaging-area-container .messaging-area .messages-area { + height: 500px; + } +} .messaging-area-container .messaging-area .messages-area .btn-container { position: absolute; top: 0; @@ -6071,6 +6086,11 @@ a.ygtvspacer:hover { overflow-y: auto; -webkit-overflow-scrolling: touch; } +@media (max-height: 670px) { + .messaging-area-container .messaging-area .messages-area .profile { + height: 500px; + } +} .messaging-area-container .messaging-area .messages-area .profile .user-container { height: 100px; } @@ -6167,6 +6187,11 @@ a.ygtvspacer:hover { box-sizing: border-box; padding: 20px; } +@media (max-height: 670px) { + .messaging-area-container .messaging-area .messages-area .messages { + height: 400px; + } +} .messaging-area-container .messaging-area .messages-area .messages .blocktime { clear: both; text-align: center; @@ -6455,6 +6480,11 @@ a.ygtvspacer:hover { margin-bottom: 30px; border: 1px solid #e3e3e3; } +@media (max-height: 670px) { + .notification-area { + height: 500px; + } +} .notification-area .control-area { box-sizing: border-box; display: inline-block; @@ -6538,6 +6568,11 @@ a.ygtvspacer:hover { -webkit-overflow-scrolling: touch; padding: 15px; } +@media (max-height: 670px) { + .notification-area .content-area .content { + height: 400px; + } +} .notification-area .content-area .content:empty { display: none; } @@ -6698,6 +6733,11 @@ a.ygtvspacer:hover { transition: right 0.25s; } } +@media (max-width: 979px) and (max-height: 670px) { + .messaging-area-container .messaging-area { + height: 500px; + } +} @media (max-width: 480px) { .messaging-area-container .messaging-area .messages-area.editing .messages-header { height: 80px;