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.6 by h677, Tue Nov 1 17:05:35 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;
# Line 43  type Line 44  type
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;                  function ConvRes(const Body, Bbs, Key,  ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
47                  procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);                  procedure CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
48                  procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);                  procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
49          end;          end;
50    
# Line 118  begin Line 119  begin
119                          CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));                          CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
120                          CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));                          CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
121    
122    
123                          //----- とりあえずかちゅ〜しゃ互換用。コメントアウトしてもよし                          //----- とりあえずかちゅ〜しゃ互換用。コメントアウトしてもよし
124                          // やりかたが苦しいけど、オプションダイアログのプレビュー用 try                          if GikoSys.Setting.UseKatjushaType then begin
125                          try                                  // やりかたが苦しいけど、オプションダイアログのプレビュー用 try
126                                  if ThreadItem.ParentBoard <> nil then                                  try
127                                          if ThreadItem.ParentBoard.ParentCategory <> nil then                                          if ThreadItem.ParentBoard <> nil then
128                                                  CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);                                                  if ThreadItem.ParentBoard.ParentCategory <> nil then
129                                          CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);                                                          CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
130                          except end;                                                  CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
131                          CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);                                  except end;
132                          CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);                                  CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
133                          CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);                                  CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
134                          CustomStringReplace( Skin, '&SKINPATH', GikoSys.Setting.CSSFileName);                                  CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
135                          CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));                                  CustomStringReplace( Skin, '&SKINPATH', GikoSys.Setting.CSSFileName);
136                          CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));                                  CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
137                          CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));                                  CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
138                                    CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
139                          CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));  
140                          CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));                                  CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
141                          CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));                                  CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
142                          //----- ここまで                                  CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
143                                    //----- ここまで
144                            end;
145                  end;                  end;
146                  Result := Skin.Text;                  Result := Skin.Text;
147          finally          finally
# Line 174  begin Line 178  begin
178                  Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );                  Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
179    
180                  //----- かちゅ〜しゃ互換用。コメントアウトしてもよし                  //----- かちゅ〜しゃ互換用。コメントアウトしてもよし
181                  Skin := CustomStringReplace( Skin, '&NUMBER',                  if GikoSys.Setting.UseKatjushaType then begin
182                          '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');                          Skin := CustomStringReplace( Skin, '&NUMBER',
183                  Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);                                  '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
184                  Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');                          Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
185                  Skin := CustomStringReplace( Skin, '&MAILNAME',                          Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
186                          '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');                          Skin := CustomStringReplace( Skin, '&MAILNAME',
187                  Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);                                  '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
188                  Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);                          Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
189                  Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);                          Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
190                  Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );                          Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
191                  Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );                          Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
192                            Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
193            end;
194                  //----- ここまで                  //----- ここまで
195    
196                  Result := Skin;                  Result := Skin;
# Line 296  begin Line 302  begin
302          end else          end else
303                  Result := AID;                  Result := AID;
304  end;  end;
305    procedure THTMLCreate.separateNumber(var st: String; var et: String; const Text, Separator: String);
306    var
307            p : Integer;
308    begin
309            p := Pos(Separator,Text);
310            if (p > 0 ) then begin
311                    st := Copy(Text, 1, p - 1);
312                    et := Copy(Text, p + Length(Separator), Length(Text));
313            end else begin
314                    st := Text;
315                    et := Text;
316            end;
317    end;
318    
319  (*************************************************************************  (*************************************************************************
320   *   *
321   * from HotZonu   * from HotZonu
# Line 303  end; Line 323  end;
323  function THTMLCreate.ConvRes(const Body, Bbs, Key,  function THTMLCreate.ConvRes(const Body, Bbs, Key,
324          ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;          ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
325          DatToHTML: boolean = false): string;          DatToHTML: boolean = false): string;
326    const
327            GT      = '&gt;';
328            SN      = '0123456789';
329            ZN      = '0123456789';
330            FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
331    var
332            i : integer;
333            s : string;
334            sw: boolean;
335            cm: boolean;
336            No: string;
337            oc      : string;
338            st, et: string;
339            pos, pmin : integer;
340            j : integer;
341            token : array[0..5] of string;
342            ch : string;
343            db : boolean;
344    
345    begin
346            //s に本文を全部入れる
347            s        :=     Body;
348            //結果をクリア
349            Result   :=     '';
350            //検索対象の文字列郡
351            token[0] := GT + GT;
352            token[1] := GT;
353            token[2] := '>>';
354            token[3] := '>';
355            token[4] := '<a ';
356            token[5] := '<A ';
357    
358            //
359            while Length(s) > 0 do begin
360                    pmin := Length(s) + 1;
361                    i       := length(token);
362                    for j := 0 to length(token) - 1 do begin
363                            pos := AnsiPos(token[j], s);
364                            if pos <> 0 then begin
365                                    if pos < pmin then begin
366                                            //どれでヒットしたか保存
367                                            i := j;
368                                            //最小値を更新
369                                            pmin := pos;
370                                    end;
371                            end;
372                    end;
373    
374                    //ヒットした文字列の一つ手前まで結果にコピー
375                    Result := Result + Copy(s, 1, pmin - 1);
376                    Delete(s, 1, pmin - 1);
377    
378                    if i = length(token) then begin
379                            //ヒットなし
380                    end else if (i = 4) or (i = 5) then begin
381                            //'<a ' or '<A' でヒット '</a>' or '</A>' までコピー
382                            pmin := AnsiPos('</a>' , s);
383                            pos := AnsiPos('</A>' , s);
384                            if (pmin <> 0) and (pos <> 0) then begin
385                                    if (pmin > pos) then begin
386                                            pmin := pos;
387                                    end;
388                            end else if (pos <> 0) then begin
389                                    pmin := pos;
390                            end;
391                            Result := Result + Copy(s, 1, pmin + 3);
392                            Delete(s, 1, pmin + 3);
393                    end else begin
394                            //何かしら見つかったパターン
395                            j := Length(token[i]) + 1;
396                            oc := '';
397                            No := '';
398                            sw := false;
399                            db := false;
400                            while j <= Length(s) do begin
401                                    if (ByteType(s, j) = mbSingleByte) then begin
402                                            //1byte文字
403                                            ch := s[j];
404                                            Inc(j);
405                                            db := false;
406                                    end else begin
407                                            //2byte文字
408                                            ch := ZenToHan(Copy(s, j, 2));
409                                            Inc(j, 2);
410                                            db := true;
411                                    end;
412    
413                                    if AnsiPos(ch, SN) > 0 then begin
414                                            No := No + ch;
415                                    end else if (ch = '-') then begin
416                                            if sw then break;
417                                            if No = '' then break;
418                                            sw := true;
419                                    end else begin
420                                            break;
421                                    end;
422                            end;
423                            //終端まで行っての終了かチェック
424                            if j <= Length(s) then begin
425                                    if db then j := j - 2
426                                    else j := j - 1;
427                            end;
428                            //何も数字が見つからないとき
429                            if No = '' then begin
430                                    Result := Result + Copy(s, 1, j - 1);
431                            end else begin
432                                    separateNumber(st, et, No, '-');
433    
434                                    if not DatToHTML then begin
435                                            Result := Result + Format(FORMAT_LINK,
436                                                                    [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue])
437                                                            + Copy(s, 1, j - 1) + '</a>';
438                                    end else begin
439                                            Result := Result + Format('<a href="#%s">', [st])
440                                                            + Copy(s, 1, j - 1) + '</a>';
441                                    end;
442                            end;
443                            Delete(s, 1, j - 1);
444                    end;
445            end;
446    end;
447    {
448    function THTMLCreate.ConvRes(const Body, Bbs, Key,
449            ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
450            DatToHTML: boolean = false): string;
451  type  type
452          PIndex = ^TIndex;          PIndex = ^TIndex;
453          TIndex = record          TIndex = record
# Line 314  const Line 459  const
459          GT      = '&gt;';          GT      = '&gt;';
460          SN      = '0123456789-';          SN      = '0123456789-';
461          ZN      = '0123456789−';          ZN      = '0123456789−';
462            FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
463  var  var
464          i : integer;          i : integer;
465          s,r : string;          s : string;
466          b : TMbcsByteType;          b : TMbcsByteType;
467          sw: boolean;          sw: boolean;
468          sp: integer;          sp: integer;
# Line 337  var Line 483  var
483                  FIndex.FNo                               := No;                  FIndex.FNo                               := No;
484                  List.Add(FIndex);                  List.Add(FIndex);
485          end;          end;
486          function ChooseString(const Text, Separator: string; Index: integer): string;          procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
487          var          var
488                  S : string;                  p : Integer;
                 i, p : integer;  
489          begin          begin
490                  S :=    Text;                  p := Pos(Separator, Text);
491                  for i :=        0 to    Index - 1 do    begin                  if (p > 0 ) then begin
492                          if      (AnsiPos(Separator, S) = 0) then        S :=    ''                          st := Copy(Text, 1, p - 1);
493                          else    S :=    Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));                          et := Copy(Text, p + Length(Separator), Length(Text));
494                    end else begin
495                            st := Text;
496                            et := Text;
497                  end;                  end;
                 p :=    AnsiPos(Separator, S);  
                 if      (p > 0) then    Result  :=      Copy(S, 1, p - 1) else Result :=        S;  
498          end;          end;
499  begin  begin
         { v1.0 b2 - 03 }  
500          s        :=     Body;          s        :=     Body;
501          r        :=     Body;          Result   :=     Body;
502          i        :=     1;          i        :=     1;
503          sw      :=      False;          sw      :=      False;
504          No      :=      '';          No      :=      '';
# Line 367  begin Line 512  begin
512                  case    b of                  case    b of
513                          mbSingleByte    : begin                          mbSingleByte    : begin
514                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin
515                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin                                          if      (Pos('<A HREF', oc) = 0) then   begin
516                                                  sw      :=      True;                                                  sw      :=      True;
517                                                  sp      :=      i;                                                  sp      :=      i;
518                                                  i :=    i + 7;                                                  i :=    i + 7;
# Line 376  begin Line 521  begin
521                                          end;                                          end;
522                                  end else                                  end else
523                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin
524                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then        begin                                          if      (Pos('<A HREF', oc) = 1) then   begin
525                                                  i :=    i + 7;                                                  i :=    i + 7;
526                                                  oc:='';                                                  oc:='';
527                                                  chk :=  True;                                                  chk :=  True;
528                                          end;                                          end;
529                                  end else                                  end else
530                                  if      (not sw) and (Copy(s,i,4) = GT) then    begin                                  if      (not sw) and (Copy(s,i,4) = GT) then    begin
531                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin                                          if      (Pos('<A HREF', oc) = 0) then   begin
532                                                  sw      :=      True;                                                  sw      :=      True;
533                                                  sp      :=      i;                                                  sp      :=      i;
534                                                  i :=    i + 3;                                                  i :=    i + 3;
# Line 393  begin Line 538  begin
538                                  end else                                  end else
539                                  if      ((not sw) and (Copy(s,i,1) = ',')) or                                  if      ((not sw) and (Copy(s,i,1) = ',')) or
540                                                  ((not sw) and (Copy(s,i,1) = '=')) then begin                                                  ((not sw) and (Copy(s,i,1) = '=')) then begin
541                                          if      ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or                                          if      ((not Chk) and (oc = '</A>')) or
542                                                          ((Chk) and      (oc = '')) or                                                          ((Chk) and      (oc = '')) or
543                                                          ((not Chk) and (al)) then                                                          ((not Chk) and (al)) then
544                                          begin                                          begin
545                                                  sw      :=      True;                                                  sw      :=      True;
546                                                  sp      :=      i;                                                  sp      :=      i;
                                                 //i :=  i + 1;  
547                                                  oc:='';                                                  oc:='';
548                                          end;                                          end;
549                                  end else                                  end else
# Line 413  begin Line 557  begin
557                                                          al := True;                                                          al := True;
558                                                  end;                                                  end;
559                                                  sw      :=      False;                                                  sw      :=      False;
560                                                  //                                                  Dec(i);
                                                 i := i - 1;  
                                                 //  
561                                                  No      := '';                                                  No      := '';
562                                                  oc:='';                                                  oc:='';
                                                 //chk :=        False;  
563                                          end;                                          end;
564                                  end else begin                                  end else begin
565                                          if      Copy(s,i,1) = '<' then  oc      :=      '';                                          if      Copy(s,i,1) = '<' then  begin
566                                          oc      :=      oc + Copy(s,i,1);                                                  oc      :=      '<';
567                                            end else begin
568                                                    oc      :=      oc + AnsiUpperCase(Copy(s,i,1));
569                                            end;
570                                          chk :=  False;                                          chk :=  False;
571                                          al      :=      False;                                          al      :=      False;
572                                  end;                                  end;
# Line 437  begin Line 581  begin
581                                  if      (not sw) and (Copy(s,i,2) = '>') then  begin                                  if      (not sw) and (Copy(s,i,2) = '>') then  begin
582                                          sw      :=      True;                                          sw      :=      True;
583                                          sp      :=      i;                                          sp      :=      i;
584                                          i :=    i + 1;                                          Inc(i);
585                                          chk :=  True;                                          chk :=  True;
586                                  end else                                  end else
587                                  if      (sw) then begin                                  if      (sw) then begin
# Line 449  begin Line 593  begin
593                                                          Add(sp, i, No);                                                          Add(sp, i, No);
594                                                  end;                                                  end;
595                                                  sw      :=      False;                                                  sw      :=      False;
596                                                  i := i - 1;                                                  Dec(i);
597                                                  No      :=      '';                                                  No      :=      '';
598                                          end;                                          end;
599                                  end else begin                                  end else begin
# Line 468  begin Line 612  begin
612                  end;                  end;
613          end;          end;
614          for i :=        List.Count - 1  downto  0 do    begin          for i :=        List.Count - 1  downto  0 do    begin
615                  if      (AnsiPos('-', PIndex(List[i]).FNo) > 0) then    begin                  separateNumber(st, et, PIndex(List[i]).FNo, '-');
                         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;  
                 end;  
616                  if not DatToHTML then                  if not DatToHTML then
617                  r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +                          Result :=       Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +
618                                          Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',                                          Format(FORMAT_LINK, [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
619                                                                  [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +                                          Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
620                                          Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +                                          Copy(Result,PIndex(List[i]).FIndexTo,Length(Result))
                                         Copy(r,PIndex(List[i]).FIndexTo,Length(r))  
621                  else                  else
622                  r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +                          Result :=       Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +
623                                          Format('<a href="#%s">', [st]) +                                          Format('<a href="#%s">', [st]) +
624                                          Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +                                          Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
625                                          Copy(r,PIndex(List[i]).FIndexTo,Length(r));                                          Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));
626    
627                  Dispose(PIndex(List[i]));                  Dispose(PIndex(List[i]));
628          end;          end;
629          List.Free;          List.Free;
         Result  :=      r;  
630  end;  end;
631    }
632  function THTMLCreate.ConvRes(  function THTMLCreate.ConvRes(
633          const Body, Bbs, Key, ParamBBS, ParamKey,          const Body, Bbs, Key, ParamBBS, ParamKey,
634          ParamStart, ParamTo, ParamNoFirst,          ParamStart, ParamTo, ParamNoFirst,
# Line 511  const Line 647  const
647          ZN      = '0123456789−';          ZN      = '0123456789−';
648  var  var
649          i : integer;          i : integer;
650          s,r : string;          s : string;
651          b : TMbcsByteType;          b : TMbcsByteType;
652          sw: boolean;          sw: boolean;
653          sp: integer;          sp: integer;
# Line 548  var Line 684  var
684  begin  begin
685          { v1.0 b2 - 03 }          { v1.0 b2 - 03 }
686          s        :=     Body;          s        :=     Body;
687          r        :=     Body;          Result   :=     Body;
688          i        :=     1;          i        :=     1;
689          sw      :=      False;          sw      :=      False;
690          No      :=      '';          No      :=      '';
# Line 559  begin Line 695  begin
695          al      :=      False;          al      :=      False;
696          while true      do      begin          while true      do      begin
697                  b :=    ByteType(s, i);                  b :=    ByteType(s, i);
698                  case    b of                  case b of
699                          mbSingleByte    : begin                          mbSingleByte    : begin
700                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin
701                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin                                          if      (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then    begin
702                                                  sw      :=      True;                                                  sw      :=      True;
703                                                  sp      :=      i;                                                  sp      :=      i;
704                                                  i :=    i + 7;                                                  i :=    i + 7;
# Line 571  begin Line 707  begin
707                                          end;                                          end;
708                                  end else                                  end else
709                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin                                  if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin
710                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then        begin                                          if      (Pos('<A HREF', AnsiUpperCase(oc)) = 1) then    begin
711                                                  i :=    i + 7;                                                  i :=    i + 7;
712                                                  oc:='';                                                  oc:='';
713                                                  chk :=  True;                                                  chk :=  True;
714                                          end;                                          end;
715                                  end else                                  end else
716                                  if      (not sw) and (Copy(s,i,4) = GT) then    begin                                  if      (not sw) and (Copy(s,i,4) = GT) then    begin
717                                          if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin                                          if      (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then    begin
718                                                  sw      :=      True;                                                  sw      :=      True;
719                                                  sp      :=      i;                                                  sp      :=      i;
720                                                  i :=    i + 3;                                                  i :=    i + 3;
# Line 600  begin Line 736  begin
736                                  end else                                  end else
737                                  if      (sw) then begin                                  if      (sw) then begin
738                                          sx      :=      Copy(s,i,1);                                          sx      :=      Copy(s,i,1);
739                                          if      (AnsiPos(sx, SN) > 0)   then    begin                                          if      (Pos(sx, SN) > 0)       then    begin
740                                                  No      :=      No      + sx;                                                  No      :=      No      + sx;
741                                          end else begin                                          end else begin
742                                                  if      (No <> '') and (No <> '-')       then   begin                                                  if      (No <> '') and (No <> '-')       then   begin
# Line 663  begin Line 799  begin
799                  end;                  end;
800          end;          end;
801          for i :=        List.Count - 1  downto  0 do    begin          for i :=        List.Count - 1  downto  0 do    begin
                 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );  
802                  if      (AnsiPos('-', PIndex(List[i]).FNo) > 0) then    begin                  if      (AnsiPos('-', PIndex(List[i]).FNo) > 0) then    begin
803                          st      :=      ChooseString(PIndex(List[i]).FNo, '-', 0);                          st      :=      ChooseString(PIndex(List[i]).FNo, '-', 0);
804                          et      :=      ChooseString(PIndex(List[i]).FNo, '-', 1);                          et      :=      ChooseString(PIndex(List[i]).FNo, '-', 1);
# Line 671  begin Line 806  begin
806                          st      :=      PIndex(List[i]).FNo;                          st      :=      PIndex(List[i]).FNo;
807                          et      :=      PIndex(List[i]).FNo;                          et      :=      PIndex(List[i]).FNo;
808                  end;                  end;
809                  r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +                  Result :=       Copy(Result,0, PIndex(List[i]).FIndexFrom - 1) +
810                                          Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',                                          Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
811                                                                  [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +                                                                  [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
812                                          Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +                                          Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
813                                          Copy(r,PIndex(List[i]).FIndexTo,Length(r));                                          Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));
814                  Dispose(PIndex(List[i]));                  Dispose(PIndex(List[i]));
815          end;          end;
816          List.Free;          List.Free;
         Result  :=      r;  
817  end;  end;
818    
819  function THTMLCreate.ConvertResAnchor(res: string): string;  function THTMLCreate.ConvertResAnchor(res: string): string;
# Line 731  begin Line 865  begin
865  end;  end;
866    
867  //Pluginを利用するBoardのスレッドのHTMLを作成してdocに書き込む  //Pluginを利用するBoardのスレッドのHTMLを作成してdocに書き込む
868  procedure THTMLCreate.CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);  procedure THTMLCreate.CreateUsePluginHTML(html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
869  var  var
870          i: integer;          i: integer;
871          NewReceiveNo: Integer;          NewReceiveNo: Integer;
# Line 745  begin Line 879  begin
879                          NewReceiveNo    := ThreadItem.NewReceive;                          NewReceiveNo    := ThreadItem.NewReceive;
880                          // フォントやサイズの設定                          // フォントやサイズの設定
881                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
882                            html.BeginUpdate;
883                          try                          try
884                                  doc.open;                                  //doc.open;
885                                  // ヘッダ                                  // ヘッダ
886                                  doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),                                  //doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),
887                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );                                  html.Append( boardPlugIn.GetHeader( DWORD( threadItem ),
888                                  doc.Write('<p id="idSearch"></p>' + #13#10 );                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
889                                    //      '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );
890                                    //doc.Write('<p id="idSearch"></p>' + #13#10 );
891                                    html.Add('<p id="idSearch"></p>');
892                                  for i := 0 to threadItem.Count - 1 do begin                                  for i := 0 to threadItem.Count - 1 do begin
893                                          // 1 は必ず表示                                          // 1 は必ず表示
894                                          if i <> 0 then begin                                          if i <> 0 then begin
# Line 774  begin Line 911  begin
911                                                  try                                                  try
912                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
913                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then
914                                                                          doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                          //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
915                                                                            html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
916                                                                  else                                                                  else
917                                                                          doc.Write( '<a name="new"></a>' + #13#10 );                                                                          //doc.Write( '<a name="new"></a>' + #13#10 );
918                                                                            html.Append( '<a name="new"></a>' );
919                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
920                                                                  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);                                                                  //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);
921                                                                    html.Append('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
922                                                          end else begin                                                          end else begin
923                                                                  doc.Write('</dl>');                                                                  //doc.Write('</dl>');
924                                                                  doc.Write('<a name="new"></a>');                                                                  html.Append('</dl>');
925                                                                  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>');                                                                  //doc.Write('<a name="new"></a>');
926                                                                  doc.Write('<dl> + #13#10');                                                                  html.Append('<a name="new"></a>');
927                                                                    //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>');
928                                                                    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>');
929                                                                    //doc.Write('<dl> + #13#10');
930                                                                    html.Append('<dl>');
931                                                          end;                                                          end;
932                                                  except                                                  except
933                                                          doc.Write( '<a name="new"></a>' + #13#10);                                                          //doc.Write( '<a name="new"></a>' + #13#10);
934                                                            html.Append( '<a name="new"></a>');
935                                                  end;                                                  end;
936                                          end;                                          end;
937    
938                                          // レス                                          // レス
939                                          doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );                                          //doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );
940                                            html.Append( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
941    
942                                          if ThreadItem.Kokomade = (i + 1) then begin                                          if ThreadItem.Kokomade = (i + 1) then begin
943                                                  // ここまで読んだ                                                  // ここまで読んだ
944                                                  try                                                  try
945                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
946                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then
947                                                                          doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                          //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
948                                                                            html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
949                                                                  else                                                                  else
950                                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                                          //doc.Write( '<a name="koko"></a>' + #13#10 );
951                                                                            html.Append( '<a name="koko"></a>' );
952                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
953                                                                  doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10 );                                                                  //doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10 );
954                                                                    html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>' );
955                                                          end else begin                                                          end else begin
956                                                                  doc.Write('</dl>');                                                                  //doc.Write('</dl>');
957                                                                  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('</dl>');
958                                                                  doc.Write('<dl>' + #13#10 );                                                                  //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>');
959                                                                    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>');
960                                                                    //doc.Write('<dl>' + #13#10 );
961                                                                    html.Append('<dl>' );
962                                                          end;                                                          end;
963                                                  except                                                  except
964                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                          //doc.Write( '<a name="koko"></a>' + #13#10 );
965                                                            html.Append( '<a name="koko"></a>' );
966                                                  end;                                                  end;
967                                          end;                                          end;
968                                  end;                                  end;
969    
970    
971                                  // スキン(フッタ)                                  // スキン(フッタ)
972                                  doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );                                  //doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );
973                                    html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
974                          finally                          finally
975                                  doc.Close;                                  //doc.Close;
976                                    html.EndUpdate;
977                          end;                          end;
978    
979                  end;                  end;
# Line 826  begin Line 981  begin
981  end;  end;
982    
983    
984  procedure THTMLCreate.CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);  procedure THTMLCreate.CreateUseSKINHTML(html : TStringList; ThreadItem: TThreadItem; ReadList: TStringList);
985  var  var
986          i: integer;          i: integer;
987          No: string;          No: string;
# Line 850  begin Line 1005  begin
1005                          // フォントやサイズの設定                          // フォントやサイズの設定
1006                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1007                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1008                          doc.open;                          //doc.open;
1009                            html.BeginUpdate;
1010                          try                          try
1011                                  doc.charset := 'Shift_JIS';                                  //doc.charset := 'Shift_JIS';
1012    
1013                                  // スキンの設定                                  // スキンの設定
1014                                  try                                  try
# Line 860  begin Line 1016  begin
1016                                          if Length( UserOptionalStyle ) > 0 then                                          if Length( UserOptionalStyle ) > 0 then
1017                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1018                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1019                                          doc.Write( SkinHeader + #13#10);                                          //doc.Write( SkinHeader + #13#10);
1020                                            html.Append( SkinHeader);
1021                                  except                                  except
1022                                  end;                                  end;
1023    
# Line 874  begin Line 1031  begin
1031                                  except                                  except
1032                                  end;                                  end;
1033    
1034                                  doc.Write('<p id="idSearch"></p>' + #13#10);                                  //doc.Write('<p id="idSearch"></p>' + #13#10);
1035                                  doc.Write('<a name="top"></a>' + #13#10);                                  html.Append('<p id="idSearch"></p>');
1036                                    //doc.Write('<a name="top"></a>' + #13#10);
1037                                    html.Append('<a name="top"></a>');
1038    
1039                                  for i := 0 to ReadList.Count - 1 do begin                                  for i := 0 to ReadList.Count - 1 do begin
1040                                          // 1 は必ず表示                                          // 1 は必ず表示
# Line 898  begin Line 1057  begin
1057                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1058                                                  try                                                  try
1059                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then
1060                                                                  doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size )  + #13#10)                                                                  //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size )  + #13#10)
1061                                                                    html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) )
1062                                                          else                                                          else
1063                                                                  doc.Write( '<a name="new"></a>' + #13#10 );                                                                  //doc.Write( '<a name="new"></a>' + #13#10 );
1064                                                                    html.Append( '<a name="new"></a>' );
1065                                                  except                                                  except
1066                                                          doc.Write( '<a name="new"></a>' + #13#10 );                                                          //doc.Write( '<a name="new"></a>' + #13#10 );
1067                                                            html.Append( '<a name="new"></a>' );
1068                                                  end;                                                  end;
1069                                          end;                                          end;
1070    
# Line 921  begin Line 1083  begin
1083                                                                  // 通常のレス                                                                  // 通常のレス
1084                                                                  strTmp := ReplaceRes( SkinRes );                                                                  strTmp := ReplaceRes( SkinRes );
1085    
1086                                                          doc.Write( strTmp + #13#10 );                                                          //doc.Write( strTmp + #13#10 );
1087                                                            html.Append( strTmp );
1088                                                  except                                                  except
1089                                                  end;                                                  end;
1090                                          end;                                          end;
# Line 930  begin Line 1093  begin
1093                                                  // ここまで読んだ                                                  // ここまで読んだ
1094                                                  try                                                  try
1095                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then
1096                                                                  doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )                                                                  //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
1097                                                                    html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
1098                                                          else                                                          else
1099                                                                  doc.Write( '<a name="koko"></a>' + #13#10 );                                                                  //doc.Write( '<a name="koko"></a>' + #13#10 );
1100                                                                    html.Append( '<a name="koko"></a>' );
1101                                                  except                                                  except
1102                                                          doc.Write( '<a name="koko"></a>' + #13#10 );                                                          //doc.Write( '<a name="koko"></a>' + #13#10 );
1103                                                            html.Append( '<a name="koko"></a>' );
1104                                                  end;                                                  end;
1105                                          end;                                          end;
1106                                  end;                                  end;
1107    
1108                                  doc.Write('<a name="bottom"></a>' + #13#10);                                  //doc.Write('<a name="bottom"></a>' + #13#10);
1109                                    html.Append('<a name="bottom"></a>' );
1110                                  // スキン(フッタ)                                  // スキン(フッタ)
1111                                  try                                  try
1112                                          doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );                                          //doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );
1113                                            html.Append( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
1114                                  except                                  except
1115                                  end;                                  end;
1116                          finally                          finally
1117                                  doc.close;                                  //doc.close;
1118                                    html.EndUpdate;
1119                          end;                          end;
1120                  end;                  end;
1121          end;          end;
1122  end;  end;
1123    
1124  procedure THTMLCreate.CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );  procedure THTMLCreate.CreateUseCSSHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
1125  var  var
1126          i: integer;          i: integer;
1127          No: string;          No: string;
# Line 962  var Line 1131  var
1131          UserOptionalStyle: string;          UserOptionalStyle: string;
1132  begin  begin
1133          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
1134                  doc.open;                  //doc.open;
1135                    html.BeginUpdate;
1136                  try                  try
1137                          doc.charset := 'Shift_JIS';                          //doc.charset := 'Shift_JIS';
1138                          NewReceiveNo := ThreadItem.NewReceive;                          NewReceiveNo := ThreadItem.NewReceive;
1139                          // フォントやサイズの設定                          // フォントやサイズの設定
1140                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1141                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1142                          if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin                          if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1143                                  //CSS使用                                  //CSS使用
1144                                  doc.Write('<html><head>' + #13#10);                                  html.Append('<html><head>');
1145                                  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">');
1146                                  doc.Write('<title>' + sTitle + '</title>' + #13#10);                                  html.Append('<title>' + sTitle + '</title>');
1147                                  doc.Write('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">' + #13#10);                                  html.Append('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1148                                  if Length( UserOptionalStyle ) > 0 then                                  if Length( UserOptionalStyle ) > 0 then
1149                                          doc.Write('<style type="text/css">body {' + UserOptionalStyle + '}</style>' + #13#10);                                          html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1150                                  doc.Write('</head>' + #13#10);                                  html.Append('</head>');
1151                                  doc.Write('<body>' + #13#10);                                  html.Append('<body>');
1152                                  doc.Write('<a name="top"></a>' + #13#10);                                  html.Append('<a name="top"></a>');
1153                                  doc.Write('<p id="idSearch"></p>' + #13#10);                                  html.Append('<p id="idSearch"></p>');
1154                                  doc.Write('<div class="title">' + sTitle + '</div>' + #13#10);                                  html.Append('<div class="title">' + sTitle + '</div>');
1155                                  for i := 0 to ReadList.Count - 1 do begin                                  for i := 0 to ReadList.Count - 1 do begin
1156                                          // 1 は必ず表示                                          // 1 は必ず表示
1157                                          if i <> 0 then begin                                          if i <> 0 then begin
# Line 1000  begin Line 1170  begin
1170                                          end;                                          end;
1171    
1172                                          if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin                                          if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1173                                                  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>');
1174                                          end;                                          end;
1175    
1176                                          if (Trim(ReadList[i]) <> '') then begin                                          if (Trim(ReadList[i]) <> '') then begin
# Line 1009  begin Line 1179  begin
1179                                                  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');
1180                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1181                                                  if Res.FMailTo = '' then                                                  if Res.FMailTo = '' then
1182                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
1183                                                                                  + '<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> '
1184                                                                                  + '<span class="name_label">名前:</span> '                                                                                  + '<span class="name_label">名前:</span> '
1185                                                                                  + '<span class="name"><b>' + Res.FName + '</b></span> '                                                                                  + '<span class="name"><b>' + Res.FName + '</b></span> '
1186                                                                                  + '<span class="date_label">投稿日:</span> '                                                                                  + '<span class="date_label">投稿日:</span> '
1187                                                                                  + '<span class="date">' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date">' + Res.FDateTime+ '</span></div>'
1188                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)                                                                                  + '<div class="mes">' + Res.FBody + ' </div>')
1189                                                  else if GikoSys.Setting.ShowMail then                                                  else if GikoSys.Setting.ShowMail then
1190                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
1191                                                                                  + '<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>'
1192                                                                                  + '<span class="name_label"> 名前: </span>'                                                                                  + '<span class="name_label"> 名前: </span>'
1193                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1194                                                                                  + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'                                                                                  + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1195                                                                                  + '<span class="date_label"> 投稿日:</span>'                                                                                  + '<span class="date_label"> 投稿日:</span>'
1196                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1197                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10)                                                                                  + '<div class="mes">' + Res.FBody + ' </div>')
1198                                                  else                                                  else
1199                                                          doc.Write('<a name="' + No + '"></a>'                                                          html.Append('<a name="' + No + '"></a>'
1200                                                                                  + '<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>'
1201                                                                                  + '<span class="name_label"> 名前: </span>'                                                                                  + '<span class="name_label"> 名前: </span>'
1202                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'                                                                                  + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1203                                                                                  + '<b>' + Res.FName + '</b></a>'                                                                                  + '<b>' + Res.FName + '</b></a>'
1204                                                                                  + '<span class="date_label"> 投稿日:</span>'                                                                                  + '<span class="date_label"> 投稿日:</span>'
1205                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'                                                                                  + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1206                                                                                  + '<div class="mes">' + Res.FBody + ' </div>' + #13#10);                                                                                  + '<div class="mes">' + Res.FBody + ' </div>');
1207                                          end;                                          end;
1208    
1209                                          if ThreadItem.Kokomade = (i + 1) then begin                                          if ThreadItem.Kokomade = (i + 1) then begin
1210                                                  doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10);                                                  html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>');
1211                                          end;                                          end;
1212    
1213                                  end;                                  end;
1214    
1215                                  doc.Write('<a name="bottom"></a>' + #13#10);                                  html.Append('<a name="bottom"></a>');
1216                                  doc.Write('<a name="last"></a>' + #13#10);                                  html.Append('<a name="last"></a>');
1217                                  doc.Write('</body></html>' + #13#10);                                  html.Append('</body></html>');
1218                          end;                          end;
1219                  finally                  finally
1220                          doc.Close;                          html.EndUpdate;
1221                            //doc.Close;
1222                  end;                  end;
1223          end;          end;
1224  end;  end;
1225    
1226  procedure THTMLCreate.CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );  procedure THTMLCreate.CreateDefaultHTML (html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
1227  var  var
1228          i: integer;          i: integer;
1229          No: string;          No: string;
# Line 1060  var Line 1231  var
1231          Res: TResRec;          Res: TResRec;
1232  begin  begin
1233          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
1234                  doc.open;                  //doc.open;
1235                    html.BeginUpdate;
1236                  try                  try
1237                          doc.charset := 'Shift_JIS';                          //doc.charset := 'Shift_JIS';
1238                          NewReceiveNo := ThreadItem.NewReceive;                          NewReceiveNo := ThreadItem.NewReceive;
1239                          doc.Write('<html><head>' + #13#10);                          html.Append('<html><head>');
1240                          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">');
1241                          doc.Write('<title>' + sTitle + '</title></head>' + #13#10);                          html.Append('<title>' + sTitle + '</title></head>');
1242                          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">');
1243                          doc.Write('<a name="top"></a>' + #13#10);                          html.Append('<a name="top"></a>');
1244                          doc.Write('<font size=+1 color="#FF0000">' + sTitle + '</font>' + #13#10);                          html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1245                          doc.Write('<dl>' + #13#10);                          html.Append('<dl>');
1246                          doc.Write('<p id="idSearch"></p>' + #13#10);                          html.Append('<p id="idSearch"></p>');
1247                          for i := 0 to ReadList.Count - 1 do begin                          for i := 0 to ReadList.Count - 1 do begin
1248                                  // 1 は必ず表示                                  // 1 は必ず表示
1249                                  if i <> 0 then begin                                  if i <> 0 then begin
# Line 1090  begin Line 1262  begin
1262                                  end;                                  end;
1263    
1264                                  if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin                                  if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1265                                          doc.Write('</dl>' + #13#10);                                          html.Append('</dl>');
1266                                          doc.Write('<a name="new"></a>' + #13#10);                                          html.Append('<a name="new"></a>');
1267                                          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>');
1268                                          doc.Write('<dl>' + #13#10);                                          html.Append('<dl>');
1269                                  end;                                  end;
1270    
1271                                  if (Trim(ReadList[i]) <> '') then begin                                  if (Trim(ReadList[i]) <> '') then begin
# Line 1102  begin Line 1274  begin
1274                                          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');
1275                                          Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                          Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1276                                          if Res.FMailTo = '' then                                          if Res.FMailTo = '' then
1277                                                  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>')
1278                                          else if GikoSys.Setting.ShowMail then                                          else if GikoSys.Setting.ShowMail then
1279                                                  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>')
1280                                          else                                          else
1281                                                  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>');
1282                                  end;                                  end;
1283                                  if ThreadItem.Kokomade = (i + 1) then begin                                  if ThreadItem.Kokomade = (i + 1) then begin
1284                                          doc.Write('</dl>' + #13#10);                                          html.Append('</dl>');
1285                                          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>');
1286                                          doc.Write('<dl>' + #13#10);                                          html.Append('<dl>');
1287                                  end;                                  end;
1288                          end;                          end;
1289                          doc.Write('</dl>' + #13#10);                          html.Append('</dl>');
1290                          doc.Write('<a name="bottom"></a>' + #13#10);                          html.Append('<a name="bottom"></a>');
1291                          doc.Write('</body></html>' + #13#10);                          html.Append('</body></html>');
1292                  finally                  finally
1293                          doc.Close;                          //doc.Close;
1294                            html.EndUpdate;
1295                  end;                  end;
1296          end;          end;
1297  end;  end;
1298    
1299  procedure THTMLCreate.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);  procedure THTMLCreate.CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
1300  var  var
1301          ReadList: TStringList;          ReadList: TStringList;
1302          CSSFileName: string;          CSSFileName: string;
1303          FileName: string;          FileName: string;
1304          Res: TResRec;          Res: TResRec;
1305            html: TStringList;
1306            mStream : TMemoryStream;
1307  {$IFDEF DEBUG}  {$IFDEF DEBUG}
1308          st, rt: Cardinal;          st, rt: Cardinal;
1309  {$ENDIF}  {$ENDIF}
# Line 1138  begin Line 1313  begin
1313          st := GetTickCount;          st := GetTickCount;
1314  {$ENDIF}  {$ENDIF}
1315          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
1316                  if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin                  html := TStringList.Create;
1317                          CreateUsePluginHTML(doc, ThreadItem, sTitle);                  try
1318                  end else begin                          if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1319                          ShortDayNames[1] := '日';               ShortDayNames[2] := '月';                                  CreateUsePluginHTML(html, ThreadItem, sTitle);
1320                          ShortDayNames[3] := '火';               ShortDayNames[4] := '水';                          end else begin
1321                          ShortDayNames[5] := '木';               ShortDayNames[6] := '金';                                  ShortDayNames[1] := '日';               ShortDayNames[2] := '月';
1322                          ShortDayNames[7] := '土';                                  ShortDayNames[3] := '火';               ShortDayNames[4] := '水';
1323                                    ShortDayNames[5] := '木';               ShortDayNames[6] := '金';
1324                                    ShortDayNames[7] := '土';
1325    
1326                          ReadList := TStringList.Create;                                  ReadList := TStringList.Create;
1327                          try                                  try
1328                                  if ThreadItem.IsLogFile then begin                                          if ThreadItem.IsLogFile then begin
1329                                          FileName := ThreadItem.GetThreadFileName;                                                  FileName := ThreadItem.GetThreadFileName;
1330                                          ReadList.LoadFromFile(FileName);                                                  ReadList.LoadFromFile(FileName);
1331                                          GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));                                                  GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1332                                          GikoSys.FAbon.Execute(ReadList);                //       あぼ〜んして                                                  GikoSys.FAbon.Execute(ReadList);                //       あぼ〜んして
1333                                          GikoSys.FSelectResFilter.Execute(ReadList); //レスのフィルタリングをする                                                  GikoSys.FSelectResFilter.Execute(ReadList); //レスのフィルタリングをする
1334                                          if ThreadItem.Title = '' then begin                                                  if ThreadItem.Title = '' then begin
1335                                                  Res := DivideStrLine(ReadList[0]);                                                          Res := DivideStrLine(ReadList[0]);
1336                                                  sTitle := Res.FTitle;                                                          sTitle := Res.FTitle;
1337                                          end else                                                  end else
1338                                                  sTitle := ThreadItem.Title                                                          sTitle := ThreadItem.Title
1339                                  end else begin                                          end else begin
1340                                          sTitle := CustomStringReplace(ThreadItem.Title, '@`', ',');                                                  sTitle := CustomStringReplace(ThreadItem.Title, '@`', ',');
1341                                  end;                                          end;
1342    
1343                                  // フォントやサイズの設定                                          // フォントやサイズの設定
1344                                  CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1345                                  if GikoSys.Setting.UseSkin then begin                                          if GikoSys.Setting.UseSkin then begin
1346                                          CreateUseSKINHTML(doc, ThreadItem, ReadList);                                                  CreateUseSKINHTML(html, ThreadItem, ReadList);
1347                                  end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin                                          end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1348                                          CreateUseCSSHTML(doc, ThreadItem, ReadList, sTitle);                                                  CreateUseCSSHTML(html, ThreadItem, ReadList, sTitle);
1349                                  end else begin                                          end else begin
1350                                          CreateDefaultHTML(doc, ThreadItem, ReadList, sTitle);                                                  CreateDefaultHTML(html, ThreadItem, ReadList, sTitle);
1351                                            end;
1352                                    finally
1353                                            ReadList.Free;
1354                                  end;                                  end;
1355                            end;
1356                            //WebBrowserに書き込み
1357                            mStream := TMemoryStream.Create;
1358                            try
1359                                    html.SaveToStream(mStream);
1360                                    mStream.Seek(soFromBeginning, 0);
1361                                    (doc as IPersistStreamInit).Load(TStreamAdapter.Create(mStream));
1362                          finally                          finally
1363                                  ReadList.Free;                                  mStream.Free;
1364                          end;                          end;
1365                    finally
1366                            html.Free;
1367                  end;                  end;
1368          end;          end;
1369  {$IFDEF DEBUG}  {$IFDEF DEBUG}

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

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