]> BookStack Code Mirror - hacks/blob - content/iframe-specific-tweaks/layouts/parts/base-body-start.blade.php
ad640f9a3f321d00c27a2b12823cb630a6b50067
[hacks] / content / iframe-specific-tweaks / layouts / parts / base-body-start.blade.php
1 <!-- Check if there's a "iframe=true" query parameter in the request -->
2 @if(request()->query('iframe') === 'true')
3
4     <!-- Set styles for when we're in "iframe mode" -->
5     <!-- Most of these hide elements to provide a simple "embedded view" -->
6     <style>
7         #header,
8         #sidebar,
9         #content .button,
10         .tri-layout-right,
11         .grid.third.gap-xxl,
12         .comments-container,
13         #main-content > .mb-m,
14         .tri-layout-mobile-tabs
15         {
16             display: none
17         }
18
19         .content-wrap.card
20         {
21             margin: 0;
22             border: none;
23             box-shadow: none;
24         }
25     </style>
26
27     <!-- Add a script to control dark-mode via JavaScript -->
28     <!-- if there's also a 'theme' query paramter -->
29     @if(request()->query('theme'))
30         <script nonce="{{ $cspNonce }}">
31             // Use JavaScript to toggle the 'dark-mode' class on the HTML element to enable/disable
32             // dark mode based on whether the `theme` query parameter is 'dark'.
33             document.documentElement.classList.toggle('dark-mode', {{ request()->query('theme') === 'dark' ? 'true' : 'false' }});
34         </script>
35     @endif
36 @endif