diff --git a/shop.py b/shop.py index 12e226d..a764b84 100644 --- a/shop.py +++ b/shop.py @@ -128,6 +128,7 @@ def show_shop(shopid): content=open(data_file, 'rt').read().decode('utf-8') for i,row in enumerate(open( data_file, 'rt').read().decode('utf-8').split("\n")): # any parsing magick would be here + row=row.rstrip() if row=="": continue icon=" " diff --git a/static/script.js b/static/script.js index 4950222..ee08ebb 100644 --- a/static/script.js +++ b/static/script.js @@ -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]); + } +} diff --git a/templates/layout.html b/templates/layout.html index 1025731..b70b6a4 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -29,6 +29,7 @@