[Bbs2ch-cvs 443] [425] read. html 形式の 2ch URL を read . cgi に置換

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 4月 7日 (月) 22:58:51 JST


Revision: 425
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=425
Author:   flyson
Date:     2008-04-07 22:58:51 +0900 (Mon, 07 Apr 2008)

Log Message:
-----------
read.html 形式の 2ch URL を read.cgi に置換

Modified Paths:
--------------
    trunk/bbs2chreader/chrome/content/bbs2chreader/ff-overlay.js
    trunk/bbs2chreader/components/b2rThreadRedirector.js


-------------- next part --------------
Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/ff-overlay.js
===================================================================
--- trunk/bbs2chreader/chrome/content/bbs2chreader/ff-overlay.js	2008-03-29 15:34:35 UTC (rev 424)
+++ trunk/bbs2chreader/chrome/content/bbs2chreader/ff-overlay.js	2008-04-07 13:58:51 UTC (rev 425)
@@ -80,6 +80,7 @@
 
 		var pathname = gContextMenu.link.pathname;
 		if(pathname.indexOf("/test/read.cgi/")==-1 &&
+				pathname.indexOf("/test/read.html/")==-1 &&
 				pathname.indexOf("/bbs/read.cgi/")==-1) return;
 
 		document.getElementById("context-bbs2chreader").hidden = false;
@@ -98,6 +99,7 @@
 					.getService(Components.interfaces.nsIPrefBranch);
 
 		var threadURLSpec = gContextMenu.link.href;
+		threadURLSpec = threadURLSpec.replace("/test/read.html/", "/test/read.cgi/");
 		var threadURL = ioService.newURI(threadURLSpec, null, null)	.QueryInterface(Components.interfaces.nsIURL);
 
 				// スレッド表示数の制限

Modified: trunk/bbs2chreader/components/b2rThreadRedirector.js
===================================================================
--- trunk/bbs2chreader/components/b2rThreadRedirector.js	2008-03-29 15:34:35 UTC (rev 424)
+++ trunk/bbs2chreader/components/b2rThreadRedirector.js	2008-04-07 13:58:51 UTC (rev 425)
@@ -136,12 +136,15 @@
 			}
 		}
 
+		var spec = aContentLocation.spec;
+		spec = spec.replace("/test/read.html/", "/test/read.cgi/");
+
 			// Be Profile Page
-		if(aContentLocation.spec.indexOf("http://be.2ch.net/test/p.php") != -1){
+		if(spec.indexOf("http://be.2ch.net/test/p.php") != -1){
 			return this.ACCEPT;
 		}
 
-		if(aContentLocation.spec.indexOf("/read.cgi/") != -1){
+		if(spec.indexOf("/read.cgi/") != -1){
 			var viewB2r = true;
 			var ask = this._pref.getBoolPref(this._PREF_ASK);
 
@@ -149,8 +152,7 @@
 				var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
 							.getService(Ci.nsIPromptService);
 				var dialogTitle = "bbs2chreader";
-				var dialogText = "Do you want to view it in bbs2chreader?\n" +
-										aContentLocation.spec +"\n";
+				var dialogText = "Do you want to view it in bbs2chreader?\n" + spec +"\n";
 				var checkText = "Don't ask me this again";
 				var notAskCheck = { value: false };
 				viewB2r = (promptService.confirmEx(null, dialogTitle, dialogText,
@@ -165,7 +167,7 @@
 			if(viewB2r){
 				var b2rService = Cc["@bbs2ch.sourceforge.jp/b2r-global-service;1"]
 						.getService(Ci.b2rIGlobalService);
-				var serverURL = "./thread/" + aContentLocation.spec;
+				var serverURL = "./thread/" + spec;
 				serverURL = b2rService.serverURL.resolve(serverURL);
 				aContentLocation.spec = serverURL;
 			}


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