Skip to main content

max / makenotwork

837 B · 18 lines History Blame Raw
1 (function() {
2 var cfg = document.getElementById('tab-item-embed-cfg');
3 var hostUrl = cfg.dataset.hostUrl;
4 var itemId = cfg.dataset.itemId;
5 var itemTitle = cfg.dataset.itemTitle;
6
7 window.switchCardLayout = function(layout) {
8 const iframe = document.getElementById('card-preview');
9 const code = document.getElementById('card-code');
10 const w = layout === 'horizontal' ? 600 : 350;
11 const h = layout === 'horizontal' ? 200 : 400;
12 iframe.src = hostUrl + '/embed/i/' + itemId + '/card?layout=' + layout;
13 iframe.width = w;
14 iframe.height = h;
15 code.textContent = '<iframe src="' + hostUrl + '/embed/i/' + itemId + '/card?layout=' + layout + '" width="' + w + '" height="' + h + '" frameborder="0" title="' + itemTitle + ' on Makenotwork"></iframe>';
16 };
17 })();
18