summaryrefslogtreecommitdiffstats
path: root/layouts/partials/scripts-front.html
diff options
context:
space:
mode:
authorDSRKafuU2020-06-04 07:21:13 -0500
committerGitHub2020-06-04 07:21:13 -0500
commit73244a2e55dffa158027126346eefd5bafa5fea8 (patch)
treec98ee9fbdb6f474579aa769a2a4b0b4c98fd21f1 /layouts/partials/scripts-front.html
parentaa5290aeef9df1c583fdf30290351968df9215dc (diff)
parent914bf54c493b299268c293be33a8babf99b1cce2 (diff)
downloadhugo-theme-fuji-73244a2e55dffa158027126346eefd5bafa5fea8.tar.gz
hugo-theme-fuji-73244a2e55dffa158027126346eefd5bafa5fea8.tar.bz2
hugo-theme-fuji-73244a2e55dffa158027126346eefd5bafa5fea8.zip
Merge pull request #24 from amzrk2/dev
v2 pre-release
Diffstat (limited to 'layouts/partials/scripts-front.html')
-rw-r--r--layouts/partials/scripts-front.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/layouts/partials/scripts-front.html b/layouts/partials/scripts-front.html
new file mode 100644
index 0000000..c516aad
--- /dev/null
+++ b/layouts/partials/scripts-front.html
@@ -0,0 +1,28 @@
+<script data-cfasync="false">
+ // detect theme data in localStorage
+ var fujiThemeData = localStorage.getItem('fuji_data-theme');
+ // if first look, set theme mode to auto
+ if (!fujiThemeData) {
+ localStorage.setItem('fuji_data-theme', 'auto');
+ } else {
+ // if not auto mode, change the data-theme attribute of body
+ if (fujiThemeData !== 'auto') {
+ document.body.setAttribute('data-theme', fujiThemeData === 'dark' ? 'dark' : 'light');
+ }
+ }
+</script>
+<script data-cfasync="false">
+ // ie detection
+ var ua = window.navigator.userAgent;
+
+ function browserDetection() {
+ if (ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0 || ua.indexOf('Edge/') > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ if (browserDetection()) {
+ window.location.href('{{ "/ie/" | absURL }}');
+ }
+</script> \ No newline at end of file