(function() { var cfg = document.getElementById('tab-item-embed-cfg'); var hostUrl = cfg.dataset.hostUrl; var itemId = cfg.dataset.itemId; var itemTitle = cfg.dataset.itemTitle; window.copyEmbed = function(btn) { const code = btn.previousElementSibling.textContent; navigator.clipboard.writeText(code).then(() => { btn.textContent = 'Copied!'; setTimeout(() => btn.textContent = 'Copy', 1500); }); }; window.switchCardLayout = function(layout) { const iframe = document.getElementById('card-preview'); const code = document.getElementById('card-code'); const w = layout === 'horizontal' ? 600 : 350; const h = layout === 'horizontal' ? 200 : 400; iframe.src = hostUrl + '/embed/i/' + itemId + '/card?layout=' + layout; iframe.width = w; iframe.height = h; code.textContent = ''; }; })();