Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/HTMLCreate.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4 by h677, Thu Aug 25 16:11:02 2005 UTC revision 1.4.2.11 by h677, Fri Nov 4 03:06:53 2005 UTC
# Line 4  interface Line 4  interface
4    
5  uses  uses
6          Windows, Messages, SysUtils, Classes, {Graphics,} Controls, {Forms,}          Windows, Messages, SysUtils, Classes, {Graphics,} Controls, {Forms,}
7          ComCtrls, IniFiles, ShellAPI, Math, GikoSystem,          ComCtrls, IniFiles, ShellAPI, Math, GikoSystem, ActiveX,
8  {$IF Defined(DELPRO) }  {$IF Defined(DELPRO) }
9          SHDocVw,          SHDocVw,
10          MSHTML,          MSHTML,
# Line 31  type Line 31  type
31                  constructor Create;                  constructor Create;
32    
33                  function AddBeProfileLink(AID : string; ANum: Integer):string ;                  function AddBeProfileLink(AID : string; ANum: Integer):string ;
34                  procedure CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);                  procedure CreateUsePluginHTML(html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
35                  procedure CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);                  procedure CreateUseSKINHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList);
36                  procedure CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );                  procedure CreateUseCSSHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
37                  procedure CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );                  procedure CreateDefaultHTML (html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
38                  function ConvertResAnchor(res: string): string;                  function ConvertResAnchor(res: string): string;
39                    procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
40          public          public
41                  { Public 宣言 }                  { Public 宣言 }
42                  function AddAnchorTag(s: string): string;                  function AddAnchorTag(s: string): string;
43                  function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;                  function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;
44                  function SkinedRes(skin: string; Res: TResRec; No: string): string;                  function SkinedRes(skin: string; Res: TResRec; No: string): string;
45                  function ConvRes(const Body, Bbs, Key,  ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;                  function ConvRes(const Body, Bbs, Key,  ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
46                  function ConvRes(const Body, Bbs, Key,  ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;                  procedure CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
                 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);  
47                  procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);                  procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
48          end;          end;
49    
# Line 118  begin Line 118  begin
118                          CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));                          CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
119                          CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));                          CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
120    
121    
122                          //----- とりあえずかちゅ〜しゃ互換用。コメントアウトしてもよし                          //----- とりあえずかちゅ〜しゃ互換用。コメントアウトしてもよし
123                          // やりかたが苦しいけど、オプションダイアログのプレビュー用 try                          if GikoSys.Setting.UseKatjushaType then begin
124                          try                                  // やりかたが苦しいけど、オプションダイアログのプレビュー用 try
125                                  if ThreadItem.ParentBoard <> nil then                                  try
126                                          if ThreadItem.ParentBoard.ParentCategory <> nil then                                          if ThreadItem.ParentBoard <> nil then
127                                                  CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);                                                  if ThreadItem.ParentBoard.ParentCategory <> nil then
128                                          CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);                                                          CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
129                          except end;                                                  CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
130                          CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);                                  except end;
131                          CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);                                  CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
132                          CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);                                  CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
133                          CustomStringReplace( Skin, '&SKINPATH', GikoSys.Setting.CSSFileName);                                  CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
134                          CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));                                  CustomStringReplace( Skin, '&SKINPATH', GikoSys.Setting.CSSFileName);
135                          CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));                                  CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
136                          CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));                                  CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
137                                    CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
138                          CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));  
139                          CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));                                  CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
140                          CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));                                  CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
141                          //----- ここまで                                  CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
142                                    //----- ここまで
143                            end;
144                  end;                  end;
145                  Result := Skin.Text;                  Result := Skin.Text;
146          finally          finally
# Line 174  begin Line 177  begin
177                  Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );                  Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
178    
179                  //----- かちゅ〜しゃ互換用。コメントアウトしてもよし                  //----- かちゅ〜しゃ互換用。コメントアウトしてもよし
180                  Skin := CustomStringReplace( Skin, '&NUMBER',                  if GikoSys.Setting.UseKatjushaType then begin
181                          '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');                          Skin := CustomStringReplace( Skin, '&NUMBER',
182                  Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);                                  '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
183                  Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');                          Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
184                  Skin := CustomStringReplace( Skin, '&MAILNAME',                          Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
185                          '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');                          Skin := CustomStringReplace( Skin, '&MAILNAME',
186                  Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);                                  '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
187                  Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);                          Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
188                  Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);                          Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
189                  Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );                          Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
190                  Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );                          Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
191                            Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
192            end;
193                  //----- ここまで                  //----- ここまで
194    
195                  Result := Skin;                  Result := Skin;
# Line 296  begin Line 301  begin
301          end else          end else
302                  Result := AID;                  Result := AID;
303  end;  end;
304    procedure THTMLCreate.separateNumber(var st: String; var et: String; const Text, Separator: String);
305    var
306            p : Integer;
307    begin
308            p := Pos(Separator,Text);
309            if (p > 0 ) then begin
310                    st := Copy(Text, 1, p - 1);
311                    et := Copy(Text, p + Length(Separator), Length(Text));
312            end else begin
313                    st := Text;
314                    et := Text;
315            end;
316    end;
317    
318  (*************************************************************************  (*************************************************************************
319   *   *
320   * from HotZonu   * from HotZonu
# Line 303  end; Line 322  end;
322  function THTMLCreate.ConvRes(const Body, Bbs, Key,  function THTMLCreate.ConvRes(const Body, Bbs, Key,
323          ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;          ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
324          DatToHTML: boolean = false): string;          DatToHTML: boolean = false): string;
 type  
         PIndex = ^TIndex;  
         TIndex = record  
                 FIndexFrom      : integer;  
                 FIndexTo                : integer;  
                 FNo                              : string;  
         end;  
325  const  const
326          GT      = '&gt;';          GT      = '&gt;';
327          SN      = '0123456789-';          SN      = '0123456789';
328          ZN      = '0123456789−';          FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
329  var  var
330          i : integer;          i : integer;
331          s,r : string;          s : string;
         b : TMbcsByteType;  
332          sw: boolean;          sw: boolean;
333          sp: integer;          cm: boolean;
334          No: string;          No: string;
         sx: string;  
         List: TList;  
335          oc      : string;          oc      : string;
336          st, et: string;          pos, pmin : integer;
337          chk : boolean;          j : integer;
338          al : boolean;          token : array[0..5] of string;
339          procedure Add(IndexFrom, IndexTo: integer; const No: string);          ch : string;
340          var          db : boolean;
341                  FIndex : PIndex;          len : integer;
342          begin          rink : string;
343                  New(FIndex);          function addResAnchor(const Left :string) : string;
                 FIndex.FIndexFrom       := IndexFrom;  
                 FIndex.FIndexTo         := IndexTo;  
                 FIndex.FNo                               := No;  
                 List.Add(FIndex);  
         end;  
         function ChooseString(const Text, Separator: string; Index: integer): string;  
344          var          var
345                  S : string;                  st,et : string;
                 i, p : integer;  
346          begin          begin
347                  S :=    Text;                  //終端まで行っての終了かチェック
348                  for i :=        0 to    Index - 1 do    begin                  if j <= len then begin
349                          if      (AnsiPos(Separator, S) = 0) then        S :=    ''                          if db then j := j - 2
350                          else    S :=    Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));                          else j := j - 1;
351                  end;                  end;
352                  p :=    AnsiPos(Separator, S);                  //何も数字が見つからないとき
353                  if      (p > 0) then    Result  :=      Copy(S, 1, p - 1) else Result :=        S;                  if No = '' then begin
354          end;                          Result := Left + Copy(s, 1, j - 1);
 begin  
         { v1.0 b2 - 03 }  
         s        :=     Body;  
         r        :=     Body;  
         i        :=     1;  
         sw      :=      False;  
         No      :=      '';  
         List:=  TList.Create;  
         oc      :=      '';  
         sp      :=      0;  
         chk :=  False;  
         al      :=      False;  
         while true      do      begin  
                 b :=    ByteType(s, i);  
                 case    b of  
                         mbSingleByte    : begin  
                                 if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin  
                                         if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 i :=    i + 7;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin  
                                         if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then        begin  
                                                 i :=    i + 7;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,4) = GT) then    begin  
                                         if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 i :=    i + 3;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      ((not sw) and (Copy(s,i,1) = ',')) or  
                                                 ((not sw) and (Copy(s,i,1) = '=')) then begin  
                                         if      ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or  
                                                         ((Chk) and      (oc = '')) or  
                                                         ((not Chk) and (al)) then  
                                         begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 //i :=  i + 1;  
                                                 oc:='';  
                                         end;  
                                 end else  
                                 if      (sw) then begin  
                                         sx      :=      Copy(s,i,1);  
                                         if      (AnsiPos(sx, SN) > 0)   then    begin  
                                                 No      :=      No      + sx;  
                                         end else begin  
                                                 if      (No <> '') and (No <> '-')       then   begin  
                                                         Add(sp, i, No);  
                                                         al := True;  
                                                 end;  
                                                 sw      :=      False;  
                                                 //  
                                                 i := i - 1;  
                                                 //  
                                                 No      := '';  
                                                 oc:='';  
                                                 //chk :=        False;  
                                         end;  
                                 end else begin  
                                         if      Copy(s,i,1) = '<' then  oc      :=      '';  
                                         oc      :=      oc + Copy(s,i,1);  
                                         chk :=  False;  
                                         al      :=      False;  
                                 end;  
                         end;  
                         mbLeadByte      : begin  
                                 if      (not sw) and (Copy(s,i,4) = '>>') then        begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         i :=    i + 3;  
                                         chk :=  True;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,2) = '>') then  begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         i :=    i + 1;  
                                         chk :=  True;  
                                 end else  
                                 if      (sw) then begin  
                                         sx      :=      Copy(s,i,2);  
                                         if      (AnsiPos(sx, ZN) > 0)   then    begin  
                                                 No      :=      No      + ZenToHan(sx);  
                                         end else begin  
                                                 if      (No <> '') and (No <> '-')      and (No <> '−') then   begin  
                                                         Add(sp, i, No);  
                                                 end;  
                                                 sw      :=      False;  
                                                 i := i - 1;  
                                                 No      :=      '';  
                                         end;  
                                 end else begin  
                                         oc      :=      '';  
                                         chk :=  False;  
                                 end;  
                                 al      :=      False;  
                         end;  
                 end;  
                 inc(i);  
                 if      (i > Length(Body))      then    begin  
                         if      (sw)    then    begin  
                                 if      (No <> '')      then    Add(sp, i, No);  
                         end;  
                         Break;  
                 end;  
         end;  
         for i :=        List.Count - 1  downto  0 do    begin  
                 if      (AnsiPos('-', PIndex(List[i]).FNo) > 0) then    begin  
                         st      :=      ChooseString(PIndex(List[i]).FNo, '-', 0);  
                         et      :=      ChooseString(PIndex(List[i]).FNo, '-', 1);  
