From ea8ce095f0e7ac61f31b79469d862df56f9d2bbc Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 26 Jun 2025 16:08:32 +0200 Subject: add favicons --- inject/1/apple-touch-icon.png | Bin 23 -> 35739 bytes inject/1/favicon.ico | Bin 14 -> 4286 bytes inject/1/icon.svg | 1 + inject/2/apple-touch-icon.png | Bin 23 -> 45839 bytes inject/2/favicon.ico | Bin 14 -> 4286 bytes inject/2/icon.svg | 1 + inject/3/apple-touch-icon.png | Bin 23 -> 39891 bytes inject/3/favicon.ico | Bin 14 -> 4286 bytes inject/3/icon.svg | 1 + inject/4/apple-touch-icon.png | Bin 23 -> 32119 bytes inject/4/favicon.ico | Bin 14 -> 4286 bytes inject/4/icon.svg | 1 + inject/5/apple-touch-icon.png | Bin 23 -> 35603 bytes inject/5/favicon.ico | Bin 14 -> 4286 bytes inject/5/icon.svg | 1 + inject/6/apple-touch-icon.png | Bin 23 -> 39310 bytes inject/6/favicon.ico | Bin 14 -> 4286 bytes inject/6/icon.svg | 1 + inject/company-switcher.css | 4 +++- inject/company-switcher.js | 38 ++++++++++++++++++++++++++++++++++++-- inject/make-icons.sh | 12 ++++++++++++ 21 files changed, 57 insertions(+), 3 deletions(-) mode change 120000 => 100644 inject/1/apple-touch-icon.png mode change 120000 => 100644 inject/1/favicon.ico create mode 120000 inject/1/icon.svg mode change 120000 => 100644 inject/2/apple-touch-icon.png mode change 120000 => 100644 inject/2/favicon.ico create mode 120000 inject/2/icon.svg mode change 120000 => 100644 inject/3/apple-touch-icon.png mode change 120000 => 100644 inject/3/favicon.ico create mode 120000 inject/3/icon.svg mode change 120000 => 100644 inject/4/apple-touch-icon.png mode change 120000 => 100644 inject/4/favicon.ico create mode 120000 inject/4/icon.svg mode change 120000 => 100644 inject/5/apple-touch-icon.png mode change 120000 => 100644 inject/5/favicon.ico create mode 120000 inject/5/icon.svg mode change 120000 => 100644 inject/6/apple-touch-icon.png mode change 120000 => 100644 inject/6/favicon.ico create mode 120000 inject/6/icon.svg create mode 100755 inject/make-icons.sh (limited to 'inject') diff --git a/inject/1/apple-touch-icon.png b/inject/1/apple-touch-icon.png deleted file mode 120000 index 2eb3b7a..0000000 --- a/inject/1/apple-touch-icon.png +++ /dev/null @@ -1 +0,0 @@ -../apple-touch-icon.png \ No newline at end of file diff --git a/inject/1/apple-touch-icon.png b/inject/1/apple-touch-icon.png new file mode 100644 index 0000000..842b53f Binary files /dev/null and b/inject/1/apple-touch-icon.png differ diff --git a/inject/1/favicon.ico b/inject/1/favicon.ico deleted file mode 120000 index cf3a36c..0000000 --- a/inject/1/favicon.ico +++ /dev/null @@ -1 +0,0 @@ -../favicon.ico \ No newline at end of file diff --git a/inject/1/favicon.ico b/inject/1/favicon.ico new file mode 100644 index 0000000..d3a7ecc Binary files /dev/null and b/inject/1/favicon.ico differ diff --git a/inject/1/icon.svg b/inject/1/icon.svg new file mode 120000 index 0000000..fb0bff9 --- /dev/null +++ b/inject/1/icon.svg @@ -0,0 +1 @@ +../../../../mnt/gmbh/Büro/Einkauf/Logos/04 Icons/TONI KG.svg \ No newline at end of file diff --git a/inject/2/apple-touch-icon.png b/inject/2/apple-touch-icon.png deleted file mode 120000 index 2eb3b7a..0000000 --- a/inject/2/apple-touch-icon.png +++ /dev/null @@ -1 +0,0 @@ -../apple-touch-icon.png \ No newline at end of file diff --git a/inject/2/apple-touch-icon.png b/inject/2/apple-touch-icon.png new file mode 100644 index 0000000..836c850 Binary files /dev/null and b/inject/2/apple-touch-icon.png differ diff --git a/inject/2/favicon.ico b/inject/2/favicon.ico deleted file mode 120000 index cf3a36c..0000000 --- a/inject/2/favicon.ico +++ /dev/null @@ -1 +0,0 @@ -../favicon.ico \ No newline at end of file diff --git a/inject/2/favicon.ico b/inject/2/favicon.ico new file mode 100644 index 0000000..084cfb0 Binary files /dev/null and b/inject/2/favicon.ico differ diff --git a/inject/2/icon.svg b/inject/2/icon.svg new file mode 120000 index 0000000..0af239d --- /dev/null +++ b/inject/2/icon.svg @@ -0,0 +1 @@ +../../../../mnt/gmbh/Büro/Einkauf/Logos/04 Icons/TONI Immo.svg \ No newline at end of file diff --git a/inject/3/apple-touch-icon.png b/inject/3/apple-touch-icon.png deleted file mode 120000 index 2eb3b7a..0000000 --- a/inject/3/apple-touch-icon.png +++ /dev/null @@ -1 +0,0 @@ -../apple-touch-icon.png \ No newline at end of file diff --git a/inject/3/apple-touch-icon.png b/inject/3/apple-touch-icon.png new file mode 100644 index 0000000..9e53e46 Binary files /dev/null and b/inject/3/apple-touch-icon.png differ diff --git a/inject/3/favicon.ico b/inject/3/favicon.ico deleted file mode 120000 index cf3a36c..0000000 --- a/inject/3/favicon.ico +++ /dev/null @@ -1 +0,0 @@ -../favicon.ico \ No newline at end of file diff --git a/inject/3/favicon.ico b/inject/3/favicon.ico new file mode 100644 index 0000000..3b18ed0 Binary files /dev/null and b/inject/3/favicon.ico differ diff --git a/inject/3/icon.svg b/inject/3/icon.svg new file mode 120000 index 0000000..2a74d3d --- /dev/null +++ b/inject/3/icon.svg @@ -0,0 +1 @@ +../../../../mnt/gmbh/Büro/Einkauf/Logos/04 Icons/TONI Neuried.svg \ No newline at end of file diff --git a/inject/4/apple-touch-icon.png b/inject/4/apple-touch-icon.png deleted file mode 120000 index 2eb3b7a..0000000 --- a/inject/4/apple-touch-icon.png +++ /dev/null @@ -1 +0,0 @@ -../apple-touch-icon.png \ No newline at end of file diff --git a/inject/4/apple-touch-icon.png b/inject/4/apple-touch-icon.png new file mode 100644 index 0000000..a741f85 Binary files /dev/null and b/inject/4/apple-touch-icon.png differ diff --git a/inject/4/favicon.ico b/inject/4/favicon.ico deleted file mode 120000 index cf3a36c..0000000 --- a/inject/4/favicon.ico +++ /dev/null @@ -1 +0,0 @@ -../favicon.ico \ No newline at end of file diff --git a/inject/4/favicon.ico b/inject/4/favicon.ico new file mode 100644 index 0000000..2e2f237 Binary files /dev/null and b/inject/4/favicon.ico differ diff --git a/inject/4/icon.svg b/inject/4/icon.svg new file mode 120000 index 0000000..6eca012 --- /dev/null +++ b/inject/4/icon.svg @@ -0,0 +1 @@ +../../../../mnt/gmbh/Büro/Einkauf/Logos/04 Icons/TONI Kompl.svg \ No newline at end of file diff --git a/inject/5/apple-touch-icon.png b/inject/5/apple-touch-icon.png deleted file mode 120000 index 2eb3b7a..0000000 --- a/inject/5/apple-touch-icon.png +++ /dev/null @@ -1 +0,0 @@ -../apple-touch-icon.png \ No newline at end of file diff --git a/inject/5/apple-touch-icon.png b/inject/5/apple-touch-icon.png new file mode 100644 index 0000000..165b4a5 Binary files /dev/null and b/inject/5/apple-touch-icon.png differ diff --git a/inject/5/favicon.ico b/inject/5/favicon.ico deleted file mode 120000 index cf3a36c..0000000 --- a/inject/5/favicon.ico +++ /dev/null @@ -1 +0,0 @@ -../favicon.ico \ No newline at end of file diff --git a/inject/5/favicon.ico b/inject/5/favicon.ico new file mode 100644 index 0000000..9925ca5 Binary files /dev/null and b/inject/5/favicon.ico differ diff --git a/inject/5/icon.svg b/inject/5/icon.svg new file mode 120000 index 0000000..a3f0259 --- /dev/null +++ b/inject/5/icon.svg @@ -0,0 +1 @@ +../../../../mnt/gmbh/Büro/Einkauf/Logos/04 Icons/Krafftwerk.svg \ No newline at end of file diff --git a/inject/6/apple-touch-icon.png b/inject/6/apple-touch-icon.png deleted file mode 120000 index 2eb3b7a..0000000 --- a/inject/6/apple-touch-icon.png +++ /dev/null @@ -1 +0,0 @@ -../apple-touch-icon.png \ No newline at end of file diff --git a/inject/6/apple-touch-icon.png b/inject/6/apple-touch-icon.png new file mode 100644 index 0000000..7cf556d Binary files /dev/null and b/inject/6/apple-touch-icon.png differ diff --git a/inject/6/favicon.ico b/inject/6/favicon.ico deleted file mode 120000 index cf3a36c..0000000 --- a/inject/6/favicon.ico +++ /dev/null @@ -1 +0,0 @@ -../favicon.ico \ No newline at end of file diff --git a/inject/6/favicon.ico b/inject/6/favicon.ico new file mode 100644 index 0000000..08816dd Binary files /dev/null and b/inject/6/favicon.ico differ diff --git a/inject/6/icon.svg b/inject/6/icon.svg new file mode 120000 index 0000000..f60a5a6 --- /dev/null +++ b/inject/6/icon.svg @@ -0,0 +1 @@ +../../../../mnt/gmbh/Büro/Einkauf/Logos/04 Icons/TONI Neuried Kompl.svg \ No newline at end of file diff --git a/inject/company-switcher.css b/inject/company-switcher.css index 1d598d8..b13c3a3 100644 --- a/inject/company-switcher.css +++ b/inject/company-switcher.css @@ -1,6 +1,8 @@ -.o_switch_company_item div:nth-child(1) { +/* Hide the checkboxes: + * .o_switch_company_item div:nth-child(1) { display: none; } +*/ /* Disable the company switcher by preventing pointer events: .o_switch_company_menu button:nth-child(1) { diff --git a/inject/company-switcher.js b/inject/company-switcher.js index b491b8a..3861de5 100644 --- a/inject/company-switcher.js +++ b/inject/company-switcher.js @@ -35,11 +35,44 @@ export function registerObserver() { // as cloning does not copy the event handlers try { let clone = elem.cloneNode(true); - clone.attributes.toni = true + clone.attributes.toni = true // remember this for later + const cid = clone.getAttribute("data-company-id"); + + // Copy title and label from the checkbox child + const col1 = clone.childNodes[0]; + const company = col1.getAttribute("aria-label"); + const iscur = col1.getAttribute("aria-checked"); + col1.removeAttribute("title"); + col1.removeAttribute("aria-label"); + col1.removeAttribute("aria-checked"); + col1.removeAttribute("role"); + col1.setAttribute("style", "width:42px"); + if (iscur == "true") { + col1.classList.add("bg-primary-subtle"); + } + + clone.title = company; + clone.setAttribute("aria-label", company); + clone.setAttribute("aria-pressed", iscur); + + const checkbox = col1.childNodes[0]; + let img = document.createElement("img"); + img.setAttribute("src", `/inject/${cid}/apple-touch-icon.png`); + img.setAttribute("class", "h-100 px-1"); + + col1.replaceChild(img, checkbox); + + const col2 = clone.childNodes[1]; + col2.removeAttribute("title"); + col2.removeAttribute("aria-label"); + col2.removeAttribute("aria-pressed"); + col2.removeAttribute("role"); + + console.warn(clone); + clone.addEventListener('click', () => { // … and we add our own event handler that opens a new window on the // subdomain URL for the other company - const cid = clone.attributes["data-company-id"].value; const url = document.URL.replace(/:\/\/(\d+\.)?odoo/, `://${cid}.odoo`); if (url) { @@ -59,6 +92,7 @@ export function registerObserver() { console.error("URL is empty, clone is:", clone); } }); + elem.parentNode.replaceChild(clone, elem); console.debug("Replaced with TONI clone:", clone); } catch (e) { console.error("While cloning element:", elem, e); } diff --git a/inject/make-icons.sh b/inject/make-icons.sh new file mode 100755 index 0000000..25e858d --- /dev/null +++ b/inject/make-icons.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +for dir in *; do + + [ -d $dir ] || continue + [ ! -L $dir/favicon.ico ] || continue + + convert -transparent white -sample 500x500 $dir/icon.svg $dir/apple-touch-icon.png + convert -transparent white -sample 32x32 $dir/icon.svg $dir/favicon.ico + +done -- cgit v1.2.3