[Bbs2ch-cvs 241] [223] 連鎖あぼーん実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 9月 27日 (木) 22:41:32 JST


Revision: 223
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=223
Author:   flyson
Date:     2007-09-27 22:41:31 +0900 (Thu, 27 Sep 2007)

Log Message:
-----------
連鎖あぼーん実装

Modified Paths:
--------------
    trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js
    trunk/bbs2chreader/chrome/content/bbs2chreader/settings/thread-pane.xul
    trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js


-------------- next part --------------
Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js
===================================================================
--- trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js	2007-09-21 17:26:21 UTC (rev 222)
+++ trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js	2007-09-27 13:41:31 UTC (rev 223)
@@ -112,6 +112,9 @@
 		this._ioService = Components.classes["@mozilla.org/network/io-service;1"]
 					.getService(Components.interfaces.nsIIOService);
 
+		this._chainAboneNumbers = new Array();
+		this._enableChainAbone = this._bbs2chService.pref.getBoolPref("extensions.bbs2chreader.thread_chain_abone")
+
 			// HTML ƒwƒbƒ_‚𑗐M‚µ‚½‚ç true ‚É‚È‚é
 		this._headerResponded = false;
 		this._opend = true;
@@ -338,6 +341,7 @@
 		}
 
 		if(this._aboneManager.shouldAbone(resName, resMail, resID, resMes)){
+			this._chainAboneNumbers.push(aNumber);
 			resName = resMail = resDate = resMes = "ABONE";
 			if(aNumber>1 && this._bbs2chService.pref.getBoolPref("extensions.bbs2chreader.thread_hide_abone")){
 				return "";
@@ -351,10 +355,23 @@
 		var resMailName = resName;
 		if(resMail) resMailName = '<a href="mailto:' + resMail + '">' + resName + '</a>';
 
-			// ƒŒƒX”ÔƒŠƒ“ƒNˆ—
-		var regResPointer = /(<a .*?>)?(&gt;&gt;|&gt;)([0-9]{1,4})(\-[0-9]{1,4})?(<\/a>)?/g;
-		resMes = resMes.replace(regResPointer, '<a href="#res$3" class="resPointer">$2$3$4</a>'); 
+			// ƒŒƒX”ÔƒŠƒ“ƒNˆ— & ˜A½‚ ‚ځ[‚ñ
+		var regResPointer = /(?:<a .*?>)?(&gt;&gt;|&gt;)([0-9]{1,4})(\-[0-9]{1,4})?(?:<\/a>)?/g;
 
+		var chainAboneNumbers = this._chainAboneNumbers;
+		var chainAbone = false;
+		resMes = resMes.replace(regResPointer, function(aStr, aP1, aP2, aP3, aOffset, aS){
+			chainAbone = chainAbone || (chainAboneNumbers.indexOf(parseInt(aP2)) != -1);
+			return '<a href="#res' + aP2 + '" class="resPointer">' + aP1 + aP2 + aP3 + '</a>';
+		});
+		if(this._enableChainAbone && chainAbone){
+			this._chainAboneNumbers.push(aNumber);
+			resName = resMail = resDate = resMes = "ABONE";
+			if(aNumber>1 && this._bbs2chService.pref.getBoolPref("extensions.bbs2chreader.thread_hide_abone")){
+				return "";
+			}
+		}
+
 			// ’ʏ탊ƒ“ƒNˆ—
 		var regUrlLink = /(h?ttp)(s)?\:([\-_\.\!\~\*\'\(\)a-zA-Z0-9\;\/\?\:\@\&\=\+\$\,\%\#]+)/g;
 		resMes = resMes.replace(regUrlLink, '<a href="http$2:$3" class="outLink">$1$2:$3</a>');
@@ -636,10 +653,31 @@
 		var resMailName = resName;
 		if(resMail) resMailName = '<a href="mailto:' + resMail + '">' + resName + '</a>';
 
-			// ƒŒƒX”ÔƒŠƒ“ƒNˆ—
-		var regResPointer = /(<a .*?>)?(&gt;&gt;|&gt;)([0-9]{1,4})(\-[0-9]{1,4})?(<\/a>)?/g;
-		resMes = resMes.replace(regResPointer, '<a href="#res$3" class="resPointer">$2$3$4</a>'); 
 
+			// ƒŒƒX”ÔƒŠƒ“ƒNˆ— & ˜A½‚ ‚ځ[‚ñ
+		var regResPointer = /(?:<a .*?>)?(&gt;&gt;|&gt;)([0-9]{1,4})(\-[0-9]{1,4})?(?:<\/a>)?/g;
+
+		var chainAboneNumbers = this._chainAboneNumbers;
+		var chainAbone = false;
+		resMes = resMes.replace(regResPointer, function(aStr, aP1, aP2, aP3, aOffset, aS){
+			chainAbone = chainAbone || (chainAboneNumbers.indexOf(parseInt(aP2)) != -1);
+			return '<a href="#res' + aP2 + '" class="resPointer">' + aP1 + aP2 + aP3 + '</a>';
+		});
+		if(this._enableChainAbone && chainAbone){
+			this._chainAboneNumbers.push(aNumber);
+			resName = resMail = resDate = resMes = "ABONE";
+			if(aNumber>1 && this._bbs2chService.pref.getBoolPref("extensions.bbs2chreader.thread_hide_abone")){
+				return "";
+			}
+		}
+
+
+
+
+
+
+
+
 			// ’ʏ탊ƒ“ƒNˆ— 
 		var regUrlLink = /(h?ttp)(s)?\:([\-_\.\!\~\*\'\(\)a-zA-Z0-9\;\/\?\:\@\&\=\+\$\,\%\#]+)/g;
 		resMes = resMes.replace(regUrlLink, '<a href="http$2:$3" class="outLink">$1$2:$3</a>');

Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/settings/thread-pane.xul
===================================================================
--- trunk/bbs2chreader/chrome/content/bbs2chreader/settings/thread-pane.xul	2007-09-21 17:26:21 UTC (rev 222)
+++ trunk/bbs2chreader/chrome/content/bbs2chreader/settings/thread-pane.xul	2007-09-27 13:41:31 UTC (rev 223)
@@ -21,6 +21,8 @@
 				name="extensions.bbs2chreader.thread_aa_font_size" type="int"/>
 		<preference id="extensions.bbs2chreader.thread_hide_abone"
 				name="extensions.bbs2chreader.thread_hide_abone" type="bool"/>
+		<preference id="extensions.bbs2chreader.thread_chain_abone"
+				name="extensions.bbs2chreader.thread_chain_abone" type="bool"/>
 	</preferences>
 
 	<settingbox label="スキン">
@@ -104,6 +106,8 @@
 				oncommand="gThreadPane.openAboneManager()"/>
 		<checkbox label="あぼーんしたレスを表示しない (透明あぼーん)"
 				preference="extensions.bbs2chreader.thread_hide_abone"/>
+		<checkbox label="連鎖あぼーん"
+				preference="extensions.bbs2chreader.thread_chain_abone"/>
 	</settingbox>
 
 </prefpane>

Modified: trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js
===================================================================
--- trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js	2007-09-21 17:26:21 UTC (rev 222)
+++ trunk/bbs2chreader/defaults/preferences/bbs2chreader-pref.js	2007-09-27 13:41:31 UTC (rev 223)
@@ -46,6 +46,7 @@
 pref("extensions.bbs2chreader.thread_aa_font_name", "sans-serif");
 pref("extensions.bbs2chreader.thread_aa_font_size", 16);
 pref("extensions.bbs2chreader.thread_hide_abone", false);
+pref("extensions.bbs2chreader.thread_chain_abone", false);
 
 pref("extensions.bbs2chreader.livebookmarks_append_board_link", true);
 pref("extensions.bbs2chreader.livebookmarks_min_unread", 1);


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