/* Jappix - An open social platform These are the talkpage JS scripts for Jappix ------------------------------------------------- License: AGPL Author: Valérian Saliou */ // Bundle var Talk = (function () { /** * Alias of this * @private */ var self = {}; /** * Creates the talkpage events * @public * @return {undefined} */ self.events = function() { try { // Launch all associated bundles Microblog.instance(); Roster.instance(); Presence.instance(); PEP.instance(); Notification.instance(); Music.instance(); } catch(e) { Console.error('Talk.events', e); } }; /** * Creates the talkpage code * @public * @return {boolean} */ self.create = function() { try { // Talkpage exists? if(Common.exists('#talk')) return false; // Anonymous detector var anonymous = Utils.isAnonymous(); // Generate the HTML code var html = '
' + '
' + '' + ''; if(!anonymous && document.createElement('audio').canPlayType) html += '
' + '
' + '
' + '
' + '
' + '
' + '' + '
' + '
' + '

' + Common._e("No result!") + '

' + '
' + '' + '
' + '
' + '
'; if(!anonymous) html += '
' + '
' + '
' + '
' + '
' + '' + Common._e("Empty") + '' + '

' + Common._e("No notifications.") + '

' + '
' + '
' + '
'; if(!anonymous) html += '
' + '
' + '' + '00:00:00' + '' + Common._e("Stop") + '' + '' + '
' + '
' + '
' + '
' + '
' + '
'; html += '
' + '
' + '
'; if(!anonymous) html += '
' + '
' + '
' + '' + 'x' + '
' + '
' + '
' + '' + '
' + '
' + '' + '
' + '
' + '' + '
' + '
' + '' + '
' + '
' + '
' + '
'; html += '
' + '
' + '
' + '' + '' + '' + '' + '
'; if(!anonymous) html += '
' + '' + '' + '' + '' + '
' + '
' + '' + '' + '' + '' + '
'; html += '
' + '
' + '
' + '
' + '
' + '
'; if(!anonymous) html += '
' + '
' + '
' + Common._e("Channel") + '
' + '
'; html += '
'; if(anonymous) html += '
' + '
' + '
'; html += '
' + '
' + '
' + '
' + '
'; if(!anonymous) html += '
' + '
' + '
' + '' + '
' + '
' + '

' + Common._e("What\'s up with you?") + '

' + '
' + '' + '
' + '
' + '' + '
' + '
' + '
' + '

' + Common._e("Attach a file") + '

' + Interface.generateFileShare() + '
' + '
' + '
' + '
' + '
' + '
' + '' + '
'; html += '
' + '
' + '
' + '
'; // Create the HTML code $('body').prepend(html); // Adapt the roster size Roster.adapt(); // Create JS events self.events(); // Start the auto idle functions Presence.liveIdle(); return true; } catch(e) { Console.error('Talk.create', e); } }; /** * Destroys the talkpage code * @public * @return {undefined} */ self.destroy = function() { try { // Reset our database DataStore.resetDB(); // Reset some vars STANZA_ID = 1; Roster.blist_all = false; Presence.first_sent = false; Search.search_filtered = false; Avatar.pending = []; JOIN_SUGGEST = []; // Kill all timers, exept the board ones $('*:not(#board .one-board)').stopTime(); // Kill the auto idle functions Presence.dieIdle(); // We renitalise the html markup as its initiale look $('.removable').remove(); Interface.title('home'); // Finally we show the homepage $('#home').show(); } catch(e) { Console.error('Talk.destroy', e); } }; /** * Return class scope */ return self; })();