diff --git a/sortt.js b/sortt.js index 1943758..d85013d 100644 --- a/sortt.js +++ b/sortt.js @@ -8,21 +8,7 @@ */ - -// test if jQuery is available -if(!window.jQuery) { - console.log("sortt.js: ERROR no jQuery found!"); -} else { - - //use JQuery to bind event on each with a "data-sortt" attribute - $('th').each(function() { - if ($(this)[0].dataset.sortt) $(this).on('click', function(e) { - var data = $(this)[0].dataset.sortt; - data = data.split(","); - sortt(data[0],data[1],data[2]); - }); - }); -} +//Declare Functions //create global function with main routine window.sortt=function(normsort,revsort,isdefault){ @@ -58,3 +44,21 @@ window.sortt=function(normsort,revsort,isdefault){ //open url window.location.replace(url.href); }; + + +//USE Functions + +// test if jQuery is available +if(!window.jQuery) { + console.log("sortt.js: ERROR no jQuery found!"); +} else { + + //use JQuery to bind event on each with a "data-sortt" attribute + $('th').each(function() { + if ($(this)[0].dataset.sortt) $(this).on('click', function(e) { + var data = $(this)[0].dataset.sortt; + data = data.split(","); + sortt(data[0],data[1],data[2]); + }); + }); +}