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.7 by h677, Wed Nov 2 18:10:55 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;          st, et: string;
337          chk : boolean;          pos, pmin : integer;
338          al : boolean;          j : integer;
339          procedure Add(IndexFrom, IndexTo: integer; const No: string);          token : array[0..5] of string;
340          var          ch : string;
341                  FIndex : PIndex;          db : boolean;
342          begin          len : integer;
                 New(FIndex);  
                 FIndex.FIndexFrom       := IndexFrom;  
                 FIndex.FIndexTo         := IndexTo;  
                 FIndex.FNo                               := No;  
                 List.Add(FIndex);  
         end;  
         function ChooseString(const Text, Separator: string; Index: integer): string;  
         var  
                 S : string;  
                 i, p : integer;  
         begin  
                 S :=    Text;  
                 for i :=        0 to    Index - 1 do    begin  
                         if      (AnsiPos(Separator, S) = 0) then        S :=    ''  
                         else    S :=    Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));  
                 end;  
                 p :=    AnsiPos(Separator, S);  
                 if      (p > 0) then    Result  :=      Copy(S, 1, p - 1) else Result :=        S;  
         end;  
343  begin  begin
344          { v1.0 b2 - 03 }          //s に本文を全部入れる
345          s        :=     Body;          s        :=     Body;
346          r        :=     Body;          //結果をクリア
347          i        :=     1;          Result   :=     '';
348          sw      :=      False;          //検索対象の文字列郡
349          No      :=      '';          token[0] := GT + GT;
350          List:=  TList.Create;          token[1] := GT;
351          oc      :=      '';          token[2] := '>>';
352          sp      :=      0;          token[3] := '>';
353          chk :=  False;          token[4] := '<a ';
354          al      :=      False;          token[5] := '<A ';
355          while true      do      begin  
356                  b :=    ByteType(s, i);          //
357                  case    b of          while Length(s) > 2 do begin
358                          mbSingleByte    : begin                  pmin := Length(s) + 1;
359                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin                  i       := Length(token);
360                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin                  for j := 0 to Length(token) - 1 do begin
361                                                  sw      :=      True;                          pos := AnsiPos(token[j], s);
362                                                  sp      :=      i;                          if pos <> 0 then begin
363                                                  i :=    i + 7;                                  if pos < pmin then begin
364                                                  oc:='';                                          //どれでヒットしたか保存
365                                                  chk :=  True;                                          i := j;
366                                          end;                                          //最小値を更新
367                                  end else                                          pmin := pos;
                                 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;  
368                                  end;                                  end;
                                 al      :=      False;  
369                          end;                          end;
370                  end;                  end;
371                  inc(i);  
372                  if      (i > Length(Body))      then    begin                  //ヒットした文字列の一つ手前まで結果にコピー
373                          if      (sw)    then    begin                  Result := Result + Copy(s, 1, pmin - 1);
374                                  if      (No <> '')      then    Add(sp, i, No);                  Delete(s, 1, pmin - 1);
375    
376                    if i = 6 then begin
377                            //ヒットなし
378                    end else if (i = 4) or (i = 5) then begin
379                            //'<a ' or '<A' でヒット '</a>' or '</A>' までコピー
380                            pmin := AnsiPos('</a>' , s);
381                            pos := AnsiPos('</A>' , s);
382                            if (pmin <> 0) and (pos <> 0) then begin
383                                    if (pmin > pos) then begin
384                                            pmin := pos;
385                                    end;
386                            end else if (pos <> 0) then begin
387                                    pmin := pos;
388                          end;                          end;
389                          Break;                          Result := Result + Copy(s, 1, pmin + 3);
390                  end;                          Delete(s, 1, pmin + 3);
         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);  
