diff options
| -rw-r--r--[l---------] | inject/1/apple-touch-icon.png | bin | 23 -> 35739 bytes | |||
| -rw-r--r--[l---------] | inject/1/favicon.ico | bin | 14 -> 4286 bytes | |||
| l--------- | inject/1/icon.svg | 1 | ||||
| -rw-r--r--[l---------] | inject/2/apple-touch-icon.png | bin | 23 -> 45839 bytes | |||
| -rw-r--r--[l---------] | inject/2/favicon.ico | bin | 14 -> 4286 bytes | |||
| l--------- | inject/2/icon.svg | 1 | ||||
| -rw-r--r--[l---------] | inject/3/apple-touch-icon.png | bin | 23 -> 39891 bytes | |||
| -rw-r--r--[l---------] | inject/3/favicon.ico | bin | 14 -> 4286 bytes | |||
| l--------- | inject/3/icon.svg | 1 | ||||
| -rw-r--r--[l---------] | inject/4/apple-touch-icon.png | bin | 23 -> 32119 bytes | |||
| -rw-r--r--[l---------] | inject/4/favicon.ico | bin | 14 -> 4286 bytes | |||
| l--------- | inject/4/icon.svg | 1 | ||||
| -rw-r--r--[l---------] | inject/5/apple-touch-icon.png | bin | 23 -> 35603 bytes | |||
| -rw-r--r--[l---------] | inject/5/favicon.ico | bin | 14 -> 4286 bytes | |||
| l--------- | inject/5/icon.svg | 1 | ||||
| -rw-r--r--[l---------] | inject/6/apple-touch-icon.png | bin | 23 -> 39310 bytes | |||
| -rw-r--r--[l---------] | inject/6/favicon.ico | bin | 14 -> 4286 bytes | |||
| l--------- | inject/6/icon.svg | 1 | ||||
| -rw-r--r-- | inject/company-switcher.css | 4 | ||||
| -rw-r--r-- | inject/company-switcher.js | 38 | ||||
| -rwxr-xr-x | inject/make-icons.sh | 12 |
21 files changed, 57 insertions, 3 deletions
diff --git a/inject/1/apple-touch-icon.png b/inject/1/apple-touch-icon.png Binary files differindex 2eb3b7a..842b53f 120000..100644 --- a/inject/1/apple-touch-icon.png +++ b/inject/1/apple-touch-icon.png diff --git a/inject/1/favicon.ico b/inject/1/favicon.ico Binary files differindex cf3a36c..d3a7ecc 120000..100644 --- a/inject/1/favicon.ico +++ b/inject/1/favicon.ico 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 Binary files differindex 2eb3b7a..836c850 120000..100644 --- a/inject/2/apple-touch-icon.png +++ b/inject/2/apple-touch-icon.png diff --git a/inject/2/favicon.ico b/inject/2/favicon.ico Binary files differindex cf3a36c..084cfb0 120000..100644 --- a/inject/2/favicon.ico +++ b/inject/2/favicon.ico 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 Binary files differindex 2eb3b7a..9e53e46 120000..100644 --- a/inject/3/apple-touch-icon.png +++ b/inject/3/apple-touch-icon.png diff --git a/inject/3/favicon.ico b/inject/3/favicon.ico Binary files differindex cf3a36c..3b18ed0 120000..100644 --- a/inject/3/favicon.ico +++ b/inject/3/favicon.ico 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 Binary files differindex 2eb3b7a..a741f85 120000..100644 --- a/inject/4/apple-touch-icon.png +++ b/inject/4/apple-touch-icon.png diff --git a/inject/4/favicon.ico b/inject/4/favicon.ico Binary files differindex cf3a36c..2e2f237 120000..100644 --- a/inject/4/favicon.ico +++ b/inject/4/favicon.ico 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 Binary files differindex 2eb3b7a..165b4a5 120000..100644 --- a/inject/5/apple-touch-icon.png +++ b/inject/5/apple-touch-icon.png diff --git a/inject/5/favicon.ico b/inject/5/favicon.ico Binary files differindex cf3a36c..9925ca5 120000..100644 --- a/inject/5/favicon.ico +++ b/inject/5/favicon.ico 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 Binary files differindex 2eb3b7a..7cf556d 120000..100644 --- a/inject/6/apple-touch-icon.png +++ b/inject/6/apple-touch-icon.png diff --git a/inject/6/favicon.ico b/inject/6/favicon.ico Binary files differindex cf3a36c..08816dd 120000..100644 --- a/inject/6/favicon.ico +++ b/inject/6/favicon.ico 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 |
