Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/conpherence/behavior-menu.js
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | if (_thread.visible !== null || !config.hasThread) { | ||||
_scrollMessageWindow(); | _scrollMessageWindow(); | ||||
_focusTextarea(); | _focusTextarea(); | ||||
} else { | } else { | ||||
didRedrawThread(); | didRedrawThread(); | ||||
} | } | ||||
if (_thread.visible !== null || !config.hasWidgets) { | if (_thread.visible !== null || !config.hasWidgets) { | ||||
reloadWidget(data); | reloadWidget(data); | ||||
} else { | |||||
JX.Stratcom.invoke( | |||||
'conpherence-update-widgets', | |||||
null, | |||||
{ | |||||
widget : getDefaultWidget(), | |||||
buildSelectors : false, | |||||
toggleWidget : true, | |||||
threadID : _thread.selected | |||||
}); | |||||
} | } | ||||
_thread.visible = _thread.selected; | _thread.visible = _thread.selected; | ||||
} | } | ||||
function markThreadsLoading(loading) { | function markThreadsLoading(loading) { | ||||
var root = JX.$('conpherence-main-layout'); | var root = JX.$('conpherence-main-layout'); | ||||
JX.DOM.alterClass(root, 'loading', loading); | JX.DOM.alterClass(root, 'loading', loading); | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | JX.behavior('conpherence-menu', function(config) { | ||||
function onWidgetResponse(thread_id, widget, response) { | function onWidgetResponse(thread_id, widget, response) { | ||||
// we got impatient and this is no longer the right answer :/ | // we got impatient and this is no longer the right answer :/ | ||||
if (_thread.selected != thread_id) { | if (_thread.selected != thread_id) { | ||||
return; | return; | ||||
} | } | ||||
var root = JX.DOM.find(document, 'div', 'conpherence-layout'); | var root = JX.DOM.find(document, 'div', 'conpherence-layout'); | ||||
var widgets_root = JX.DOM.find(root, 'div', 'conpherence-widgets-holder'); | var widgets_root = JX.DOM.find(root, 'div', 'conpherence-widgets-holder'); | ||||
JX.DOM.setContent(widgets_root, JX.$H(response.widgets)); | JX.DOM.setContent(widgets_root, JX.$H(response.widgets)); | ||||
JX.Stratcom.invoke( | |||||
'conpherence-update-widgets', | |||||
null, | |||||
{ | |||||
widget : widget, | |||||
buildSelectors : true, | |||||
toggleWidget : true, | |||||
threadID : _thread.selected | |||||
}); | |||||
markWidgetLoading(false); | |||||
} | } | ||||
function getDefaultWidget() { | function getDefaultWidget() { | ||||
var device = JX.Device.getDevice(); | return 'widgets-people'; | ||||
var widget = 'conpherence-message-pane'; | |||||
if (device == 'desktop') { | |||||
widget = 'widgets-people'; | |||||
var uri = JX.$U(location.href); | |||||
var params = uri.getQueryParams(); | |||||
if ('settings' in params) { | |||||
widget = 'widgets-settings'; | |||||
} | |||||
} | |||||
return widget; | |||||
} | } | ||||
/** | /** | ||||
* This function is a wee bit tricky. Internally, we want to scroll the | * This function is a wee bit tricky. Internally, we want to scroll the | ||||
* message window and let other stuff - notably widgets - redraw / build if | * message window and let other stuff - notably widgets - redraw / build if | ||||
* necessary. Externally, we want a hook to scroll the message window | * necessary. Externally, we want a hook to scroll the message window | ||||
* - notably when the widget selector is used to invoke the message pane. | * - notably when the widget selector is used to invoke the message pane. | ||||
* The following three functions get 'er done. | * The following three functions get 'er done. | ||||
▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines |