From flyson @ users.sourceforge.jp Sat Sep 10 22:10:35 2005 From: flyson @ users.sourceforge.jp (flyson) Date: Sat, 10 Sep 2005 22:10:35 +0900 Subject: [Bbs2ch-cvs 1] CVS update: bbs2chreader/components Message-ID: <20050910131035.05EC42AC014@users.sourceforge.jp> Index: bbs2chreader/components/nsBbs2chService.js diff -u bbs2chreader/components/nsBbs2chService.js:1.5 bbs2chreader/components/nsBbs2chService.js:1.6 --- bbs2chreader/components/nsBbs2chService.js:1.5 Fri Sep 9 03:45:54 2005 +++ bbs2chreader/components/nsBbs2chService.js Sat Sep 10 22:10:34 2005 @@ -206,6 +206,8 @@ var contentBrowser = browserWindow.document.getElementById("content"); if(aAddTab){ var newTab = contentBrowser.addTab(aURLSpec, aReferrer); + if(this.pref.getBoolPref("fls.bbs2chreader.tab_load_in_foreground")) + contentBrowser.selectedTab = newTab; }else{ contentBrowser.loadURI(aURLSpec, aReferrer); } From flyson @ users.sourceforge.jp Tue Sep 13 22:41:23 2005 From: flyson @ users.sourceforge.jp (flyson) Date: Tue, 13 Sep 2005 22:41:23 +0900 Subject: [Bbs2ch-cvs 2] CVS update: bbs2chreader/content/bbs2chreader Message-ID: <20050913134123.067702AC00E@users.sourceforge.jp> Index: bbs2chreader/content/bbs2chreader/post.js diff -u /dev/null bbs2chreader/content/bbs2chreader/post.js:1.1 --- /dev/null Tue Sep 13 22:41:22 2005 +++ bbs2chreader/content/bbs2chreader/post.js Tue Sep 13 22:41:22 2005 @@ -0,0 +1,325 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is bbs2chreader. + * + * The Initial Developer of the Original Code is + * flyson. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Nazo + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + + + +function Bbs2chPost(aThreadURI){ + this.threadURI = aThreadURI; + + this._bbs2chService = Components.classes["@mozilla.org/bbs2ch-service;1"] + .getService(Components.interfaces.nsIBbs2chService), + this._ioService = Components.classes["@mozilla.org/network/io-service;1"] + .getService(Components.interfaces.nsIIOService), + + this._init(); +} + +Bbs2chPost.prototype = { + + _init:function(){ + this.boardURI = this._bbs2chService.getBoardURL(this.threadURI.spec); + this.board = new Bbs2chBoardItems(this.boardURI.spec); + this.type = this._bbs2chService.getBoardType(this.threadURI.spec); + var datID = (this.threadURI.spec.match(/\/(\d{9,10})/)) ? RegExp.$1 : ""; + var idxFile = this._bbs2chService.getLogFileAtURL(this.boardURI.resolve(datID + ".idx")); + + if(!idxFile.exists()){ + this._isIdx=false; + }else{ + this._isIdx=true; + this._idx = this._bbs2chService.fromSJIS(this._bbs2chService.readFile(idxFile.path)); + } + }, + + + _getSetting: function(aName){ + //実際はthread側にあるべきなんだけど… + var reg = new RegExp("^"+aName+"=(.+)","m"); + var title = this._idx.match(reg) ? RegExp.$1 : null; + return title; + }, + + + isSupport:function(){ + switch(this.type){ + case this._bbs2chService.BOARD_TYPE_JBBS: + case this._bbs2chService.BOARD_TYPE_MACHI: + case this._bbs2chService.BOARD_TYPE_PAGE: + case this._bbs2chService.BOARD_TYPE_OLD2CH: + return false; + case this._bbs2chService.BOARD_TYPE_2CH: + case this._bbs2chService.BOARD_TYPE_BE2CH: + return true; + default: + return false; + } + }, + + + isValidThread:function(){ + //読み込まれていないスレッドには書き込まないようにする。 + if(!this._isIdx){ + return false; + } + return true; + }, + + + get title(){ + return (this._getSetting("title")!=null)?this._getSetting("title"):this.threadURI.spec; + }, + + + _message: "", + set message(aVal){ + this._message = aVal; + }, + get message(){ + var message = this._message; + message = message.replace(/(^|\n) /g,"$1 "); + message = message.replace(/ {2}/g,"  "); + message = message.replace(/\u2003/g," "); + message = message.replace(/\u2002/g," "); + message = message.replace(/\u2009/g," "); + message = message.replace(/\u00a9/g,"©"); + message = message.replace(/\u00ae/g,"®"); + return message; + }, + + + _name: "", + set name(aVal){ + this._name = aVal; + }, + get name(){ + return this._name; + }, + + isSage: false, + + + _mail: "", + set mail(aVal){ + this._mail = aVal; + }, + + + get mail(){ + if(this.isSage) return "sage"; + return this._mail; + }, + + + //複数エラーを吐けるようにしておく + OK: 0, + ERROR_NOT_BE_LOGIN: 1<<0, + ERROR_MESSAGE_EMPTY: 1<<1, + ERROR_NAME_EMPTY: 1<<2, + ERROR_MAIL_EMPTY: 1<<3, + ERROR_SUBJECT_EMPTY: 1<<4, + ERROR_MESSAGE_TOO_LONG: 1<<5, + ERROR_NAME_TOO_LONG: 1<<6, + ERROR_MAIL_TOO_LONG: 1<<7, + ERROR_SUBJECT_TOO_LONG: 1<<8, + ERROR_MESSAGE_TOO_RETURN: 1<<9, + + + isValid: function(){ + var flag = this.OK; + //beチェック + if((this.board.getSetting("BBS_BE_ID")=="1" || this.type==this._bbs2chService.BOARD_TYPE_BE2CH) + && !Bbs2chBeLogin.logined){ + flag |= this.ERROR_NOT_BE_LOGIN; + } + + //本文の未記入チェック + if(this.message==""){ + flag |= this.ERROR_MESSAGE_EMPTY; + } + + //改行チェック + if(this.message.match(/\n/g) && this.board.getSetting("BBS_LINE_NUMBER") != null && + this.message.match(/\n/g).length+1 > this.board.getSetting("BBS_LINE_NUMBER")*2){ + flag |= this.ERROR_MESSAGE_TOO_RETURN; + } + + //本文の長さチェック + var checkMessage=this._escape(this.message).replace(/%[0-9a-fA-F]{2}/g,"x"); + if(checkMessage.length > this.board.getSetting("BBS_MESSAGE_COUNT")){ + flag |= this.ERROR_MESSAGE_TOO_LONG; + } + + //名前の未記入チェック + if(this.board.getSetting("NANASHI_CHECK")=="1" && this.name==""){ + flag |= this.ERROR_NAME_EMPTY; + } + + //名前の長さチェック + var checkName=this._escape(this.name).replace(/%[0-9a-fA-F]{2}/g,"x"); + if(checkName.length > this.board.getSetting("BBS_NAME_COUNT")){ + flag |= this.ERROR_NAME_TOO_LONG; + } + + //メールの長さチェック + var checkMail = this._escape(this.mail).replace(/%[0-9a-fA-F]{2}/g,"x"); + if(checkMail.length > this.board.getSetting("BBS_MAIL_COUNT")){ + flag |= this.ERROR_MAIL_TOO_LONG; + } + + return flag; + }, + getPreview: function(){ + var preview = new Array(); + preview["name"] = (this.name!="")?this.name:this.board.getSetting("BBS_NONAME_NAME") + preview["mail"] = this.mail; + preview["message"] = this.message; + var nowDate = new Date(); + var date = nowDate.getFullYear() + "/"; + date += ((nowDate.getMonth() < 9)? "0" : "") + (nowDate.getMonth() + 1) + "/"; + date += ((nowDate.getDate() < 10)? "0" : "") + nowDate.getDate() + " "; + date += ((nowDate.getHours() < 10)? "0" : "") + nowDate.getHours() + ":"; + date += ((nowDate.getMinutes() < 10)? "0" : "") + nowDate.getMinutes(); + preview["date"] = date; + preview["backgroundColor"] = this.board.getSetting("BBS_THREAD_COLOR"); + if(!preview["backgroundColor"]){ + preview["backgroundColor"] = "#EFEFEF"; + } + preview["color"] = this.board.getSetting("BBS_TEXT_COLOR"); + if(!preview["color"]){ + preview["color"] = "#000000"; + } + preview["nameColor"] = this.board.getSetting("BBS_NAME_COLOR"); + if(!preview["nameColor"]){ + preview["nameColor"] = "green"; + } + return preview; + }, + getLastModified: function(){ + var lastModified = this._getSetting("lastModified"); + if(lastModified==null)lastModified = ""; + return Math.ceil(new Date(lastModified).getTime() / 1000); + }, + get _postURI(){ + var postURISpec = this.boardURI.resolve("../test/bbs.cgi"); + var postURI = this._ioService.newURI(postURISpec, null, null) + .QueryInterface(Components.interfaces.nsIURL); + return postURI; + }, + _escape: function(aString){ + var textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"] + .getService(Components.interfaces.nsITextToSubURI); + + switch(this.type){ + case this._bbs2chService.BOARD_TYPE_2CH: + return textToSubURI.ConvertAndEscape("Shift_JIS", aString); + case this._bbs2chService.BOARD_TYPE_BE2CH: + return textToSubURI.ConvertAndEscape("EUC-JP", aString); + } + return aString; + }, + post: function(aListener){ + this.listener = aListener; + // DAT ID + this.threadURI.spec.match(/\/(\d{9,10})/); + var datID = RegExp.$1; + // カテゴリ + this.boardURI.spec.match(/\/([^\/]+)\/?$/); + var category = RegExp.$1; + // POST データ + var postSubmit = "\u66F8\u304D\u8FBC\u3080"; + postSubmit = "submit=" + this._escape(postSubmit); + + var postBbs = "bbs=" + category; + var postKey = "key=" + datID; + var postTime = "time=" + this.getLastModified(); + + var postMsg = "MESSAGE=" + this._escape(this.message); + var postName = "FROM=" + this._escape(this.name); + var postMail = "mail=" + this._escape(this.mail); + + var postData = new Array(postSubmit, postBbs, postKey, postTime, + postMsg, postName, postMail).join("&"); + + var httpReqest = new Bbs2chHttpRequest(this._postURI.spec, aListener, this.threadURI.spec); + httpReqest.post(postData); + }, + SUCCESS: 0, + COOKIE: 1, + SERVER_HIGH: 2, + SAMBA: 3, + ERROR: 4, + UNKNOWN: 5, + getStatus:function(aResponse){ + //書きこみました,書き込みました,書き込み終了,書きこみが終わりました + const SUCCESS = new Array("\u66F8\u304D\u3053\u307F\u307E\u3057\u305F","\u66F8\u304D\u8FBC\u307F\u307E\u3057\u305F","\u66F8\u304D\u8FBC\u307F\u7D42\u4E86","\u66F8\u304D\u3053\u307F\u304C\u7D42\u308F\u308A\u307E\u3057\u305F"); + //クッキー確認 + const CHECK_COOKIE = new Array("\u30AF\u30C3\u30AD\u30FC\u78BA\u8A8D"); + //お茶でも飲みましょう + const CHECK_SERVER_HIGH = new Array("\u304A\u8336\u3067\u3082\u98F2\u307F\u307E\u3057\u3087\u3046"); + //SAMBA24 + const CHECK_SAMBA = new Array("Samba","SAMBA","samba"); + //ERROR,ERROR + const CHECK_ERROR = new Array("ERROR","\uFF25\uFF32\uFF32\uFF2F\uFF32"); + for(var i in SUCCESS){ + if(aResponse.match(SUCCESS[i])){ + return this.SUCCESS; + } + } + for(i in CHECK_COOKIE){ + if(aResponse.match(CHECK_COOKIE[i])){ + return this.COOKIE; + } + } + for(i in CHECK_SERVER_HIGH){ + if(aResponse.match(CHECK_SERVER_HIGH[i])){ + return this.SERVER_HIGH; + } + } + for(i in CHECK_SAMBA){ + if(aResponse.match(CHECK_SAMBA[i])){ + return this.SAMBA; + } + } + for(i in CHECK_ERROR){ + if(aResponse.match(CHECK_ERROR[i])){ + return this.ERROR; + } + } + return this.UNKNOWN; + } +} \ No newline at end of file Index: bbs2chreader/content/bbs2chreader/post-wizard.xul diff -u bbs2chreader/content/bbs2chreader/post-wizard.xul:1.6 bbs2chreader/content/bbs2chreader/post-wizard.xul:1.7 --- bbs2chreader/content/bbs2chreader/post-wizard.xul:1.6 Thu Sep 1 01:57:49 2005 +++ bbs2chreader/content/bbs2chreader/post-wizard.xul Tue Sep 13 22:41:22 2005 @@ -13,6 +13,7 @@ From flyson @ users.sourceforge.jp Sat Sep 17 04:11:11 2005 From: flyson @ users.sourceforge.jp (flyson) Date: Sat, 17 Sep 2005 04:11:11 +0900 Subject: [Bbs2ch-cvs 8] CVS update: bbs2chreader/content/bbs2chreader/lib Message-ID: <20050916191111.BEAC92AC013@users.sourceforge.jp> Index: bbs2chreader/content/bbs2chreader/lib/rdf.js diff -u bbs2chreader/content/bbs2chreader/lib/rdf.js:1.1 bbs2chreader/content/bbs2chreader/lib/rdf.js:1.2 --- bbs2chreader/content/bbs2chreader/lib/rdf.js:1.1 Sun Jul 24 05:30:42 2005 +++ bbs2chreader/content/bbs2chreader/lib/rdf.js Sat Sep 17 04:11:11 2005 @@ -146,12 +146,14 @@ this.ds.Assert(source, property, value, true); }, + + /** * nsIRDFLiteral 型のプロパティ値を文字列として取得する * @param {variable} aResourceOrID リソースまたはリソースID * @param {string} aProperty プロパティの名前 - * @type nsIRDFLiteral - * @return nsIRDFLiteral + * @type string + * @return プロパティ値 */ getLiteralProperty: function(aResourceOrID, aProperty){ var source = (typeof(aResourceOrID)=="string") ? @@ -161,26 +163,6 @@ return null; }, - /** - * nsIRDFLiteral 型のプロパティ値を文字列配列として取得する - * @param {variable} aResourceOrID リソースまたはリソースID - * @param {string} aProperty プロパティの名前 - * @type nsIRDFLiteral - * @return nsIRDFLiteral - */ - getLiteralProperties: function(aResourceOrID, aProperty){ - var results = new Array(); - var source = (typeof(aResourceOrID)=="string") ? - this.getResource(aResourceOrID) : aResourceOrID; - var targets = this.ds.GetTargets(source, this.getResource(aProperty), true); - while (targets.hasMoreElements()) { - var target = targets.getNext() - .QueryInterface(Components.interfaces.nsIRDFLiteral); - results.push(target.Value); - } - return results; - }, - /** * nsIRDFInt 型のプロパティ値を設定する @@ -199,6 +181,22 @@ /** + * nsIRDFInt 型のプロパティ値を取得する + * @param {variable} aResourceOrID リソースまたはリソースID + * @param {string} aProperty プロパティの名前 + * @type number + * @return プロパティ値 + */ + getIntProperty: function(aResourceOrID, aProperty){ + var source = (typeof(aResourceOrID)=="string") ? + this.getResource(aResourceOrID) : aResourceOrID; + var target = this.ds.GetTarget(source, this.getResource(aProperty), true); + if(target) return target.QueryInterface(Components.interfaces.nsIRDFInt).Value; + return null; + }, + + + /** * nsIRDFDate 型のプロパティ値を設定する * @param {variable} aResourceOrID リソースまたはリソースID * @param {string} aProperty プロパティの名前 @@ -215,6 +213,22 @@ /** + * nsIRDFDate 型のプロパティ値を取得する + * @param {variable} aSourceOrID リソースまたはリソースID + * @param {string} aProperty プロパティの名前 + * @type number + * @return プロパティ値 + */ + getDateProperty: function(aSourceOrID, aProperty){ + var source = (typeof(aResourceOrID)=="string") ? + this.getResource(aResourceOrID) : aResourceOrID; + var target = this.ds.GetTarget(source, this.getResource(aProperty), true); + if(target) return target.QueryInterface(Components.interfaces.nsIRDFDate).Value; + return null; + }, + + + /** * nsIRDFResource を作成してコンテナに格納する * aParentContainerOrID を指定しない場合は コンテナに格納しない * @param {string} aSourceID 作成するリソースの ID From flyson @ users.sourceforge.jp Sat Sep 17 04:13:33 2005 From: flyson @ users.sourceforge.jp (flyson) Date: Sat, 17 Sep 2005 04:13:33 +0900 Subject: [Bbs2ch-cvs 9] CVS update: bbs2chreader/content/bbs2chreader Message-ID: <20050916191333.375162AC013@users.sourceforge.jp> Index: bbs2chreader/content/bbs2chreader/rdf.js diff -u bbs2chreader/content/bbs2chreader/rdf.js:1.8 bbs2chreader/content/bbs2chreader/rdf.js:removed --- bbs2chreader/content/bbs2chreader/rdf.js:1.8 Sat Jun 18 05:03:14 2005 +++ bbs2chreader/content/bbs2chreader/rdf.js Sat Sep 17 04:13:33 2005 @@ -1,326 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is bbs2chreader. - * - * The Initial Developer of the Original Code is - * flyson. - * Portions created by the Initial Developer are Copyright (C) 2004 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * flyson - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -/** - * RDF データソースを操作するブジェクト - * @constructor - */ -function Bbs2chRDF(){ - this._ds = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"] - .createInstance(Components.interfaces.nsIRDFDataSource); - this._rdfService = Components.classes['@mozilla.org/rdf/rdf-service;1'] - .getService(Components.interfaces.nsIRDFService); - this._rdfContainerUtils = Components.classes['@mozilla.org/rdf/container-utils;1'] - .getService(Components.interfaces.nsIRDFContainerUtils); -} - - -Bbs2chRDF.prototype = { - - -// ********** ********* プロパティ ********** ********** - - - /** - * RDFデータソース - * @type nsIRDFDataSource - */ - get ds(){ - return this._ds; - }, - - -// ********** ********* メソッド ********** ********** - - - /** - * 指定した ID の nsIRDFResource を返す - * @param {string} aResourceID リソースの ID - * @type nsIRDFResource - * @return nsIRDFResource - */ - getResource: function(aResourceID){ - return this._rdfService.GetResource(aResourceID); - }, - - - /** - * 指定した値の nsIRDFLiteral を返す - * @param {string} aValue 値 - * @type nsIRDFLiteral - * @return nsIRDFLiteral - */ - getLiteral: function(aValue){ - return this._rdfService.GetLiteral(aValue); - }, - - - /** - * 指定した値の nsIRDFInt を返す - * @param {number} aValue 値 - * @type nsIRDFInt - * @return nsIRDFInt - */ - getIntLiteral: function(aValue){ - return this._rdfService.GetIntLiteral(aValue); - }, - - - /** - * 指定した値の nsIRDFDate を返す - * @param {number} aValue 値 - * @type nsIRDFDate - * @return nsIRDFDate - */ - getDateLiteral: function(aValue){ - return this._rdfService.GetDateLiteral(aValue); - }, - - - /** - * 既存の nsIRDFDataSource を使って初期化 - * @param {nsIRDFDataSource} aDataSource RDF データソース - */ - initWithDataSource: function(aDataSource){ - if(!(aDataSource instanceof Components.interfaces.nsIRDFDataSource)) - throw Components.results.NS_ERROR_INVALID_ARG; - this._ds = aDataSource; - }, - - - /** - * RDF URL を使って初期化 - * @param {string} aURL RDF データソース URL - */ - initWithRDFURL: function(aDataSource){ - this._ds = this._rdfService.GetDataSource(aDataSource); - }, - - - /** - * nsIRDFLiteral 型のプロパティ値を設定する - * @param {variable} aResourceOrID リソースまたはリソースID - * @param {string} aProperty プロパティの名前 - * @param {string} aValue プロパティ値 - */ - setLiteralProperty: function(aResourceOrID, aProperty, aValue){ - var source = (typeof(aResourceOrID)=="string") ? - this.getResource(aResourceOrID) : aResourceOrID; - var property = this.getResource(aProperty); - var value = this.getLiteral(aValue); - - this.ds.Assert(source, property, value, true); - }, - - - /** - * nsIRDFLiteral 型のプロパティ値を取得する - * @param {variable} aResourceOrID リソースまたはリソースID - * @param {string} aProperty プロパティの名前 - * @type nsIRDFLiteral - * @return nsIRDFLiteral - */ - getLiteralProperty: function(aResourceOrID, aProperty){ - var source = (typeof(aResourceOrID)=="string") ? - this.getResource(aResourceOrID) : aResourceOrID; - var target = this.ds.GetTarget(source, - this.getResource(aProperty), true); - if(target) return target.QueryInterface(Components.interfaces.nsIRDFLiteral); - return null; - }, - - - /** - * nsIRDFInt 型のプロパティ値を設定する - * @param {variable} aResourceOrID リソースまたはリソースID - * @param {string} aProperty プロパティの名前 - * @param {number} aValue プロパティ値 - */ - setIntProperty: function(aResourceOrID, aProperty, aValue){ - var source = (typeof(aResourceOrID)=="string") ? - this.getResource(aResourceOrID) : aResourceOrID; - var property = this.getResource(aProperty); - var value = this.getIntLiteral(aValue); - - this.ds.Assert(source, property, value, true); - }, - - - /** - * nsIRDFInt 型のプロパティ値を取得する - * @param {variable} aResourceOrID リソースまたはリソースID - * @param {string} aProperty プロパティの名前 - * @type nsIRDFInt - * @return nsIRDFInt - */ - getIntProperty: function(aResourceOrID, aProperty){ - var source = (typeof(aResourceOrID)=="string") ? - this.getResource(aResourceOrID) : aResourceOrID; - var target = this.ds.GetTarget(source, - this.getResource(aProperty), true); - if(target) return target.QueryInterface(Components.interfaces.nsIRDFInt); - return null; - }, - - - /** - * nsIRDFDate 型のプロパティ値を設定する - * @param {variable} aResourceOrID リソースまたはリソースID - * @param {string} aProperty プロパティの名前 - * @param {number} aValue プロパティ値 - */ - setDateProperty: function(aResourceOrID, aProperty, aValue){ - var source = (typeof(aResourceOrID)=="string") ? - this.GetResource(aResourceOrID) : aResourceOrID; - var property = this.getResource(aProperty); - var value = this.getDateLiteral(aValue); - - this.ds.Assert(source, property, value, true); - }, - - - /** - * nsIRDFDate 型のプロパティ値を取得する - * @param {variable} aSourceOrID リソースまたはリソースID - * @param {string} aProperty プロパティの名前 - * @type nsIRDFDate - * @return nsIRDFDate - */ - getDateProperty: function(aSourceOrID, aProperty){ - var source = (typeof(aResourceOrID)=="string") ? - this.getResource(aResourceOrID) : aResourceOrID; - var target = this.ds.GetTarget(source, - this.getResource(aProperty), true); - if(target) return target.QueryInterface(Components.interfaces.nsIRDFDate); - return null; - }, - - - /** - * nsIRDFResource を作成してコンテナに格納する - * aParentContainerOrID を指定しない場合は コンテナに格納しない - * @param {string} aSourceID 作成するリソースの ID - * @param {variable} aParentContainerOrID リソースを格納するコンテナ - * @type nsIRDFResource - * @return 作成した nsIRDFResource - */ - appendResource: function(aResourceOrID, aParentContainerOrID){ - var resource = this.getResource(aResourceOrID); - if(aParentContainerOrID){ - var parentContainer = (typeof(parentContainer)=="string") ? - this.getContainer(aParentContainerOrID) : aParentContainerOrID; - parentContainer.AppendElement(resource); - } - return resource; - }, - - /** - * 新しい順指定(Seq)コンテナを作成する - * @param {string} aSourceID 作成するコンテナの ID - * @type nsIRDFContainer - * @return 作成した nsIRDFContainer - */ - makeSeqContainer: function(aResourceID){ - var containerRes = this.getResource(aResourceID); - return this._rdfContainerUtils.MakeSeq(this.ds, containerRes); - }, - - /** - * 指定した ID のコンテナを返す - * 存在しない場合は作成する - * @param {string} aSourceID コンテナの ID - * @type nsIRDFContainer - * @return 指定した nsIRDFContainer - */ - getContainer: function(aResourceID){ - try{ - var containerRes = this.getResource(aResourceID); - var rdfContainer = Components.classes["@mozilla.org/rdf/container;1"] - .createInstance(Components.interfaces.nsIRDFContainer); - rdfContainer.Init(this.ds, containerRes); - return rdfContainer; - }catch(ex){} - return this.makeSeqContainer(aResourceID); - }, - - - /** - * コンテナの内容を削除 - * @param {string} aSourceID コンテナの ID - */ - clearContainer: function(aResourceID){ - var container = this.getContainer(aResourceID); - while(container.GetCount()){ - container.RemoveElementAt(1, true); - } - }, - - - /** - * RDF データソースの XML ソースを返す - * @param {string} 追加する XML名前空間の接頭辞 (追加しないなら null) - * @param {string} 追加する XML名前空間の URI (追加しないなら null) - * @type {string} - * @return XML ソース - */ - getXmlSource: function(aNsPrefix, aNsURL){ - var serializer = Components.classes["@mozilla.org/rdf/xml-serializer;1"] - .createInstance(Components.interfaces.nsIRDFXMLSerializer); - serializer.init(this.ds); - - if(aNsPrefix && aNsURL){ - var atomService = Components.classes["@mozilla.org/atom-service;1"] - .createInstance(Components.interfaces.nsIAtomService); - var prefix = atomService.getAtom(aNsPrefix); - serializer.addNameSpace(prefix, aNsURL); - } - - var outputStream = { - data: "", - write: function(aBuffer, aCount){ - this.data += aBuffer; - return aCount; - } - }; - - serializer.QueryInterface(Components.interfaces.nsIRDFXMLSource) - .Serialize(outputStream); - return(outputStream.data); - } - -} From flyson @ users.sourceforge.jp Sat Sep 17 04:19:39 2005 From: flyson @ users.sourceforge.jp (flyson) Date: Sat, 17 Sep 2005 04:19:39 +0900 Subject: [Bbs2ch-cvs 10] CVS update: bbs2chreader/content/bbs2chreader Message-ID: <20050916191940.023B82AC013@users.sourceforge.jp> Index: bbs2chreader/content/bbs2chreader/bbsmenu-page.xul diff -u bbs2chreader/content/bbs2chreader/bbsmenu-page.xul:1.12 bbs2chreader/content/bbs2chreader/bbsmenu-page.xul:1.13 --- bbs2chreader/content/bbs2chreader/bbsmenu-page.xul:1.12 Thu Aug 25 21:53:37 2005 +++ bbs2chreader/content/bbs2chreader/bbsmenu-page.xul Sat Sep 17 04:19:39 2005 @@ -13,9 +13,7 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">