author | Michael Krelin <hacker@klever.net> | 2006-10-02 19:51:26 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-10-02 19:51:26 (UTC) |
commit | 5ebff6dee62ada9c0559f65381ccd92892911151 (patch) (unidiff) | |
tree | ca36d8fd3da98846eda11d38cc049ff6dd8c5915 | |
parent | b568e40a49d810d49bcc4af3bcb81ee1812627a5 (diff) | |
download | fireflix-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
-rw-r--r-- | content/fireflix.js | 12 | ||||
-rw-r--r-- | locale/en-US/fireflix.properties | 2 |
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 = { | |||
798 | } | 798 | } |
799 | }, | 799 | }, |
800 | render_description_frame: function(content) { | 800 | render_description_frame: function(content) { |
801 | if(!content) { | ||
802 | this.searchresult_description.innerHTML = ''; | 801 | this.searchresult_description.innerHTML = ''; |
803 | }else{ | 802 | if(content) { |
804 | this.searchresult_description.innerHTML = content?content:''; | 803 | var dp = new DOMParser(); |
804 | var pd = dp.parseFromString( | ||
805 | '<div xmlns="http://www.w3.org/1999/xhtml">'+content+'</div>', 'text/xml' ); | ||
806 | var de = pd.documentElement; | ||
807 | if(de.tagName=='parsererror') | ||
808 | this.searchresult_description.innerHTML=this.fireflix.loc_strings.getString('broken_description'); | ||
809 | else | ||
810 | this.searchresult_description.appendChild(de); | ||
805 | /* of all linking elements flickr only allows a */ | 811 | /* of all linking elements flickr only allows a */ |
806 | var as = this.searchresult_description.getElementsByTagName('a'); | 812 | var as = this.searchresult_description.getElementsByTagName('a'); |
807 | for(var a=0;a<as.length;++a) | 813 | 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 | |||
11 | urltype_p=Flickr photo URL | 11 | urltype_p=Flickr photo URL |
12 | 12 | ||
13 | search_page=Page %S of %S | 13 | search_page=Page %S of %S |
14 | |||
15 | broken_description=Broken photo description | ||