- if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
- stRes := 0;
- endRes := 0;
- try
- buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
- if buf <> '' then
- stRes := StrToInt64( buf );
- if AnsiPos( '&nofirst=',URL) <> 0 then begin
- buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
- end else begin
- buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- end;
- try
- if buf <> '' then
- endRes := StrToInt64(buf)
- except
- endRes := 0;
- end;
- except
- stRes := 0;
- end;
- if (stRes <> 0) and (endRes = 0) then
- endRes := stRes + MAX_POPUP_RES
- else if (stRes = 0) and (endRes <> 0) then begin
- stRes := endRes - MAX_POPUP_RES;
- if stRes < 1 then
- stRes := 1;
- end;
- GikoSys.GetBrowsableThreadURL( URL );
- end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
- endRes := 0;
- buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- try
- if buf <> '' then
- stRes := StrToInt(buf)
- else begin
- stRes := 0;
- end;
- except
- stRes := 0;
- end;
- end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
- try
- stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
- if AnsiPos( '&nofirst=',URL) <> 0 then begin
- buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
- end else begin
- buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- end;
- try
- if buf <> '' then
- endRes := StrToInt64(buf);
- except
- endRes := 0;
- end;
- except
- stRes := 0;
- end;
- end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
+ for i := 0 to Length(START_NAME) -1 do begin
+ idx := AnsiPos(START_NAME[i], URL);
+ if (idx <> 0) then begin
+ break;
+ end;
+ idx := AnsiPos(END_NAME[i], URL);
+ if (idx <> 0) then begin
+ break;
+ end;
+
+ end;
+
+ if (idx <> 0) then begin
+ idx := AnsiPos('?', URL);
+ if (idx = 0) then begin
+ idx := LastDelimiter('/', URL);
+ end;
+ stRes := 0;
+ endRes := 0;
+ bufList := TStringList.Create();
+ try
+ bufList.Delimiter := '&';
+ bufList.DelimitedText := Copy(URL, idx + 1, Length(URL));
+ for i := 0 to bufList.Count - 1 do begin
+ convBuf := '';
+ // \8aJ\8en\83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if (stRes = 0) then begin
+ for j := 0 to Length(START_NAME) - 1 do begin
+ idx := AnsiPos(START_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(START_NAME[j]), Length(bufList[i]));
+ stRes := StrToInt64Def( convBuf, 0 );
+ break;
+ end;
+ end;
+ end;
+ // \8fI\97¹\83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if (convBuf = '') and (endRes = 0) then begin
+ for j := 0 to Length(END_NAME) - 1 do begin
+ idx := AnsiPos(END_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(END_NAME[j]), Length(bufList[i]));
+ endRes := StrToInt64Def( convBuf, 0 );
+ break;
+ end;
+ end;
+ end;
+ // \83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if ((stRes = 0) and (endRes = 0) and (convBuf = '')) then begin
+ for j := 0 to Length(RES_NAME) - 1 do begin
+ idx := AnsiPos(RES_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(RES_NAME[j]), Length(bufList[i]));
+ stRes := StrToInt64Def( convBuf, 0 );
+ endRes := stRes;
+ break;
+ end;
+ end;
+ end;
+ end;
+
+ if (stRes <> 0) and (endRes = 0) then begin
+ endRes := stRes + MAX_POPUP_RES;
+ end else if (stRes = 0) and (endRes <> 0) then begin
+ stRes := endRes - MAX_POPUP_RES;
+ if stRes < 1 then begin
+ stRes := 1;
+ end;
+ end;
+ finally
+ bufList.clear;
+ bufList.free;
+ end;
+ end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin