-
Notifications
You must be signed in to change notification settings - Fork 0
/
extend.php
39 lines (34 loc) · 1.4 KB
/
extend.php
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
33
34
35
36
37
38
39
<?php
namespace DaleZ\fluentflarum;
use Flarum\Extend;
use Flarum\Frontend\Document;
return [
(new Extend\Frontend('forum'))
->content(function (Document $document) {
$document->head[] = '<script>(function () {
var r = getComputedStyle(document.querySelector(":root"));
function changeTitleColor() {
if (r.getPropertyValue("--colored-titlebar") === "false") {
var m = document.querySelector(`meta[name="theme-color"]`);
m.content = r.getPropertyValue("--header-bg");
};
}
changeTitleColor();
if (r.getPropertyValue("--colored-titlebar") === "false") new Promise(function (resolve) {
var id = setInterval(function () {
if (flarum) {
if (flarum.extensions) {
clearInterval(id);
resolve();
}
}
}, 500)
}).then(function () {
if (flarum.extensions["fof-nightmode"]) {
document.addEventListener("fofnightmodechange", changeTitleColor);
}
});
})();</script>';
})
->css(__DIR__.'/less/forum.less'),
];