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

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

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