You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.7 KiB
1 lines
3.7 KiB
define(["jquery","core/custom_interaction_events","core/pubsub","core_message/message_drawer_view_contact","core_message/message_drawer_view_contacts","core_message/message_drawer_view_conversation","core_message/message_drawer_view_group_info","core_message/message_drawer_view_overview","core_message/message_drawer_view_search","core_message/message_drawer_view_settings","core_message/message_drawer_router","core_message/message_drawer_routes","core_message/message_drawer_events"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n={PANEL_BODY_CONTAINER:'[data-region="panel-body-container"]',PANEL_HEADER_CONTAINER:'[data-region="panel-header-container"]',VIEW_CONTACT:'[data-region="view-contact"]',VIEW_CONTACTS:'[data-region="view-contacts"]',VIEW_CONVERSATION:'[data-region="view-conversation"]',VIEW_GROUP_INFO:'[data-region="view-group-info"]',VIEW_OVERVIEW:'[data-region="view-overview"]',VIEW_SEARCH:'[data-region="view-search"]',VIEW_SETTINGS:'[data-region="view-settings"]',ROUTES:"[data-route]",ROUTES_BACK:"[data-route-back]",HEADER_CONTAINER:'[data-region="header-container"]',BODY_CONTAINER:'[data-region="body-container"]',FOOTER_CONTAINER:'[data-region="footer-container"]'},o=function(a,b,c){var d=b.find(n.HEADER_CONTAINER).find(c);d.length||(d=b.find(n.PANEL_HEADER_CONTAINER).find(c));var e=b.find(n.BODY_CONTAINER).find(c);e.length||(e=b.find(n.PANEL_BODY_CONTAINER).find(c));var f=b.find(n.FOOTER_CONTAINER).find(c);return[a,d.length?d:null,e.length?e:null,f.length?f:null]},p=[[l.VIEW_CONTACT,n.VIEW_CONTACT,d.show,d.description],[l.VIEW_CONTACTS,n.VIEW_CONTACTS,e.show,e.description],[l.VIEW_CONVERSATION,n.VIEW_CONVERSATION,f.show,f.description],[l.VIEW_GROUP_INFO,n.VIEW_GROUP_INFO,g.show,g.description],[l.VIEW_OVERVIEW,n.VIEW_OVERVIEW,h.show,h.description],[l.VIEW_SEARCH,n.VIEW_SEARCH,i.show,i.description],[l.VIEW_SETTINGS,n.VIEW_SETTINGS,j.show,j.description]],q=function(a,b){p.forEach(function(c){k.add(a,c[0],o(a,b,c[1]),c[2],c[3])})},r=function(a,b){b.attr("data-shown")||(k.go(a,l.VIEW_OVERVIEW),b.attr("data-shown",!0)),b.removeClass("hidden"),b.attr("aria-expanded",!0),b.attr("aria-hidden",!1)},s=function(a){a.addClass("hidden"),a.attr("aria-expanded",!1),a.attr("aria-hidden",!0)},t=function(a){return!a.hasClass("hidden")},u=function(d,e,f){b.define(e,[b.events.activate]);var g=/^data-route-param-?(\d*)$/;e.on(b.events.activate,n.ROUTES,function(b,c){for(var e=a(b.target).closest(n.ROUTES),f=e.attr("data-route"),h=[],i=0;i<e[0].attributes.length;i++)h.push(e[0].attributes[i]);var j=h.filter(function(a){var b=a.nodeName,c=g.test(b);return c});j.sort(function(a,b){var c=g.exec(a.nodeName),d=g.exec(b.nodeName),e=c.length>1?c[1]:0,f=d.length>1?d[1]:0;return e<f?-1:f<e?1:0});var l=j.map(function(a){return a.nodeValue}),m=[d,f].concat(l);k.go.apply(null,m),c.originalEvent.preventDefault()}),e.on(b.events.activate,n.ROUTES_BACK,function(a,b){k.back(d),b.originalEvent.preventDefault()}),f||(c.subscribe(m.SHOW,function(){r(d,e)}),c.subscribe(m.HIDE,function(){s(e)}),c.subscribe(m.TOGGLE_VISIBILITY,function(){t(e)?s(e):r(d,e)})),c.subscribe(m.SHOW_CONVERSATION,function(a){r(d,e),k.go(d,l.VIEW_CONVERSATION,a)}),c.subscribe(m.CREATE_CONVERSATION_WITH_USER,function(a){r(d,e),k.go(d,l.VIEW_CONVERSATION,null,"create",a)}),c.subscribe(m.SHOW_SETTINGS,function(){r(d,e),k.go(d,l.VIEW_SETTINGS)}),c.subscribe(m.PREFERENCES_UPDATED,function(a){var b=a.filter(function(a){return"message_entertosend"==a.type}),c=b.length?b[0]:null;if(c){var d=e.find(n.FOOTER_CONTAINER).find(n.VIEW_CONVERSATION);d.attr("data-enter-to-send",c.value)}})},v=function(b,c,d,e,f){b=a(b),q(c,b),u(c,b,d),d&&(r(c,b),e?f?k.go(c,l.VIEW_CONVERSATION,f):k.go(c,l.VIEW_CONVERSATION,null,"create",e):f&&k.go(c,l.VIEW_CONVERSATION,f))};return{init:v}});
|