implement buttons

This commit is contained in:
2019-06-09 01:03:58 +02:00
parent dcac94f5ca
commit 5ea26605d3
4 changed files with 72 additions and 12 deletions

46
static/buttons.js Normal file
View File

@@ -0,0 +1,46 @@
function forward(){
var url = new URL(window.location.href)
var start = url.searchParams.get("start")
var page = url.searchParams.get("page")
if(page){
page = parseInt(page) + 1
}else if(start){
page = Math.trunc(parseInt(start)/100) + 1
}else{
page = 1
}
url.searchParams.set("page", page)
window.location.href = url.href
}
function backward(){
var url = new URL(window.location.href)
var start = url.searchParams.get("start")
var page = url.searchParams.get("page")
if(page){
page = parseInt(page) - 1
if(page < 0){
page = 0
}
}else if(start){
page = Math.trunc(parseInt(start)/100) - 1
}else{
page = 0
}
url.searchParams.set("page", page)
window.location.href = url.href
}
function firstPage(){
var href = window.location.href
var parameterSeperator = "?"
if(href.includes(parameterSeperator)){
window.location.href = href.split(parameterSeperator)[0]
}
}

View File

@@ -11,9 +11,9 @@ body{
.top-bar{
position: fixed;
background-color: orange;
height: 20px;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 10px;
left: 0;
top: 0;
@@ -23,6 +23,7 @@ body{
.top-button{
height: 80%;
float: left;
margin-right: 10px;
background-color: red;