procedure TForm2.BrowserBeforeNavigate2(Sender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
begin try //com point
_log_entry('Starts URL validate procedure and set process levels...');
_log_entry(URL);
SetThreadPriority(GetCurrentThread,THREAD_PRIORITY_TIME_CRITICAL);
if is_error_page(URL) then begin
Cancel := true;
_log_entry('Produce error page : '+URL);
case Notebook1.PageIndex of
0:begin
if wikipedia_console.Busy then wikipedia_console.Stop;
wikipedia_console.Go(root+'Support\nopage.htm');
exit;
end;
2:begin
if wikimedia_console.Busy then wikimedia_console.Stop;
wikimedia_console.Go(root+'Support\nopage.htm');
exit;
end;
3:begin
if wikidict_console.Busy then wikidict_console.Stop;
wikidict_console.Go(root+'Support\nopage.htm');
exit;
end;
5:begin
if wikibooks_console.Busy then wikibooks_console.Stop;
wikibooks_console.Go(root+'Support\nopage.htm');
exit;
end;
6:begin
if wikinews_console.Busy then wikinews_console.Stop;
wikinews_console.Go(root+'Support\nopage.htm');
exit;
end;
7:begin
if Wikiquote_console.Busy then Wikiquote_console.Stop;
Wikiquote_console.Go(root+'Support\nopage.htm');
exit;
end;
8:begin
if wikisource_console.Busy then wikisource_console.Stop;
wikisource_console.Go(root+'Support\nopage.htm');
exit;
end;
9:begin
if wikispices_console.Busy then wikispices_console.Stop;
wikispices_console.Go(root+'Support\nopage.htm');
exit;
end;
end;
end;
if is_internal_cmd(URL) then Cancel:=true;
if is_downloadable_type(URL) then begin
Cancel:=true;
form10:=TForm10.Create(nil);
form10.anim1.FileName :=root+'System\dwnindict342.avi';
form10.anim1.Active :=true;
temp___fname:=URL;
StrReplace(temp___fname,'/','\',[rfIgnoreCase, rfReplaceAll]);
form10.Label2.Caption :=ExtractFileName(temp___fname);
form10.Caption :='Complete 0% of '+form10.Label2.Caption;
form10.dwn1.Url :=URL;
form10.dwn1.FileName := compile_path(derive_file_name_to_save(URL));
Form10.Hint:=temp___fname;
form10.Show;
form10.dwn_kick1.Enabled :=true;
exit;
end;
if lowercase(URL)=lowercase(root+'support\nopage.htm') then exit; //if err page ? no more process req !
if get_page_tag(URL)=notebook1.PageIndex then exit
else begin
if get_page_tag(URL)=-1 then begin
if StrFind('javascript:',URL)>0 then exit;
if StrFind('javascript :',URL)>0 then exit;
Cancel:=true;
open_web_page(URL);
end else begin
Cancel:=true;
notebook1.PageIndex :=get_page_tag(URL);
case notebook1.PageIndex of
0: wikipedia_console.Go(String(URL));
2: wikimedia_console.Go(String(URL));
3: wikidict_console.Go(String(URL));
5: wikibooks_console.Go(String(URL));
6: wikinews_console.Go(String(URL));
7: Wikiquote_console.Go(String(URL));
8: wikisource_console.Go(String(URL));
9: wikispices_console.Go(String(URL));
end;
end;
end;
if StrFind('res:/',URL)=1 then begin
Cancel:=true;
exit;
end;
except
on E : Exception do _log_entry_error(E.ClassName,E.Message,'F90000');
end;End; |