aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRael <rael.gc@gmail.com>2015-10-15 09:50:35 -0300
committerRael <rael.gc@gmail.com>2015-10-15 09:50:35 -0300
commit9b54dd0942b12166c4e1d85b7746751363fba26c (patch)
tree14ae0abd113e01e73e1c82b469ca43bcfeb1cf4e
parent4d14786f46aba895293970eef68b308cf4fcd2e6 (diff)
downloadscudcloud-9b54dd0942b12166c4e1d85b7746751363fba26c.zip
scudcloud-9b54dd0942b12166c4e1d85b7746751363fba26c.tar.gz
scudcloud-9b54dd0942b12166c4e1d85b7746751363fba26c.tar.bz2
Escaping single quotes in leftpane JS (#258)
-rw-r--r--scudcloud-1.0/leftpane-src.js18
-rw-r--r--scudcloud-1.0/resources/leftpane.js2
2 files changed, 11 insertions, 9 deletions
diff --git a/scudcloud-1.0/leftpane-src.js b/scudcloud-1.0/leftpane-src.js
index ae44fb5..40856f0 100644
--- a/scudcloud-1.0/leftpane-src.js
+++ b/scudcloud-1.0/leftpane-src.js
@@ -1,19 +1,21 @@
var LeftPane = {
addTeam: function(id, name, url, icon, active){
var node = document.getElementById(id);
- if(node == null){
+ if(node === null){
var ul = document.getElementById('teams');
li = document.createElement('li');
li.id = id;
- li.setAttribute("onclick", "LeftPane.switchTo('"+id+"','"+url+"')")
- li.setAttribute("title", name)
+ li.setAttribute("onclick", "LeftPane.switchTo('"+id.replace(/'/g, '&quot;')+"','"+url.replace(/'/g, '&quot;')+"')");
+ li.setAttribute("title", name);
li.innerHTML = name[0];
if( icon ){
li.style.backgroundImage = "url('"+ icon +"')";
- li.innerHTML = ""
+ li.innerHTML = "";
}
ul.appendChild(li);
- if(active) LeftPane.setActive(id);
+ if(active){
+ LeftPane.setActive(id);
+ }
LeftPane.switchTo(id, url);
}
},
@@ -33,7 +35,7 @@ var LeftPane = {
document.getElementById(team).classList.remove('alert');
},
switchTo: function(id, url){
- leftPane.switchTo(url)
+ leftPane.switchTo(url);
LeftPane.setActive(id);
},
setActive: function(id){
@@ -57,10 +59,10 @@ var LeftPane = {
if (index >= list.length) {
index = 0;
} else if (index < 0) {
- index = list.length - 1
+ index = list.length - 1;
}
LeftPane.click(index);
}
-}
+};
diff --git a/scudcloud-1.0/resources/leftpane.js b/scudcloud-1.0/resources/leftpane.js
index 1ae607e..1138579 100644
--- a/scudcloud-1.0/resources/leftpane.js
+++ b/scudcloud-1.0/resources/leftpane.js
@@ -1 +1 @@
-var LeftPane={addTeam:function(e,t,n,l,i){var c=document.getElementById(e);if(null==c){var a=document.getElementById("teams");li=document.createElement("li"),li.id=e,li.setAttribute("onclick","LeftPane.switchTo('"+e+"','"+n+"')"),li.setAttribute("title",t),li.innerHTML=t[0],l&&(li.style.backgroundImage="url('"+l+"')",li.innerHTML=""),a.appendChild(li),i&&LeftPane.setActive(e),LeftPane.switchTo(e,n)}},click:function(e){for(var t=document.getElementsByTagName("li"),n=0;n<t.length;n++)if(e==n){t[n].click();break}},alert:function(e){document.getElementById(e).classList.add("alert")},stopAlert:function(e){document.getElementById(e).classList.remove("alert")},switchTo:function(e,t){leftPane.switchTo(t),LeftPane.setActive(e)},setActive:function(e){for(var t=document.getElementsByTagName("li"),n=0;n<t.length;n++)t[n].className="inactive";document.getElementById(e).className="active"},clickNext:function(e){for(var t=document.getElementsByTagName("li"),n=0;n<t.length&&"active"!=t[n].className;n++);n+=e,n>=t.length?n=0:0>n&&(n=t.length-1),LeftPane.click(n)}};
+var LeftPane={addTeam:function(e,t,n,l,i){var c=document.getElementById(e);if(null===c){var a=document.getElementById("teams");li=document.createElement("li"),li.id=e,li.setAttribute("onclick","LeftPane.switchTo('"+e.replace(/'/g,"&quot;")+"','"+n.replace(/'/g,"&quot;")+"')"),li.setAttribute("title",t),li.innerHTML=t[0],l&&(li.style.backgroundImage="url('"+l+"')",li.innerHTML=""),a.appendChild(li),i&&LeftPane.setActive(e),LeftPane.switchTo(e,n)}},click:function(e){for(var t=document.getElementsByTagName("li"),n=0;n<t.length;n++)if(e==n){t[n].click();break}},alert:function(e){document.getElementById(e).classList.add("alert")},stopAlert:function(e){document.getElementById(e).classList.remove("alert")},switchTo:function(e,t){leftPane.switchTo(t),LeftPane.setActive(e)},setActive:function(e){for(var t=document.getElementsByTagName("li"),n=0;n<t.length;n++)t[n].className="inactive";document.getElementById(e).className="active"},clickNext:function(e){for(var t=document.getElementsByTagName("li"),n=0;n<t.length&&"active"!=t[n].className;n++);n+=e,n>=t.length?n=0:0>n&&(n=t.length-1),LeftPane.click(n)}};