arooly,
function compare(c, e) {
var f = document.querySelectorAll(".items");
[].forEach.call(f, function(d) {
[].slice.call(d.querySelectorAll(".item"), 0).sort(function(a, b) {
a = a.querySelector(c).textContent;
b = b.querySelector(c).textContent;
return e ? b - a : a - b
}).forEach(function(a, b) {
d.appendChild(a)
})
})
};