Nattiden před 1 rokem
rodič
revize
b84d9ad497

+ 3 - 0
Project/libraries/Homepage/Light/LightFooter.xaml

@@ -6,6 +6,9 @@
     LogoScale="1.1" Logo="M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z" />
     </StackPanel>
     <StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Right" Margin="-4,0,0,0">
+    <local:MyIconTextButton HorizontalAlignment="Left" Text="设置" ToolTip="新闻主页设置" EventType="打开帮助"
+    EventData="https://pcl.mcnews.thestack.top/BetaNotice.json"
+    LogoScale="1.1" Logo="M959 493.08L750.69 133.218c-7.559-11.362-18.92-18.92-32.183-18.92h-414.77a36.669 36.669 0 0 0-32.182 18.92L63.195 493.08a34.426 34.426 0 0 0 0 37.84l208.36 359.862c7.558 11.362 18.92 18.92 32.183 18.92h414.769a36.669 36.669 0 0 0 32.183-18.92L959 530.92a34.426 34.426 0 0 0 0-37.84z m-66.316 37.84L718.507 833.975c-7.607 11.361-18.969 18.92-32.183 18.92H335.872a36.669 36.669 0 0 1-32.183-18.92L127.561 530.92a34.426 34.426 0 0 1 0-37.84L303.69 190.025c7.558-11.361 18.92-18.92 32.183-18.92h350.354c13.264 0 26.527 7.559 32.183 18.92L892.684 493.08a34.377 34.377 0 0 1 0 37.84z M510.245 341.528a169.74 169.74 0 0 0-170.423 170.423 169.74 169.74 0 0 0 170.423 170.472A169.74 169.74 0 0 0 680.716 511.95a169.74 169.74 0 0 0-170.471-170.423z m0 284.087A113.957 113.957 0 0 1 396.629 512a113.957 113.957 0 0 1 113.616-113.615A113.957 113.957 0 0 1 623.86 512a113.957 113.957 0 0 1-113.615 113.615z"/>
     <local:MyIconTextButton HorizontalAlignment="Left" Text="反馈" ToolTip="反馈新闻主页问题" EventType="打开网页"
     EventData="https://github.com/Light-Beacon/PCL2-NewsHomepage/issues/new/choose"
     LogoScale="1" Logo="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0z M1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0z"/>

+ 5 - 1
Project/libraries/Homepage/NewFooter.xaml

@@ -26,7 +26,11 @@
     </StackPanel>
     </StackPanel>
     <StackPanel HorizontalAlignment="Right" >
-    <local:MyIconTextButton HorizontalAlignment="Left" Text="反馈" ToolTip="反馈新闻主页问题" EventType="打开网页"
+    ${@IF|${beta-test}|
+   <local:MyIconTextButton HorizontalAlignment="Left" Text="设置" ToolTip="新闻主页设置" EventType="打开帮助"
+    EventData="https://pcl.mcnews.thestack.top/BetaNotice.json"
+    LogoScale="1.1" Logo="M959 493.08L750.69 133.218c-7.559-11.362-18.92-18.92-32.183-18.92h-414.77a36.669 36.669 0 0 0-32.182 18.92L63.195 493.08a34.426 34.426 0 0 0 0 37.84l208.36 359.862c7.558 11.362 18.92 18.92 32.183 18.92h414.769a36.669 36.669 0 0 0 32.183-18.92L959 530.92a34.426 34.426 0 0 0 0-37.84z m-66.316 37.84L718.507 833.975c-7.607 11.361-18.969 18.92-32.183 18.92H335.872a36.669 36.669 0 0 1-32.183-18.92L127.561 530.92a34.426 34.426 0 0 1 0-37.84L303.69 190.025c7.558-11.361 18.92-18.92 32.183-18.92h350.354c13.264 0 26.527 7.559 32.183 18.92L892.684 493.08a34.377 34.377 0 0 1 0 37.84z M510.245 341.528a169.74 169.74 0 0 0-170.423 170.423 169.74 169.74 0 0 0 170.423 170.472A169.74 169.74 0 0 0 680.716 511.95a169.74 169.74 0 0 0-170.471-170.423z m0 284.087A113.957 113.957 0 0 1 396.629 512a113.957 113.957 0 0 1 113.616-113.615A113.957 113.957 0 0 1 623.86 512a113.957 113.957 0 0 1-113.615 113.615z"/>
+    }<local:MyIconTextButton HorizontalAlignment="Left" Text="反馈" ToolTip="反馈新闻主页问题" EventType="打开网页"
     EventData="https://github.com/Light-Beacon/PCL2-NewsHomepage/issues/new/choose"
     LogoScale="1" Logo="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0z M1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0z"/>
     <local:MyIconTextButton HorizontalAlignment="Left" Text="刷新" ToolTip="刷新新闻主页" EventType="刷新主页"

