1 /*!
  2  * @include "_NameSpace.js"
  3  * @include "Board.js"
  4  * @include "RangeList.js"
  5  * @include "ReferredList.js"
  6  * @include "ResItem.js"
  7  * @include "Strings.js"
  8  */
  9 
 10 /**
 11  * スレの情報を参照するオブジェクト。レス内容、タイトルやレス数などの情報取得と一部変更が可能。
 12  * 
 13  * @class _JVS.ThreadItem
 14  */
 15 _JVS.ThreadItem = function(){
 16 	/**
 17 	 * オブジェクトが参照するスレが属する板のBoardオブジェクト
 18 	 * Action:○ LateCall:○ Command:○
 19 	 * @type _JVS.Board
 20 	 */
 21 	this.Board = null;
 22 	
 23 	/**
 24 	 * ThreadItemが参照するスレの実体が存在しているかどうか
 25 	 * true  存在しており、アクセス可能
 26 	 * false 削除されており、アクセス不可
 27 	 * 
 28 	 * ※スレはスクリプトからThreadItemオブジェクトに参照されることで参照カウントが加算されるため、
 29 	 * 現在の実装ではThreadItemへの参照がある限りConnectedがfalseになることはない。
 30 	 * 
 31 	 * Action:○ LateCall:○ Command:○
 32 	 * @type bool
 33 	 */
 34 	this.Connected = true;
 35 	
 36 	/**
 37 	 * スレのログ(datファイル)が存在するか
 38 	 * true  存在する
 39 	 * false 存在しない
 40 	 * Action:○ LateCall:○ Command:○
 41 	 * @type bool
 42 	 */
 43 	this.DatExist = true;
 44 	
 45 	/**
 46 	 * dat名(datファイルのファイル名から拡張子を取り除いたもの)
 47 	 * Action:○ LateCall:○ Command:○
 48 	 * @type String
 49 	 */
 50 	this.DatName = "1234567890";
 51 	
 52 	/**
 53 	 * 取得済みのdatファイルの大きさ(単位:byte)
 54 	 * Action:○ LateCall:○ Command:○
 55 	 * @type int
 56 	 */
 57 	this.DatSize = 100*1024;
 58 	
 59 	/**
 60 	 * datファイル全体の文字列
 61 	 * Action:○ LateCall:○ Command:○
 62 	 * @type String
 63 	 */
 64 	this.DatText = "name<>mail<>date<>message<>thread\n";
 65 	
 66 	/**
 67 	 * スレのΔレス値
 68 	 * Action:○ LateCall:○ Command:○
 69 	 * @type int
 70 	 */
 71 	this.DeltaRes = 1;
 72 	
 73 	/**
 74 	 * スレの最終レスの時刻値
 75 	 * 最終レスが未定義値の場合は0。
 76 	 * Action:○ LateCall:○ Command:○
 77 	 * @type int
 78 	 */
 79 	this.FinalRes = 0;
 80 	
 81 	/**
 82 	 * レスのあぼーん状態を取得する
 83 	 * Action:○ LateCall:○ Command:○
 84 	 * @param {int} Index あぼーんの状態を取得するレスのレス番号
 85 	 * @return {int} レスのあぼーん状態
 86 	 * 0: 通常
 87 	 * 1: あぼーん
 88 	 * 2: 透明あぼーん
 89 	 * 4: レスチェック
 90 	 */
 91 	this.GetAbone = function(Index){return 0;};
 92 	
 93 	/**
 94 	 * レスに含まれた>>1などのレス番リンクの参照先一覧を保持したRangeListオブジェクトを取得する。
 95 	 * Action:○ LateCall:○ Command:○
 96 	 * 
 97 	 * @example
 98 	 * >>4 >>1-2 >>6-8 というリンクを持ったレスでは、次の内容のRangeListが戻り値として得られる。
 99 	 * 
100 	 * RangeList.Count == 3
101 	 * RangeList.RangeBegin(0) == 1, RangeList.RangeEnd(0) == 2
102 	 * RangeList.RangeBegin(1) == 4, RangeList.RangeEnd(1) == 4
103 	 * RangeList.RangeBegin(2) == 6, RangeList.RangeEnd(2) == 8
104 	 * RangeList.WholeRangeWidth == 6
105 	 * 
106 	 * ただし、得られたRangeはソートされ、参照先の範囲が連続したものは結合、重複は削除されるので、
107 	 * 元のレス番参照が例えば>>1,2 >>4 >>6-7 >>7-8であっても同じ結果になり、区別できない
108 	 * 
109 	 * @param {int} Index レス番リンク参照一覧を取得するレスのレス番号
110 	 * @param {int} IncludeName
111 	 * @return {_JVS.RangeList} レス番リンク参照一覧を保持したRangeList
112 	 */
113 	this.GetNumberLinks = function(Index, IncludeName){return null;};
114 	
115 	/**
116 	 * スレの全レスについて、>>1などのレス番リンクでそのレスを参照した元スレの一覧を保持した
117 	 * ReferredListオブジェクトを取得する。
118 	 * Action:○ LateCall:○ Command:○
119 	 * @return {_JVS.ReferredList} そのスレのレス番リンク情報を保持したReferredListオブジェクト
120 	 */
121 	this.GetReferredList = function(){return null;};
122 	
123 	/**
124 	 * レスの内容を保持したResItemオブジェクトを取得する
125 	 * Action:○ LateCall:○ Command:○
126 	 * @param {int} Index 内容を取得するレスのレス番
127 	 * @return {_JVS.ResItem} レス内容を保持したResItemオブジェクト
128 	 */
129 	this.GetRes = function(Index){return null;};
130 	
131 	/**
132 	 * レスに含まれるURLの一覧を取得する
133 	 * Action:○ LateCall:○ Command:○
134 	 * @param {int} Index URL一覧を取得するレスのレス番
135 	 * @return {_JVS.Strings} URL一覧を保持したStringsオブジェクト
136 	 */
137 	this.GetUrlList = function(Index){return null;};
138 	
139 	/**
140 	 * Subject.txtから取得したレス数(スレ一覧の「レス」)
141 	 * Action:○ LateCall:○ Command:○
142 	 * @type int
143 	 */
144 	this.ItemCount = 1;
145 	
146 	/**
147 	 * スレの勢いΔの値
148 	 * Action:○ LateCall:○ Command:○
149 	 * @type int
150 	 */
151 	this.ItemDelta = 1;
152 	
153 	/**
154 	 * スレの最終取得の時刻値
155 	 * 最終レスが未定義値の場合は0。
156 	 * @type int
157 	 */
158 	this.LastGot = 0;
159 	
160 	/**
161 	 * datの最終更新時刻(httpレスポンスヘッダから取得した文字列)
162 	 * 
163 	 * 参考:javascriptの日付オブジェクトに変換する方法
164 	 * var lastModified = new Date(thread.lastModified);
165 	 * 
166 	 * Action:○ LateCall:○ Command:○
167 	 * @type String
168 	 */
169 	this.LastModified = "Thu, 01 Jan 1970 00:00:00 GMT";;
170 	
171 	/**
172 	 * スレの最終書き込みの時刻値。未定義値の場合は0。
173 	 * Action:○ LateCall:○ Command:○
174 	 * @type int
175 	 */
176 	this.LastWrote = 0;
177 	
178 	/**
179 	 * 取得済みのレス数
180 	 * Action:○ LateCall:○ Command:○
181 	 * @type int
182 	 */
183 	this.Lines = 1;
184 	
185 	/**
186 	 * 該当のスレを表示しているスレビューがある場合はそのスレを再読込する。
187 	 * SetAbone()であぼーん状態を設定したり、NGを新規追加した後に表示にそれらを反映するのに使用する
188 	 * Action:○ LateCall:○ Command:○
189 	 */
190 	this.LocalReload = function(){};
191 	
192 	/**
193 	 * スレの印の状態
194 	 * 1: 印あり
195 	 * 0: 印なし
196 	 * Action:○ LateCall:○ Command:○
197 	 * @type int
198 	 */
199 	this.Mark = 0;
200 	
201 	/**
202 	 * 板一覧上でのスレの番号。過去ログの場合は0
203 	 * Action:○ LateCall:○ Command:○
204 	 * @type int
205 	 */
206 	this.Number = 1;
207 	
208 	/**
209 	 * システムでは使用/制御しない。
210 	 * スクリプトがスレごとに固有の情報を保持させたい場合に情報をこのプロパティに代入する。
211 	 * スクリプトごとに保存領域が分けられているので、同じThreadItemに対してA.jsとB.jsが別々に
212 	 * ThreadItem.Objを設定できる。逆に、他のスクリプトが設定したObjを参照することはできない。
213 	 * スクリプトからの参照がなくなってもObjは保持され、再度スクリプトから参照すれば値を取得可能。
214 	 * ただし、スレは板の更新時に参照がなければ削除→再作成されるので、ThreadItemオブジェクトから
215 	 * 参照されていないスレが保持するObjはそのスレが所属する板の更新により高い確率で失われる。
216 	 * 
217 	 * Action:○ LateCall:○ Command:○
218 	 * @type Object
219 	 */
220 	this.Obj = null;
221 	
222 	/**
223 	 * 読み込み済みのスレのうち、既読になっているレスの番号
224 	 * 閉じた状態のスレにこの値を設定してから開くことで「この先を未読で閉じる」が設定してあるのと
225 	 * 同等の効果が得られる。
226 	 * Action:○ LateCall:○ Command:○
227 	 * @type int 
228 	 */
229 	this.OldLines = 1;
230 	
231 	/**
232 	 * レスのあぼーん状態を設定する。SetAboneを行ってもスレビューの表示には反映されない。
233 	 * 表示に反映させるには、必要なあぼーんを設定した後にThreadItem.LocalReload()を呼び出して
234 	 * 再読込を行う。
235 	 * Action:○ LateCall:○ Command:○
236 	 * @param {int} Index あぼーんの状態を取得するレスのレス番号
237 	 * @param {int} Value レスに設定するあぼーん状態
238 	 * 0: 通常
239 	 * 1: あぼーん
240 	 * 2: 透明あぼーん
241 	 * 4: レスチェック
242 	 */
243 	this.SetAbone = function(Index, Value){};
244 	
245 	/**
246 	 * スレのタイトル。変更すると.idxファイルに変更が保存され、以後はそのスレタイで表示される。
247 	 * Action:○ LateCall:○ Command:○
248 	 * @type String
249 	 */
250 	this.Title = "";
251 	
252 	/**
253 	 * スレのURL。レス数指定などは付かない。
254 	 * Action:○ LateCall:○ Command:○
255 	 * @type String
256 	 */
257 	this.URL = "";
258 	
259 	/**
260 	 * スレに記憶させたコテメールアドレス
261 	 * @type String
262 	 */
263 	this.UserdWriteMail = "";
264 	
265 	/**
266 	 * スレに記憶させたコテ名
267 	 * @type String
268 	 */
269 	this.UserdWriteName = "";
270 };
271