diff options
author | Lukas Winkler <github@lw1.at> | 2018-03-23 06:46:55 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2018-03-23 06:46:55 +0300 |
commit | 668ab5a92441e3c228a9641e2af3e85250e57af3 (patch) | |
tree | d496df9643a55a919f4e8466a7ccd0861fcfc452 /plugins/CoreHome/templates | |
parent | 27ce0a8f24d463fd8fb4f248f76ed35cce434514 (diff) |
better adblock detection (#12493)
* better adblock detection
also check for CSS and JS
* Move the adblock notice messages to the bottom
Diffstat (limited to 'plugins/CoreHome/templates')
-rw-r--r-- | plugins/CoreHome/templates/_adblockDetect.twig | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/plugins/CoreHome/templates/_adblockDetect.twig b/plugins/CoreHome/templates/_adblockDetect.twig index ec69ffecf8..f60d2ac0e3 100644 --- a/plugins/CoreHome/templates/_adblockDetect.twig +++ b/plugins/CoreHome/templates/_adblockDetect.twig @@ -22,14 +22,20 @@ } if (wasMostLikelyCausedByAdblock) { - var warning = document.createElement('h3'); - warning.innerHTML = '{{ 'CoreHome_AdblockIsMaybeUsed'|translate|e('js') }}'; + var shouldGetHiddenElement = document.getElementById("should-get-hidden"); + var warning = document.createElement('p'); + warning.innerText = '{{ 'CoreHome_AdblockIsMaybeUsed'|translate|e('js') }}'; - body[0].appendChild(warning); - warning.style.color = 'red'; - warning.style.fontWeight = 'bold'; - warning.style.marginLeft = '16px'; - warning.style.marginBottom = '16px'; + if (shouldGetHiddenElement) { + shouldGetHiddenElement.appendChild(warning); + } else { + body[0].insertBefore(warning, body[0].firstChild); + warning.style.color = 'red'; + warning.style.fontWeight = 'bold'; + warning.style.marginLeft = '16px'; + warning.style.marginBottom = '16px'; + warning.style.fontSize = '20px'; + } } })(); } |