feat: add website root path settings (#1)

* feat: add website root path settings
* fix: disable cloudflare rocket-loader for iframe-resizer
This commit is contained in:
Axel Cocat 2022-03-16 23:39:45 +01:00 committed by GitHub
parent 1b7e975080
commit b8de1cbc8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 86 additions and 60 deletions

View file

@ -6,22 +6,31 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{title}}</title>
<link rel="stylesheet" type="text/css" href="/css/bulma.min.css">
<link rel="stylesheet" type="text/css" href="/css/armory.css">
<link rel="stylesheet" type="text/css" href="{{websiteRoot}}/css/bulma.min.css">
<link rel="stylesheet" type="text/css" href="{{websiteRoot}}/css/armory.css">
</head>
<body>
<script type="application/javascript">
const handlebarsData = {{{JSONstringify locals}}};
</script>
<script type="application/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
{{#if iframeMode.enabled}}
<script type="application/javascript">
if (window === window.parent) {
// If not embedded, redirect to the main website with the iframe in it
window.location.href = `{{iframeMode.url}}/?${window.location.pathname.trim().replace(/^\//, "")}`;
window.location.href = `{{iframeMode.url}}/?${window.location.pathname.trim().replace(handlebarsData.websiteRoot, "").replace(/^\//, "")}`;
}
</script>
<script type="application/javascript" src="/js/sync-url.js"></script>
<script type="application/javascript" src="https://cdn.jsdelivr.net/npm/iframe-resizer@4.3.2/js/iframeResizer.contentWindow.min.js"></script>
<script type="application/javascript" src="{{websiteRoot}}/js/sync-url.js"></script>
<script type="application/javascript" data-cfasync="false" src="https://cdn.jsdelivr.net/npm/iframe-resizer@4.3.2/js/iframeResizer.contentWindow.min.js"></script>
<script type="application/javascript">
$(window).on("load", () => {
window.parent.postMessage("contentLoaded", "*");
});
</script>
{{/if}}
<script type="application/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<section class="section">
{{{ body }}}