+ 17 - 0
Project/modules/homepage_preference.py

@@ -0,0 +1,17 @@
+from homepagebuilder.interfaces import script
+from homepagebuilder.core.types import Context
+
+@script('PreferenceUrl')
+def get_preferece_url(context:'Context', *_args, **_kwargs):
+    settings = context.setter.toProperties()
+    url = 'https://pcl.mcnews.thestack.top/'
+    if settings.get('LightEdition', False):
+        url += 'Light'
+    args = []
+    if settings.get('SkinNewra', False):
+        args.append('skin=newra')
+    if settings.get('HideTranslating', False):
+        args.append('not_finished=false')
+    if len(args) > 0:
+        url += '?' + '&amp;'.join(args)
+    return url

+ 37 - 0
Project/pages/Preference/BetaNotice.xaml

@@ -0,0 +1,37 @@
+<!--title=主页设置:预览提示-->
+<local:MyCard Margin="0,0,0,15" CanSwap="False">
+    <local:MyCard.Inlines>
+        主页设置
+        <InlineUIContainer>
+            <Border Background="{DynamicResource ColorBrush5}" CornerRadius="6">
+                <TextBlock FontSize="10" Margin="6,2" >
+                    <TextBlock.Foreground>
+                        <Binding Path="Foreground" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=TextBlock, AncestorLevel=1}"/>
+                    </TextBlock.Foreground>
+                    预览功能
+                </TextBlock>
+            </Border>
+        </InlineUIContainer>
+    </local:MyCard.Inlines>
+    <StackPanel Margin="25,50,23,15">
+        <TextBlock TextWrapping="Wrap" Margin="0,0,0,4">
+            主页设置是新闻主页的预览功能,在这里你可以按照自己的喜好调整主页的显示内容。
+        </TextBlock>
+        <TextBlock TextWrapping="Wrap" Margin="0,0,0,4">
+            这些选项是<Bold>正在测试</Bold>的新功能,<Bold>可能不稳定</Bold>,也不代表最终成果,也可能随时取消。<Bold>但不会对你使用PCL的其它功能造成影响,也不会造成你的数据损坏、丢失。</Bold>
+        </TextBlock>
+        <TextBlock TextWrapping="Wrap" Margin="0,0,0,4">
+            由于PCL主页限制,<Bold>使用该功能需要将主页从“预设”改为“联网更新”</Bold>,稍后会提供链接地址,你可以选择自动更改(暂时不可用)或手动更改。
+        </TextBlock>
+        <TextBlock TextWrapping="Wrap" Margin="0,0,0,10">
+            如果你遇到问题或者有改进建议可以在新闻主页的 Github 仓库中提出。
+        </TextBlock>
+        <TextBlock TextWrapping="Wrap" Margin="0,0,0,20">
+            你可以随时将主页从“联网更新”改回“预设”以关闭该功能(进行过配置的选项不会保留)。如果你不想或在稍后进行本次测试你可以点击窗口左上角返回。
+        </TextBlock>
+        <local:MyCheckBox Text="我已阅读、了解并同意上述内容" x:Name="ConfirmCheckBox"/>
+        <local:MyButton IsEnabled="{Binding Path=Checked, ElementName=ConfirmCheckBox}" Text="进入设置页面" 
+                        EventType="打开帮助" EventData="https://pcl.mcnews.thestack.top/Preference.json"
+                        Height="40" Margin="20,10,20,10"/>
+    </StackPanel>
+</local:MyCard>

+ 182 - 0
Project/pages/Preference/Preference.xaml

