JSFiddle - React, Tailwind, and code Playground
by cgtrman
JavaScript
/* Revision: common.js 2013-02-14 */
/******* Common SSP Javascript code *******/
//initialize datepicker default settings for our app
Date.firstDayOfWeek = 7;
Date.format = 'mm/dd/yyyy';
/******* Define parsers for tablesorter *******/
// BUB - Comment out 02/14/13
$.tablesorter.addParser({
// set a unique id
id: 'filename',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
var filename = s.toLowerCase();
filename = filename.replace(/^.*<a.+">/i,"");
filename = filename.replace(/<\/a>$/i,"");
filename = filename.replace(/^.*<img.+>/i,"");
return filename;
},
// set type, either numeric or text
type: 'text'
});
$.tablesorter.addParser({ //filename/foldername sorting for views with folders and files (eg. supp files v2, kb prop archives)
// set a unique id
id: 'folders_files',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
var filename = s.toLowerCase();
if (filename.match(new RegExp(/trans_spacer.gif/i))) { //determine whether or not there is a trans_spacer.gif here
filename = filename.replace(new RegExp(/^<img.*>\ /i),""); //strip off the entire <img> tag and the space directly after it
} else {
filename = filename.replace(new RegExp(/^.*title="?/i),""); //strip off the stuff before the title attribute (and the 'title=' as well)
filename = filename.replace(new RegExp(/"? alt=.*/i),""); //strip off everything after the title attribute (this one is for IE)
filename = filename.replace(new RegExp(/" class=.*/i),""); //strip off everything after the title attribute (this one is for FF)
if (s.match(new RegExp(/icon_folder_blue.gif/i))) { //determine whether or not this is a directory
//check folders for trailing numbers
var ending_num = new RegExp(/[0-9]+$/).exec(filename);...