From ce4d9df665146045dab8b20abd62e5ca68a6a8aa Mon Sep 17 00:00:00 2001 From: andrehjr Date: Tue, 15 Nov 2011 21:33:43 -0200 Subject: [PATCH 1/2] Fix issue #182: Pad forgets usernames --- static/js/pad2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/pad2.js b/static/js/pad2.js index 9df57ae8f..394eb4c71 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -81,7 +81,7 @@ function getParams() { var showControls = getUrlVars()["showControls"]; var showChat = getUrlVars()["showChat"]; - var userName = unescape(getUrlVars()["userName"]); + var userName = getUrlVars()["userName"]; var showLineNumbers = getUrlVars()["showLineNumbers"]; var useMonospaceFont = getUrlVars()["useMonospaceFont"]; var IsnoColors = getUrlVars()["noColors"]; @@ -130,7 +130,7 @@ function getParams() if(userName) { // If the username is set as a parameter we should set a global value that we can call once we have initiated the pad. - globalUserName = userName; + globalUserName = unescape(userName); } } From 8e7e74170e480a5ceebade3ee3e23347043171ae Mon Sep 17 00:00:00 2001 From: andrehjr Date: Tue, 15 Nov 2011 21:36:26 -0200 Subject: [PATCH 2/2] Extract getUrlVars() function calls to a local var --- static/js/pad2.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/static/js/pad2.js b/static/js/pad2.js index 394eb4c71..d6429eea9 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -79,12 +79,13 @@ function randomString() function getParams() { - var showControls = getUrlVars()["showControls"]; - var showChat = getUrlVars()["showChat"]; - var userName = getUrlVars()["userName"]; - var showLineNumbers = getUrlVars()["showLineNumbers"]; - var useMonospaceFont = getUrlVars()["useMonospaceFont"]; - var IsnoColors = getUrlVars()["noColors"]; + var params = getUrlVars() + var showControls = params["showControls"]; + var showChat = params["showChat"]; + var userName = params["userName"]; + var showLineNumbers = params["showLineNumbers"]; + var useMonospaceFont = params["useMonospaceFont"]; + var IsnoColors = params["noColors"]; if(IsnoColors) {