355                  end else begin                  end else begin
356                          st      :=      PIndex(List[i]).FNo;                          separateNumber(st, et, No, '-');
                         et      :=      PIndex(List[i]).FNo;  
                 end;  
                 if not DatToHTML then  
                 r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +  
                                         Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',  
                                                                 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +  
                                         Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +  
                                         Copy(r,PIndex(List[i]).FIndexTo,Length(r))  
                 else  
                 r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +  
                                         Format('<a href="#%s">', [st]) +  
                                         Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +  
                                         Copy(r,PIndex(List[i]).FIndexTo,Length(r));  
357    
358                  Dispose(PIndex(List[i]));                          if not DatToHTML then begin
359                                    Result := Left + Format(FORMAT_LINK,
360                                                            [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]);
361                            end else begin
362                                    Result := Left + Format('<a href="#%s">', [st]);
363                            end;
364                            Result := Result + Copy(s, 1, j - 1) + '</a>';
365                    end;
366                    Delete(s, 1, j - 1);
367          end;          end;
         List.Free;  
         Result  :=      r;  
 end;  
368    
369  function THTMLCreate.ConvRes(          procedure getNumberString;
         const Body, Bbs, Key, ParamBBS, ParamKey,  
         ParamStart, ParamTo, ParamNoFirst,  
         ParamTrue, FullURL : string  
 ): string;  
 type  
         PIndex = ^TIndex;  
         TIndex = record  
                 FIndexFrom      : integer;  
                 FIndexTo                : integer;  
                 FNo                              : string;  
         end;  
 const  
         GT      = '&gt;';  
         SN      = '0123456789-';  
         ZN      = '0123456789−';  
 var  
         i : integer;  
         s,r : string;  
         b : TMbcsByteType;  
         sw: boolean;  
         sp: integer;  
         No: string;  
         sx: string;  
         List: TList;  
         oc      : string;  
         st, et: string;  
         chk : boolean;  
         al : boolean;  
         procedure Add(IndexFrom, IndexTo: integer; const No: string);  
         var  
                 FIndex : PIndex;  
