+// Javascript for index page: mostly counters updating
new Vue({
el: "#indexPage",
data: {
},
computed: {
sortedCounts: function () {
- const variantsCounts = variantArray.map( v => {
+ const variantsCounts = variantArray
+ .filter( v => {
+ return v.name.startsWith(this.curPrefix);
+ })
+ .map( v => {
return {
name: v.name,
desc: v.description,
},
created: function() {
const url = socketUrl;
- // random enough (TODO: function)
- const sid = (Date.now().toString(36) + Math.random().toString(36).substr(2, 7)).toUpperCase();
+ const sid = getRandString();
this.conn = new WebSocket(url + "/?sid=" + sid + "&page=index");
const socketMessageListener = msg => {
const data = JSON.parse(msg.data);
}
// ...ignore everything else
};
+ // Show welcome dialog box if "first visit"
+ const visited = getCookie("visited");
+ if (!visited || visited !== "1")
+ document.getElementById("modalB4welcome").checked = true;
+ },
+ methods: {
+ showWelcomeMsg: function() {
+ document.getElementById("modalB4welcome").checked = false;
+ document.getElementById("modalWelcome").checked = true;
+ },
+ markAsVisited: function() {
+ setCookie('visited', '1');
+ document.getElementById('modalWelcome').checked = false;
+ },
},
});