OSDN Git Service

fixed critical bug! read escape fixed.
authorelixirel <elixirel@users.sourceforge.jp>
Sat, 6 Jun 2009 03:22:09 +0000 (12:22 +0900)
committerelixirel <elixirel@users.sourceforge.jp>
Sat, 6 Jun 2009 03:22:09 +0000 (12:22 +0900)
js/lunardial/feedblog_gen.js

index 88f3039..1e18d81 100644 (file)
@@ -202,8 +202,10 @@ function entryLoader(index){
         editIndex = -1;
     }
     else {
+        var temp_content = entryList[index].content;
+        alert(temp_content);
         document.getElementById("entry_title").value = entryList[index].title;
-        document.getElementById("entry_stdin").value = entryList[index].content;
+        document.getElementById("entry_stdin").value = temp_content;
         editIndex = index;
     }
 }
@@ -228,15 +230,15 @@ function refleshEntrylistBox(){
  * @param {Object} obj
  */
 function FeedInfo(obj){
-    this.title = xmlAttrContentUnescape($("title:first", obj).text());
-    this.subtitle = xmlAttrContentUnescape($("subtitle:first", obj).text());
-    this.self = xmlAttrContentUnescape($("link[rel=self]", obj).attr("href"));
-    this.alternate = xmlAttrContentUnescape($("link[rel=alternate]", obj).attr("href"));
-    this.updated = xmlAttrContentUnescape($("updated:first", obj).text());
-    this.id = xmlAttrContentUnescape($("id:first", obj).text());
-    this.rights = xmlAttrContentUnescape($("rights:first", obj).text());
-    this.authorname = xmlAttrContentUnescape($("author>name", obj).text());
-    this.authoremail = xmlAttrContentUnescape($("author>email", obj).text());
+    this.title = $("title:first", obj).text();
+    this.subtitle = $("subtitle:first", obj).text();
+    this.self = $("link[rel=self]", obj).attr("href");
+    this.alternate = $("link[rel=alternate]", obj).attr("href");
+    this.updated = $("updated:first", obj).text();
+    this.id = $("id:first", obj).text();
+    this.rights = $("rights:first", obj).text();
+    this.authorname = $("author>name", obj).text();
+    this.authoremail = $("author>email", obj).text();
 }
 
 /**
@@ -244,14 +246,13 @@ function FeedInfo(obj){
  * @param {Object} obj entry 要素の DOM オブジェクト
  */
 function Entry(obj){
-    this.id = xmlAttrContentUnescape($("id:first", obj).text());
-    this.title = xmlAttrContentUnescape($("title:first", obj).text());
-    this.summary = xmlAttrContentUnescape($("summary:first", obj).text());
-    this.published = xmlAttrContentUnescape($("published:first", obj).text());
-    this.updated = xmlAttrContentUnescape($("updated:first", obj).text());
-    this.link = xmlAttrContentUnescape($("link:first", obj).attr("href"));
-    this.content = xmlAttrContentUnescape($("content:first", obj).text());
-    this.content = xmlAttrContentUnescape(this.content);
+    this.id = $("id:first", obj).text();
+    this.title = $("title:first", obj).text();
+    this.summary = $("summary:first", obj).text();
+    this.published = $("published:first", obj).text();
+    this.updated = $("updated:first", obj).text();
+    this.link = $("link:first", obj).attr("href");
+    this.content = $("content:first", obj).text();
     
     if (inputValidateMode == 1) {
         this.content = this.content.replace(/[\r\n]|\r\n/g, "");
@@ -317,7 +318,6 @@ function toXml(finfo, elist){
 function convertContent(content){
     if (document.getElementById("addContentBr").checked) {
         content = content.replace(/[\n\r]|\r\n/g, "<br>\n");
-        // content = content.replace(/(<br>|<\/p>|<\/h\d>|<\/div>)(?=[^\n])/ig, "$1\n");
     }
     else {
         content = content.replace(/<br>/ig, "\n");
@@ -335,11 +335,12 @@ function xmlAttrContentEscape(str){
 }
 
 /**
- * XMLのエスケープを行う関数
- * @param {String} str エスケープを行う文字列
+ * XMLの逆エスケープを行う関数
+ * バグあり!&amp;の処理がおかしい
+ * @param {String} str 逆エスケープを行う文字列
  */
 function xmlAttrContentUnescape(str){
-    return str.replace(/&quot;/g, '"').replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");
+    return str.replace(/&nbsp;/g, " ").replace(/&quot;/g, '"').replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");
 }
 
 /**