summaryrefslogtreecommitdiffstats
path: root/data/js/script.js
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-05-01 23:50:38 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-05 12:21:27 +0200
commita5cde5f11ba4d773bd7b369596f5bb00a0e1666e (patch)
tree537a57e3b02de9ab74e898f921c3971cd2fe04b6 /data/js/script.js
parentb76a85e2992000bd6fa21a58050ffcac0f8fba39 (diff)
Extract tablesorter js and encapsulate
Diffstat (limited to 'data/js/script.js')
-rw-r--r--data/js/script.js63
1 files changed, 0 insertions, 63 deletions
diff --git a/data/js/script.js b/data/js/script.js
index b9f196fab..7b103699a 100644
--- a/data/js/script.js
+++ b/data/js/script.js
@@ -1,68 +1,5 @@
(function($) {
$(function() {
- if (typeof $.tablesorter !== 'undefined') {
- // source: https://projects.archlinux.org/archweb.git/tree/sitestatic/archweb.js
- $.tablesorter.addParser({
- id: 'filesize',
- re: /^(\d+(?:\.\d+)?)(bytes?|[KMGTPEZY]i?B|B)$/,
- is: function(s) {
- return this.re.test(s);
- },
- format: function(s) {
- var matches = this.re.exec(s);
- if (!matches) {
- return 0;
- }
- var size = parseFloat(matches[1]),
- suffix = matches[2];
-
- switch(suffix) {
- /* intentional fall-through at each level */
- case 'YB':
- case 'YiB':
- size *= 1024;
- case 'ZB':
- case 'ZiB':
- size *= 1024;
- case 'EB':
- case 'EiB':
- size *= 1024;
- case 'PB':
- case 'PiB':
- size *= 1024;
- case 'TB':
- case 'TiB':
- size *= 1024;
- case 'GB':
- case 'GiB':
- size *= 1024;
- case 'MB':
- case 'MiB':
- size *= 1024;
- case 'KB':
- case 'KiB':
- size *= 1024;
- }
- return size;
- },
- type: 'numeric'
- });
-
- $(".tablesorter").tablesorter({
- textExtraction: function(node) {
- var attr = $(node).attr('data-sort-value');
- if (typeof attr !== 'undefined' && attr !== false) {
- var intAttr = parseInt(attr);
- if (!isNaN(intAttr)) {
- return intAttr;
- }
- return attr;
- }
- return $(node).text();
- }
- });
- }
-
if ($("img.lazyload").length) {
$("img.lazyload").show().lazyload({treshold: 200});
}