391                  end else begin                  end else begin
392                          st      :=      PIndex(List[i]).FNo;                          //何かしら見つかったパターン
393                          et      :=      PIndex(List[i]).FNo;                          j := Length(token[i]) + 1;
394                  end;                          oc := '';
395                  if not DatToHTML then                          No := '';
396                  r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +                          sw := false;
397                                          Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',                          db := false;
398                                                                  [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +                          len := Length(s);
399                                          Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +                          while j <= len do begin
400                                          Copy(r,PIndex(List[i]).FIndexTo,Length(r))                                  if (ByteType(s, j) = mbSingleByte) then begin
401                  else                                          //1byte文字
402                  r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +                                          ch := s[j];
403                                          Format('<a href="#%s">', [st]) +                                          Inc(j);
404                                          Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +                                          db := false;
405                                          Copy(r,PIndex(List[i]).FIndexTo,Length(r));                                  end else begin
406                                            //2byte文字
407                  Dispose(PIndex(List[i]));                                          ch := ZenToHan(Copy(s, j, 2));
408          end;                                          Inc(j, 2);
409          List.Free;                                          db := true;
410          Result  :=      r;                                  end;
 end;  
411    
412  function THTMLCreate.ConvRes(                                  if System.Pos(ch, SN) > 0 then begin
413          const Body, Bbs, Key, ParamBBS, ParamKey,                                          No := No + ch;
414          ParamStart, ParamTo, ParamNoFirst,                                  end else if (ch = '-') then begin
415          ParamTrue, FullURL : string                                          if sw then break;
416  ): string;                                          if No = '' then break;
417  type                                          sw := true;
         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;  
         begin  
                 New(FIndex);  
                 FIndex.FIndexFrom       := IndexFrom;  
                 FIndex.FIndexTo         := IndexTo;  
                 FIndex.FNo                               := No;  
                 List.Add(FIndex);  
         end;  
         function ChooseString(const Text, Separator: string; Index: integer): string;  
         var  
                 S : string;  
                 i, p : integer;  
         begin  
                 S :=    Text;  
                 for i :=        0 to    Index - 1 do    begin  
                         if      (AnsiPos(Separator, S) = 0) then        S :=    ''  
                         else    S :=    Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));  
                 end;  
                 p :=    AnsiPos(Separator, S);  
                 if      (p > 0) then    Result  :=      Copy(S, 1, p - 1) else Result :=        S;  
         end;  
 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;  
418                                  end else begin                                  end else begin
419                                          if      Copy(s,i,1) = '<' then  oc      :=      '';                                          break;
                                         oc      :=      oc + Copy(s,i,1);  
                                         chk :=  False;  
                                         al      :=      False;  
420                                  end;                                  end;
421                          end;                          end;
422                          mbLeadByte      : begin                          //終端まで行っての終了かチェック
423                                  if      (not sw) and (Copy(s,i,4) = '>>') then        begin                          if j <= len then begin
424                                          sw      :=      True;                                  if db then j := j - 2
425                                          sp      :=      i;                                  else j := j - 1;
426                                          i :=    i + 3;                          end;
427                                          chk :=  True;                          //何も数字が見つからないとき
428                                  end else                          if No = '' then begin
429                                  if      (not sw) and (Copy(s,i,2) = '>') then  begin                                  Result := Result + Copy(s, 1, j - 1);
430                                          sw      :=      True;                          end else begin
431                                          sp      :=      i;                                  separateNumber(st, et, No, '-');
432                                          i :=    i + 1;  
433                                          chk :=  True;                                  if not DatToHTML then begin
434                                  end else                                          Result := Result + Format(FORMAT_LINK,
435                                  if      (sw) then begin                                                                  [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]);
                                         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;  
436                                  end else begin                                  end else begin
437                                          oc      :=      '';                                          Result := Result + Format('<a href="#%s">', [st]);
                                         chk :=  False;  
438                                  end;                                  end;
439                                  al      :=      False;                                  Result := Result + Copy(s, 1, j - 1) + '</a>';
                         end;  
                 end;  
                 inc(i);  
                 if      (i > Length(Body))      then    begin  
                         if      (sw)    then    begin  
                                 if      (No <> '')      then    Add(sp, i, No);  
440                          end;                          end;
441                          Break;                          Delete(s, 1, j - 1);
                 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);  
                 end else begin  
                         st      :=      PIndex(List[i]).FNo;  
                         et      :=      PIndex(List[i]).FNo;  
442                  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]));  
443          end;          end;
444          List.Free;          Result := Result + s;
         Result  :=      r;  
