item sorting

This commit is contained in:
q
2016-07-05 13:45:44 +03:00
parent 03139a87b6
commit 9ac90f401b
4 changed files with 20 additions and 3 deletions

View File

@@ -51,3 +51,16 @@ window.onclick = function(event) {
}
}
}
function sortMarkdown() {
var divs = document.getElementsByClassName("entry");
divs = Array.prototype.slice.call(divs, 0);
divs.sort(function(a, b) {
return a.children[1].innerHTML.localeCompare(b.children[1].innerHTML);
});
var parent = document.getElementById('entry_loop');
parent.innerHTML = "";
for(var i = 0, l = divs.length; i < l; i++) {
parent.appendChild(divs[i]);
}
}