{HttpApp,} YofUtils, {URLMon,} BoardGroup, {gzip,} {Dolib,}
{bmRegExp,} AbonUnit, MojuUtils, Setting,
ExternalBoardManager, ExternalBoardPlugInMain{,}
- {Sort,} ,GikoBayesian, HintWindow;
+ {Sort,} ,GikoBayesian, {HintWindow,} ActiveX, ResPopupBrowser;
type
+
+ PResLinkRec = ^TResLinkRec;
+ TResLinkRec = record
+ FBbs: string;
+ FKey : string;
+ end;
+
+ TBufferedWebBrowser = class(TStringList)
+ private
+ //! \8f\91\82«\8d\9e\82Þ\83u\83\89\83E\83U
+ FBrowser: TWebBrowser;
+ //! \89½\8ds\82Ü\82Å\82½\82ß\82é\82©\82Ì\83T\83C\83Y
+ FBuffSize: Integer;
+ //! \83u\83\89\83E\83U\82ÌIHTMLDocument2\83C\83\93\83^\83t\83F\81[\83X\82ð\95Û\8e\9d\82·\82é open\82©\82çclose\82Ì\8aÔ\82Å
+ FBrowserDoc: Variant;
+ public
+ constructor Create(Browser: TWebBrowser; BuffSize: Integer);
+ destructor Destory;
+ procedure Open;
+ procedure Close;
+ procedure Flush;
+ function Add(const S: string): Integer; override;
+ end;
THTMLCreate = class(TObject)
private
{ Private \90é\8c¾ }
constructor Create;
function AddBeProfileLink(AID : string; ANum: Integer):string ;
- procedure CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
- procedure CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);
- procedure CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
- procedure CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
- function ConvertResAnchor(res: string): string;
+ procedure CreateUsePluginHTML(html:TBufferedWebBrowser; ThreadItem: TThreadItem; var sTitle: string);
+ procedure CreateUseSKINHTML(html:TBufferedWebBrowser; ThreadItem: TThreadItem; ReadList: TStringList);
+ procedure CreateUseCSSHTML(html:TBufferedWebBrowser; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
+ procedure CreateDefaultHTML (html:TBufferedWebBrowser; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
+ procedure ConvertResAnchor(PRes: PResRec);
procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
+ function checkComma(const s : String; var j : Integer) : boolean;
+ function addResAnchor(PAddRes: PResRec; PResLink : PResLinkRec; dat : boolean;
+ var s : String; j : Integer; const No: String) : string;
+ function appendResAnchor(PAddRes: PResRec; PResLink : PResLinkRec;
+ dat : boolean; var s : String) : string;
+ function getNumberString(const str: String;var index :Integer; var dbCharlen: Boolean;
+ sLen :Integer): String;
+ function isOutsideRange(item: TThreadItem; index: Integer ): Boolean;
+ function getKeywordLink(item: TThreadItem): String;
+ function GetResString(index: Integer; const Line: String; PResLink : PResLinkRec): String;
public
{ Public \90é\8c¾ }
- function AddAnchorTag(s: string): string;
+ procedure AddAnchorTag(PRes: PResRec);
function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;
- function SkinedRes(const skin: string; Res: TResRec; const No: string): string;
- 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, FullURL : string): string; overload;
- procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
+ function SkinedRes(const skin: string; PRes: PResRec; const No: string): string;
+ procedure ConvRes( PRes : PResRec; PResLink : PResLinkRec; DatToHTML: boolean = false); overload;
+ procedure CreateHTML2(Browser: TWebBrowser; ThreadItem: TThreadItem; var sTitle: string);
procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
//\83\8c\83X\83|\83b\83v\83A\83b\83v\82Ì\8dì\90¬
- procedure SetResPopupText(Hint :TResPopup; threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
+ procedure SetResPopupText(Hint :TResPopupBrowser; threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
//\83\8a\83\93\83N\82Ì\95¶\8e\9a\97ñ\82©\82ç\83\8c\83X\83|\83b\83v\83A\83b\83v\97p\82ÌURL\82É\95Ï\8a·\82·\82é
class function GetRespopupURL(AText, AThreadURL : string): string;
//\8ew\92è\82µ\82½\83p\83X\82É\83X\83L\83\93\82à\82µ\82\82ÍCSS\82Ì\83t\83@\83C\83\8b\82Ì\83R\83s\81[\82ð\8dì\82é
class procedure SkinorCSSFilesCopy(path: string);
+ //dat\82P\8ds\82ð\83\8c\83X\82É\95ª\89ð\82·\82é
+ class procedure DivideStrLine(Line: string; PRes: PResRec);
+ //HTML\82©\82ç\83\8a\83\93\83N\83^\83O\82ð\8dí\8f\9c\82·\82é
+ class function DeleteLink(const s: string): string;
+ //HTML\82Ì\83{\83f\83B\82É\8b\96\82³\82ê\82é\95¶\8e\9a\97ñ\82É\92u\8a·\82·\82é
+ class function RepHtml(const s: string): string;
+ //\83\8c\83X\83G\83f\83B\83^\82Ì\83v\83\8c\83r\83\85\81[\97pHTML\82ð\8dì\90¬\82·\82é
+ class function CreatePreviewHTML(const Title: string; const No: string;
+ const Mail: string; const Namae: string; const Body: string ) : string;
end;
var
implementation
+uses
+ Trip;
+
const
URL_CHAR: string = '0123456789'
+ 'abcdefghijklmnopqrstuvwxyz'
// \83\8c\83X\82Ì\92l\82ð\92u\8a·\82·\82é
function THTMLCreate.SkinedRes(
const skin: string;
- Res: TResRec;
+ PRes: PResRec;
const No: string
): string;
const
{$ELSE}
spamminess := 0;
{$ENDIF}
- Result := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
+ Result := CustomStringReplace( skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
Result := CustomStringReplace( Result, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
- Result := CustomStringReplace( Result, '<MAIL/>', Res.FMailTo);
- Result := CustomStringReplace( Result, '<DATE/>', Res.FDateTime);
+ Result := CustomStringReplace( Result, '<MAIL/>', PRes.FMailTo);
+ Result := CustomStringReplace( Result, '<DATE/>', PRes.FDateTime);
Result := CustomStringReplace( Result, '<PLAINNUMBER/>', No);
Result := CustomStringReplace( Result, '<NAME/>',
- Format(FORMT_NAME, [Res.FName]));
+ Format(FORMT_NAME, [PRes.FName]));
Result := CustomStringReplace( Result, '<NUMBER/>',
Format(FORMT_NUM, [No, No, No]));
Result := CustomStringReplace( Result, '<MAILNAME/>',
- Format(FORMT_MAILNAME,[Res.FMailTo, Res.FName]));
- Result := CustomStringReplace( Result, '<MESSAGE/>', Res.FBody);
+ Format(FORMT_MAILNAME,[PRes.FMailTo, PRes.FName]));
+ Result := CustomStringReplace( Result, '<MESSAGE/>', PRes.FBody);
+
//----- \82©\82¿\82ã\81`\82µ\82á\8cÝ\8a·\97p\81B\83R\83\81\83\93\83g\83A\83E\83g\82µ\82Ä\82à\82æ\82µ
if GikoSys.Setting.UseKatjushaType then begin
Result := CustomStringReplace( Result, '&NUMBER',
'<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
Result := CustomStringReplace( Result, '&PLAINNUMBER', No);
- Result := CustomStringReplace( Result, '&NAME', '<b>' + Res.FName + '</b>');
+ Result := CustomStringReplace( Result, '&NAME', '<b>' + PRes.FName + '</b>');
Result := CustomStringReplace( Result, '&MAILNAME',
- '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
- Result := CustomStringReplace( Result, '&MAIL', Res.FMailTo);
- Result := CustomStringReplace( Result, '&DATE', Res.FDateTime);
- Result := CustomStringReplace( Result, '&MESSAGE', Res.FBody);
+ '<a href="mailto:' + PRes.FMailTo + '"><b>' + PRes.FName + '</b></a>');
+ Result := CustomStringReplace( Result, '&MAIL', PRes.FMailTo);
+ Result := CustomStringReplace( Result, '&DATE', PRes.FDateTime);
+ Result := CustomStringReplace( Result, '&MESSAGE', PRes.FBody);
Result := CustomStringReplace( Result, '&SPAMMINESS', FloatToStr( spamminess ) );
Result := CustomStringReplace( Result, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
end;
(*************************************************************************
*http://\82Ì\95¶\8e\9a\97ñ\82ðanchor\83^\83O\95t\82«\82É\82·\82é\81B
*************************************************************************)
-function THTMLCreate.AddAnchorTag(s: string): string;
+procedure THTMLCreate.AddAnchorTag(PRes: PResRec);
+const
+ _HEAD : array[0..9] of String =
+ ('', 'h', 'ht', '', 'htt', '', 'http://', '', '', '');
var
url: string;
href: string;
idx, idx2: Integer;
pos : PChar;
pp, pe : PChar;
+ s : String;
+ len : Integer;
begin
- Result := '';
+ s := PRes.FBody;
+ PRes.FBody := '';
- while True do begin
+ //while True do begin
+ repeat
idx := MaxInt;
idx2 := MaxInt;
pp := PChar(s);
if idx = MaxInt then begin
//\83\8a\83\93\83N\82ª\96³\82¢\82æ\81B
- Result := Result + s;
- Break;
- end;
-
- if (idx > 1) and (idx > anchorLen) and
- (AnsiStrPosEx(pp + idx - 1 - anchorLen, pp + idx, pANCHORs, pANCHORe) <> nil) then begin
- //\8aù\82É\83\8a\83\93\83N\83^\83O\82ª\82Â\82¢\82Ä\82¢\82é\82Á\82Û\82¢\82Æ\82«\82Í\83\80\83V
- //</a></A>\82ð\92T\82·\81A\8f¬\95¶\8e\9a\82Å\8c©\82Â\82©\82ç\82È\82¯\82ê\82Î\91å\95¶\8e\9a\82Å\8c\9f\8dõ
- pos := AnsiStrPosEx(pp + idx, pe, pCTAGLs, pCTAGLe);
- if pos = nil then
- pos := AnsiStrPosEx(pp + idx, pe, pCTAGUs, pCTAGUe);
- if pos = nil then
- b := Length(REF_MARK[idx2])
- else
- b := pos - pp + 1;
-
- Result := Result + Copy(s, 1, idx + b);
- Delete(s, 1, idx + b);
- Continue;
- end;
-
- Result := Result + Copy(s, 1, idx - 1);
- Delete(s, 1, idx - 1);
- b := Length( s ) + 1;
- pp := PChar(s);
- for i := 1 to b do begin
- pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1);
-
- if pe = nil then begin
- //URL\82¶\82á\82È\82¢\95¶\8e\9a\94\8c©\81I\82Æ\82©\81A\95¶\8e\9a\82ª\82È\82\82È\82Á\82½\81B
- url := Copy(s, 1, i - 1);
- case idx2 of
- 1 : href := 'h' + url;
- 2 : href := 'ht' + url;
- 4 : href := 'htt' + url;
- 6 : href := 'http://' + url;
+ len := Length(PRes.FBody);
+ SetLength(PRes.FBody, Length(s) + len);
+ Move(pp^, PRes.FBody[len + 1], Length(s));
+ end else begin
+ if (idx > anchorLen) and
+ (AnsiStrPosEx(pp + idx - 1 - anchorLen, pp + idx, pANCHORs, pANCHORe) <> nil) then begin
+ //\8aù\82É\83\8a\83\93\83N\83^\83O\82ª\82Â\82¢\82Ä\82¢\82é\82Á\82Û\82¢\82Æ\82«\82Í\83\80\83V
+ //</a></A>\82ð\92T\82·\81A\8f¬\95¶\8e\9a\82Å\8c©\82Â\82©\82ç\82È\82¯\82ê\82Î\91å\95¶\8e\9a\82Å\8c\9f\8dõ
+ pos := AnsiStrPosEx(pp + idx, pe, pCTAGLs, pCTAGLe);
+ if pos = nil then
+ pos := AnsiStrPosEx(pp + idx, pe, pCTAGUs, pCTAGUe);
+ if pos = nil then
+ b := Length(REF_MARK[idx2])
else
- href := url;
- end;
+ b := pos - (pp + idx) + 1;
- Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
- Delete(s, 1, i - 1);
- Break;
+ len := Length(PRes.FBody);
+ SetLength(PRes.FBody, len + idx + b );
+ Move(pp^, PRes.FBody[len + 1], idx + b);
+ Delete(s, 1, idx + b);
+ end else begin
+ pp := PChar(s);
+ len := Length(PRes.FBody);
+ SetLength(PRes.FBody, len + idx - 1);
+ Move(pp^, PRes.FBody[len + 1], idx - 1);
+
+ Delete(s, 1, idx - 1);
+ b := Length( s ) + 1;
+ pp := PChar(s);
+ for i := 1 to b do begin
+ //\82P\83o\83C\83g\95¶\8e\9a\82ÅURL\82É\8eg\82¦\82È\82¢\95¶\8e\9a\82È\82ç
+ if (AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1) = nil) then begin
+ url := Copy(s, 1, i - 1);
+ Delete(s, 1, i - 1);
+ href := Format('%s%s', [_HEAD[idx2], url]);
+ PRes.FBody
+ := Format('%s<a href="%s" target="_blank">%s</a>', [PRes.FBody, href, url]);
+ Break;
+ end;
+ //\88ê\95¶\8e\9a\90i\82ß\82é\81B
+ Inc(pp);
+ end;
end;
- //\88ê\95¶\8e\9a\90i\82ß\82é\81B
- Inc(pp);
end;
- end;
+ until idx = MaxInt;
end;
//\88ø\90\94\81AAID\81F\91Î\8fÛ\82Æ\82È\82é\93ú\95tID\95¶\8e\9a\97ñ\81AANum:\83\8c\83X\94Ô AURL\81F\82»\82Ì\83X\83\8c\83b\83h\82ÌURL
function THTMLCreate.AddBeProfileLink(AID : string; ANum: Integer):string ;
+const
+ BE_MARK : string = 'BE:';
var
p : integer;
BNum, BMark : string;
begin
- p := AnsiPos('BE:', AnsiUpperCase(AID));
+ p := AnsiPos(BE_MARK, AnsiUpperCase(AID));
if p > 0 then begin
BNum := Copy(AID, p, Length(AID));
AID := Copy(AID, 1, p - 1);
end else
Result := AID;
end;
-procedure THTMLCreate.separateNumber(var st: String; var et: String; const Text, Separator: String);
+//! \83\8c\83X\83A\83\93\83J\81[\82Ì\83\8c\83X\94Ô\8d\86\82ð\95ª\8a\84\82·\82é
+// Text = '1-9' -> st = '1'; et = '9'
+// Text = '10' -> st = '10'; et = '10'
+procedure THTMLCreate.separateNumber(var st: String; var et: String; const Text:String; const Separator: String);
var
p : Integer;
begin
et := Text;
end;
end;
-(*************************************************************************
- *
- * from HotZonu
- *************************************************************************)
-function THTMLCreate.ConvRes(const Body, Bbs, Key,
- ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
- DatToHTML: boolean = false): string;
+//! \83\8c\83X\83A\83\93\83J\81[\82ª\8ew\82µ\82Ä\82¢\82é\83\8c\83X\94Ô\8d\86\82Ì\95¶\8e\9a\97ñ\82ð\8eæ\93¾\82·\82é
+function THTMLCreate.getNumberString(
+ const str: String;
+ var index :Integer; var dbCharlen: Boolean; sLen :Integer)
+: String;
const
- GT = '>';
SN = '0123456789';
- FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
+var
+ ch : String;
+ sw : Boolean;
+begin
+ Result := '';
+ sw := False;
+ while (index <= sLen) do begin
+ if (ByteType(str, index) = mbSingleByte) then begin
+ //1byte\95¶\8e\9a
+ ch := str[index];
+ Inc(index);
+ dbCharlen := false;
+ end else begin
+ //2byte\95¶\8e\9a
+ ch := ZenToHan(Copy(str, index, 2));
+ Inc(index, 2);
+ dbCharlen := true;
+ end;
+
+ if System.Pos(ch, SN) > 0 then begin
+ Result := Result + ch;
+ end else if (ch = '-') then begin
+ if sw then break;
+ if Result = '' then break;
+ Result := Result + ch;
+ sw := true;
+ end else begin
+ break;
+ end;
+ end;
+end;
+
+procedure THTMLCreate.ConvRes( PRes : PResRec; PResLink : PResLinkRec; DatToHTML: boolean = false);
+const
+ GT = '>';
//\8c\9f\8dõ\91Î\8fÛ\82Ì\95¶\8e\9a\97ñ\8cS
TOKEN : array[0..5] of string = (GT+GT, GT, '\81\84\81\84', '\81\84', '<a ', '<A ');
var
i : integer;
s : string;
- sw: boolean;
- cm: boolean;
No: string;
- oc : string;
pos, pmin : integer;
j : integer;
- ch : string;
db : boolean;
- len : integer;
rink : string;
- function addResAnchor(const Left :string) : string;
- var
- st,et : string;
- begin
- //\8fI\92[\82Ü\82Å\8ds\82Á\82Ä\82Ì\8fI\97¹\82©\83`\83F\83b\83N
- if j <= len then begin
- if db then j := j - 2
- else j := j - 1;
- end;
- //\89½\82à\90\94\8e\9a\82ª\8c©\82Â\82©\82ç\82È\82¢\82Æ\82«
- if No = '' then begin
- Result := Left + Copy(s, 1, j - 1);
- end else begin
- separateNumber(st, et, No, '-');
-
- if not DatToHTML then begin
- Result := Left + Format(FORMAT_LINK,
- [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]);
- end else begin
- Result := Left + Format('<a href="#%s">', [st]);
- end;
- Result := Result + Copy(s, 1, j - 1) + '</a>';
- end;
- Delete(s, 1, j - 1);
- end;
-
- procedure getNumberString;
- begin
- while (j <= len) do begin
- if (ByteType(s, j) = mbSingleByte) then begin
- //1byte\95¶\8e\9a
- ch := s[j];
- Inc(j);
- db := false;
- end else begin
- //2byte\95¶\8e\9a
- ch := ZenToHan(Copy(s, j, 2));
- Inc(j, 2);
- db := true;
- end;
-
- if System.Pos(ch, SN) > 0 then begin
- No := No + ch;
- end else if (ch = '-') then begin
- if sw then break;
- if No = '' then break;
- No := No + ch;
- sw := true;
- end else begin
- break;
- end;
- end;
- end;
-
- function checkComma : boolean;
- begin
- j := 1;
- len := Length(s);
- if ((len > 0) and (s[j] = ',')) or ((len > 1) and (ZenToHan(Copy(s, j ,2)) = ',')) then begin
- Result := true;
- if (ByteType(s, j) = mbSingleByte) then
- Inc(j)
- else
- Inc(j, 2);
- No := '';
- end else begin
- Result := false;
- end;
- end;
begin
//s \82É\96{\95¶\82ð\91S\95\94\93ü\82ê\82é
- s := Body;
+ s := PRes.FBody;
//\8c\8b\89Ê\82ð\83N\83\8a\83A
- Result := '';
+ PRes.FBody := '';
//
while Length(s) > 2 do begin
end;
//\83q\83b\83g\82µ\82½\95¶\8e\9a\97ñ\82Ì\88ê\82Â\8eè\91O\82Ü\82Å\8c\8b\89Ê\82É\83R\83s\81[
- Result := Result + Copy(s, 1, pmin - 1);
+ PRes.FBody := PRes.FBody + Copy(s, 1, pmin - 1);
Delete(s, 1, pmin - 1);
if i = 6 then begin
pmin := pos;
end;
rink := Copy(s, 1, pmin + 3);
- Result := Result + rink;
+ PRes.FBody := PRes.FBody + rink;
Delete(s, 1, pmin + 3);
pmin := Length(rink);
end;
// \83\8c\83X\83A\83\93\83J\81[\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82½\82ç,\82ª\91±\82\8cÀ\82è\83A\83\93\83J\81[\82Æ\82µ\82Ä\88µ\82¤
if i <= 3 then begin
- No := '';
- cm := checkComma;
- len := Length(s);
- while cm do begin
- oc := '';
- No := '';
- sw := false;
- db := false;
- getNumberString;
- Result := addResAnchor(Result);
- cm := checkComma;
- end;
+ appendResAnchor(PRes, PResLink, DatToHTML, s );
end;
end else begin
//\89½\82©\82µ\82ç\8c©\82Â\82©\82Á\82½\83p\83^\81[\83\93
j := Length(TOKEN[i]) + 1;
- oc := '';
- No := '';
- sw := false;
db := false;
- len := Length(s);
- getNumberString;
- Result := addResAnchor(Result);
+ No := getNumberString(s, j, db, Length(s) );
+ //\8fI\92[\82Ü\82Å\8ds\82Á\82Ä\82Ì\8fI\97¹\82©\83`\83F\83b\83N
+ if j <= Length(s) then begin
+ if db then j := j - 2
+ else j := j - 1;
+ end;
+ addResAnchor(PRes, PResLink, DatToHTML, s, j, No);
+
+ // , \82ª\91±\82\8cÀ\82è\83\8c\83X\83A\83\93\83J\81[\82Æ\82µ\82Ä\8f\88\97\9d\82·\82é
+ appendResAnchor(PRes, PResLink, DatToHTML, s );
+ end;
+ end;
+ if Length(s) > 0 then begin
+ PRes.FBody := PRes.FBody + s;
+ end;
+end;
+function THTMLCreate.checkComma(
+ const s : String;
+ var j : Integer
+) : boolean;
+var
+ bType : TMbcsByteType;
+begin
+ Result := false;
+ if (Length(s) > 0) then begin
+ bType := ByteType(s, j);
+ if ((bType = mbSingleByte) and (s[j] = ',') or
+ ((bType = mbLeadByte) and (ZenToHan(Copy(s, j ,2)) = ','))) then begin
+ Result := true;
+ if (bType = mbSingleByte) then
+ Inc(j)
+ else
+ Inc(j, 2);
end;
end;
- Result := Result + s;
end;
+function THTMLCreate.appendResAnchor(
+ PAddRes: PResRec; PResLink : PResLinkRec; dat : boolean;
+ var s : String) : string;
+var
+ No{, ch, oc}: String;
+ len, j : Integer;
+ cm, {sw,} db : Boolean;
-function THTMLCreate.ConvertResAnchor(res: string): string;
+begin
+ No := '';
+ j := 1;
+ cm := checkComma(s, j);
+ len := Length(s);
+ while cm do begin
+ db := false;
+ No := getNumberString(s, j, db, len );
+
+ //\8fI\92[\82Ü\82Å\8ds\82Á\82Ä\82Ì\8fI\97¹\82©\83`\83F\83b\83N
+ if j <= len then begin
+ if db then j := j - 2
+ else j := j - 1;
+ end;
+ addResAnchor(PAddRes, PResLink, dat, s, j, No);
+ j := 1;
+ len := Length(s);
+ cm := checkComma(s, j);
+ end;
+end;
+
+function THTMLCreate.addResAnchor(
+ PAddRes: PResRec; PResLink : PResLinkRec; dat : boolean;
+ var s : String; j : Integer; const No: String) : string;
+const
+ FORMAT_LINK = '<a href="../test/read.cgi?bbs=%s&key=%s&st=%s&to=%s&nofirst=true" target="_blank">';
+var
+ st,et : string;
+begin
+
+ //\89½\82à\90\94\8e\9a\82ª\8c©\82Â\82©\82ç\82È\82¢\82Æ\82«
+ if No = '' then begin
+ PAddRes.FBody := PAddRes.FBody + Copy(s, 1, j - 1);
+ end else begin
+ separateNumber(st, et, No, '-');
+
+ if not dat then begin
+ PAddRes.FBody := PAddRes.FBody +
+ Format(FORMAT_LINK, [PResLink.FBbs, PResLink.FKey, st, et]);
+ end else begin
+ PAddRes.FBody := PAddRes.FBody + Format('<a href="#%s">', [st]);
+ end;
+ PAddRes.FBody := PAddRes.FBody + Copy(s, 1, j - 1) + '</a>';
+ end;
+ Delete(s, 1, j - 1);
+end;
+
+
+procedure THTMLCreate.ConvertResAnchor(PRes: PResRec);
const
_HEAD : string = '<a href="../';
_TAIL : string = ' target="_blank">';
var
i, j, k: Integer;
tmp: string;
+ res: string;
begin
- Result := '';
+ res := PRes.FBody;
+ PRes.FBody := '';
i := AnsiPos(_HEAD, res);
while i <> 0 do begin
- Result := Result + Copy(res, 1, i -1);
+ PRes.FBody := PRes.FBody + Copy(res, 1, i -1);
Delete(res, 1, i - 1);
j := AnsiPos(_TAIL, res);
if j = 0 then begin
- Result := Result + res;
+ PRes.FBody := PRes.FBody + res;
Exit;
end;
tmp := Copy(res, 1, j - 1);
if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
- Result := Result + '<a href="#' + tmp + '">';
+ PRes.FBody := PRes.FBody + '<a href="#' + tmp + '">';
end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
- Result := Result + '<a href="#' + tmp + '">';
+ PRes.FBody := PRes.FBody + '<a href="#' + tmp + '">';
end else begin
k := LastDelimiter('/', tmp);
Delete(tmp, 1, k);
else
Delete(tmp, AnsiPos('"', tmp), Length(tmp));
- Result := Result + '<a href="#' + tmp + '">';
+ PRes.FBody := PRes.FBody + '<a href="#' + tmp + '">';
end;
i := AnsiPos(_HEAD, res);
end;
- Result := Result + res;
+ PRes.FBody := PRes.FBody + res;
end;
-
//Plugin\82ð\97\98\97p\82·\82éBoard\82Ì\83X\83\8c\83b\83h\82ÌHTML\82ð\8dì\90¬\82µ\82Ädoc\82É\8f\91\82«\8d\9e\82Þ
-procedure THTMLCreate.CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
+procedure THTMLCreate.CreateUsePluginHTML(html:TBufferedWebBrowser; ThreadItem: TThreadItem; var sTitle: string);
var
i: integer;
NewReceiveNo: Integer;
NewReceiveNo := ThreadItem.NewReceive;
// \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
UserOptionalStyle := GikoSys.SetUserOptionalStyle;
- try
- doc.open;
- // \83w\83b\83_
- doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),
- '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
- doc.Write('<p id="idSearch"></p>');
-
- for i := 0 to threadItem.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case GikoSys.ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > GikoSys.ResRange then
- Continue;
- end;
- end;
+ html.add(boardPlugIn.GetHeader( DWORD( threadItem ),
+ '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
+ html.Add('<p id="idSearch"></p>');
+ html.Flush;
+
+ for i := 0 to threadItem.Count - 1 do begin
+ // 1 \82Í\95K\82¸\95\\8e¦
+ if i <> 0 then begin
+ // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
+ if (isOutsideRange(ThreadItem, i)) then begin
+ Continue;
+ end;
+ end;
- // \90V\92\85\83}\81[\83N
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- try
- if GikoSys.Setting.UseSkin then begin
- if FileExists( GikoSys.GetSkinNewmarkFileName ) then
- doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
- else
- doc.Write( '<a name="new"></a>');
- end else if GikoSys.Setting.UseCSS then begin
- doc.Write('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
- end else begin
- doc.Write('</dl>');
- doc.Write('<a name="new"></a>');
- 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>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
- doc.Write('<dl>');
- end;
- except
- doc.Write( '<a name="new"></a>');
+ // \90V\92\85\83}\81[\83N
+ if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
+ try
+ if GikoSys.Setting.UseSkin then begin
+ if FileExists( GikoSys.GetSkinNewmarkFileName ) then
+ html.Add( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
+ else
+ html.Add( '<a name="new"></a>');
+ end else if GikoSys.Setting.UseCSS then begin
+ html.Add('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
+ end else begin
+ html.Add('</dl>');
+ html.Add('<a name="new"></a>');
+ html.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
+ html.Add('<dl>');
end;
+ except
+ html.Add( '<a name="new"></a>');
end;
+ end;
- // \83\8c\83X
- doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ));
+ // \83\8c\83X
+ html.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ));
- if ThreadItem.Kokomade = (i + 1) then begin
- // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
- try
- if GikoSys.Setting.UseSkin then begin
- if FileExists( GikoSys.GetSkinBookmarkFileName ) then
- doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
- else
- doc.Write( '<a name="koko"></a>');
- end else if GikoSys.Setting.UseCSS then begin
- doc.Write('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
- end else begin
- doc.Write('</dl>');
- 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>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>');
- doc.Write('<dl>');
- end;
- except
- doc.Write( '<a name="koko"></a>');
+ if ThreadItem.Kokomade = (i + 1) then begin
+ // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
+ try
+ if GikoSys.Setting.UseSkin then begin
+ if FileExists( GikoSys.GetSkinBookmarkFileName ) then
+ html.Add( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ))
+ else
+ html.Add( '<a name="koko"></a>');
+ end else if GikoSys.Setting.UseCSS then begin
+ html.Add('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
+ end else begin
+ html.Add('</dl>');
+ html.Add('<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>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>');
+ html.Add('<dl>');
end;
+ except
+ html.Add('<a name="koko"></a>');
end;
end;
+ end;
- // \83X\83L\83\93(\83t\83b\83^)
- doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ));
- finally
- doc.Close;
- end;
+ // \83X\83L\83\93(\83t\83b\83^)
+ html.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ));
end;
-procedure THTMLCreate.CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);
+procedure THTMLCreate.CreateUseSKINHTML(html:TBufferedWebBrowser; ThreadItem: TThreadItem; ReadList: TStringList);
+const
+ KOKO_TAG = '<a name="koko"></a>';
+ NEW_TAG = '<a name="new"></a>';
var
i: integer;
- No: string;
NewReceiveNo: Integer;
Res: TResRec;
UserOptionalStyle: string;
SkinHeader: string;
SkinNewRes: string;
SkinRes: string;
- strTmp : string;
ThreadName : string;
+ ResLink :TResLinkRec;
begin
NewReceiveNo := ThreadItem.NewReceive;
// \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
UserOptionalStyle := GikoSys.SetUserOptionalStyle;
ThreadName := ChangeFileExt(ThreadItem.FileName, '');
-
- doc.open;
+ ResLink.FBbs := ThreadItem.ParentBoard.BBSID;
+ ResLink.FKey := ThreadName;
+ // \83X\83L\83\93\82Ì\90Ý\92è
try
- doc.charset := 'Shift_JIS';
+ SkinHeader := LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, ThreadItem.Size);
+ if Length( UserOptionalStyle ) > 0 then
+ SkinHeader := CustomStringReplace( SkinHeader, '</head>',
+ '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
+ html.Add( SkinHeader );
+ except
+ end;
- // \83X\83L\83\93\82Ì\90Ý\92è
- try
- SkinHeader := LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, ThreadItem.Size);
- if Length( UserOptionalStyle ) > 0 then
- SkinHeader := CustomStringReplace( SkinHeader, '</head>',
- '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
- doc.Write( SkinHeader );
- except
- end;
+ SkinNewRes := LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, ThreadItem.Size);
+ SkinRes := LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, ThreadItem.Size );
- try
- SkinNewRes := LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, ThreadItem.Size);
- except
- end;
+ html.Add('<p id="idSearch"></p>'#13#10'<a name="top"></a>');
+ html.Flush;
- try
- SkinRes := LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, ThreadItem.Size );
- except
+ for i := 0 to ReadList.Count - 1 do begin
+ // 1 \82Í\95K\82¸\95\\8e¦
+ if i <> 0 then begin
+ // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
+ if (isOutsideRange(ThreadItem, i)) then begin
+ Continue;
+ end;
end;
- doc.Write('<p id="idSearch"></p>'#13#10'<a name="top"></a>');
-
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case GikoSys.ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > GikoSys.ResRange then
- Continue;
- end;
- end;
-
- // \90V\92\85\83}\81[\83N
- if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
- try
- if FileExists( GikoSys.GetSkinNewmarkFileName ) then
- doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
- else
- doc.Write( '<a name="new"></a>');
- except
- doc.Write( '<a name="new"></a>' );
- end;
- end;
-
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
-
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ThreadName, 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
-
- try
- if NewReceiveNo <= (i + 1) then
- // \90V\92\85\83\8c\83X
- strTmp := SkinedRes(SkinNewRes, Res, No) //ReplaceRes( SkinNewRes )
- else
- // \92Ê\8fí\82Ì\83\8c\83X
- strTmp := SkinedRes(SkinRes, Res, No); //ReplaceRes( SkinRes );
-
- doc.Write( strTmp );
- except
- end;
- end;
+ // \90V\92\85\83}\81[\83N
+ if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
+ if FileExists( GikoSys.GetSkinNewmarkFileName ) then
+ html.Add( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
+ else
+ html.Add( NEW_TAG );
+ end;
- if ThreadItem.Kokomade = (i + 1) then begin
- // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
- try
- if FileExists( GikoSys.GetSkinBookmarkFileName ) then
- doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
- else
- doc.Write( '<a name="koko"></a>' );
- except
- doc.Write( '<a name="koko"></a>' );
- end;
- end;
+ if (Trim(ReadList[i]) <> '') then begin
+ DivideStrLine(ReadList[i], @Res);
+ AddAnchorTag(@Res);
+ ConvRes(@Res, @ResLink);
+ Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
+
+ if NewReceiveNo <= (i + 1) then
+ // \90V\92\85\83\8c\83X
+ html.Add(SkinedRes(SkinNewRes, @Res, IntToStr(i + 1)))
+ else
+ // \92Ê\8fí\82Ì\83\8c\83X
+ html.Add(SkinedRes(SkinRes, @Res, IntToStr(i + 1)));
end;
- doc.Write('<a name="bottom"></a>');
- // \83X\83L\83\93(\83t\83b\83^)
- try
- doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
- except
+ if ThreadItem.Kokomade = (i + 1) then begin
+ // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
+ if FileExists( GikoSys.GetSkinBookmarkFileName ) then
+ html.Add( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ))
+ else
+ html.Add( KOKO_TAG );
end;
- finally
- doc.close;
end;
+ html.Add(getKeywordLink(ThreadItem));
+ html.Add('<a name="bottom"></a>');
+ // \83X\83L\83\93(\83t\83b\83^)
+ html.Add( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
end;
-procedure THTMLCreate.CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
+procedure THTMLCreate.CreateUseCSSHTML(html:TBufferedWebBrowser; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
const
FORMAT_NOMAIL = '<a name="%s"></a><div class="header"><span class="no"><a href="menu:%s">%s</a></span>'
- + '<span class="name_label">\96¼\91O\81F</span> <span class="name"><b>%s</b></span>'
- + '<span class="date_label">\93\8a\8de\93ú\81F</span> <span class="date">%s</span></div>'
+ + '<span class="name_label"> \96¼\91O\81F </span> <span class="name"><b>%s</b></span>'
+ + '<span class="date_label"> \93\8a\8de\93ú\81F</span> <span class="date">%s</span></div>'
+ '<div class="mes">%s</div>';
FORMAT_SHOWMAIL = '<a name="%s"></a><div class="header"><span class="no"><a href="menu:%s">%s</a></span>'
+ '<span class="name_label"> \96¼\91O\81F </span><a class="name_mail" href="mailto:%s">'
+ '<b>%s</b></a><span class="mail"> [%s]</span><span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> %s</span></div><div class="mes">%s </div>';
+ + '<span class="date"> %s</span></div><div class="mes">%s</div>';
FORMAT_NOSHOW = '<a name="%s"></a><div class="header"><span class="no"><a href="menu:%s">%s</a></span>'
+ '<span class="name_label"> \96¼\91O\81F </span><a class="name_mail" href="mailto:%s">'
+ '<b>%s</b></a><span class="date_label"> \93\8a\8de\93ú\81F</span><span class="date"> %s</span></div>'
- + '<div class="mes">%s </div>';
-
+ + '<div class="mes">%s</div>';
var
i: integer;
No: string;
NewReceiveNo: Integer;
Res: TResRec;
UserOptionalStyle: string;
+ ThreadName :String;
+ ResLink :TResLinkRec;
begin
- doc.open;
- try
- doc.charset := 'Shift_JIS';
- NewReceiveNo := ThreadItem.NewReceive;
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- UserOptionalStyle := GikoSys.SetUserOptionalStyle;
- CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
- if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
- //CSS\8eg\97p
- doc.Write('<html><head>');
- doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- doc.Write('<title>' + sTitle + '</title>');
- doc.Write('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
- if Length( UserOptionalStyle ) > 0 then
- doc.Write('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
- doc.Write('</head>'#13#10'<body>');
- doc.Write('<a name="top"></a>'#13#10'<p id="idSearch"></p>');
- doc.Write('<div class="title">' + sTitle + '</div>');
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case GikoSys.ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > GikoSys.ResRange then
- Continue;
- end;
- end;
-
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- doc.Write('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
- end;
-
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
- if Res.FMailTo = '' then
- doc.Write(Format(FORMAT_NOMAIL, [No, No, No, Res.FName, Res.FDateTime, Res.FBody]))
- else if GikoSys.Setting.ShowMail then
- doc.Write(Format(FORMAT_SHOWMAIL, [No, No, No, Res.FMailTo, Res.FName, Res.FMailTo, Res.FDateTime, Res.FBody]))
- else
- doc.Write(Format(FORMAT_NOSHOW, [No, No, No, Res.FName, Res.FDateTime, Res.FBody]));
- end;
+ NewReceiveNo := ThreadItem.NewReceive;
+ ThreadName := ChangeFileExt(ThreadItem.FileName, '');
+ ResLink.FBbs := ThreadItem.ParentBoard.BBSID;
+ ResLink.FKey := ThreadName;
+ // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
+ UserOptionalStyle := GikoSys.SetUserOptionalStyle;
+ CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
+ if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
+ //CSS\8eg\97p
+ html.Add('<html><head>');
+ html.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
+ html.Add('<title>' + sTitle + '</title>');
+ html.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
+ if Length( UserOptionalStyle ) > 0 then
+ html.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
+ html.Add('</head>'#13#10'<body>');
+ html.Add('<a name="top"></a>'#13#10'<p id="idSearch"></p>');
+ html.Add('<div class="title">' + sTitle + '</div>');
+ html.Flush;
+ for i := 0 to ReadList.Count - 1 do begin
+ // 1 \82Í\95K\82¸\95\\8e¦
+ if i <> 0 then begin
+ // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
+ if (isOutsideRange(ThreadItem, i)) then begin
+ Continue;
+ end;
+ end;
- if ThreadItem.Kokomade = (i + 1) then begin
- doc.Write('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
- end;
+ if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
+ html.Add('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
+ end;
+ if (Trim(ReadList[i]) <> '') then begin
+ No := IntToStr(i + 1);
+ DivideStrLine(ReadList[i], @Res);
+ AddAnchorTag(@Res);
+ ConvRes(@Res, @ResLink);
+ Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
+ if Res.FMailTo = '' then
+ html.Add(Format(FORMAT_NOMAIL, [No, No, No, Res.FName, Res.FDateTime, Res.FBody]))
+ else if GikoSys.Setting.ShowMail then
+ html.Add(Format(FORMAT_SHOWMAIL, [No, No, No, Res.FMailTo, Res.FName, Res.FMailTo, Res.FDateTime, Res.FBody]))
+ else
+ html.Add(Format(FORMAT_NOSHOW, [No, No, No, Res.FMailTo, Res.FName, Res.FDateTime, Res.FBody]));
+ end;
+ if ThreadItem.Kokomade = (i + 1) then begin
+ html.Add('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
end;
- doc.Write('<a name="bottom"></a>');
- doc.Write('<a name="last"></a>');
- doc.Write('</body></html>');
end;
- finally
- doc.Close;
+ html.Add(getKeywordLink(ThreadItem));
+ html.Add('<a name="bottom"></a>');
+ html.Add('<a name="last"></a>');
+ html.Add('</body></html>');
end;
end;
-procedure THTMLCreate.CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
+procedure THTMLCreate.CreateDefaultHTML (html:TBufferedWebBrowser; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
var
i: integer;
- No: string;
NewReceiveNo: Integer;
- Res: TResRec;
+ ThreadName: String;
+ ResLink : TResLinkRec;
begin
- doc.open;
- try
- doc.charset := 'Shift_JIS';
- NewReceiveNo := ThreadItem.NewReceive;
- doc.Write('<html><head>'#13#10);
- doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10);
- doc.Write('<title>' + sTitle + '</title></head>'#13#10);
- doc.Write('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">'#13#10);
- doc.Write('<a name="top"></a>'#13#10);
- doc.Write('<font size=+1 color="#FF0000">' + sTitle + '</font>'#13#10);
- doc.Write('<dl>'#13#10);
- doc.Write('<p id="idSearch"></p>'#13#10);
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case GikoSys.ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > GikoSys.ResRange then
- Continue;
- end;
- end;
+ NewReceiveNo := ThreadItem.NewReceive;
+ ThreadName := ChangeFileExt(ThreadItem.FileName, '');
+ ResLink.FBbs := ThreadItem.ParentBoard.BBSID;
+ ResLink.FKey := ThreadName;
+ html.Add('<html><head>');
+ html.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
+ html.Add('<title>' + sTitle + '</title></head>');
+ html.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
+ html.Add('<a name="top"></a>');
+ html.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
+ html.Add('<dl>');
+ html.Add('<p id="idSearch"></p>');
+ html.Flush;
+ for i := 0 to ReadList.Count - 1 do begin
+ // 1 \82Í\95K\82¸\95\\8e¦
+ if i <> 0 then begin
+ // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
+ if (isOutsideRange(ThreadItem, i)) then begin
+ Continue;
+ end;
+ end;
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- doc.Write('</dl>'#13#10);
- doc.Write('<a name="new"></a>'#13#10);
- 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>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>'#13#10);
- doc.Write('<dl>'#13#10);
- end;
+ if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
+ html.Add('</dl>');
+ html.Add('<a name="new"></a>');
+ html.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
+ html.Add('<dl>');
+ end;
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
- if Res.FMailTo = '' then
- doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>'#13#10)
- else if GikoSys.Setting.ShowMail then
- doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>'#13#10)
- else
- doc.Write('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>'#13#10);
- end;
- if ThreadItem.Kokomade = (i + 1) then begin
- 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>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>'#13#10);
- doc.Write('<dl>'#13#10);
- end;
+ if (Trim(ReadList[i]) <> '') then begin
+ html.Add(GetResString(i, ReadList[i], @ResLink));
+ end;
+ if ThreadItem.Kokomade = (i + 1) then begin
+ html.Add('</dl>');
+ html.Add('<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>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>');
+ html.Add('<dl>');
end;
- doc.Write('</dl>'#13#10);
- doc.Write('<a name="bottom"></a>'#13#10);
- doc.Write('</body></html>'#13#10);
- finally
- doc.Close;
end;
+ html.Add(getKeywordLink(ThreadItem));
+ html.Add('</dl>'#13#10'<a name="bottom"></a>'#13#10'</body></html>');
end;
-
-procedure THTMLCreate.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
+function THTMLCreate.GetResString(index: Integer; const Line: String; PResLink : PResLinkRec): String;
+var
+ No : String;
+ Res: TResRec;
+begin
+ No := IntToStr(index + 1);
+ DivideStrLine(Line, @Res);
+ AddAnchorTag(@Res);
+ ConvRes(@Res, PResLink);
+ Res.FDateTime := AddBeProfileLink(Res.FDateTime, index + 1);
+ if Res.FMailTo = '' then
+ Result := '<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>'#13#10
+ else if GikoSys.Setting.ShowMail then
+ Result := '<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>'#13#10
+ else
+ Result := '<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>'#13#10;
+end;
+procedure THTMLCreate.CreateHTML2(Browser: TWebBrowser; ThreadItem: TThreadItem; var sTitle: string);
var
ReadList: TStringList;
CSSFileName: string;
FileName: string;
Res: TResRec;
+ body : TBufferedWebBrowser;
{$IFDEF DEBUG}
st, rt: Cardinal;
{$ENDIF}
st := GetTickCount;
{$ENDIF}
if ThreadItem <> nil then begin
- if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
- CreateUsePluginHTML(doc, ThreadItem, sTitle);
- end else begin
- ShortDayNames[1] := '\93ú'; ShortDayNames[2] := '\8c\8e';
- ShortDayNames[3] := '\89Î'; ShortDayNames[4] := '\90\85';
- ShortDayNames[5] := '\96Ø'; ShortDayNames[6] := '\8bà';
- ShortDayNames[7] := '\93y';
+ body := TBufferedWebBrowser.Create(Browser, 100);
+ try
+ body.Open;
+ if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
+ CreateUsePluginHTML(body, ThreadItem, sTitle);
+ end else begin
+ ShortDayNames[1] := '\93ú'; ShortDayNames[2] := '\8c\8e';
+ ShortDayNames[3] := '\89Î'; ShortDayNames[4] := '\90\85';
+ ShortDayNames[5] := '\96Ø'; ShortDayNames[6] := '\8bà';
+ ShortDayNames[7] := '\93y';
- ReadList := TStringList.Create;
- try
- if ThreadItem.IsLogFile then begin
- ReadList.BeginUpdate;
- FileName := ThreadItem.GetThreadFileName;
- ReadList.LoadFromFile(FileName);
- ReadList.EndUpdate;
- GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
- GikoSys.FAbon.Execute(ReadList); // \82 \82Ú\81`\82ñ\82µ\82Ä
- GikoSys.FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
- if ThreadItem.Title = '' then begin
- Res := DivideStrLine(ReadList[0]);
- sTitle := Res.FTitle;
- end else
- sTitle := ThreadItem.Title
- end else begin
- sTitle := CustomStringReplace(ThreadItem.Title, '\81\97\81M', ',');
- end;
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
- if GikoSys.Setting.UseSkin then begin
- CreateUseSKINHTML(doc, ThreadItem, ReadList);
- end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
- CreateUseCSSHTML(doc, ThreadItem, ReadList, sTitle);
- end else begin
- CreateDefaultHTML(doc, ThreadItem, ReadList, sTitle);
+ ReadList := TStringList.Create;
+ try
+ if ThreadItem.IsLogFile then begin
+ ReadList.BeginUpdate;
+ FileName := ThreadItem.GetThreadFileName;
+ ReadList.LoadFromFile(FileName);
+ ReadList.EndUpdate;
+ GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
+ GikoSys.FAbon.Execute(ReadList); // \82 \82Ú\81`\82ñ\82µ\82Ä
+ GikoSys.FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
+ if ThreadItem.Title = '' then begin
+ DivideStrLine(ReadList[0], @Res);
+ sTitle := Res.FTitle;
+ end else
+ sTitle := ThreadItem.Title
+ end else begin
+ sTitle := CustomStringReplace(ThreadItem.Title, '\81\97\81M', ',');
+ end;
+ // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
+ CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
+ if GikoSys.Setting.UseSkin then begin
+ CreateUseSKINHTML(body, ThreadItem, ReadList);
+ end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
+ CreateUseCSSHTML(body, ThreadItem, ReadList, sTitle);
+ end else begin
+ CreateDefaultHTML(body, ThreadItem, ReadList, sTitle);
+ end;
+ finally
+ ReadList.Free;
end;
-
- finally
- ReadList.Free;
end;
+ finally
+ body.Close;
+ body.Free;
end;
end;
{$IFDEF DEBUG}
SkinHeader: string;
SkinRes: string;
tmp, tmp1: string;
+ ThreadName: String;
+ ResLink : TResLinkRec;
function LoadSkin( fileName: string ): string;
begin
Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
end;
function ReplaceRes( skin: string ): string;
begin
- Result := SkinedRes( skin, Res, No );
+ Result := SkinedRes( skin, @Res, No );
end;
begin
if ThreadItem <> nil then begin
CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
+ ThreadName := ChangeFileExt(ThreadItem.FileName, '');
+ ResLink.FBbs := ThreadItem.ParentBoard.BBSID;
+ ResLink.FKey := ThreadName;
html.Clear;
html.BeginUpdate;
//if ThreadItem.IsBoardPlugInAvailable then begin
for i := 0 to threadItem.Count - 1 do begin
// \83\8c\83X
- html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
+ Res.FBody := boardPlugIn.GetRes( DWORD( threadItem ), i + 1 );
+ ConvertResAnchor(@Res);
+ html.Append( Res.FBody );
end;
// \83X\83L\83\93(\83t\83b\83^)
GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
GikoSys.FAbon.Execute(ReadList); // \82 \82Ú\81`\82ñ\82µ\82Ä
GikoSys.FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
- Res := DivideStrLine(ReadList[0]);
+ DivideStrLine(ReadList[0], @Res);
//Res.FTitle := CustomStringReplace(Res.FTitle, '\81\97\81M', ',');
sTitle := Res.FTitle;
end else begin
if (Trim(ReadList[i]) <> '') then begin
No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
+ DivideStrLine(ReadList[i], @Res);
+ AddAnchorTag(@Res);
+ ConvRes(@Res, @ResLink, true);
+ ConvertResAnchor(@Res);
try
html.Append( ReplaceRes( SkinRes ) );
for i := 0 to ReadList.Count - 1 do begin
if (Trim(ReadList[i]) <> '') then begin
No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
+ DivideStrLine(ReadList[i], @Res);
+ AddAnchorTag(@Res);
+ ConvRes(@Res, @ResLink, true);
+ ConvertResAnchor(@Res);
if Res.FMailTo = '' then
html.Append('<a name="' + No + '"></a>'
+ '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
for i := 0 to ReadList.Count - 1 do begin
if (Trim(ReadList[i]) <> '') then begin
No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
+ DivideStrLine(ReadList[i], @Res);
+ AddAnchorTag(@Res);
+ ConvRes(@Res, @ResLink, true);
+ ConvertResAnchor(@Res);
if Res.FMailTo = '' then
html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> \93\8a\8de\93ú\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
else if GikoSys.Setting.ShowMail then
end;
end;
-procedure THTMLCreate.SetResPopupText(Hint : TResPopup; threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
+procedure THTMLCreate.SetResPopupText(Hint : TResPopupBrowser; threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
var
i: Integer;
tmp: string;
wkInt: Integer;
- Res: TResRec;
- Header: string;
- Body: string;
boardPlugIn : TBoardPlugIn;
+ Html: TStringList;
+ ResLink : TResLinkRec;
begin
+
+ Html := TStringList.Create;
try
if StNum > ToNum then begin
wkInt := StNum;
if StNum + MAX_POPUP_RES < ToNum then
ToNum := StNum + MAX_POPUP_RES;
+ Hint.Title := '';
+ Hint.RawDocument := '';
+ Hint.Thread := nil;
+
//\83^\83C\83g\83\8b\95\\8e¦
if Title then
if ThreadItem <> nil then
Hint.Title := ThreadItem.Title;
if ThreadItem <> nil then begin
+ Hint.Thread := ThreadItem;
+ ResLink.FBbs := ThreadItem.ParentBoard.BBSID;
+ ResLink.FKey := ChangeFileExt(ThreadItem.FileName, '');
//if ThreadItem.IsBoardPlugInAvailable then begin
if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
//===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
//\82±\82±\82Å\82Q\82¿\82á\82ñ\82Ë\82é\82Ìdat\82Ì\8c`\8e®\82Å\82P\8ds\93Ç\82Ý\8d\9e\82ß\82ê\82Î¥¥¥\81B\81«\93Ç\82ß\82é\82æ\82¤\82É\82È\82Á\82½
tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
- Res := DivideStrLine(tmp);
- if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
- Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
- else
- Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
- Header := DeleteFontTag(Header);
- Header := CustomStringReplace(Header, '<br>', '',true);
-
- Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
- Body := CustomStringReplace(Body, '<br>', #10,true);
- Body := CustomStringReplace(Body, '</a>', '',true);
- Body := GikoSys.DeleteLink(Body);
- Body := CustomStringReplace(Body, '<', '<');
- Body := CustomStringReplace(Body, '>', '>');
- Body := CustomStringReplace(Body, '"', '"');
- Body := CustomStringReplace(Body, '&', '&');
- Body := CustomStringReplace(Body, ' ', ' ');
-
- Hint.Add(Header, Body);
+ Html.Add(GetResString(Line-1, tmp, @ResLink));
end;
end;
end else begin
FileName := ThreadItem.FilePath;
tmp := GikoSys.ReadThreadFile(FileName, Line);
if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
- Res := DivideStrLine(tmp);
- if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
- Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
- else
- Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
-
- Body := DeleteFontTag(Res.FBody);
- Body := CustomStringReplace(Body, '<br> ', #10,true);
- Body := CustomStringReplace(Body, '<br>', #10,true);
- Body := CustomStringReplace(Body, '</a>', '',true);
- Body := GikoSys.DeleteLink(Body);
- Body := CustomStringReplace(Body, '<', '<');
- Body := CustomStringReplace(Body, '>', '>');
- Body := CustomStringReplace(Body, '"', '"');
- Body := CustomStringReplace(Body, '&', '&');
- Body := CustomStringReplace(Body, ' ', ' ');
- Hint.Add(Header, Body);
+ Html.Add(GetResString(Line-1, tmp, @ResLink));
end;
end;
end;
+ if (Html.Count > 0) then begin
+ Hint.RawDocument := '<DL>' + Html.Text + '</DL>';
+ end;
end;
finally
+ Html.Free;
end;
end;
end else if GikoSys.Setting.UseCSS then begin
current := ExtractFilePath(GikoSys.GetStyleSheetDir);
tmp := ExtractFilePath(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName);
- end;
+ end else begin
+ Exit;
+ end;
dirs := TStringList.Create;
try
dirs.Add(tmp);
for i := 0 to dirs.Count - 1 do begin
files := TStringList.Create;
try
- files.BeginUpdate;
+ files.BeginUpdate;
gikoSys.GetFileList(dirs[i], '*.*', files, true);
- files.EndUpdate;
+ files.EndUpdate;
tmpD := CustomStringReplace(dirs[i], GikoSys.GetConfigDir, path);
if (AnsiPos(dirs[i], tmp) <> 0) and not (DirectoryExists(tmpD)) then
ForceDirectories(tmpD);
dirs.Free;
end;
end;
+{!
+\brief dat\83t\83@\83C\83\8b\82Ì\88ê\83\89\83C\83\93\82ð\95ª\89ð
+\param Line dat\83t\83@\83C\83\8b\82ð\8d\\90¬\82·\82é 1 \8ds
+\return \83\8c\83X\8fî\95ñ
+}
+class procedure THTMLCreate.DivideStrLine(Line: string; PRes: PResRec);
+const
+ delimiter = '<>';
+var
+ pds, pde : PChar;
+ pss, pse : PChar;
+ ppos : PChar;
+begin
+ //\8cÅ\92è
+ PRes.FType := glt2chNew;
+
+ pss := PChar(Line);
+ pse := pss + Length(Line);
+ pds := PChar(delimiter);
+ pde := pds + Length(delimiter);
+
+ ppos := AnsiStrPosEx(pss, pse, pds, pde);
+ if (ppos = nil) then begin
+ Line := CustomStringReplace(Line, '<>', '<>');
+ Line := CustomStringReplace(Line, ',', '<>');
+ Line := CustomStringReplace(Line, '\81\97\81M', ',');
+ end;
+ //Trim\82µ\82Ä\82Í\82¢\82¯\82È\82¢\8bC\82ª\82·\82é\81@by\82à\82¶\82ã
+ PRes.FName := RemoveToken(Line, delimiter);
+ PRes.FMailTo := RemoveToken(Line, delimiter);
+ PRes.FDateTime := RemoveToken(Line, delimiter);
+ PRes.FBody := RemoveToken(Line, delimiter);
+ //\82Q\82¿\82á\82ñ\82Ë\82é\82Æ\82©\82¾\82Æ\81A\96{\95¶\82Ì\90æ\93ª\82É\82P\82Â\94¼\8ap\8bó\94\92\82ª\93ü\82Á\82Ä\82¢\82é\82Ì\82Å\8dí\8f\9c\82·\82é
+ //\91¼\82Ì\8cf\8e¦\94Â\82Å\81A\83\8c\83X\8e©\91Ì\82Ì\8bó\94\92\82©\82à\82µ\82ê\82È\82¢\82¯\82Ç\82»\82ê\82Í\92ú\82ß\82é
+ PRes.FBody := TrimLeft(PRes.FBody);
+ //\8bó\82¾\82Æ\96â\91è\82ª\8bN\82«\82é\82©\82ç\81A\8bó\94\92\82ð\90Ý\92è\82·\82é
+ if PRes.FBody = '' then
+ PRes.FBody := ' ';
+
+ PRes.FTitle := RemoveToken(Line, delimiter);
+end;
+
+{!
+\brief HTML \82©\82ç\83A\83\93\83J\81[\83^\83O\82ð\8dí\8f\9c
+\param s \8c³\82É\82È\82é HTML
+\return \83A\83\93\83J\81[\83^\83O\82ª\8dí\8f\9c\82³\82ê\82½ HTML
+}
+class function THTMLCreate.DeleteLink(const s: string): string;
+var
+ s1: string;
+ s2: string;
+ idx: Integer;
+ i: Integer;
+begin
+ i := 0;
+ Result := '';
+ while True do begin
+ s1 := GikoSys.GetTokenIndex(s, '<a href="', i);
+ s2 := GikoSys.GetTokenIndex(s, '<a href="', i + 1);
+ idx := Pos('">', s1);
+ if idx <> 0 then
+ Delete(s1, 1, idx + 1);
+ idx := Pos('">', s2);
+ if idx <> 0 then
+ Delete(s2, 1, idx + 1);
+ Result := Result + s1 + s2;
+ if s2 = '' then
+ Break;
+
+ inc(i, 2);
+ end;
+end;
+{
+\brief HTML\89»\82Ì\82½\82ß\82Ì\92u\8a·
+\param s \8c³\82É\82È\82é\95¶\8e\9a\97ñ
+\return HTML\82ÌinnerText\82Æ\82µ\82Ä\82ä\82é\82³\82ê\82é\95¶\8e\9a\97ñ
+}
+class function THTMLCreate.RepHtml(const s: string): string;
+begin
+// s := StringReplace(s, '&', '&', [rfReplaceAll]);
+ Result := s;
+ Result := CustomStringReplace(Result, '<', '<');
+ Result := CustomStringReplace(Result, '>', '>');
+// s := StringReplace(s, ' ', ' ', [rfReplaceAll]); //\8ed\97l\95Ï\8dX\82É\82æ\82è \8eg\97p\95s\89Â
+ Result := CustomStringReplace(Result, '"', '"');
+end;
+{
+\brief \83\8c\83X\83G\83f\83B\83^\82Å\82Ì\83v\83\8c\83r\83\85\81[\97pHTML\8dì\90¬
+\param Title \83X\83\8c\83b\83h\83^\83C\83g\83\8b
+\param No \83\8c\83X\94Ô\8d\86
+\param Mail \83\81\81[\83\8b\97\93
+\param Name \96¼\91O\97\93
+\param Body \96{\95¶
+\return \83v\83\8c\83r\83\85\81[\97pHTML
+}
+class function THTMLCreate.CreatePreviewHTML(
+ const Title: string;
+ const No: string;
+ const Mail: string;
+ const Namae: string;
+ const Body: string
+) : string;
+var
+ posTrip : Integer;
+ tripOrigin : string;
+ NameWithTrip: string;
+ DateTime: string;
+begin
+ Result := '<HTML><HEAD>'#13#10
+ + '<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">'#13#10
+ + '<TITLE>' + title + '</TITLE>'#13#10
+ + '</HEAD>'#13#10
+ + '<BODY text="#000000" bgcolor="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">'#13#10
+ + '<FONT COLOR="#FF0000">' + title + '</FONT>'#13#10
+ + '<DL>'#13#10;
+
+ DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', Now());
+
+ NameWithTrip := Namae;
+ posTrip := AnsiPos( '#', Namae );
+ if posTrip > 0 then begin
+ tripOrigin := Copy( Namae, posTrip + 1, Length( Namae ) );
+ NameWithTrip := Copy( Namae, 1, posTrip - 1 ) + '</B> \81\9f' +
+ get_2ch_trip( PChar( tripOrigin ) ) + '<B>';
+ end;
+ if Mail = '' then begin
+ Result := Result + '<DT>' + No + ' \81F <FONT color="forestgreen"><B>' + NameWithTrip
+ + '</B></FONT> \81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10
+ end else begin
+ Result := Result + '<DT>' + No + ' \81F <A href="mailto:' + Mail + '"><B>' + NameWithTrip
+ + '</B></A> [' + Mail + ']\81F ' + DateTime+ '<BR><DD>' + Body + '<BR><BR><BR>' + #13#10;
+ end;
+ Result := Result + '</BODY></HTML>';
+
+end;
+{
+\brief \95\\8e¦\94Í\88Í\8aO\83\8c\83X\94Ô\8d\86\94»\92è\8f\88\97\9d
+\param item \95\\8e¦\83X\83\8c\83b\83h
+\param index \83\8c\83X\94Ô\8d\86
+\return ture:\95\\8e¦\94Í\88Í\8aO false:\95\\8e¦\94Í\88Í\93à
+}
+function THTMLCreate.isOutsideRange( item: TThreadItem; index: Integer ): Boolean;
+begin
+ Result := False;
+ // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
+ case GikoSys.ResRange of
+ Ord( grrKoko ):
+ if item.Kokomade > (index + 1) then
+ Result := True;
+ Ord( grrNew ):
+ if item.NewReceive > (index + 1) then
+ Result := True;
+ 10..65535:
+ if (GikoSys.Setting.HeadResCount) < (index + 1) then begin
+ if (item.Count - index) > GikoSys.ResRange then begin
+ Result := True;
+ end;
+ end;
+ end;
+end;
+constructor TBufferedWebBrowser.Create(Browser: TWebBrowser; BuffSize: Integer);
+begin
+ inherited Create;
+ Self.Sorted := False;
+ if (Browser = nil) then
+ Raise Exception.Create('Browser is NULL');
+ FBrowser := Browser;
+
+ // \83o\83b\83t\83@\82·\82é\8ds\90\94\82ð
+ if (BuffSize < 0) then begin
+ FBuffSize := 100;
+ end else begin
+ FBuffSize := BuffSize;
+ end;
+ Self.Capacity := FBuffSize + 10;
+end;
+procedure TBufferedWebBrowser.Open;
+begin
+ FBrowserDoc := Idispatch( olevariant(FBrowser.ControlInterface).Document);
+ FBrowserDoc.open;
+ FBrowserDoc.charset := 'Shift_JIS';
+end;
+procedure TBufferedWebBrowser.Close;
+begin
+ Self.Flush;
+ try
+ FBrowserDoc.Close;
+ except
+ end;
+ FBrowser := nil;
+end;
+function TBufferedWebBrowser.Add(const S: string): Integer;
+begin
+ Result := inherited Add(TrimRight(s));
+ if (Self.Count > FBuffSize) then begin
+ FBrowserDoc.Write(Self.Text);
+ Self.Clear;
+ end;
+end;
+procedure TBufferedWebBrowser.Flush ;
+begin
+ if (Self.Count > 0) then begin
+ FBrowserDoc.Write(Self.Text);
+ Self.Clear;
+ end;
+end;
+destructor TBufferedWebBrowser.Destory;
+begin
+ try
+ if (FBrowserDoc <> 0) then begin
+ FBrowserDoc.close;
+ FBrowserDoc := 0;
+ end;
+ except
+ end;
+ inherited;
+end;
+//! \8aÖ\98A\83L\81[\83\8f\81[\83h\83\8a\83\93\83N\8fo\97Í
+function THTMLCreate.getKeywordLink(item: TThreadItem): String;
+const
+ PARA_URL = 'http://p2.2ch.io/getf.cgi?';
+begin
+ Result := '';
+ if (GikoSys.Setting.AddKeywordLink) and (item.ParentBoard.Is2ch) then begin
+ Result := '<p><span id="keyword"><a href="' + PARA_URL
+ + item.URL + '" target="_blank">\8aÖ\98A\83L\81[\83\8f\81[\83h</a></span></p>';
+ end;
+end;
initialization
HTMLCreater := THTMLCreate.Create;
finalization
if HTMLCreater <> nil then begin
- HTMLCreater.Free;
- HTMLCreater := nil;
+ FreeAndNil(HTMLCreater);
end;
end.