[Bbs2ch-cvs 457] [439] [04_BRANCH] 書き込み仕様変更対応

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 9月 16日 (火) 22:42:54 JST


Revision: 439
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=439
Author:   flyson
Date:     2008-09-16 22:42:54 +0900 (Tue, 16 Sep 2008)

Log Message:
-----------
[04_BRANCH] 書き込み仕様変更対応

Modified Paths:
--------------
    branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post-wizard.js
    branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post.js


-------------- next part --------------
Modified: branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post-wizard.js
===================================================================
--- branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post-wizard.js	2008-09-13 15:01:45 UTC (rev 438)
+++ branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post-wizard.js	2008-09-16 13:42:54 UTC (rev 439)
@@ -157,12 +157,12 @@
 /**
  * 書き込み
  */
-function post(){
+function post(aAdditionalData){
 	document.getElementById("wizPostWizard").getButton("back").disabled = true;
 	document.getElementById("wizPostWizard").getButton("finish").disabled = true;
 	gTxtResponse.value = "";
 	document.getElementById("btnRePost").disabled = true;
-	gPost.post(postListener);
+	gPost.post(postListener, aAdditionalData);
 }
 
 /**
@@ -222,6 +222,27 @@
 		window.close();
 	}else if(status==gPost.COOKIE && !rewrite){
 		rewrite = true;
+
+		try{
+			var doc = document.implementation.createDocument("", "", null);
+			doc.appendChild(doc.createElement("root"));
+			var unescapeHTML = Components.classes["@mozilla.org/feed-unescapehtml;1"]
+		    		.getService(Components.interfaces.nsIScriptableUnescapeHTML);
+			var fragment = unescapeHTML.parseFragment(aResponse, false, null, doc.documentElement);
+			doc.documentElement.appendChild(fragment);
+			var inputNodes = doc.getElementsByTagName("input");
+			var additionalData = new Array();
+			var ignoreInputs = ["submit","subject","bbs","key","time","MESSAGE","FROM","mail"];
+			for(var [i, input] in Iterator(inputNodes)){
+				if(input.type != "hidden") continue;
+				if(ignoreInputs.indexOf(input.name) != -1) continue;
+				additionalData.push(input.name +"="+ input.value);
+			}
+			post(additionalData);
+			return;
+		}catch(ex){
+			
+		}
 		post();
 	}else if(status==gPost.ERROR || status==gPost.SAMBA){
 		alert(hardCoatingStr("書き込み中にエラーが発生しました"));
@@ -374,4 +395,4 @@
 	}
 	
 	chkBeLogin.checked = Bbs2chBeLogin.logined;
-}
\ No newline at end of file
+}

Modified: branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post.js
===================================================================
--- branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post.js	2008-09-13 15:01:45 UTC (rev 438)
+++ branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/post.js	2008-09-16 13:42:54 UTC (rev 439)
@@ -282,7 +282,7 @@
  		}
  		return aString;
 	},
-	post: function(aListener){
+	post: function(aListener, additionalData){
 		this.listener = aListener;
 			// DAT ID
 		this.threadURI.spec.match(/\/(\d{9,10})/);
@@ -305,6 +305,9 @@
 
 		var postData = new Array(postSubmit, postBbs, postKey, postTime,
 									postMsg, postName, postMail, postHana);
+		if(additionalData){
+			postData = postData.concat(additionalData);
+		}
 
 		if(this._bbs2chService.maruLogined){
 			var sid = "sid=" + encodeURIComponent(this._bbs2chService.maruSessionID);
@@ -358,4 +361,4 @@
 		}
 		return this.UNKNOWN;
 	}
-}
\ No newline at end of file
+}


bbs2ch-cvs メーリングリストの案内
Back to archive index