修改页面样式功能,首页样式功能导航栏样式功能等
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const commonUtil = fs.readFileSync("utils/CommonUtil.js", "utf8");
|
||||
|
||||
function assert(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
assert(
|
||||
/installCaiSingleLotteryMode\(\)\s*\{[\s\S]*#lotteryFilter[\s\S]*closest\('\.cxz-filter-row'\)\.hide\(\);/.test(
|
||||
commonUtil,
|
||||
),
|
||||
"CommonUtil should hide the inner lottery filter row on cai.html",
|
||||
);
|
||||
|
||||
assert(
|
||||
/installCaiSingleLotteryMode\(\)\s*\{[\s\S]*ApiClient\.loadMenuCompat\(\)[\s\S]*topbar__nav-link/.test(
|
||||
commonUtil,
|
||||
),
|
||||
"CommonUtil should render lottery switching into the top navigation",
|
||||
);
|
||||
|
||||
assert(
|
||||
/activeClass\s*=\s*String\(code\)\s*===\s*currentCode[\s\S]*topbar__nav-link'\s*\+\s*activeClass/.test(
|
||||
commonUtil,
|
||||
),
|
||||
"CommonUtil top navigation should mark current lottery active",
|
||||
);
|
||||
|
||||
assert(
|
||||
/this\.installCaiSingleLotteryMode\(\);/.test(commonUtil),
|
||||
"CommonUtil.loadPageConfig should install cai single-lottery mode",
|
||||
);
|
||||
|
||||
console.log("cai single-lottery checks passed");
|
||||
@@ -0,0 +1,308 @@
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$outDir = Join-Path (Get-Location) "images\trend-icons"
|
||||
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
||||
|
||||
function New-IconBitmap {
|
||||
$bitmap = New-Object System.Drawing.Bitmap 128, 128, ([System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
|
||||
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
||||
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
|
||||
$graphics.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::AntiAliasGridFit
|
||||
$graphics.Clear([System.Drawing.Color]::Transparent)
|
||||
return @($bitmap, $graphics)
|
||||
}
|
||||
|
||||
function New-Pen($color, $width = 4) {
|
||||
$pen = New-Object System.Drawing.Pen $color, $width
|
||||
$pen.StartCap = [System.Drawing.Drawing2D.LineCap]::Round
|
||||
$pen.EndCap = [System.Drawing.Drawing2D.LineCap]::Round
|
||||
$pen.LineJoin = [System.Drawing.Drawing2D.LineJoin]::Round
|
||||
return $pen
|
||||
}
|
||||
|
||||
function New-Brush($color) {
|
||||
return New-Object System.Drawing.SolidBrush $color
|
||||
}
|
||||
|
||||
function Draw-Ball($g, $x, $y, $size, $color1, $color2, $text = "") {
|
||||
$rect = New-Object System.Drawing.RectangleF $x, $y, $size, $size
|
||||
$path = New-Object System.Drawing.Drawing2D.GraphicsPath
|
||||
$path.AddEllipse($rect)
|
||||
$brush = New-Object System.Drawing.Drawing2D.LinearGradientBrush $rect, $color1, $color2, 135
|
||||
$g.FillPath($brush, $path)
|
||||
$g.DrawPath((New-Pen ([System.Drawing.Color]::FromArgb(160, 255, 255, 255)) 2), $path)
|
||||
if ($text) {
|
||||
$font = New-Object System.Drawing.Font "Arial", 13, ([System.Drawing.FontStyle]::Bold)
|
||||
$format = New-Object System.Drawing.StringFormat
|
||||
$format.Alignment = [System.Drawing.StringAlignment]::Center
|
||||
$format.LineAlignment = [System.Drawing.StringAlignment]::Center
|
||||
$g.DrawString($text, $font, (New-Brush ([System.Drawing.Color]::White)), $rect, $format)
|
||||
$font.Dispose()
|
||||
$format.Dispose()
|
||||
}
|
||||
$brush.Dispose()
|
||||
$path.Dispose()
|
||||
}
|
||||
|
||||
function Draw-Grid($g) {
|
||||
$gridPen = New-Pen ([System.Drawing.Color]::FromArgb(42, 16, 43, 106)) 2
|
||||
foreach ($x in @(32, 56, 80, 104)) {
|
||||
$g.DrawLine($gridPen, $x, 24, $x, 104)
|
||||
}
|
||||
foreach ($y in @(32, 56, 80, 104)) {
|
||||
$g.DrawLine($gridPen, 24, $y, 112, $y)
|
||||
}
|
||||
$gridPen.Dispose()
|
||||
}
|
||||
|
||||
function Draw-Axes($g) {
|
||||
$axisPen = New-Pen ([System.Drawing.Color]::FromArgb(150, 16, 43, 106)) 3
|
||||
$g.DrawLine($axisPen, 24, 102, 108, 102)
|
||||
$g.DrawLine($axisPen, 24, 102, 24, 24)
|
||||
$axisPen.Dispose()
|
||||
}
|
||||
|
||||
function Save-Icon($name, [scriptblock]$draw) {
|
||||
$parts = New-IconBitmap
|
||||
$bitmap = $parts[0]
|
||||
$graphics = $parts[1]
|
||||
& $draw $graphics
|
||||
$path = Join-Path $outDir $name
|
||||
$bitmap.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
$graphics.Dispose()
|
||||
$bitmap.Dispose()
|
||||
Write-Host $path
|
||||
}
|
||||
|
||||
$redA = [System.Drawing.Color]::FromArgb(246, 91, 80)
|
||||
$redB = [System.Drawing.Color]::FromArgb(218, 28, 49)
|
||||
$blueA = [System.Drawing.Color]::FromArgb(74, 158, 255)
|
||||
$blueB = [System.Drawing.Color]::FromArgb(18, 79, 190)
|
||||
$gold = [System.Drawing.Color]::FromArgb(253, 185, 51)
|
||||
$navy = [System.Drawing.Color]::FromArgb(16, 43, 106)
|
||||
$green = [System.Drawing.Color]::FromArgb(36, 196, 132)
|
||||
$purple = [System.Drawing.Color]::FromArgb(138, 92, 246)
|
||||
|
||||
Save-Icon "ssq-trend.png" {
|
||||
param($g)
|
||||
Draw-Grid $g
|
||||
Draw-Axes $g
|
||||
$linePen = New-Pen $redA 5
|
||||
$g.DrawLines($linePen, @(
|
||||
[System.Drawing.PointF]::new(28, 82),
|
||||
[System.Drawing.PointF]::new(46, 58),
|
||||
[System.Drawing.PointF]::new(66, 72),
|
||||
[System.Drawing.PointF]::new(88, 42),
|
||||
[System.Drawing.PointF]::new(108, 56)
|
||||
))
|
||||
$linePen.Dispose()
|
||||
Draw-Ball $g 22 72 25 $redA $redB "06"
|
||||
Draw-Ball $g 56 62 25 $redA $redB "12"
|
||||
Draw-Ball $g 88 46 25 $blueA $blueB "16"
|
||||
}
|
||||
|
||||
Save-Icon "basic-trend.png" {
|
||||
param($g)
|
||||
Draw-Grid $g
|
||||
Draw-Axes $g
|
||||
$pen1 = New-Pen $navy 5
|
||||
$pen2 = New-Pen $gold 4
|
||||
$g.DrawLines($pen1, @(
|
||||
[System.Drawing.PointF]::new(28, 86),
|
||||
[System.Drawing.PointF]::new(46, 76),
|
||||
[System.Drawing.PointF]::new(64, 62),
|
||||
[System.Drawing.PointF]::new(82, 46),
|
||||
[System.Drawing.PointF]::new(106, 36)
|
||||
))
|
||||
$g.DrawLines($pen2, @(
|
||||
[System.Drawing.PointF]::new(30, 96),
|
||||
[System.Drawing.PointF]::new(54, 90),
|
||||
[System.Drawing.PointF]::new(78, 70),
|
||||
[System.Drawing.PointF]::new(104, 68)
|
||||
))
|
||||
$pen1.Dispose()
|
||||
$pen2.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "number-distribution.png" {
|
||||
param($g)
|
||||
Draw-Grid $g
|
||||
foreach ($row in 0..3) {
|
||||
foreach ($col in 0..4) {
|
||||
$x = 24 + $col * 20
|
||||
$y = 28 + $row * 18
|
||||
$color = if (($row + $col) % 3 -eq 0) { $redA } elseif (($row + $col) % 3 -eq 1) { $blueA } else { $gold }
|
||||
Draw-Ball $g $x $y 13 $color ([System.Drawing.Color]::FromArgb($color.A, [Math]::Max(0, $color.R - 32), [Math]::Max(0, $color.G - 32), [Math]::Max(0, $color.B - 32))) ""
|
||||
}
|
||||
}
|
||||
$barBrush = New-Brush ([System.Drawing.Color]::FromArgb(170, 16, 43, 106))
|
||||
$g.FillRectangle($barBrush, 28, 102, 18, 10)
|
||||
$g.FillRectangle($barBrush, 54, 92, 18, 20)
|
||||
$g.FillRectangle($barBrush, 80, 84, 18, 28)
|
||||
$barBrush.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "red-blue-trend.png" {
|
||||
param($g)
|
||||
Draw-Grid $g
|
||||
$redPen = New-Pen $redA 5
|
||||
$bluePen = New-Pen $blueA 5
|
||||
$g.DrawLines($redPen, @(
|
||||
[System.Drawing.PointF]::new(22, 82),
|
||||
[System.Drawing.PointF]::new(44, 48),
|
||||
[System.Drawing.PointF]::new(68, 64),
|
||||
[System.Drawing.PointF]::new(92, 34),
|
||||
[System.Drawing.PointF]::new(112, 52)
|
||||
))
|
||||
$g.DrawLines($bluePen, @(
|
||||
[System.Drawing.PointF]::new(22, 56),
|
||||
[System.Drawing.PointF]::new(44, 76),
|
||||
[System.Drawing.PointF]::new(68, 46),
|
||||
[System.Drawing.PointF]::new(92, 72),
|
||||
[System.Drawing.PointF]::new(112, 36)
|
||||
))
|
||||
Draw-Ball $g 24 78 19 $redA $redB ""
|
||||
Draw-Ball $g 86 68 19 $blueA $blueB ""
|
||||
$redPen.Dispose()
|
||||
$bluePen.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "combined-trend.png" {
|
||||
param($g)
|
||||
Draw-Grid $g
|
||||
$area = New-Object System.Drawing.Drawing2D.GraphicsPath
|
||||
$area.AddPolygon(@(
|
||||
[System.Drawing.PointF]::new(26, 96),
|
||||
[System.Drawing.PointF]::new(26, 74),
|
||||
[System.Drawing.PointF]::new(48, 52),
|
||||
[System.Drawing.PointF]::new(72, 66),
|
||||
[System.Drawing.PointF]::new(102, 38),
|
||||
[System.Drawing.PointF]::new(102, 96)
|
||||
))
|
||||
$g.FillPath((New-Brush ([System.Drawing.Color]::FromArgb(52, 74, 158, 255))), $area)
|
||||
$pen = New-Pen $purple 5
|
||||
$g.DrawLines($pen, @(
|
||||
[System.Drawing.PointF]::new(26, 74),
|
||||
[System.Drawing.PointF]::new(48, 52),
|
||||
[System.Drawing.PointF]::new(72, 66),
|
||||
[System.Drawing.PointF]::new(102, 38)
|
||||
))
|
||||
Draw-Ball $g 72 70 20 $redA $redB ""
|
||||
Draw-Ball $g 92 34 20 $blueA $blueB ""
|
||||
$pieBrush = New-Brush ([System.Drawing.Color]::FromArgb(230, 253, 185, 51))
|
||||
$g.FillPie($pieBrush, 28, 28, 24, 24, 270, 230)
|
||||
$g.DrawEllipse((New-Pen $navy 3), 28, 28, 24, 24)
|
||||
$area.Dispose()
|
||||
$pen.Dispose()
|
||||
$pieBrush.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "blue-trend.png" {
|
||||
param($g)
|
||||
Draw-Grid $g
|
||||
Draw-Axes $g
|
||||
$pen = New-Pen $blueA 5
|
||||
$g.DrawLines($pen, @(
|
||||
[System.Drawing.PointF]::new(28, 84),
|
||||
[System.Drawing.PointF]::new(46, 66),
|
||||
[System.Drawing.PointF]::new(64, 76),
|
||||
[System.Drawing.PointF]::new(86, 44),
|
||||
[System.Drawing.PointF]::new(108, 58)
|
||||
))
|
||||
Draw-Ball $g 32 76 21 $blueA $blueB "03"
|
||||
Draw-Ball $g 80 38 21 $blueA $blueB "12"
|
||||
$pen.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "blue-amplitude.png" {
|
||||
param($g)
|
||||
$axisPen = New-Pen ([System.Drawing.Color]::FromArgb(150, 16, 43, 106)) 3
|
||||
$g.DrawLine($axisPen, 24, 64, 108, 64)
|
||||
$g.DrawLine($axisPen, 32, 24, 32, 104)
|
||||
$wavePen = New-Pen $blueA 6
|
||||
$g.DrawBezier($wavePen, 24, 76, 44, 18, 66, 110, 88, 52)
|
||||
$g.DrawBezier($wavePen, 88, 52, 96, 34, 106, 28, 114, 38)
|
||||
$arrowPen = New-Pen $gold 4
|
||||
$g.DrawLine($arrowPen, 98, 92, 98, 34)
|
||||
$g.DrawLine($arrowPen, 98, 34, 90, 44)
|
||||
$g.DrawLine($arrowPen, 98, 34, 106, 44)
|
||||
$g.DrawLine($arrowPen, 98, 92, 90, 82)
|
||||
$g.DrawLine($arrowPen, 98, 92, 106, 82)
|
||||
Draw-Ball $g 50 70 22 $blueA $blueB ""
|
||||
$axisPen.Dispose()
|
||||
$wavePen.Dispose()
|
||||
$arrowPen.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "blue-tail.png" {
|
||||
param($g)
|
||||
$ringPen = New-Pen $blueA 5
|
||||
$g.DrawEllipse($ringPen, 26, 22, 76, 76)
|
||||
$font = New-Object System.Drawing.Font "Arial", 24, ([System.Drawing.FontStyle]::Bold)
|
||||
$small = New-Object System.Drawing.Font "Arial", 13, ([System.Drawing.FontStyle]::Bold)
|
||||
$format = New-Object System.Drawing.StringFormat
|
||||
$format.Alignment = [System.Drawing.StringAlignment]::Center
|
||||
$format.LineAlignment = [System.Drawing.StringAlignment]::Center
|
||||
$g.DrawString("0-9", $font, (New-Brush $navy), ([System.Drawing.RectangleF]::new(20, 30, 88, 40)), $format)
|
||||
$g.DrawString("TAIL", $small, (New-Brush $blueB), ([System.Drawing.RectangleF]::new(20, 68, 88, 24)), $format)
|
||||
Draw-Ball $g 78 82 24 $blueA $blueB "7"
|
||||
$ringPen.Dispose()
|
||||
$font.Dispose()
|
||||
$small.Dispose()
|
||||
$format.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "blue-two-sum.png" {
|
||||
param($g)
|
||||
Draw-Ball $g 18 42 34 $blueA $blueB "08"
|
||||
Draw-Ball $g 76 42 34 $blueA $blueB "11"
|
||||
$font = New-Object System.Drawing.Font "Arial", 22, ([System.Drawing.FontStyle]::Bold)
|
||||
$format = New-Object System.Drawing.StringFormat
|
||||
$format.Alignment = [System.Drawing.StringAlignment]::Center
|
||||
$format.LineAlignment = [System.Drawing.StringAlignment]::Center
|
||||
$g.DrawString("+", $font, (New-Brush $gold), ([System.Drawing.RectangleF]::new(51, 42, 28, 34)), $format)
|
||||
$sumBrush = New-Brush ([System.Drawing.Color]::FromArgb(230, 16, 43, 106))
|
||||
$g.FillRectangle($sumBrush, 34, 88, 60, 18)
|
||||
$g.DrawString("=19", (New-Object System.Drawing.Font "Arial", 13, ([System.Drawing.FontStyle]::Bold)), (New-Brush ([System.Drawing.Color]::White)), ([System.Drawing.RectangleF]::new(34, 87, 60, 20)), $format)
|
||||
$font.Dispose()
|
||||
$format.Dispose()
|
||||
$sumBrush.Dispose()
|
||||
}
|
||||
|
||||
Save-Icon "dev-coming.png" {
|
||||
param($g)
|
||||
$plate = New-Object System.Drawing.RectangleF 18, 28, 92, 64
|
||||
$plateBrush = New-Object System.Drawing.Drawing2D.LinearGradientBrush $plate, ([System.Drawing.Color]::FromArgb(245, 255, 255, 255)), ([System.Drawing.Color]::FromArgb(235, 232, 239, 250)), 90
|
||||
$path = New-Object System.Drawing.Drawing2D.GraphicsPath
|
||||
$path.AddArc(18, 28, 16, 16, 180, 90)
|
||||
$path.AddArc(94, 28, 16, 16, 270, 90)
|
||||
$path.AddArc(94, 76, 16, 16, 0, 90)
|
||||
$path.AddArc(18, 76, 16, 16, 90, 90)
|
||||
$path.CloseFigure()
|
||||
$g.FillPath($plateBrush, $path)
|
||||
$g.DrawPath((New-Pen ([System.Drawing.Color]::FromArgb(105, 16, 43, 106)) 2), $path)
|
||||
|
||||
$pen = New-Pen $blueA 5
|
||||
$g.DrawLines($pen, @(
|
||||
[System.Drawing.PointF]::new(32, 72),
|
||||
[System.Drawing.PointF]::new(46, 56),
|
||||
[System.Drawing.PointF]::new(62, 64),
|
||||
[System.Drawing.PointF]::new(80, 42),
|
||||
[System.Drawing.PointF]::new(98, 54)
|
||||
))
|
||||
Draw-Ball $g 28 78 22 $redA $redB ""
|
||||
Draw-Ball $g 74 34 24 $blueA $blueB ""
|
||||
Draw-Ball $g 50 58 20 $gold ([System.Drawing.Color]::FromArgb(232, 140, 20)) ""
|
||||
|
||||
$font = New-Object System.Drawing.Font "Arial", 15, ([System.Drawing.FontStyle]::Bold)
|
||||
$format = New-Object System.Drawing.StringFormat
|
||||
$format.Alignment = [System.Drawing.StringAlignment]::Center
|
||||
$format.LineAlignment = [System.Drawing.StringAlignment]::Center
|
||||
$g.DrawString("DEV", $font, (New-Brush $navy), ([System.Drawing.RectangleF]::new(30, 94, 68, 24)), $format)
|
||||
|
||||
$plateBrush.Dispose()
|
||||
$path.Dispose()
|
||||
$pen.Dispose()
|
||||
$font.Dispose()
|
||||
$format.Dispose()
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const commonUtil = fs.readFileSync("utils/CommonUtil.js", "utf8");
|
||||
|
||||
function assert(condition, message) {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
[
|
||||
"cai.html",
|
||||
"caiinfo.html",
|
||||
].forEach((page) => {
|
||||
assert(commonUtil.includes(`'${page}'`), `cai navigation page missing: ${page}`);
|
||||
});
|
||||
|
||||
[
|
||||
"usercenter.html",
|
||||
"mianfeishoucang.html",
|
||||
"tuiguang.html",
|
||||
"jine.html",
|
||||
"chongzhi.html",
|
||||
"tixian.html",
|
||||
"tixianlist.html",
|
||||
"fabumianfeiwenzhang.html",
|
||||
"fufei.html",
|
||||
"appdown.html",
|
||||
"apply.html",
|
||||
"open-browser.html",
|
||||
"reg.html",
|
||||
"repwd.html",
|
||||
"social-callback.html",
|
||||
"upgrade.html",
|
||||
"wodefenxiao.html",
|
||||
"yinsixieyi.html",
|
||||
"yonghuxieyi.html",
|
||||
].forEach((page) => {
|
||||
assert(commonUtil.includes(`'${page}'`), `empty navigation page missing: ${page}`);
|
||||
});
|
||||
|
||||
[
|
||||
"双色球走势图",
|
||||
"基本走势",
|
||||
"出号分布",
|
||||
"红蓝走势",
|
||||
"综合走势",
|
||||
"蓝球走势",
|
||||
"蓝球振幅",
|
||||
"蓝球尾数",
|
||||
"蓝球两数和",
|
||||
].forEach((label) => {
|
||||
assert(commonUtil.includes(`label: '${label}'`), `feature nav item missing: ${label}`);
|
||||
});
|
||||
|
||||
assert(commonUtil.includes("开发中敬请期待"), "coming-soon popup text missing");
|
||||
assert(commonUtil.includes("trend-icons/dev-coming.png"), "coming-soon popup image missing");
|
||||
assert(commonUtil.includes("this.installTopbarNavigationMode();"), "loadPageConfig should install topbar navigation mode");
|
||||
assert(commonUtil.includes("DOMContentLoaded', installTopbarNavigationMode"), "DOMContentLoaded should install topbar navigation mode");
|
||||
|
||||
console.log("topbar navigation mode checks passed");
|
||||
@@ -0,0 +1,28 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const source = fs.readFileSync(path.join(__dirname, '..', 'utils', 'CommonUtil.js'), 'utf8');
|
||||
|
||||
function assertContains(pattern, message) {
|
||||
if (!pattern.test(source)) {
|
||||
console.error(message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
assertContains(/topbar__btn--signin/, 'Expected public topbar to inject a sign-in button.');
|
||||
assertContains(/CommonUtil\.signIn\(/, 'Expected sign-in button to call CommonUtil.signIn().');
|
||||
assertContains(/text:\s*['"]\u7b7e\u5230['"]/, 'Expected sign-in button text to be sign in.');
|
||||
assertContains(/ensureTopbarSignInStyle/, 'Expected public topbar to install a dedicated sign-in button style.');
|
||||
assertContains(/\.topbar__btn--signin\s*\{/, 'Expected dedicated sign-in button CSS to be injected.');
|
||||
assertContains(/setTopbarSignInSigned/, 'Expected a shared helper to lock the topbar sign-in button.');
|
||||
assertContains(/\u5df2\u7b7e\u5230/, 'Expected signed state text to be already signed.');
|
||||
assertContains(/mineSignInStatus|\/api\/web\/mine\/sign-in\/status/, 'Expected topbar to load the current sign-in status.');
|
||||
assertContains(/\u5df2\u7b7e\u5230\|\u5df2\u7b7e\|\u5df2\u7ecf\u7b7e\u5230\|\u7b7e\u5230\u8fc7/, 'Expected already-signed API messages to lock the button.');
|
||||
|
||||
if (/class:\s*['"][^'"]*topbar__btn--signin[^'"]*topbar__btn--primary/.test(source)) {
|
||||
console.error('Expected sign-in button to use a quieter dedicated style, not the primary button style.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('topbar sign-in checks passed');
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Reference in New Issue
Block a user