");
}
+function userDataCallback(data) {
+ noosfero.user_data = data;
+ if (data.login) {
+ // logged in
+ if (data.chat_enabled) {
+ setInterval(function(){ $.getJSON(user_data, chatOnlineUsersDataCallBack)}, 10000);
+ }
+ }
+ if (data.notice) {
+ display_notice(data.notice);
+ // clear notice so that it is not display again in the case this function is called again.
+ data.notice = null;
+ }
+ // Bind this event to do more actions with the user data (for example, inside plugins)
+ jQuery(window).trigger("userDataLoaded", data);
+};
+
// controls the display of the login/logout stuff
jQuery(function($) {
$.ajaxSetup({
@@ -528,21 +545,13 @@ jQuery(function($) {
});
var user_data = noosfero_root() + '/account/user_data';
- $.getJSON(user_data, function userDataCallBack(data) {
- if (data.login) {
- // logged in
- if (data.chat_enabled) {
- setInterval(function(){ $.getJSON(user_data, chatOnlineUsersDataCallBack)}, 10000);
- }
- $('head').append('');
- $('head').append('');
- }
- if (data.notice) {
- display_notice(data.notice);
- }
- // Bind this event to do more actions with the user data (for example, inside plugins)
- $(window).trigger("userDataLoaded", data);
- });
+ $.getJSON(user_data, userDataCallback)
+ if (user_data.login) {
+ $('head').append('');
+ $('head').append('');
+ }
+
+ $.ajaxSetup({ cache: false });
function chatOnlineUsersDataCallBack(data) {
if ($('#chat-online-users').length == 0) {
--
libgit2 0.21.2