[Bbs2ch-cvs 198] [180] デフォルトスキンもローカルから読み込むようにした

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 7月 28日 (土) 02:59:11 JST


Revision: 180
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=180
Author:   flyson
Date:     2007-07-28 02:59:10 +0900 (Sat, 28 Jul 2007)

Log Message:
-----------
デフォルトスキンもローカルから読み込むようにした

Modified Paths:
--------------
    trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js

Modified: trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js
===================================================================
--- trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js	2007-07-27 17:53:06 UTC (rev 179)
+++ trunk/bbs2chreader/chrome/content/bbs2chreader/server/thread.js	2007-07-27 17:59:10 UTC (rev 180)
@@ -1133,11 +1133,11 @@
 			skinURISpec = fileURL.resolve(encodeURIComponent(skinName)) + "/";
 		}
 
-		this._tmpHeader   = this._bbs2chService.readLocalURI(skinURISpec + "Header.html");
-		this._tmpFooter   = this._bbs2chService.readLocalURI(skinURISpec + "Footer.html");
-		this._tmpRes	  = this._bbs2chService.readLocalURI(skinURISpec + "Res.html");
-		this._tmpNewRes	  = this._bbs2chService.readLocalURI(skinURISpec + "NewRes.html");
-		this._tmpNewMark  = this._bbs2chService.readLocalURI(skinURISpec + "NewMark.html");
+		this._tmpHeader   = this._bbs2chService.readFile(this._resolveSkinFile("Header.html").path);
+		this._tmpFooter   = this._bbs2chService.readFile(this._resolveSkinFile("Footer.html").path);
+		this._tmpRes	  = this._bbs2chService.readFile(this._resolveSkinFile("Res.html").path);
+		this._tmpNewRes	  = this._bbs2chService.readFile(this._resolveSkinFile("NewRes.html").path);
+		this._tmpNewMark  = this._bbs2chService.readFile(this._resolveSkinFile("NewMark.html").path);
 
 			// Šî–{ƒXƒLƒ“ƒ^ƒO‚Ì’uŠ·
 		this._tmpHeader = this._replaceBaseTag(this._tmpHeader);
@@ -1155,6 +1155,27 @@
 		}
 	},
 
+	_resolveSkinFile: function(aFilePath){
+		var skinName = this._bbs2chService.pref.getComplexValue("extensions.bbs2chreader.thread_skin",
+							Components.interfaces.nsISupportsString).data;
+
+		var skinFile = null;
+		if(skinName){
+			skinFile = this._bbs2chService.getDataDir();
+			skinFile.appendRelativePath("skin");
+			skinFile.appendRelativePath(skinName);
+		}else{
+			var bbs2chreaderID = "{0B9D558E-6983-486b-9AAD-B6CBCD2FC807}";
+			var extensionManager = Components.classes["@mozilla.org/extensions/manager;1"]
+					.getService(Components.interfaces.nsIExtensionManager);
+			var installLocation = extensionManager.getInstallLocation(bbs2chreaderID);
+			skinFile = installLocation.getItemFile(bbs2chreaderID, "defaults/skin").clone()
+							.QueryInterface(Components.interfaces.nsILocalFile);
+		}
+		skinFile.appendRelativePath(aFilePath);
+		return skinFile;
+	},
+
 	/**
 	 * Šî–{ƒXƒLƒ“ƒ^ƒO‚Ì’uŠ·
 	 * @param aString string ’uŠ·‚³‚ê‚镶Žš—ñ




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