You've already forked lazarus-ccr
fpbrowser: Prepares the possibility to have a module which changes the HTML
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1925 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -16,7 +16,7 @@ type
|
||||
ShortDescription: string;
|
||||
Activated: Boolean;
|
||||
constructor Create; virtual;
|
||||
function HandleOnPageLoad(APage: TStream): string; virtual;
|
||||
function HandleOnPageLoad(AInput: string; out AOutput: string): Boolean;
|
||||
end;
|
||||
|
||||
procedure RegisterBrowserModule(AModule: TBrowserModule);
|
||||
@ -52,9 +52,10 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
function TBrowserModule.HandleOnPageLoad(APage: TStream): string;
|
||||
function TBrowserModule.HandleOnPageLoad(AInput: string; out AOutput: string): Boolean;
|
||||
begin
|
||||
|
||||
AOutput := '';
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
@ -5,7 +5,8 @@ unit pageloader;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
Classes, SysUtils,
|
||||
browsermodules;
|
||||
|
||||
type
|
||||
|
||||
@ -54,8 +55,20 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPageLoaderThread.Execute;
|
||||
var
|
||||
lModule: TBrowserModule;
|
||||
lNewContents: string;
|
||||
i: Integer;
|
||||
begin
|
||||
PageLoader.LoadFromURL(URL);
|
||||
|
||||
// Run all modules which might want to change the HTML
|
||||
for i := 0 to GetBrowserModuleCount() - 1 do
|
||||
begin
|
||||
lModule := GetBrowserModule(i);
|
||||
if lModule.HandleOnPageLoad(PageLoader.Contents, lNewContents) then
|
||||
PageLoader.Contents := lNewContents;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPageLoaderThread.CallPageLoadProgress;
|
||||
|
Reference in New Issue
Block a user