mirror of
https://github.com/acanas/swad-core.git
synced 2024-05-29 04:53:26 +02:00
Version 21.58: Nov 21, 2021 Code refactoring in timeline.
This commit is contained in:
parent
733ae0e86d
commit
9d46cff420
|
@ -938,28 +938,10 @@ function readNewTimelineData () {
|
||||||
// ...to the top of UL 'new_timeline_list')
|
// ...to the top of UL 'new_timeline_list')
|
||||||
var newTimeline = document.getElementById('new_timeline_list'); // Access to UL with the new timeline
|
var newTimeline = document.getElementById('new_timeline_list'); // Access to UL with the new timeline
|
||||||
|
|
||||||
for (var i=1; i<=numNotesJustGot; i++) {
|
for (var i=0; i<numNotesJustGot; i++) {
|
||||||
// Check if the last child (the oldest) in just now timeline...
|
// Move node from just now timeline to new timeline
|
||||||
// ...is the last ocurrence of the note
|
newTimeline.insertBefore(justNowTimeline.lastChild, newTimeline.firstChild);
|
||||||
var mostRecentOcurrenceOfNote = true;
|
newTimeline.firstChild.className += " Tml_NEW_PUB";
|
||||||
var lastChildIndex = numNotesJustGot - i;
|
|
||||||
var noteCode = justNowTimeline.lastChild.dataset.noteCode;
|
|
||||||
for (var j=0; j<lastChildIndex; j++)
|
|
||||||
if (justNowTimeline.childNodes[j].dataset.noteCode == noteCode) {
|
|
||||||
mostRecentOcurrenceOfNote = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move or remove node from new timeline
|
|
||||||
if (mostRecentOcurrenceOfNote) {
|
|
||||||
// Move node from just now timeline to new timeline
|
|
||||||
newTimeline.insertBefore(justNowTimeline.lastChild, newTimeline.firstChild);
|
|
||||||
newTimeline.firstChild.className += " Tml_NEW_PUB";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// Remove last child (because is repeated in more recent pubs)
|
|
||||||
justNowTimeline.removeChild(justNowTimeline.lastChild);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update number of new posts
|
// Update number of new posts
|
||||||
|
|
Loading…
Reference in New Issue
Block a user