370          begin          begin
371                  New(FIndex);                  while (j <= len) do begin
372                  FIndex.FIndexFrom       := IndexFrom;                          if (ByteType(s, j) = mbSingleByte) then begin
373                  FIndex.FIndexTo         := IndexTo;                                  //1byte文字
374                  FIndex.FNo                               := No;                                  ch := s[j];
375                  List.Add(FIndex);                                  Inc(j);
376                                    db := false;
377                            end else begin
378                                    //2byte文字
379                                    ch := ZenToHan(Copy(s, j, 2));
380                                    Inc(j, 2);
381                                    db := true;
382                            end;
383    
384                            if System.Pos(ch, SN) > 0 then begin
385                                    No := No + ch;
386                            end else if (ch = '-') then begin
387                                    if sw then break;
388                                    if No = '' then break;
389                                    No := No + ch;
390                                    sw := true;
391                            end else begin
392                                    break;
393                            end;
394                    end;
395          end;          end;
396          function ChooseString(const Text, Separator: string; Index: integer): string;  
397          var          function checkComma : boolean;
                 S : string;  
                 i, p : integer;  
398          begin          begin
399                  S :=    Text;                  j := 1;
400                  for i :=        0 to    Index - 1 do    begin                  len := Length(s);
401                          if      (AnsiPos(Separator, S) = 0) then        S :=    ''                  if ((len > 0) and (s[j] = ',')) or ((len > 1) and (ZenToHan(Copy(s, j ,2)) = ','))  then begin
402                          else    S :=    Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));                          Result := true;
403                            if (ByteType(s, j) = mbSingleByte) then
404                                    Inc(j)
405                            else
406                                    Inc(j, 2);
407                            No := '';
408                    end else begin
409                            Result := false;
410                  end;                  end;
                 p :=    AnsiPos(Separator, S);  
                 if      (p > 0) then    Result  :=      Copy(S, 1, p - 1) else Result :=        S;  
