From 7d9a97558c4bf3a441d43dbf9c978e89d68e8c56 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 18:52:14 +0100 Subject: [PATCH 01/10] code styling --- background.js | 8 +- chromesoul.html | 16 ++-- chromesoul.js | 10 +-- lib/avatars.js | 24 ++--- lib/client.js | 90 +++++++++---------- lib/contacts.nsui.js | 163 +++++++++++++++++----------------- lib/ns_client.js | 194 ++++++++++++++++++++-------------------- lib/nsui.js | 206 +++++++++++++++++++++---------------------- lib/options.js | 106 +++++++++++----------- lib/tab.nsui.js | 86 +++++++++--------- lib/txt_socket.js | 54 ++++++------ manifest.json | 18 ++-- 12 files changed, 488 insertions(+), 487 deletions(-) mode change 100755 => 100644 lib/tab.nsui.js diff --git a/background.js b/background.js index 811910f..d44220d 100644 --- a/background.js +++ b/background.js @@ -15,8 +15,8 @@ // chrome.app.runtime.onLaunched.addListener(function() { - chrome.app.window.create('chromesoul.html', { - 'width': 800, - 'height': 500 - }); + chrome.app.window.create('chromesoul.html', { + 'width': 800, + 'height': 500 + }); }); diff --git a/chromesoul.html b/chromesoul.html index 56ec90b..2b74add 100644 --- a/chromesoul.html +++ b/chromesoul.html @@ -19,16 +19,16 @@
-
-
-
-
-
- +
+
+
+
+
+
-
    -
    +
      +
      diff --git a/chromesoul.js b/chromesoul.js index a60e1f0..c5cf7bb 100644 --- a/chromesoul.js +++ b/chromesoul.js @@ -1,10 +1,10 @@ var chromesoul = (function() { var chromesoul = { - "opts": new OptionsManager(), - "ui": new Nsui(), - "contacts": new ContactList(), - "client": new Client(), - "avatars": new AvatarManager() + "opts": new OptionsManager(), + "ui": new Nsui(), + "contacts": new ContactList(), + "client": new Client(), + "avatars": new AvatarManager() }; return (window.chromesoul = window.$cs = chromesoul); diff --git a/lib/avatars.js b/lib/avatars.js index ff77ab7..0a0169e 100644 --- a/lib/avatars.js +++ b/lib/avatars.js @@ -24,25 +24,25 @@ AvatarManager.prototype.getContactPic = function(name, callback) { xhr.open("GET", "http://cdn.local.epitech.net/userprofil/profilview/" + name + ".jpg", true); xhr.responseType = "blob"; xhr.onload = (function(elem) { - return function(e) { - if (e.target.status === 200) { - elem.avatars[name] = window.webkitURL.createObjectURL(this.response); - } else { - elem.avatars[name] = "img/default-avatar.jpg"; - } + return function(e) { + if (e.target.status === 200) { + elem.avatars[name] = window.webkitURL.createObjectURL(this.response); + } else { + elem.avatars[name] = "img/default-avatar.jpg"; + } - if (typeof callback !== "undefined") { - callback(elem.avatars[name]); - } - }; + if (typeof callback !== "undefined") { + callback(elem.avatars[name]); + } + }; })(this); xhr.send(); } AvatarManager.prototype.get = function(name, callback) { if (typeof this.avatars[name] === "undefined") { - this.getContactPic(name, callback); + this.getContactPic(name, callback); } else { - callback(this.avatars[name]); + callback(this.avatars[name]); } }; diff --git a/lib/client.js b/lib/client.js index 2eed5e6..fccc27e 100644 --- a/lib/client.js +++ b/lib/client.js @@ -26,41 +26,41 @@ var Client = function() { Client.prototype.createSocket = function() { if (this.socket === null) { - this.socket = new TxtSocket(); - this.socket.onError = (function(elem) { - return function() { - elem.is_connected = false; - elem.connect(); - }; - })(this); + this.socket = new TxtSocket(); + this.socket.onError = (function(elem) { + return function() { + elem.is_connected = false; + elem.connect(); + }; + })(this); } }; Client.prototype.connect = function() { if (!this.is_connected) { - this.createSocket(); - this.socket.connect(this.client.host, this.client.port, (function(elem) { - return function() { - elem.client.connect(elem, function() { - if (elem.is_connected) { - elem.daemonize(); - elem.changeStatus(); - elem.addContact(); - } else { - elem.disconnect(); - } - }); - }; - })(this)); + this.createSocket(); + this.socket.connect(this.client.host, this.client.port, (function(elem) { + return function() { + elem.client.connect(elem, function() { + if (elem.is_connected) { + elem.daemonize(); + elem.changeStatus(); + elem.addContact(); + } else { + elem.disconnect(); + } + }); + }; + })(this)); } } Client.prototype.disconnect = function() { if (this.is_connected) { - this.is_connected = false; - this.client.disconnect(this); - this.socket.disconnect(); - this.socket = null; + this.is_connected = false; + this.client.disconnect(this); + this.socket.disconnect(); + this.socket = null; } this.changeStatus(this.client.status_disconnected); }; @@ -72,49 +72,49 @@ Client.prototype.reconnect = function() { Client.prototype.daemonize = function() { this.socket.read((function(elem) { - return function(data) { - elem.client.recv(elem, data); - elem.daemonize(); - }; + return function(data) { + elem.client.recv(elem, data); + elem.daemonize(); + }; })(this)); }; Client.prototype.changeStatus = function(status) { if (typeof status === 'undefined') { - status = this.client.default_status; + status = this.client.default_status; } if (status !== this.status) { - this.status = status; - this.updateStatus(); + this.status = status; + this.updateStatus(); } }; Client.prototype.updateStatus = function() { if (this.status !== null) { - this.client.changeStatus(this); + this.client.changeStatus(this); } }; Client.prototype.addContact = function(name) { if (typeof name !== 'undefined') { - this.waiting_contacts.push(name); + this.waiting_contacts.push(name); } if (this.is_connected) { - var tmp = this.waiting_contacts; - this.waiting_contacts = []; - this.client.addContact(this, tmp); + var tmp = this.waiting_contacts; + this.waiting_contacts = []; + this.client.addContact(this, tmp); } }; Client.prototype.rmContact = function(name) { if (this.is_connected) { - this.client.rmContact(this, name); + this.client.rmContact(this, name); } }; Client.prototype.speak = function(to, msg) { if (this.is_connected) { - this.client.speak(this, to, msg); + this.client.speak(this, to, msg); } }; @@ -124,14 +124,14 @@ Client.prototype.init = function(client, ui) { this.connect(); setInterval((function(elem) { - return function() { - elem.connect(); - }; + return function() { + elem.connect(); + }; })(this), 10000); setInterval((function(elem) { - return function() { - elem.updateStatus(); - }; + return function() { + elem.updateStatus(); + }; })(this), 180000); }; diff --git a/lib/contacts.nsui.js b/lib/contacts.nsui.js index ab1df9a..c3d45bd 100644 --- a/lib/contacts.nsui.js +++ b/lib/contacts.nsui.js @@ -24,17 +24,17 @@ ContactList.prototype.insertContact = function(elem) { var i, next = null; for (i in this.contacts) { - if (this.contacts.hasOwnProperty(i)) { - if (elem.name < this.contacts[i].name && (next === null || this.contacts[i].name < next.name)) { - next = this.contacts[i]; - } - } + if (this.contacts.hasOwnProperty(i)) { + if (elem.name < this.contacts[i].name && (next === null || this.contacts[i].name < next.name)) { + next = this.contacts[i]; + } + } } if (next !== null) { - this.lst.insertBefore(elem.li, next.li); + this.lst.insertBefore(elem.li, next.li); } else { - this.lst.appendChild(elem.li); + this.lst.appendChild(elem.li); } }; @@ -42,83 +42,84 @@ ContactList.prototype.addContact = function(name) { var infos = {}, li = null, login = null, close = null; if (typeof this.contacts[name] === "undefined") { - infos = { - "name": name, - "li": null, - "avatar": null - }; + infos = { + "name": name, + "li": null, + "avatar": null + }; - li = document.createElement("li"); - $cs.avatars.get(infos.name, function(url) { - li.style.backgroundImage = "url('" + url + "')"; - }); - img = document.createElement("img"); - this.setImageStatus(img, "offline"); - login = document.createElement("span"); - close = document.createElement("span"); - close.classList.add("remove"); - login.innerHTML = name; - close.innerHTML = 'x'; - li.appendChild(img); - li.appendChild(login); - li.appendChild(close); - li.addEventListener("dblclick", function() { - var nel = $cs.ui.addNewTab(name); + li = document.createElement("li"); + $cs.avatars.get(infos.name, function(url) { + li.style.backgroundImage = "url('" + url + "')"; + }); + img = document.createElement("img"); + this.setImageStatus(img, "offline"); + login = document.createElement("span"); + close = document.createElement("span"); + close.classList.add("remove"); + login.innerHTML = name; + close.innerHTML = 'x'; + li.appendChild(img); + li.appendChild(login); + li.appendChild(close); + li.addEventListener("dblclick", function() { + var nel = $cs.ui.addNewTab(name); - $cs.ui.hideAllTabs(); - $cs.ui.showContent("chat-pannel"); - nel.show(); - }); - close.addEventListener("click", (function(elem) { - return function() { - elem.rmContact(name); - }; - })(this)); + $cs.ui.hideAllTabs(); + $cs.ui.showContent("chat-pannel"); + nel.show(); + }); + close.addEventListener("click", (function(elem) { + return function() { + elem.rmContact(name); + }; + })(this)); - infos.li = li; - infos.img = img; - this.contacts[name] = infos; - this.save(); - this.insertContact(infos); + infos.li = li; + infos.img = img; + this.contacts[name] = infos; + this.save(); + this.insertContact(infos); } $cs.client.addContact(name); }; ContactList.prototype.rmContact = function(name) { if (typeof this.contacts[name] !== "undefined") { - this.lst.removeChild(this.contacts[name].li); - delete this.contacts[name]; - this.save(); + this.lst.removeChild(this.contacts[name].li); + delete this.contacts[name]; + this.save(); } }; ContactList.prototype.setImageStatus = function(img, status) { - var status_list = {'default' : 'img/status/contact-connected.png', + var status_list = { + 'default' : 'img/status/contact-connected.png', - 'offline': 'img/status/contact-disconnected.png', - 'disconnected': 'img/status/contact-disconnected.png', - 'deconnecte': 'img/status/contact-disconnected.png', - 'deco': 'img/status/contact-disconnected.png', - 'hidden': 'img/status/contact-disconnected.png', - 'cache': 'img/status/contact-disconnected.png', + 'offline': 'img/status/contact-disconnected.png', + 'disconnected': 'img/status/contact-disconnected.png', + 'deconnecte': 'img/status/contact-disconnected.png', + 'deco': 'img/status/contact-disconnected.png', + 'hidden': 'img/status/contact-disconnected.png', + 'cache': 'img/status/contact-disconnected.png', - 'away': 'img/status/contact-away.png', - 'inactif': 'img/status/contact-away.png', - 'absent': 'img/status/contact-away.png', - 'idle': 'img/status/contact-away.png', - 'locked': 'img/status/contact-away.png', - 'lock': 'img/status/contact-away.png', + 'away': 'img/status/contact-away.png', + 'inactif': 'img/status/contact-away.png', + 'absent': 'img/status/contact-away.png', + 'idle': 'img/status/contact-away.png', + 'locked': 'img/status/contact-away.png', + 'lock': 'img/status/contact-away.png', - 'dnd': 'img/status/contact-dnd.png', - 'occuped': 'img/status/contact-dnd.png', - 'npd': 'img/status/contact-dnd.png', - 'occupe': 'img/status/contact-dnd.png' - }; + 'dnd': 'img/status/contact-dnd.png', + 'occuped': 'img/status/contact-dnd.png', + 'npd': 'img/status/contact-dnd.png', + 'occupe': 'img/status/contact-dnd.png' + }; if (status_list.hasOwnProperty(status)) { - img.src = status_list[status]; + img.src = status_list[status]; } else { - img.src = status_list.default; + img.src = status_list.default; } img.alt = status; img.title = status; @@ -126,8 +127,8 @@ ContactList.prototype.setImageStatus = function(img, status) { ContactList.prototype.changeContactStatus = function(name, status) { if (typeof this.contacts[name] !== "undefined") { - this.setImageStatus(this.contacts[name].img, status); - console.log(name + ' changed his status to ' + status); + this.setImageStatus(this.contacts[name].img, status); + console.log(name + ' changed his status to ' + status); } }; @@ -135,9 +136,9 @@ ContactList.prototype.save = function() { var i, data = {"contact_list": []}; for (i in this.contacts) { - if (this.contacts.hasOwnProperty(i)) { - data.contact_list.push(i); - } + if (this.contacts.hasOwnProperty(i)) { + data.contact_list.push(i); + } } data.contact_list.sort(); this.storage.set(data, function() {}); @@ -146,13 +147,13 @@ ContactList.prototype.save = function() { ContactList.prototype.restore = function() { this.storage.get("contact_list", (function(elem) { return function(items) { - elem.contacts = {}; - elem.lst.innerHTML = ""; - if (typeof items.contact_list !== "undefined") { - for (i = items.contact_list.length - 1; i >= 0; --i) { - elem.addContact(items.contact_list[i]); - } - } + elem.contacts = {}; + elem.lst.innerHTML = ""; + if (typeof items.contact_list !== "undefined") { + for (i = items.contact_list.length - 1; i >= 0; --i) { + elem.addContact(items.contact_list[i]); + } + } }; })(this)); }; @@ -163,9 +164,9 @@ ContactList.prototype.init = function() { this.restore(); this.save(); add_btn.addEventListener("keyup", function(event) { - if (event.keyCode == 13 && this.value != "") { - $cs.contacts.addContact(this.value); - this.value = ""; - } + if (event.keyCode == 13 && this.value != "") { + $cs.contacts.addContact(this.value); + this.value = ""; + } }); }; diff --git a/lib/ns_client.js b/lib/ns_client.js index acda182..8c72436 100644 --- a/lib/ns_client.js +++ b/lib/ns_client.js @@ -23,77 +23,77 @@ var NsClient = function() { this.action = {}; this.action.ping = function(client, str) { - if (str.substr(0, 5) !== 'ping ') { - return false; - } + if (str.substr(0, 5) !== 'ping ') { + return false; + } - client.socket.write(str, function(inf) {}); - return true; + client.socket.write(str, function(inf) {}); + return true; }; this.action.msg = (function(elem) { - return function(client, str) { - var mo = {}, mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| msg ([^ ]*)/.exec(str); + return function(client, str) { + var mo = {}, mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| msg ([^ ]*)/.exec(str); - if (mch === null) { - return false; - } + if (mch === null) { + return false; + } - mo.socket = mch[1]; - mo.login = mch[2]; - mo.host = mch[3]; - mo.location = elem.msgDecode(mch[4]); - mo.group = mch[5]; - mo.message = elem.msgDecode(mch[6]); + mo.socket = mch[1]; + mo.login = mch[2]; + mo.host = mch[3]; + mo.location = elem.msgDecode(mch[4]); + mo.group = mch[5]; + mo.message = elem.msgDecode(mch[6]); - $cs.ui.addContentToTab(mo.login, mo); // TODO: FIX ME! + $cs.ui.addContentToTab(mo.login, mo); // TODO: FIX ME! - return true; - }; + return true; + }; })(this); this.action.status = (function(elem) { - return function(client, str) { - var mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| state ([^ ]*):(\d+)/.exec(str); + return function(client, str) { + var mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| state ([^ ]*):(\d+)/.exec(str); - if (mch === null) { - return false; - } + if (mch === null) { + return false; + } - $cs.contacts.changeContactStatus(mch[2], elem.msgDecode(mch[6])); // TODO: FIX ME! + $cs.contacts.changeContactStatus(mch[2], elem.msgDecode(mch[6])); // TODO: FIX ME! - return true; - }; + return true; + }; })(this); this.action.login_out = function(client, str) { - var status = 'offline', mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| (login|logout)/.exec(str); + var status = 'offline', mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| (login|logout)/.exec(str); - if (mch === null) { - return false; - } + if (mch === null) { + return false; + } - if (mch[6] === 'login') { - status = 'actif'; - } + if (mch[6] === 'login') { + status = 'actif'; + } - $cs.contacts.changeContactStatus(mch[2], status); // TODO: FIX ME! + $cs.contacts.changeContactStatus(mch[2], status); // TODO: FIX ME! - return true; + return true; }; this.action.who = (function(elem) { return function(client, str) { - var mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| who (\d+) (.*?) (.*?) (\d+) (\d+) (\d+) (\d+) (.*?) (.*?) (.*?) (.*?):(.*) (.*)/.exec(str); + var mch = /user_cmd (\d+):user:.*?:(.*?)@(.*?):.*?:(.*?):(.*?) \| who (\d+) (.*?) (.*?) (\d+) (\d+) (\d+) (\d+) (.*?) (.*?) (.*?) (.*?):(.*) (.*)/.exec(str); - if (mch === null) { - return false; - } + if (mch === null) { + return false; + } - $cs.contacts.changeContactStatus(mch[7], elem.msgDecode(mch[16])); // TODO: FIX ME! + $cs.contacts.changeContactStatus(mch[7], elem.msgDecode(mch[16])); // TODO: FIX ME! - return true; - }; + return true; + }; })(this); }; @@ -101,66 +101,66 @@ NsClient.prototype.connect = function(client, callback) { var login, pwd_socks; if (!client.is_connected) { - login = $cs.opts.get('login'); - pwd_socks = $cs.opts.get('pwd_socks'); - if (login !== null && pwd_socks !== null) { - client.socket.read(function(data) { - var auth = ''; + login = $cs.opts.get('login'); + pwd_socks = $cs.opts.get('pwd_socks'); + if (login !== null && pwd_socks !== null) { + client.socket.read(function(data) { + var auth = ''; - data = data.split(' '); - auth = 'ext_user_log '; - auth += login + ' '; - auth += hex_md5(data[2] + '-' + data[3] + '/' + data[4] + pwd_socks) + ' '; - auth += 'chromesoul chromesoul\n'; - client.socket.write('auth_ag ext_user none none\n', function(inf) { - client.socket.read(function(data) { - client.socket.write(auth, function(inf) { - client.socket.read(function(data) { - if (data === 'rep 002 -- cmd end') { - client.is_connected = true; - console.info('connected to the netsoul server'); - } else { - console.error('authentication failure'); - } - callback(); - }); - }); - }); - }); - }); - } else { - callback(); - } + data = data.split(' '); + auth = 'ext_user_log '; + auth += login + ' '; + auth += hex_md5(data[2] + '-' + data[3] + '/' + data[4] + pwd_socks) + ' '; + auth += 'chromesoul chromesoul\n'; + client.socket.write('auth_ag ext_user none none\n', function(inf) { + client.socket.read(function(data) { + client.socket.write(auth, function(inf) { + client.socket.read(function(data) { + if (data === 'rep 002 -- cmd end') { + client.is_connected = true; + console.info('connected to the netsoul server'); + } else { + console.error('authentication failure'); + } + callback(); + }); + }); + }); + }); + }); + } else { + callback(); + } } else { - callback(); + callback(); } }; NsClient.prototype.disconnect = function(client) { var msg = 'user_cmd msg_user exit\n'; client.socket.write(msg, function() { - client.socket.disconnect(); + client.socket.disconnect(); }); }; NsClient.prototype.changeStatus = function(client) { if (client.is_connected) { - status_msg = 'user_cmd state '; - status_msg += this.msgEncode(client.status) + ':'; - status_msg += Math.round(new Date().getTime() / 1000) + '\n'; - client.socket.write(status_msg, function(inf) { - $cs.ui.onUserStatusChange(client.status); - }); + status_msg = 'user_cmd state '; + status_msg += this.msgEncode(client.status) + ':'; + status_msg += Math.round(new Date().getTime() / 1000) + '\n'; + client.socket.write(status_msg, function(inf) { + $cs.ui.onUserStatusChange(client.status); + }); } else { - $cs.ui.onUserStatusChange(client.status); + $cs.ui.onUserStatusChange(client.status); } }; NsClient.prototype.recv = function(client, data) { for (var i = this.actions_enabled.length - 1; i >= 0; --i) { - if (this.action[this.actions_enabled[i]](client, data)) { - break; - } + if (this.action[this.actions_enabled[i]](client, data)) { + break; + } } }; @@ -173,8 +173,8 @@ NsClient.prototype.addContact = function(client, lst) { var msg = 'user_cmd watch_log_user {' + lst.join(',') + '}\n'; client.socket.write(msg, function(inf) { - var msg = 'user_cmd who {' + lst.join(',') + '}\n'; - client.socket.write(msg, function(inf) {}); + var msg = 'user_cmd who {' + lst.join(',') + '}\n'; + client.socket.write(msg, function(inf) {}); }); }; @@ -184,27 +184,27 @@ NsClient.prototype.rmContact = function(client, name) { NsClient.prototype.replacePairs = function(str, pairs) { for (var i in pairs) { - if (pairs.hasOwnProperty(i)) { - str = str.replace(pairs[i], i); - } + if (pairs.hasOwnProperty(i)) { + str = str.replace(pairs[i], i); + } } return str; } NsClient.prototype.msgDecode = function(msg) { return this.replacePairs(unescape(msg), { - '@': /%40/g, - '*': /%2A/g, - '/': /%2F/g, - '+': /%2B/g + '@': /%40/g, + '*': /%2A/g, + '/': /%2F/g, + '+': /%2B/g }); }; NsClient.prototype.msgEncode = function(msg) { return this.replacePairs(escape(msg), { - '%40': /@/g, - '%2A': /\*/g, - '%2F': /\//g, - '%2B': /\+/g, + '%40': /@/g, + '%2A': /\*/g, + '%2F': /\//g, + '%2B': /\+/g, }); }; diff --git a/lib/nsui.js b/lib/nsui.js index caf174e..45279da 100644 --- a/lib/nsui.js +++ b/lib/nsui.js @@ -21,8 +21,8 @@ var Nsui = function() { Nsui.prototype.setReconnect = function(func) { document.getElementById("user-status").addEventListener("click", function() { - func(); - $cs.contacts.restore(); + func(); + $cs.contacts.restore(); }, false); }; @@ -30,13 +30,13 @@ Nsui.prototype.onUserStatusChange = function(new_status) { var el = document.getElementById("user-status-img"); if (el !== null) { - if (new_status !== "disconnected") { - el.src = 'img/status/me-connected.png'; - } else { - el.src = 'img/status/me-disconnected.png'; - } - el.alt = new_status; - el.title = new_status; + if (new_status !== "disconnected") { + el.src = 'img/status/me-connected.png'; + } else { + el.src = 'img/status/me-disconnected.png'; + } + el.alt = new_status; + el.title = new_status; } }; @@ -52,17 +52,17 @@ Nsui.prototype.deleteTab = function(tab) { var new_tab = this.getNextTab(tab.name); this.tab_lst = this.tab_lst.filter(function(element, index, array) { - return tab.name !== element.name; + return tab.name !== element.name; }); if (new_tab !== null) { - new_tab.show(); + new_tab.show(); } }; Nsui.prototype.hideAllTabs = function() { for (i = this.tab_lst.length - 1; i >= 0; --i) { - this.tab_lst[i].hide(); + this.tab_lst[i].hide(); } }; @@ -70,10 +70,10 @@ Nsui.prototype.getTabByName = function(name) { var i, ret = null; for (i = this.tab_lst.length - 1; i >= 0; --i) { - if (this.tab_lst[i].name === name) { - ret = this.tab_lst[i]; - break ; - } + if (this.tab_lst[i].name === name) { + ret = this.tab_lst[i]; + break ; + } } return ret; @@ -83,13 +83,13 @@ Nsui.prototype.getNextTab = function(current_name) { var i, prev = null; for (i = this.tab_lst.length - 1; i >= 0; --i) { - if (this.tab_lst[i].name === current_name) { - if (prev === null && typeof this.tab_lst[i - 1] !== "undefined") { - prev = this.tab_lst[i - 1]; - } - break ; - } - prev = this.tab_lst[i]; + if (this.tab_lst[i].name === current_name) { + if (prev === null && typeof this.tab_lst[i - 1] !== "undefined") { + prev = this.tab_lst[i - 1]; + } + break ; + } + prev = this.tab_lst[i]; } return prev; @@ -99,12 +99,12 @@ Nsui.prototype.addNewTab = function(tab_name) { var tab = this.getTabByName(tab_name); if (tab === null) { - tab = this.createTab(tab_name); + tab = this.createTab(tab_name); } if (this.tab_lst.length <= 1) { - tab.show(); + tab.show(); } else if (!tab.isCurrent()) { - tab.setActive(); + tab.setActive(); } return tab; @@ -114,46 +114,46 @@ Nsui.prototype.sendNotification = function(image, title, message) { var notif; if (message.lenght > 32) { - message = message.substr(0, 32) + "…"; + message = message.substr(0, 32) + "…"; } - if (typeof chrome.notifications !== "undefined") { - chrome.notifications.create( - '', - { - type: 'basic', - iconUrl: image, - title: title, - message: message, - priority: 0 - }, - function(id) { - setTimeout(function() { - chrome.notifications.clear(id, function() {}); - }, 5000); - } - ); + if (typeof chrome.notifications !== "undefined") { + chrome.notifications.create( + '', + { + type: 'basic', + iconUrl: image, + title: title, + message: message, + priority: 0 + }, + function(id) { + setTimeout(function() { + chrome.notifications.clear(id, function() {}); + }, 5000); + } + ); - chrome.notifications.onClicked.addListener(function(id) { - window.focus(); - chrome.notifications.clear(id, function() {}); - }); + chrome.notifications.onClicked.addListener(function(id) { + window.focus(); + chrome.notifications.clear(id, function() {}); + }); } else { - notif = webkitNotifications.createNotification( - image, - title, - message - ); + notif = webkitNotifications.createNotification( + image, + title, + message + ); - notif.onclick = function() { - window.focus(); - this.cancel(); - }; + notif.onclick = function() { + window.focus(); + this.cancel(); + }; - notif.show(); - setTimeout(function() { - notif.cancel(); - }, 5000); + notif.show(); + setTimeout(function() { + notif.cancel(); + }, 5000); } } @@ -161,16 +161,16 @@ Nsui.prototype.addContentToTab = function(tab_name, content) { var tab = null; if ($cs.opts.get("enable_msg")) { - tab = this.addNewTab(tab_name); - tab.appendMessage(content); + tab = this.addNewTab(tab_name); + tab.appendMessage(content); - if (!this.focus && typeof content.login !== "undefined" && content.login !== null && $cs.opts.get("enable_notif")) { - $cs.avatars.get(content.login, (function(elem) { - return function(url) { - elem.sendNotification(url, content.login, content.message); - }; - })(this)); - } + if (!this.focus && typeof content.login !== "undefined" && content.login !== null && $cs.opts.get("enable_notif")) { + $cs.avatars.get(content.login, (function(elem) { + return function(url) { + elem.sendNotification(url, content.login, content.message); + }; + })(this)); + } } }; @@ -189,9 +189,9 @@ Nsui.prototype.formatMessage = function(msg) { fmt += '' + this.formatInteger(dt.getHours(), 2) + ':' + this.formatInteger(dt.getMinutes(), 2) + ':' + this.formatInteger(dt.getSeconds(), 2) + '
      '; if (typeof msg.login !== "undefined" && msg.login !== null) { - fmt += '' + msg.login + ': '; + fmt += '' + msg.login + ': '; } else { - fmt += '' + document.getElementById('login').value + ': '; + fmt += '' + document.getElementById('login').value + ': '; } fmt += this.sanitizeText(msg.message).replace(lnk_exp, '$1'); @@ -205,59 +205,59 @@ Nsui.prototype.sanitizeText = function(str) { }; Nsui.prototype.currentTabStyle = function() { - $cs.opts.restore(); - if (this.tab_lst.length > 1) { - for (var tab in this.tab_lst) { - if (tab.el_lst.classList.contains("tab-current")) { - tab.chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; - break; - } - } - } - else if (this.tab_lst.length > 0) { - this.tab_lst[0].chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; - } + $cs.opts.restore(); + if (this.tab_lst.length > 1) { + for (var tab in this.tab_lst) { + if (tab.el_lst.classList.contains("tab-current")) { + tab.chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; + break; + } + } + } + else if (this.tab_lst.length > 0) { + this.tab_lst[0].chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; + } }; Nsui.prototype.showContent = function(part_id) { var i, ctn_lst = ["config-pannel", "chat-pannel"]; - if (part_id === "chat-pannel") { - this.currentTabStyle(); - } + if (part_id === "chat-pannel") { + this.currentTabStyle(); + } for (i = ctn_lst.length - 1; i>= 0; --i) { - if (ctn_lst[i] === part_id) { - document.getElementById(ctn_lst[i]).style.display = "block"; - } else { - document.getElementById(ctn_lst[i]).style.display = "none"; - } + if (ctn_lst[i] === part_id) { + document.getElementById(ctn_lst[i]).style.display = "block"; + } else { + document.getElementById(ctn_lst[i]).style.display = "none"; + } } }; Nsui.prototype.switchContent = function(part_id, part_id_to) { if (document.getElementById(part_id).style.display !== "block") { - this.showContent(part_id); + this.showContent(part_id); } else { - this.showContent(part_id_to); + this.showContent(part_id_to); } }; Nsui.prototype.init = function() { window.onfocus = (function(elem) { - return function() { - elem.focus = true; - }; + return function() { + elem.focus = true; + }; })(this); window.onblur = (function(elem) { - return function() { - elem.focus = false; - }; + return function() { + elem.focus = false; + }; })(this); document.getElementById("settings-btn").addEventListener("click", (function(elem) { - return function() { - elem.switchContent("config-pannel", "chat-pannel"); - }; + return function() { + elem.switchContent("config-pannel", "chat-pannel"); + }; })(this), false); Tab.prototype.closeHandler = (function(elem) { @@ -268,7 +268,7 @@ Nsui.prototype.init = function() { Tab.prototype.showHandler = (function(elem) { return function() { - elem.hideAllTabs(); + elem.hideAllTabs(); }; })(this); diff --git a/lib/options.js b/lib/options.js index 500f195..1c0d2c1 100644 --- a/lib/options.js +++ b/lib/options.js @@ -25,36 +25,36 @@ var OptionsManager = function() { OptionsManager.prototype.types = { "get": { - "text": function(elem) { - return elem.value; - }, - "password": function(elem) { - return elem.value; - }, - "checkbox": function(elem) { - return elem.checked; - }, - "number": function(elem) { - return elem.value; - } + "text": function(elem) { + return elem.value; + }, + "password": function(elem) { + return elem.value; + }, + "checkbox": function(elem) { + return elem.checked; + }, + "number": function(elem) { + return elem.value; + } }, "set": { - "text": function(elem, val) { - elem.value = val; - }, - "password": function(elem, val) { - elem.value = val; - }, - "checkbox": function(elem, val) { - if (!val) { - elem.removeAttribute('checked'); - } else { - elem.setAttribute('checked'); - } - }, - "number": function(elem, val) { - elem.value = val; - } + "text": function(elem, val) { + elem.value = val; + }, + "password": function(elem, val) { + elem.value = val; + }, + "checkbox": function(elem, val) { + if (!val) { + elem.removeAttribute('checked'); + } else { + elem.setAttribute('checked'); + } + }, + "number": function(elem, val) { + elem.value = val; + } } }; @@ -62,7 +62,7 @@ OptionsManager.prototype.get = function(name) { var ret = null; if (typeof this.values[name] !== "undefined") { - ret = this.values[name]; + ret = this.values[name]; } return ret; @@ -76,47 +76,47 @@ OptionsManager.prototype.init = function() { this.restore(); if (this.save !== null) { - this.save_btn.addEventListener("click", (function(elem) { - return function() { - elem.save(); - }; - })(this)); + this.save_btn.addEventListener("click", (function(elem) { + return function() { + elem.save(); + }; + })(this)); } }; OptionsManager.prototype.savePart = function(pass) { var i = 0, data = {}, storage; - if (pass) { - storage = this.pass_storage; + if (pass) { + storage = this.pass_storage; } else { - storage = this.storage; + storage = this.storage; } if (this.opts !== null) { - for (i = this.opts.length - 1; i >= 0; --i) { - if ((pass && (this.getElemType(this.opts[i]) === "password" || this.getElemType(this.opts[i]) === "text")) - || (!pass && this.getElemType(this.opts[i]) !== "password" && this.getElemType(this.opts[i]) !== "text")) { - data[this.opts[i].id] = this.getElemValue(this.opts[i]); - this.values[this.opts[i].id] = data[this.opts[i].id]; - } - } - storage.set(data, (function(elem) { + for (i = this.opts.length - 1; i >= 0; --i) { + if ((pass && (this.getElemType(this.opts[i]) === "password" || this.getElemType(this.opts[i]) === "text")) + || (!pass && this.getElemType(this.opts[i]) !== "password" && this.getElemType(this.opts[i]) !== "text")) { + data[this.opts[i].id] = this.getElemValue(this.opts[i]); + this.values[this.opts[i].id] = data[this.opts[i].id]; + } + } + storage.set(data, (function(elem) { return function () { - if (elem !== null) { + if (elem !== null) { elem.innerHTML = "Options saved."; setTimeout(function() { - elem.innerHTML = ""; + elem.innerHTML = ""; }, 3000); - } + } }; - })(this.status)); + })(this.status)); } }; OptionsManager.prototype.save = function() { this.savePart(true); - this.savePart(false); + this.savePart(false); }; OptionsManager.prototype.restore = function() { @@ -125,7 +125,7 @@ OptionsManager.prototype.restore = function() { for (i in items) { el = document.getElementById(i); if (el !== null) { - elem.values[i] = items[i]; + elem.values[i] = items[i]; elem.setElemValue(el, items[i]); } } @@ -144,7 +144,7 @@ OptionsManager.prototype.getElemValue = function(elem) { var val = null, type = this.getElemType(elem); if (typeof this.types.get[type] !== "undefined") { - val = this.types.get[type](elem); + val = this.types.get[type](elem); } return val; @@ -154,7 +154,7 @@ OptionsManager.prototype.setElemValue = function(elem, val) { var type = elem.getAttribute('type'); if (typeof this.types.set[type] !== "undefined") { - this.types.set[type](elem, val); + this.types.set[type](elem, val); } }; diff --git a/lib/tab.nsui.js b/lib/tab.nsui.js old mode 100755 new mode 100644 index 9765ad7..cdcb0f6 --- a/lib/tab.nsui.js +++ b/lib/tab.nsui.js @@ -22,7 +22,7 @@ var Tab = function(name) { this.buff_len = 1000; this.history_index = 0; this.history = []; - $cs.opts.restore(); + $cs.opts.restore(); this.initListElement(); this.initBodyElement(); }; @@ -63,53 +63,53 @@ Tab.prototype.initListElement = function() { Tab.prototype.initBodyElement = function() { var chat_input_w = document.createElement("div"); - + this.chat_input = document.createElement("input"); this.chat_input.placeholder = "Some text here..."; - + this.chat_log = document.createElement("p"); this.chat_log.classList.add("chat-log"); - this.chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; - + this.chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; + this.el_body = document.createElement("div"); this.el_body.classList.add("tab-body"); this.el_body.id = this.name; this.el_body.style.display = "none"; - + chat_input_w.classList.add("chat-input-wrapper"); - + this.chat_input.classList.add("chat-input"); this.chat_input.setAttribute("type", "text"); this.chat_input.addEventListener("keyup", (function(elem) { - return function(event) { - var key_submit = 13, key_up = 38, key_down = 40; + return function(event) { + var key_submit = 13, key_up = 38, key_down = 40; - if (event.keyCode === key_submit && this.value != "") { - var msg = this.value; - this.value = ""; + if (event.keyCode === key_submit && this.value != "") { + var msg = this.value; + this.value = ""; - if (typeof $cs.client !== "undefined" && $cs.opts.get("enable_msg")) { - $cs.client.speak(elem.name, msg); - $cs.ui.addContentToTab(elem.name, {"message": msg}); - } else { - console.error("chromesoul client not found"); - } - } else if (event.keyCode === key_up) { - if (elem.history_index < elem.history.length) { - elem.history_index++; - this.value = elem.history[elem.history.length - elem.history_index]; - } - } else if (event.keyCode === key_down) { - if (elem.history_index > 0) { - elem.history_index--; - if (elem.history_index > 0) { - this.value = elem.history[elem.history.length - elem.history_index]; - } else { - this.value = ""; - } - } - } - }; + if (typeof $cs.client !== "undefined" && $cs.opts.get("enable_msg")) { + $cs.client.speak(elem.name, msg); + $cs.ui.addContentToTab(elem.name, {"message": msg}); + } else { + console.error("chromesoul client not found"); + } + } else if (event.keyCode === key_up) { + if (elem.history_index < elem.history.length) { + elem.history_index++; + this.value = elem.history[elem.history.length - elem.history_index]; + } + } else if (event.keyCode === key_down) { + if (elem.history_index > 0) { + elem.history_index--; + if (elem.history_index > 0) { + this.value = elem.history[elem.history.length - elem.history_index]; + } else { + this.value = ""; + } + } + } + }; })(this), false); chat_input_w.appendChild(this.chat_input); @@ -120,7 +120,7 @@ Tab.prototype.initBodyElement = function() { Tab.prototype.close = function() { if (typeof this.closeHandler !== "undefined") { - this.closeHandler(); + this.closeHandler(); } this.wr_body.removeChild(this.el_body); this.wr_lst.removeChild(this.el_lst); @@ -132,16 +132,16 @@ Tab.prototype.hide = function() { }; Tab.prototype.show = function() { - this.options.restore(); + this.options.restore(); if (typeof this.showHandler !== "undefined") { - this.showHandler(); + this.showHandler(); } this.el_lst.classList.remove("tab-active"); this.el_lst.classList.add("tab-current"); this.el_body.style.display = "block"; - $cs.opts.restore() + $cs.opts.restore() this.chat_log.scrollTop = 42000; - this.chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; + this.chat_log.style.fontSize = $cs.opts.values["chat-size"] + "px"; this.chat_input.focus(); }; @@ -155,19 +155,19 @@ Tab.prototype.setActive = function() { Tab.prototype.flushText = function() { while (this.chat_log.children.length > this.buff_len) { - this.chat_log.removeChild(this.chat_log.children[0]); + this.chat_log.removeChild(this.chat_log.children[0]); } while (this.history.length > this.buff_len) { - this.history.shift(); + this.history.shift(); } }; Tab.prototype.appendMessage = function(msg) { this.history_index = 0; this.chat_log.innerHTML += '
      ' + $cs.ui.formatMessage(msg) + '
      '; - + if (!(typeof msg.login !== "undefined" && msg.login !== null)) { - this.history.push(msg.message); + this.history.push(msg.message); } this.flushText(); this.chat_log.scrollTop = 42 * this.buff_len; diff --git a/lib/txt_socket.js b/lib/txt_socket.js index 0bea6b4..1d9fcf6 100644 --- a/lib/txt_socket.js +++ b/lib/txt_socket.js @@ -22,17 +22,17 @@ var TxtSocket = function() { TxtSocket.prototype.connect = function(host, port, callback) { chrome.socket.create('tcp', {}, (function(elem) { - return function(inf) { - elem.socket_id = inf.socketId; - chrome.socket.connect(elem.socket_id, host, port, callback); - }; + return function(inf) { + elem.socket_id = inf.socketId; + chrome.socket.connect(elem.socket_id, host, port, callback); + }; })(this)); }; TxtSocket.prototype.disconnect = function() { if (this.socket_id !== null) { - chrome.socket.disconnect(this.socket_id); - chrome.socket.destroy(this.socket_id); + chrome.socket.disconnect(this.socket_id); + chrome.socket.destroy(this.socket_id); } }; @@ -40,32 +40,32 @@ TxtSocket.prototype.read = function(callback) { var tmp = '', offset = this.buffer.indexOf("\n"); if (offset === -1) { - chrome.socket.read(this.socket_id, (function(elem) { - return function(rd_inf) { - if (rd_inf.resultCode > 0) { - elem.buffer += elem.ab2str(rd_inf.data); - elem.read(callback); - } else { - elem.throwError({code: rd_inf.resultCode}); - } - }; - })(this)); + chrome.socket.read(this.socket_id, (function(elem) { + return function(rd_inf) { + if (rd_inf.resultCode > 0) { + elem.buffer += elem.ab2str(rd_inf.data); + elem.read(callback); + } else { + elem.throwError({code: rd_inf.resultCode}); + } + }; + })(this)); } else { - tmp = this.buffer.substr(0, offset); - this.buffer = this.buffer.substr(offset + 1); - callback(tmp); + tmp = this.buffer.substr(0, offset); + this.buffer = this.buffer.substr(offset + 1); + callback(tmp); } }; TxtSocket.prototype.write = function(str, callback) { chrome.socket.write(this.socket_id, this.str2ab(str), (function(elem) { - return function(w_inf) { - if (w_inf.bytesWritten >= 0) { - callback(w_inf); - } else { - elem.throwError({code: w_inf.bytesWritten}); - } - }; + return function(w_inf) { + if (w_inf.bytesWritten >= 0) { + callback(w_inf); + } else { + elem.throwError({code: w_inf.bytesWritten}); + } + }; })(this)); }; @@ -83,7 +83,7 @@ TxtSocket.prototype.str2ab = function(str) { var i = 0, buff = new ArrayBuffer(str.length), buff_v = new Uint8Array(buff); for (i = str.length - 1; i >= 0; --i) { - buff_v[i] = str.charCodeAt(i); + buff_v[i] = str.charCodeAt(i); } return buff; diff --git a/manifest.json b/manifest.json index e427cd9..4c48539 100644 --- a/manifest.json +++ b/manifest.json @@ -6,18 +6,18 @@ "offline_enabled": false, "description": "Netsoul client for Google Chrome.", "icons": { - "16": "icon_16.png", - "128": "icon_128.png" + "16": "icon_16.png", + "128": "icon_128.png" }, "app": { - "background": { - "scripts": ["background.js"] - } + "background": { + "scripts": ["background.js"] + } }, "permissions": [ - "http://cdn.local.epitech.net/userprofil/profilview/", - "storage", - "notifications", - {"socket": ["tcp-connect:ns-server.epita.fr:4242"]} + "http://cdn.local.epitech.net/userprofil/profilview/", + "storage", + "notifications", + {"socket": ["tcp-connect:ns-server.epita.fr:4242"]} ] } From d1cc85274ad5ecdff04ac09f297540170f1eb73a Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 18:55:37 +0100 Subject: [PATCH 02/10] adding SirBelga to the credits file --- CREDITS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.md b/CREDITS.md index 80129b7..291abfd 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -2,6 +2,7 @@ * [Rodolphe Breard](http://blog.uraniborg.net/) (development) * [Romain Mardargent](http://ro-maen.com/) (design) +* [SirBelga](https://github.com/SirBelga) (the mysterious merge-request guy who contributes to the code) ### Special thanks From a95faa4e4fda4c16205afaddefad80234826d587 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 19:00:58 +0100 Subject: [PATCH 03/10] converting the chat font-size number input to a slider --- chromesoul.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromesoul.html b/chromesoul.html index 2b74add..a5624b9 100644 --- a/chromesoul.html +++ b/chromesoul.html @@ -23,7 +23,7 @@


      -
      +
      From 17c2a83c1900a075dca237a5ed7d8a7e2fd54379 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 19:04:11 +0100 Subject: [PATCH 04/10] incrementing the version number --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4c48539..3c9340d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "Chromesoul", - "version": "0.5.7", + "version": "0.6.0", "minimum_chrome_version": "25", "manifest_version": 2, "offline_enabled": false, From 6ea048482e220e6d7f85ea32d7f791ba6b242ba0 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 19:52:42 +0100 Subject: [PATCH 05/10] adding packaging tool --- Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..952159b --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +NAME = chromesoul +VERSION = $(shell cat manifest.json | /bin/grep '"version"' | cut -d '"' -f 4) +SRC = background.js \ + chromesoul.css \ + chromesoul.html \ + chromesoul.js \ + CREDITS.md \icon_128.png \ + icon_16.png \ + img \ + lib \ + LICENCE.txt \ + manifest.json \ + README.md \ + third-party +PUBDIR = publish +ARCHIVE = $(PUBDIR)/chromesoul_$(VERSION).zip + +all: + zip -r $(ARCHIVE) $(SRC) + rm -f $(PUBDIR)/chromesoul.zip + ln -s $(ARCHIVE) $(PUBDIR)/chromesoul.zip From 77d0a58646399eaa5eeaac4e3058a3e75bd5203e Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 20:03:46 +0100 Subject: [PATCH 06/10] quick and dirty bugfix --- lib/tab.nsui.js | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tab.nsui.js b/lib/tab.nsui.js index cdcb0f6..c2c04fe 100644 --- a/lib/tab.nsui.js +++ b/lib/tab.nsui.js @@ -132,7 +132,7 @@ Tab.prototype.hide = function() { }; Tab.prototype.show = function() { - this.options.restore(); + //this.options.restore(); if (typeof this.showHandler !== "undefined") { this.showHandler(); } diff --git a/manifest.json b/manifest.json index 3c9340d..5ef4e7e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "Chromesoul", - "version": "0.6.0", + "version": "0.6.1", "minimum_chrome_version": "25", "manifest_version": 2, "offline_enabled": false, From c0460496dd32ff9aa6d85e718a2d1f47a4ed51ad Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 20:52:11 +0100 Subject: [PATCH 07/10] font size enabled, closing issue #4 --- chromesoul.html | 2 +- lib/options.js | 6 ++++++ lib/tab.nsui.js | 2 -- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/chromesoul.html b/chromesoul.html index a5624b9..6dff6f7 100644 --- a/chromesoul.html +++ b/chromesoul.html @@ -5,7 +5,7 @@ Chromesoul - +

      disconnected

      diff --git a/lib/options.js b/lib/options.js index 1c0d2c1..39c516c 100644 --- a/lib/options.js +++ b/lib/options.js @@ -82,6 +82,12 @@ OptionsManager.prototype.init = function() { }; })(this)); } + + var chat_size = document.getElementById("chat-size"); + chat_size.addEventListener("change", function() { + var body = document.getElementById("body-id"); + body.style.fontSize = chat_size.value + "px"; + }, false); }; OptionsManager.prototype.savePart = function(pass) { diff --git a/lib/tab.nsui.js b/lib/tab.nsui.js index c2c04fe..c313140 100644 --- a/lib/tab.nsui.js +++ b/lib/tab.nsui.js @@ -22,7 +22,6 @@ var Tab = function(name) { this.buff_len = 1000; this.history_index = 0; this.history = []; - $cs.opts.restore(); this.initListElement(); this.initBodyElement(); }; @@ -132,7 +131,6 @@ Tab.prototype.hide = function() { }; Tab.prototype.show = function() { - //this.options.restore(); if (typeof this.showHandler !== "undefined") { this.showHandler(); } From 739d6ce883e080ae69e92d9f4f3316dc93b573c9 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Thu, 6 Nov 2014 20:52:43 +0100 Subject: [PATCH 08/10] incrementing version number --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 5ef4e7e..4060ff5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "Chromesoul", - "version": "0.6.1", + "version": "0.6.2", "minimum_chrome_version": "25", "manifest_version": 2, "offline_enabled": false, From 9ac3be8c2be683d120ee27b16f05e089e6a94cf5 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 17 Apr 2016 11:32:54 +0200 Subject: [PATCH 09/10] Ignore vim's swap files. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3265426..1896ae2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ test* publish +*.swp From 03cb5406cf4d6710fca8c5174e7d12f7a369f8c7 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 17 Apr 2016 11:38:56 +0200 Subject: [PATCH 10/10] Add an explicit privacy policy Google now requires applications published on the web store to publish a privacy policy. Chromesoul's implicit "no log, no analytic" policy is therefore now explicitly written. https://blog.chromium.org/2016/04/ensuring-transparency-and-choice-in.html https://developer.chrome.com/webstore/program_policies#userdata https://developer.chrome.com/webstore/user_data --- PRIVACY.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 PRIVACY.md diff --git a/PRIVACY.md b/PRIVACY.md new file mode 100644 index 0000000..245c0d0 --- /dev/null +++ b/PRIVACY.md @@ -0,0 +1,5 @@ +## Privacy policy + +Chromesoul is an instant messaging client, hence you need to supply your identification information in order to connect to the server. Your password is stored in Chrome's local storage and is not shared with anyone else than the server you want to connect to. Your login and contact list are stored in Chrome's synced storage, which implies that if you are logged in with a Google account, it will be shared with others Chrome browsers where you are logged in with your Google account. You can read more about how Google encrypts the synced data: [set or change a sync passphrase](https://support.google.com/chrome/answer/1181035) + +In order to protect your privacy, Chromesoul does not log any conversation or activity and does not retrieve any analytic data. However, the server you connect to is not edited, maintained or affiliated in any way with Chromesoul and therefore may follow a different privacy policy.