445  end;  end;
446    
447  function THTMLCreate.ConvertResAnchor(res: string): string;  function THTMLCreate.ConvertResAnchor(res: string): string;
# Line 731  begin Line 493  begin
493  end;  end;
494    
495  //Pluginを利用するBoardのスレッドのHTMLを作成してdocに書き込む  //Pluginを利用するBoardのスレッドのHTMLを作成してdocに書き込む
496  procedure THTMLCreate.CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);  procedure THTMLCreate.CreateUsePluginHTML(html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
497  var  var
498          i: integer;          i: integer;
499          NewReceiveNo: Integer;          NewReceiveNo: Integer;
# Line 745  begin Line 507  begin
507                          NewReceiveNo    := ThreadItem.NewReceive;                          NewReceiveNo    := ThreadItem.NewReceive;
508                          // フォントやサイズの設定                          // フォントやサイズの設定
509                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
510                            html.BeginUpdate;
511                          try                          try
                                 doc.open;  
512                                  // ヘッダ                                  // ヘッダ
513                                  doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),                                  html.Append( boardPlugIn.GetHeader( DWORD( threadItem ),
514                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
515                                  doc.Write('<p id="idSearch"></p>' + #13#10 );                                  html.Add('<p id="idSearch"></p>');
   
516                                  for i := 0 to threadItem.Count - 1 do begin                                  for i := 0 to threadItem.Count - 1 do begin
517                                          // 1 は必ず表示                                          // 1 は必ず表示
518                                          if i <> 0 then begin                                          if i <> 0 then begin
# Line 774  begin Line 535  begin
535                                                  try                                                  try
536                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
537                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then
538                                                                          doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
539                                                                  else                                                                  else
540                                                                          doc.Write( '<a name="new"></a>' + #13#10 );                                                                          //doc.Write( '<a name="new"></a>' + #13#10 );
541                                                                            html.Append( '<a name="new"></a>' );
542                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
543                                                                  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>');
544                                                          end else begin                                                          end else begin
545                                                                  doc.Write('</dl>');                                                                  html.Append('</dl>');
546                                                                  doc.Write('<a name="new"></a>');                                                                  html.Append('<a name="new"></a>');
547                                                                  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>');
548                                                                  doc.Write('<dl> + #13#10');                                                                  html.Append('<dl>');
549                                                          end;                                                          end;
550                                                  except                                                  except
551                                                          doc.Write( '<a name="new"></a>' + #13#10);                                                          html.Append( '<a name="new"></a>');
552                                                  end;                                                  end;
553                                          end;                                          end;
554    
555                                          // レス                                          // レス
556                                          doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );                                          html.Append( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
557    
558                                          if ThreadItem.Kokomade = (i + 1) then begin                                          if ThreadItem.Kokomade = (i + 1) then begin
559                                                  // ここまで読んだ                                                  // ここまで読んだ
560                                                  try                                                  try
561                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
562                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then
563                                                                          doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
564                                                                  else                                                                  else
565                                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                                          html.Append( '<a name="koko"></a>' );
566                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
567                                                                  doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10 );                                                                  html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>' );
568                                                          end else begin                                                          end else begin
569                                                                  doc.Write('</dl>');                                                                  html.Append('</dl>');
570                                                                  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>');
571                                                                  doc.Write('<dl>' + #13#10 );                                                                  html.Append('<dl>' );
572                                                          end;                                                          end;
573                                                  except                                                  except
574                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                          html.Append( '<a name="koko"></a>' );
575                                                  end;                                                  end;
576                                          end;                                          end;
577                                  end;                                  end;
578    
579    
580                                  // スキン(フッタ)                                  // スキン(フッタ)
581                                  doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );                                  html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
582                          finally                          finally
583                                  doc.Close;                                  html.EndUpdate;
584                          end;                          end;
585    
586                  end;                  end;
# Line 826  begin Line 588  begin
588  end;  end;
589    
590    
591  procedure THTMLCreate.CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);  procedure THTMLCreate.CreateUseSKINHTML(html : TStringList; ThreadItem: TThreadItem; ReadList: TStringList);
592  var  var
593          i: integer;          i: integer;
594          No: string;          No: string;
# Line 838  var Line 600  var
600          SkinNewRes: string;          SkinNewRes: string;
601          SkinRes: string;          SkinRes: string;
602          strTmp : string;          strTmp : string;
603          function ReplaceRes( skin: string ): string;          threadKey : string;
         begin  
                 Result := SkinedRes( skin, Res, No );  
         end;  
604  begin  begin
605          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
606                  // スキン使用                  // スキン使用
# Line 850  begin Line 609  begin
609                          // フォントやサイズの設定                          // フォントやサイズの設定
610                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
611                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
612                          doc.open;  
613                            threadKey := ChangeFileExt(ThreadItem.FileName, '');
614                            html.BeginUpdate;
615                          try                          try
616                                  doc.charset := 'Shift_JIS';                                  //doc.charset := 'Shift_JIS';
617    
618                                  // スキンの設定                                  // スキンの設定
619                                  try                                  try
# Line 860  begin Line 621  begin
621                                          if Length( UserOptionalStyle ) > 0 then                                          if Length( UserOptionalStyle ) > 0 then
622                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',
623                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
624                                          doc.Write( SkinHeader + #13#10);                                          html.Append( SkinHeader);
625                                  except                                  except
626                                  end;                                  end;
627    
# Line 874  begin Line 635  begin
635                                  except                                  except
636                                  end;                                  end;
637    
638                                  doc.Write('<p id="idSearch"></p>' + #13#10);                                  html.Append('<p id="idSearch"></p>');
639                                  doc.Write('<a name="top"></a>' + #13#10);                                  html.Append('<a name="top"></a>');
640    
641                                  for i := 0 to ReadList.Count - 1 do begin                                  for i := 0 to ReadList.Count - 1 do begin
642                                          // 1 は必ず表示                                          // 1 は必ず表示
# Line 893  begin Line 654  begin
654                                                                  Continue;                                                                  Continue;
655                                                  end;                                                  end;
656                                          end;                                          end;
   
657                                          // 新着マーク                                          // 新着マーク
658                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
659                                                  try                                                  try
660                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then
661                                                                  doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size )  + #13#10)                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) )
662                                                          else                                                          else
663                                                                  doc.Write( '<a name="new"></a>' + #13#10 );                                                                  html.Append( '<a name="new"></a>' );
664                                                  except                                                  except
665                                                          doc.Write( '<a name="new"></a>' + #13#10 );                                                          html.Append( '<a name="new"></a>' );
666                                                  end;                                                  end;
667                                          end;                                          end;
668    
# Line 910  begin Line 670  begin
670                                                  No := IntToStr(i + 1);                                                  No := IntToStr(i + 1);
671    
672                                                  Res := DivideStrLine(ReadList[i]);                                                  Res := DivideStrLine(ReadList[i]);
673                                                  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');
674                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
675    
676                                                  try                                                  try
677                                                          if NewReceiveNo <= (i + 1) then                                                          if NewReceiveNo <= (i + 1) then
678                                                                  // 新着レス                                                                  // 新着レス
679                                                                  strTmp := ReplaceRes( SkinNewRes )                                                                  strTmp := SkinedRes( SkinNewRes, Res, No )
680                                                          else                                                          else
681                                                                  // 通常のレス                                                                  // 通常のレス
682                                                                  strTmp := ReplaceRes( SkinRes );                                                                  strTmp := SkinedRes( SkinRes, Res, No  );
683    
684                                                          doc.Write( strTmp + #13#10 );                                                          html.Append( strTmp );
685                                                  except                                                  except
686                                                  end;                                                  end;
687                                          end;                                          end;
# Line 930  begin Line 690  begin
690                                                  // ここまで読んだ                                                  // ここまで読んだ
691                                                  try                                                  try
692                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then
693                                                                  doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
694                                                          else                                                          else
695                                                                  doc.Write( '<a name="koko"></a>' + #13#10 );                                                                  html.Append( '<a name="koko"></a>' );
696                                                  except                                                  except
697                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                          html.Append( '<a name="koko"></a>' );
698                                                  end;                                                  end;
699                                          end;                                          end;
700                                  end;                                  end;
701    
702                                  doc.Write('<a name="bottom"></a>' + #13#10);                                  html.Append('<a name="bottom"></a>' );
703                                  // スキン(フッタ)                                  // スキン(フッタ)
704                                  try                                  try
705                                          doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );                                          html.Append( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
706                                  except                                  except
707                                  end;                                  end;
708                          finally                          finally
709                                  doc.close;                                  html.EndUpdate;
710                          end;                          end;
711                  end;                  end;
712          end;          end;
713  end;  end;
714    
715  procedure THTMLCreate.CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );  procedure THTMLCreate.CreateUseCSSHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
716  var  var
717          i: integer;          i: integer;
718          No: string;          No: string;
# Line 962  var Line 722  var
722          UserOptionalStyle: string;          UserOptionalStyle: string;
723  begin  begin
724          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
725                  doc.open;                  //doc.open;
726                    html.BeginUpdate;
727                  try                  try
728                          doc.charset := 'Shift_JIS';                          //doc.charset := 'Shift_JIS';
729                          NewReceiveNo := ThreadItem.NewReceive;                          NewReceiveNo := ThreadItem.NewReceive;
730                          // フォントやサイズの設定                          // フォントやサイズの設定
731                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
732                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
733                          if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin                          if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
734                                  //CSS使用                                  //CSS使用
735                                  doc.Write('<html><head>' + #13#10);                                  html.Append('<html><head>');
736                                  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">');
737                                  doc.Write('<title>' + sTitle + '</title>' + #13#10);                                  html.Append('<title>' + sTitle + '</title>');
738                                  doc.Write('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">' + #13#10);                                  html.Append('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
739                                  if Length( UserOptionalStyle ) > 0 then                                  if Length( UserOptionalStyle ) > 0 then
740                                          doc.Write('<style type="text/css">body {' + UserOptionalStyle + '}</style>' + #13#10);                                          html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
741                                  doc.Write('</head>' + #13#10);                                  html.Append('</head>');
742                                  doc.Write('<body>' + #13#10);                                  html.Append('<body>');
743                                  doc.Write('<a name="top"></a>' + #13#10);                                  html.Append('<a name="top"></a>');
744                                  doc.Write('<p id="idSearch"></p>' + #13#10);                                  html.Append('<p id="idSearch"></p>');
745                                  doc.Write('<div class="title">' + sTitle + '</div>' + #13#10);                                  html.Append('<div class="title">' + sTitle + '</div>');
746                                  for i := 0 to ReadList.Count - 1 do begin                                  for i := 0 to ReadList.Count - 1 do begin
747                                          // 1 は必ず表示                                          // 1 は必ず表示
748                                          if i <> 0 then begin                                          if i <> 0 then begin
# Line 1000  begin Line 761  begin
761                                          end;                                          end;
762    
763                                          if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin                                          if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
764                                                  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>');
765                                          end;                                          end;
766    
767                                          if (Trim(ReadList[i]) <> '') then begin                                          if (Trim(ReadList[i]) <> '') then begin
# Line 1009  begin Line 770  begin
770                                                  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');
771                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
772                                                  if Res.FMailTo = '' then                                                  if Res.FMailTo = '' then
773                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
774                                                                                  + '<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> '
775                                                                                  + '<span class="name_label">名前:</span> '                                                                                  + '<span class="name_label">名前:</span> '
776                                                                                  + '<span class="name"><b>' + Res.FName + '</b></span> '                                                                                  + '<span class="name"><b>' + Res.FName + '</b></span> '
777                                                                                  + '<span class="date_label">投稿日:</span> '                                                                                  + '<span class="date_label">投稿日:</span> '
778                                                                                  + '<span class="date">' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date">' + Res.FDateTime+ '</span></div>'
779                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)                                                                                  + '<div class="mes">' + Res.FBody + ' </div>')
780                                                  else if GikoSys.Setting.ShowMail then                                                  else if GikoSys.Setting.ShowMail then
781                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
782                                                                                  + '<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>'
783                                                                                  + '<span class="name_label"> 名前: </span>'                                                                                  + '<span class="name_label"> 名前: </span>'
784                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
785                                                                                  + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'                                                                                  + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
786                                                                                  + '<span class="date_label"> 投稿日:</span>'                                                                                  + '<span class="date_label"> 投稿日:</span>'
787                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
788                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)                                                                                  + '<div class="mes">' + Res.FBody + ' </div>')
789                                                  else                                                  else
790                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
791                                                                                  + '<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>'
792                                                                                  + '<span class="name_label"> 名前: </span>'                                                                                  + '<span class="name_label"> 名前: </span>'
793                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
794                                                                                  + '<b>' + Res.FName + '</b></a>'                                                                                  + '<b>' + Res.FName + '</b></a>'
795                                                                                  + '<span class="date_label"> 投稿日:</span>'                                                                                  + '<span class="date_label"> 投稿日:</span>'
796                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
797                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10);                                                                                  + '<div class="mes">' + Res.FBody + ' </div>');
798                                          end;                                          end;
799    
800                                          if ThreadItem.Kokomade = (i + 1) then begin                                          if ThreadItem.Kokomade = (i + 1) then begin
801                                                  doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10);                                                  html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>');
802                                          end;                                          end;
803    
804                                  end;                                  end;
805    
806                                  doc.Write('<a name="bottom"></a>' + #13#10);                                  html.Append('<a name="bottom"></a>');
807                                  doc.Write('<a name="last"></a>' + #13#10);                                  html.Append('<a name="last"></a>');
808                                  doc.Write('</body></html>' + #13#10);                                  html.Append('</body></html>');
809                          end;                          end;
810                  finally                  finally
811                          doc.Close;                          html.EndUpdate;
812                            //doc.Close;
813                  end;                  end;
814          end;          end;
815  end;  end;
816    
817  procedure THTMLCreate.CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );  procedure THTMLCreate.CreateDefaultHTML (html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
818  var  var
819          i: integer;          i: integer;
820          No: string;          No: string;
# Line 1060  var Line 822  var
822          Res: TResRec;          Res: TResRec;
823  begin  begin
824          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
825                  doc.open;                  //doc.open;
826                    html.BeginUpdate;
827                  try                  try
828                          doc.charset := 'Shift_JIS';                          //doc.charset := 'Shift_JIS';
829                          NewReceiveNo := ThreadItem.NewReceive;                          NewReceiveNo := ThreadItem.NewReceive;
830                          doc.Write('<html><head>' + #13#10);                          html.Append('<html><head>');
831                          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">');
832                          doc.Write('<title>' + sTitle + '</title></head>' + #13#10);                          html.Append('<title>' + sTitle + '</title></head>');
833                          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">');
834                          doc.Write('<a name="top"></a>' + #13#10);                          html.Append('<a name="top"></a>');
835                          doc.Write('<font size=+1 color="#FF0000">' + sTitle + '</font>' + #13#10);                          html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
836                          doc.Write('<dl>' + #13#10);                          html.Append('<dl>');
837                          doc.Write('<p id="idSearch"></p>' + #13#10);                          html.Append('<p id="idSearch"></p>');
838                          for i := 0 to ReadList.Count - 1 do begin                          for i := 0 to ReadList.Count - 1 do begin
839                                  // 1 は必ず表示                                  // 1 は必ず表示
840                                  if i <> 0 then begin                                  if i <> 0 then begin
# Line 1090  begin Line 853  begin
853                                  end;                                  end;
854    
855                                  if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin                                  if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
856                                          doc.Write('</dl>' + #13#10);                                          html.Append('</dl>');
857                                          doc.Write('<a name="new"></a>' + #13#10);                                          html.Append('<a name="new"></a>');
858                                          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>');
859                                          doc.Write('<dl>' + #13#10);                                          html.Append('<dl>');
860                                  end;                                  end;
861    
862                                  if (Trim(ReadList[i]) <> '') then begin                                  if (Trim(ReadList[i]) <> '') then begin
# Line 1102  begin Line 865  begin
865                                          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');
866                                          Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                          Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
867                                          if Res.FMailTo = '' then                                          if Res.FMailTo = '' then
868                                                  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>')
869                                          else if GikoSys.Setting.ShowMail then                                          else if GikoSys.Setting.ShowMail then
870                                                  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>')
871                                          else                                          else
872                                                  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>');
873                                  end;                                  end;
874                                  if ThreadItem.Kokomade = (i + 1) then begin                                  if ThreadItem.Kokomade = (i + 1) then begin
875                                          doc.Write('</dl>' + #13#10);                                          html.Append('</dl>');
876                                          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>');
877                                          doc.Write('<dl>' + #13#10);                                          html.Append('<dl>');
878                                  end;                                  end;
879                          end;                          end;
880                          doc.Write('</dl>' + #13#10);                          html.Append('</dl>');
881                          doc.Write('<a name="bottom"></a>' + #13#10);                          html.Append('<a name="bottom"></a>');
882                          doc.Write('</body></html>' + #13#10);                          html.Append('</body></html>');
883                  finally                  finally
884                          doc.Close;                          //doc.Close;
885                            html.EndUpdate;
886                  end;                  end;
887          end;          end;
888  end;  end;
889    
890  procedure THTMLCreate.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);  procedure THTMLCreate.CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
891  var  var
892          ReadList: TStringList;          ReadList: TStringList;
893          CSSFileName: string;          CSSFileName: string;
894          FileName: string;          FileName: string;
895          Res: TResRec;          Res: TResRec;
896            html: TStringList;
897            mStream : TMemoryStream;
898  {$IFDEF DEBUG}  {$IFDEF DEBUG}
899          st, rt: Cardinal;          st, rt: Cardinal;
900  {$ENDIF}  {$ENDIF}
# Line 1138  begin Line 904  begin
904          st := GetTickCount;          st := GetTickCount;
905  {$ENDIF}  {$ENDIF}
906          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
907                  if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin                  html := TStringList.Create;
908                          CreateUsePluginHTML(doc, ThreadItem, sTitle);                  try
909                  end else begin                          if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
910                          ShortDayNames[1] := '日';               ShortDayNames[2] := '月';                                  CreateUsePluginHTML(html, ThreadItem, sTitle);
911                          ShortDayNames[3] := '火';               ShortDayNames[4] := '水';                          end else begin
912                          ShortDayNames[5] := '木';               ShortDayNames[6] := '金';                                  ShortDayNames[1] := '日';               ShortDayNames[2] := '月';
913                          ShortDayNames[7] := '土';                                  ShortDayNames[3] := '火';               ShortDayNames[4] := '水';
914                                    ShortDayNames[5] := '木';               ShortDayNames[6] := '金';
915                                    ShortDayNames[7] := '土';
916    
917                          ReadList := TStringList.Create;                                  ReadList := TStringList.Create;
918                          try                                  try
919                                  if ThreadItem.IsLogFile then begin                                          ReadList.BeginUpdate;
920                                          FileName := ThreadItem.GetThreadFileName;                                          if ThreadItem.IsLogFile then begin
921                                          ReadList.LoadFromFile(FileName);                                                  FileName := ThreadItem.GetThreadFileName;
922                                          GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));                                                  ReadList.LoadFromFile(FileName);
923                                          GikoSys.FAbon.Execute(ReadList);                //       あぼ〜んして                                                  GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
924                                          GikoSys.FSelectResFilter.Execute(ReadList); //レスのフィルタリングをする                                                  GikoSys.FAbon.Execute(ReadList);                //       あぼ〜んして
925                                          if ThreadItem.Title = '' then begin                                                  GikoSys.FSelectResFilter.Execute(ReadList); //レスのフィルタリングをする
926                                                  Res := DivideStrLine(ReadList[0]);                                                  if ThreadItem.Title = '' then begin
927                                                  sTitle := Res.FTitle;                                                          Res := DivideStrLine(ReadList[0]);
928                                          end else                                                          sTitle := Res.FTitle;
929                                                  sTitle := ThreadItem.Title                                                  end else
930                                  end else begin                                                          sTitle := ThreadItem.Title
931                                          sTitle := CustomStringReplace(ThreadItem.Title, '@`', ',');                                          end else begin
932                                  end;                                                  sTitle := CustomStringReplace(ThreadItem.Title, '@`', ',');
933                                            end;
934    
935                                  // フォントやサイズの設定                                          // フォントやサイズの設定
936                                  CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
937                                  if GikoSys.Setting.UseSkin then begin                                          if GikoSys.Setting.UseSkin then begin
938                                          CreateUseSKINHTML(doc, ThreadItem, ReadList);                                                  CreateUseSKINHTML(html, ThreadItem, ReadList);
939                                  end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin                                          end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
940                                          CreateUseCSSHTML(doc, ThreadItem, ReadList, sTitle);                                                  CreateUseCSSHTML(html, ThreadItem, ReadList, sTitle);
941                                  end else begin                                          end else begin
942                                          CreateDefaultHTML(doc, ThreadItem, ReadList, sTitle);                                                  CreateDefaultHTML(html, ThreadItem, ReadList, sTitle);
943                                            end;
944                                    finally
945                        ReadList.EndUpdate;
946                                            ReadList.Free;
947                                  end;                                  end;
948                            end;
949                            //WebBrowserに書き込み
950                            mStream := TMemoryStream.Create;
951                            try
952                                    html.SaveToStream(mStream);
953                                    mStream.Seek(soFromBeginning, 0);
954                                    (doc as IPersistStreamInit).Load(TStreamAdapter.Create(mStream));
955                          finally                          finally
956                                  ReadList.Free;                                  mStream.Free;
957                          end;                          end;
958                    finally
959                            html.Free;
960                  end;                  end;
961          end;          end;
962  {$IFDEF DEBUG}  {$IFDEF DEBUG}

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

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