Skip to content

Commit

Permalink
2022.5.20 Emergency Publish
Browse files Browse the repository at this point in the history
  • Loading branch information
SLT-World committed May 20, 2022
1 parent af20bd5 commit 44915da
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 230 deletions.
22 changes: 0 additions & 22 deletions SLBr/SLBr/Handlers/JSBindingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,6 @@ public string SearchProviderPrefix()
}
public string SayHello(string name) { return $"Hello {name}!"; }

public void Back()
{
Application.Current.Dispatcher.BeginInvoke(new Action(delegate
{
MainWindow.Instance.Undo();
}));
}
public void Forward()
{
Application.Current.Dispatcher.BeginInvoke(new Action(delegate
{
MainWindow.Instance.Redo();
}));
}
public void Refresh()
{
Application.Current.Dispatcher.BeginInvoke(new Action(delegate
{
MainWindow.Instance.Refresh();
}));
}

public void PromptExample()
{
Prompt("Example Message", "", "");
Expand Down
18 changes: 9 additions & 9 deletions SLBr/SLBr/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Use of this source code is governed by a GNU license that can be found in the LI
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<DockPanel x:Name="ToolBarPanel" Grid.Row="0">
<Menu FontFamily="Segoe MDL2 Assets" Margin="5,0,0,0" Height="23" Width="23" Background="Transparent" BorderBrush="Transparent" Foreground="{DynamicResource ControlFontBrush}" DockPanel.Dock="Left" HorizontalAlignment="Center" VerticalAlignment="Center">
<DockPanel x:Name="ToolBarPanel" Grid.Row="0" Margin="5">
<Menu FontFamily="Segoe MDL2 Assets" Margin="0" Height="23" Width="23" Background="Transparent" BorderBrush="Transparent" Foreground="{DynamicResource ControlFontBrush}" DockPanel.Dock="Left" HorizontalAlignment="Center" VerticalAlignment="Center">
<MenuItem ToolTip="More options" Header="&#xE700;" Height="23" Margin="0,2" Foreground="{DynamicResource ControlFontBrush}" BorderThickness="0">
<MenuItem Header="New Tab" FontFamily="Arial" Click="ButtonAction" Tag="3"/>
<Separator/>
Expand Down Expand Up @@ -199,25 +199,24 @@ Use of this source code is governed by a GNU license that can be found in the LI
<MenuItem Header="About" FontFamily="Arial" Click="ButtonAction" Tag="12&lt;,&gt;slbr://about/"/>
</MenuItem>
</Menu>
<Button Style="{DynamicResource AddButton}" Content="&#xE710;" Margin="0" Height="23" Width="23" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="3" ToolTip="New Tab"/>
<Button x:Name="BackButton" Style="{DynamicResource AddButton}" ToolTip="Back" Content="&#xE72B;" Margin="0" Height="23" Width="23" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="0"/>
<Button x:Name="ForwardButton" Style="{DynamicResource AddButton}" ToolTip="Forward" Content="&#xE72A;" Margin="0" Height="23" Width="23" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="1"/>
<Button x:Name="ReloadButton" Margin="0" Height="23" Width="23" ToolTip="Refresh" Style="{DynamicResource AddButton}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="&#xE72C;" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="2"/>
<Button x:Name="ForwardButton" Style="{DynamicResource AddButton}" ToolTip="Forward" Content="&#xE72A;" Margin="0" Height="23" Width="23" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="1"/>
<Button Style="{DynamicResource AddButton}" Content="&#xE80F;" Margin="0" Height="23" Width="23" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="10" ToolTip="Home"/>
<Button Style="{DynamicResource AddButton}" Content="&#xE710;" Margin="0" Height="23" Width="23" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="3" ToolTip="New Tab"/>
<Button Margin="0" Height="23" Width="23" ToolTip="Add to favourites" x:Name="FavouriteButton" Style="{DynamicResource AddButton}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="&#xEB51;" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="11"/>
<Grid x:Name="SSLGrid" Margin="0" Height="23" Width="23">
<TextBlock x:Name="SSLSymbol" VerticalAlignment="Center" TextAlignment="Center" Text="&#xE72E;" Foreground="{DynamicResource ControlFontBrush}"/>
<Grid.ToolTip>
<ToolTip x:Name="SSLToolTip"/>
</Grid.ToolTip>
</Grid>
<DockPanel DockPanel.Dock="Right" Margin="0,5,5,5">
<DockPanel DockPanel.Dock="Right" Margin="0">
<Border x:Name="ROCNationalDay" Visibility="Collapsed" Tag="12&lt;,&gt;https://www.president.gov.tw/" MouseDown="MiddleButtonAction" ToolTip="Grand National Day of the Republic of China" Margin="0" Height="23" Width="23" Background="#000096" CornerRadius="25">
<Image Source="Resources/Republic_of_China_Star_Only.png" RenderOptions.BitmapScalingMode="HighQuality"/>
</Border>
</DockPanel>
<TextBox DockPanel.Dock="Right" x:Name="FindTextBox" Margin="5,5,0,5" Height="23" Width="200" FontFamily="arial" Padding="0,1,0,0" KeyDown="FindTextBox_KeyDown" ToolTip="Find a specific text in this page"/>
<Menu x:Name="SuggestionsDropdown" DockPanel.Dock="Right" FontFamily="Segoe MDL2 Assets" Margin="5,0,0,0" Height="23" Width="23" Background="Transparent" BorderBrush="Transparent" Foreground="{DynamicResource ControlFontBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox DockPanel.Dock="Right" x:Name="FindTextBox" Margin="5,0,0,0" Height="23" Width="200" FontFamily="arial" Padding="0,1,0,0" KeyDown="FindTextBox_KeyDown" ToolTip="Find a specific text in this page"/>
<Menu x:Name="SuggestionsDropdown" DockPanel.Dock="Right" FontFamily="Segoe MDL2 Assets" Margin="0" Height="23" Width="23" Background="Transparent" BorderBrush="Transparent" Foreground="{DynamicResource ControlFontBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">
<MenuItem ToolTip="Suggestions" Header="&#xEA80;" Height="23" Margin="0,2" Foreground="{DynamicResource ControlFontBrush}" BorderThickness="0">
<MenuItem.ItemsSource>
<CompositeCollection>
Expand All @@ -234,7 +233,8 @@ Use of this source code is governed by a GNU license that can be found in the LI
</MenuItem.ItemContainerStyle>
</MenuItem>
</Menu>
<TextBox x:Name="AddressBox" Margin="5,5,0,5" Height="23" Width="auto" FontFamily="arial" Padding="0,1,0,0" KeyDown="AddressBox_KeyDown" GotFocus="AddressBox_GotFocus" LostFocus="AddressBox_LostFocus" MouseEnter="AddressBox_MouseEnter" MouseLeave="AddressBox_MouseLeave" Tag="Loading..."/>
<Button DockPanel.Dock="Right" Margin="0" Height="23" Width="23" ToolTip="Add to favourites" x:Name="FavouriteButton" Style="{DynamicResource AddButton}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="&#xEB51;" Foreground="{DynamicResource ControlFontBrush}" Click="ButtonAction" Tag="11"/>
<TextBox x:Name="AddressBox" Margin="5,0" Height="23" Width="auto" FontFamily="arial" Padding="0" KeyDown="AddressBox_KeyDown" GotFocus="AddressBox_GotFocus" LostFocus="AddressBox_LostFocus" MouseEnter="AddressBox_MouseEnter" MouseLeave="AddressBox_MouseLeave" Tag="Loading..."/>
</DockPanel>
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0" x:Name="FavouriteContainer" Height="33" Grid.Row="1" HorizontalAlignment="Stretch">
<ScrollViewer x:Name="FavouriteScrollViewer" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden" PreviewMouseWheel="FavouriteScrollViewer_PreviewMouseWheel">
Expand Down
36 changes: 25 additions & 11 deletions SLBr/SLBr/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static string GetScreenshotPath()

string ReleaseYear = "2022";
string ReleaseMonth = "5";
string ReleaseDay = "18";
string ReleaseDay = "20";

bool IsInformationSet;
public string ChromiumVersion;
Expand Down Expand Up @@ -452,11 +452,11 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
if (!MainSave.Has("FavouritesBar"))
MainSave.Set("FavouritesBar", true.ToString());
if (!MainSave.Has("AdBlock"))
AdBlock(IsPrivateMode);
AdBlock(true);
else
AdBlock(bool.Parse(MainSave.Get("AdBlock")));
if (!MainSave.Has("TrackerBlock"))
TrackerBlock(IsPrivateMode);
TrackerBlock(true);
else
TrackerBlock(bool.Parse(MainSave.Get("TrackerBlock")));
if (!MainSave.Has("RenderMode"))
Expand All @@ -467,7 +467,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
{
if (ProcessorID.Contains(Processor))
{
_RenderMode = Processor;
_RenderMode = "Software";
}
}
SetRenderMode(_RenderMode, false);
Expand All @@ -479,7 +479,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
if (!MainSave.Has("DoNotTrack"))
MainSave.Set("DoNotTrack", true.ToString());
if (!MainSave.Has("AutoSuggestions"))
SetAutoSuggestions(false);
SetAutoSuggestions(true);
else
SetAutoSuggestions(bool.Parse(MainSave.Get("AutoSuggestions")));
if (!MainSave.Has("Weblight"))
Expand Down Expand Up @@ -595,6 +595,10 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
GCTimer.Start();
if (!IsIEMode)
{
SuggestionsTimer = new DispatcherTimer();
SuggestionsTimer.Tick += SuggestionsTimer_Tick;
SuggestionsTimer.Interval = new TimeSpan(0, 0, 1);

Inspector = new ChromiumWebBrowser("localhost:8088/json/list");
ConfigureInspectorBrowser();
UtilityContainer.Children.Add(Inspector);
Expand Down Expand Up @@ -624,6 +628,13 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
SSLToolTip.Content = "APPLYTEMPLATE";
SSLToolTip.IsOpen = false;*/
}

private void SuggestionsTimer_Tick(object? sender, EventArgs e)
{
SuggestionsTimer.Stop();
SetSuggestions();
}

private void Window_Closing(object sender, CancelEventArgs e)
{
if (IsProcessLoaded)
Expand Down Expand Up @@ -824,13 +835,13 @@ private void SetRendererArgs(CefSettings settings)
//settings.CefCommandLineArgs.Add("enable-smooth-scrolling");
//settings.CefCommandLineArgs.Add("enable-overlay-scrollbar");

//settings.CefCommandLineArgs.Add("disable-threaded-scrolling");
//settings.CefCommandLineArgs.Add("disable-smooth-scrolling");
//settings.CefCommandLineArgs.Add("disable-features", "AsyncWheelEvents,TouchpadAndWheelScrollLatching");
settings.CefCommandLineArgs.Add("disable-threaded-scrolling");
settings.CefCommandLineArgs.Add("disable-smooth-scrolling");
settings.CefCommandLineArgs.Add("disable-features", "AsyncWheelEvents,TouchpadAndWheelScrollLatching");

settings.CefCommandLineArgs.Add("canvas-oop-rasterization");

//settings.CefCommandLineArgs.Add("off-screen-frame-rate", "30");
settings.CefCommandLineArgs.Add("off-screen-frame-rate", "40");

settings.CefCommandLineArgs.Add("enable-tile-compression");

Expand Down Expand Up @@ -951,7 +962,7 @@ private void SetSecurityArgs(CefSettings settings)

//settings.CefCommandLineArgs.Add("disable-features=IsolateOrigins,process-per-tab,site-per-process,process-per-site");

//settings.CefCommandLineArgs["disable-features"] += ",SameSiteByDefaultCookies";//Cross Site Request
//settings.CefCommandLineArgs["disable-features"] += ",SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure";//Cross Site Request

if (IsDeveloperMode)
settings.CefCommandLineArgs.Add("ignore-gpu-blocklist");//Uncomment this if CPU is blacklisted or not utilized for SLBr's use on your device
Expand Down Expand Up @@ -2883,7 +2894,9 @@ private void AddressBox_KeyDown(object sender, KeyEventArgs e)
}
else if (bool.Parse(MainSave.Get("AutoSuggestions")) && (e.Key >= Key.A && e.Key <= Key.Z)/* || (e.Key >= Key.D0 && e.Key <= Key.D9) || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9)*/ && Utils.CheckForInternetConnection(100))
{
SetSuggestions();
SuggestionsTimer.Stop();
SuggestionsTimer.Start();
//SetSuggestions();
}
}
}
Expand Down Expand Up @@ -2989,6 +3002,7 @@ private void FavouriteScrollViewer_PreviewMouseWheel(object sender, MouseWheelEv
FavouriteScrollViewer.ScrollToHorizontalOffset(FavouriteScrollViewer.HorizontalOffset - e.Delta / 3);
e.Handled = true;
}
DispatcherTimer SuggestionsTimer;
private void SetSuggestions()
{
Application.Current.Dispatcher.BeginInvoke(new Action(delegate
Expand Down
Loading

0 comments on commit 44915da

Please sign in to comment.