411          end;          end;
412  begin  begin
413          { v1.0 b2 - 03 }          //s に本文を全部入れる
414          s        :=     Body;          s        :=     Body;
415          r        :=     Body;          //結果をクリア
416          i        :=     1;          Result   :=     '';
417          sw      :=      False;          //検索対象の文字列郡
418          No      :=      '';          token[0] := GT + GT;
419          List:=  TList.Create;          token[1] := GT;
420          oc      :=      '';          token[2] := '>>';
421          sp      :=      0;          token[3] := '>';
422          chk :=  False;          token[4] := '<a ';
423          al      :=      False;          token[5] := '<A ';
424          while true      do      begin  
425                  b :=    ByteType(s, i);          //
426                  case    b of          while Length(s) > 2 do begin
427                          mbSingleByte    : begin                  pmin := Length(s) + 1;
428                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin                  i       := Length(token);
429                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin                  for j := 0 to 5 do begin
430                                                  sw      :=      True;                          pos := AnsiPos(token[j], s);
431                                                  sp      :=      i;                          if pos <> 0 then begin
432                                                  i :=    i + 7;                                  if pos < pmin then begin
433                                                  oc:='';                                          //どれでヒットしたか保存
434                                                  chk :=  True;                                          i := j;
435                                          end;                                          //最小値を更新
436                                  end else                                          pmin := pos;
437                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin                                  end;
438                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then        begin                          end;
439                                                  i :=    i + 7;                  end;
440                                                  oc:='';  
441                                                  chk :=  True;                  //ヒットした文字列の一つ手前まで結果にコピー
442                                          end;                  Result := Result + Copy(s, 1, pmin - 1);
443                                  end else                  Delete(s, 1, pmin - 1);
444                                  if      (not sw) and (Copy(s,i,4) = GT) then    begin  
445                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin                  if i = 6 then begin
446                                                  sw      :=      True;                          //ヒットなし
447                                                  sp      :=      i;                  end else if (i = 4) or (i = 5) then begin
448                                                  i :=    i + 3;                          //'<a ' or '<A' でヒット '</a>' or '</A>' までコピー
449                                                  oc:='';                          pmin := AnsiPos('</a>' , s);
450                                                  chk :=  True;                          pos := AnsiPos('</A>' , s);
451                                          end;                          if (pmin <> 0) and (pos <> 0) then begin
452                                  end else                                  if (pmin > pos) then begin
453                                  if      ((not sw) and (Copy(s,i,1) = ',')) or                                          pmin := pos;
454                                                  ((not sw) and (Copy(s,i,1) = '=')) then begin                                  end;
455                                          if      ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or                          end else if (pos <> 0) then begin
456                                                          ((Chk) and      (oc = '')) or                                  pmin := pos;
457                                                          ((not Chk) and (al)) then                          end;
458                                          begin                          rink := Copy(s, 1, pmin + 3);
459                                                  sw      :=      True;                          Result := Result + rink;
460                                                  sp      :=      i;                          Delete(s, 1, pmin + 3);
461                                                  //i :=  i + 1;  
462                                                  oc:='';                          pmin := Length(rink);
463                                          end;                          i       := Length(token);
464                                  end else                          for j := 0 to 3 do begin
465                                  if      (sw) then begin                                  pos := AnsiPos(token[j], rink);
466                                          sx      :=      Copy(s,i,1);                                  if pos <> 0 then begin
467                                          if      (AnsiPos(sx, SN) > 0)   then    begin                                          if pos < pmin then begin
468                                                  No      :=      No      + sx;                                                  //どれでヒットしたか保存
469                                          end else begin                                                  i := j;
470                                                  if      (No <> '') and (No <> '-')       then   begin                                                  //最小値を更新
471                                                          Add(sp, i, No);                                                  pmin := pos;
472                                                          al := True;                                          end;
473                                                  end;                                  end;
474                                                  sw      :=      False;                          end;
475                                                  //                          // レスアンカーが含まれていたら,が続く限りアンカーとして扱う
476                                                  i := i - 1;                          if i <= 3 then begin
477                                                  //                                  No := '';
478                                                  No      := '';                                  cm := checkComma;
479                                                  oc:='';                                  len := Length(s);
480                                                  //chk :=        False;                                  while cm do begin
481                                          end;                                          getNumberString;
482                                  end else begin                                          Result := addResAnchor(Result);
483                                          if      Copy(s,i,1) = '<' then  oc      :=      '';                                          cm := checkComma;
                                         oc      :=      oc + Copy(s,i,1);  
                                         chk :=  False;  
                                         al      :=      False;  
                                 end;  
                         end;  
                         mbLeadByte      : begin  
                                 if      (not sw) and (Copy(s,i,4) = '>>') then        begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         i :=    i + 3;  
                                         chk :=  True;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,2) = '>') then  begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         i :=    i + 1;  
                                         chk :=  True;  
                                 end else  
                                 if      (sw) then begin  
                                         sx      :=      Copy(s,i,2);  
                                         if      (AnsiPos(sx, ZN) > 0)   then    begin  
                                                 No      :=      No      + ZenToHan(sx);  
                                         end else begin  
                                                 if      (No <> '') and (No <> '-')      and (No <> '−') then   begin  
                                                         Add(sp, i, No);  
                                                 end;  
                                                 sw      :=      False;  
                                                 i := i - 1;  
                                                 No      :=      '';  
                                         end;  
                                 end else begin  
                                         oc      :=      '';  
                                         chk :=  False;  
484                                  end;                                  end;
                                 al      :=      False;  
                         end;  
                 end;  
                 inc(i);  
                 if      (i > Length(Body))      then    begin  
                         if      (sw)    then    begin  
                                 if      (No <> '')      then    Add(sp, i, No);  
485                          end;                          end;
                         Break;  
                 end;  
         end;  
         for i :=        List.Count - 1  downto  0 do    begin  
                 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );  
                 if      (AnsiPos('-', PIndex(List[i]).FNo) > 0) then    begin  
                         st      :=      ChooseString(PIndex(List[i]).FNo, '-', 0);  
                         et      :=      ChooseString(PIndex(List[i]).FNo, '-', 1);  
486                  end else begin                  end else begin
487                          st      :=      PIndex(List[i]).FNo;                          //何かしら見つかったパターン
488                          et      :=      PIndex(List[i]).FNo;                          j := Length(token[i]) + 1;
489                            oc := '';
490                            No := '';
491                            sw := false;
492                            db := false;
493                            len := Length(s);
494                            getNumberString;
495                            Result := addResAnchor(Result);
496                  end;                  end;
                 r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +  
                                         Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',  
                                                                 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +  
                                         Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +  
                                         Copy(r,PIndex(List[i]).FIndexTo,Length(r));  
                 Dispose(PIndex(List[i]));  
497          end;          end;
498          List.Free;          Result := Result + s;
         Result  :=      r;  