@@ -0,0 +1,182 @@
+<!--title=主页设置-->
+<local:MyTextBox Visibility="Collapsed"><local:MyTextBox.Text>
+    <Binding UpdateSourceTrigger="PropertyChanged" Mode="OneWayToSource"
+    Path="VerticalScrollBarVisibility" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=local:MyScrollViewer, AncestorLevel=1}" 
+    FallbackValue="Disabled"/></local:MyTextBox.Text></local:MyTextBox>
+<local:MyTextBox Visibility="Collapsed"><local:MyTextBox.Text>
+    <Binding UpdateSourceTrigger="PropertyChanged" Mode="OneWayToSource"
+    Path="Margin" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=StackPanel, AncestorLevel=2}" 
+    FallbackValue="20,0,0,0"/></local:MyTextBox.Text></local:MyTextBox>
+<Grid>
+    <Grid.ColumnDefinitions>
+        <ColumnDefinition Width="180"/>
+        <ColumnDefinition Width="*"/>
+    </Grid.ColumnDefinitions>
+    <Grid.RowDefinitions>
+        <RowDefinition/>
+        <RowDefinition MaxHeight="100"/>
+    </Grid.RowDefinitions>
+
+<StackPanel Margin="0,15,5,0" Grid.Column="0" Grid.Row="0">
+    <local:MyCard Margin="0,0,0,15" CanSwap="False" >
+        <local:MyCard.Inlines>
+            主页设置
+            <InlineUIContainer>
+                <Border Background="{DynamicResource ColorBrush5}" CornerRadius="6">
+                    <TextBlock FontSize="10" Margin="6,2" >
+                        <TextBlock.Foreground>
+                            <Binding Path="Foreground" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=TextBlock, AncestorLevel=1}"/>
+                        </TextBlock.Foreground>
+                        预览功能
+                    </TextBlock>
+                </Border>
+            </InlineUIContainer>
+        </local:MyCard.Inlines>
+        <StackPanel Margin="25,40,23,15">
+            <TextBlock TextWrapping="Wrap" Margin="0,0,0,4">
+                主页设置是新闻主页的预览功能,在这里你可以按照自己的喜好调整主页的显示内容。
+            </TextBlock>
+            <TextBlock TextWrapping="Wrap" Margin="0,0,0,4">
+                这些选项是正在测试的新功能,可能不稳定,也不代表最终成果,也可能随时取消。
+            </TextBlock>
+        </StackPanel>
+    </local:MyCard>
+    <local:MyCard Margin="0,0,0,15" CanSwap="False">
+    <StackPanel Margin="15,5">
+        <TextBlock x:Name="OutputTextBlock" Visibility="Collapsed">
+            <TextBlock.Text>
+                <MultiBinding StringFormat="{}https://pcl.mcnews.thestack.top/SaveChanges.json?SkinBasic={0}&amp;SkinNewra={1}&amp;StandardEdition={2}&amp;LightEdition={3}&amp;HideTranslating={4}">
+                    <Binding Path="Checked" ElementName="BasicSkinRadioBox"/>
+                    <Binding Path="Checked" ElementName="NewraSkinRadioBox"/>
+                    <Binding Path="Checked" ElementName="StandardEditionRadioBox"/>
+                    <Binding Path="Checked" ElementName="LightEditionRadioBox"/>
+                    <Binding Path="Checked" ElementName="HideTranslatingCheckBox"/>
+                </MultiBinding>
+            </TextBlock.Text>
+        </TextBlock>
+        <local:MyButton IsEnabled="{Binding Path=Checked, ElementName=ConfirmCheckBox}"
+                        Text="保存" ColorType="Highlight"
+                        EventType="打开帮助" ToolTip="跳转到保存页面"
+                        Height="40" Margin="0,10,0,10">
+            <local:MyButton.EventData>
+                <Binding Path="Text" ElementName="OutputTextBlock"/>
+            </local:MyButton.EventData>
+        </local:MyButton>
+    </StackPanel>   
+</local:MyCard>
+</StackPanel>
+
+<StackPanel Margin="0,15,5,0" Grid.Column="0" Grid.Row="1">
+</StackPanel>
+
+
+
+<local:MyScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Grid.Column="1" Grid.RowSpan="2">
+    <local:MyScrollViewer.Height>
+        <Binding
+        Path="ActualHeight" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=local:MyPageRight, AncestorLevel=1}"/>
+    </local:MyScrollViewer.Height>
+<StackPanel Margin="15,0,15,0">
+<local:MyCard Margin="0,15,0,15" CanSwap="False" Title="主页面">
+    <StackPanel Margin="25,30,23,15"> 
+        <Grid>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="*"/>
+            </Grid.ColumnDefinitions>
+
+            <Border Grid.Column="0" Height="50" Margin="10" BorderThickness="0.5" CornerRadius="6">
+                <Border.BorderBrush>
+                    <Binding Path="Children[1].Stroke" ElementName="StandardEditionRadioBox"/>
+                </Border.BorderBrush>
+            </Border>
+            <Border Grid.Column="0" Height="50" Margin="10" CornerRadius="6" Opacity="0.2">
+                <Border.BorderBrush>
+                    <Binding Path="Children[0].Foreground" ElementName="StandardEditionRadioBox"/>
+                </Border.BorderBrush>
+                <Border.Background>
+                    <Binding Path="Children[2].Fill" ElementName="StandardEditionRadioBox"/>
+                </Border.Background>
+            </Border>
+            <local:MyRadioBox Grid.Column="0" Height="50" Margin="20,10,10,10" x:Name="StandardEditionRadioBox" Checked="True">
+                <Run>完整</Run>
+                <LineBreak/>
+                <Run FontSize="10">原汁原味的新闻主页体验</Run>
+            </local:MyRadioBox>
+
+            <Border Grid.Column="1" Height="50" Margin="10" BorderThickness="0.5" CornerRadius="6">
+                <Border.BorderBrush>
+                    <Binding Path="Children[1].Stroke" ElementName="LightEditionRadioBox"/>
+                </Border.BorderBrush>
+            </Border>
+            <Border Grid.Column="1" Height="50" Margin="10" CornerRadius="6" Opacity="0.2">
+                <Border.Background>
+                    <Binding Path="Children[2].Fill" ElementName="LightEditionRadioBox"/>
+                </Border.Background>
+            </Border>
+            <local:MyRadioBox Grid.Column="1" Height="50" Margin="20,10,10,10" x:Name="LightEditionRadioBox">
+                <Run>精简</Run>
+                <LineBreak/>
+                <Run FontSize="10">只保留最新版本的链接,性能更高</Run>
+            </local:MyRadioBox>
+
+        </Grid>
+    </StackPanel>
+</local:MyCard>
+
+<local:MyCard Margin="0,0,0,15" CanSwap="False" Title="皮肤">
+    <StackPanel Margin="25,30,23,15"> 
+        <Grid>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="*"/>
+            </Grid.ColumnDefinitions>
+            <Grid.RowDefinitions>
+                <RowDefinition/>
+                <RowDefinition/>
+            </Grid.RowDefinitions>
+            <Border Grid.Column="0" Grid.Row="1" Height="50" Margin="10" BorderThickness="0.5" CornerRadius="6">
+                <Border.BorderBrush>
+                    <Binding Path="Children[1].Stroke" ElementName="BasicSkinRadioBox"/>
+                </Border.BorderBrush>
+            </Border>
+            <Border Grid.Column="0" Grid.Row="1" Height="50" Margin="10" CornerRadius="6" Opacity="0.2">
+                <Border.Background>
+                    <Binding Path="Children[2].Fill" ElementName="BasicSkinRadioBox"/>
+                </Border.Background>
+            </Border>
+            <local:MyRadioBox Grid.Column="0" Grid.Row="1" Height="50" Margin="20,10,10,10" x:Name="BasicSkinRadioBox" Checked="True">
+                <Run>经典</Run>
+            </local:MyRadioBox>
+            <local:MyImage Grid.Column="0" Grid.Row="0" Source="https://s21.ax1x.com/2025/08/03/pVNbeg0.png" Margin="10,5"/>
+
+            <Border Grid.Column="1" Grid.Row="1" Height="50" Margin="10" BorderThickness="0.5" CornerRadius="6">
+                <Border.BorderBrush>
+                    <Binding Path="Children[1].Stroke" ElementName="NewraSkinRadioBox"/>
+                </Border.BorderBrush>
+            </Border>
+            <Border Grid.Column="1" Grid.Row="1" Height="50" Margin="10" CornerRadius="6" Opacity="0.2">
+                <Border.BorderBrush>
+                    <Binding Path="Children[0].Foreground" ElementName="NewraSkinRadioBox"/>
+                </Border.BorderBrush>
+                <Border.Background>
+                    <Binding Path="Children[2].Fill" ElementName="NewraSkinRadioBox"/>
+                </Border.Background>
+            </Border>
+            <local:MyRadioBox Grid.Column="1" Grid.Row="1" Height="50" Margin="20,10,10,10" x:Name="NewraSkinRadioBox" >
+                <Run>通透</Run>
+            </local:MyRadioBox>
+            <local:MyImage Grid.Column="1" Grid.Row="0" Source="https://s21.ax1x.com/2025/08/03/pVNb359.png" Margin="10,5"/>
+        </Grid>
+    </StackPanel>
+</local:MyCard>
+
+<local:MyCard Margin="0,0,0,15" CanSwap="False" Title="杂项">
+    <StackPanel Margin="25,40,23,15"> 
+        <local:MyCheckBox Text="隐藏“正在翻译中”动画" x:Name="HideTranslatingCheckBox"/>
+    </StackPanel>
+</local:MyCard>
+
+</StackPanel>
+</local:MyScrollViewer>
+</Grid>

