if (document.readyState !== 'complete') { window.addEventListener('load', redirectAndReplaceContentWithLink); } else { redirectAndReplaceContentWithLink(); } function yatteeUrl() { return window.location.href.replace(/^https?:\/\//, 'yattee://'); } function yatteeLink() { return 'Open in Yattee'; } function redirect() { window.location.href = yatteeUrl() } function replaceContentWithLink() { document.querySelector('body').innerHTML = '