499  end;  end;
500    
501  function THTMLCreate.ConvertResAnchor(res: string): string;  function THTMLCreate.ConvertResAnchor(res: string): string;
# Line 731  begin Line 547  begin
547  end;  end;
548    
549  //Pluginを利用するBoardのスレッドのHTMLを作成してdocに書き込む  //Pluginを利用するBoardのスレッドのHTMLを作成してdocに書き込む
550  procedure THTMLCreate.CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);  procedure THTMLCreate.CreateUsePluginHTML(html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
551  var  var
552          i: integer;          i: integer;
553          NewReceiveNo: Integer;          NewReceiveNo: Integer;
# Line 745  begin Line 561  begin
561                          NewReceiveNo    := ThreadItem.NewReceive;                          NewReceiveNo    := ThreadItem.NewReceive;
562                          // フォントやサイズの設定                          // フォントやサイズの設定
563                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
564                            html.BeginUpdate;
565                          try                          try
                                 doc.open;  
566                                  // ヘッダ                                  // ヘッダ
567                                  doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),                                  html.Append( boardPlugIn.GetHeader( DWORD( threadItem ),
568                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
569                                  doc.Write('<p id="idSearch"></p>' + #13#10 );                                  html.Add('<p id="idSearch"></p>');
   
570                                  for i := 0 to threadItem.Count - 1 do begin                                  for i := 0 to threadItem.Count - 1 do begin
571                                          // 1 は必ず表示                                          // 1 は必ず表示
572                                          if i <> 0 then begin                                          if i <> 0 then begin
# Line 774  begin Line 589  begin
589                                                  try                                                  try
590                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
591                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then
592                                                                          doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
593                                                                  else                                                                  else
594                                                                          doc.Write( '<a name="new"></a>' + #13#10 );                                                                          //doc.Write( '<a name="new"></a>' + #13#10 );
595                                                                            html.Append( '<a name="new"></a>' );
596                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
597                                                                  doc.Write('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>' + #13#10);                                                                  html.Append('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
598                                                          end else begin                                                          end else begin
599                                                                  doc.Write('</dl>');                                                                  html.Append('</dl>');
600                                                                  doc.Write('<a name="new"></a>');                                                                  html.Append('<a name="new"></a>');
601                                                                  doc.Write('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>新着レス ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');                                                                  html.Append('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>新着レス ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
602                                                                  doc.Write('<dl> + #13#10');                                                                  html.Append('<dl>');
603                                                          end;                                                          end;
604                                                  except                                                  except
605                                                          doc.Write( '<a name="new"></a>' + #13#10);                                                          html.Append( '<a name="new"></a>');
606                                                  end;                                                  end;
607                                          end;                                          end;
608    
609                                          // レス                                          // レス
610                                          doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );                                          html.Append( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
611    
612                                          if ThreadItem.Kokomade = (i + 1) then begin                                          if ThreadItem.Kokomade = (i + 1) then begin
613                                                  // ここまで読んだ                                                  // ここまで読んだ
614                                                  try                                                  try
615                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
616                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then
617                                                                          doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
618                                                                  else                                                                  else
619                                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                                          html.Append( '<a name="koko"></a>' );
620                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
621                                                                  doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10 );                                                                  html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>' );
622                                                          end else begin                                                          end else begin
623                                                                  doc.Write('</dl>');                                                                  html.Append('</dl>');
624                                                                  doc.Write('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>ココまで読んだ</b></font></td></tr></table>');                                                                  html.Append('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>ココまで読んだ</b></font></td></tr></table>');
625                                                                  doc.Write('<dl>' + #13#10 );                                                                  html.Append('<dl>' );
626                                                          end;                                                          end;
627                                                  except                                                  except
628                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                          html.Append( '<a name="koko"></a>' );
629                                                  end;                                                  end;
630                                          end;                                          end;
631                                  end;                                  end;
632    
633    
634                                  // スキン(フッタ)                                  // スキン(フッタ)
635                                  doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );                                  html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
636                          finally                          finally
637                                  doc.Close;                                  html.EndUpdate;
638                          end;                          end;
639    
640                  end;                  end;
# Line 826  begin Line 642  begin
642  end;  end;
643    
644    
645  procedure THTMLCreate.CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);  procedure THTMLCreate.CreateUseSKINHTML(html : TStringList; ThreadItem: TThreadItem; ReadList: TStringList);
646  var  var
647          i: integer;          i: integer;
648          No: string;          No: string;
# Line 838  var Line 654  var
654          SkinNewRes: string;          SkinNewRes: string;
655          SkinRes: string;          SkinRes: string;
656          strTmp : string;          strTmp : string;
657          function ReplaceRes( skin: string ): string;          threadKey : string;
         begin  
                 Result := SkinedRes( skin, Res, No );  
         end;  
658  begin  begin
659          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
660                  // スキン使用                  // スキン使用
# Line 850  begin Line 663  begin
663                          // フォントやサイズの設定                          // フォントやサイズの設定
664                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
665                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
666                          doc.open;  
667                            threadKey := ChangeFileExt(ThreadItem.FileName, '');
668                            html.BeginUpdate;
669                          try                          try
670                                  doc.charset := 'Shift_JIS';                                  //doc.charset := 'Shift_JIS';
671    
672                                  // スキンの設定                                  // スキンの設定
673                                  try                                  try
# Line 860  begin Line 675  begin
675                                          if Length( UserOptionalStyle ) > 0 then                                          if Length( UserOptionalStyle ) > 0 then
676                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',
677                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
678                                          doc.Write( SkinHeader + #13#10);                                          html.Append( SkinHeader);
679                                  except                                  except
680                                  end;                                  end;
681    
# Line 874  begin Line 689  begin
689                                  except                                  except
690                                  end;                                  end;
691    
692                                  doc.Write('<p id="idSearch"></p>' + #13#10);                                  html.Append('<p id="idSearch"></p>');
693                                  doc.Write('<a name="top"></a>' + #13#10);                                  html.Append('<a name="top"></a>');
694    
695                                  for i := 0 to ReadList.Count - 1 do begin                                  for i := 0 to ReadList.Count - 1 do begin
696                                          // 1 は必ず表示                                          // 1 は必ず表示
# Line 893  begin Line 708  begin
708                                                                  Continue;                                                                  Continue;
709                                                  end;                                                  end;
710                                          end;                                          end;
   
711                                          // 新着マーク                                          // 新着マーク
712                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
713                                                  try                                                  try
714                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then
715                                                                  doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size )  + #13#10)                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) )
716                                                          else                                                          else
717                                                                  doc.Write( '<a name="new"></a>' + #13#10 );                                                                  html.Append( '<a name="new"></a>' );
718                                                  except                                                  except
719                                                          doc.Write( '<a name="new"></a>' + #13#10 );                                                          html.Append( '<a name="new"></a>' );
720                                                  end;                                                  end;
721                                          end;                                          end;
722    
# Line 910  begin Line 724  begin
724                                                  No := IntToStr(i + 1);                                                  No := IntToStr(i + 1);
725    
726                                                  Res := DivideStrLine(ReadList[i]);                                                  Res := DivideStrLine(ReadList[i]);
727                                                  Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');                                                  Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, threadKey, 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
728                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
729    
730                                                  try                                                  try
731                                                          if NewReceiveNo <= (i + 1) then                                                          if NewReceiveNo <= (i + 1) then
732                                                                  // 新着レス                                                                  // 新着レス
733                                                                  strTmp := ReplaceRes( SkinNewRes )                                                                  strTmp := SkinedRes( SkinNewRes, Res, No )
734                                                          else                                                          else
735                                                                  // 通常のレス                                                                  // 通常のレス
736                                                                  strTmp := ReplaceRes( SkinRes );                                                                  strTmp := SkinedRes( SkinRes, Res, No  );
737    
738                                                          doc.Write( strTmp + #13#10 );                                                          html.Append( strTmp );
739                                                  except                                                  except
740                                                  end;                                                  end;
741                                          end;                                          end;
# Line 930  begin Line 744  begin
744                                                  // ここまで読んだ                                                  // ここまで読んだ
745                                                  try                                                  try
746                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then
747                                                                  doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
748                                                          else                                                          else
749                                                                  doc.Write( '<a name="koko"></a>' + #13#10 );                                                                  html.Append( '<a name="koko"></a>' );
750                                                  except                                                  except
751                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                          html.Append( '<a name="koko"></a>' );
752                                                  end;                                                  end;
753                                          end;                                          end;
754                                  end;                                  end;
755    
756                                  doc.Write('<a name="bottom"></a>' + #13#10);                                  html.Append('<a name="bottom"></a>' );
757                                  // スキン(フッタ)                                  // スキン(フッタ)
758                                  try                                  try
759                                          doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );                                          html.Append( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
760                                  except                                  except
761                                  end;                                  end;
762                          finally                          finally
763                                  doc.close;                                  html.EndUpdate;
764                          end;                          end;
765                  end;                  end;
766          end;          end;
767  end;  end;
768    
769  procedure THTMLCreate.CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );  procedure THTMLCreate.CreateUseCSSHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
770  var  var
771          i: integer;          i: integer;
772          No: string;          No: string;
# Line 962  var Line 776  var
776          UserOptionalStyle: string;          UserOptionalStyle: string;
777  begin  begin
778          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
779                  doc.open;                  //doc.open;
780                    html.BeginUpdate;
781                  try                  try
782                          doc.charset := 'Shift_JIS';                          //doc.charset := 'Shift_JIS';
783                          NewReceiveNo := ThreadItem.NewReceive;                          NewReceiveNo := ThreadItem.NewReceive;
784                          // フォントやサイズの設定                          // フォントやサイズの設定
785                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
786                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
787                          if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin                          if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
788                                  //CSS使用                                  //CSS使用
789                                  doc.Write('<html><head>' + #13#10);                                  html.Append('<html><head>');
790                                  doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' + #13#10);                                  html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
791                                  doc.Write('<title>' + sTitle + '</title>' + #13#10);                                  html.Append('<title>' + sTitle + '</title>');
792                                  doc.Write('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">' + #13#10);                                  html.Append('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
793                                  if Length( UserOptionalStyle ) > 0 then                                  if Length( UserOptionalStyle ) > 0 then
794                                          doc.Write('<style type="text/css">body {' + UserOptionalStyle + '}</style>' + #13#10);                                          html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
795                                  doc.Write('</head>' + #13#10);                                  html.Append('</head>');
796                                  doc.Write('<body>' + #13#10);                                  html.Append('<body>');
797                                  doc.Write('<a name="top"></a>' + #13#10);                                  html.Append('<a name="top"></a>');
798                                  doc.Write('<p id="idSearch"></p>' + #13#10);                                  html.Append('<p id="idSearch"></p>');
799                                  doc.Write('<div class="title">' + sTitle + '</div>' + #13#10);                                  html.Append('<div class="title">' + sTitle + '</div>');
800                                  for i := 0 to ReadList.Count - 1 do begin                                  for i := 0 to ReadList.Count - 1 do begin
801                                          // 1 は必ず表示                                          // 1 は必ず表示
802                                          if i <> 0 then begin                                          if i <> 0 then begin
# Line 1000  begin Line 815  begin
815                                          end;                                          end;
816    
817                                          if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin                                          if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
818                                                  doc.Write('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>' + #13#10);                                                  html.Append('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
819                                          end;                                          end;
820    
821                                          if (Trim(ReadList[i]) <> '') then begin                                          if (Trim(ReadList[i]) <> '') then begin
# Line 1009  begin Line 824  begin
824                                                  Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');                                                  Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
825                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
826                                                  if Res.FMailTo = '' then                                                  if Res.FMailTo = '' then
827                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
828                                                                                  + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '                                                                                  + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
829                                                                                  + '<span class="name_label">名前:</span> '                                                                                  + '<span class="name_label">名前:</span> '
830                                                                                  + '<span class="name"><b>' + Res.FName + '</b></span> '                                                                                  + '<span class="name"><b>' + Res.FName + '</b></span> '
831                                                                                  + '<span class="date_label">投稿日:</span> '                                                                                  + '<span class="date_label">投稿日:</span> '
832                                                                                  + '<span class="date">' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date">' + Res.FDateTime+ '</span></div>'
833                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)                                                                                  + '<div class="mes">' + Res.FBody + ' </div>')
834                                                  else if GikoSys.Setting.ShowMail then                                                  else if GikoSys.Setting.ShowMail then
835                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
836                                                                                  + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'                                                                                  + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
837                                                                                  + '<span class="name_label"> 名前: </span>'                                                                                  + '<span class="name_label"> 名前: </span>'
838                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
839                                                                                  + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'                                                                                  + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
840                                                                                  + '<span class="date_label"> 投稿日:</span>'                                                                                  + '<span class="date_label"> 投稿日:</span>'
841                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
842                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)                                                                                  + '<div class="mes">' + Res.FBody + ' </div>')
843                                                  else                                                  else
844                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
845                                                                                  + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'                                                                                  + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
846                                                                                  + '<span class="name_label"> 名前: </span>'                                                                                  + '<span class="name_label"> 名前: </span>'
847                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
848                                                                                  + '<b>' + Res.FName + '</b></a>'                                                                                  + '<b>' + Res.FName + '</b></a>'
849                                                                                  + '<span class="date_label"> 投稿日:</span>'                                                                                  + '<span class="date_label"> 投稿日:</span>'
850                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
851                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10);                                                                                  + '<div class="mes">' + Res.FBody + ' </div>');
852                                          end;                                          end;
853    
854                                          if ThreadItem.Kokomade = (i + 1) then begin                                          if ThreadItem.Kokomade = (i + 1) then begin
855                                                  doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10);                                                  html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>');
856                                          end;                                          end;
857    
858                                  end;                                  end;
859    
860                                  doc.Write('<a name="bottom"></a>' + #13#10);                                  html.Append('<a name="bottom"></a>');
861                                  doc.Write('<a name="last"></a>' + #13#10);                                  html.Append('<a name="last"></a>');
862                                  doc.Write('</body></html>' + #13#10);                                  html.Append('</body></html>');
863                          end;                          end;
864                  finally                  finally
865                          doc.Close;                          html.EndUpdate;
866                            //doc.Close;
867                  end;                  end;
868          end;          end;
869  end;  end;
870    
871  procedure THTMLCreate.CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );  procedure THTMLCreate.CreateDefaultHTML (html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
872  var  var
873          i: integer;          i: integer;
874          No: string;          No: string;
# Line 1060  var Line 876  var
876          Res: TResRec;          Res: TResRec;
877  begin  begin
878          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
879                  doc.open;                  //doc.open;
880                    html.BeginUpdate;
881                  try                  try
882                          doc.charset := 'Shift_JIS';                          //doc.charset := 'Shift_JIS';
883                          NewReceiveNo := ThreadItem.NewReceive;                          NewReceiveNo := ThreadItem.NewReceive;
884                          doc.Write('<html><head>' + #13#10);                          html.Append('<html><head>');
885                          doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' + #13#10);                          html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
886                          doc.Write('<title>' + sTitle + '</title></head>' + #13#10);                          html.Append('<title>' + sTitle + '</title></head>');
887                          doc.Write('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">' + #13#10);                          html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
888                          doc.Write('<a name="top"></a>' + #13#10);                          html.Append('<a name="top"></a>');
889                          doc.Write('<font size=+1 color="#FF0000">' + sTitle + '</font>' + #13#10);                          html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
890                          doc.Write('<dl>' + #13#10);                          html.Append('<dl>');
891                          doc.Write('<p id="idSearch"></p>' + #13#10);                          html.Append('<p id="idSearch"></p>');
892                          for i := 0 to ReadList.Count - 1 do begin                          for i := 0 to ReadList.Count - 1 do begin
893                                  // 1 は必ず表示                                  // 1 は必ず表示
894                                  if i <> 0 then begin                                  if i <> 0 then begin
# Line 1090  begin Line 907  begin
907                                  end;                                  end;
908    
909                                  if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin                                  if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
910                                          doc.Write('</dl>' + #13#10);                                          html.Append('</dl>');
911                                          doc.Write('<a name="new"></a>' + #13#10);                                          html.Append('<a name="new"></a>');
912                                          doc.Write('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>新着レス ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>' + #13#10);                                          html.Append('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>新着レス ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
913                                          doc.Write('<dl>' + #13#10);                                          html.Append('<dl>');
914                                  end;                                  end;
915    
916                                  if (Trim(ReadList[i]) <> '') then begin                                  if (Trim(ReadList[i]) <> '') then begin
# Line 1102  begin Line 919  begin
919                                          Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');                                          Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
920                                          Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                          Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
921                                          if Res.FMailTo = '' then                                          if Res.FMailTo = '' then
922                                                  doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 名前:<font color="forestgreen"><b> ' + Res.FName + ' </b></font> 投稿日: <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>' + #13#10)                                                  html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 名前:<font color="forestgreen"><b> ' + Res.FName + ' </b></font> 投稿日: <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
923                                          else if GikoSys.Setting.ShowMail then                                          else if GikoSys.Setting.ShowMail then
924                                                  doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 名前:<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] 投稿日: <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>' + #13#10)                                                  html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 名前:<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] 投稿日: <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
925                                          else                                          else
926                                                  doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 名前:<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> 投稿日: <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>' + #13#10);                                                  html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 名前:<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> 投稿日: <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>');
927                                  end;                                  end;
928                                  if ThreadItem.Kokomade = (i + 1) then begin                                  if ThreadItem.Kokomade = (i + 1) then begin
929                                          doc.Write('</dl>' + #13#10);                                          html.Append('</dl>');
930                                          doc.Write('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>ココまで読んだ</b></font></td></tr></table>' + #13#10);                                          html.Append('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>ココまで読んだ</b></font></td></tr></table>');
931                                          doc.Write('<dl>' + #13#10);                                          html.Append('<dl>');
932                                  end;                                  end;
933                          end;                          end;
934                          doc.Write('</dl>' + #13#10);                          html.Append('</dl>');
935                          doc.Write('<a name="bottom"></a>' + #13#10);                          html.Append('<a name="bottom"></a>');
936                          doc.Write('</body></html>' + #13#10);                          html.Append('</body></html>');
937                  finally                  finally
938                          doc.Close;                          //doc.Close;
939                            html.EndUpdate;
940                  end;                  end;
941          end;          end;
942  end;  end;
943    
944  procedure THTMLCreate.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);  procedure THTMLCreate.CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
945  var  var
946          ReadList: TStringList;          ReadList: TStringList;
947          CSSFileName: string;          CSSFileName: string;
948          FileName: string;          FileName: string;
949          Res: TResRec;          Res: TResRec;
950            html: TStringList;
951            mStream : TMemoryStream;
952  {$IFDEF DEBUG}  {$IFDEF DEBUG}
953          st, rt: Cardinal;          st, rt: Cardinal;
954  {$ENDIF}  {$ENDIF}
# Line 1138  begin Line 958  begin
958          st := GetTickCount;          st := GetTickCount;
959  {$ENDIF}  {$ENDIF}
960          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
961                  if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin                  html := TStringList.Create;
962                          CreateUsePluginHTML(doc, ThreadItem, sTitle);                  try
963                  end else begin                          if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
964                          ShortDayNames[1] := '日';               ShortDayNames[2] := '月';                                  CreateUsePluginHTML(html, ThreadItem, sTitle);
965                          ShortDayNames[3] := '火';               ShortDayNames[4] := '水';                          end else begin
966                          ShortDayNames[5] := '木';               ShortDayNames[6] := '金';                                  ShortDayNames[1] := '日';               ShortDayNames[2] := '月';
967                          ShortDayNames[7] := '土';                                  ShortDayNames[3] := '火';               ShortDayNames[4] := '水';
968                                    ShortDayNames[5] := '木';               ShortDayNames[6] := '金';
969                                    ShortDayNames[7] := '土';
970    
971                          ReadList := TStringList.Create;                                  ReadList := TStringList.Create;
972                          try                                  try
973                                  if ThreadItem.IsLogFile then begin                                          ReadList.BeginUpdate;
974                                          FileName := ThreadItem.GetThreadFileName;                                          if ThreadItem.IsLogFile then begin
975                                          ReadList.LoadFromFile(FileName);                                                  FileName := ThreadItem.GetThreadFileName;
976                                          GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));                                                  ReadList.LoadFromFile(FileName);
977                                          GikoSys.FAbon.Execute(ReadList);                //       あぼ〜んして                                                  GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
978                                          GikoSys.FSelectResFilter.Execute(ReadList); //レスのフィルタリングをする                                                  GikoSys.FAbon.Execute(ReadList);                //       あぼ〜んして
979                                          if ThreadItem.Title = '' then begin                                                  GikoSys.FSelectResFilter.Execute(ReadList); //レスのフィルタリングをする
980                                                  Res := DivideStrLine(ReadList[0]);                                                  if ThreadItem.Title = '' then begin
981                                                  sTitle := Res.FTitle;                                                          Res := DivideStrLine(ReadList[0]);
982                                          end else                                                          sTitle := Res.FTitle;
983                                                  sTitle := ThreadItem.Title                                                  end else
984                                  end else begin                                                          sTitle := ThreadItem.Title
985                                          sTitle := CustomStringReplace(ThreadItem.Title, '@`', ',');                                          end else begin
986                                  end;                                                  sTitle := CustomStringReplace(ThreadItem.Title, '@`', ',');
987                                            end;
988    
989                                  // フォントやサイズの設定                                          // フォントやサイズの設定
990                                  CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
991                                  if GikoSys.Setting.UseSkin then begin                                          if GikoSys.Setting.UseSkin then begin
992                                          CreateUseSKINHTML(doc, ThreadItem, ReadList);                                                  CreateUseSKINHTML(html, ThreadItem, ReadList);
993                                  end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin                                          end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
994                                          CreateUseCSSHTML(doc, ThreadItem, ReadList, sTitle);                                                  CreateUseCSSHTML(html, ThreadItem, ReadList, sTitle);
995                                  end else begin                                          end else begin
996                                          CreateDefaultHTML(doc, ThreadItem, ReadList, sTitle);                                                  CreateDefaultHTML(html, ThreadItem, ReadList, sTitle);
997                                            end;
998                                    finally
999                        ReadList.EndUpdate;
1000                                            ReadList.Free;
1001                                  end;                                  end;
1002                            end;
1003                            //WebBrowserに書き込み
1004                            mStream := TMemoryStream.Create;
1005                            try
1006                                    html.SaveToStream(mStream);
1007                                    mStream.Seek(soFromBeginning, 0);
1008                                    (doc as IPersistStreamInit).Load(TStreamAdapter.Create(mStream));
1009                          finally                          finally
1010                                  ReadList.Free;                                  mStream.Free;
1011                          end;                          end;
1012                    finally
1013                            html.Free;
1014                  end;                  end;
1015          end;          end;
1016  {$IFDEF DEBUG}  {$IFDEF DEBUG}

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.4.2.11

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26