Skip to content

Commit

Permalink
Lazyload + Focus überarbeitet
Browse files Browse the repository at this point in the history
  • Loading branch information
aeberhard committed Jan 19, 2023
1 parent e149c4a commit 96f0a07
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pages/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,19 @@
?>

<script>
window.onload = function(event) {
if (document.getElementById('consent_manager-background')) {
consent_managerBox = document.getElementById('consent_manager-background');
consent_managerBox.classList.remove('consent_manager-hidden');

var focusableEls = consent_managerBox.querySelectorAll('input[type="checkbox"]');//:not([disabled])
var firstFocusableEl = focusableEls[0];
consent_managerBox.focus();
if (firstFocusableEl) firstFocusableEl.focus();
if (window.location.href.indexOf('nofocus') == -1) {
var focusableEls = consent_managerBox.querySelectorAll('input[type="checkbox"]');//:not([disabled])
var firstFocusableEl = focusableEls[0];
consent_managerBox.focus();
if (firstFocusableEl) {
firstFocusableEl.focus();
}
}

consent_managerBox.querySelectorAll('.consent_manager-sitelinks').forEach(function (el) {
el.querySelectorAll('a').forEach(function (link) {
Expand Down Expand Up @@ -154,6 +159,7 @@
document.getElementById('consent_manager-background').classList.remove('consent_manager-hidden');
}
}
}
</script>

</body>
Expand Down Expand Up @@ -249,7 +255,7 @@

$n['field'] .= '<div class="thumbnail-container" title="' . $theme_options['name'] . '" data-theme="' . $themeid . '">';
$n['field'] .= ' <div class="thumbnail">';
$n['field'] .= ' <iframe loading="lazy" class="thumbnailframe" src="?page=consent_manager/theme&preview='.$themeid.'" data-theme="' . $themeid . '" onload="this.style.opacity = 1"></iframe>';
$n['field'] .= ' <iframe loading="lazy" width="1440px" height="900px" class="thumbnailframe" src="?page=consent_manager/theme&preview='.$themeid.'&nofocus" data-theme="' . $themeid . '" onload="this.style.opacity = 1"></iframe>';
$n['field'] .= ' </div>';
$n['field'] .= '</div>';

Expand Down Expand Up @@ -344,7 +350,7 @@

$n['field'] .= '<div class="thumbnail-container" title="' . $theme_options['name'] . '" data-theme="' . $themeid . '">';
$n['field'] .= ' <div class="thumbnail">';
$n['field'] .= ' <iframe loading="lazy" class="thumbnailframe" src="?page=consent_manager/theme&preview='.$themeid.'" data-theme="' . $themeid . '" onload="this.style.opacity = 1"></iframe>';
$n['field'] .= ' <iframe loading="lazy" width="1440px" height="900px" class="thumbnailframe" src="?page=consent_manager/theme&preview='.$themeid.'&nofocus" data-theme="' . $themeid . '" onload="this.style.opacity = 1"></iframe>';
$n['field'] .= ' </div>';
$n['field'] .= '</div>';

Expand Down

0 comments on commit 96f0a07

Please sign in to comment.