+ 65 - 0
Project/pages/Preference/SaveChanges.xaml

@@ -0,0 +1,65 @@
+<!--title=保存更改-->
+<StackPanel>
+    <StackPanel.Resources>
+        <Style TargetType="TextBox">
+            <Setter Property="FontSize" Value="14" />
+            <Setter Property="IsReadOnly" Value="True" />
+            <Setter Property="Margin" Value="2,0,2,0" />
+            <Setter Property="FontFamily" Value="Consolas"/>
+            <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}"/>
+            <Setter Property="Height" Value="26"/>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="TextBox">
+                        <Border Background="{DynamicResource ColorBrush6}" Opacity="0.9"
+                            BorderBrush="{DynamicResource ColorBrush4}" BorderThickness="0"
+                            CornerRadius="5" Padding="4,4,4,0.2"> 
+                            <ScrollViewer x:Name="PART_ContentHost" Focusable="false"
+                                HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
+                        </Border>
+                        <ControlTemplate.Triggers>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+</StackPanel.Resources>
+<local:MyCard Margin="0,0,0,15" CanSwap="False">
+    <local:MyCard.Inlines>
+        自动保存
+    </local:MyCard.Inlines>
+    <StackPanel Margin="25,50,23,15">
+        <TextBlock TextWrapping="Wrap" Margin="0,0,0,4">
+            点击下方按钮会自动执行保存命令并重启PCL。
+        </TextBlock>
+        <local:MyButton Text="技术原因暂不可用" IsEnabled="False"
+                        EventType="打开文件"
+                        Height="40" Margin="20,10,20,10" EventData="Powershell| -NoExit -Command"/>
+    </StackPanel>
+</local:MyCard>
+<local:MyCard Margin="0,0,0,15" CanSwap="False">
+    <local:MyCard.Inlines>
+        手动更改
+    </local:MyCard.Inlines>
+    <StackPanel Margin="25,40,23,15">
+        <Grid  Margin="0,0,0,14">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="*"/>
+                <ColumnDefinition Width="80"/>
+            </Grid.ColumnDefinitions>
+        <TextBox Grid.Column="0" TextWrapping="Wrap" x:Name="LinkTextBox" Margin="0,0,10,0">
+            ${@PreferenceUrl}
+        </TextBox>
+        <local:MyButton Grid.Column="1" Height="26" EventType="复制文本" EventData="{Binding ElementName=LinkTextBox, Path=Text}">
+            复制链接
+        </local:MyButton>
+        </Grid>
+        <TextBlock TextWrapping="Wrap" Margin="0,0,0,10">
+            复制以上链接,点击下方按钮,找到:主页 -> 联网更新,粘贴链接,回到主页即可完成设置。
+        </TextBlock>
+        <local:MyButton Height="40" Margin="20,10,20,10" EventType="切换页面" EventData="3|1">
+            打开个性化设置
+        </local:MyButton>
+    </StackPanel>
+</local:MyCard>
+</StackPanel>