baseof.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. {{/* Copyright Materialize, Inc. All rights reserved. Use of this software is
  2. governed by the Business Source License included in the LICENSE file at the root
  3. of this repository. As of the Change Date specified in that file, in accordance
  4. with the Business Source License, use of this software will be governed by the
  5. Apache License, Version 2.0. */}}
  6. <!DOCTYPE html>
  7. <html>
  8. <head>
  9. {{ partial "head.html" . }}
  10. </head>
  11. <body>
  12. <script>
  13. const theme = localStorage.getItem("theme");
  14. const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
  15. if (theme === null) {
  16. localStorage.setItem("theme", "system");
  17. if (darkMediaQuery.matches) {
  18. document.body.classList.add("dark");
  19. } else {
  20. document.body.classList.add("light");
  21. }
  22. } else if (theme === "dark") {
  23. document.body.classList.add("dark");
  24. } else if (theme === "light") {
  25. document.body.classList.add("light");
  26. } else if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
  27. document.body.classList.add("dark");
  28. } else {
  29. document.body.classList.add("light");
  30. }
  31. </script>
  32. <!-- If a page uses supportlevel svg icons, embed them inline
  33. so they can be referenced via <use> tags. -->
  34. {{ if in .Page.RawContent "supportLevel" }} {{ partial "inline-svgs.html"}}
  35. {{ end }} {{ partial "header.html" . }} {{ block "body" .}}
  36. <div class="content-wrapper">
  37. {{ partial "sidebar.html" . }}
  38. <main
  39. class="content {{ if .Params.make_table_row_headers_searchable }} docsearch_index_table_headers {{ end }}"
  40. >
  41. <button class="show-topics" aria-label="Open the topics sidebar">
  42. <svg
  43. xmlns="http://www.w3.org/2000/svg"
  44. class="ionicon"
  45. viewBox="0 0 512 512"
  46. >
  47. <title>Arrow Pointing to the left</title>
  48. <path
  49. fill="none"
  50. stroke="currentColor"
  51. stroke-linecap="round"
  52. stroke-linejoin="round"
  53. stroke-width="48"
  54. d="M328 112L184 256l144 144"
  55. />
  56. </svg>
  57. All Topics
  58. </button>
  59. <div>
  60. {{ partial "breadcrumbs.html" . }} {{ block "main" . }}{{ end }}
  61. </div>
  62. <a href="#top" class="back-to-top">Back to top &uarr;</a>
  63. <!-- Footer goes in main so the border-right of
  64. sidebar.html can extend to the bottom of the page. -->
  65. {{ partial "footer.html" . }}
  66. </main>
  67. {{ partial "toc.html" . }}
  68. </div>
  69. {{ end }}
  70. <div class="backdrop"></div>
  71. <script>
  72. /* Add anchor links to headings */
  73. anchors.add(
  74. ".content h2, .content h3, .content h4, .content h5, .content h6, .heading"
  75. );
  76. /* Copy anchor links to clipboard on click */
  77. document.addEventListener("click", function (e) {
  78. const target = e.target;
  79. if (target.classList.contains("anchorjs-link")) {
  80. const initialIcon = e.target.getAttribute("data-anchorjs-icon");
  81. e.target.setAttribute("data-anchorjs-icon", "\u2713");
  82. setTimeout(() => {
  83. e.target.setAttribute("data-anchorjs-icon", initialIcon);
  84. }, 1000);
  85. e.preventDefault();
  86. const copyText = target.href;
  87. window.location.assign(target.href);
  88. navigator.clipboard
  89. .writeText(copyText)
  90. .then(() => {
  91. // Successful copy
  92. console.log("Text copied to clipboard: " + copyText);
  93. })
  94. .catch((error) => {
  95. // Error occurred
  96. console.error("Failed to copy text: " + error);
  97. });
  98. }
  99. });
  100. $(".content ol:has(p)").addClass("has-p");
  101. /* Make external links open in new tabs */
  102. $('a[href*="//"]:not([href*="materialize.com"])').attr({
  103. target: "_blank",
  104. title: "External Link",
  105. });
  106. /* Add "Click to Copy" button to code blocks */
  107. $(document).ready(function () {
  108. $("pre.chroma").append(
  109. '<button class="default_button copy_button" title="Copy code to clipboard">Copy</button>'
  110. );
  111. $("pre.chroma button.copy_button").click(function (e) {
  112. var _this = $(this),
  113. copyHex = document.createElement("textarea");
  114. copyHex.value = _this.parent().find("code").text().trim();
  115. document.body.appendChild(copyHex);
  116. copyHex.select();
  117. document.execCommand("copy");
  118. document.body.removeChild(copyHex);
  119. _this.addClass("success").text("Copied");
  120. setTimeout(function () {
  121. _this.removeClass("success").text("Copy");
  122. }, 1000);
  123. window.analytics && window.analytics.track('Button Clicked');
  124. });
  125. });
  126. // Add click handlers for all top-level items with children.
  127. const menus = $("nav[role=navigation] li.has-children");
  128. menus.find("a:not([href])").click((e) => {
  129. $(e.target).parents("li").first().toggleClass("open");
  130. e.preventDefault();
  131. return false;
  132. });
  133. // When an item is already active, and it's clicked, just collapse it
  134. menus.find("a.active").click((e) => {
  135. $(e.target).parents("li").first().toggleClass("open");
  136. e.preventDefault();
  137. return false;
  138. });
  139. // Open the submenu containing the current page by default.
  140. menus.has(".active").addClass("open");
  141. //Scroll the sidebar to the active element
  142. $(".sidebar").scrollTop(
  143. $(".sidebar .active").offset().top - $(window).height() / 2
  144. );
  145. </script>
  146. <script>
  147. const menuToggle = document.querySelector("nav .toggle");
  148. const mobileLinks = document.querySelector(".mobile");
  149. const sidebarOpenButton = document.querySelector("button.show-topics");
  150. const sidebarCloseButton = document.querySelector("button.close-topics");
  151. const sidebarWrapper = document.querySelector(".sidebar-wrapper");
  152. const backdrop = document.querySelector(".backdrop");
  153. const allTables = document.querySelectorAll("table");
  154. allTables.forEach((table) => {
  155. table.outerHTML = `<div class="table-container">${table.outerHTML}</div>`;
  156. });
  157. const toggleBodyOverflow = (boolean) => {
  158. if (boolean) {
  159. document.documentElement.style.overflowY = "scroll";
  160. } else {
  161. document.documentElement.style.overflowY = "hidden";
  162. }
  163. };
  164. sidebarOpenButton.addEventListener("click", () => {
  165. sidebarWrapper.classList.add("shown");
  166. backdrop.style.display = "block";
  167. toggleBodyOverflow(false);
  168. });
  169. const closeSidebar = () => {
  170. sidebarWrapper.classList.remove("shown");
  171. backdrop.style.display = "none";
  172. toggleBodyOverflow(true);
  173. };
  174. sidebarCloseButton.addEventListener("click", () => {
  175. closeSidebar();
  176. });
  177. backdrop.addEventListener("click", () => {
  178. closeSidebar();
  179. });
  180. menuToggle.addEventListener("click", () => {
  181. menuToggle.classList.toggle("open");
  182. if (menuToggle.classList.contains("open")) {
  183. mobileLinks.style.display = "block";
  184. toggleBodyOverflow(false);
  185. } else {
  186. mobileLinks.style.display = "none";
  187. toggleBodyOverflow(true);
  188. }
  189. });
  190. const query = window.matchMedia("(max-width: 850px)");
  191. query.addEventListener("change", (e) => {
  192. if (!e.matches) {
  193. mobileLinks.style.display = "none";
  194. menuToggle.classList.remove("open");
  195. toggleBodyOverflow(true);
  196. backdrop.style.display = "none";
  197. }
  198. });
  199. const systemButton = document.querySelector("button.system");
  200. const lightButton = document.querySelector("button.light");
  201. const darkButton = document.querySelector("button.dark");
  202. const highlightButton = (theme) => {
  203. [systemButton, lightButton, darkButton].forEach((button) => {
  204. if ([...button.classList].includes(theme)) {
  205. button.classList.add("active");
  206. } else {
  207. button.classList.remove("active");
  208. }
  209. });
  210. };
  211. highlightButton(theme);
  212. darkMediaQuery.addEventListener("change", () => {
  213. const storedTheme = localStorage.getItem("theme");
  214. if (storedTheme === "system") {
  215. highlightButton(storedTheme);
  216. if (darkMediaQuery.matches) {
  217. document.body.classList.replace("light", "dark");
  218. } else {
  219. document.body.classList.replace("dark", "light");
  220. }
  221. }
  222. });
  223. systemButton.addEventListener("click", () => {
  224. if (darkMediaQuery.matches) {
  225. document.body.classList.replace("light", "dark");
  226. } else {
  227. document.body.classList.replace("dark", "light");
  228. }
  229. localStorage.setItem("theme", "system");
  230. highlightButton("system");
  231. });
  232. lightButton.addEventListener("click", () => {
  233. document.body.classList.replace("dark", "light");
  234. localStorage.setItem("theme", "light");
  235. highlightButton("light");
  236. });
  237. darkButton.addEventListener("click", () => {
  238. document.body.classList.replace("light", "dark");
  239. localStorage.setItem("theme", "dark");
  240. highlightButton("dark");
  241. });
  242. const allLinks = document.querySelectorAll("a");
  243. console.log(allLinks.length);
  244. allLinks.forEach((link) => {
  245. const firstChild = link.children[0];
  246. if (firstChild) {
  247. if (firstChild.nodeName === "CODE") {
  248. link.classList.add("link-with-code");
  249. }
  250. }
  251. });
  252. const preferenceButton = document.querySelector("#cookie-preference");
  253. preferenceButton.addEventListener("click", () => {
  254. window.Osano.cm.showDrawer('osano-cm-dom-info-dialog-open');
  255. })
  256. </script>
  257. </body>
  258. </html>