show reading times in their own table column
This commit is contained in:
parent
68bc0767f2
commit
0c859e79b0
2 changed files with 12 additions and 14 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "ReadingTime",
|
"name": "ReadingTime",
|
||||||
"author": "Lapineige",
|
"author": "Lapineige",
|
||||||
"description": "Add a reading time estimation next to each article title",
|
"description": "Add a reading time estimation next to each article",
|
||||||
"version": 1.2,
|
"version": 1.2,
|
||||||
"entrypoint": "ReadingTime",
|
"entrypoint": "ReadingTime",
|
||||||
"type": "user"
|
"type": "user"
|
||||||
|
|
|
||||||
|
|
@ -27,19 +27,17 @@
|
||||||
|
|
||||||
flux_list[i].dataset.readingTime = reading_time.reading_time;
|
flux_list[i].dataset.readingTime = reading_time.reading_time;
|
||||||
|
|
||||||
if (document.body.clientWidth <= 840) { // in mobile mode, the feed name is not visible (there is only the favicon)
|
const li = document.createElement("li");
|
||||||
// add the reading time right before article's title
|
li.setAttribute("class", "item date");
|
||||||
// in that case, [Time] - [Title] format is used instead of a "|" (as it looks better and doesn't take much more space)
|
li.style.width = "min-content";
|
||||||
if ( document.querySelector("#" + reading_time.flux.id + " ul.horizontal-list li.item.title a").textContent.substring(0,(reading_time.reading_time + 'm - ').length) != reading_time.reading_time + 'm - ' ) {
|
li.style.minWidth = "40px";
|
||||||
document.querySelector("#" + reading_time.flux.id + " ul.horizontal-list li.item.title a").textContent = reading_time.reading_time + 'm - ' + document.querySelector("#" + reading_time.flux.id + " ul.horizontal-list li.item.title a").textContent;
|
li.style.overflow = "hidden";
|
||||||
}
|
li.style.textAlign = "right";
|
||||||
} else {
|
li.style.display = "table-cell";
|
||||||
// add the reading time just after the feed name
|
li.textContent = "" + reading_time.reading_time + '\u2009m';
|
||||||
if ( document.querySelector("#" + reading_time.flux.id + " ul.horizontal-list li.item.website").textContent.substring(1, (reading_time.reading_time + 'm|').length + 1) != reading_time.reading_time + 'm|' ) {
|
|
||||||
document.querySelector("#" + reading_time.flux.id + " ul.horizontal-list li.item.website").childNodes[0].childNodes[2].textContent = reading_time.reading_time + 'm| ' + document.querySelector("#" + reading_time.flux.id + " ul.horizontal-list li.item.website").childNodes[0].childNodes[2].textContent;
|
const ul = document.querySelector("#" + reading_time.flux.id + " ul.horizontal-list");
|
||||||
}
|
ul.insertBefore(li, ul.children[ul.children.length - 1]);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue