svnno****@sourc*****
svnno****@sourc*****
2008年 8月 27日 (水) 22:10:12 JST
Revision: 434 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=434 Author: flyson Date: 2008-08-27 22:10:12 +0900 (Wed, 27 Aug 2008) Log Message: ----------- [04_BRANCH]ã¾ã¡BBS offlaw å¯¾å¿ Modified Paths: -------------- branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/items.js branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/page.js branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/server/thread.js branches/bbs2chreader/04_BRANCH/components/nsBbs2chService.js -------------- next part -------------- Modified: branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/items.js =================================================================== --- branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/items.js 2008-07-04 19:05:26 UTC (rev 433) +++ branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/items.js 2008-08-27 13:10:12 UTC (rev 434) @@ -193,11 +193,11 @@ var charset = "Shift_JIS"; switch(this.type){ case this._bbs2chService.BOARD_TYPE_2CH: + case this._bbs2chService.BOARD_TYPE_MACHI: charset = "Shift_JIS"; break; case this._bbs2chService.BOARD_TYPE_BE2CH: case this._bbs2chService.BOARD_TYPE_JBBS: - case this._bbs2chService.BOARD_TYPE_MACHI: charset = "euc-jp"; break; } @@ -266,9 +266,10 @@ threadUrlSpec = baseUrlSpec + "bbs/read.cgi/" + categoryPath; break; case this._bbs2chService.BOARD_TYPE_MACHI: - categoryPath = this.url.directory.replace(/\//g, ""); baseUrlSpec = this.url.resolve("../"); - threadUrlSpec = baseUrlSpec + "bbs/read.cgi?BBS=" + categoryPath; + categoryPath = this.url.spec.substring(baseUrlSpec.length); + threadUrlSpec = baseUrlSpec + "bbs/read.cgi/" + categoryPath; + break; } @@ -294,9 +295,6 @@ item.force = this.getThreadForce(item.datID, item.count); item.makeDate = this._getFormatedDate(new Date(item.datID * 1000)); item.url = threadUrlSpec + item.datID + "/"; - if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ - item.url = threadUrlSpec + "&KEY=" + item.datID; - } if(logItemHash.hasOwnProperty("item-" + item.datID)){ var logItem = logItemHash["item-" + item.datID]; @@ -393,9 +391,6 @@ logItem.force = 0; logItem.makeDate = this._getFormatedDate(new Date(logItem.datID * 1000)); logItem.url = aThreadUrlSpec + logItem.datID + "/"; - if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ - logItem.url = aThreadUrlSpec + "&KEY=" + logItem.datID; - } if(logItem.id in cacheItemHash && cacheItemHash[logItem.id].lastModified == lastModified){ @@ -468,4 +463,4 @@ } -} \ No newline at end of file +} Modified: branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/page.js =================================================================== --- branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/page.js 2008-07-04 19:05:26 UTC (rev 433) +++ branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/board/page.js 2008-08-27 13:10:12 UTC (rev 434) @@ -313,11 +313,7 @@ if(isNaN(threadViewLimit) || threadViewLimit == 0){ threadViewLimit = ""; }else{ - if(gBoardItems.type == gBbs2chService.BOARD_TYPE_MACHI){ - threadViewLimit = "&LAST=" + threadViewLimit; - }else{ threadViewLimit = "l" + threadViewLimit; - } } var url = "/thread/" + gBoardItems.items[index].url + threadViewLimit; Modified: branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/server/thread.js =================================================================== --- branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/server/thread.js 2008-07-04 19:05:26 UTC (rev 433) +++ branches/bbs2chreader/04_BRANCH/chrome/content/bbs2chreader/server/thread.js 2008-08-27 13:10:12 UTC (rev 434) @@ -741,27 +741,14 @@ } b2rThreadMachi.prototype = { - get optionsStart(){ - return (this.dat.queryHash["START"]) ? parseInt(this.dat.queryHash["START"]) : null; - }, - get optionsLast(){ - return (this.dat.queryHash["LAST"]) ? parseInt(this.dat.queryHash["LAST"]) : null; - }, - get optionsEnd(){ - return (this.dat.queryHash["END"]) ? parseInt(this.dat.queryHash["END"]) : null; - }, - get optionsNoFirst(){ - return (this.dat.queryHash["NOFIRST"] == "TRUE") ? true : false; - }, - datDownload: function(){ - var datURLSpec = this.dat.datURL.spec + var datURLSpec = this.dat.threadURL.resolve("./").replace("read.cgi", "offlaw.cgi"); this._aboneChecked = true; this._threadAbone = false; // ·ªGET if(this.dat.datFile.exists() && this.dat.lineCount){ - datURLSpec += "&NOFIRST=TRUE&START=" + (this.dat.lineCount + 1); + datURLSpec += (this.dat.lineCount + 1) + "-"; } var datURL = this._ioService.newURI(datURLSpec, null, null) .QueryInterface(Components.interfaces.nsIURL); @@ -774,106 +761,13 @@ this.httpChannel.asyncOpen(this, null); }, - onStartRequest: function(aRequest, aContext){ - this._bInputStream = Components.classes["@mozilla.org/binaryinputstream;1"] - .createInstance(Components.interfaces.nsIBinaryInputStream); - this._htmlData = new Array(); - }, + datLineParse: function(aLine, aNumber, aNew){ + var resArray = aLine.split("<>"); + resArray.shift(); + var super = b2rThread2ch.prototype.datLineParse; + return super.apply(this, [resArray.join("<>"), aNumber, aNew]); + } - onDataAvailable: function (aRequest, aContext, aInputStream, aOffset, aCount){ - if(!this._opend) return; - - aRequest.QueryInterface(Components.interfaces.nsIHttpChannel); - var httpStatus = aRequest.responseStatus; - // KvÈîñªÈ¢ÈçI¹ - if(!(httpStatus==200 || httpStatus==206)) return; - if(aCount == 0) return; - - this._bInputStream.setInputStream(aInputStream); - var availableData = this._bInputStream.readBytes(aCount); - // NULL ¶ - availableData = availableData.replace(/\x00/g, "*"); - - this._htmlData.push(availableData); - this.write(" "); - }, - - onStopRequest: function(aRequest, aContext, aStatus){ - if(!this._opend) return; - - this._bInputStream = null; - aRequest.QueryInterface(Components.interfaces.nsIHttpChannel); - var httpStatus = aRequest.responseStatus; - - switch(httpStatus){ - case 200: // ÊíGET OK - case 206: // ·ªGET OK - break; - default: // HTTP G[ - this.write(this.converter.getFooter(httpStatus)); - this.close(); - return; - } - - var datLines = this.machiHTML2DAT(this._htmlData.join("")); - this._htmlData = null; - - if(datLines.length == 0){ // ¢XV - this.write(this.converter.getFooter("not_modified")); - this.close(); - return; - } - - for(var i=0; i<datLines.length; i++){ - this.write(this.datLineParse(datLines[i], this.dat.lineCount+i+1, true)); - } - - if(httpStatus == 200 || httpStatus == 206){ - this.dat.lineCount += datLines.length; - - var datData = datLines.join("\n"); - if(this.dat.idxFile.exists()){ - datData = "\n" + datData; - } - this.datSave(datData); - } - - this.write(this.converter.getFooter("ok")); - this.close(); - - this._data = null; - }, - - machiHTML2DAT: function(aResponse){ - // bZ[Wªªñsɪ©êÄ¢éÌÅêsÉ·é - var datLines = aResponse.replace(/\n \]\<\/font\>/gm, " ]</font>"); - datLines = datLines.split("\n"); - - // bZ[WÆ^CgÈOÌsðí - var reg = /^<(?:title>|dt>\d)/; - datLines = datLines.filter(function(aElement, aIndex, aArray){ - return reg.test(aElement); - }); - - // zñÌêÂÚÍ^Cg - var datTitle = datLines.shift().replace(/<\/?title>/g, ""); - - datLines = datLines.map(function(aElement, aIndex, aArray){ - var datLine = aElement; - var name = (datLine.match(/<b> ([^<]+) <\/b>/i)) ? RegExp.$1 : ""; - var mail = (datLine.match(/<a href="mailto:([^"]+)"><b>/i)) ? RegExp.$1 : ""; - var date = (datLine.match(/eúF ([^<]+) <font/)) ? RegExp.$1 : ""; - var message = (datLine.match(/<br><dd>/)) ? RegExp.rightContext : ""; - message = message.replace(/ <br><br>$/, ""); - message = message.replace(/<a href="[^"]+" target="_blank">([^<]+)<\/a>/g, "$1"); - var datNumber = (datLine.match(/<dt>(\d+) ¼O/)) ? parseInt(RegExp.$1) : 0; - var title = (datNumber==1) ? datTitle : ""; - return name +"<>"+ mail +"<>"+ date +"<>"+ message +"<>" + title; - }); - - return datLines; - } - }; b2rThreadMachi.prototype.__proto__ = b2rThread2ch.prototype; @@ -890,13 +784,9 @@ get threadPlainURL(){ if(!this._threadPlainURL){ - if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ - this._threadPlainURL = this.datURL; - }else{ - var threadPlainSpec = this.threadURL.resolve("./"); - this._threadPlainURL = this._ioService.newURI(threadPlainSpec, null, null) - .QueryInterface(Components.interfaces.nsIURL); - } + var threadPlainSpec = this.threadURL.resolve("./"); + this._threadPlainURL = this._ioService.newURI(threadPlainSpec, null, null) + .QueryInterface(Components.interfaces.nsIURL); } return this._threadPlainURL; }, @@ -908,8 +798,7 @@ get datURL(){ if(!this._datURL){ if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ - var datURLSpec = this.threadURL.resolve("./read.cgi"); - datURLSpec += "?BBS=" + this.queryHash["BBS"] + "&KEY=" + this.queryHash["KEY"]; + var datURLSpec = this.threadURL.spec.replace("/read.cgi/", "/offlaw.cgi/") + this.id + "/"; this._datURL = this._ioService.newURI(datURLSpec, null, null) .QueryInterface(Components.interfaces.nsIURL); }else{ @@ -950,11 +839,7 @@ get id(){ if(!this._id){ - if(this.type == this._bbs2chService.BOARD_TYPE_MACHI){ - this._id = this.queryHash["KEY"] || null; - }else{ - this._id = this.threadURL.directory.match(/\/(\d{9,10})/) ? RegExp.$1 : null; - } + this._id = this.threadURL.directory.match(/\/(\d{9,10})/) ? RegExp.$1 : null; } return this._id; }, @@ -1351,4 +1236,4 @@ return false; } -}; \ No newline at end of file +}; Modified: branches/bbs2chreader/04_BRANCH/components/nsBbs2chService.js =================================================================== --- branches/bbs2chreader/04_BRANCH/components/nsBbs2chService.js 2008-07-04 19:05:26 UTC (rev 433) +++ branches/bbs2chreader/04_BRANCH/components/nsBbs2chService.js 2008-08-27 13:10:12 UTC (rev 434) @@ -372,11 +372,10 @@ boardURLSpec = boardURLSpec.replace("/test/read.cgi/", "/"); break; case this.BOARD_TYPE_JBBS: + case this.BOARD_TYPE_MACHI: boardURLSpec = boardURLSpec.replace("/bbs/read.cgi/", "/"); break; case this.BOARD_TYPE_OLD2CH: - case this.BOARD_TYPE_MACHI: - boardURLSpec += url.query.match(/bbs=(\w+)/i) ? RegExp.$1 + "/" : null; break; } return this._ioService.newURI(boardURLSpec, null, null) @@ -883,4 +882,4 @@ function NSGetModule(aCompMgr, aFileSpec){ return Module; -} \ No newline at end of file +}