display config vars

This commit is contained in:
Baptiste Lemoine 2020-07-20 14:52:44 +02:00
parent b9a34c871b
commit cd6ed45634
6 changed files with 21 additions and 10 deletions

View File

@ -21,26 +21,29 @@ class Conversion {
}
filterToots(toots, options) {
let minchartoots;
let filteredToots = toots;
if(options.showMostRecentTootsOnTop){
filteredToots = filteredToots.reverse();
}
if (options.filterBiggerTottsBeforeSlicing) {
minchartoots = toots.filter(item => {
filteredToots = filteredToots.filter(item => {
return item['object'].content && item['object'].content.length > options.min_length;
});
minchartoots = minchartoots.slice(0, options.max_toots);
filteredToots = filteredToots.slice(0, options.max_toots);
} else {
const slice = toots.slice(0, options.max_toots);
minchartoots = slice.filter(item => {
filteredToots = slice.filter(item => {
return item['object'].content && item['object'].content.length > options.min_length;
});
}
minchartoots.forEach(toot => {
filteredToots.forEach(toot => {
toot = this.findMediaUrl(toot);
toot = this.removeLastChars(toot);
return toot;
});
return minchartoots;
return filteredToots;
}
//

View File

@ -15,6 +15,7 @@ const max_toots = 10; // filter only long toots
const filterBiggerTottsBeforeSlicing = false; // filter only long toots
const filterOnlyHavingMedias = true; // filter only toots having medias
const writeStatsJson = false; // filter only toots having medias
const showMostRecentTootsOnTop = true; // filter only toots having medias
const TemplateVars = {
pageTitle : 'Mastodon export converter to HTML',
likes : jsonParsedLikes,
@ -26,6 +27,7 @@ const TemplateVars = {
filterOnlyHavingMedias,
filterBiggerTottsBeforeSlicing,
writeStatsJson,
showMostRecentTootsOnTop
};
const masto_converter = require('./conversion');

View File

@ -1,6 +1,6 @@
{
"scripts": {
"start": "node main.js"
"start": "nodemon main.js"
},
"dependencies": {
"bulma": "^0.9.0",

View File

@ -33,7 +33,7 @@ a {
}
.media-media-displayed {
min-height: 500px;
min-height: 300px;
margin-right: 1em;
}

View File

@ -1 +1,7 @@
h2 #{outbox.length} of Messages #{outboxTotalLength} in your outbox.First #{max_toots} toots, filtered by a minimal length of #{min_length} characters of content.
h2 Configuration of this page
div.config
p Showing #{outbox.length} of Messages #{outboxTotalLength} in your outbox.First #{max_toots} toots, filtered by a minimal length of #{min_length} characters of content.
p filter bigger toots: #{filterBiggerTottsBeforeSlicing}
p write statistics in output folder #{writeStatsJson}
p showing only toots with medias attached to them #{filterOnlyHavingMedias}
p show most recent toot first #{showMostRecentTootsOnTop}

View File

@ -13,4 +13,4 @@ div.media-gallery
if(media.mediaType.search('image') != -1)
figure.media-media-displayed.media-image
a(href=media.href)
img(src=media.href,alt=media.href)
img(src=media.href,alt=media.href)