-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmti.user.js
32 lines (30 loc) · 1.03 KB
/
mti.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name MetaThemeInjector
// @namespace MTI
// @author Eduard Ursu ( @d3ward )
// @version 1.0.1
// @description Auto change meta theme-color
// @match *://*/*
// @run-at document-end
// ==/UserScript==
const injectC = (color) => {
if (document.querySelectorAll('meta[name="theme-color"]').length > 0) {
var metaThemeColor = document.querySelector("meta[name=theme-color]");
metaThemeColor.setAttribute("content", color);
} else {
var link = document.createElement('meta');
link.setAttribute('name', 'theme-color');
link.setAttribute('content', color);
document.getElementsByTagName('head')[0].appendChild(link);
}
}
var color = "white"; //default color on all website
// Set color for facebook.com
if (/facebook\.com/.test(location.hostname)) {
color = "blue";
} else if (/youtube\.com/.test(location.hostname)) {
// Set Color for youtube
color = "youtube";
}
//If you want more add colors add an if with the same syntax above
injectC(color);