diff --git a/UI/WebServerResources/JavascriptAPIExtensions.js b/UI/WebServerResources/JavascriptAPIExtensions.js index 2e39fe69a..69aa6bd5e 100644 --- a/UI/WebServerResources/JavascriptAPIExtensions.js +++ b/UI/WebServerResources/JavascriptAPIExtensions.js @@ -343,3 +343,11 @@ String.prototype._base64_utf8_decode = function() { return string; }; + +String.prototype.cssSafeString = function() { + var newString = this.replace("#", "_", "g"); + newString = newString.replace(".", "_", "g"); + newString = newString.replace("@", "_", "g"); + + return newString; +} diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 0fb99c34f..fc864847b 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -374,7 +374,7 @@ function tasksListCallback(http) { $(listItem).addClassName(data[i][5]); var owner = data[i][1]; listItem.owner = owner; - $(listItem).addClassName("ownerIs" + owner); + $(listItem).addClassName("ownerIs" + owner.cssSafeString()); listItem.cname = escape(data[i][0]); var input = document.createElement("input"); input.setAttribute("type", "checkbox"); @@ -723,7 +723,7 @@ function newEventDIV(cname, owner, starts, lasts, var innerDiv = document.createElement("div"); eventDiv.appendChild(innerDiv); $(innerDiv).addClassName("eventInside"); - $(innerDiv).addClassName("ownerIs" + owner); + $(innerDiv).addClassName("ownerIs" + owner.cssSafeString()); var gradientDiv = document.createElement("div"); innerDiv.appendChild(gradientDiv); @@ -1390,16 +1390,16 @@ function appendCalendar(folderName, folder) { var theRules = new Array(); var lastSheet = document.styleSheets[document.styleSheets.length - 1]; if (lastSheet.insertRule) { // Mozilla - lastSheet.insertRule('.ownerIs' + contactId + ' {' + lastSheet.insertRule('.ownerIs' + contactId.cssSafeString() + ' {' + ' background-color: ' + color + ' !important; }', 0); } else { // IE - lastSheet.addRule('.ownerIs' + contactId, - ' background-color: ' - + color - + ' !important; }'); + lastSheet.addRule('.ownerIs' + contactId.cssSafeString(), + ' background-color: ' + + color + + ' !important; }'); } }