mirror of
https://github.com/simon987/sist2.git
synced 2025-04-19 18:26:43 +00:00
Generate random seed when ?sort=random param is specified
This commit is contained in:
parent
38fba363f2
commit
4ec54c9a32
9
sist2-vue/dist/css/chunk-vendors.css
vendored
9
sist2-vue/dist/css/chunk-vendors.css
vendored
File diff suppressed because one or more lines are too long
1
sist2-vue/dist/css/index.css
vendored
1
sist2-vue/dist/css/index.css
vendored
File diff suppressed because one or more lines are too long
33
sist2-vue/dist/index.html
vendored
33
sist2-vue/dist/index.html
vendored
@ -1,3 +1,32 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>sist2</title><link href="css/chunk-vendors.css" rel="preload" as="style"><link href="css/index.css" rel="preload" as="style"><link href="js/chunk-vendors.js" rel="preload" as="script"><link href="js/index.js" rel="preload" as="script"><link href="css/chunk-vendors.css" rel="stylesheet"><link href="css/index.css" rel="stylesheet"></head><body><noscript><style>body {
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'/>
|
||||||
|
|
||||||
|
<title>sist2</title>
|
||||||
|
<link href="js/chunk-vendors.js" rel="preload" as="script"><link href="js/index.js" rel="preload" as="script"></head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
height: initial;
|
height: initial;
|
||||||
}</style><div style="text-align: center; margin-top: 100px"><strong>We're sorry but sist2 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong><br><strong>Nous sommes désolés mais sist2 ne fonctionne pas correctement si JavaScript est activé. Veuillez l'activer pour continuer.</strong></div></noscript><div id="app"></div><script src="js/chunk-vendors.js"></script><script src="js/index.js"></script></body></html>
|
}
|
||||||
|
</style>
|
||||||
|
<div style="text-align: center; margin-top: 100px">
|
||||||
|
<strong>
|
||||||
|
We're sorry but sist2 doesn't work properly without JavaScript enabled.
|
||||||
|
Please enable it to continue.
|
||||||
|
</strong>
|
||||||
|
<br/>
|
||||||
|
<strong>
|
||||||
|
Nous sommes désolés mais sist2 ne fonctionne pas correctement
|
||||||
|
si JavaScript est activé.
|
||||||
|
Veuillez l'activer pour continuer.
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="text/javascript" src="js/chunk-vendors.js"></script><script type="text/javascript" src="js/index.js"></script></body>
|
||||||
|
</html>
|
||||||
|
19534
sist2-vue/dist/js/chunk-vendors.js
vendored
19534
sist2-vue/dist/js/chunk-vendors.js
vendored
File diff suppressed because one or more lines are too long
4102
sist2-vue/dist/js/index.js
vendored
4102
sist2-vue/dist/js/index.js
vendored
File diff suppressed because one or more lines are too long
@ -60,7 +60,6 @@ export default {
|
|||||||
color: #222 !important;
|
color: #222 !important;
|
||||||
font-size: 1.75rem;
|
font-size: 1.75rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: Hack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-brand:hover {
|
.navbar-brand:hover {
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {randomSeed} from "@/util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SortSelect",
|
name: "SortSelect",
|
||||||
computed: {
|
computed: {
|
||||||
@ -52,7 +54,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
onSelect(sortMode) {
|
onSelect(sortMode) {
|
||||||
if (sortMode === "random") {
|
if (sortMode === "random") {
|
||||||
this.$store.commit("setSeed", Math.round(Math.random() * 100000));
|
this.$store.commit("setSeed", randomSeed());
|
||||||
}
|
}
|
||||||
this.$store.commit("setSortMode", sortMode);
|
this.$store.commit("setSortMode", sortMode);
|
||||||
}
|
}
|
||||||
|
2
sist2-vue/src/plugins/bootstrap-vue.js
vendored
2
sist2-vue/src/plugins/bootstrap-vue.js
vendored
@ -2,6 +2,6 @@ import Vue from "vue"
|
|||||||
|
|
||||||
import BootstrapVue from "bootstrap-vue"
|
import BootstrapVue from "bootstrap-vue"
|
||||||
import "bootstrap/dist/css/bootstrap.min.css"
|
import "bootstrap/dist/css/bootstrap.min.css"
|
||||||
import "bootstrap-vue/dist/bootstrap-vue.css"
|
import "bootstrap-vue/dist/bootstrap-vue.min.css"
|
||||||
|
|
||||||
Vue.use(BootstrapVue)
|
Vue.use(BootstrapVue)
|
||||||
|
@ -2,7 +2,7 @@ import Vue from "vue"
|
|||||||
import Vuex from "vuex"
|
import Vuex from "vuex"
|
||||||
import VueRouter, {Route} from "vue-router";
|
import VueRouter, {Route} from "vue-router";
|
||||||
import {EsHit, EsResult, EsTag, Index, Tag} from "@/Sist2Api";
|
import {EsHit, EsResult, EsTag, Index, Tag} from "@/Sist2Api";
|
||||||
import {deserializeMimes, serializeMimes} from "@/util";
|
import {deserializeMimes, randomSeed, serializeMimes} from "@/util";
|
||||||
|
|
||||||
const CONF_VERSION = 2;
|
const CONF_VERSION = 2;
|
||||||
|
|
||||||
@ -241,6 +241,9 @@ export default new Vuex.Store({
|
|||||||
|
|
||||||
if (route.query.sort) {
|
if (route.query.sort) {
|
||||||
commit("setSortMode", route.query.sort);
|
commit("setSortMode", route.query.sort);
|
||||||
|
if (route.query.sort === "random" && route.query.seed === undefined) {
|
||||||
|
route.query.seed = randomSeed().toString();
|
||||||
|
}
|
||||||
commit("setSeed", Number(route.query.seed));
|
commit("setSeed", Number(route.query.seed));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -163,3 +163,7 @@ export function decompressMime(mime: string): string {
|
|||||||
.replace(",", "+")
|
.replace(",", "+")
|
||||||
.replace("X", "x-")
|
.replace("X", "x-")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function randomSeed(): number {
|
||||||
|
return Math.round(Math.random() * 100000);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user