summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-10-02 19:51:26 (UTC)
committer Michael Krelin <hacker@klever.net>2006-10-02 19:51:26 (UTC)
commit5ebff6dee62ada9c0559f65381ccd92892911151 (patch) (side-by-side diff)
treeca36d8fd3da98846eda11d38cc049ff6dd8c5915
parentb568e40a49d810d49bcc4af3bcb81ee1812627a5 (diff)
downloadfireflix-5ebff6dee62ada9c0559f65381ccd92892911151.zip
fireflix-5ebff6dee62ada9c0559f65381ccd92892911151.tar.gz
fireflix-5ebff6dee62ada9c0559f65381ccd92892911151.tar.bz2
preparse photo descriptions to avoid breaking things because of invalid html in description
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@181 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--content/fireflix.js12
-rw-r--r--locale/en-US/fireflix.properties2
2 files changed, 11 insertions, 3 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index 92c42f4..966630c 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -798,10 +798,16 @@ var fireflix = {
}
},
render_description_frame: function(content) {
- if(!content) {
this.searchresult_description.innerHTML = '';
- }else{
- this.searchresult_description.innerHTML = content?content:'';
+ if(content) {
+ var dp = new DOMParser();
+ var pd = dp.parseFromString(
+ '<div xmlns="http://www.w3.org/1999/xhtml">'+content+'</div>', 'text/xml' );
+ var de = pd.documentElement;
+ if(de.tagName=='parsererror')
+ this.searchresult_description.innerHTML=this.fireflix.loc_strings.getString('broken_description');
+ else
+ this.searchresult_description.appendChild(de);
/* of all linking elements flickr only allows a */
var as = this.searchresult_description.getElementsByTagName('a');
for(var a=0;a<as.length;++a)
diff --git a/locale/en-US/fireflix.properties b/locale/en-US/fireflix.properties
index 18300ff..f583040 100644
--- a/locale/en-US/fireflix.properties
+++ b/locale/en-US/fireflix.properties
@@ -11,3 +11,5 @@ urltype_o=Original image
urltype_p=Flickr photo URL
search_page=Page %S of %S
+
+broken_description=Broken photo description