User:Lukehollis/common.js

console.log("hello wp");

// example code // https://cdn.pannellum.org/2.5/pannellum.htm#panorama=https%3A//static.mused.org/apophis_highlight_test.png

function embedPanoviewer { var fileDiv = document.getElementById('file'); var links = document.getElementsByTagName('a'); for (var i = 0; i < links.length; i++) { var link = links[i]; if (link.href.indexOf('panoviewer') !== -1) { var iframe = document.createElement('iframe'); iframe.width = '100%'; iframe.height = '400'; iframe.allowFullscreen = true; iframe.style.border = 'none'; iframe.src = link.href; if (fileDiv) { fileDiv.innerHTML = ''; fileDiv.appendChild(iframe); } else { document.body.appendChild(iframe); }     break; } } }

window.addEventListener('load', embedPanoviewer);