kxcd caption

By tds Last update Feb 19, 2010 — Installed 682 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 4 posts, 3 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Ilmari Karonen Scriptwright
You seem to have an escaping bug in this script. The lines that read:
var caption = document.createElement('div');
caption.innerHTML = '<p>' + title + '<p/>';
should instead read something like:
var caption = document.createElement('p');
caption.appendChild(document.createTextNode(title));
That way, it'll work correctly even if the comic title happens to contain HTML tags (which, xkcd being xkcd, wouldn't surprise me at all). It's not quite the same otherwise ? my code creates a single

tag, yours creates a

with two

s, the second one empty ? but that's a minor difference you can easily correct if it matters.

 
tds Script's Author

Updated the meta-data to work correctly on all urls.

 
tds Script's Author

Now supports both the standard comics, and any of the large-format comics that are buried under a hyperlink.

Also improved meta-data so it applies itself to xkcd.org/.net/.com

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel