X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Fclient.js;h=0b77e651306cf45a225f0f860f02a1b68b1e5afa;hp=917ae8ee85594c056f3c5f80b760353bcc4b9b2a;hb=73eeebd801f82fd9b9eeba3c5757bb26e01ec648;hpb=0d2df8ad038e13c1d9af1636bb0660a481e40a2e diff --git a/js/client.js b/js/client.js index 917ae8e..0b77e65 100644 --- a/js/client.js +++ b/js/client.js @@ -58,6 +58,10 @@ euphorik.Client.statusType = { disconnected : 2 }; +/** + * Reset all the local personal data. Does not erase the remote data. + * This function is used during disconnecting. + */ euphorik.Client.prototype.resetPersonalData = function() { this.id = 0; this.nick = euphorik.conf.defaultNick; @@ -74,14 +78,20 @@ euphorik.Client.prototype.resetPersonalData = function() { this.mainConversationPage = 1; this.ekMaster = false; this.ostentatiousMaster = "light"; - - // les conversations, une conversation est un objet possédant les propriétés suivantes : - // - root (entier) - // - page (entier) - // - reduit (bool) + + // The user opened conversations. + // Each conversation object owns theses properties : + // - root (integer) + // - page (integer) + // - isCollapsed (bool) this.conversations = []; }; +/** + * Set the CSS. Dynamically change the href to the CSS in the DOM. + * @css The relative path to the CSS file, for example : + * "styles/1/euphorik.css". + */ euphorik.Client.prototype.setCss = function(css) { if (this.css === css || !css) { return; @@ -89,12 +99,17 @@ euphorik.Client.prototype.setCss = function(css) { this.css = css; $("link#mainCss").attr("href", this.css); + if (this.autoflush) { this.flush(true); } }; -euphorik.Client.prototype.pageSuivante = function(numConv) { +/** + * Change the current page to the next one for the given conversation. + * @numConv The number of the conversation. + */ +euphorik.Client.prototype.nextPage = function(numConv) { if (numConv < 0 && this.mainConversationPage > 1) { this.mainConversationPage -= 1; } else if (this.conversations[numConv].page > 1) { @@ -102,7 +117,11 @@ euphorik.Client.prototype.pageSuivante = function(numConv) { } }; -euphorik.Client.prototype.pagePrecedente = function(numConv) { +/** + * Change the current page to the previous one for the given conversation. + * @numConv The number of the conversation. + */ +euphorik.Client.prototype.previousPage = function(numConv) { if (numConv < 0) { this.mainConversationPage += 1; } else { @@ -114,7 +133,7 @@ euphorik.Client.prototype.pagePrecedente = function(numConv) { * Définit la première page pour la conversation donnée. * @return true si la page a changé sinon false */ -euphorik.Client.prototype.goPremierePage = function(numConv) +euphorik.Client.prototype.goFirstPage = function(numConv) { if (numConv < 0) { if (this.mainConversationPage === 1) { @@ -148,7 +167,7 @@ euphorik.Client.prototype.ajouterConversation = function(racine) { return false; } - this.conversations.push({root : racine, page : 1, reduit : false}); + this.conversations.push({root : racine, page : 1, isCollapsed : false}); if (this.autoflush) { this.flush(true); } @@ -175,7 +194,7 @@ euphorik.Client.prototype.supprimerConversation = function(num) { euphorik.Client.prototype.getJSONConversations = function() { var conversations = []; this.conversations.each(function(i, conv) { - conversations.push({ "root" : conv.root, "minimized" : conv.reduit }); + conversations.push({ "root" : conv.root, "minimized" : conv.isCollapsed }); }); return conversations; }; @@ -359,7 +378,7 @@ euphorik.Client.prototype.chargerDonnees = function(data) { // les conversations this.conversations = data.profile.conversations; this.conversations.map(function(conv) { - return { root : conv.root, page : 1, reduit : conv.minimized }; + return { root : conv.root, page : 1, isCollapsed : conv.minimized }; }); this.majBulle();