notifications: Use a dynamic SVG favicon for unread counts.
Closes #2304. Signed-off-by: Anders Kaseorg <anders@zulip.com>
|
@ -1,5 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
// Dependencies
|
||||
set_global(
|
||||
"$",
|
||||
|
@ -32,7 +34,9 @@ zrequire("ui");
|
|||
zrequire("spoilers");
|
||||
spoilers.hide_spoilers_in_notification = () => {};
|
||||
|
||||
zrequire("notifications");
|
||||
rewiremock.proxy(() => zrequire("notifications"), {
|
||||
"../../static/js/favicon": {},
|
||||
});
|
||||
|
||||
// Not muted streams
|
||||
const general = {
|
||||
|
|
|
@ -104,7 +104,9 @@ zrequire("narrow");
|
|||
zrequire("search_suggestion");
|
||||
zrequire("search");
|
||||
zrequire("tutorial");
|
||||
zrequire("notifications");
|
||||
rewiremock.proxy(() => zrequire("notifications"), {
|
||||
"../../static/js/favicon": {},
|
||||
});
|
||||
zrequire("pm_conversations");
|
||||
zrequire("pm_list");
|
||||
zrequire("list_cursor");
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
"file-loader": "^6.0.0",
|
||||
"flatpickr": "^4.5.7",
|
||||
"font-awesome": "^4.7.0",
|
||||
"font-subset-loader2": "^1.1.7",
|
||||
"ga-gtag": "^1.0.1",
|
||||
"handlebars": "^4.7.2",
|
||||
"handlebars-loader": "^1.7.1",
|
||||
|
@ -65,6 +66,7 @@
|
|||
"style-loader": "^1.0.0",
|
||||
"terser-webpack-plugin": "^4.1.0",
|
||||
"turndown": "^6.0.0",
|
||||
"url-loader": "^4.1.1",
|
||||
"webfonts-loader": "^7.0.1",
|
||||
"webpack": "^4.33.0",
|
||||
"webpack-cli": "^3.3.2",
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/tmp.svg
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
# Generates the favicon images containing unread message counts.
|
||||
|
||||
# Open the SVG and find the number text elements using XPath
|
||||
tree = ET.parse('orig.svg')
|
||||
elems = [tree.getroot().findall(
|
||||
f".//*[@id='{name}']/{{http://www.w3.org/2000/svg}}tspan")[0]
|
||||
for name in ('number_back', 'number_front')]
|
||||
|
||||
for i in range(1, 100):
|
||||
# Prepare a modified SVG
|
||||
s = f'{i:2}'
|
||||
for e in elems:
|
||||
e.text = s
|
||||
with open('tmp.svg', 'wb') as out:
|
||||
tree.write(out)
|
||||
|
||||
# Convert to PNG
|
||||
subprocess.check_call(['inkscape', '--without-gui', '--export-area-page',
|
||||
f'--export-png=../../../static/images/favicon/favicon-{i}.png',
|
||||
'tmp.svg'])
|
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 626 B |
Before Width: | Height: | Size: 645 B |
Before Width: | Height: | Size: 634 B |
Before Width: | Height: | Size: 632 B |
Before Width: | Height: | Size: 645 B |
Before Width: | Height: | Size: 610 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 631 B |
Before Width: | Height: | Size: 645 B |
Before Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 667 B |
Before Width: | Height: | Size: 640 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 668 B |
Before Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 661 B |
Before Width: | Height: | Size: 678 B |
Before Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 693 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 701 B |
Before Width: | Height: | Size: 531 B |
Before Width: | Height: | Size: 688 B |
Before Width: | Height: | Size: 649 B |
Before Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 659 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 685 B |
Before Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 672 B |
Before Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 687 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 692 B |
Before Width: | Height: | Size: 559 B |
Before Width: | Height: | Size: 693 B |
Before Width: | Height: | Size: 649 B |
Before Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 669 B |
Before Width: | Height: | Size: 667 B |
Before Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 659 B |
Before Width: | Height: | Size: 697 B |
Before Width: | Height: | Size: 689 B |
Before Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 620 B |
Before Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 667 B |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 670 B |
Before Width: | Height: | Size: 626 B |
Before Width: | Height: | Size: 676 B |
Before Width: | Height: | Size: 674 B |
Before Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 692 B |
Before Width: | Height: | Size: 694 B |
Before Width: | Height: | Size: 567 B |
Before Width: | Height: | Size: 696 B |
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 678 B |