Wait until dom is loaded for adding the theming global

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-01-15 21:34:41 +01:00
parent 14a3bf225e
commit 3ffb03e8f5
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 3 additions and 3 deletions

View File

@ -43,8 +43,8 @@ class InlineJS implements IInline {
function getData(): string {
$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
$responseJS = '(function() {
OCA.Theming = {
$responseJS = 'document.addEventListener(\'DOMContentLoaded\', function() {
window.OCA.Theming = {
name: ' . json_encode($this->themingDefaults->getName()) . ',
url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ',
slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ',
@ -54,7 +54,7 @@ class InlineJS implements IInline {
inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getColorPrimary())) . ',
cacheBuster: ' . json_encode($cacheBusterValue) . '
};
})();';
});';
return $responseJS;
}
}