summaryrefslogtreecommitdiffstats
path: root/layouts/partials/scripts-front.html
diff options
context:
space:
mode:
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