<!-- Second Logo Clickable -->
<script>
(function () {
  var CONFIG = {
    url: 'https://www.relaischateaux.com/de/hotel/capofaro-resort/',
    logoDefault: 'https://media.invisioncic.com/p289038/monthly_2025_12/RELAIS_ET_CHATEAUX_LOGO_Logo-white.thumb.png.bd642b9d46d5256da30e86290b2e946f.png',
    logoShrink: 'https://images.squarespace-cdn.com/content/v1/690b0e974b222924ed85163e/fcd8bfe0-0842-4417-ad3e-bb9edbd4cd73/RELAIS_ET_CHATEAUX_LOGO_Logo.png?format=300w',
    logoWidthDefault: '40px',
    logoWidthShrink: '40px',
    target: '.header-actions.header-actions--right',
    header: 'header#header'
  };

  function createLink() {
    var a = document.createElement('a');
    a.className = 'custom-img';
    a.href = CONFIG.url;
    a.target = '_blank';
    a.rel = 'noopener noreferrer';
    var img = document.createElement('img');
    img.src = CONFIG.logoDefault;
    img.style.width = CONFIG.logoWidthDefault;
    a.appendChild(img);
    return a;
  }

  function updateLogos() {
    var header = document.querySelector(CONFIG.header);
    var isShrink = header && header.classList.contains('shrink');
    document.querySelectorAll('.custom-img img').forEach(function (img) {
      img.src = isShrink ? CONFIG.logoShrink : CONFIG.logoDefault;
      img.style.width = isShrink ? CONFIG.logoWidthShrink : CONFIG.logoWidthDefault;
    });
  }

  function inject() {
    var containers = document.querySelectorAll(CONFIG.target);
    if (!containers.length) return;
    containers.forEach(function (container) {
      container.prepend(createLink());
    });

    var header = document.querySelector(CONFIG.header);
    if (!header) return;
    new MutationObserver(updateLogos).observe(header, { attributes: true, attributeFilter: ['class'] });
  }

  document.addEventListener('DOMContentLoaded', inject);
  document.addEventListener('mercury:load', inject);
})();
</script>
<style>
div.header-display-mobile .header-actions.header-actions--right {
    display: flex !important;
    position: absolute;
    right: 0;
}
</style>

 

Buy me a coffee