Add favicon notification.

This commit is contained in:
yukirij 2024-09-28 20:35:49 -07:00
parent b95162e9e2
commit a89636c846
5 changed files with 99 additions and 6 deletions

View File

@ -174,6 +174,7 @@ async fn main()
"www/js/const.js",
"www/js/language.js",
"www/js/util.js",
"www/js/badge.js",
"www/js/game_asset.js",
"www/js/game.js",
"www/js/interface.js",
@ -183,6 +184,7 @@ async fn main()
"www/js/main.js",
]).ok();
cache.cache_file("image/png", "/favicon.png", "www/asset/favicon.png").ok();
cache.cache_file("image/png", "/favicon_notify.png", "www/asset/favicon_notify.png").ok();
let asset_path = std::path::Path::new("www/asset");
for asset in [

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="120"
height="120"
viewBox="0 0 120 120"
version="1.1"
id="svg1"
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
sodipodi:docname="favicon_notify.svg"
inkscape:export-filename="favicon_notify.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="true"
inkscape:zoom="4.9208333"
inkscape:cx="41.558002"
inkscape:cy="30.279424"
inkscape:window-width="2588"
inkscape:window-height="1368"
inkscape:window-x="1257"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1">
<inkscape:grid
id="grid1"
units="px"
originx="0"
originy="0"
spacingx="1"
spacingy="1"
empcolor="#0099e5"
empopacity="0.30196078"
color="#0099e5"
opacity="0.14901961"
empspacing="5"
dotted="false"
gridanglex="30"
gridanglez="30"
visible="true" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:#621313;fill-opacity:1;stroke-width:1.10891"
d="M 62.871213,3.4652358 V 16.772189 L 35.148395,36.732618 29.603831,114.35651 H 96.138595 L 90.594031,36.732618 62.871213,16.772189 V 3.4652358 l 44.356507,27.7228182 5.54456,77.623896 -16.633685,11.08913 H 29.603831 l -16.63369,-11.08913 5.544563,-77.623896 z"
id="path2-3"
sodipodi:nodetypes="ccccccccccccccc" />
<path
style="fill:#ae5555;fill-opacity:1;stroke-width:1.10891"
d="M 59.356512,0.2638065 V 13.57076 L 31.633694,33.531188 26.08913,111.15508 H 92.623894 L 87.07933,33.531188 59.356512,13.57076 V 0.2638065 l 44.356508,27.7228185 5.54456,77.623895 -16.633686,11.08913 H 26.08913 L 9.4554395,105.61052 15.000003,27.986625 Z"
id="path2"
sodipodi:nodetypes="ccccccccccccccc" />
<ellipse
style="fill:#ffdb65;fill-opacity:1;stroke-width:1.25"
id="path1"
cx="75"
cy="30"
rx="24.999996"
ry="25" />
<circle
style="fill:#fff998;fill-opacity:1;stroke-width:1"
id="path1-2"
cx="75"
cy="30"
r="20" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1,8 +1,11 @@
class Badge {
}
function BADGE_UPDATE()
function BADGE_UPDATE(notify)
{
let link = document.querySelector("link[rel~='icon']");
if(link) {
if(notify) {
link.href = "/favicon_notify.png";
} else {
link.href = "/favicon.png";
}
}
}

View File

@ -132,6 +132,8 @@ function MESSAGE(event) {
index = result.index;
STATUS.resume = result.data;
BADGE_UPDATE(STATUS.challenge > 0 || STATUS.resume > 0);
UI.update_status();
}
} break;