end else begin
URL := Text;
- if Pos('about:blank..', URL) = 1 then
+ if Pos('about:blank..', URL) = 1 then begin
URL := StringReplace( URL, 'about:blank..', 'http://www.2ch.net', [] );
+ PathRec := Gikosys.Parse2chURL2(URL);
+ end else begin
+ PathRec := Gikosys.Parse2chURL2(URL);
+ if (AnsiPos('=st=', Text ) <> 0) and ( AnsiPos( '=to=',Text) <> 0 ) then begin
+ try
+ PathRec.FSt := StrToInt( Copy( Text, AnsiPos('=st=', Text ) + 4, AnsiPos( '=to=',Text) - AnsiPos('=st=', Text ) - 4 ) );
+ PathRec.FTo := StrToInt( Copy( Text, AnsiPos('=to=', Text ) + 4, AnsiPos( '=nofirst=',Text) - AnsiPos('=to=', Text ) - 4) );
+ except
+ PathRec.FSt := 0;
+ PathRec.FTo := 0;
+ end;
+ end;
+ end;
- PathRec := Gikosys.Parse2chURL2(URL);
GikoSys.ParseURI( URL, Protocol, Host, Path, Document, Port, Bookmark );
- if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
+ //if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
URL := GikoSys.GetBrowsableThreadURL( URL );
-
- wkIntSt := PathRec.FSt;
- wkIntTo := PathRec.FTo;
+ wkIntSt := PathRec.FSt;
+ wkIntTo := PathRec.FTo;
if (wkIntSt = 0) and (wkIntTo = 0) then begin
wkIntSt := 1;
SetResPopupText( threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
end;
end;
- end;
+ //end;
//if s <> '' then
// ShowTextPopup(s);
function DeleteLink(const s: string): string;
function GetShortName(const LongName: string; ALength: integer): string;
- function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string): string;
+ function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string): string; overload;
+ function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
function ZenToHan(const s: string): string;
function VaguePos(const Substr, S: string): Integer;
FAWKStr.Free;
FSetting.Free;
FDolib.Free;
- FAbon.Free;
- FSelectResFilter.Free;
+ FAbon.Free;
+ FSelectResFilter.Free;
//\83e\83\93\83|\83\89\83\8aHTML\82ð\8dí\8f\9c
FileList := TStringList.Create;
try
No := IntToStr(i + 1);
Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
-
if Res.FType = glt2chOld then begin
Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
end;
Res.FBody := AddAnchorTag(Res.FBody);
+ Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true',ThreadItem.URL);
+
if Res.FName = '' then
Res.FName := ' ';
SaveList.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;
Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- Res.FBody := AddAnchorTag(Res.FBody);
+ Res.FBody := AddAnchorTag(Res.FBody);
+ Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true',ThreadItem.URL);
+
if Res.FName = '' then
Res.FName := ' ';
if Res.FMailTo = '' then
SaveList.Add('<dl>');
end;
Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
if Res.FType = glt2chOld then begin
Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
end;
Res.FBody := AddAnchorTag(Res.FBody);
+ Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true',ThreadItem.URL);
if Res.FMailTo = '' then
SaveList.Add('<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
Result := r;
end;
+function TGikoSys.ConvRes(
+ const Body, Bbs, Key, ParamBBS, ParamKey,
+ ParamStart, ParamTo, ParamNoFirst,
+ ParamTrue, FullURL : string
+): string;
+type
+ PIndex = ^TIndex;
+ TIndex = record
+ FIndexFrom : integer;
+ FIndexTo : integer;
+ FNo : string;
+ end;
+const
+ GT = '>';
+ SN = '0123456789-';
+ ZN = '\82O\82P\82Q\82R\82S\82T\82U\82V\82W\82X\81|';
+var
+ i : integer;
+ s,r : string;
+ b : TMbcsByteType;
+ sw: boolean;
+ sp: integer;
+ No: string;
+ sx: string;
+ List: TList;
+ oc : string;
+ st, et: string;
+ chk : boolean;
+ al : boolean;
+ procedure Add(IndexFrom, IndexTo: integer; const No: string);
+ var
+ FIndex : PIndex;
+ begin
+ New(FIndex);
+ FIndex.FIndexFrom := IndexFrom;
+ FIndex.FIndexTo := IndexTo;
+ FIndex.FNo := No;
+ List.Add(FIndex);
+ end;
+ function ChooseString(const Text, Separator: string; Index: integer): string;
+ var
+ S : string;
+ i, p : integer;
+ begin
+ S := Text;
+ for i := 0 to Index - 1 do begin
+ if (AnsiPos(Separator, S) = 0) then S := ''
+ else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
+ end;
+ p := AnsiPos(Separator, S);
+ if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
+ end;
+begin
+ { v1.0 b2 - 03 }
+ s := Body;
+ r := Body;
+ i := 1;
+ sw := False;
+ No := '';
+ List:= TList.Create;
+ oc := '';
+ sp := 0;
+ chk := False;
+ al := False;
+ while true do begin
+ b := ByteType(s, i);
+ case b of
+ mbSingleByte : begin
+ if (not sw) and (Copy(s,i,8) = GT + GT) then begin
+ if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
+ sw := True;
+ sp := i;
+ i := i + 7;
+ oc:='';
+ chk := True;
+ end;
+ end else
+ if (not sw) and (Copy(s,i,8) = GT + GT) then begin
+ if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
+ i := i + 7;
+ oc:='';
+ chk := True;
+ end;
+ end else
+ if (not sw) and (Copy(s,i,4) = GT) then begin
+ if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
+ sw := True;
+ sp := i;
+ i := i + 3;
+ oc:='';
+ chk := True;
+ end;
+ end else
+ if ((not sw) and (Copy(s,i,1) = ',')) or
+ ((not sw) and (Copy(s,i,1) = '=')) then begin
+ if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
+ ((Chk) and (oc = '')) or
+ ((not Chk) and (al)) then
+ begin
+ sw := True;
+ sp := i;
+ //i := i + 1;
+ oc:='';
+ end;
+ end else
+ if (sw) then begin
+ sx := Copy(s,i,1);
+ if (AnsiPos(sx, SN) > 0) then begin
+ No := No + sx;
+ end else begin
+ if (No <> '') and (No <> '-') then begin
+ Add(sp, i, No);
+ al := True;
+ end;
+ sw := False;
+ //
+ i := i - 1;
+ //
+ No := '';
+ oc:='';
+ //chk := False;
+ end;
+ end else begin
+ if Copy(s,i,1) = '<' then oc := '';
+ oc := oc + Copy(s,i,1);
+ chk := False;
+ al := False;
+ end;
+ end;
+ mbLeadByte : begin
+ if (not sw) and (Copy(s,i,4) = '\81\84\81\84') then begin
+ sw := True;
+ sp := i;
+ i := i + 3;
+ chk := True;
+ end else
+ if (not sw) and (Copy(s,i,2) = '\81\84') then begin
+ sw := True;
+ sp := i;
+ i := i + 1;
+ chk := True;
+ end else
+ if (sw) then begin
+ sx := Copy(s,i,2);
+ if (AnsiPos(sx, ZN) > 0) then begin
+ No := No + ZenToHan(sx);
+ end else begin
+ if (No <> '') and (No <> '-') and (No <> '\81|') then begin
+ Add(sp, i, No);
+ end;
+ sw := False;
+ i := i - 1;
+ No := '';
+ end;
+ end else begin
+ oc := '';
+ chk := False;
+ end;
+ al := False;
+ end;
+ end;
+ inc(i);
+ if (i > Length(Body)) then begin
+ if (sw) then begin
+ if (No <> '') then Add(sp, i, No);
+ end;
+ Break;
+ end;
+ end;
+ for i := List.Count - 1 downto 0 do begin
+ //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
+ if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
+ st := ChooseString(PIndex(List[i]).FNo, '-', 0);
+ et := ChooseString(PIndex(List[i]).FNo, '-', 1);
+ end else begin
+ st := PIndex(List[i]).FNo;
+ et := PIndex(List[i]).FNo;
+ end;
+ r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
+ Format('<a href="%s=%s=%s=%s=%s=%s=%s" target="_blank">',
+ [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
+ Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
+ Copy(r,PIndex(List[i]).FIndexTo,Length(r));
+ Dispose(PIndex(List[i]));
+ end;
+ List.Free;
+ Result := r;
+end;
+
(*************************************************************************
* \91S\8ap\81¨\94¼\8ap
* from HotZonu