improved ui a bit
This commit is contained in:
1 parent
002ca66666
commit
cbb4d0a674
5 files changed
+112
-35
No files matched your search
+18
-5
@@ -6,6 +6,9 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>JS Reading App</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/styles/default.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-light.min.css">
|
||||
|
||||
<script src="https://unpkg.com/htmx.org@1.9.9"></script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -25,12 +28,22 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function getDefaultIndex(){
|
||||
if(document.location.hash.length > 1){
|
||||
return document.location.hash.substr(1)
|
||||
|
||||
function getIndexFromHash(){
|
||||
if(document.location.hash.length < 2){
|
||||
return null;
|
||||
}
|
||||
return localStorage.getItem("defaultIndex") || '0';
|
||||
const ret = document.location.hash.substr(1)
|
||||
if(isNaN(ret)){
|
||||
return ret;
|
||||
}
|
||||
return parseInt(ret) - 1;
|
||||
}
|
||||
|
||||
function getDefaultIndex(){
|
||||
return getIndexFromHash() || localStorage.getItem("defaultIndex") || '0';
|
||||
}
|
||||
|
||||
document.body.addEventListener('htmx:configRequest', function(evt) {
|
||||
evt.detail.headers.session = localStorage.getItem("seed");
|
||||
evt.detail.path = evt.detail.path.replace(":seed", localStorage.getItem("seed"));
|
||||
@@ -46,7 +59,7 @@
|
||||
if(isNaN(evt.detail.value)){
|
||||
return;
|
||||
}
|
||||
document.location.hash = evt.detail.value
|
||||
document.location.hash = parseInt(evt.detail.value) + 1;
|
||||
localStorage.setItem("defaultIndex", evt.detail.value);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user