add ability to search in fulltext
This commit is contained in:
parent
afef2388dc
commit
7dc1a6332a
@ -33,17 +33,30 @@ class Conversion {
|
||||
let filteredToots = toots;
|
||||
let filter = true;
|
||||
console.log('before slicing filteredToots.length', filteredToots.length)
|
||||
// console.log('filteredToots[0]', filteredToots[0])
|
||||
|
||||
filteredToots = filteredToots.filter(item => {
|
||||
if(item['object'].content){
|
||||
|
||||
item['object'].content = item['object'].content.trim()
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
if (filter) {
|
||||
|
||||
if (options.filterOnlyHavingMedias) {
|
||||
toots = masto_converter.conversion.filterOnlyTootsWithMedias(toots);
|
||||
toots = this.filterOnlyTootsWithMedias(toots);
|
||||
console.log('toots.length only attachements', toots.length);
|
||||
}
|
||||
if (options.showMostRecentTootsOnTop) {
|
||||
filteredToots = filteredToots.reverse();
|
||||
}
|
||||
if (options.searchTerm) {
|
||||
console.log('filtrer les toots ayant pour contenu: ', options.searchTerm);
|
||||
filteredToots = filteredToots.filter(item => {
|
||||
return (item['object'].content && item['object'].content.length && item['object'].content.indexOf(options.searchTerm) !== -1);
|
||||
});
|
||||
}
|
||||
if (options.filterBiggerTootsBeforeSlicing) {
|
||||
console.log('min length of content of toots ', options.min_length );
|
||||
filteredToots = filteredToots.filter(item => {
|
||||
@ -57,11 +70,6 @@ class Conversion {
|
||||
return (item['object'].content && item['object'].content.length >= options.min_length && item['object'].content.length <= options.max_length);
|
||||
});
|
||||
}
|
||||
// filteredToots.forEach(toot => {
|
||||
// toot = this.findMediaUrl(toot);
|
||||
// toot = this.removeLastChars(toot);
|
||||
// return toot;
|
||||
// });
|
||||
console.log('after slicing filteredToots.length', filteredToots.length)
|
||||
|
||||
|
||||
|
16
main.js
16
main.js
@ -13,18 +13,22 @@ var jsonParsedLikes, jsonParsedOutbox;
|
||||
* export configuration.
|
||||
* You can filter the export in the following vars
|
||||
*/
|
||||
const min_length = 300; // minmum character length of toots to display
|
||||
const searchTerm = 'art';
|
||||
const instanceURL = 'https://mastodon.cipherbliss.com';
|
||||
const min_length = 1; // minmum character length of toots to display
|
||||
const max_length = 100000; // max character length of toots to display
|
||||
const max_toots = 200// maximum count of output
|
||||
const filterBiggerTootsBeforeSlicing = false; // filter only long toots
|
||||
const filterOnlyHavingMedias = false; // filter only toots having medias
|
||||
const displayMedias = false; // display medias in toots
|
||||
const max_toots = 30// maximum count of output
|
||||
const filterBiggerTootsBeforeSlicing = true; // filter only long toots
|
||||
const filterOnlyHavingMedias = true; // filter only toots having medias
|
||||
const displayMedias = true; // display medias in toots
|
||||
const showMostRecentTootsOnTop = true; // sorting order
|
||||
// output write
|
||||
const writeStatsJson = false; // write json export file about statistics
|
||||
const writeHtml = false; // write json export file about statistics
|
||||
const writeHtml = true; // write json export file about statistics
|
||||
|
||||
const TemplateVars = {
|
||||
searchTerm,
|
||||
instanceURL,
|
||||
pageTitle : 'Mastodon export converter to HTML',
|
||||
likes : jsonParsedLikes,
|
||||
outbox : jsonParsedOutbox,
|
||||
|
@ -5,7 +5,7 @@ body {
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00a7d1;
|
||||
color: #002736 !important;
|
||||
}
|
||||
|
||||
.status {
|
||||
@ -19,7 +19,9 @@ a {
|
||||
.published {
|
||||
width: 70ch;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
padding-right: 3em;
|
||||
}
|
||||
.date-published {
|
||||
font-size: 0.5em;
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ div.media-gallery
|
||||
audio(src=media.href,controls=controls)
|
||||
if(media.mediaType.search('image') != -1)
|
||||
figure.media-media-displayed.media-image
|
||||
a(href=media.href)
|
||||
img(src=media.href,alt=media.href)
|
||||
a(href=instanceURL+'/system/'+media.url)
|
||||
img(src=instanceURL+'/system/'+media.url,alt=media.url)
|
||||
|
@ -14,7 +14,9 @@ div.container#tootsList
|
||||
i.fa.fa-paperplane-o
|
||||
img.header(src='/avatar.gif')
|
||||
div.date-published=oredredItem['object'].published
|
||||
blockquote.pl-6.published(!=oredredItem['object'].content)
|
||||
blockquote.pl-6.published
|
||||
| !{oredredItem['object'].content.trim()}
|
||||
p.length=(oredredItem['object'].content.length)
|
||||
if oredredItem['object'].attachment && oredredItem['object'].attachment.length
|
||||
if(!displayMedias)
|
||||
sub.font-medium.no-media.bg-orange-300.p-2 Medias are not displayed
|
||||
|
Loading…
Reference in New Issue
Block a user