[Bbs2ch-cvs 124] CVS update: bbs2chreader/content/bbs2chreader

Back to archive index

flyson flyso****@users*****
2006年 9月 18日 (月) 19:09:02 JST


Index: bbs2chreader/content/bbs2chreader/board-page.xul
diff -u bbs2chreader/content/bbs2chreader/board-page.xul:1.15 bbs2chreader/content/bbs2chreader/board-page.xul:1.16
--- bbs2chreader/content/bbs2chreader/board-page.xul:1.15	Fri Jan 20 01:40:09 2006
+++ bbs2chreader/content/bbs2chreader/board-page.xul	Mon Sep 18 19:09:02 2006
@@ -63,7 +63,7 @@
 		<spacer flex="1"/>
 
 		<label value="&lblFilter.label;"/>
-		<menulist id="mlstFilterLimit" value="-1" persist="value" oncommand="initTreeSubject()">
+		<menulist id="mlstFilterLimit" value="-1" persist2="value" oncommand="initTreeSubject()">
 			<menupopup>
 				<menuitem label="ALL" value="-1"/>
 				<menuitem label="TOP 200" value="200"/>
@@ -73,7 +73,7 @@
 		</menulist>
 
 		<checkbox id="chkShowDownedLogs" label="&chkShowDownedLogs.label;"
-				checked="true" persist="checked" oncommand="initTreeSubject()"/>
+				checked="true" persist2="checked" oncommand="initTreeSubject()"/>
 
 		<spacer class="small-margin"/>
 	</toolbar>
@@ -84,28 +84,28 @@
 	onclick="treeSubjectClick(event)" onkeypress="treeSubjectKeyDown(event)">
 	<treecols>
 		<treecol id="colStatus" label="!" flex="1" property="status"
-				notext="true" persist="hidden width sortActive sortDirection"/>
+				notext="true" persist2="hidden width sortActive sortDirection"/>
 		<splitter class="tree-splitter"/>
 		<treecol id="colNumber" label="&colNumber.label;" flex="1" property="number"
-				persist="hidden width sortActive sortDirection"/>
+				persist2="hidden width sortActive sortDirection"/>
 		<splitter class="tree-splitter"/>
 		<treecol id="colTitle" label="&colTitle.label;" flex="15" property="title"
-				persist="hidden width sortActive sortDirection"/>
+				persist2="hidden width sortActive sortDirection"/>
 		<splitter class="tree-splitter"/>
 		<treecol id="colCount" label="&colCount.label;" flex="1" property="count"
-				persist="hidden width sortActive sortDirection"/>
+				persist2="hidden width sortActive sortDirection"/>
 		<splitter class="tree-splitter"/>
 		<treecol id="colRead" label="&colRead.label;" flex="1" property="read"
-				persist="hidden width sortActive sortDirection"/>
+				persist2="hidden width sortActive sortDirection"/>
 		<splitter class="tree-splitter"/>
 		<treecol id="colUnread" label="&colUnread.label;" flex="1" property="unread"
-				persist="hidden width sortActive sortDirection"/>
+				persist2="hidden width sortActive sortDirection"/>
 		<splitter class="tree-splitter"/>
 		<treecol id="colForce" label="&colForce.label;" flex="1" property="force"
-				 hidden="true" persist="hidden width sortActive sortDirection"/>
+				 hidden="true" persist2="hidden width sortActive sortDirection"/>
 		<splitter class="tree-splitter"/>
 		<treecol id="colMakeDate" label="&colMakeDate.label;" flex="1" property="makeDate"
-				isdate="true" hidden="true" persist="hidden width sortActive sortDirection"/>
+				isdate="true" hidden="true" persist2="hidden width sortActive sortDirection"/>
 	</treecols>
 	<treechildren/>
 </tree>
Index: bbs2chreader/content/bbs2chreader/board-page.js
diff -u bbs2chreader/content/bbs2chreader/board-page.js:1.33 bbs2chreader/content/bbs2chreader/board-page.js:1.34
--- bbs2chreader/content/bbs2chreader/board-page.js:1.33	Fri Jul 14 22:57:57 2006
+++ bbs2chreader/content/bbs2chreader/board-page.js	Mon Sep 18 19:09:02 2006
@@ -71,6 +71,8 @@
 
 	gTreeSubject = document.getElementById("treeSubject");
 
+	loadPersist();
+
     	// ツリーの偶数行に色をつける 	 
 	if(gBbs2chService.pref.getBoolPref("fls.bbs2chreader.enable_tree_stripe2"))
 		gTreeSubject.setAttribute("stripe", "true");
@@ -97,6 +99,9 @@
 	var chkShowDownedLogs = document.getElementById("chkShowDownedLogs");
 	if(!chkShowDownedLogs.checked) chkShowDownedLogs.setAttribute("checked", "false");
 
+
+	savePersist();
+
 		// ダウンロードのキャンセル
 	if(gSubjectDownloader && gSubjectDownloader.loading)
 		gSubjectDownloader.abort(true);
@@ -128,6 +133,49 @@
 }
 
 
+function loadPersist(){
+	var persistPref = Components.classes["@mozilla.org/preferences-service;1"]
+						.getService(Components.interfaces.nsIPrefService)
+						.getBranch("fls.bbs2chreader.board_persist.");
+	var prefList = persistPref.getChildList("", {});
+	for(var i=0; i<prefList.length; i++){
+		var prefName = prefList[i];
+		var prefValue = persistPref.getCharPref(prefName);
+		var elementId = prefName.split(".")[0];
+		var attrName = prefName.split(".")[1];
+		var element = document.getElementById(elementId);
+		if(element){
+			element.setAttribute(attrName, prefValue);
+			if(attrName == "value") element.value = prefValue;
+		}
+		
+	}
+}
+
+
+function savePersist(){
+	var persistPref = Components.classes["@mozilla.org/preferences-service;1"]
+						.getService(Components.interfaces.nsIPrefService)
+						.getBranch("fls.bbs2chreader.board_persist.");
+
+	var xpathResult = document.evaluate("descendant::*[@id][@persist2]", document, null,
+						XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+
+	for (var i = 0; i < xpathResult.snapshotLength; i++){
+		var node = xpathResult.snapshotItem(i);
+		var persists = node.getAttribute("persist2").split(/\s/);
+
+		for(var j=0; j<persists.length; j++){
+			var attrName = persists[j];
+			var attrValue = node.getAttribute(attrName);
+			if(attrValue != "")
+				persistPref.setCharPref(node.id +"."+ attrName, attrValue);
+		}
+	}
+
+}
+
+
 /**
  * TreeSubject の初期化
  */


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