Make duration and refresh easily configurable
Also increase duration to 10 seconds per post
This commit is contained in:
parent
7edce5ab0f
commit
eb85222ea3
2 changed files with 11 additions and 6 deletions
|
@ -2,5 +2,7 @@
|
||||||
"navbarBrandText": "Netzbegrünung Mastowall",
|
"navbarBrandText": "Netzbegrünung Mastowall",
|
||||||
"defaultServerUrl": "https://gruene.social",
|
"defaultServerUrl": "https://gruene.social",
|
||||||
"navbarColor": "#008939",
|
"navbarColor": "#008939",
|
||||||
|
"duration": 10,
|
||||||
|
"refreshDuration": 30,
|
||||||
"includeReplies": true
|
"includeReplies": true
|
||||||
}
|
}
|
||||||
|
|
15
script.js
15
script.js
|
@ -1,12 +1,6 @@
|
||||||
// The existingPosts array is used to track already displayed posts
|
// The existingPosts array is used to track already displayed posts
|
||||||
let existingPosts = [];
|
let existingPosts = [];
|
||||||
|
|
||||||
// below times are in milliseconds
|
|
||||||
// duration for slide animations
|
|
||||||
let duration = 5000;
|
|
||||||
// refresh rate
|
|
||||||
let refresh = 30000;
|
|
||||||
|
|
||||||
// getUrlParameter helps to fetch URL parameters
|
// getUrlParameter helps to fetch URL parameters
|
||||||
function getUrlParameter(name) {
|
function getUrlParameter(name) {
|
||||||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
||||||
|
@ -40,6 +34,11 @@ const timeAgo = function(seconds) {
|
||||||
};
|
};
|
||||||
|
|
||||||
let includeReplies;
|
let includeReplies;
|
||||||
|
// below times are in milliseconds
|
||||||
|
// duration for slide animations
|
||||||
|
let duration;
|
||||||
|
// refresh rate
|
||||||
|
let refresh;
|
||||||
|
|
||||||
// fetchConfig fetches the configuration from the config.json file
|
// fetchConfig fetches the configuration from the config.json file
|
||||||
const fetchConfig = async function() {
|
const fetchConfig = async function() {
|
||||||
|
@ -48,12 +47,16 @@ const fetchConfig = async function() {
|
||||||
$('#navbar-brand').text(config.navbarBrandText);
|
$('#navbar-brand').text(config.navbarBrandText);
|
||||||
$('.navbar').css('background-color', config.navbarColor);
|
$('.navbar').css('background-color', config.navbarColor);
|
||||||
includeReplies = config.includeReplies;
|
includeReplies = config.includeReplies;
|
||||||
|
duration = config.duration * 1000;
|
||||||
|
refresh = config.refreshDuration * 1000;
|
||||||
return config.defaultServerUrl;
|
return config.defaultServerUrl;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error loading config.json:", error);
|
console.log("Error loading config.json:", error);
|
||||||
$('#navbar-brand').text("Netzbegrünung Mastowall");
|
$('#navbar-brand').text("Netzbegrünung Mastowall");
|
||||||
$('.navbar').css('background-color', "#008939");
|
$('.navbar').css('background-color', "#008939");
|
||||||
includeReplies = true;
|
includeReplies = true;
|
||||||
|
duration = 10000;
|
||||||
|
refresh = 30000;
|
||||||
return "https://gruene.social";
|
return "https://gruene.social";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue