Skip to content

Commit

Permalink
Change to docsify umami plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
EmberLightVFX committed Jul 5, 2024
1 parent fd3402a commit f378bde
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/EmberLightVFX/Camera-Sensor-Database@main/docs/plugins/calculator/bootstrap.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css">
<script defer src="https://uma.emberlight.duckdns.org/uma"
data-website-id="72e753cb-429c-425f-87e2-4d0feeb82685"></script>
<style>
:root {
--theme-hue: 30;
Expand All @@ -59,6 +57,8 @@
subMaxLevel: 0,
sidebarDisplayLevel: 0,
auto2top: true,
umami_src: 'https://uma.emberlight.duckdns.org/uma',
umami_id: '289c3a57-757a-49b6-a125-22fe610bb16d',
calculatorDB: "https://raw.githubusercontent.com/EmberLightVFX/Camera-Sensor-Database/main/data/sensors.json",
calculatorTheme: "dark",
basePath: 'https://raw.githubusercontent.com/EmberLightVFX/Camera-Sensor-Database/master/data/markdown/',
Expand All @@ -68,6 +68,8 @@
<!-- Docsify v4 -->
<script
src="https://cdn.jsdelivr.net/gh/EmberLightVFX/Camera-Sensor-Database@main/docs/plugins/calculator/calculator-plugin.js"></script>
<script
src="https://raw.githubusercontent.com/EmberLightVFX/Camera-Sensor-Database@main/main/docs/plugins/umami/uma.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js"></script>
Expand Down
31 changes: 31 additions & 0 deletions docs/plugins/umami/uma.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(function () {
let install = function (hook, vm) {
if (!$docsify.umami_src) {
console.error('[Docsify] Umami src is required.');
return;
}
if (!$docsify.umami_id) {
console.error('[Docsify] Umami id is required.');
return;
}

// Invoked one time when the docsify instance has mounted on the DOM
hook.mounted(function () {
let script = document.createElement('script');
script.defer = true;
script.src = $docsify.umami_src;
script.setAttribute('data-website-id', $docsify.umami_id);
document.head.appendChild(script);
});

// Invoked on each page load before new markdown is transformed to HTML.
hook.afterEach(function (markdown) {
if (umami) {
umami.track(props => ({ ...props, url: window.location.hash, title: document.title }));
}
});
};

$docsify.plugins = [].concat(install, $docsify.plugins);

}());

0 comments on commit f378bde

Please sign in to comment.