diff --git a/README.RU.md b/README.RU.md
index a354526..2608504 100644
--- a/README.RU.md
+++ b/README.RU.md
@@ -14,6 +14,10 @@
2. Измените название, параметры окна, UserAgent, ссылку и так далее, прокси, в конфигурационном файле `Config.ini`.
3. Измените иконку, с помощью [Resource Hacker](http://www.angusj.com/resourcehacker/).
+## Режим отладки
+Для быстрой отладки можно включить специальный режим, в котором доступно: изменение размеров, изменение User agent, очистка всех данных. Для включения измените параметр `Debug` на `1`.
+[![](https://github.com/user-attachments/assets/cae19d08-4951-44bf-8278-2edcf076eb75)](https://github.com/user-attachments/assets/5d2eafc3-2825-48c3-bc82-718ca471549d)
+
## Загрузка
>Версия для Windows 10, 11.
diff --git a/README.md b/README.md
index bdb79ce..5bea44e 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
← Choose language | Выберите язык
# ProtonShell
-Lightweight shell for websites, simple web applications, built on the Microsoft Edge system browser. Based on it you can make a separate window for Google Docs, ChatGPT, Twitch chat, Instagram client for PC, with js userscript or some web application in its own window.
+Lightweight shell for websites, simple web applications, built on the Microsoft Edge system browser. Based on it you can make a self window for Google Docs, ChatGPT, Twitch chat, Instagram client for PC, with js userscript or some web application in its own window.
## Screenshots
![](https://github.com/user-attachments/assets/902b2e58-664d-460f-abfd-37de3c8c920b)
@@ -16,6 +16,10 @@ Lightweight shell for websites, simple web applications, built on the Microsoft
2. Change the name, window parameters, UserAgent, link and so on, proxy, in the `Config.ini` configuration file.
3. Change the icon with [Resource Hacker](http://www.angusj.com/resourcehacker/).
+## Debug mode
+For fast debugging you can enable a special mode in which the following is available: resizing, changing User agent, clearing all data. To enable it, change the `Debug` parameter to `1`.
+[![](https://github.com/user-attachments/assets/c71837e8-9097-438f-8e15-93efc42b65d3)](https://github.com/user-attachments/assets/e2e88215-3e52-46dd-b24a-42eb6bfdc3e7)
+
## Download
>Version for Windows 10, 11.
diff --git a/Source/Config.ini b/Source/Config.ini
index 8fe38a7..90e63df 100644
--- a/Source/Config.ini
+++ b/Source/Config.ini
@@ -12,11 +12,13 @@ UserScript=
SystemProxy=
# Return to previous system proxy after closing the app (if you use proxy), 1 - on, 0 - off
ReturnPreviousProxy=0
+# Debug menu, 1 - on, 0 - off
+Debug=0
[Window]
Title=Test App
IconPath=
-Width=720
+Width=640
Height=480
SaveSize=0
diff --git a/Source/DevicesList.txt b/Source/DevicesList.txt
new file mode 100644
index 0000000..978e30b
--- /dev/null
+++ b/Source/DevicesList.txt
@@ -0,0 +1,15 @@
+Default (640x480)
+Galaxy S4 (1080x1920)
+Galaxy S20/S21 (1440x3200)
+Galaxy Note 10/20 (1440x3040)
+Pixel 4/5 (1080x2280)
+Pixel 6/7 (1080x2400)
+OnePlus 8/9 (1080x2400)
+iPhone 5/5S/SE (320x568)
+iPhone 6/6S/7/8 (750x1334)
+iPhone X/XS/11 Pro (1125x2436)
+iPhone 11/11 Pro Max/12/12 Pro (1284x2778)
+iPad 1/2 (768x1024)
+iPad Mini (768x1024)
+iPad Pro 11 (834x1194)
+iPad Pro 12.9 (1648x2368)
\ No newline at end of file
diff --git a/Source/Unit1.dfm b/Source/Unit1.dfm
index ef402f7..051725c 100644
--- a/Source/Unit1.dfm
+++ b/Source/Unit1.dfm
@@ -14,19 +14,193 @@ object Main: TMain
OnClose = FormClose
OnCreate = FormCreate
OnDestroy = FormDestroy
+ OnResize = FormResize
TextHeight = 13
object EdgeBrowser: TEdgeBrowser
Left = 0
- Top = 0
+ Top = 113
Width = 640
- Height = 480
+ Height = 367
Align = alClient
TabOrder = 0
UserDataFolder = '%LOCALAPPDATA%\bds.exe.WebView2'
OnCreateWebViewCompleted = EdgeBrowserCreateWebViewCompleted
OnNavigationCompleted = EdgeBrowserNavigationCompleted
OnNewWindowRequested = EdgeBrowserNewWindowRequested
- ExplicitWidth = 624
- ExplicitHeight = 476
+ ExplicitTop = 0
+ ExplicitWidth = 636
+ ExplicitHeight = 479
+ end
+ object DebugPanel: TPanel
+ Left = 0
+ Top = 0
+ Width = 640
+ Height = 113
+ Align = alTop
+ TabOrder = 1
+ Visible = False
+ object ResolutionLbl: TLabel
+ Left = 9
+ Top = 93
+ Width = 75
+ Height = 13
+ Caption = 'Resolution: 0x0'
+ end
+ object LeftBtn: TButton
+ Left = 7
+ Top = 7
+ Width = 25
+ Height = 25
+ Caption = #8592
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ TabOrder = 0
+ OnClick = LeftBtnClick
+ end
+ object RightBtn: TButton
+ Left = 37
+ Top = 7
+ Width = 25
+ Height = 25
+ Caption = #8594
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ TabOrder = 1
+ OnClick = RightBtnClick
+ end
+ object RefreshBtn: TButton
+ Left = 67
+ Top = 7
+ Width = 25
+ Height = 25
+ Caption = #8635
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ TabOrder = 2
+ OnClick = RefreshBtnClick
+ end
+ object ClearBtn: TButton
+ Left = 127
+ Top = 7
+ Width = 25
+ Height = 25
+ Caption = #55357#56785#65039
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ ParentShowHint = False
+ ShowHint = True
+ TabOrder = 4
+ OnClick = ClearBtnClick
+ end
+ object HomeBtn: TButton
+ Left = 97
+ Top = 7
+ Width = 25
+ Height = 25
+ Caption = #55356#57312
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ ParentShowHint = False
+ ShowHint = False
+ TabOrder = 3
+ OnClick = HomeBtnClick
+ end
+ object DevicesCB: TComboBox
+ Left = 8
+ Top = 38
+ Width = 212
+ Height = 21
+ Style = csDropDownList
+ ParentShowHint = False
+ ShowHint = True
+ TabOrder = 5
+ OnChange = DevicesCBChange
+ end
+ object SetDeviceBtn: TButton
+ Left = 226
+ Top = 7
+ Width = 25
+ Height = 25
+ Caption = #55357#56561
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ ParentFont = False
+ ParentShowHint = False
+ ShowHint = True
+ TabOrder = 6
+ OnClick = SetDeviceBtnClick
+ end
+ object RotateDeviceBtn: TButton
+ Left = 256
+ Top = 7
+ Width = 25
+ Height = 25
+ Caption = #8634
+ ParentShowHint = False
+ ShowHint = True
+ TabOrder = 7
+ OnClick = RotateDeviceBtnClick
+ end
+ object UserAgentsCB: TComboBox
+ Left = 8
+ Top = 66
+ Width = 272
+ Height = 21
+ Style = csDropDownList
+ ItemIndex = 0
+ ParentShowHint = False
+ ShowHint = True
+ TabOrder = 8
+ Text = 'Default User Agent'
+ OnChange = UserAgentsCBChange
+ Items.Strings = (
+ 'Default User Agent')
+ end
+ object ZoomCB: TComboBox
+ Left = 227
+ Top = 38
+ Width = 53
+ Height = 21
+ Style = csDropDownList
+ ItemIndex = 7
+ TabOrder = 9
+ Text = '100%'
+ Items.Strings = (
+ '30%'
+ '40%'
+ '50%'
+ '60%'
+ '70%'
+ '80%'
+ '90%'
+ '100%'
+ '125%'
+ '150%'
+ '175%'
+ '200%')
+ end
end
end
diff --git a/Source/Unit1.pas b/Source/Unit1.pas
index 0a759ad..a16a534 100644
--- a/Source/Unit1.pas
+++ b/Source/Unit1.pas
@@ -5,7 +5,7 @@ interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, WebView2, Winapi.ActiveX, Vcl.Edge, IniFiles, ShellAPI,
- Registry, WinInet;
+ Registry, WinInet, Vcl.StdCtrls, Vcl.ExtCtrls;
const // https://stackoverflow.com/questions/66692031/how-to-set-useragent-in-new-delphi-tedgebrowser
IID_ICoreWebView2Settings2: TGUID = '{EE9A0F68-F46C-4E32-AC23-EF8CAC224D2A}';
@@ -20,6 +20,18 @@ interface
type
TMain = class(TForm)
EdgeBrowser: TEdgeBrowser;
+ DebugPanel: TPanel;
+ LeftBtn: TButton;
+ RightBtn: TButton;
+ RefreshBtn: TButton;
+ ClearBtn: TButton;
+ HomeBtn: TButton;
+ DevicesCB: TComboBox;
+ SetDeviceBtn: TButton;
+ ResolutionLbl: TLabel;
+ RotateDeviceBtn: TButton;
+ UserAgentsCB: TComboBox;
+ ZoomCB: TComboBox;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure EdgeBrowserCreateWebViewCompleted(Sender: TCustomEdgeBrowser;
@@ -29,6 +41,16 @@ TMain = class(TForm)
procedure EdgeBrowserNavigationCompleted(Sender: TCustomEdgeBrowser;
IsSuccess: Boolean; WebErrorStatus: TOleEnum);
procedure FormDestroy(Sender: TObject);
+ procedure LeftBtnClick(Sender: TObject);
+ procedure RightBtnClick(Sender: TObject);
+ procedure RefreshBtnClick(Sender: TObject);
+ procedure HomeBtnClick(Sender: TObject);
+ procedure ClearBtnClick(Sender: TObject);
+ procedure SetDeviceBtnClick(Sender: TObject);
+ procedure FormResize(Sender: TObject);
+ procedure RotateDeviceBtnClick(Sender: TObject);
+ procedure UserAgentsCBChange(Sender: TObject);
+ procedure DevicesCBChange(Sender: TObject);
private
{ Private declarations }
public
@@ -38,27 +60,71 @@ TMain = class(TForm)
var
Main: TMain;
WinOldWidth, WinOldHeight, WinOldTop, WinOldLeft: integer;
- WinSaveSize, WinSavePos, ReturnPrevSystemProxy: boolean;
- EdgeUserAgent, SystemProxy, PrevSystemProxy: string;
+ WinSaveSize, WinSavePos, ReturnPrevSystemProxy, UserAgentsCBChanged: boolean;
+ MainURL, EdgeUserAgent, NewUserAgent, SystemProxy, PrevSystemProxy: string;
OpenExternalLinks, LoadUserScript: boolean;
UserScriptFile: TStringList;
+ IDS_CONFIRM_DELETE_ALL_DATA, IDS_RESOLUTION: string;
+
implementation
{$R *.dfm}
+procedure TMain.ClearBtnClick(Sender: TObject);
+var
+ ScriptStr: string;
+begin
+ case MessageBox(Handle, PChar(IDS_CONFIRM_DELETE_ALL_DATA), PChar(Caption), 35) of
+ 7: Exit;
+ 2: Exit;
+ end;
+
+ ScriptStr:=
+ 'localStorage.clear();' + sLineBreak +
+
+ 'sessionStorage.clear();' + sLineBreak +
+
+ // Cookie
+ 'document.cookie.split(";").forEach(function(cookie) {' + sLineBreak +
+ ' document.cookie = cookie.split("=")[0] + "=;expires=" + new Date(0).toUTCString() + ";path=/";' + sLineBreak +
+ '});' + sLineBreak +
+
+ // IndexedDB
+ 'indexedDB.databases().then(function(databases) {' + sLineBreak +
+ ' databases.forEach(function(db) {' + sLineBreak +
+ ' indexedDB.deleteDatabase(db.name);' + sLineBreak +
+ ' });' + sLineBreak +
+ '});' + sLineBreak +
+
+ // PWA
+ 'caches.keys().then(function(names) {' + sLineBreak +
+ ' for (let name of names) caches.delete(name);' + sLineBreak +
+ '});' + sLineBreak +
+ 'window.location.reload();';
+
+ EdgeBrowser.ExecuteScript(ScriptStr);
+end;
+
+procedure TMain.DevicesCBChange(Sender: TObject);
+begin
+ if DevicesCB.ItemIndex = -1 then Exit;
+ DevicesCB.Hint:=DevicesCB.Items.Strings[DevicesCB.ItemIndex];
+end;
+
procedure TMain.EdgeBrowserCreateWebViewCompleted(Sender: TCustomEdgeBrowser;
AResult: HRESULT);
var
WebViewSettings: ICoreWebView2Settings2;
- //HR: HRESULT;
begin
- if Trim(EdgeUserAgent) = '' then Exit;
+ if Trim(NewUserAgent) = '' then Exit;
// You must query SettingsInterface2 from SettingsInterface it's important
Sender.SettingsInterface.QueryInterface(IID_ICoreWebView2Settings2, WebViewSettings);
if not Assigned(WebViewSettings) then
raise Exception.Create('ICoreWebView2Settings2 not found');
- WebViewSettings.Set_UserAgent(PWideChar(EdgeUserAgent));
+
+ WebViewSettings.Set_UserAgent(PWideChar(NewUserAgent));
+
//HR := WebViewSettings.Get_UserAgent(PWideChar(EdgeUserAgent));
//if not SUCCEEDED(HR) then
//raise Exception.Create('Get_UserAgent failed');
@@ -66,9 +132,32 @@ procedure TMain.EdgeBrowserCreateWebViewCompleted(Sender: TCustomEdgeBrowser;
procedure TMain.EdgeBrowserNavigationCompleted(Sender: TCustomEdgeBrowser;
IsSuccess: Boolean; WebErrorStatus: TOleEnum);
+var
+ WebViewSettings: ICoreWebView2Settings2;
+ EdgeUserAgentTemp: string;
+ UAPosDots: integer;
begin
if UserScriptFile.Text <> '' then
EdgeBrowser.ExecuteScript(UserScriptFile.Text);
+
+ // Debuge mode User Agents
+ if (DebugPanel.Visible = false) or (UserAgentsCBChanged = false) then Exit;
+ UserAgentsCBChanged:=false;
+
+ Sender.SettingsInterface.QueryInterface(IID_ICoreWebView2Settings2, WebViewSettings);
+
+ if not Assigned(WebViewSettings) then
+ raise Exception.Create('ICoreWebView2Settings2 not found');
+
+ if UserAgentsCB.ItemIndex < 1 then
+ WebViewSettings.Set_UserAgent(PWideChar(EdgeUserAgent))
+ else begin
+ EdgeUserAgentTemp:=UserAgentsCB.Items.Strings[UserAgentsCB.ItemIndex];
+ UAPosDots:=Pos(':', EdgeUserAgentTemp);
+ if UAPosDots <> 0 then
+ Delete(EdgeUserAgentTemp, 1, UAPosDots);
+ WebViewSettings.Set_UserAgent(PWideChar(Trim(EdgeUserAgentTemp)));
+ end;
end;
procedure TMain.EdgeBrowserNewWindowRequested(Sender: TCustomEdgeBrowser;
@@ -136,10 +225,10 @@ procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction);
Ini: TIniFile;
begin
if (WinSaveSize) and (WindowState <> wsMaximized) then
- if (WinOldWidth <> Width) or (WinOldHeight <> Height) then begin
+ if (WinOldWidth <> ClientWidth) or (WinOldHeight <> ClientHeight) then begin
Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
- Ini.WriteInteger('Window', 'Width', Width);
- Ini.WriteInteger('Window', 'Height', Height);
+ Ini.WriteInteger('Window', 'Width', ClientWidth);
+ Ini.WriteInteger('Window', 'Height', ClientHeight);
Ini.Free;
end;
@@ -153,13 +242,39 @@ procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction);
UserScriptFile.Free;
end;
-procedure TMain.FormCreate(Sender: TObject);
+procedure WindowToCenter;
+var
+ ScreenCenter: TPoint;
+ ScreenTop: Integer;
+begin
+ with Screen.MonitorFromWindow(Main.Handle).WorkareaRect do begin
+ ScreenCenter:=Point(Left + Width div 2, Top + Height div 2);
+ ScreenTop:=Top;
+ end;
+
+ Main.Top:=ScreenCenter.Y - Main.Height div 2;
+ if Main.Top < ScreenTop then Main.Top:=ScreenTop;
+
+ Main.Left:=ScreenCenter.X - Main.Width div 2;
+end;
+
+function GetLocaleInformation(Flag: integer): string;
var
- Ini: TIniFile; URL, LocalFile, FulllPath, UserScriptPath, IconPath: string;
+ pcLCA: array [0..20] of Char;
begin
- EdgeBrowser.UserDataFolder:=ExtractFilePath(ParamStr(0)) + 'Data';
+ if GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, Flag, pcLCA, 19) <= 0 then
+ pcLCA[0]:=#0;
+ Result:=pcLCA;
+end;
+procedure TMain.FormCreate(Sender: TObject);
+var
+ Ini: TIniFile; LocalFile, FulllPath, UserScriptPath, IconPath: string;
+begin
FulllPath:=ExtractFilePath(ParamStr(0));
+
+ EdgeBrowser.UserDataFolder:=FulllPath + 'Data';
+
Ini:=TIniFile.Create(FulllPath + 'Config.ini');
LocalFile:=Trim(Ini.ReadString('Main', 'File', ''));
@@ -167,7 +282,7 @@ procedure TMain.FormCreate(Sender: TObject);
if (LocalFile <> '') and (Length(LocalFile) > 1) and (LocalFile[2] <> ':') then
LocalFile:=FulllPath + LocalFile;
- EdgeUserAgent:=Ini.ReadString('Main', 'UserAgent', '');
+ NewUserAgent:=Ini.ReadString('Main', 'UserAgent', '');
OpenExternalLinks:=Ini.ReadBool('Main', 'OpenExternalLinks', false);
UserScriptPath:=Ini.ReadString('Main', 'UserScript', '');
UserScriptFile:=TStringList.Create;
@@ -175,27 +290,28 @@ procedure TMain.FormCreate(Sender: TObject);
UserScriptFile.LoadFromFile(UserScriptPath, TEncoding.UTF8);
if LocalFile <> '' then
- URL:=LocalFile
+ MainURL:=LocalFile
else
- URL:=Ini.ReadString('Main', 'URL', '');
+ MainURL:=Ini.ReadString('Main', 'URL', '');
- EdgeBrowser.Navigate(URL);
+ EdgeBrowser.Navigate(MainURL);
// Windows sizes
- Width:=Ini.ReadInteger('Window', 'Width', Width);
- Height:=Ini.ReadInteger('Window', 'Height', Height);
+ ClientWidth:=Ini.ReadInteger('Window', 'Width', ClientWidth);
+ ClientHeight:=Ini.ReadInteger('Window', 'Height', ClientHeight);
WinSaveSize:=Ini.ReadBool('Window', 'SaveSize', false);
- WinOldWidth:=Width;
- WinOldHeight:=Height;
+ WinOldWidth:=ClientWidth;
+ WinOldHeight:=ClientHeight;
// Windows position
if (Trim(Ini.ReadString('Window', 'Top', '')) <> '') and (Trim(Ini.ReadString('Window', 'Left', '')) <> '') then begin
Main.Top:=Ini.ReadInteger('Window', 'Top', Top);
Main.Left:=Ini.ReadInteger('Window', 'Left', Left);
- end else begin
- Main.Top:=Screen.Height div 2 - Height div 2; // Main.Position - Some problems with Edge
- Main.Left:=Screen.Width div 2 - Width div 2;
- end;
+ end else// begin
+ WindowToCenter;
+ //Main.Top:=Screen.Height div 2 - Height div 2; // Main.Position - Some problems with Edge
+ //Main.Left:=Screen.Width div 2 - Width div 2;
+ //end;
WinSavePos:=Ini.ReadBool('Window', 'SavePos', false);
WinOldTop:=Top;
WinOldLeft:=Left;
@@ -236,7 +352,39 @@ procedure TMain.FormCreate(Sender: TObject);
ProxyActivate(true);
end;
+ if Ini.ReadBool('Main', 'Debug', false) then begin
+ DebugPanel.Visible:=true;
+ ClientHeight:=ClientHeight + DebugPanel.Height;
+ Top:=Top - DebugPanel.Height div 2;
+ if FileExists(FulllPath + 'DevicesList.txt') then begin
+ DevicesCB.Items.LoadFromFile(FulllPath + 'DevicesList.txt', TEncoding.UTF8);
+ if DevicesCB.Items.Count > 0 then
+ DevicesCB.ItemIndex:=0;
+ end;
+ if FileExists(FulllPath + 'UserAgentsList.txt') then begin
+ UserAgentsCB.Items.LoadFromFile(FulllPath + 'UserAgentsList.txt', TEncoding.UTF8);
+ if UserAgentsCB.Items.Count > 0 then
+ UserAgentsCB.ItemIndex:=0;
+ end;
+ end;
+
Ini.Free;
+
+ if GetLocaleInformation(LOCALE_SENGLANGUAGE) = 'Russian' then begin
+ IDS_CONFIRM_DELETE_ALL_DATA:=' ?';
+ IDS_RESOLUTION:=': ';
+ ClearBtn.Hint:=' ';
+ SetDeviceBtn.Hint:=' ';
+ RotateDeviceBtn.Hint:=' ';
+ end else begin
+ IDS_CONFIRM_DELETE_ALL_DATA:='Are you sure you want to delete all data?';
+ IDS_RESOLUTION:='Resolution: ';
+ ClearBtn.Hint:='Deleting all data';
+ SetDeviceBtn.Hint:='Change device';
+ RotateDeviceBtn.Hint:='Rotate the device';
+ end;
+
+ EdgeUserAgent:='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0';
end;
procedure TMain.FormDestroy(Sender: TObject);
@@ -248,4 +396,70 @@ procedure TMain.FormDestroy(Sender: TObject);
ProxyActivate(false);
end;
+procedure TMain.FormResize(Sender: TObject);
+begin
+ ResolutionLbl.Caption:=IDS_RESOLUTION + IntToStr(EdgeBrowser.Width) + 'x' + IntToStr(EdgeBrowser.Height);
+end;
+
+procedure TMain.HomeBtnClick(Sender: TObject);
+begin
+ EdgeBrowser.Navigate(MainURL);
+end;
+
+procedure TMain.LeftBtnClick(Sender: TObject);
+begin
+ EdgeBrowser.GoBack;
+end;
+
+procedure TMain.RefreshBtnClick(Sender: TObject);
+begin
+ EdgeBrowser.Refresh;
+end;
+
+procedure TMain.RightBtnClick(Sender: TObject);
+begin
+ EdgeBrowser.GoForward;
+end;
+
+procedure TMain.RotateDeviceBtnClick(Sender: TObject);
+var
+ TempWidth: integer;
+begin
+ if WindowState = wsMaximized then Exit;
+ TempWidth:=Main.ClientWidth;
+ Main.ClientWidth:=Main.ClientHeight - DebugPanel.Height;
+ Main.ClientHeight:=TempWidth + DebugPanel.Height;
+ WindowToCenter;
+end;
+
+procedure TMain.SetDeviceBtnClick(Sender: TObject);
+var
+ ResolutionStr: string; ZoomValue: real;
+begin
+ if DevicesCB.ItemIndex = -1 then Exit;
+
+ if WindowState = wsMaximized then
+ WindowState:=wsNormal;
+
+ ZoomValue:=StrToIntDef(Copy(ZoomCB.Items.Strings[ZoomCB.ItemIndex], 1, Length(ZoomCB.Items.Strings[ZoomCB.ItemIndex]) - 1), 100) * 0.01;
+
+ ResolutionStr:=DevicesCB.Items[DevicesCB.ItemIndex];
+ ResolutionStr:=Copy(ResolutionStr, Pos('(', ResolutionStr) + 1, Length(ResolutionStr));
+ ResolutionStr:=Copy(ResolutionStr, 1, Pos(')', ResolutionStr) - 1);
+
+ ClientWidth:=Trunc(StrToIntDef(Copy(ResolutionStr, 1, Pos('x', ResolutionStr) - 1), 640) * ZoomValue);
+ ClientHeight:=Trunc((StrToIntDef(Copy(ResolutionStr, Pos('x', ResolutionStr) + 1, Length(ResolutionStr)), 480) + DebugPanel.Height) * ZoomValue);
+
+ WindowToCenter;
+end;
+
+procedure TMain.UserAgentsCBChange(Sender: TObject);
+begin
+ if UserAgentsCB.ItemIndex = -1 then Exit;
+ UserAgentsCBChanged:=true;
+ UserAgentsCB.Hint:=UserAgentsCB.Items.Strings[UserAgentsCB.ItemIndex];
+ Sleep(15);
+ EdgeBrowser.Refresh;
+end;
+
end.
diff --git a/Source/UserAgentsList.txt b/Source/UserAgentsList.txt
new file mode 100644
index 0000000..eab7946
--- /dev/null
+++ b/Source/UserAgentsList.txt
@@ -0,0 +1,5 @@
+Default User Agent
+Android (Chrome): Mozilla/5.0 (Linux; Android 13; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.113 Mobile Safari/537.36
+iPhone (Safari): Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/605.1.15
+iPad (Firefox): Mozilla/5.0 (iPad; CPU OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/128.0 Mobile/15E148 Safari/605.1.15
+Windows (Chrome): Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36