remove theme-specific code from the globally-applied site.js file

This commit is contained in:
mappu 2016-04-18 19:42:55 +12:00
parent 12eb8a2111
commit 39789220a8

View File

@ -1,6 +1,10 @@
(function() {
"use strict";
//
// Tag support
//
var show_all = function() {
var tr = document.querySelectorAll(".projtable tr");
for (var i = 0, e = tr.length; i !== e; ++i) {
@ -39,6 +43,18 @@
};
};
window.addEventListener('load', function() {
var taglinks = document.querySelectorAll(".tag-link");
for (var i = 0, e = taglinks.length; i !== e; ++i) {
var tag = taglinks[i].getAttribute("data-tag");
taglinks[i].addEventListener('click', get_show_tag(tag));
}
});
//
// Sort support (theme opt-in)
//
var sort_rows = function(cb) {
var tr = document.querySelectorAll(".projtable tr");
var items = [];
@ -56,42 +72,29 @@
}
};
var sort_update = function() {
var cb;
switch(document.getElementById('sortorder').value) {
var sort_update = function(sort_by) {
switch(sort_by) {
case 'a':
default: {
cb = function(el) {
sort_rows(function(el) {
return el.getAttribute('data-sort-ct');
};
});
} break;
case 'b': {
cb = function(el) {
sort_rows(function(el) {
return el.getAttribute('data-sort-mt');
}
});
} break;
case 'c': {
cb = function(el) {
sort_rows(function(el) {
return el.getAttribute('data-sort-al');
}
});
} break;
};
sort_rows(cb);
};
window.addEventListener('load', function() {
var taglinks = document.querySelectorAll(".tag-link");
for (var i = 0, e = taglinks.length; i !== e; ++i) {
var tag = taglinks[i].getAttribute("data-tag");
taglinks[i].addEventListener('click', get_show_tag(tag));
}
window.sortUpdate = sort_update;
var so = document.getElementById('sortorder');
if (so) {
so.addEventListener('change', sort_update);
sort_update();
}
});
})();