FIX: More safety when displaying link counts on blogs

This commit is contained in:
Robin Ward
2014-05-20 15:20:02 -04:00
parent 9445bea530
commit 6dd1880f1f
2 changed files with 16 additions and 11 deletions

View File

@ -40,13 +40,14 @@
if (countFor.length > 0) {
// Send JSONP request for the counts
var d = document.createElement('script');
d.src = discourseUrl + "embed/count?callback=discourseUpdateCounts";
var d = document.createElement('script'),
srcUrl = discourseUrl + "embed/count?callback=discourseUpdateCounts";
for (var j=0; j<countFor.length; j++) {
d.src += "&" + "embed_url[]=" + encodeURIComponent(countFor[j]);
srcUrl += "&" + "embed_url[]=" + encodeURIComponent(countFor[j]);
}
d.src = srcUrl;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
}
})();
})();