<commit_before><Page
    x:Class="FlashbackUwp.Views.ThreadPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FlashbackUwp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewModels="using:FlashbackUwp.ViewModels"
    xmlns:controls="using:Template10.Controls"
    xmlns:converters="using:FlashbackUwp.Converters"
    xmlns:extensions="using:FlashbackUwp.Extensions"
    mc:Ignorable="d">

    <Page.DataContext>
        <viewModels:ThreadViewModel x:Name="ViewModel" />
    </Page.DataContext>


    <Page.Resources>
        <converters:BoolToVisibilityConverter x:Key="BoolConverter" />
        <converters:ColorConverter x:Key="ColorConverter" />
    </Page.Resources>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <!-- Header Row -->
            <RowDefinition Height="*" />
            <!-- Content Row -->
            <RowDefinition Height="Auto" />
            <!-- CommandBar Row -->
        </Grid.RowDefinitions>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="AdaptiveVisualStateGroup">
                <VisualState x:Name="VisualStateNarrow">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource NarrowMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <!--  TODO: change properties for narrow view  -->
                        <Setter Target="BottonCommands.Visibility" Value="Visible"/>
                        <Setter Target="pageHeader.PrimaryCommandsVisibility" Value="Collapsed"/>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="VisualStateNormal">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource NormalMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <!--  TODO: change properties for normal view  -->
                        <Setter Target="BottonCommands.Visibility" Value="Visible"/>
                        <Setter Target="pageHeader.PrimaryCommandsVisibility" Value="Collapsed"/>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="VisualStateWide">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource WideMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <!--  TODO: change properties for wide view  -->
                        <Setter Target="BottonCommands.Visibility" Value="Collapsed"/>
                        <Setter Target="pageHeader.PrimaryCommandsVisibility" Value="Visible"/>

                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <!--  header  -->
        <controls:PageHeader x:Name="pageHeader" Frame="{x:Bind Frame}" Grid.Row="0"                          
                             EllipsisVisibility="Collapsed" 
                             PrimaryCommandsVisibility="Collapsed">
            <controls:PageHeader.PrimaryCommands>
                <AppBarButton Icon="Comment" Label="Svara" Click="{x:Bind ViewModel.Refresh}" IsEnabled="{Binding IsLoggedIn}" />
                <AppBarButton Icon=" Favorite" Label="Favorit" Click="{x:Bind ViewModel.AddToFavourites}" IsEnabled="{Binding IsLoggedIn}" />
                <AppBarButton Icon="Refresh" Label="Ladda om" Click="{x:Bind ViewModel.Refresh}" />
                <AppBarButton Icon="Pin" Label="Pinna" Click="{x:Bind ViewModel.Pin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter},ConverterParameter=true}" />
                <AppBarButton Icon="Unpin" Label="Ta bort" Click="{x:Bind ViewModel.UnPin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter}}" />
                <AppBarButton Icon="World" Label="Öppna i webbläsare" Click="OpenInWebBrowser" />
            </controls:PageHeader.PrimaryCommands>
            <controls:PageHeader.Content>
                <RelativePanel HorizontalAlignment="Left">
                    <TextBlock x:Name="rubrik" Text="{Binding ForumThread.Title}" Tapped="{x:Bind ViewModel.NavigateToParentForum}" Margin="0,0,10,5"></TextBlock>

                    <Button Click="{x:Bind ViewModel.FirstPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Style="{StaticResource NavigationButton}" RelativePanel.Below="rubrik" x:Name="First">
                        <SymbolIcon Symbol="Previous"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.PrevioustPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Back" RelativePanel.Below="rubrik" RelativePanel.RightOf="First">
                        <SymbolIcon Symbol="Back"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.ShowPicker}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Picker" RelativePanel.Below="rubrik" RelativePanel.RightOf="Back">
                        <SymbolIcon Symbol="List"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.NextPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Next" RelativePanel.Below="rubrik" RelativePanel.RightOf="Picker">
                        <SymbolIcon Symbol="Forward"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.LastPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Last" RelativePanel.Below="rubrik" RelativePanel.RightOf="Next">
                        <SymbolIcon Symbol="Next"/>
                    </Button>

                    <TextBlock Margin="24,-5,0,0"  RelativePanel.Below="rubrik" RelativePanel.RightOf="Last" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Text="{Binding ForumThread.PagenumberText}"/>

                </RelativePanel>
            </controls:PageHeader.Content>
        </controls:PageHeader>

        <!--  content  -->
        <ScrollViewer Padding="12,8,0,0" Grid.Row="1">
            <WebView x:Name="WebView" NavigationCompleted="{x:Bind ViewModel.BrowserReady}"  NewWindowRequested="WebView_OnNewWindowRequested" extensions:HtmlWebViewExtender.HTML="{Binding ForumThread.Html}"  DefaultBackgroundColor="{ThemeResource SystemAltHighColor}" >
                
            </WebView>
        </ScrollViewer>

        <CommandBar ClosedDisplayMode="Compact" x:Name="BottonCommands" Visibility="Collapsed" Grid.Row="2">
            <AppBarButton Name="BottonAddFavourite" Icon="Comment" Label="Svara" Click="{x:Bind ViewModel.Refresh}" IsEnabled="{Binding IsLoggedIn}" />
            <AppBarButton Name="BottonReply" Icon=" Favorite" Label="Favorit" Click="{x:Bind ViewModel.AddToFavourites}" IsEnabled="{Binding IsLoggedIn}" />
            <AppBarButton Name="BottonPrimaryHome" Icon="Refresh" Label="Ladda om" Click="{x:Bind ViewModel.Refresh}" />
            <AppBarButton Name="BottonPin" Icon="Pin" Label="Pinna" Click="{x:Bind ViewModel.Pin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter},ConverterParameter=true}" />
            <AppBarButton Name="BottonUnPin" Icon="Unpin" Label="Ta bort" Click="{x:Bind ViewModel.UnPin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter}}" />

            <CommandBar.SecondaryCommands>
                <AppBarButton Icon="ClosePane" Label="Överst" Click="WebViewTop"/>
                <AppBarButton Icon="OpenPane" Label="Längst ner" Click="WebViewBottom"/>
                <AppBarButton Icon="World" Label="Öppna i webbläsare" Click="OpenInWebBrowser"/>
            </CommandBar.SecondaryCommands>
        </CommandBar>

    </Grid><commit_msg>gjort så att det är enklare att gå överst/längst ner i trådar<commit_after><Page
    x:Class="FlashbackUwp.Views.ThreadPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FlashbackUwp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewModels="using:FlashbackUwp.ViewModels"
    xmlns:controls="using:Template10.Controls"
    xmlns:converters="using:FlashbackUwp.Converters"
    xmlns:extensions="using:FlashbackUwp.Extensions"
    mc:Ignorable="d">

    <Page.DataContext>
        <viewModels:ThreadViewModel x:Name="ViewModel" />
    </Page.DataContext>


    <Page.Resources>
        <converters:BoolToVisibilityConverter x:Key="BoolConverter" />
        <converters:ColorConverter x:Key="ColorConverter" />
    </Page.Resources>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <!-- Header Row -->
            <RowDefinition Height="*" />
            <!-- Content Row -->
            <RowDefinition Height="Auto" />
            <!-- CommandBar Row -->
        </Grid.RowDefinitions>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="AdaptiveVisualStateGroup">
                <VisualState x:Name="VisualStateNarrow">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource NarrowMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <!--  TODO: change properties for narrow view  -->
                        <Setter Target="BottonCommands.Visibility" Value="Visible"/>
                        <Setter Target="pageHeader.PrimaryCommandsVisibility" Value="Collapsed"/>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="VisualStateNormal">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource NormalMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <!--  TODO: change properties for normal view  -->
                        <Setter Target="BottonCommands.Visibility" Value="Visible"/>
                        <Setter Target="pageHeader.PrimaryCommandsVisibility" Value="Collapsed"/>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="VisualStateWide">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource WideMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <!--  TODO: change properties for wide view  -->
                        <Setter Target="BottonCommands.Visibility" Value="Collapsed"/>
                        <Setter Target="pageHeader.PrimaryCommandsVisibility" Value="Visible"/>

                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <!--  header  -->
        <controls:PageHeader x:Name="pageHeader" Frame="{x:Bind Frame}" Grid.Row="0"                          
                             EllipsisVisibility="Collapsed" 
                             PrimaryCommandsVisibility="Collapsed">
            <controls:PageHeader.PrimaryCommands>
                <AppBarButton Icon="Comment" Label="Svara" Click="{x:Bind ViewModel.Refresh}" IsEnabled="{Binding IsLoggedIn}" />
                <AppBarButton Icon=" Favorite" Label="Favorit" Click="{x:Bind ViewModel.AddToFavourites}" IsEnabled="{Binding IsLoggedIn}" />
                <AppBarButton Icon="Refresh" Label="Ladda om" Click="{x:Bind ViewModel.Refresh}" />
                <AppBarButton Icon="Pin" Label="Pinna" Click="{x:Bind ViewModel.Pin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter},ConverterParameter=true}" />
                <AppBarButton Icon="Unpin" Label="Ta bort" Click="{x:Bind ViewModel.UnPin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter}}" />
                <AppBarButton Icon="World" Label="Öppna i webbläsare" Click="OpenInWebBrowser" />
            </controls:PageHeader.PrimaryCommands>
            <controls:PageHeader.Content>
                <RelativePanel HorizontalAlignment="Left">
                    <TextBlock x:Name="rubrik" Text="{Binding ForumThread.Title}" Tapped="{x:Bind ViewModel.NavigateToParentForum}" Margin="0,0,10,5"></TextBlock>

                    <Button Click="{x:Bind ViewModel.FirstPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Style="{StaticResource NavigationButton}" RelativePanel.Below="rubrik" x:Name="First">
                        <SymbolIcon Symbol="Previous"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.PrevioustPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Back" RelativePanel.Below="rubrik" RelativePanel.RightOf="First">
                        <SymbolIcon Symbol="Back"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.ShowPicker}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Picker" RelativePanel.Below="rubrik" RelativePanel.RightOf="Back">
                        <SymbolIcon Symbol="List"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.NextPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Next" RelativePanel.Below="rubrik" RelativePanel.RightOf="Picker">
                        <SymbolIcon Symbol="Forward"/>
                    </Button>

                    <Button Click="{x:Bind ViewModel.LastPage}" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Margin="15,0,0,0" Style="{StaticResource NavigationButton}" x:Name="Last" RelativePanel.Below="rubrik" RelativePanel.RightOf="Next">
                        <SymbolIcon Symbol="Next"/>
                    </Button>

                    <TextBlock Margin="24,-5,0,0"  RelativePanel.Below="rubrik" RelativePanel.RightOf="Last" Visibility="{Binding ForumThread.ShowNavigation, Converter={StaticResource BoolConverter}}" Text="{Binding ForumThread.PagenumberText}"/>

                </RelativePanel>
            </controls:PageHeader.Content>
        </controls:PageHeader>

        <!--  content  -->
        <ScrollViewer Padding="12,8,0,0" Grid.Row="1">
            <WebView x:Name="WebView" NavigationCompleted="{x:Bind ViewModel.BrowserReady}"  NewWindowRequested="WebView_OnNewWindowRequested" extensions:HtmlWebViewExtender.HTML="{Binding ForumThread.Html}"  DefaultBackgroundColor="{ThemeResource SystemAltHighColor}" >
                
            </WebView>
        </ScrollViewer>

        <CommandBar ClosedDisplayMode="Compact" x:Name="BottonCommands" Visibility="Collapsed" Grid.Row="2">
            <AppBarButton Name="BottonAddFavourite" Icon="Comment" Label="Svara" Click="{x:Bind ViewModel.Refresh}" IsEnabled="{Binding IsLoggedIn}" />
            <AppBarButton Name="BottonReply" Icon=" Favorite" Label="Favorit" Click="{x:Bind ViewModel.AddToFavourites}" IsEnabled="{Binding IsLoggedIn}" />
            <AppBarButton Name="BottonPrimaryHome" Icon="Refresh" Label="Ladda om" Click="{x:Bind ViewModel.Refresh}" />
            <AppBarButton Name="BottonPin" Icon="Pin" Label="Pinna" Click="{x:Bind ViewModel.Pin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter},ConverterParameter=true}" />
            <AppBarButton Name="BottonUnPin" Icon="Unpin" Label="Ta bort" Click="{x:Bind ViewModel.UnPin}" Visibility="{Binding IsPinned,Converter={StaticResource BoolConverter}}" />

            <CommandBar.SecondaryCommands>
                <AppBarButton Icon="World" Label="Öppna i webbläsare" Click="OpenInWebBrowser"/>
                <AppBarSeparator></AppBarSeparator>
                <AppBarButton Icon="ClosePane" Label="Överst" Click="WebViewTop"/>
                <AppBarButton Icon="OpenPane" Label="Längst ner" Click="WebViewBottom"/>
            </CommandBar.SecondaryCommands>
        </CommandBar>

    </Grid>
{'fraction_non_alphanumeric': 0.12737251314886805, 'fraction_numerical': 0.006402927052366796, 'mean_word_length': 2.7418181818181817, 'pattern_counts': {'":': 0, '<': 209, '<?xml version=': 0, '>': 209, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6869082', 'n_tokens_mistral': 4765, 'n_tokens_neox': 4379, 'n_words': 705}