Add JS files
This commit is contained in:
@@ -0,0 +1,958 @@
|
||||
/*!
|
||||
* tablesorter pager plugin
|
||||
* updated 9/15/2014 (v2.17.8)
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function($) {
|
||||
"use strict";
|
||||
/*jshint supernew:true */
|
||||
var ts = $.tablesorter;
|
||||
|
||||
$.extend({ tablesorterPager: new function() {
|
||||
|
||||
this.defaults = {
|
||||
// target the pager markup
|
||||
container: null,
|
||||
|
||||
// use this format: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}"
|
||||
// where {page} is replaced by the page number, {size} is replaced by the number of records to show,
|
||||
// {sortList:col} adds the sortList to the url into a "col" array, and {filterList:fcol} adds
|
||||
// the filterList to the url into an "fcol" array.
|
||||
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
|
||||
// and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url
|
||||
ajaxUrl: null,
|
||||
|
||||
// modify the url after all processing has been applied
|
||||
customAjaxUrl: function(table, url) { return url; },
|
||||
|
||||
// modify the $.ajax object to allow complete control over your ajax requests
|
||||
ajaxObject: {
|
||||
dataType: 'json'
|
||||
},
|
||||
|
||||
// set this to false if you want to block ajax loading on init
|
||||
processAjaxOnInit: true,
|
||||
|
||||
// process ajax so that the following information is returned:
|
||||
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
|
||||
// example:
|
||||
// [
|
||||
// 100, // total rows
|
||||
// [
|
||||
// [ "row1cell1", "row1cell2", ... "row1cellN" ],
|
||||
// [ "row2cell1", "row2cell2", ... "row2cellN" ],
|
||||
// ...
|
||||
// [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
|
||||
// ],
|
||||
// [ "header1", "header2", ... "headerN" ] // optional
|
||||
// ]
|
||||
ajaxProcessing: function(ajax){ return [ 0, [], null ]; },
|
||||
|
||||
// output default: '{page}/{totalPages}'
|
||||
// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
||||
output: '{startRow} to {endRow} of {totalRows} rows', // '{page}/{totalPages}'
|
||||
|
||||
// apply disabled classname to the pager arrows when the rows at either extreme is visible
|
||||
updateArrows: true,
|
||||
|
||||
// starting page of the pager (zero based index)
|
||||
page: 0,
|
||||
|
||||
// reset pager after filtering; set to desired page #
|
||||
// set to false to not change page at filter start
|
||||
pageReset: 0,
|
||||
|
||||
// Number of visible rows
|
||||
size: 10,
|
||||
|
||||
// Number of options to include in the pager number selector
|
||||
maxOptionSize: 20,
|
||||
|
||||
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
||||
savePages: true,
|
||||
|
||||
// defines custom storage key
|
||||
storageKey: 'tablesorter-pager',
|
||||
|
||||
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
||||
// table row set to a height to compensate; default is false
|
||||
fixedHeight: false,
|
||||
|
||||
// count child rows towards the set page size? (set true if it is a visible table row within the pager)
|
||||
// if true, child row(s) may not appear to be attached to its parent row, may be split across pages or
|
||||
// may distort the table if rowspan or cellspans are included.
|
||||
countChildRows: false,
|
||||
|
||||
// remove rows from the table to speed up the sort of large tables.
|
||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||
removeRows: false, // removing rows in larger tables speeds up the sort
|
||||
|
||||
// css class names of pager arrows
|
||||
cssFirst: '.first', // go to first page arrow
|
||||
cssPrev: '.prev', // previous page arrow
|
||||
cssNext: '.next', // next page arrow
|
||||
cssLast: '.last', // go to last page arrow
|
||||
cssGoto: '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
cssPageDisplay: '.pagedisplay', // location of where the "output" is displayed
|
||||
cssPageSize: '.pagesize', // page size selector - select dropdown that sets the "size" option
|
||||
cssErrorRow: 'tablesorter-errorRow', // error information row
|
||||
|
||||
// class added to arrows when at the extremes (i.e. prev/first arrows are "disabled" when on the first page)
|
||||
cssDisabled: 'disabled', // Note there is no period "." in front of this class name
|
||||
|
||||
// stuff not set by the user
|
||||
totalRows: 0,
|
||||
totalPages: 0,
|
||||
filteredRows: 0,
|
||||
filteredPages: 0,
|
||||
ajaxCounter: 0,
|
||||
currentFilters: [],
|
||||
startRow: 0,
|
||||
endRow: 0,
|
||||
$size: null,
|
||||
last: {}
|
||||
|
||||
};
|
||||
|
||||
var $this = this,
|
||||
|
||||
// hide arrows at extremes
|
||||
pagerArrows = function(p, disable) {
|
||||
var a = 'addClass',
|
||||
r = 'removeClass',
|
||||
d = p.cssDisabled,
|
||||
dis = !!disable,
|
||||
first = ( dis || p.page === 0 ),
|
||||
tp = Math.min( p.totalPages, p.filteredPages ),
|
||||
last = ( dis || (p.page === tp - 1) || tp === 0 );
|
||||
if ( p.updateArrows ) {
|
||||
p.$container.find(p.cssFirst + ',' + p.cssPrev)[ first ? a : r ](d).attr('aria-disabled', first);
|
||||
p.$container.find(p.cssNext + ',' + p.cssLast)[ last ? a : r ](d).attr('aria-disabled', last);
|
||||
}
|
||||
},
|
||||
|
||||
updatePageDisplay = function(table, p, completed) {
|
||||
var i, pg, s, $out, regex,
|
||||
c = table.config,
|
||||
f = c.$table.hasClass('hasFilters'),
|
||||
t = [],
|
||||
sz = p.size || 10; // don't allow dividing by zero
|
||||
t = [ (c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered'), c.selectorRemove.replace(/^(\w+\.)/g,'') ];
|
||||
if (p.countChildRows) { t.push(c.cssChildRow); }
|
||||
regex = new RegExp( '(' + t.join('|') + ')' );
|
||||
if (f && !p.ajaxUrl) {
|
||||
if ($.isEmptyObject(c.cache)) {
|
||||
// delayInit: true so nothing is in the cache
|
||||
p.filteredRows = p.totalRows = c.$tbodies.eq(0).children('tr').not( p.countChildRows ? '' : '.' + c.cssChildRow ).length;
|
||||
} else {
|
||||
p.filteredRows = 0;
|
||||
$.each(c.cache[0].normalized, function(i, el) {
|
||||
p.filteredRows += p.regexRows.test(el[c.columns].$row[0].className) ? 0 : 1;
|
||||
});
|
||||
}
|
||||
} else if (!f) {
|
||||
p.filteredRows = p.totalRows;
|
||||
}
|
||||
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
|
||||
c.totalRows = p.totalRows;
|
||||
c.filteredRows = p.filteredRows;
|
||||
p.filteredPages = Math.ceil( p.filteredRows / sz ) || 0;
|
||||
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
|
||||
t = (p.size * p.page > p.filteredRows);
|
||||
p.startRow = (t) ? 1 : (p.filteredRows === 0 ? 0 : p.size * p.page + 1);
|
||||
p.page = (t) ? 0 : p.page;
|
||||
p.endRow = Math.min( p.filteredRows, p.totalRows, p.size * ( p.page + 1 ) );
|
||||
$out = p.$container.find(p.cssPageDisplay);
|
||||
// form the output string (can now get a new output string from the server)
|
||||
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || p.output : p.output )
|
||||
// {page} = one-based index; {page+#} = zero based index +/- value
|
||||
.replace(/\{page([\-+]\d+)?\}/gi, function(m,n){
|
||||
return p.totalPages ? p.page + (n ? parseInt(n, 10) : 1) : 0;
|
||||
})
|
||||
// {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object)
|
||||
.replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m){
|
||||
var len, indx,
|
||||
str = m.replace(/[{}\s]/g,''),
|
||||
extra = str.split(':'),
|
||||
data = p.ajaxData,
|
||||
// return zero for default page/row numbers
|
||||
deflt = /(rows?|pages?)$/i.test(str) ? 0 : '';
|
||||
if (/(startRow|page)/.test(extra[0]) && extra[1] === 'input') {
|
||||
len = ('' + (extra[0] === 'page' ? p.totalPages : p.totalRows)).length;
|
||||
indx = extra[0] === 'page' ? p.page + 1 : p.startRow;
|
||||
return '<input type="text" class="ts-' + extra[0] + '" style="max-width:' + len + 'em" value="' + indx + '"/>';
|
||||
}
|
||||
return extra.length > 1 && data && data[extra[0]] ? data[extra[0]][extra[1]] : p[str] || (data ? data[str] : deflt) || deflt;
|
||||
});
|
||||
if ($out.length) {
|
||||
$out[ ($out[0].tagName === 'INPUT') ? 'val' : 'html' ](s);
|
||||
if ( p.$goto.length ) {
|
||||
t = '';
|
||||
pg = Math.min( p.totalPages, p.filteredPages );
|
||||
// Filter the options page number link array if it's larger than 'maxOptionSize'
|
||||
// as large page set links will slow the browser on large dom inserts
|
||||
var skip_set_size = Math.floor(pg / p.maxOptionSize),
|
||||
large_collection = pg > p.maxOptionSize,
|
||||
current_page = p.page + 1,
|
||||
start_page = 1,
|
||||
end_page = pg,
|
||||
option_pages = [];
|
||||
//construct default options pages array
|
||||
var option_pages_start_page = (large_collection && current_page == 1) ? skip_set_size : 1;
|
||||
for (i = option_pages_start_page; i <= pg;) {
|
||||
option_pages.push(i);
|
||||
i = large_collection ? i + skip_set_size : i++;
|
||||
}
|
||||
if (large_collection) {
|
||||
var central_focus_size = Math.floor(p.maxOptionSize / 2) - 1,
|
||||
lower_focus_window = Math.abs(Math.floor(current_page - central_focus_size/2)),
|
||||
focus_option_pages = [];
|
||||
start_page = Math.min(current_page, lower_focus_window);
|
||||
end_page = start_page + central_focus_size;
|
||||
//construct an array to get a focus set around the current page
|
||||
for (i = start_page; i <= end_page ; i++) focus_option_pages.push(i);
|
||||
var insert_index = Math.floor(option_pages.length / 2) - Math.floor(focus_option_pages.length / 2);
|
||||
Array.prototype.splice.apply(option_pages, [ insert_index, focus_option_pages.length ].concat(focus_option_pages));
|
||||
option_pages.sort(function sortNumber(a,b) { return a - b; });
|
||||
}
|
||||
for ( i = 0; i < option_pages.length; i++) {
|
||||
t += '<option>' + option_pages[i] + '</option>';
|
||||
}
|
||||
p.$goto[0].innerHTML = t;
|
||||
p.$goto[0].value = current_page;
|
||||
}
|
||||
// rebind startRow/page inputs
|
||||
$out.find('.ts-startRow, .ts-page').unbind('change').bind('change', function(){
|
||||
var v = $(this).val(),
|
||||
pg = $(this).hasClass('ts-startRow') ? Math.floor( v/p.size ) + 1 : v;
|
||||
c.$table.trigger('pageSet.pager', [ pg ]);
|
||||
});
|
||||
}
|
||||
}
|
||||
pagerArrows(p);
|
||||
if (p.initialized && completed !== false) {
|
||||
c.$table.trigger('pagerComplete', p);
|
||||
// save pager info to storage
|
||||
if (p.savePages && ts.storage) {
|
||||
ts.storage(table, p.storageKey, {
|
||||
page : p.page,
|
||||
size : p.size
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
fixHeight = function(table, p) {
|
||||
var d, h,
|
||||
c = table.config,
|
||||
$b = c.$tbodies.eq(0);
|
||||
if (p.fixedHeight) {
|
||||
$b.find('tr.pagerSavedHeightSpacer').remove();
|
||||
h = $.data(table, 'pagerSavedHeight');
|
||||
if (h) {
|
||||
d = h - $b.height();
|
||||
if ( d > 5 && $.data(table, 'pagerLastSize') === p.size && $b.children('tr:visible').length < p.size ) {
|
||||
$b.append('<tr class="pagerSavedHeightSpacer ' + c.selectorRemove.replace(/^(\w+\.)/g,'') + '" style="height:' + d + 'px;"></tr>');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
changeHeight = function(table, p) {
|
||||
var $b = table.config.$tbodies.eq(0);
|
||||
$b.find('tr.pagerSavedHeightSpacer').remove();
|
||||
$.data(table, 'pagerSavedHeight', $b.height());
|
||||
fixHeight(table, p);
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
},
|
||||
|
||||
hideRows = function(table, p){
|
||||
if (!p.ajaxUrl) {
|
||||
var i,
|
||||
lastIndex = 0,
|
||||
c = table.config,
|
||||
rows = c.$tbodies.eq(0).children('tr'),
|
||||
l = rows.length,
|
||||
s = ( p.page * p.size ),
|
||||
e = s + p.size,
|
||||
f = c.widgetOptions && c.widgetOptions.filter_filteredRow || 'filtered',
|
||||
j = 0; // size counter
|
||||
for ( i = 0; i < l; i++ ){
|
||||
if ( !rows[i].className.match(f) ) {
|
||||
if (j === s && rows[i].className.match(c.cssChildRow)) {
|
||||
// hide child rows @ start of pager (if already visible)
|
||||
rows[i].style.display = 'none';
|
||||
} else {
|
||||
rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
|
||||
// don't count child rows
|
||||
j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'')) && !p.countChildRows ? 0 : 1;
|
||||
if ( j === e && rows[i].style.display !== 'none' && rows[i].className.match(ts.css.cssHasChild) ) {
|
||||
lastIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// add any attached child rows to last row of pager. Fixes part of issue #396
|
||||
if ( lastIndex > 0 && rows[lastIndex].className.match(ts.css.cssHasChild) ) {
|
||||
while ( ++lastIndex < l && rows[lastIndex].className.match(c.cssChildRow) ) {
|
||||
rows[lastIndex].style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hideRowsSetup = function(table, p){
|
||||
p.size = parseInt( p.$size.val(), 10 ) || p.size;
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
pagerArrows(p);
|
||||
if ( !p.removeRows ) {
|
||||
hideRows(table, p);
|
||||
$(table).bind('sortEnd.pager filterEnd.pager', function(){
|
||||
hideRows(table, p);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
renderAjax = function(data, table, p, xhr, exception){
|
||||
// process data
|
||||
if ( typeof(p.ajaxProcessing) === "function" ) {
|
||||
// ajaxProcessing result: [ total, rows, headers ]
|
||||
var i, j, hsh, $f, $sh, t, th, d, l, rr_count,
|
||||
c = table.config,
|
||||
$t = c.$table,
|
||||
tds = '',
|
||||
result = p.ajaxProcessing(data, table, xhr) || [ 0, [] ],
|
||||
hl = $t.find('thead th').length;
|
||||
|
||||
// Clean up any previous error.
|
||||
ts.showError(table);
|
||||
|
||||
if ( exception ) {
|
||||
if (c.debug) {
|
||||
ts.log('Ajax Error', xhr, exception);
|
||||
}
|
||||
ts.showError(table,
|
||||
xhr.status === 0 ? 'Not connected, verify Network' :
|
||||
xhr.status === 404 ? 'Requested page not found [404]' :
|
||||
xhr.status === 500 ? 'Internal Server Error [500]' :
|
||||
exception === 'parsererror' ? 'Requested JSON parse failed' :
|
||||
exception === 'timeout' ? 'Time out error' :
|
||||
exception === 'abort' ? 'Ajax Request aborted' :
|
||||
'Uncaught error: ' + xhr.statusText + ' [' + xhr.status + ']' );
|
||||
c.$tbodies.eq(0).children('tr').detach();
|
||||
p.totalRows = 0;
|
||||
} else {
|
||||
// process ajax object
|
||||
if (!$.isArray(result)) {
|
||||
p.ajaxData = result;
|
||||
c.totalRows = p.totalRows = result.total;
|
||||
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
||||
th = result.headers;
|
||||
d = result.rows;
|
||||
} else {
|
||||
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
||||
t = isNaN(result[0]) && !isNaN(result[1]);
|
||||
// ensure a zero returned row count doesn't fail the logical ||
|
||||
rr_count = result[t ? 1 : 0];
|
||||
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
||||
// can't set filtered rows when returning an array
|
||||
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
||||
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
||||
th = result[2]; // headers
|
||||
}
|
||||
l = d && d.length;
|
||||
if (d instanceof jQuery) {
|
||||
if (p.processAjaxOnInit) {
|
||||
// append jQuery object
|
||||
c.$tbodies.eq(0).children('tr').detach();
|
||||
c.$tbodies.eq(0).append(d);
|
||||
}
|
||||
} else if (l) {
|
||||
// build table from array
|
||||
for ( i = 0; i < l; i++ ) {
|
||||
tds += '<tr>';
|
||||
for ( j = 0; j < d[i].length; j++ ) {
|
||||
// build tbody cells; watch for data containing HTML markup - see #434
|
||||
tds += /^\s*<td/.test(d[i][j]) ? $.trim(d[i][j]) : '<td>' + d[i][j] + '</td>';
|
||||
}
|
||||
tds += '</tr>';
|
||||
}
|
||||
// add rows to first tbody
|
||||
if (p.processAjaxOnInit) {
|
||||
c.$tbodies.eq(0).html( tds );
|
||||
}
|
||||
}
|
||||
p.processAjaxOnInit = true;
|
||||
// only add new header text if the length matches
|
||||
if ( th && th.length === hl ) {
|
||||
hsh = $t.hasClass('hasStickyHeaders');
|
||||
$sh = hsh ? c.widgetOptions.$sticky.children('thead:first').children('tr').children() : '';
|
||||
$f = $t.find('tfoot tr:first').children();
|
||||
// don't change td headers (may contain pager)
|
||||
c.$headers.filter('th').each(function(j){
|
||||
var $t = $(this), icn;
|
||||
// add new test within the first span it finds, or just in the header
|
||||
if ( $t.find('.' + ts.css.icon).length ) {
|
||||
icn = $t.find('.' + ts.css.icon).clone(true);
|
||||
$t.find('.tablesorter-header-inner').html( th[j] ).append(icn);
|
||||
if ( hsh && $sh.length ) {
|
||||
icn = $sh.eq(j).find('.' + ts.css.icon).clone(true);
|
||||
$sh.eq(j).find('.tablesorter-header-inner').html( th[j] ).append(icn);
|
||||
}
|
||||
} else {
|
||||
$t.find('.tablesorter-header-inner').html( th[j] );
|
||||
if (hsh && $sh.length) {
|
||||
$sh.eq(j).find('.tablesorter-header-inner').html( th[j] );
|
||||
}
|
||||
}
|
||||
$f.eq(j).html( th[j] );
|
||||
});
|
||||
}
|
||||
}
|
||||
if (c.showProcessing) {
|
||||
ts.isProcessing(table); // remove loading icon
|
||||
}
|
||||
// make sure last pager settings are saved, prevents multiple server side calls with
|
||||
// the same parameters
|
||||
p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
|
||||
p.last.totalRows = p.totalRows;
|
||||
p.last.currentFilters = p.currentFilters;
|
||||
p.last.sortList = (c.sortList || []).join(',');
|
||||
updatePageDisplay(table, p);
|
||||
fixHeight(table, p);
|
||||
$t.trigger('updateCache', [function(){
|
||||
if (p.initialized) {
|
||||
// apply widgets after table has rendered & after a delay to prevent
|
||||
// multiple applyWidget blocking code from blocking this trigger
|
||||
setTimeout(function(){
|
||||
$t
|
||||
.trigger('applyWidgets')
|
||||
.trigger('pagerChange', p);
|
||||
}, 0);
|
||||
}
|
||||
}]);
|
||||
|
||||
}
|
||||
if (!p.initialized) {
|
||||
p.initialized = true;
|
||||
$(table)
|
||||
.trigger('applyWidgets')
|
||||
.trigger('pagerInitialized', p);
|
||||
}
|
||||
},
|
||||
|
||||
getAjax = function(table, p){
|
||||
var url = getAjaxUrl(table, p),
|
||||
$doc = $(document),
|
||||
counter,
|
||||
c = table.config;
|
||||
if ( url !== '' ) {
|
||||
if (c.showProcessing) {
|
||||
ts.isProcessing(table, true); // show loading icon
|
||||
}
|
||||
$doc.bind('ajaxError.pager', function(e, xhr, settings, exception) {
|
||||
renderAjax(null, table, p, xhr, exception);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
});
|
||||
|
||||
counter = ++p.ajaxCounter;
|
||||
|
||||
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||
p.ajaxObject.success = function(data, status, jqxhr) {
|
||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||
if (counter < p.ajaxCounter){
|
||||
return;
|
||||
}
|
||||
renderAjax(data, table, p, jqxhr);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
if (typeof p.oldAjaxSuccess === 'function') {
|
||||
p.oldAjaxSuccess(data);
|
||||
}
|
||||
};
|
||||
if (c.debug) {
|
||||
ts.log('ajax initialized', p.ajaxObject);
|
||||
}
|
||||
$.ajax(p.ajaxObject);
|
||||
}
|
||||
},
|
||||
|
||||
getAjaxUrl = function(table, p) {
|
||||
var c = table.config,
|
||||
url = (p.ajaxUrl) ? p.ajaxUrl
|
||||
// allow using "{page+1}" in the url string to switch to a non-zero based index
|
||||
.replace(/\{page([\-+]\d+)?\}/, function(s,n){ return p.page + (n ? parseInt(n, 10) : 0); })
|
||||
.replace(/\{size\}/g, p.size) : '',
|
||||
sl = c.sortList,
|
||||
fl = p.currentFilters || $(table).data('lastSearch') || [],
|
||||
sortCol = url.match(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/),
|
||||
filterCol = url.match(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/),
|
||||
arry = [];
|
||||
if (sortCol) {
|
||||
sortCol = sortCol[1];
|
||||
$.each(sl, function(i,v){
|
||||
arry.push(sortCol + '[' + v[0] + ']=' + v[1]);
|
||||
});
|
||||
// if the arry is empty, just add the col parameter... "&{sortList:col}" becomes "&col"
|
||||
url = url.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : sortCol );
|
||||
arry = [];
|
||||
}
|
||||
if (filterCol) {
|
||||
filterCol = filterCol[1];
|
||||
$.each(fl, function(i,v){
|
||||
if (v) {
|
||||
arry.push(filterCol + '[' + i + ']=' + encodeURIComponent(v));
|
||||
}
|
||||
});
|
||||
// if the arry is empty, just add the fcol parameter... "&{filterList:fcol}" becomes "&fcol"
|
||||
url = url.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : filterCol );
|
||||
p.currentFilters = fl;
|
||||
}
|
||||
if ( typeof(p.customAjaxUrl) === "function" ) {
|
||||
url = p.customAjaxUrl(table, url);
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager ajax url: ' + url);
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
renderTable = function(table, rows, p) {
|
||||
var $tb, index, count, added,
|
||||
$t = $(table),
|
||||
c = table.config,
|
||||
f = c.$table.hasClass('hasFilters'),
|
||||
l = rows && rows.length || 0, // rows may be undefined
|
||||
s = ( p.page * p.size ),
|
||||
e = p.size;
|
||||
if ( l < 1 ) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: no rows for pager to render');
|
||||
}
|
||||
// empty table, abort!
|
||||
return;
|
||||
}
|
||||
if ( p.page >= p.totalPages ) {
|
||||
// lets not render the table more than once
|
||||
moveToLastPage(table, p);
|
||||
}
|
||||
p.isDisabled = false; // needed because sorting will change the page and re-enable the pager
|
||||
if (p.initialized) { $t.trigger('pagerChange', p); }
|
||||
|
||||
if ( !p.removeRows ) {
|
||||
hideRows(table, p);
|
||||
} else {
|
||||
ts.clearTableBody(table);
|
||||
$tb = ts.processTbody(table, c.$tbodies.eq(0), true);
|
||||
// not filtered, start from the calculated starting point (s)
|
||||
// if filtered, start from zero
|
||||
index = f ? 0 : s;
|
||||
count = f ? 0 : s;
|
||||
added = 0;
|
||||
while (added < e && index < rows.length) {
|
||||
if (!f || !/filtered/.test(rows[index][0].className)){
|
||||
count++;
|
||||
if (count > s && added <= e) {
|
||||
added++;
|
||||
$tb.append(rows[index]);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
ts.processTbody(table, $tb, false);
|
||||
}
|
||||
updatePageDisplay(table, p);
|
||||
if ( !p.isDisabled ) { fixHeight(table, p); }
|
||||
if (table.isUpdating) {
|
||||
$t.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
},
|
||||
|
||||
showAllRows = function(table, p){
|
||||
if ( p.ajax ) {
|
||||
pagerArrows(p, true);
|
||||
} else {
|
||||
p.isDisabled = true;
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
p.page = 0;
|
||||
p.size = p.totalRows;
|
||||
p.totalPages = 1;
|
||||
$(table)
|
||||
.addClass('pagerDisabled')
|
||||
.removeAttr('aria-describedby')
|
||||
.find('tr.pagerSavedHeightSpacer').remove();
|
||||
renderTable(table, table.config.rowsCopy, p);
|
||||
$(table).trigger('applyWidgets');
|
||||
if (table.config.debug) {
|
||||
ts.log('pager disabled');
|
||||
}
|
||||
}
|
||||
// disable size selector
|
||||
p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page')).each(function(){
|
||||
$(this).attr('aria-disabled', 'true').addClass(p.cssDisabled)[0].disabled = true;
|
||||
});
|
||||
},
|
||||
|
||||
// updateCache if delayInit: true
|
||||
updateCache = function(table) {
|
||||
var c = table.config,
|
||||
p = c.pager;
|
||||
c.$table.trigger('updateCache', [ function(){
|
||||
var i,
|
||||
rows = [],
|
||||
n = table.config.cache[0].normalized;
|
||||
p.totalRows = n.length;
|
||||
for (i = 0; i < p.totalRows; i++) {
|
||||
rows.push(n[i][c.columns].$row);
|
||||
}
|
||||
c.rowsCopy = rows;
|
||||
moveToPage(table, p, true);
|
||||
} ]);
|
||||
},
|
||||
|
||||
moveToPage = function(table, p, pageMoved) {
|
||||
if ( p.isDisabled ) { return; }
|
||||
var c = table.config,
|
||||
$t = $(table),
|
||||
l = p.last,
|
||||
pg = Math.min( p.totalPages, p.filteredPages );
|
||||
if ( pageMoved !== false && p.initialized && $.isEmptyObject(table.config.cache)) {
|
||||
return updateCache(table);
|
||||
}
|
||||
if ( p.page < 0 ) { p.page = 0; }
|
||||
if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
|
||||
// fixes issue where one currentFilter is [] and the other is ['','',''],
|
||||
// making the next if comparison think the filters are different (joined by commas). Fixes #202.
|
||||
l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters;
|
||||
p.currentFilters = (p.currentFilters || []).join('') === '' ? [] : p.currentFilters;
|
||||
// don't allow rendering multiple times on the same page/size/totalRows/filters/sorts
|
||||
if ( l.page === p.page && l.size === p.size && l.totalRows === p.totalRows &&
|
||||
(l.currentFilters || []).join(',') === (p.currentFilters || []).join(',') &&
|
||||
l.sortList === (c.sortList || []).join(',') ) { return; }
|
||||
if (c.debug) {
|
||||
ts.log('Pager changing to page ' + p.page);
|
||||
}
|
||||
p.last = {
|
||||
page : p.page,
|
||||
size : p.size,
|
||||
// fixes #408; modify sortList otherwise it auto-updates
|
||||
sortList : (c.sortList || []).join(','),
|
||||
totalRows : p.totalRows,
|
||||
currentFilters : p.currentFilters || []
|
||||
};
|
||||
if (p.ajax) {
|
||||
getAjax(table, p);
|
||||
} else if (!p.ajax) {
|
||||
renderTable(table, c.rowsCopy, p);
|
||||
}
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
if (p.initialized && pageMoved !== false) {
|
||||
$t
|
||||
.trigger('pageMoved', p)
|
||||
.trigger('applyWidgets');
|
||||
if (table.isUpdating) {
|
||||
$t.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setPageSize = function(table, size, p) {
|
||||
p.size = size || p.size || 10;
|
||||
p.$size.val(p.size);
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
p.filteredPages = Math.ceil( p.filteredRows / p.size );
|
||||
moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToFirstPage = function(table, p) {
|
||||
p.page = 0;
|
||||
moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToLastPage = function(table, p) {
|
||||
p.page = ( Math.min( p.totalPages, p.filteredPages ) - 1 );
|
||||
moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToNextPage = function(table, p) {
|
||||
p.page++;
|
||||
if ( p.page >= ( Math.min( p.totalPages, p.filteredPages ) - 1 ) ) {
|
||||
p.page = ( Math.min( p.totalPages, p.filteredPages ) - 1 );
|
||||
}
|
||||
moveToPage(table, p);
|
||||
},
|
||||
|
||||
moveToPrevPage = function(table, p) {
|
||||
p.page--;
|
||||
if ( p.page <= 0 ) {
|
||||
p.page = 0;
|
||||
}
|
||||
moveToPage(table, p);
|
||||
},
|
||||
|
||||
destroyPager = function(table, p){
|
||||
showAllRows(table, p);
|
||||
p.$container.hide(); // hide pager
|
||||
table.config.appender = null; // remove pager appender function
|
||||
p.initialized = false;
|
||||
delete table.config.rowsCopy;
|
||||
$(table).unbind('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
|
||||
if (ts.storage) {
|
||||
ts.storage(table, p.storageKey, '');
|
||||
}
|
||||
},
|
||||
|
||||
enablePager = function(table, p, triggered){
|
||||
var info,
|
||||
c = table.config;
|
||||
p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page'))
|
||||
.removeClass(p.cssDisabled)
|
||||
.removeAttr('disabled')
|
||||
.attr('aria-disabled', 'false');
|
||||
p.isDisabled = false;
|
||||
p.page = $.data(table, 'pagerLastPage') || p.page || 0;
|
||||
p.size = $.data(table, 'pagerLastSize') || parseInt(p.$size.find('option[selected]').val(), 10) || p.size || 10;
|
||||
p.$size.val(p.size); // set page size
|
||||
p.totalPages = Math.ceil( Math.min( p.totalRows, p.filteredRows ) / p.size );
|
||||
// if table id exists, include page display with aria info
|
||||
if ( table.id ) {
|
||||
info = table.id + '_pager_info';
|
||||
p.$container.find(p.cssPageDisplay).attr('id', info);
|
||||
c.$table.attr('aria-describedby', info);
|
||||
}
|
||||
if ( triggered ) {
|
||||
c.$table.trigger('updateRows');
|
||||
setPageSize(table, p.size, p);
|
||||
hideRowsSetup(table, p);
|
||||
fixHeight(table, p);
|
||||
if (c.debug) {
|
||||
ts.log('pager enabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$this.appender = function(table, rows) {
|
||||
var c = table.config,
|
||||
p = c.pager;
|
||||
if ( !p.ajax ) {
|
||||
c.rowsCopy = rows;
|
||||
p.totalRows = p.countChildRows ? c.$tbodies.eq(0).children('tr').length : rows.length;
|
||||
p.size = $.data(table, 'pagerLastSize') || p.size || 10;
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
renderTable(table, rows, p);
|
||||
// update display here in case all rows are removed
|
||||
updatePageDisplay(table, p, false);
|
||||
}
|
||||
};
|
||||
|
||||
$this.construct = function(settings) {
|
||||
return this.each(function() {
|
||||
// check if tablesorter has initialized
|
||||
if (!(this.config && this.hasInitialized)) { return; }
|
||||
var t, ctrls, fxn,
|
||||
table = this,
|
||||
c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager = $.extend( true, {}, $.tablesorterPager.defaults, settings ),
|
||||
$t = c.$table,
|
||||
// added in case the pager is reinitialized after being destroyed.
|
||||
pager = p.$container = $(p.container).addClass('tablesorter-pager').show();
|
||||
if (c.debug) {
|
||||
ts.log('Pager initializing');
|
||||
}
|
||||
p.oldAjaxSuccess = p.oldAjaxSuccess || p.ajaxObject.success;
|
||||
c.appender = $this.appender;
|
||||
if (ts.filter && $.inArray('filter', c.widgets) >= 0) {
|
||||
// get any default filter settings (data-value attribute) fixes #388
|
||||
p.currentFilters = c.$table.data('lastSearch') || ts.filter.setDefaults(table, c, c.widgetOptions) || [];
|
||||
// set, but don't apply current filters
|
||||
ts.setFilters(table, p.currentFilters, false);
|
||||
}
|
||||
if (p.savePages && ts.storage) {
|
||||
t = ts.storage(table, p.storageKey) || {}; // fixes #387
|
||||
p.page = isNaN(t.page) ? p.page : t.page;
|
||||
p.size = ( isNaN(t.size) ? p.size : t.size ) || 10;
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
}
|
||||
|
||||
// skipped rows
|
||||
p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'') + '|' + c.cssChildRow + ')');
|
||||
|
||||
$t
|
||||
.unbind('filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize '.split(' ').join('.pager '))
|
||||
.bind('filterStart.pager', function(e, filters) {
|
||||
p.currentFilters = filters;
|
||||
// don't change page is filters are the same (pager updating, etc)
|
||||
if (p.pageReset !== false && (c.lastCombinedFilter || '') !== (filters || []).join('')) {
|
||||
p.page = p.pageReset; // fixes #456 & #565
|
||||
}
|
||||
})
|
||||
// update pager after filter widget completes
|
||||
.bind('filterEnd.pager sortEnd.pager', function() {
|
||||
if (p.initialized) {
|
||||
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
|
||||
// make sure we have a copy of all table rows once the cache has been built
|
||||
updateCache(table);
|
||||
}
|
||||
// update page display first, so we update p.filteredPages
|
||||
updatePageDisplay(table, p, false);
|
||||
moveToPage(table, p, false);
|
||||
c.$table.trigger('applyWidgets');
|
||||
fixHeight(table, p);
|
||||
}
|
||||
})
|
||||
.bind('disable.pager', function(e){
|
||||
e.stopPropagation();
|
||||
showAllRows(table, p);
|
||||
})
|
||||
.bind('enable.pager', function(e){
|
||||
e.stopPropagation();
|
||||
enablePager(table, p, true);
|
||||
})
|
||||
.bind('destroy.pager', function(e){
|
||||
e.stopPropagation();
|
||||
destroyPager(table, p);
|
||||
})
|
||||
.bind('updateComplete.pager', function(e, table, triggered){
|
||||
e.stopPropagation();
|
||||
// table can be unintentionally undefined in tablesorter v2.17.7 and earlier
|
||||
if ( !table || triggered ) { return; }
|
||||
fixHeight(table, p);
|
||||
var $rows = c.$tbodies.eq(0).children('tr').not(c.selectorRemove);
|
||||
p.totalRows = $rows.length - ( p.countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length );
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
if ($rows.length && c.rowsCopy && c.rowsCopy.length === 0) {
|
||||
// make a copy of all table rows once the cache has been built
|
||||
updateCache(table);
|
||||
}
|
||||
updatePageDisplay(table, p);
|
||||
hideRows(table, p);
|
||||
})
|
||||
.bind('pageSize.pager', function(e,v){
|
||||
e.stopPropagation();
|
||||
setPageSize(table, parseInt(v, 10) || 10, p);
|
||||
hideRows(table, p);
|
||||
updatePageDisplay(table, p, false);
|
||||
if (p.$size.length) { p.$size.val(p.size); } // twice?
|
||||
})
|
||||
.bind('pageSet.pager', function(e,v){
|
||||
e.stopPropagation();
|
||||
p.page = (parseInt(v, 10) || 1) - 1;
|
||||
if (p.$goto.length) { p.$goto.val(p.size); } // twice?
|
||||
moveToPage(table, p, true);
|
||||
updatePageDisplay(table, p, false);
|
||||
});
|
||||
|
||||
// clicked controls
|
||||
ctrls = [ p.cssFirst, p.cssPrev, p.cssNext, p.cssLast ];
|
||||
fxn = [ moveToFirstPage, moveToPrevPage, moveToNextPage, moveToLastPage ];
|
||||
pager.find(ctrls.join(','))
|
||||
.attr("tabindex", 0)
|
||||
.unbind('click.pager')
|
||||
.bind('click.pager', function(e){
|
||||
e.stopPropagation();
|
||||
var i, $t = $(this), l = ctrls.length;
|
||||
if ( !$t.hasClass(p.cssDisabled) ) {
|
||||
for (i = 0; i < l; i++) {
|
||||
if ($t.is(ctrls[i])) {
|
||||
fxn[i](table, p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// goto selector
|
||||
p.$goto = pager.find(p.cssGoto);
|
||||
if ( p.$goto.length ) {
|
||||
p.$goto
|
||||
.unbind('change')
|
||||
.bind('change', function(){
|
||||
p.page = $(this).val() - 1;
|
||||
moveToPage(table, p, true);
|
||||
updatePageDisplay(table, p, false);
|
||||
});
|
||||
}
|
||||
|
||||
// page size selector
|
||||
p.$size = pager.find(p.cssPageSize);
|
||||
if ( p.$size.length ) {
|
||||
// setting an option as selected appears to cause issues with initial page size
|
||||
p.$size.find('option').removeAttr('selected');
|
||||
p.$size.unbind('change.pager').bind('change.pager', function() {
|
||||
p.$size.val( $(this).val() ); // in case there are more than one pagers
|
||||
if ( !$(this).hasClass(p.cssDisabled) ) {
|
||||
setPageSize(table, parseInt( $(this).val(), 10 ), p);
|
||||
changeHeight(table, p);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// clear initialized flag
|
||||
p.initialized = false;
|
||||
// before initialization event
|
||||
$t.trigger('pagerBeforeInitialized', p);
|
||||
|
||||
enablePager(table, p, false);
|
||||
|
||||
if ( typeof(p.ajaxUrl) === 'string' ) {
|
||||
// ajax pager; interact with database
|
||||
p.ajax = true;
|
||||
//When filtering with ajax, allow only custom filtering function, disable default filtering since it will be done server side.
|
||||
c.widgetOptions.filter_serversideFiltering = true;
|
||||
c.serverSideSorting = true;
|
||||
moveToPage(table, p);
|
||||
} else {
|
||||
p.ajax = false;
|
||||
// Regular pager; all rows stored in memory
|
||||
$(this).trigger("appendCache", true);
|
||||
hideRowsSetup(table, p);
|
||||
}
|
||||
|
||||
changeHeight(table, p);
|
||||
|
||||
// pager initialized
|
||||
if (!p.ajax) {
|
||||
p.initialized = true;
|
||||
$(table).trigger('pagerInitialized', p);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}() });
|
||||
|
||||
// see #486
|
||||
ts.showError = function(table, message){
|
||||
$(table).each(function(){
|
||||
var $row,
|
||||
c = this.config,
|
||||
errorRow = c.pager && c.pager.cssErrorRow || c.widgetOptions.pager_css && c.widgetOptions.pager_css.errorRow || 'tablesorter-errorRow';
|
||||
if (c) {
|
||||
if (typeof message === 'undefined') {
|
||||
c.$table.find('thead').find(c.selectorRemove).remove();
|
||||
} else {
|
||||
$row = ( /tr\>/.test(message) ? $(message) : $('<tr><td colspan="' + c.columns + '">' + message + '</td></tr>') )
|
||||
.click(function(){
|
||||
$(this).remove();
|
||||
})
|
||||
// add error row to thead instead of tbody, or clicking on the header will result in a parser error
|
||||
.appendTo( c.$table.find('thead:first') )
|
||||
.addClass( errorRow + ' ' + c.selectorRemove.replace(/^(\w+\.)/g,'') )
|
||||
.attr({
|
||||
role : 'alert',
|
||||
'aria-live' : 'assertive'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// extend plugin scope
|
||||
$.fn.extend({
|
||||
tablesorterPager: $.tablesorterPager.construct
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
2
modules/EcmReportsBackUp20151106/TableSorterNew/addons/pager/jquery.tablesorter.pager.min.js
vendored
Executable file
2
modules/EcmReportsBackUp20151106/TableSorterNew/addons/pager/jquery.tablesorter.pager.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,102 @@
|
||||
/*!
|
||||
* custom pager controls (beta) for TableSorter 9/15/2014 (v2.17.8)
|
||||
initialize custom pager script BEFORE initializing tablesorter/tablesorter pager
|
||||
custom pager looks like this:
|
||||
1 | 2 … 5 | 6 | 7 … 99 | 100
|
||||
_ _ _ _ adjacentSpacer
|
||||
_ _ distanceSpacer
|
||||
_____ ________ ends (2 default)
|
||||
_________ aroundCurrent (1 default)
|
||||
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false, loopfunc:true */
|
||||
/*global jQuery: false */
|
||||
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
$.tablesorter = $.tablesorter || {};
|
||||
|
||||
$.tablesorter.customPagerControls = function(settings) {
|
||||
var defaults = {
|
||||
table : 'table',
|
||||
pager : '.pager',
|
||||
pageSize : '.left a',
|
||||
currentPage : '.right a',
|
||||
ends : 2, // number of pages to show of either end
|
||||
aroundCurrent : 1, // number of pages surrounding the current page
|
||||
link : '<a href="#">{page}</a>', // page element; use {page} to include the page number
|
||||
currentClass : 'current', // current page class name
|
||||
adjacentSpacer : ' | ', // spacer for page numbers next to each other
|
||||
distanceSpacer : ' … ', // spacer for page numbers away from each other (ellipsis)
|
||||
addKeyboard : true // add left/right keyboard arrows to change current page
|
||||
},
|
||||
options = $.extend({}, defaults, settings),
|
||||
$table = $(options.table),
|
||||
$pager = $(options.pager);
|
||||
|
||||
$table
|
||||
.on('pagerInitialized pagerComplete', function (e, c) {
|
||||
var indx,
|
||||
p = c.pager ? c.pager : c, // using widget
|
||||
pages = $('<div/>'),
|
||||
pageArray = [],
|
||||
cur = p.page + 1,
|
||||
start = cur > 1 ? (p.filteredPages - cur < options.aroundCurrent ? -(options.aroundCurrent + 1) + (p.filteredPages - cur) : -options.aroundCurrent) : 0,
|
||||
end = cur < options.aroundCurrent + 1 ? options.aroundCurrent + 3 - cur : options.aroundCurrent + 1;
|
||||
for (indx = start; indx < end; indx++) {
|
||||
if (cur + indx >= 1 && cur + indx < p.filteredPages) { pageArray.push( cur + indx ); }
|
||||
}
|
||||
if (pageArray.length) {
|
||||
// include first and last pages (ends) in the pagination
|
||||
for (indx = 0; indx < options.ends; indx++){
|
||||
if ($.inArray(indx + 1, pageArray) === -1) { pageArray.push(indx + 1); }
|
||||
if ($.inArray(p.filteredPages - indx, pageArray) === -1) { pageArray.push(p.filteredPages - indx); }
|
||||
}
|
||||
// sort the list
|
||||
pageArray = pageArray.sort(function(a, b){ return a - b; });
|
||||
// make links and spacers
|
||||
$.each(pageArray, function(indx, value){
|
||||
pages
|
||||
.append( $(options.link.replace(/\{page\}/g, value)).toggleClass(options.currentClass, value === cur).attr('data-page', value) )
|
||||
.append( '<span>' + (indx < pageArray.length - 1 && ( pageArray[ indx + 1 ] - 1 !== value ) ? options.distanceSpacer :
|
||||
( indx >= pageArray.length - 1 ? '' : options.adjacentSpacer )) + '</span>' );
|
||||
});
|
||||
}
|
||||
$pager.find('.pagecount').html(pages.html());
|
||||
});
|
||||
|
||||
// set up pager controls
|
||||
$pager.find(options.pageSize).on('click', function () {
|
||||
$(this)
|
||||
.addClass(options.currentClass)
|
||||
.siblings()
|
||||
.removeClass(options.currentClass);
|
||||
$table.trigger('pageSize', $(this).html());
|
||||
return false;
|
||||
}).end()
|
||||
.on('click', options.currentPage, function(){
|
||||
$(this)
|
||||
.addClass(options.currentClass)
|
||||
.siblings()
|
||||
.removeClass(options.currentClass);
|
||||
$table.trigger('pageSet', $(this).attr('data-page'));
|
||||
return false;
|
||||
});
|
||||
|
||||
// make right/left arrow keys work
|
||||
if (options.addKeyboard) {
|
||||
$(document).on('keydown', function(events){
|
||||
// ignore arrows inside form elements
|
||||
if (/input|select|textarea/i.test(events.target.tagName)) { return; }
|
||||
if (events.which === 37) {
|
||||
// left
|
||||
$pager.find(options.currentPage).filter('.' + options.currentClass).prevAll(':not(span):first').click();
|
||||
} else if (events.which === 39) {
|
||||
// right
|
||||
$pager.find(options.currentPage).filter('.' + options.currentClass).nextAll(':not(span):first').click();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
182
modules/EcmReportsBackUp20151106/TableSorterNew/beta-testing/widget-reorder.js
Executable file
182
modules/EcmReportsBackUp20151106/TableSorterNew/beta-testing/widget-reorder.js
Executable file
@@ -0,0 +1,182 @@
|
||||
/*! tablesorter column reorder - beta testing
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* by Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
$.tablesorter.addWidget({
|
||||
id: 'reorder',
|
||||
priority: 70,
|
||||
options : {
|
||||
reorder_axis : 'xy', // x or xy
|
||||
reorder_delay : 300,
|
||||
reorder_helperClass : 'tablesorter-reorder-helper',
|
||||
reorder_helperBar : 'tablesorter-reorder-helper-bar',
|
||||
reorder_noReorder : 'reorder-false',
|
||||
reorder_blocked : 'reorder-block-left reorder-block-end',
|
||||
reorder_complete : null // callback
|
||||
},
|
||||
init: function(table, thisWidget, c, wo) {
|
||||
var i, timer, $helper, $bar, clickOffset,
|
||||
lastIndx = -1,
|
||||
ts = $.tablesorter,
|
||||
endIndex = -1,
|
||||
startIndex = -1,
|
||||
t = wo.reorder_blocked.split(' '),
|
||||
noReorderLeft = t[0] || 'reorder-block-left',
|
||||
noReorderLast = t[1] || 'reorder-block-end',
|
||||
lastOffset = c.$headers.not('.' + noReorderLeft).first(),
|
||||
offsets = c.$headers.map(function(i){
|
||||
var s, $t = $(this);
|
||||
if ($t.hasClass(noReorderLeft)) {
|
||||
s = lastOffset;
|
||||
$t = s;
|
||||
//lastOffset = $t;
|
||||
}
|
||||
lastOffset = $t;
|
||||
return $t.offset().left;
|
||||
}).get(),
|
||||
len = offsets.length,
|
||||
startReorder = function(e, $th){
|
||||
var p = $th.position(),
|
||||
r = $th.parent().position(),
|
||||
i = startIndex = $th.index();
|
||||
clickOffset = [ e.pageX - p.left, e.pageY - r.top ];
|
||||
$helper = c.$table.clone();
|
||||
$helper.find('> thead > tr:first').children('[data-column!=' + i + ']').remove();
|
||||
$helper.find('thead tr:gt(0), caption, colgroup, tbody, tfoot').remove();
|
||||
$helper
|
||||
.css({
|
||||
position: 'absolute',
|
||||
zIndex : 1,
|
||||
left: p.left - clickOffset[0],
|
||||
top: r.top - clickOffset[1],
|
||||
width: $th.outerWidth()
|
||||
})
|
||||
.appendTo('body')
|
||||
.find('th, td').addClass(wo.reorder_helperClass);
|
||||
$bar = $('<div class="' + wo.reorder_helperBar + '" />')
|
||||
.css({
|
||||
position : 'absolute',
|
||||
top : c.$table.find('thead').offset().top,
|
||||
height : $th.closest('thead').outerHeight() + c.$table.find('tbody').height()
|
||||
})
|
||||
.appendTo('body');
|
||||
positionBar(e);
|
||||
lastIndx = endIndex;
|
||||
},
|
||||
positionBar = function(e){
|
||||
for (i = 0; i <= len; i++) {
|
||||
if ( i > 0 && e.pageX < offsets[i-1] + (offsets[i] - offsets[i-1])/2 && !c.$headers.eq(i).hasClass(noReorderLeft) ) {
|
||||
endIndex = i - 1;
|
||||
// endIndex = offsets.lastIndexOf( offsets[i-1] ); // lastIndexOf not supported by IE8 and older
|
||||
if (endIndex >= 0 && lastIndx === endIndex) { return false; }
|
||||
lastIndx = endIndex;
|
||||
if (c.debug) {
|
||||
ts.log( endIndex === 0 ? 'target before column 0' : endIndex === len ? 'target after last column' : 'target between columns ' + startIndex + ' and ' + endIndex);
|
||||
}
|
||||
$bar.css('left', offsets[i-1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (endIndex < 0) {
|
||||
endIndex = len;
|
||||
$bar.css('left', offsets[len]);
|
||||
}
|
||||
},
|
||||
finishReorder = function(){
|
||||
$helper.remove();
|
||||
$bar.remove();
|
||||
// finish reorder
|
||||
var adj, s = startIndex,
|
||||
rows = c.$table.find('tr'),
|
||||
cols;
|
||||
startIndex = -1; // stop mousemove updates
|
||||
if ( s > -1 && endIndex > -1 && s != endIndex && s + 1 !== endIndex ) {
|
||||
adj = endIndex !== 0;
|
||||
if (c.debug) {
|
||||
ts.log( 'Inserting column ' + s + (adj ? ' after' : ' before') + ' column ' + (endIndex - adj ? 1 : 0) );
|
||||
}
|
||||
rows.each(function() {
|
||||
cols = $(this).children();
|
||||
cols.eq(s)[ adj ? 'insertAfter' : 'insertBefore' ]( cols.eq( endIndex - (adj ? 1 : 0) ) );
|
||||
});
|
||||
cols = [];
|
||||
// stored header info needs to be modified too!
|
||||
for (i = 0; i < len; i++) {
|
||||
if (i === s) { continue; }
|
||||
if (i === endIndex - (adj ? 1 : 0)) {
|
||||
if (!adj) { cols.push(c.headerContent[s]); }
|
||||
cols.push(c.headerContent[i]);
|
||||
if (adj) { cols.push(c.headerContent[s]); }
|
||||
} else {
|
||||
cols.push(c.headerContent[i]);
|
||||
}
|
||||
}
|
||||
c.headerContent = cols;
|
||||
// cols = c.headerContent.splice(s, 1);
|
||||
// c.headerContent.splice(endIndex - (adj ? 1 : 0), 0, cols);
|
||||
c.$table.trigger('updateAll', [ true, wo.reorder_complete ]);
|
||||
}
|
||||
endIndex = -1;
|
||||
},
|
||||
mdown = function(e, el){
|
||||
var $t = $(el), evt = e;
|
||||
if ($t.hasClass(wo.reorder_noReorder)) { return; }
|
||||
timer = setTimeout(function(){
|
||||
$t.addClass('tablesorter-reorder');
|
||||
startReorder(evt, $t);
|
||||
}, wo.reorder_delay);
|
||||
};
|
||||
|
||||
console.log( c.$headers.last().hasClass(noReorderLast) );
|
||||
|
||||
if ( c.$headers.last().hasClass(noReorderLast) ) {
|
||||
offsets.push( offsets[ offsets.length - 1 ] );
|
||||
} else {
|
||||
offsets.push( c.$table.offset().left + c.$table.outerWidth() );
|
||||
}
|
||||
|
||||
c.$headers.not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e){
|
||||
mdown(e, this);
|
||||
});
|
||||
|
||||
$(document)
|
||||
.bind('mousemove.reorder', function(e){
|
||||
if (startIndex !== -1){
|
||||
var c = { left : e.pageX - clickOffset[0] };
|
||||
endIndex = -1;
|
||||
if (/y/.test(wo.reorder_axis)) {
|
||||
c.top = e.pageY - clickOffset[1];
|
||||
}
|
||||
$helper.css(c);
|
||||
positionBar(e);
|
||||
}
|
||||
})
|
||||
.add( c.$headers )
|
||||
.bind('mouseup.reorder', function(){
|
||||
clearTimeout(timer);
|
||||
if (startIndex !== -1 && endIndex !== -1){
|
||||
finishReorder();
|
||||
} else {
|
||||
startIndex = -1;
|
||||
}
|
||||
});
|
||||
|
||||
// has sticky headers?
|
||||
c.$table.bind('stickyHeadersInit', function(){
|
||||
wo.$sticky.find('thead').children().not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e){
|
||||
mdown(e, this);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// add mouse coordinates
|
||||
$x = $('#main h1:last'); $(document).mousemove(function(e){ $x.html( e.pageX ); });
|
||||
|
||||
})(jQuery);
|
||||
6
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/bootstrap.min.js
vendored
Executable file
6
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/bootstrap.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,704 @@
|
||||
/*
|
||||
===============================================================================
|
||||
Chili is the jQuery code highlighter plugin
|
||||
...............................................................................
|
||||
LICENSE: http://www.opensource.org/licenses/mit-license.php
|
||||
WEBSITE: http://noteslog.com/chili/
|
||||
|
||||
Copyright 2008 / Andrea Ercolino
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
|
||||
( function($) {
|
||||
|
||||
ChiliBook = { //implied global
|
||||
|
||||
version: "2.2" // 2008-07-06
|
||||
|
||||
// options --------------------------------------------------------------------
|
||||
|
||||
, automatic: true
|
||||
, automaticSelector: "code"
|
||||
|
||||
, lineNumbers: !true
|
||||
|
||||
, codeLanguage: function( el ) {
|
||||
var recipeName = $( el ).attr( "class" );
|
||||
return recipeName ? recipeName : '';
|
||||
}
|
||||
|
||||
, recipeLoading: true
|
||||
, recipeFolder: "" // used like: recipeFolder + recipeName + '.js'
|
||||
|
||||
// IE and FF convert   to " ", Safari and Opera do not
|
||||
, replaceSpace: " "
|
||||
, replaceTab: "    "
|
||||
, replaceNewLine: " <br/>"
|
||||
|
||||
, selectionStyle: [ "position:absolute; z-index:3000; overflow:scroll;"
|
||||
, "width:16em;"
|
||||
, "height:9em;"
|
||||
, "border:1px solid gray;"
|
||||
, "padding:15px;"
|
||||
, "background-color:yellow;"
|
||||
].join( ' ' )
|
||||
|
||||
// ------------------------------------------------------------- end of options
|
||||
|
||||
, defaultReplacement: '<span class="$0">$$</span>' // TODO: make this an option again
|
||||
, recipes: {} //repository
|
||||
, queue: {} //registry
|
||||
|
||||
, unique: function() {
|
||||
return (new Date()).valueOf();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
$.fn.chili = function( options ) {
|
||||
var book = $.extend( {}, ChiliBook, options || {} );
|
||||
|
||||
function cook( ingredients, recipe, blockName ) {
|
||||
|
||||
function prepareBlock( recipe, blockName ) {
|
||||
var steps = [];
|
||||
for( var stepName in recipe[ blockName ] ) {
|
||||
steps.push( prepareStep( recipe, blockName, stepName ) );
|
||||
}
|
||||
return steps;
|
||||
} // prepareBlock
|
||||
|
||||
function prepareStep( recipe, blockName, stepName ) {
|
||||
var step = recipe[ blockName ][ stepName ];
|
||||
var exp = ( typeof step._match == "string" ) ? step._match : step._match.source;
|
||||
return {
|
||||
recipe: recipe
|
||||
, blockName: blockName
|
||||
, stepName: stepName
|
||||
, exp: "(" + exp + ")"
|
||||
, length: 1 // add 1 to account for the newly added parentheses
|
||||
+ (exp // count number of submatches in here
|
||||
.replace( /\\./g, "%" ) // disable any escaped character
|
||||
.replace( /\[.*?\]/g, "%" ) // disable any character class
|
||||
.match( /\((?!\?)/g ) // match any open parenthesis, not followed by a ?
|
||||
|| [] // make sure it is an empty array if there are no matches
|
||||
).length // get the number of matches
|
||||
, replacement: step._replace ? step._replace : book.defaultReplacement
|
||||
};
|
||||
} // prepareStep
|
||||
|
||||
function knowHow( steps ) {
|
||||
var prevLength = 1;
|
||||
var exps = [];
|
||||
for (var i = 0; i < steps.length; i++) {
|
||||
var exp = steps[ i ].exp;
|
||||
// adjust backreferences
|
||||
exp = exp.replace( /\\\\|\\(\d+)/g, function( m, aNum ) {
|
||||
return !aNum ? m : "\\" + ( prevLength + 1 + parseInt( aNum, 10 ) );
|
||||
} );
|
||||
exps.push( exp );
|
||||
prevLength += steps[ i ].length;
|
||||
}
|
||||
var prolog = '((?:\\s|\\S)*?)';
|
||||
var epilog = '((?:\\s|\\S)+)';
|
||||
var source = '(?:' + exps.join( "|" ) + ')';
|
||||
source = prolog + source + '|' + epilog;
|
||||
return new RegExp( source, recipe._case ? "g" : "gi" );
|
||||
} // knowHow
|
||||
|
||||
function escapeHTML( str ) {
|
||||
return str.replace( /&/g, "&" ).replace( /</g, "<" );
|
||||
} // escapeHTML
|
||||
|
||||
function replaceSpaces( str ) {
|
||||
return str.replace( / +/g, function( spaces ) {
|
||||
return spaces.replace( / /g, replaceSpace );
|
||||
} );
|
||||
} // replaceSpaces
|
||||
|
||||
function filter( str ) {
|
||||
str = escapeHTML( str );
|
||||
if( replaceSpace ) {
|
||||
str = replaceSpaces( str );
|
||||
}
|
||||
return str;
|
||||
} // filter
|
||||
|
||||
function applyRecipe( subject, recipe ) {
|
||||
return cook( subject, recipe );
|
||||
} // applyRecipe
|
||||
|
||||
function applyBlock( subject, recipe, blockName ) {
|
||||
return cook( subject, recipe, blockName );
|
||||
} // applyBlock
|
||||
|
||||
function applyStep( subject, recipe, blockName, stepName ) {
|
||||
var replaceSpace = book.replaceSpace;
|
||||
|
||||
var step = prepareStep( recipe, blockName, stepName );
|
||||
var steps = [step];
|
||||
|
||||
var perfect = subject.replace( knowHow( steps ), function() {
|
||||
return chef.apply( { steps: steps }, arguments );
|
||||
} );
|
||||
return perfect;
|
||||
} // applyStep
|
||||
|
||||
function applyModule( subject, module, context ) {
|
||||
if( ! module ) {
|
||||
return filter( subject );
|
||||
}
|
||||
|
||||
var sub = module.split( '/' );
|
||||
var recipeName = '';
|
||||
var blockName = '';
|
||||
var stepName = '';
|
||||
switch( sub.length ) {
|
||||
case 1:
|
||||
recipeName = sub[0];
|
||||
break;
|
||||
case 2:
|
||||
recipeName = sub[0]; blockName = sub[1];
|
||||
break;
|
||||
case 3:
|
||||
recipeName = sub[0]; blockName = sub[1]; stepName = sub[2];
|
||||
break;
|
||||
default:
|
||||
return filter( subject );
|
||||
}
|
||||
|
||||
function getRecipe( recipeName ) {
|
||||
var path = getPath( recipeName );
|
||||
var recipe = book.recipes[ path ];
|
||||
if( ! recipe ) {
|
||||
throw {msg:"recipe not available"};
|
||||
}
|
||||
return recipe;
|
||||
}
|
||||
|
||||
try {
|
||||
var recipe;
|
||||
if ( '' == stepName ) {
|
||||
if ( '' == blockName ) {
|
||||
if ( '' == recipeName ) {
|
||||
//nothing to do
|
||||
}
|
||||
else { // ( '' != recipeName )
|
||||
recipe = getRecipe( recipeName );
|
||||
return applyRecipe( subject, recipe );
|
||||
}
|
||||
}
|
||||
else { // ( '' != blockName )
|
||||
if( '' == recipeName ) {
|
||||
recipe = context.recipe;
|
||||
}
|
||||
else {
|
||||
recipe = getRecipe( recipeName );
|
||||
}
|
||||
if( ! (blockName in recipe) ) {
|
||||
return filter( subject );
|
||||
}
|
||||
return applyBlock( subject, recipe, blockName );
|
||||
}
|
||||
}
|
||||
else { // ( '' != stepName )
|
||||
if( '' == recipeName ) {
|
||||
recipe = context.recipe;
|
||||
}
|
||||
else {
|
||||
recipe = getRecipe( recipeName );
|
||||
}
|
||||
if( '' == blockName ) {
|
||||
blockName = context.blockName;
|
||||
}
|
||||
if( ! (blockName in recipe) ) {
|
||||
return filter( subject );
|
||||
}
|
||||
if( ! (stepName in recipe[blockName]) ) {
|
||||
return filter( subject );
|
||||
}
|
||||
return applyStep( subject, recipe, blockName, stepName );
|
||||
}
|
||||
}
|
||||
catch( e ) {
|
||||
if (e.msg && e.msg == "recipe not available") {
|
||||
var cue = 'chili_' + book.unique();
|
||||
if( book.recipeLoading ) {
|
||||
var path = getPath( recipeName );
|
||||
if( ! book.queue[ path ] ) {
|
||||
/* this is a new recipe to download */
|
||||
try {
|
||||
book.queue[ path ] = [ {cue: cue, subject: subject, module: module, context: context} ];
|
||||
$.getJSON( path, function( recipeLoaded ) {
|
||||
book.recipes[ path ] = recipeLoaded;
|
||||
var q = book.queue[ path ];
|
||||
for( var i = 0, iTop = q.length; i < iTop; i++ ) {
|
||||
var replacement = applyModule( q[ i ].subject, q[ i ].module, q[ i ].context );
|
||||
if( book.replaceTab ) {
|
||||
replacement = replacement.replace( /\t/g, book.replaceTab );
|
||||
}
|
||||
if( book.replaceNewLine ) {
|
||||
replacement = replacement.replace( /\n/g, book.replaceNewLine );
|
||||
}
|
||||
$( '#' + q[ i ].cue ).replaceWith( replacement );
|
||||
}
|
||||
} );
|
||||
}
|
||||
catch( recipeNotAvailable ) {
|
||||
alert( "the recipe for '" + recipeName + "' was not found in '" + path + "'" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not a new recipe, so just enqueue this element */
|
||||
book.queue[ path ].push( {cue: cue, subject: subject, module: module, context: context} );
|
||||
}
|
||||
return '<span id="' + cue + '">' + filter( subject ) + '</span>';
|
||||
}
|
||||
return filter( subject );
|
||||
}
|
||||
else {
|
||||
return filter( subject );
|
||||
}
|
||||
}
|
||||
} // applyModule
|
||||
|
||||
function addPrefix( prefix, replacement ) {
|
||||
var aux = replacement.replace( /(<span\s+class\s*=\s*(["']))((?:(?!__)\w)+\2\s*>)/ig, "$1" + prefix + "__$3" );
|
||||
return aux;
|
||||
} // addPrefix
|
||||
|
||||
function chef() {
|
||||
if (! arguments[ 0 ]) {
|
||||
return '';
|
||||
}
|
||||
var steps = this.steps;
|
||||
var i = 0; // iterate steps
|
||||
var j = 2; // iterate chef's arguments
|
||||
var prolog = arguments[ 1 ];
|
||||
var epilog = arguments[ arguments.length - 3 ];
|
||||
if (! epilog) {
|
||||
var step;
|
||||
while( step = steps[ i++ ] ) {
|
||||
var aux = arguments; // this unmasks chef's arguments inside the next function
|
||||
if( aux[ j ] ) {
|
||||
var replacement = '';
|
||||
if( $.isFunction( step.replacement ) ) {
|
||||
var matches = []; //Array.slice.call( aux, j, step.length );
|
||||
for (var k = 0, kTop = step.length; k < kTop; k++) {
|
||||
matches.push( aux[ j + k ] );
|
||||
}
|
||||
matches.push( aux[ aux.length - 2 ] );
|
||||
matches.push( aux[ aux.length - 1 ] );
|
||||
replacement = step.replacement
|
||||
.apply( {
|
||||
x: function() {
|
||||
var subject = arguments[0];
|
||||
var module = arguments[1];
|
||||
var context = {
|
||||
recipe: step.recipe
|
||||
, blockName: step.blockName
|
||||
};
|
||||
return applyModule( subject, module, context );
|
||||
}
|
||||
}, matches );
|
||||
}
|
||||
else { //we expect step.replacement to be a string
|
||||
replacement = step.replacement
|
||||
.replace( /(\\\$)|(?:\$\$)|(?:\$(\d+))/g, function( m, escaped, K ) {
|
||||
if( escaped ) { /* \$ */
|
||||
return "$";
|
||||
}
|
||||
else if( !K ) { /* $$ */
|
||||
return filter( aux[ j ] );
|
||||
}
|
||||
else if( K == "0" ) { /* $0 */
|
||||
return step.stepName;
|
||||
}
|
||||
else { /* $K */
|
||||
return filter( aux[ j + parseInt( K, 10 ) ] );
|
||||
}
|
||||
} );
|
||||
}
|
||||
replacement = addPrefix( step.recipe._name, replacement );
|
||||
return filter( prolog ) + replacement;
|
||||
}
|
||||
else {
|
||||
j+= step.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return filter( epilog );
|
||||
}
|
||||
} // chef
|
||||
|
||||
if( ! blockName ) {
|
||||
blockName = '_main';
|
||||
checkSpices( recipe );
|
||||
}
|
||||
if( ! (blockName in recipe) ) {
|
||||
return filter( ingredients );
|
||||
}
|
||||
var replaceSpace = book.replaceSpace;
|
||||
var steps = prepareBlock( recipe, blockName );
|
||||
var kh = knowHow( steps );
|
||||
var perfect = ingredients.replace( kh, function() {
|
||||
return chef.apply( { steps: steps }, arguments );
|
||||
} );
|
||||
return perfect;
|
||||
|
||||
} // cook
|
||||
|
||||
function loadStylesheetInline( sourceCode ) {
|
||||
if( document.createElement ) {
|
||||
var e = document.createElement( "style" );
|
||||
e.type = "text/css";
|
||||
if( e.styleSheet ) { // IE
|
||||
e.styleSheet.cssText = sourceCode;
|
||||
}
|
||||
else {
|
||||
var t = document.createTextNode( sourceCode );
|
||||
e.appendChild( t );
|
||||
}
|
||||
document.getElementsByTagName( "head" )[0].appendChild( e );
|
||||
}
|
||||
} // loadStylesheetInline
|
||||
|
||||
function checkSpices( recipe ) {
|
||||
var name = recipe._name;
|
||||
if( ! book.queue[ name ] ) {
|
||||
|
||||
var content = ['/* Chili -- ' + name + ' */'];
|
||||
for (var blockName in recipe) {
|
||||
if( blockName.search( /^_(?!main\b)/ ) < 0 ) {
|
||||
for (var stepName in recipe[ blockName ]) {
|
||||
var step = recipe[ blockName ][ stepName ];
|
||||
if( '_style' in step ) {
|
||||
if( step[ '_style' ].constructor == String ) {
|
||||
content.push( '.' + name + '__' + stepName + ' { ' + step[ '_style' ] + ' }' );
|
||||
}
|
||||
else {
|
||||
for (var className in step[ '_style' ]) {
|
||||
content.push( '.' + name + '__' + className + ' { ' + step[ '_style' ][ className ] + ' }' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
content = content.join('\n');
|
||||
|
||||
loadStylesheetInline( content );
|
||||
|
||||
book.queue[ name ] = true;
|
||||
}
|
||||
} // checkSpices
|
||||
|
||||
function askDish( el ) {
|
||||
var recipeName = book.codeLanguage( el );
|
||||
if( '' != recipeName ) {
|
||||
var path = getPath( recipeName );
|
||||
if( book.recipeLoading ) {
|
||||
/* dynamic setups come here */
|
||||
if( ! book.queue[ path ] ) {
|
||||
/* this is a new recipe to download */
|
||||
try {
|
||||
book.queue[ path ] = [ el ];
|
||||
$.getJSON( path, function( recipeLoaded ) {
|
||||
book.recipes[ path ] = recipeLoaded;
|
||||
var q = book.queue[ path ];
|
||||
for( var i = 0, iTop = q.length; i < iTop; i++ ) {
|
||||
makeDish( q[ i ], path );
|
||||
}
|
||||
} );
|
||||
}
|
||||
catch( recipeNotAvailable ) {
|
||||
alert( "the recipe for '" + recipeName + "' was not found in '" + path + "'" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not a new recipe, so just enqueue this element */
|
||||
book.queue[ path ].push( el );
|
||||
}
|
||||
/* a recipe could have been already downloaded */
|
||||
makeDish( el, path );
|
||||
}
|
||||
else {
|
||||
/* static setups come here */
|
||||
makeDish( el, path );
|
||||
}
|
||||
}
|
||||
} // askDish
|
||||
|
||||
function makeDish( el, recipePath ) {
|
||||
var recipe = book.recipes[ recipePath ];
|
||||
if( ! recipe ) {
|
||||
return;
|
||||
}
|
||||
var $el = $( el );
|
||||
var ingredients = $el.text();
|
||||
if( ! ingredients ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//fix for msie: \r (13) is used instead of \n (10)
|
||||
//fix for opera: \r\n is used instead of \n
|
||||
ingredients = ingredients.replace(/\r\n?/g, "\n");
|
||||
|
||||
//reverse fix for safari: msie, mozilla and opera render the initial \n
|
||||
if( $el.parent().is('pre') ) {
|
||||
if( ! $.browser.safari ) {
|
||||
ingredients = ingredients.replace(/^\n/g, "");
|
||||
}
|
||||
}
|
||||
|
||||
var dish = cook( ingredients, recipe ); // all happens here
|
||||
|
||||
if( book.replaceTab ) {
|
||||
dish = dish.replace( /\t/g, book.replaceTab );
|
||||
}
|
||||
if( book.replaceNewLine ) {
|
||||
dish = dish.replace( /\n/g, book.replaceNewLine );
|
||||
}
|
||||
|
||||
el.innerHTML = dish; //much faster than $el.html( dish );
|
||||
//tried also the function replaceHtml from http://blog.stevenlevithan.com/archives/faster-than-innerhtml
|
||||
//but it was not faster nor without sideffects (it was not possible to count spans into el)
|
||||
|
||||
//opera and safari select PRE text correctly
|
||||
if( $.browser.msie || $.browser.mozilla ) {
|
||||
enableSelectionHelper( el );
|
||||
}
|
||||
|
||||
var $that = $el.parent();
|
||||
var classes = $that.attr( 'class' );
|
||||
var ln = /ln-(\d+)-([\w][\w\-]*)|ln-(\d+)|ln-/.exec( classes );
|
||||
if( ln ) {
|
||||
addLineNumbers( el );
|
||||
var start = 0;
|
||||
if( ln[1] ) {
|
||||
start = parseInt( ln[1], 10 );
|
||||
var $pieces = $( '.ln-' + ln[1] + '-' + ln[2] );
|
||||
var pos = $pieces.index( $that[0] );
|
||||
$pieces.slice( 0, pos ).each( function() {
|
||||
start += $( this ).find( 'li' ).length;
|
||||
} );
|
||||
}
|
||||
else if( ln[3] ) {
|
||||
start = parseInt( ln[3], 10 );
|
||||
}
|
||||
else {
|
||||
start = 1;
|
||||
}
|
||||
$el.find( 'ol' )[0].start = start;
|
||||
$('body').width( $('body').width() - 1 ).width( $('body').width() + 1 );
|
||||
}
|
||||
else if( book.lineNumbers ) {
|
||||
addLineNumbers( el );
|
||||
}
|
||||
|
||||
} // makeDish
|
||||
|
||||
function enableSelectionHelper( el ) {
|
||||
var element = null;
|
||||
$( el )
|
||||
.parents()
|
||||
.filter( "pre" )
|
||||
.bind( "mousedown", function() {
|
||||
element = this;
|
||||
if( $.browser.msie ) {
|
||||
document.selection.empty();
|
||||
}
|
||||
else {
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
} )
|
||||
.bind( "mouseup", function( event ) {
|
||||
if( element && (element == this) ) {
|
||||
element = null;
|
||||
var selected = '';
|
||||
if( $.browser.msie ) {
|
||||
selected = document.selection.createRange().htmlText;
|
||||
if( '' == selected ) {
|
||||
return;
|
||||
}
|
||||
selected = preserveNewLines( selected );
|
||||
var container_tag = '<textarea style="STYLE">';
|
||||
}
|
||||
else {
|
||||
selected = window.getSelection().toString(); //opera doesn't select new lines
|
||||
if( '' == selected ) {
|
||||
return;
|
||||
}
|
||||
selected = selected
|
||||
.replace( /\r/g, '' )
|
||||
.replace( /^# ?/g, '' )
|
||||
.replace( /\n# ?/g, '\n' )
|
||||
;
|
||||
var container_tag = '<pre style="STYLE">';
|
||||
}
|
||||
var $container = $( container_tag.replace( /\bSTYLE\b/, ChiliBook.selectionStyle ) )
|
||||
.appendTo( 'body' )
|
||||
.text( selected )
|
||||
.attr( 'id', 'chili_selection' )
|
||||
.click( function() { $(this).remove(); } )
|
||||
;
|
||||
var top = event.pageY - Math.round( $container.height() / 2 ) + "px";
|
||||
var left = event.pageX - Math.round( $container.width() / 2 ) + "px";
|
||||
$container.css( { top: top, left: left } );
|
||||
if( $.browser.msie ) {
|
||||
// window.clipboardData.setData( 'Text', selected ); //I couldn't find anything similar for Mozilla
|
||||
$container[0].focus();
|
||||
$container[0].select();
|
||||
}
|
||||
else {
|
||||
var s = window.getSelection();
|
||||
s.removeAllRanges();
|
||||
var r = document.createRange();
|
||||
r.selectNodeContents( $container[0] );
|
||||
s.addRange( r );
|
||||
}
|
||||
}
|
||||
} )
|
||||
;
|
||||
} // enableSelectionHelper
|
||||
|
||||
function getPath( recipeName ) {
|
||||
return book.recipeFolder + recipeName + ".js";
|
||||
} // getPath
|
||||
|
||||
function getSelectedText() {
|
||||
var text = '';
|
||||
if( $.browser.msie ) {
|
||||
text = document.selection.createRange().htmlText;
|
||||
}
|
||||
else {
|
||||
text = window.getSelection().toString();
|
||||
}
|
||||
return text;
|
||||
} // getSelectedText
|
||||
|
||||
function preserveNewLines( html ) {
|
||||
do {
|
||||
var newline_flag = ChiliBook.unique();
|
||||
}
|
||||
while( html.indexOf( newline_flag ) > -1 );
|
||||
var text = '';
|
||||
if (/<br/i.test(html) || /<li/i.test(html)) {
|
||||
if (/<br/i.test(html)) {
|
||||
html = html.replace( /\<br[^>]*?\>/ig, newline_flag );
|
||||
}
|
||||
else if (/<li/i.test(html)) {
|
||||
html = html.replace( /<ol[^>]*?>|<\/ol>|<li[^>]*?>/ig, '' ).replace( /<\/li>/ig, newline_flag );
|
||||
}
|
||||
var el = $( '<pre>' ).appendTo( 'body' ).hide()[0];
|
||||
el.innerHTML = html;
|
||||
text = $( el ).text().replace( new RegExp( newline_flag, "g" ), '\r\n' );
|
||||
$( el ).remove();
|
||||
}
|
||||
return text;
|
||||
} // preserveNewLines
|
||||
|
||||
function addLineNumbers( el ) {
|
||||
|
||||
function makeListItem1( not_last_line, not_last, last, open ) {
|
||||
var close = open ? '</span>' : '';
|
||||
var aux = '';
|
||||
if( not_last_line ) {
|
||||
aux = '<li>' + open + not_last + close + '</li>';
|
||||
}
|
||||
else if( last ) {
|
||||
aux = '<li>' + open + last + close + '</li>';
|
||||
}
|
||||
return aux;
|
||||
} // makeListItem1
|
||||
|
||||
function makeListItem2( not_last_line, not_last, last, prev_li ) {
|
||||
var aux = '';
|
||||
if( prev_li ) {
|
||||
aux = prev_li;
|
||||
}
|
||||
else {
|
||||
aux = makeListItem1( not_last_line, not_last, last, '' )
|
||||
}
|
||||
return aux;
|
||||
} // makeListItem2
|
||||
|
||||
var html = $( el ).html();
|
||||
var br = /<br>/.test(html) ? '<br>' : '<BR>';
|
||||
var empty_line = '<li>' + book.replaceSpace + '</li>';
|
||||
var list_items = html
|
||||
//extract newlines at the beginning of a span
|
||||
.replace( /(<span [^>]+>)((?:(?: |\xA0)<br>)+)(.*?)(<\/span>)/ig, '$2$1$3$4' ) // I don't know why <span .*?> does not work here
|
||||
//transform newlines inside of a span
|
||||
.replace( /(.*?)(<span .*?>)(.*?)(?:<\/span>(?: |\xA0)<br>|<\/span>)/ig, // but here it does
|
||||
function( all, before, open, content ) {
|
||||
if (/<br>/i.test(content)) {
|
||||
var pieces = before.split( br );
|
||||
var lastPiece = pieces.pop();
|
||||
before = pieces.join( br );
|
||||
var aux = (before ? before + br : '') //+ replace1( lastPiece + content, open );
|
||||
+ (lastPiece + content).replace( /((.*?)(?: |\xA0)<br>)|(.*)/ig,
|
||||
function( tmp, not_last_line, not_last, last ) {
|
||||
var aux2 = makeListItem1( not_last_line, not_last, last, open );
|
||||
return aux2;
|
||||
}
|
||||
);
|
||||
return aux;
|
||||
}
|
||||
else {
|
||||
return all;
|
||||
}
|
||||
}
|
||||
)
|
||||
//transform newlines outside of a span
|
||||
.replace( /(<li>.*?<\/li>)|((.*?)(?: |\xA0)<br>)|(.+)/ig,
|
||||
function( tmp, prev_li, not_last_line, not_last, last ) {
|
||||
var aux2 = makeListItem2( not_last_line, not_last, last, prev_li );
|
||||
return aux2;
|
||||
}
|
||||
)
|
||||
//fix empty lines for Opera
|
||||
.replace( /<li><\/li>/ig, empty_line )
|
||||
;
|
||||
|
||||
el.innerHTML = '<ol>' + list_items + '</ol>';
|
||||
} // addLineNumbers
|
||||
|
||||
function revealChars( tmp ) {
|
||||
return $
|
||||
.map( tmp.split(''),
|
||||
function(n, i) {
|
||||
return ' ' + n + ' ' + n.charCodeAt( 0 ) + ' ';
|
||||
} )
|
||||
.join(' ');
|
||||
} // revealChars
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// the coloring starts here
|
||||
this
|
||||
.each( function() {
|
||||
var $this = $( this );
|
||||
$this.trigger( 'chili.before_coloring' );
|
||||
askDish( this );
|
||||
$this.trigger( 'chili.after_coloring' );
|
||||
} );
|
||||
|
||||
return this;
|
||||
//-----------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
|
||||
|
||||
//main
|
||||
$( function() {
|
||||
|
||||
if( ChiliBook.automatic ) {
|
||||
$( ChiliBook.automaticSelector ).chili();
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} ) ( jQuery );
|
||||
229
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/chili/recipes.js
Executable file
229
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/chili/recipes.js
Executable file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
===============================================================================
|
||||
Chili is the jQuery code highlighter plugin
|
||||
...............................................................................
|
||||
LICENSE: http://www.opensource.org/licenses/mit-license.php
|
||||
WEBSITE: http://noteslog.com/chili/
|
||||
|
||||
Copyright 2008 / Andrea Ercolino
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
ChiliBook.recipeLoading = false;
|
||||
|
||||
ChiliBook.recipes[ "html.js" ] =
|
||||
{
|
||||
_name: 'html'
|
||||
, _case: false
|
||||
, _main: {
|
||||
doctype: {
|
||||
_match: /<!DOCTYPE\b[\w\W]*?>/
|
||||
, _style: "color: #CC6600;"
|
||||
}
|
||||
, ie_style: {
|
||||
_match: /(<!--\[[^\]]*\]>)([\w\W]*?)(<!\[[^\]]*\]-->)/
|
||||
, _replace: function( all, open, content, close ) {
|
||||
return "<span class='ie_style'>" + this.x( open ) + "</span>"
|
||||
+ this.x( content, '//style' )
|
||||
+ "<span class='ie_style'>" + this.x( close ) + "</span>";
|
||||
}
|
||||
, _style: "color: DarkSlateGray; font-weight: bold;"
|
||||
}
|
||||
, comment: {
|
||||
_match: /<!--[\w\W]*?-->/
|
||||
, _style: "color: gray;"
|
||||
}
|
||||
, script: {
|
||||
_match: /(<script\s+[^>]*>)([\w\W]*?)(<\/script\s*>)/
|
||||
, _replace: function( all, open, content, close ) {
|
||||
return this.x( open, '//tag_start' )
|
||||
+ this.x( content, 'js' )
|
||||
+ this.x( close, '//tag_end' );
|
||||
}
|
||||
}
|
||||
, style: {
|
||||
_match: /(<style\s+[^>]*>)([\w\W]*?)(<\/style\s*>)/
|
||||
, _replace: function( all, open, content, close ) {
|
||||
return this.x( open, '//tag_start' )
|
||||
+ this.x( content, 'css' )
|
||||
+ this.x( close, '//tag_end' );
|
||||
}
|
||||
}
|
||||
// matches a starting tag of an element (with attrs)
|
||||
// like "<div ... >" or "<img ... />"
|
||||
, tag_start: {
|
||||
_match: /(<\w+)((?:[?%]>|[\w\W])*?)(\/>|>)/
|
||||
, _replace: function( all, open, content, close ) {
|
||||
return "<span class='tag_start'>" + this.x( open ) + "</span>"
|
||||
+ this.x( content, '/tag_attrs' )
|
||||
+ "<span class='tag_start'>" + this.x( close ) + "</span>";
|
||||
}
|
||||
, _style: "color: navy;"
|
||||
}
|
||||
// matches an ending tag
|
||||
// like "</div>"
|
||||
, tag_end: {
|
||||
_match: /<\/\w+\s*>|\/>/
|
||||
, _style: "color: navy;"
|
||||
}
|
||||
, entity: {
|
||||
_match: /&\w+?;/
|
||||
, _style: "color: blue;"
|
||||
}
|
||||
}
|
||||
, tag_attrs: {
|
||||
// matches a name/value pair
|
||||
attr: {
|
||||
// before in $1, name in $2, between in $3, value in $4
|
||||
_match: /(\W*?)([\w-]+)(\s*=\s*)((?:\'[^\']*(?:\\.[^\']*)*\')|(?:\"[^\"]*(?:\\.[^\"]*)*\"))/
|
||||
, _replace: "$1<span class='attr_name'>$2</span>$3<span class='attr_value'>$4</span>"
|
||||
, _style: { attr_name: "color: royalBlue;", attr_value: "color: maroon;" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ChiliBook.recipes[ "js.js" ] =
|
||||
{
|
||||
_name: 'js'
|
||||
, _case: true
|
||||
, _main: {
|
||||
ml_comment: {
|
||||
_match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
|
||||
, _style: 'color: gray;'
|
||||
}
|
||||
, sl_comment: {
|
||||
_match: /\/\/.*/
|
||||
, _style: 'color: gray;'
|
||||
}
|
||||
, string: {
|
||||
_match: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/
|
||||
, _style: 'color: teal;'
|
||||
}
|
||||
, num: {
|
||||
_match: /\b[+-]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?\b/
|
||||
, _style: 'color: #a00;'
|
||||
}
|
||||
, boolean: {
|
||||
_match: /\b(true|false|null)\b/
|
||||
, _style: 'color: #c00;'
|
||||
}
|
||||
, reg_not: { //this prevents "a / b / c" to be interpreted as a reg_exp
|
||||
_match: /(?:\w+\s*)\/[^\/\\\n]*(?:\\.[^\/\\\n]*)*\/[gim]*(?:\s*\w+)/
|
||||
, _replace: function( all ) {
|
||||
return this.x( all, '//num' );
|
||||
}
|
||||
}
|
||||
, reg_exp: {
|
||||
_match: /\/[^\/\\\n]*(?:\\.[^\/\\\n]*)*\/[gim]*/
|
||||
, _style: 'color: maroon;'
|
||||
}
|
||||
, brace: {
|
||||
_match: /[\{\}]/
|
||||
, _style: 'color: #c00; font-weight: bold;'
|
||||
}
|
||||
, statement: {
|
||||
_match: /\b(with|while|var|try|throw|switch|return|if|for|finally|else|do|default|continue|const|catch|case|break)\b/
|
||||
, _style: 'color: navy; font-weight: bold;'
|
||||
}
|
||||
, error: {
|
||||
_match: /\b(URIError|TypeError|SyntaxError|ReferenceError|RangeError|EvalError|Error)\b/
|
||||
, _style: 'color: Coral;'
|
||||
}
|
||||
, object: {
|
||||
_match: /\b(String|RegExp|Object|Number|Math|Function|Date|Boolean|Array)\b/
|
||||
, _style: 'color: DeepPink;'
|
||||
}
|
||||
, property: {
|
||||
_match: /\b(undefined|arguments|NaN|Infinity)\b/
|
||||
, _style: 'color: Purple; font-weight: bold;'
|
||||
}
|
||||
, 'function': {
|
||||
_match: /\b(parseInt|parseFloat|isNaN|isFinite|eval|encodeURIComponent|encodeURI|decodeURIComponent|decodeURI)\b/
|
||||
, _style: 'color: olive;'
|
||||
}
|
||||
, operator: {
|
||||
_match: /\b(void|typeof|this|new|instanceof|in|function|delete)\b/
|
||||
, _style: 'color: RoyalBlue; font-weight: bold;'
|
||||
}
|
||||
, liveconnect: {
|
||||
_match: /\b(sun|netscape|java|Packages|JavaPackage|JavaObject|JavaClass|JavaArray|JSObject|JSException)\b/
|
||||
, _style: 'text-decoration: overline;'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ChiliBook.recipes[ "css.js" ] =
|
||||
{
|
||||
_name: 'css'
|
||||
, _case: true
|
||||
, _main: {
|
||||
comment: {
|
||||
_match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
|
||||
, _style: "color: gray;"
|
||||
}
|
||||
, directive: {
|
||||
_match: /@\w+/
|
||||
, _style: "color: fuchsia;"
|
||||
}
|
||||
, url: {
|
||||
_match: /\b(url\s*\()([^)]+)(\))/
|
||||
, _replace: "<span class='url'>$1</span><span class='number'>$2</span><span class='url'>$3</span>"
|
||||
, _style: "color: #490093;"
|
||||
}
|
||||
, block: {
|
||||
_match: /\{([\w\W]*?)\}/
|
||||
, _replace: function( all, pairs ) {
|
||||
return '{' + this.x( pairs, '/definition' ) + '}';
|
||||
}
|
||||
}
|
||||
, 'class': {
|
||||
_match: /\.\S+/
|
||||
, _style: "color: #0069d2; font-weight: bold;"
|
||||
}
|
||||
, id: {
|
||||
_match: /#\S+/
|
||||
, _style: "color: #75029B; font-weight: bold;"
|
||||
}
|
||||
, pseudo: {
|
||||
_match: /:\w+/
|
||||
, _style: "color: #CC9900;"
|
||||
}
|
||||
, element: {
|
||||
_match: /\w+/
|
||||
, _style: "color: #004080; font-weight: bold;"
|
||||
}
|
||||
}
|
||||
, definition: {
|
||||
comment: {
|
||||
_match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\//
|
||||
}
|
||||
, property: {
|
||||
_match: /\b(?:zoom|z-index|writing-mode|word-wrap|word-spacing|word-break|width|widows|white-space|volume|voice-family|visibility|vertical-align|unicode-bidi|top|text-underline-position|text-transform|text-shadow|text-overflow|text-kashida-space|text-justify|text-indent|text-decoration|text-autospace|text-align-last|text-align|table-layout|stress|speech-rate|speak-punctuation|speak-numeral|speak-header|speak|size|scrollbar-track-color|scrollbar-shadow-color|scrollbar-highlight-color|scrollbar-face-color|scrollbar-dark-shadow-color|scrollbar-base-color|scrollbar-arrow-color|scrollbar-3d-light-color|ruby-position|ruby-overhang|ruby-align|right|richness|quotes|position|play-during|pitch-range|pitch|pause-before|pause-after|pause|page-break-inside|page-break-before|page-break-after|page|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-Y|overflow-X|overflow|outline-width|outline-style|outline-color|outline|orphans|min-width|min-height|max-width|max-height|marks|marker-offset|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|line-break|letter-spacing|left|layout-grid-type|layout-grid-mode|layout-grid-line|layout-grid-char-spacing|layout-grid-char|layout-grid|layout-flow|layer-background-image|layer-background-color|include-source|ime-mode|height|font-weight|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-family|font|float|filter|empty-cells|elevation|display|direction|cursor|cue-before|cue-after|cue|counter-reset|counter-increment|content|color|clip|clear|caption-side|bottom|border-width|border-top-width|border-top-style|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-left-width|border-left-style|border-left-color|border-left|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-color|border-bottom|border|behavior|background-repeat|background-position-y|background-position-x|background-position|background-image|background-color|background-attachment|background|azimuth|accelerator|opacity)\s*:/
|
||||
, _style: "color: #330066;"
|
||||
}
|
||||
, special: {
|
||||
_match: /\b(?:-use-link-source|-set-link-source|-replace|-moz-user-select|-moz-user-modify|-moz-user-input|-moz-user-focus|-moz-outline-width|-moz-outline-style|-moz-outline-color|-moz-outline|-moz-opacity|-moz-border-top-colors|-moz-border-right-colors|-moz-border-radius-topright|-moz-border-radius-topleft|-moz-border-radius-bottomright|-moz-border-radius-bottomleft|-moz-border-radius|-moz-border-left-colors|-moz-border-bottom-colors|-moz-binding|-webkit-transition|-moz-transition|-o-transition|transition|-webkit-box-sizing|-moz-box-sizing|box-sizing)\s*:/
|
||||
, _style: "color: #330066;"
|
||||
}
|
||||
, url: {
|
||||
_match: /\b(url\s*\()([^)]+)(\))/
|
||||
, _replace: "<span class='url'>$1</span><span class='number'>$2</span><span class='url'>$3</span>"
|
||||
}
|
||||
, value: {
|
||||
_match: /\b(?:xx-small|xx-large|x-soft|x-small|x-slow|x-low|x-loud|x-large|x-high|x-fast|wider|wait|w-resize|visible|url|uppercase|upper-roman|upper-latin|upper-alpha|underline|ultra-expanded|ultra-condensed|tv|tty|transparent|top|thin|thick|text-top|text-bottom|table-row-group|table-row|table-header-group|table-footer-group|table-column-group|table-column|table-cell|table-caption|sw-resize|super|sub|status-bar|static|square|spell-out|speech|solid|soft|smaller|small-caption|small-caps|small|slower|slow|silent|show|separate|semi-expanded|semi-condensed|se-resize|scroll|screen|s-resize|run-in|rtl|rightwards|right-side|right|ridge|rgb|repeat-y|repeat-x|repeat|relative|projection|print|pre|portrait|pointer|overline|outside|outset|open-quote|once|oblique|nw-resize|nowrap|normal|none|no-repeat|no-open-quote|no-close-quote|ne-resize|narrower|n-resize|move|mix|middle|message-box|medium|marker|ltr|lowercase|lower-roman|lower-latin|lower-greek|lower-alpha|lower|low|loud|local|list-item|line-through|lighter|level|leftwards|left-side|left|larger|large|landscape|justify|italic|invert|inside|inset|inline-table|inline|icon|higher|high|hide|hidden|help|hebrew|handheld|groove|format|fixed|faster|fast|far-right|far-left|fantasy|extra-expanded|extra-condensed|expanded|embossed|embed|e-resize|double|dotted|disc|digits|default|decimal-leading-zero|decimal|dashed|cursive|crosshair|cross|crop|counters|counter|continuous|condensed|compact|collapse|code|close-quote|circle|center-right|center-left|center|caption|capitalize|braille|bottom|both|bolder|bold|block|blink|bidi-override|below|behind|baseline|avoid|auto|aural|attr|armenian|always|all|absolute|above|not-allowed|inherit)\b/
|
||||
, _style: "color: #3366FF;"
|
||||
}
|
||||
, string: {
|
||||
_match: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/
|
||||
, _style: "color: teal;"
|
||||
}
|
||||
, number: {
|
||||
_match: /(?:\b[+-]?(?:\d*\.?\d+|\d+\.?\d*))(?:%|(?:(?:px|pt}rem|em|s|)\b))/
|
||||
, _style: "color: maroon;"
|
||||
}
|
||||
, color : {
|
||||
_match: /(?:\#[a-fA-F0-9]{3,6})|\b(?:yellow|white|teal|silver|red|purple|olive|navy|maroon|lime|green|gray|fuchsia|blue|black|aqua|YellowGreen|Yellow|WhiteSmoke|White|Wheat|Violet|Turquoise|Tomato|Thistle|Teal|Tan|SteelBlue|SpringGreen|Snow|SlateGrey|SlateGray|SlateBlue|SkyBlue|Silver|Sienna|SeaShell|SeaGreen|SandyBrown|Salmon|SaddleBrown|RoyalBlue|RosyBrown|Red|Purple|PowderBlue|Plum|Pink|Peru|PeachPuff|PapayaWhip|PaleVioletRed|PaleTurquoise|PaleGreen|PaleGoldenRod|Orchid|OrangeRed|Orange|OliveDrab|Olive|OldLace|Navy|NavajoWhite|Moccasin|MistyRose|MintCream|MidnightBlue|MediumVioletRed|MediumTurquoise|MediumSpringGreen|MediumSlateBlue|MediumSeaGreen|MediumPurple|MediumOrchid|MediumBlue|MediumAquaMarine|Maroon|Magenta|Linen|LimeGreen|Lime|LightYellow|LightSteelBlue|LightSlateGrey|LightSlateGray|LightSkyBlue|LightSeaGreen|LightSalmon|LightPink|LightGrey|LightGreen|LightGray|LightGoldenRodYellow|LightCyan|LightCoral|LightBlue|LemonChiffon|LawnGreen|LavenderBlush|Lavender|Khaki|Ivory|Indigo|IndianRed|HotPink|HoneyDew|Grey|GreenYellow|Green|Gray|GoldenRod|Gold|GhostWhite|Gainsboro|Fuchsia|ForestGreen|FloralWhite|FireBrick|DodgerBlue|DimGrey|DimGray|DeepSkyBlue|DeepPink|Darkorange|DarkViolet|DarkTurquoise|DarkSlateGrey|DarkSlateGray|DarkSlateBlue|DarkSeaGreen|DarkSalmon|DarkRed|DarkOrchid|DarkOliveGreen|DarkMagenta|DarkKhaki|DarkGrey|DarkGreen|DarkGray|DarkGoldenRod|DarkCyan|DarkBlue|Cyan|Crimson|Cornsilk|CornflowerBlue|Coral|Chocolate|Chartreuse|CadetBlue|BurlyWood|Brown|BlueViolet|Blue|BlanchedAlmond|Black|Bisque|Beige|Azure|Aquamarine|Aqua|AntiqueWhite|AliceBlue)\b/
|
||||
, _style: "color: green;"
|
||||
}
|
||||
}
|
||||
};
|
||||
175
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/demo-build-table.js
Executable file
175
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/demo-build-table.js
Executable file
@@ -0,0 +1,175 @@
|
||||
$(function(){
|
||||
|
||||
// ***************************
|
||||
// ARRAY
|
||||
// ***************************
|
||||
var arry = [
|
||||
[ 'ID', 'Name', 'Age', 'Date' ], // header
|
||||
[ 'A42b', 'Parker', 28, 'Jul 6, 2006 8:14 AM' ], // row 1
|
||||
[ 'A255', 'Hood', 33, 'Dec 10, 2002 5:14 AM' ], // row 2
|
||||
[ 'A33', 'Kent', 18, 'Jan 12, 2003 11:14 AM' ], // row 3
|
||||
[ 'A1', 'Franklin', 45, 'Jan 18, 2001 9:12 AM' ], // row 4
|
||||
[ 'A102', 'Evans', 22, 'Jan 18, 2007 9:12 AM' ], // row 5
|
||||
[ 'A42a', 'Everet', 22, 'Jan 18, 2007 9:12 AM' ], // row 6
|
||||
[ 'ID', 'Name', 'Age', 'Date' ] // footer
|
||||
];
|
||||
|
||||
$('#array2Table').tablesorter({
|
||||
theme: 'blue',
|
||||
data : arry,
|
||||
widgets: ['zebra'],
|
||||
widgetOptions : {
|
||||
// build_type : 'array', // can be detected if undefined
|
||||
// build_source : arry, // overrides the data setting above
|
||||
build_headers : {
|
||||
widths : ['15%', '30%', '15%', '40%'] // set header cell widths
|
||||
},
|
||||
build_footers : {
|
||||
text : [ 'ID (a###)', 'Last Name', 'Age (joined)', 'Date (joined)' ]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// ***************************
|
||||
// ARRAY (from string)
|
||||
// ***************************
|
||||
$('#string2Table').tablesorter({
|
||||
theme: 'blue',
|
||||
widgets: ['zebra'],
|
||||
widgetOptions: {
|
||||
build_type : 'array',
|
||||
build_source : 'header 1,header 2,header 3;r1c1,r1c2,r1c3;r2c1,r2c2,r2c3;r3c1,r3c2,r3c3;"footer, 1","footer, 2","footer, 3"',
|
||||
build_processing : function(data, wo) {
|
||||
var rows = data.split(';');
|
||||
return $.each(rows, function(i,cells) {
|
||||
// similar to using rows[i] = cells.split(',') but the splitCSV script
|
||||
// doesn't split the cell if the separator (comma) is within quotes
|
||||
rows[i] = $.tablesorter.buildTable.splitCSV(cells, ',');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// ***************************
|
||||
// CSV (DOM)
|
||||
// ***************************
|
||||
$('#csv2Table').tablesorter({
|
||||
theme: 'blue',
|
||||
widgets: ['zebra'],
|
||||
widgetOptions: {
|
||||
// *** build widget core ***
|
||||
build_type : 'csv', // array, object, csv, ajax
|
||||
build_source : $('.csv'), // url, dom
|
||||
build_complete : 'tablesorter-build-complete', // triggered event when build completes
|
||||
|
||||
// *** CSV & array ***
|
||||
build_headers : {
|
||||
rows : 1, // Number of header rows from the csv
|
||||
classes : [], // Header classes to apply to cells
|
||||
text : [], // Header cell text
|
||||
widths : ['3%', '27%', '50%', '20%'] // set header cell widths
|
||||
},
|
||||
build_footers : {
|
||||
rows : 1, // Number of header rows from the csv
|
||||
classes : [], // Footer classes to apply to cells
|
||||
text : [] // Footer cell text
|
||||
},
|
||||
build_numbers : {
|
||||
addColumn : '#', // include row numbering column?
|
||||
sortable : true // make column sortable?
|
||||
},
|
||||
|
||||
// *** CSV options ***
|
||||
build_csvStartLine : 0, // line within the csv to start adding to table
|
||||
build_csvSeparator : ",", // csv separator
|
||||
}
|
||||
});
|
||||
|
||||
// ***************************
|
||||
// CSV (Ajax)
|
||||
// ***************************
|
||||
$('#csv2Table2').tablesorter({
|
||||
theme: 'blue',
|
||||
widgets: ['zebra'],
|
||||
widgetOptions: {
|
||||
// *** build widget core ***
|
||||
build_type : 'csv',
|
||||
build_source : { url: 'assets/build.txt', dataType: 'html' },
|
||||
build_headers : {
|
||||
widths : ['30%', '50%', '20%'] // set header cell widths
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// ***************************
|
||||
// OBJECT (Variable)
|
||||
// ***************************
|
||||
var dataObject = {
|
||||
headers : [
|
||||
[
|
||||
// each object/string is a cell
|
||||
{ text: 'First Name', class: 'fname', width: '10%' }, // row 0 cell 1
|
||||
'Last Name',
|
||||
{ text: 'Age', class: 'age', 'data-sorter' : false }, // row 0 cell 3
|
||||
'Total',
|
||||
{ text: 'Discount', class : 'sorter-false' }, // row 0 cell 5
|
||||
{ text: 'Date', class : 'date' } // row 0 cell 6
|
||||
]
|
||||
],
|
||||
footers : 'clone', // clone headers or assign array like headers
|
||||
rows : [
|
||||
// TBODY 1
|
||||
[ 'Peter', 'Parker', 28, '$9.99', '20%', 'Jul 6, 2006 8:14 AM' ], // row 1
|
||||
[ 'John', 'Hood', 33, '$19.99', '25%', 'Dec 10, 2002 5:14 AM' ], // row 2
|
||||
[ 'Clark', 'Kent', 18, '$15.89', '44%', 'Jan 12, 2003 11:14 AM' ], // row 3
|
||||
|
||||
// TBODY 2
|
||||
{ newTbody: true, class: 'tablesorter-infoOnly' },
|
||||
{ cells : [ { html: '<strong>Info Row</strong>', colSpan: 6 } ] }, // row 4
|
||||
|
||||
// TBODY 3
|
||||
{ newTbody: true },
|
||||
[ 'Bruce', 'Evans', 22, '$13.19', '11%', 'Jan 18, 2007 9:12 AM' ], // row 5
|
||||
[ 'Brice', 'Almighty', 45, '$153.19', '44%', 'Jan 18, 2001 9:12 AM' ], // row 6
|
||||
|
||||
{ class: 'specialRow', // row 7
|
||||
cells: [
|
||||
// each object/string is a cell
|
||||
{ text: 'Fred', class: 'fname' },
|
||||
{ text: 'Smith', class: 'lname' },
|
||||
{ text: 18, class: 'age', 'data-info': 'fake ID!, he is really 16' },
|
||||
{ text: '$22.44', class: 'total' },
|
||||
'8%',
|
||||
{ text: 'Aug 20, 2012 10:15 AM', class: 'date' }
|
||||
],
|
||||
'data-info' : 'This row likes turtles'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
$('#object2Table').tablesorter({
|
||||
theme: 'blue',
|
||||
data : dataObject,
|
||||
widgets: ['zebra'],
|
||||
widgetOptions : {
|
||||
// *** build object options ***
|
||||
build_objectRowKey : 'rows', // object key containing table rows
|
||||
build_objectCellKey : 'cells', // object key containing table cells (within the rows object)
|
||||
build_objectHeaderKey : 'headers', // object key containing table headers
|
||||
build_objectFooterKey : 'footers' // object key containing table footers
|
||||
}
|
||||
});
|
||||
|
||||
// ***************************
|
||||
// OBJECT (JSON via Ajax)
|
||||
// ***************************
|
||||
$('#object2Table2').tablesorter({
|
||||
theme: 'blue',
|
||||
widgets: ['zebra'],
|
||||
widgetOptions: {
|
||||
build_type : 'json',
|
||||
build_source : { url: 'assets/build.json', dataType: 'json' }
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
208
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/docs.js
Executable file
208
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/docs.js
Executable file
@@ -0,0 +1,208 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global prettyPrint:false */
|
||||
(function($){
|
||||
$(function(){
|
||||
var $t, t, v, animating, clicked,
|
||||
|
||||
cleanupCode = function(code){
|
||||
return code.replace(/[<>\"\'\t\n]/g, function(m) { return {
|
||||
'<' : '<',
|
||||
'>' : '>',
|
||||
"'" : ''',
|
||||
'"' : '"',
|
||||
'\t': ' ',
|
||||
'\n': '<br/>' // needed for IE
|
||||
}[m];});
|
||||
};
|
||||
|
||||
$("a.external").each(function(){this.target = '_new';});
|
||||
|
||||
// get javascript source
|
||||
if ($("#js").length) {
|
||||
$("#javascript pre").addClass('mod').html( cleanupCode( $("#js").html() ) );
|
||||
}
|
||||
if ($("#css").length) {
|
||||
$("pre.lang-css").addClass('mod').html( cleanupCode( $("#css").html() ) );
|
||||
}
|
||||
if ($("#demo").length && $("#html pre").length) {
|
||||
$("#html pre").addClass('mod').html( cleanupCode( $("#demo").html() ) );
|
||||
}
|
||||
|
||||
// apply to already pre-formatted blocks to add <br> for IE
|
||||
$('pre.prettyprint:not(.mod)').each(function(){
|
||||
$t = $(this);
|
||||
$t.html( cleanupCode( $t.html() ) );
|
||||
});
|
||||
|
||||
if (typeof prettyPrint !== 'undefined') { prettyPrint(); }
|
||||
|
||||
// hide child rows
|
||||
$('#root .tablesorter-childRow').hide();
|
||||
// toggle child row content, not hiding the row since we are using rowspan
|
||||
$('#root .toggle').click(function(){
|
||||
$(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
animating = false;
|
||||
clicked = false;
|
||||
$('.collapsible').hide();
|
||||
|
||||
$('a.permalink').click(function(){
|
||||
var $el = $(this);
|
||||
setTimeout(function(){
|
||||
if (!animating && !clicked) {
|
||||
animating = true;
|
||||
$el.closest('tr').find('.collapsible').slideToggle();
|
||||
setTimeout(function(){ animating = false; }, 200);
|
||||
}
|
||||
}, 200);
|
||||
return false;
|
||||
});
|
||||
$('#root .permalink').dblclick(function(){
|
||||
clicked = true;
|
||||
window.location.hash = '#' + $(this).closest('tr')[0].id;
|
||||
showProperty();
|
||||
setTimeout(function(){ clicked = false; }, 500);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.toggleAll, .showAll, .hideAll').click(function(){
|
||||
t = $.trim($(this).text());
|
||||
// use nextAll to ignore any <br> or other elements between this link and the table
|
||||
$(this).parent().nextAll('table:first').find('.collapsible')[t]();
|
||||
return false;
|
||||
});
|
||||
|
||||
// update version number
|
||||
$t = $('.current-version');
|
||||
if ($t.length) {
|
||||
$t.html($.tablesorter.version);
|
||||
}
|
||||
|
||||
// add high visibility tags for newest versions (just grab the major revision number 2.10.0 -> 10
|
||||
t = $.tablesorter.version.replace(/(v|version|\+)/g, '').split('.');
|
||||
v = [ parseInt(t[0], 10) || 1, parseInt(t[1], 10) || 0 ];
|
||||
$('.version').each(function(){
|
||||
var i;
|
||||
$t = $(this);
|
||||
i = $t.text().replace(/(v|version|\+)/g, '').split('.');
|
||||
t = [ parseInt(i[0], 10) || 1, parseInt(i[1], 10) || 0 ];
|
||||
if (t[0] === v[0] && t[1] >= v[1] - 1 ) {
|
||||
$t.prepend('<span class="label ' + ( t[0] === v[0] && t[1] < v[1] ? ' label-default' : ' label-success' ) +
|
||||
'">'+ ($t.hasClass('updated') ? 'Updated' : 'New') + '</span> ');
|
||||
}
|
||||
});
|
||||
|
||||
$t = $('.accordion');
|
||||
if ($t.length) {
|
||||
var id, hashId,
|
||||
hash = window.location.hash;
|
||||
// add accodion ids
|
||||
$t.each(function(i){
|
||||
$(this).children('h3').each(function(i){
|
||||
var txt = $(this).find('a').text().toLowerCase().replace(/[-:()\"]/g,'').replace(/[\s+\/]/g,'_');
|
||||
this.id = txt;
|
||||
if (hash && txt === hash.slice(1)) {
|
||||
hashId = i;
|
||||
}
|
||||
});
|
||||
});
|
||||
// set up accordions
|
||||
$t.each(function(i){
|
||||
var $this = $(this);
|
||||
$this.accordion({
|
||||
active: hashId,
|
||||
animate: false,
|
||||
heightStyle: 'content',
|
||||
collapsible: true,
|
||||
create: function() {
|
||||
$this.children('h3').each(function(i){
|
||||
this.id = $(this).find('a').text().toLowerCase().replace(/[-:()\"]/g,'').replace(/[\s+\/]/g,'_');
|
||||
$(this).before('<a class="accordion-link link" data-index="' + i + '" href="#' + this.id + '"></a>');
|
||||
});
|
||||
$this.find('.accordion-link').click(function(){
|
||||
$this.accordion( "option", "active", $(this).data('index') );
|
||||
});
|
||||
},
|
||||
activate: function(e, ui) {
|
||||
// refresh zebra widget when rows are visible
|
||||
ui.newPanel.find('table').trigger('applyWidgets');
|
||||
}
|
||||
});
|
||||
// open parent accordion of nested accordion
|
||||
if ( $this.find(hash).length && !$this.children(hash).length ) {
|
||||
// div should have an id of ui-accordion-#-panel-#
|
||||
id = $(hash).closest('.ui-accordion-content').attr('id').match(/\d+$/);
|
||||
if (id && id.length) {
|
||||
$this.accordion('option', 'active', Number(id[0]) - 1);
|
||||
}
|
||||
|
||||
// open table row of nested accordion
|
||||
} else if ( ($this.find(hash).closest('tr').attr('id') || '') !== '') {
|
||||
t = $this.find(hash).closest('tr');
|
||||
t.find('.collapsible').show();
|
||||
if (t.closest('table').hasClass('hasStickyHeaders')) {
|
||||
setTimeout(function(){
|
||||
window.scrollTo( 0, t.offset().top - 27 );
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function showProperty(){
|
||||
var prop, $t, wo, h = window.location.hash;
|
||||
if (h) {
|
||||
prop = $(h);
|
||||
if (prop.length && !/h3|a|table/i.test(prop[0].tagName)) {
|
||||
prop.find('.collapsible').show();
|
||||
if (h === '#csschildrow') {
|
||||
$('#root .tablesorter-childRow').show();
|
||||
}
|
||||
// move below sticky header; added delay as there could be some lag
|
||||
setTimeout(function(){
|
||||
$t = prop.closest('table');
|
||||
if ($t.length) {
|
||||
wo = $t[0].config.widgetOptions;
|
||||
h = ( wo.$sticky ? wo.$sticky.height() : '' ) || $t.hasClass('hasStickHeaders') ? 27 : 0;
|
||||
if ($t.hasClass('options') || $t.hasClass('api')) {
|
||||
window.scrollTo( 0, prop.offset().top - h );
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(window).load(function(){
|
||||
if ($('#root').length) {
|
||||
$(window).bind('hashchange', function(){
|
||||
showProperty();
|
||||
});
|
||||
showProperty();
|
||||
}
|
||||
});
|
||||
|
||||
// append hidden parsed value to cell
|
||||
// used by feet-inch-fraction & metric parser demos
|
||||
window.addParsedValues = function($t, cols, format){
|
||||
var r,
|
||||
$r = $t.find('tbody tr'),
|
||||
c = $t[0].config.cache[0].normalized;
|
||||
$r.each(function(i){
|
||||
r = this;
|
||||
$.each(cols, function(v,j){
|
||||
r.cells[j].innerHTML += ' <span class="val hidden removeme">(<span class="results">' + (format ? format(c[i][j]) : c[i][j]) + '</span>)</span>';
|
||||
});
|
||||
});
|
||||
|
||||
$('.toggleparsedvalue').on('click', function(){
|
||||
$('.val').toggleClass('hidden');
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
32
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-1.2.6.min.js
vendored
Executable file
32
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-1.2.6.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
167
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-1.4.4.min.js
vendored
Executable file
167
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-1.4.4.min.js
vendored
Executable file
@@ -0,0 +1,167 @@
|
||||
/*!
|
||||
* jQuery JavaScript Library v1.4.4
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* http://sizzlejs.com/
|
||||
* Copyright 2010, The Dojo Foundation
|
||||
* Released under the MIT, BSD, and GPL Licenses.
|
||||
*
|
||||
* Date: Thu Nov 11 19:04:53 2010 -0500
|
||||
*/
|
||||
(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
|
||||
h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;k<J.length;k++){h=J[k];h.origType.replace(X,"")===a.type?f.push(h.selector):J.splice(k--,1)}f=c(a.target).closest(f,a.currentTarget);o=0;for(x=f.length;o<x;o++){r=f[o];for(k=0;k<J.length;k++){h=J[k];if(r.selector===h.selector&&(!A||A.test(h.namespace))){l=r.elem;e=null;if(h.preType==="mouseenter"||
|
||||
h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==l)C.push({elem:l,handleObj:h,level:r.level})}}}o=0;for(x=C.length;o<x;o++){f=C[o];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
|
||||
"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
|
||||
e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
|
||||
"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
|
||||
a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
|
||||
C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
|
||||
s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
|
||||
j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
|
||||
toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
|
||||
-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
|
||||
if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(s in j){v=G[s];z=j[s];if(G!==z)if(ga&&z&&(b.isPlainObject(z)||(H=b.isArray(z)))){if(H){H=false;v=v&&b.isArray(v)?v:[]}else v=v&&b.isPlainObject(v)?v:{};G[s]=b.extend(ga,v,z)}else if(z!==B)G[s]=z}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;
|
||||
if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
|
||||
b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
|
||||
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
|
||||
l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H<G;){if(s.apply(j[H++],v)===false)break}else if(K)for(z in j){if(s.call(j[z],
|
||||
z,j[z])===false)break}else for(v=j[0];H<G&&s.call(v,H,v)!==false;v=j[++H]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(k,"").replace(o,"")},makeArray:function(j,s){var v=s||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?M.call(v,j):b.merge(v,j)}return v},inArray:function(j,s){if(s.indexOf)return s.indexOf(j);for(var v=0,z=s.length;v<z;v++)if(s[v]===j)return v;return-1},merge:function(j,
|
||||
s){var v=j.length,z=0;if(typeof s.length==="number")for(var H=s.length;z<H;z++)j[v++]=s[z];else for(;s[z]!==B;)j[v++]=s[z++];j.length=v;return j},grep:function(j,s,v){var z=[],H;v=!!v;for(var G=0,K=j.length;G<K;G++){H=!!s(j[G],G);v!==H&&z.push(j[G])}return z},map:function(j,s,v){for(var z=[],H,G=0,K=j.length;G<K;G++){H=s(j[G],G,v);if(H!=null)z[z.length]=H}return z.concat.apply([],z)},guid:1,proxy:function(j,s,v){if(arguments.length===2)if(typeof s==="string"){v=j;j=v[s];s=B}else if(s&&!b.isFunction(s)){v=
|
||||
s;s=B}if(!s&&j)s=function(){return j.apply(v||this,arguments)};if(j)s.guid=j.guid=j.guid||s.guid||b.guid++;return s},access:function(j,s,v,z,H,G){var K=j.length;if(typeof s==="object"){for(var Q in s)b.access(j,Q,s[Q],z,H,v);return j}if(v!==B){z=!G&&z&&b.isFunction(v);for(Q=0;Q<K;Q++)H(j[Q],s,z?v.call(j[Q],Q,H(j[Q],s)):v,G);return j}return K?H(j[0],s):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=L.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&n.exec(j)||
|
||||
[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,s){R["[object "+s+"]"]=s.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=m.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,s){return D.call(s,j)};if(!/\s/.test("\u00a0")){k=/^[\s\xA0]+/;o=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)u=function(){t.removeEventListener("DOMContentLoaded",u,
|
||||
false);b.ready()};else if(t.attachEvent)u=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",u);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
|
||||
k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
|
||||
scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
|
||||
false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
|
||||
1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
|
||||
"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
|
||||
c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
|
||||
else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,
|
||||
a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===B){d=this.triggerHandler("getData"+k[1]+"!",[k[0]]);if(d===B&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===B&&k[1]?this.data(k[0]):d}else return this.each(function(){var o=c(this),x=[k[0],b];o.triggerHandler("setData"+k[1]+"!",x);c.data(this,a,b);o.triggerHandler("changeData"+k[1]+"!",x)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=
|
||||
c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
|
||||
a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var sa=/[\n\t]/g,ha=/\s+/,Sa=/\r/g,Ta=/^(?:href|src|style)$/,Ua=/^(?:button|input)$/i,Va=/^(?:button|input|object|select|textarea)$/i,Wa=/^a(?:rea)?$/i,ta=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",
|
||||
colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(x){var r=c(this);r.addClass(a.call(this,x,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===
|
||||
1)if(f.className){for(var h=" "+f.className+" ",l=f.className,k=0,o=b.length;k<o;k++)if(h.indexOf(" "+b[k]+" ")<0)l+=" "+b[k];f.className=c.trim(l)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var x=c(this);x.removeClass(a.call(this,o,x.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(sa," "),
|
||||
l=0,k=b.length;l<k;l++)h=h.replace(" "+b[l]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,l=c(this),k=b,o=a.split(ha);f=o[h++];){k=e?k:!l.hasClass(f);l[k?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,
|
||||
"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(sa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
|
||||
if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var l=f[h];if(l.selected&&(c.support.optDisabled?!l.disabled:l.getAttribute("disabled")===null)&&(!l.parentNode.disabled||!c.nodeName(l.parentNode,"optgroup"))){a=c(l).val();if(b)return a;d.push(a)}}return d}if(ta.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Sa,"")}return B}var k=c.isFunction(a);return this.each(function(o){var x=c(this),r=a;if(this.nodeType===1){if(k)r=
|
||||
a.call(this,o,x.val());if(r==null)r="";else if(typeof r==="number")r+="";else if(c.isArray(r))r=c.map(r,function(C){return C==null?"":C+""});if(c.isArray(r)&&ta.test(this.type))this.checked=c.inArray(x.val(),r)>=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
|
||||
attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
|
||||
b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
|
||||
c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
|
||||
arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
|
||||
d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
|
||||
c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h<A.length;h++){C=A[h];if(d.guid===C.guid){if(k||x.test(C.namespace)){e==null&&A.splice(h--,1);r.remove&&r.remove.call(a,C)}if(e!=null)break}}if(A.length===0||e!=null&&A.length===1){if(!r.teardown||r.teardown.call(a,o)===false)c.removeEvent(a,f,w.handle);delete I[f]}}else for(h=0;h<A.length;h++){C=A[h];if(k||x.test(C.namespace)){c.event.remove(a,r,C.handler,h);A.splice(h--,1)}}}if(c.isEmptyObject(I)){if(b=
|
||||
w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,J);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
|
||||
8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
|
||||
"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
|
||||
d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f<l;f++){var k=d[f];if(b||e.test(k.namespace)){a.handler=k.handler;a.data=k.data;a.handleObj=k;k=k.handler.apply(this,h);if(k!==B){a.result=k;if(k===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
|
||||
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
|
||||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ka,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
|
||||
Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
|
||||
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
|
||||
var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
|
||||
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
|
||||
xa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
|
||||
B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
|
||||
"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
|
||||
0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h<k;h++)c.event.add(this[h],d,l,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
|
||||
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
|
||||
1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var ya={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var l,k=0,o,x,r=h||this.selector;h=h?this:c(this.context);if(typeof d===
|
||||
"object"&&!d.preventDefault){for(l in d)h[b](l,e,d[l],r);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(l=d[k++])!=null;){o=X.exec(l);x="";if(o){x=o[0];l=l.replace(X,"")}if(l==="hover")d.push("mouseenter"+x,"mouseleave"+x);else{o=l;if(l==="focus"||l==="blur"){d.push(ya[l]+x);l+=x}else l=(ya[l]||l)+x;if(b==="live"){x=0;for(var A=h.length;x<A;x++)c.event.add(h[x],"live."+Y(l,r),{data:e,selector:r,handler:f,origType:l,origHandler:f,preType:o})}else h.unbind("live."+Y(l,r),f)}}return this}});
|
||||
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
|
||||
(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1&&!q){y.sizcache=n;y.sizset=p}if(y.nodeName.toLowerCase()===i){F=y;break}y=y[g]}m[p]=F}}}function b(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1){if(!q){y.sizcache=n;y.sizset=p}if(typeof i!=="string"){if(y===i){F=true;break}}else if(k.filter(i,
|
||||
[y]).length>0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
|
||||
break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
|
||||
q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
|
||||
l;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};k.matches=function(g,i){return k(g,null,null,i)};k.matchesSelector=function(g,i){return k(i,null,null,[g]).length>0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p<q;p++){var u,y=o.order[p];if(u=o.leftMatch[y].exec(g)){var F=u[1];u.splice(1,1);if(F.substr(F.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");m=o.find[y](u,i,n);if(m!=null){g=g.replace(o.match[y],"");break}}}}m||(m=i.getElementsByTagName("*"));
|
||||
return{set:m,expr:g}};k.filter=function(g,i,n,m){for(var p,q,u=g,y=[],F=i,M=i&&i[0]&&k.isXML(i[0]);g&&i.length;){for(var N in o.filter)if((p=o.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=o.filter[N];D=p[1];q=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===y)y=[];if(o.preFilter[N])if(p=o.preFilter[N](p,F,n,y,m,M)){if(p===true)continue}else q=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var s=m^!!O;if(n&&O!=null)if(s)q=true;else F[j]=false;else if(s){y.push(D);q=true}}if(O!==
|
||||
B){n||(F=y);g=g.replace(o.match[N],"");if(!q)return[];break}}}if(g===u)if(q==null)k.error(g);else break;u=g}return F};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var o=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
|
||||
POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var n=typeof i==="string",m=n&&!/\W/.test(i);n=n&&!m;if(m)i=i.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=n||q&&q.nodeName.toLowerCase()===
|
||||
i?q||false:q===i}n&&k.filter(i,g,true)},">":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p<q;p++){if(n=g[p]){n=n.parentNode;g[p]=n.nodeName.toLowerCase()===i?n:false}}else{for(;p<q;p++)if(n=g[p])g[p]=m?n.parentNode:n.parentNode===i;m&&k.filter(i,g,true)}},"":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=i=i.toLowerCase();q=a}q("parentNode",i,p,g,m,n)},"~":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=
|
||||
i=i.toLowerCase();q=a}q("previousSibling",i,p,g,m,n)}},find:{ID:function(g,i,n){if(typeof i.getElementById!=="undefined"&&!n)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){for(var n=[],m=i.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&n.push(m[p]);return n.length===0?null:n}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,n,m,p,q){g=" "+g[1].replace(/\\/g,
|
||||
"")+" ";if(q)return g;q=0;for(var u;(u=i[q])!=null;q++)if(u)if(p^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
|
||||
m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
|
||||
true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
|
||||
g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return i<n[3]-0},gt:function(g,i,n){return i>n[3]-0},nth:function(g,i,n){return n[3]-
|
||||
0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n<m;n++)if(i[n]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var n=i[1],m=g;switch(n){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(n===
|
||||
"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":n=i[2];var p=i[3];if(n===1&&p===0)return true;var q=i[0],u=g.parentNode;if(u&&(u.sizcache!==q||!g.nodeIndex)){var y=0;for(m=u.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++y;u.sizcache=q}m=g.nodeIndex-p;return n===0?m===0:m%n===0&&m/n>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
|
||||
i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
|
||||
if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
|
||||
g);else if(typeof g.length==="number")for(var p=g.length;n<p;n++)m.push(g[n]);else for(;g[n];n++)m.push(g[n]);return m}}var w,I;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var n,m,p=[],q=[];n=g.parentNode;m=i.parentNode;var u=n;if(g===i){h=true;return 0}else if(n===m)return I(g,i);else if(n){if(!m)return 1}else return-1;
|
||||
for(;u;){p.unshift(u);u=u.parentNode}for(u=m;u;){q.unshift(u);u=u.parentNode}n=p.length;m=q.length;for(u=0;u<n&&u<m;u++)if(p[u]!==q[u])return I(p[u],q[u]);return u===n?I(g,q[u],-1):I(p[u],i,1)};I=function(g,i,n){if(g===i)return n;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}k.getText=function(g){for(var i="",n,m=0;g[m];m++){n=g[m];if(n.nodeType===3||n.nodeType===4)i+=n.nodeValue;else if(n.nodeType!==8)i+=k.getText(n.childNodes)}return i};(function(){var g=t.createElement("div"),
|
||||
i="script"+(new Date).getTime(),n=t.documentElement;g.innerHTML="<a name='"+i+"'/>";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
|
||||
n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
|
||||
function(){var g=k,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
|
||||
p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
|
||||
t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
|
||||
function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n<u;n++)k(g,q[n],m);return k.filter(p,m)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=k.getText;c.isXMLDoc=k.isXML;
|
||||
c.contains=k.contains})();var Za=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,ab=/,/,Na=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,cb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var l=0;l<d;l++)if(b[l]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},
|
||||
not:function(a){return this.pushStack(ma(this,a,false),"not",a)},filter:function(a){return this.pushStack(ma(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
|
||||
h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(l?l.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
|
||||
c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
|
||||
2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
|
||||
b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
|
||||
e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1,
|
||||
"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
|
||||
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
|
||||
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
|
||||
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
|
||||
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
|
||||
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null;
|
||||
else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=
|
||||
c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,l=a[0],k=[];if(!c.support.checkClone&&arguments.length===3&&typeof l==="string"&&Da.test(l))return this.each(function(){c(this).domManip(a,
|
||||
b,d,true)});if(c.isFunction(l))return this.each(function(x){var r=c(this);a[0]=l.call(this,x,b?r.html():B);r.domManip(a,b,d)});if(this[0]){e=l&&l.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);h=e.fragment;if(f=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var o=this.length;f<o;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):
|
||||
this[f]:this[f],f>0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",
|
||||
prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var l=(f>0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||
|
||||
b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1></$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]==="<table>"&&!x?r.childNodes:[];for(o=k.length-
|
||||
1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
|
||||
d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,
|
||||
jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,
|
||||
zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
|
||||
h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
|
||||
if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=
|
||||
d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left;
|
||||
e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
||||
ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b===
|
||||
"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("<div>").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
|
||||
!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
|
||||
getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
|
||||
script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
|
||||
!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache=
|
||||
false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset;
|
||||
A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type",
|
||||
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
|
||||
c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
|
||||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]=
|
||||
encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",
|
||||
[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),
|
||||
e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});
|
||||
if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",
|
||||
3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",qa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",
|
||||
d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,
|
||||
d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),l,k=this.nodeType===1,o=k&&c(this).is(":hidden"),x=this;for(l in a){var r=c.camelCase(l);if(l!==r){a[r]=a[l];delete a[l];l=r}if(a[l]==="hide"&&o||a[l]==="show"&&!o)return h.complete.call(this);if(k&&(l==="height"||l==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(qa(this.nodeName)===
|
||||
"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[l])){(h.specialEasing=h.specialEasing||{})[l]=a[l][1];a[l]=a[l][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(A,C){var J=new c.fx(x,h,A);if(vb.test(C))J[C==="toggle"?o?"show":"hide":C](a);else{var w=wb.exec(C),I=J.cur()||0;if(w){var L=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(x,A,(L||1)+g);I=(L||
|
||||
1)/J.cur()*I;c.style(x,A,I+g)}if(w[1])L=(w[1]==="-="?-1:1)*L+I;J.custom(I,L,g)}else J.custom(I,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
|
||||
d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
|
||||
Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)}
|
||||
var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
|
||||
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
|
||||
this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
|
||||
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
|
||||
b.elem}).length};var xb=/^t(?:able|d|h)$/i,Ia=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(l){c.offset.setOffset(this,a,l)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
|
||||
h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(x){c.offset.setOffset(this,a,x)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b.ownerDocument,h=f.documentElement,l=f.body;d=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;
|
||||
for(var k=b.offsetTop,o=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==h;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;d=f?f.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;o-=b.scrollLeft;if(b===e){k+=b.offsetTop;o+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&xb.test(b.nodeName))){k+=parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){k+=
|
||||
parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){k+=l.offsetTop;o+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){k+=Math.max(h.scrollTop,l.scrollTop);o+=Math.max(h.scrollLeft,l.scrollLeft)}return{top:k,left:o}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
|
||||
height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
|
||||
f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
|
||||
"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),l=c.css(a,"top"),k=c.css(a,"left"),o=e==="absolute"&&c.inArray("auto",[l,k])>-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a,
|
||||
e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&&
|
||||
c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
|
||||
c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+
|
||||
b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window);
|
||||
4
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-latest.min.js
vendored
Executable file
4
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-latest.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
13
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-ui-latest.min.js
vendored
Executable file
13
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery-ui-latest.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
11
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery.jui_theme_switch.min.js
vendored
Executable file
11
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery.jui_theme_switch.min.js
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @fileOverview jui_theme_switch: jquery plugin to switch juery-ui themes
|
||||
* <p>License MIT
|
||||
* <br />Copyright 2012 Christos Pontikis <a href="http://pontikis.net">http://pontikis.net</a>
|
||||
* <br />Project page <a href="http://pontikis.net/labs/jui_theme_switch">http://pontikis.net/labs/jui_theme_switch</a>
|
||||
* <br />Minified using Online YUI Compressor http://www.refresh-sf.com/yui/
|
||||
* @version 1.0.6 (21 Jan 2013)
|
||||
* @author Christos Pontikis http://pontikis.net
|
||||
* @requires jquery, jquery-ui
|
||||
*/
|
||||
"use strict";(function(e){var d="jui_theme_switch",c="jui_theme_switch_status";var a={init:function(f){var g=this;return this.each(function(){var k=g.data(d);if(typeof(k)=="undefined"){var n=g.jui_theme_switch("getDefaults");k=e.extend({},n,f)}else{k=e.extend({},k,f)}g.data(d,k);if(typeof g.data(c)==="undefined"){g.data(c,{});g.data(c)["selected_theme"]={}}g.unbind("onChangeTheme").bind("onChangeTheme",k.onChangeTheme);g.unbind("onDisplay").bind("onDisplay",k.onDisplay);var p=g.attr("id"),r,q,s="",h=b(k.switcher_id_prefix,p),u=b(k.switcher_label_id_prefix,p),t,m,w=e("#"+k.stylesheet_link_id),o="",l,j="",v="";e.ajax({url:k.datasource_url,dataType:"json",cache:false,success:function(i){r=i.length;s+='<label id="'+u+'" for="'+h+'">'+k.switcher_label+"</label>";s+='<select id="'+h+'" size="'+k.list_size+'">';for(q=0;q<r;q++){if(l=i[q]["active"]=="yes"||k.show_all=="yes"){if(k.use_groups=="yes"){l=i[q]["group"];if(l!==j){s+='<optgroup label="'+l+'">';j=l}}if(k.default_theme==i[q]["theme_name"]){g.data(c)["selected_theme"]=i[q];o=' selected="selected"'}else{o=""}v="";if(i[q].hasOwnProperty("hosted_locally")){if(i[q]["hosted_locally"]=="yes"){v=k.project_url}}s+='<option value="'+v+i[q]["theme_url"]+'"'+o+">";s+=i[q]["theme_name"];s+="</option>";if(k.use_groups=="yes"){if(q<r-1&&i[parseInt(q)+1]["group"]!==j){s+="</optgroup>"}}}}s+="</select>";g.html(s);m=e("#"+u);t=e("#"+h);m.removeClass().addClass(k.labelClass);t.removeClass().addClass(k.listClass);g.removeClass().addClass(k.containerClass);g.off("change",t).on("change",t,function(){w.attr("href",t.val());for(q=0;q<r;q++){if(e("#"+h+" option:selected").text()==i[q]["theme_name"]){g.data(c)["selected_theme"]=i[q];break}}g.triggerHandler("onChangeTheme",i[q])});g.triggerHandler("onDisplay")}})})},getDefaults:function(){return{switcher_label:"Select theme",default_theme:"ui-lightness",list_size:"1",use_groups:"yes",show_all:"no",project_url:"",containerClass:"switcher_container",labelClass:"switcher_label",listClass:"switcher_list",switcher_label_id_prefix:"lbl_",switcher_id_prefix:"switcher_",onChangeTheme:function(){},onDisplay:function(){}}},getOption:function(f){var g=this;return g.data(d)[f]},getAllOptions:function(){var f=this;return f.data(d)},setOption:function(f,i,h){var g=this;g.data(d)[f]=i;if(h){g.jui_theme_switch("init")}},refresh:function(){var f=this;f.jui_theme_switch()},destroy:function(){return e(this).each(function(){var f=e(this);f.removeData(d)})},getTheme:function(){var f=this;return f.data(c)["selected_theme"]}};var b=function(g,f){return g+f};e.fn.jui_theme_switch=function(g){if(this.size()!=1){var f="You must use this plugin ("+d+") with a unique element (at once)";this.html('<span style="color: red;">ERROR: '+f+"</span>");e.error(f)}if(a[g]){return a[g].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof g==="object"||!g){return a.init.apply(this,arguments)}else{e.error("Method "+g+" does not exist on jQuery."+d)}}}})(jQuery);
|
||||
7
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery.tipsy.min.js
vendored
Executable file
7
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/jquery.tipsy.min.js
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
/* tipsy, facebook style tooltips for jquery
|
||||
* version 1.0.0a
|
||||
* (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
||||
* released under the MIT license
|
||||
* Modified to use themes: https://github.com/Mottie/tipsy
|
||||
*/
|
||||
(function(b){function l(a,c){this.$element=b(a);this.options=c;this.enabled=!0;this.fixTitle()}l.prototype={show:function(){var a=this.getTitle();if(a&&this.enabled){var c=this.tip(),d=this.options.theme[0]||"black",f=this.options.theme[1]||"white",g;c.find(".tipsy-inner").css({background:d,color:f})[this.options.html?"html":"text"](a);c[0].className="tipsy";c.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var a=b.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth, height:this.$element[0].offsetHeight}),f=c[0].offsetWidth,h=c[0].offsetHeight,e="function"==typeof this.options.gravity?this.options.gravity.call(this.$element[0]):this.options.gravity,k;switch(e.charAt(0)){case "n":k={top:a.top+a.height+this.options.offset,left:a.left+a.width/2-f/2};g={"border-bottom-color":d};break;case "s":k={top:a.top-h-this.options.offset,left:a.left+a.width/2-f/2};g={"border-top-color":d};break;case "e":k={top:a.top+a.height/2-h/2,left:a.left-f-this.options.offset};g={"border-left-color":d}; break;case "w":k={top:a.top+a.height/2-h/2,left:a.left+a.width+this.options.offset},g={"border-right-color":d}}2==e.length&&("w"==e.charAt(1)?k.left=a.left+a.width/2-15:k.left=a.left+a.width/2-f+15);c.css(k).addClass("tipsy-"+e);c.find(".tipsy-arrow").css(g)[0].className="tipsy-arrow tipsy-arrow-"+e.charAt(0);this.options.className&&c.addClass("function"==typeof this.options.className?this.options.className.call(this.$element[0]):this.options.className);this.options.fade?c.stop().css({opacity:0,display:"block", visibility:"visible"}).animate({opacity:this.options.opacity}):c.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){b(this).remove()}):this.tip().remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("original-title"))&&a.attr("original-title",a.attr("title")||"").removeAttr("title")},getTitle:function(){var a,b=this.$element,d=this.options;this.fixTitle();d=this.options;"string"== typeof d.title?a=b.attr("title"==d.title?"original-title":d.title):"function"==typeof d.title&&(a=d.title.call(b[0]));return(a=(""+a).replace(/(^\s*|\s*$)/,""))||d.fallback},tip:function(){this.$tip||(this.$tip=b('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'));return this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.options=this.$element=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled= !this.enabled}};b.fn.tipsy=function(a){function c(e){var c=b.data(e,"tipsy");c||(c=new l(e,b.fn.tipsy.elementOptions(e,a)),b.data(e,"tipsy",c));return c}function d(){var b=c(this);b.hoverState="in";0==a.delayIn?b.show():(b.fixTitle(),setTimeout(function(){"in"==b.hoverState&&b.show()},a.delayIn))}function f(){var b=c(this);b.hoverState="out";0==a.delayOut?b.hide():setTimeout(function(){"out"==b.hoverState&&b.hide()},a.delayOut)}if(!0===a)return this.data("tipsy");if("string"==typeof a){var g=this.data("tipsy"); if(g)g[a]();return this}a=b.extend({},b.fn.tipsy.defaults,a);a.live||this.each(function(){c(this)});if("manual"!=a.trigger){var g=a.live?"live":"bind",h="hover"==a.trigger?"mouseleave":"blur";this[g]("hover"==a.trigger?"mouseenter":"focus",d)[g](h,f)}return this};b.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:0.8,title:"title",theme:["black","white"],trigger:"hover"};b.fn.tipsy.elementOptions=function(a,c){return b.metadata? b.extend({},c,b(a).metadata()):c};b.fn.tipsy.autoNS=function(){return b(this).offset().top>b(document).scrollTop()+b(window).height()/2?"s":"n"};b.fn.tipsy.autoWE=function(){return b(this).offset().left>b(document).scrollLeft()+b(window).width()/2?"e":"w"};b.fn.tipsy.autoBounds=function(a,c){return function(){var d=c[0],f=1<c.length?c[1]:!1,g=b(document).scrollTop()+a,h=b(document).scrollLeft()+a,e=b(this);e.offset().top<g&&(d="n");e.offset().left<h&&(f="w");b(window).width()+b(document).scrollLeft()- e.offset().left<a&&(f="e");b(window).height()+b(document).scrollTop()-e.offset().top<a&&(d="s");return d+(f?f:"")}}})(jQuery);
|
||||
28
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/prettify.js
Executable file
28
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/prettify.js
Executable file
@@ -0,0 +1,28 @@
|
||||
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
|
||||
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
|
||||
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
|
||||
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
|
||||
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
|
||||
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
|
||||
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
|
||||
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
|
||||
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
|
||||
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
|
||||
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
|
||||
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
|
||||
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
|
||||
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
|
||||
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
|
||||
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
|
||||
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
|
||||
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
|
||||
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
|
||||
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
|
||||
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
|
||||
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
|
||||
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();
|
||||
28
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/search-ie.js
Executable file
28
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/search-ie.js
Executable file
@@ -0,0 +1,28 @@
|
||||
/* IE 8 and less */
|
||||
$(function(){
|
||||
// open side menu
|
||||
var checked = false;
|
||||
$('.main-header').click(function(){
|
||||
checked = !checked;
|
||||
$('#main-nav').animate({ width: checked ? 250 : 0 }, 300);
|
||||
$('#main')
|
||||
.animate({ marginLeft: checked ? 250 : 0 }, 300)
|
||||
.css({ overflow: checked ? 'hidden' : '' })
|
||||
.find('.open-menu').toggle(!checked).end()
|
||||
.find('.close-menu').toggle(checked).end()
|
||||
.find('#banner h1').css({ paddingLeft : checked ? 0 : 30 });
|
||||
});
|
||||
|
||||
// make sure the case insensitive button is checked (visually)
|
||||
$('#csfalse').addClass('switch-selection-right');
|
||||
|
||||
// search option buttons
|
||||
$('.switch-label').click(function(){
|
||||
var tar = $(this).attr('for');
|
||||
$('#' + tar)
|
||||
.prop('checked', true)
|
||||
.change()
|
||||
.siblings('.switch-selection')
|
||||
.toggleClass( 'switch-selection-right', (tar === 'letter' || tar === 'csfalse') );
|
||||
});
|
||||
});
|
||||
160
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/search.js
Executable file
160
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/search.js
Executable file
@@ -0,0 +1,160 @@
|
||||
/* jQuery Highlight plugin
|
||||
* Based on highlight v3 by Johann Burkard
|
||||
* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
|
||||
* Copyright (c) 2009 Bartek Szopka
|
||||
* Licensed under MIT license.
|
||||
* Modified to require a minimum number of characters before searching
|
||||
*/
|
||||
;jQuery.extend({highlight:function(a,c,b,d,f){if(3===a.nodeType){if(c=a.data.match(c))return b=document.createElement(b||"span"),b.className=d||"highlight",a=a.splitText(c.index),a.splitText(c[0].length),d=a.cloneNode(!0),b.appendChild(d),a.parentNode.replaceChild(b,a),1}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName)&&1>$(a).closest(f).length&&(a.tagName!==b.toUpperCase()||a.className!==d))for(var e=0;e<a.childNodes.length;e++)e+=jQuery.highlight(a.childNodes[e],c,b,d,f); return 0}});jQuery.fn.unhighlight=function(a){var c={className:"highlight",element:"span"};jQuery.extend(c,a);return this.find(c.element+"."+c.className).each(function(){var a=this.parentNode;a.replaceChild(this.firstChild,this);a.normalize()}).end()}; jQuery.fn.highlight=function(a,c){var b={className:"highlight",element:"span",caseSensitive:!1,wordsOnly:!1,ignore:"",min:3,error:">= 3",message:function(a){console&&console.log&&console.log(a)}},b=jQuery.extend(b,c);a.constructor===String&&(a=0<a.indexOf(",")?a.replace(/\s+/g," ").split(/\s*,\s*/g):[a]);a=jQuery.grep(a,function(a){return""!==a});if(a.join("").length<b.min)return b.message&&b.message(b.error||""),!1;a=jQuery.map(a,function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}); if(0===a.length)return this;var d=b.caseSensitive?"":"i",f="("+a.join("|")+")";b.wordsOnly&&(f="\\b"+f+"\\b");var e=RegExp(f,d);return this.each(function(){jQuery.highlight(this,e,b.element,b.className,b.ignore)})};
|
||||
|
||||
/* tipsy, facebook style tooltips for jquery
|
||||
* version 1.0.0a
|
||||
* (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
||||
* released under the MIT license
|
||||
* Modified to use themes: https://github.com/Mottie/tipsy
|
||||
*/
|
||||
(function(b){function l(a,c){this.$element=b(a);this.options=c;this.enabled=!0;this.fixTitle()}l.prototype={show:function(){var a=this.getTitle();if(a&&this.enabled){var c=this.tip(),d=this.options.theme[0]||"black",f=this.options.theme[1]||"white",g;c.find(".tipsy-inner").css({background:d,color:f})[this.options.html?"html":"text"](a);c[0].className="tipsy";c.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var a=b.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth, height:this.$element[0].offsetHeight}),f=c[0].offsetWidth,h=c[0].offsetHeight,e="function"==typeof this.options.gravity?this.options.gravity.call(this.$element[0]):this.options.gravity,k;switch(e.charAt(0)){case "n":k={top:a.top+a.height+this.options.offset,left:a.left+a.width/2-f/2};g={"border-bottom-color":d};break;case "s":k={top:a.top-h-this.options.offset,left:a.left+a.width/2-f/2};g={"border-top-color":d};break;case "e":k={top:a.top+a.height/2-h/2,left:a.left-f-this.options.offset};g={"border-left-color":d}; break;case "w":k={top:a.top+a.height/2-h/2,left:a.left+a.width+this.options.offset},g={"border-right-color":d}}2==e.length&&("w"==e.charAt(1)?k.left=a.left+a.width/2-15:k.left=a.left+a.width/2-f+15);c.css(k).addClass("tipsy-"+e);c.find(".tipsy-arrow").css(g)[0].className="tipsy-arrow tipsy-arrow-"+e.charAt(0);this.options.className&&c.addClass("function"==typeof this.options.className?this.options.className.call(this.$element[0]):this.options.className);this.options.fade?c.stop().css({opacity:0,display:"block", visibility:"visible"}).animate({opacity:this.options.opacity}):c.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){b(this).remove()}):this.tip().remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("original-title"))&&a.attr("original-title",a.attr("title")||"").removeAttr("title")},getTitle:function(){var a,b=this.$element,d=this.options;this.fixTitle();d=this.options;"string"== typeof d.title?a=b.attr("title"==d.title?"original-title":d.title):"function"==typeof d.title&&(a=d.title.call(b[0]));return(a=(""+a).replace(/(^\s*|\s*$)/,""))||d.fallback},tip:function(){this.$tip||(this.$tip=b('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'));return this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.options=this.$element=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled= !this.enabled}};b.fn.tipsy=function(a){function c(e){var c=b.data(e,"tipsy");c||(c=new l(e,b.fn.tipsy.elementOptions(e,a)),b.data(e,"tipsy",c));return c}function d(){var b=c(this);b.hoverState="in";0==a.delayIn?b.show():(b.fixTitle(),setTimeout(function(){"in"==b.hoverState&&b.show()},a.delayIn))}function f(){var b=c(this);b.hoverState="out";0==a.delayOut?b.hide():setTimeout(function(){"out"==b.hoverState&&b.hide()},a.delayOut)}if(!0===a)return this.data("tipsy");if("string"==typeof a){var g=this.data("tipsy"); if(g)g[a]();return this}a=b.extend({},b.fn.tipsy.defaults,a);a.live||this.each(function(){c(this)});if("manual"!=a.trigger){var g=a.live?"live":"bind",h="hover"==a.trigger?"mouseleave":"blur";this[g]("hover"==a.trigger?"mouseenter":"focus",d)[g](h,f)}return this};b.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:0.8,title:"title",theme:["black","white"],trigger:"hover"};b.fn.tipsy.elementOptions=function(a,c){return b.metadata? b.extend({},c,b(a).metadata()):c};b.fn.tipsy.autoNS=function(){return b(this).offset().top>b(document).scrollTop()+b(window).height()/2?"s":"n"};b.fn.tipsy.autoWE=function(){return b(this).offset().left>b(document).scrollLeft()+b(window).width()/2?"e":"w"};b.fn.tipsy.autoBounds=function(a,c){return function(){var d=c[0],f=1<c.length?c[1]:!1,g=b(document).scrollTop()+a,h=b(document).scrollLeft()+a,e=b(this);e.offset().top<g&&(d="n");e.offset().left<h&&(f="w");b(window).width()+b(document).scrollLeft()- e.offset().left<a&&(f="e");b(window).height()+b(document).scrollTop()-e.offset().top<a&&(d="s");return d+(f?f:"")}}})(jQuery);
|
||||
|
||||
/*!
|
||||
query-string
|
||||
Parse and stringify URL query strings
|
||||
https://github.com/sindresorhus/query-string
|
||||
by Sindre Sorhus
|
||||
MIT License
|
||||
*/
|
||||
(function(){var b={parse:function(a){return"string"!==typeof a?{}:(a=a.trim().replace(/^\?/,""))?a.trim().split("&").reduce(function(a,b){var c=b.replace(/\+/g," ").split("=");a[c[0]]=void 0===c[1]?null:decodeURIComponent(c[1]);return a},{}):{}},stringify:function(a){return a?Object.keys(a).map(function(b){return encodeURIComponent(b)+"="+encodeURIComponent(a[b])}).join("&"):""}};"undefined"!==typeof module&&module.exports?module.exports=b:window.queryString=b})();
|
||||
|
||||
/* page search */
|
||||
/*jshint browser:true, jquery:true */
|
||||
/*global queryString:false */
|
||||
jQuery(function($){
|
||||
// $("body p").highlight(["jQuery", "highlight", "plugin"]);
|
||||
var resultsLength, searching,
|
||||
search = window.location.search,
|
||||
$results = [],
|
||||
index = 0,
|
||||
$window = $(window),
|
||||
$main = $('#main'),
|
||||
$search = $('.search').val(''), // Firefox retains the input value
|
||||
$status = $('.status'),
|
||||
$word = $('#word'),
|
||||
$case = $('#cstrue'), // case sensitive
|
||||
updateStatus = function(){
|
||||
var value = $search.val();
|
||||
$status.empty().removeClass('busy');
|
||||
if (resultsLength) {
|
||||
$results.removeClass('selected').eq(index).addClass('selected');
|
||||
}
|
||||
if (value !== '') {
|
||||
$status
|
||||
.html( (resultsLength === 0 ? 0 : index + 1) + '/' + resultsLength )
|
||||
.toggleClass('label label-danger', resultsLength === 0);
|
||||
message(
|
||||
resultsLength > 0 ? '' :
|
||||
value.length > 2 ? 'No results' : 'Please enter three or more letters'
|
||||
);
|
||||
} else {
|
||||
message('');
|
||||
}
|
||||
},
|
||||
message = function(text){
|
||||
$status
|
||||
.attr('original-title', text)
|
||||
.tipsy( text === '' ? 'hide' : 'show' );
|
||||
// make sure the result count doesn't cover the search text
|
||||
$search.css('padding-right', $status.width() + 5);
|
||||
},
|
||||
jumpTo = function(){
|
||||
if (resultsLength) {
|
||||
var resultPosition, parentPosition,
|
||||
$current = $results.eq(index),
|
||||
$collapsible = $current.closest('.collapsible, tr[id]');
|
||||
if ($collapsible.length && $collapsible.is(':hidden')) {
|
||||
$collapsible.slideToggle();
|
||||
}
|
||||
if ($current.length) {
|
||||
resultPosition = $current.position().top;
|
||||
parentPosition = $collapsible.length ? $current.closest('tr[id]').position().top : resultPosition;
|
||||
if (parentPosition + $(window).height() < resultPosition) {
|
||||
parentPosition = resultPosition;
|
||||
}
|
||||
$window.scrollTop( parentPosition - 28 );
|
||||
}
|
||||
}
|
||||
updateStatus();
|
||||
},
|
||||
applySearch = function(){
|
||||
searching = queryString.parse(search);
|
||||
if (searching.q) {
|
||||
$('#main-nav-check').prop('checked', true);
|
||||
$search
|
||||
.val( searching.q )
|
||||
// make searching.index a zero-based index
|
||||
.trigger('change', [ isNaN(searching.index) ? 0 : parseInt(searching.index, 10) - 1 ]);
|
||||
}
|
||||
};
|
||||
|
||||
// make sure defaults are set
|
||||
$('#word, #csfalse').click();
|
||||
|
||||
$search
|
||||
// needed for IE
|
||||
.on('keyup', function(e){
|
||||
if (e.which === 13) {
|
||||
$(this).trigger('change');
|
||||
}
|
||||
})
|
||||
.add('#word, #letter, #cstrue, #csfalse').on('change', function(event, newIndex){
|
||||
index = newIndex || 0;
|
||||
$status.addClass('busy');
|
||||
setTimeout(function(){
|
||||
$main
|
||||
.unhighlight()
|
||||
.highlight( $search.val(), {
|
||||
ignore:'thead',
|
||||
wordsOnly: $word.is(':checked'),
|
||||
caseSensitive: $case.is(':checked')
|
||||
});
|
||||
$results = $('.highlight');
|
||||
resultsLength = $results.length;
|
||||
if (index > resultsLength) {
|
||||
index = resultsLength - 1;
|
||||
}
|
||||
jumpTo();
|
||||
}, 1);
|
||||
});
|
||||
$('.search-prev, .search-next').click(function(){
|
||||
if (resultsLength) {
|
||||
index = index + ($(this).hasClass('search-prev') ? -1 : 1);
|
||||
if (index < 0) { index = resultsLength - 1; }
|
||||
if (index > resultsLength - 1) { index = 0; }
|
||||
jumpTo();
|
||||
}
|
||||
});
|
||||
$('.search-clear').click(function(){
|
||||
$search.val('').change();
|
||||
updateStatus();
|
||||
});
|
||||
$main.on('click', '.highlight', function(){
|
||||
index = $results.index(this);
|
||||
updateStatus();
|
||||
});
|
||||
|
||||
$('.tooltip-bottom').tipsy({ gravity: 'n' });
|
||||
$('.tooltip-top').tipsy({ gravity: 's' });
|
||||
$('.tooltip-edge-left').tipsy({ gravity: 'nw' });
|
||||
$('.tooltip-edge-right').tipsy({ gravity: 'ne' });
|
||||
$('.tooltip-right').tipsy({ gravity: 'w' });
|
||||
$('.status').tipsy({
|
||||
gravity: 's',
|
||||
opacity: 1,
|
||||
theme: [ '#d9534f', 'white' ]
|
||||
});
|
||||
|
||||
// search on load
|
||||
// ?q=array&index=10
|
||||
if (search) {
|
||||
applySearch();
|
||||
}
|
||||
|
||||
});
|
||||
22
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/select2-3.4.6.min.js
vendored
Executable file
22
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/select2-3.4.6.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
132
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/sugar.min.js
vendored
Executable file
132
modules/EcmReportsBackUp20151106/TableSorterNew/docs/js/sugar.min.js
vendored
Executable file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Sugar Library v1.4.1
|
||||
*
|
||||
* Freely distributable and licensed under the MIT-style license.
|
||||
* Copyright (c) 2013 Andrew Plummer
|
||||
* http://sugarjs.com/
|
||||
*
|
||||
* ---------------------------- */
|
||||
(function(){function aa(a){return function(){return a}}
|
||||
var m=Object,p=Array,q=RegExp,r=Date,s=String,t=Number,u=Math,ba="undefined"!==typeof global?global:this,v=m.prototype.toString,da=m.prototype.hasOwnProperty,ea=m.defineProperty&&m.defineProperties,fa="function"===typeof q(),ga=!("0"in new s("a")),ia={},ja=/^\[object Date|Array|String|Number|RegExp|Boolean|Arguments\]$/,w="Boolean Number String Array Date RegExp Function".split(" "),la=ka("boolean",w[0]),y=ka("number",w[1]),z=ka("string",w[2]),A=ma(w[3]),C=ma(w[4]),D=ma(w[5]),F=ma(w[6]);
|
||||
function ma(a){var b="Array"===a&&p.isArray||function(b,d){return(d||v.call(b))==="[object "+a+"]"};return ia[a]=b}function ka(a,b){function c(c){return G(c)?v.call(c)==="[object "+b+"]":typeof c===a}return ia[b]=c}
|
||||
function na(a){a.SugarMethods||(oa(a,"SugarMethods",{}),H(a,!1,!0,{extend:function(b,c,d){H(a,!1!==d,c,b)},sugarRestore:function(){return pa(this,a,arguments,function(a,c,d){oa(a,c,d.method)})},sugarRevert:function(){return pa(this,a,arguments,function(a,c,d){d.existed?oa(a,c,d.original):delete a[c]})}}))}function H(a,b,c,d){var e=b?a.prototype:a;na(a);I(d,function(d,f){var h=e[d],l=J(e,d);F(c)&&h&&(f=qa(h,f,c));!1===c&&h||oa(e,d,f);a.SugarMethods[d]={method:f,existed:l,original:h,instance:b}})}
|
||||
function K(a,b,c,d,e){var g={};d=z(d)?d.split(","):d;d.forEach(function(a,b){e(g,a,b)});H(a,b,c,g)}function pa(a,b,c,d){var e=0===c.length,g=L(c),f=!1;I(b.SugarMethods,function(b,c){if(e||-1!==g.indexOf(b))f=!0,d(c.instance?a.prototype:a,b,c)});return f}function qa(a,b,c){return function(d){return c.apply(this,arguments)?b.apply(this,arguments):a.apply(this,arguments)}}function oa(a,b,c){ea?m.defineProperty(a,b,{value:c,configurable:!0,enumerable:!1,writable:!0}):a[b]=c}
|
||||
function L(a,b,c){var d=[];c=c||0;var e;for(e=a.length;c<e;c++)d.push(a[c]),b&&b.call(a,a[c],c);return d}function sa(a,b,c){var d=a[c||0];A(d)&&(a=d,c=0);L(a,b,c)}function ta(a){if(!a||!a.call)throw new TypeError("Callback is not callable");}function M(a){return void 0!==a}function N(a){return void 0===a}function J(a,b){return!!a&&da.call(a,b)}function G(a){return!!a&&("object"===typeof a||fa&&D(a))}function ua(a){var b=typeof a;return null==a||"string"===b||"number"===b||"boolean"===b}
|
||||
function va(a,b){b=b||v.call(a);try{if(a&&a.constructor&&!J(a,"constructor")&&!J(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}return!!a&&"[object Object]"===b&&"hasOwnProperty"in a}function I(a,b){for(var c in a)if(J(a,c)&&!1===b.call(a,c,a[c],a))break}function wa(a,b){for(var c=0;c<a;c++)b(c)}function xa(a,b){I(b,function(c){a[c]=b[c]});return a}function ya(a){ua(a)&&(a=m(a));if(ga&&z(a))for(var b=a,c=0,d;d=b.charAt(c);)b[c++]=d;return a}function O(a){xa(this,ya(a))}
|
||||
O.prototype.constructor=m;var P=u.abs,za=u.pow,Aa=u.ceil,Q=u.floor,R=u.round,Ca=u.min,S=u.max;function Da(a,b,c){var d=za(10,P(b||0));c=c||R;0>b&&(d=1/d);return c(a*d)/d}var Ea=48,Fa=57,Ga=65296,Ha=65305,Ia=".",Ja="",Ka={},La;function Ma(){return"\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u2028\u2029\u3000\ufeff"}function Na(a,b){var c="";for(a=a.toString();0<b;)if(b&1&&(c+=a),b>>=1)a+=a;return c}
|
||||
function Oa(a,b){var c,d;c=a.replace(La,function(a){a=Ka[a];a===Ia&&(d=!0);return a});return d?parseFloat(c):parseInt(c,b||10)}function T(a,b,c,d){d=P(a).toString(d||10);d=Na("0",b-d.replace(/\.\d+/,"").length)+d;if(c||0>a)d=(0>a?"-":"+")+d;return d}function Pa(a){if(11<=a&&13>=a)return"th";switch(a%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}
|
||||
function Qa(a,b){function c(a,c){if(a||-1<b.indexOf(c))d+=c}var d="";b=b||"";c(a.multiline,"m");c(a.ignoreCase,"i");c(a.global,"g");c(a.u,"y");return d}function Ra(a){z(a)||(a=s(a));return a.replace(/([\\/\'*+?|()\[\]{}.^$])/g,"\\$1")}function U(a,b){return a["get"+(a._utc?"UTC":"")+b]()}function Sa(a,b,c){return a["set"+(a._utc&&"ISOWeek"!=b?"UTC":"")+b](c)}
|
||||
function Ta(a,b){var c=typeof a,d,e,g,f,h,l,n;if("string"===c)return a;g=v.call(a);d=va(a,g);e=A(a,g);if(null!=a&&d||e){b||(b=[]);if(1<b.length)for(l=b.length;l--;)if(b[l]===a)return"CYC";b.push(a);d=a.valueOf()+s(a.constructor);f=e?a:m.keys(a).sort();l=0;for(n=f.length;l<n;l++)h=e?l:f[l],d+=h+Ta(a[h],b);b.pop()}else d=-Infinity===1/a?"-0":s(a&&a.valueOf?a.valueOf():a);return c+g+d}function Ua(a,b){return a===b?0!==a||1/a===1/b:Va(a)&&Va(b)?Ta(a)===Ta(b):!1}
|
||||
function Va(a){var b=v.call(a);return ja.test(b)||va(a,b)}function Wa(a,b,c){var d,e=a.length,g=b.length,f=!1!==b[g-1];if(!(g>(f?1:2)))return Xa(a,e,b[0],f,c);d=[];L(b,function(b){if(la(b))return!1;d.push(Xa(a,e,b,f,c))});return d}function Xa(a,b,c,d,e){d&&(c%=b,0>c&&(c=b+c));return e?a.charAt(c):a[c]}function Ya(a,b){K(b,!0,!1,a,function(a,b){a[b+("equal"===b?"s":"")]=function(){return m[b].apply(null,[this].concat(L(arguments)))}})}na(m);I(w,function(a,b){na(ba[b])});var Za,$a;
|
||||
for($a=0;9>=$a;$a++)Za=s.fromCharCode($a+Ga),Ja+=Za,Ka[Za]=s.fromCharCode($a+Ea);Ka[","]="";Ka["\uff0e"]=Ia;Ka[Ia]=Ia;La=q("["+Ja+"\uff0e,"+Ia+"]","g");
|
||||
"use strict";H(m,!1,!1,{keys:function(a){var b=[];if(!G(a)&&!D(a)&&!F(a))throw new TypeError("Object required");I(a,function(a){b.push(a)});return b}});
|
||||
function ab(a,b,c,d){var e=a.length,g=-1==d,f=g?e-1:0;c=isNaN(c)?f:parseInt(c>>0);0>c&&(c=e+c);if(!g&&0>c||g&&c>=e)c=f;for(;g&&0<=c||!g&&c<e;){if(a[c]===b)return c;c+=d}return-1}function bb(a,b,c,d){var e=a.length,g=0,f=M(c);ta(b);if(0!=e||f)f||(c=a[d?e-1:g],g++);else throw new TypeError("Reduce called on empty array with no initial value");for(;g<e;)f=d?e-g-1:g,f in a&&(c=b(c,a[f],f,a)),g++;return c}function cb(a){if(0===a.length)throw new TypeError("First argument must be defined");}H(p,!1,!1,{isArray:function(a){return A(a)}});
|
||||
H(p,!0,!1,{every:function(a,b){var c=this.length,d=0;for(cb(arguments);d<c;){if(d in this&&!a.call(b,this[d],d,this))return!1;d++}return!0},some:function(a,b){var c=this.length,d=0;for(cb(arguments);d<c;){if(d in this&&a.call(b,this[d],d,this))return!0;d++}return!1},map:function(a,b){b=arguments[1];var c=this.length,d=0,e=Array(c);for(cb(arguments);d<c;)d in this&&(e[d]=a.call(b,this[d],d,this)),d++;return e},filter:function(a){var b=arguments[1],c=this.length,d=0,e=[];for(cb(arguments);d<c;)d in
|
||||
this&&a.call(b,this[d],d,this)&&e.push(this[d]),d++;return e},indexOf:function(a,b){return z(this)?this.indexOf(a,b):ab(this,a,b,1)},lastIndexOf:function(a,b){return z(this)?this.lastIndexOf(a,b):ab(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(ta(a);d<c;)d in this&&a.call(b,this[d],d,this),d++},reduce:function(a,b){return bb(this,a,b)},reduceRight:function(a,b){return bb(this,a,b,!0)}});
|
||||
H(Function,!0,!1,{bind:function(a){var b=this,c=L(arguments,null,1),d;if(!F(this))throw new TypeError("Function.prototype.bind called on a non-function");d=function(){return b.apply(b.prototype&&this instanceof b?this:a,c.concat(L(arguments)))};d.prototype=this.prototype;return d}});H(r,!1,!1,{now:function(){return(new r).getTime()}});
|
||||
(function(){var a=Ma().match(/^\s+$/);try{s.prototype.trim.call([1])}catch(b){a=!1}H(s,!0,!a,{trim:function(){return this.toString().trimLeft().trimRight()},trimLeft:function(){return this.replace(q("^["+Ma()+"]+"),"")},trimRight:function(){return this.replace(q("["+Ma()+"]+$"),"")}})})();
|
||||
(function(){var a=new r(r.UTC(1999,11,31)),a=a.toISOString&&"1999-12-31T00:00:00.000Z"===a.toISOString();K(r,!0,!a,"toISOString,toJSON",function(a,c){a[c]=function(){return T(this.getUTCFullYear(),4)+"-"+T(this.getUTCMonth()+1,2)+"-"+T(this.getUTCDate(),2)+"T"+T(this.getUTCHours(),2)+":"+T(this.getUTCMinutes(),2)+":"+T(this.getUTCSeconds(),2)+"."+T(this.getUTCMilliseconds(),3)+"Z"}})})();
|
||||
"use strict";function db(a){a=q(a);return function(b){return a.test(b)}}
|
||||
function eb(a){var b=a.getTime();return function(a){return!(!a||!a.getTime)&&a.getTime()===b}}function fb(a){return function(b,c,d){return b===a||a.call(this,b,c,d)}}function gb(a){return function(b,c,d){return b===a||a.call(d,c,b,d)}}function hb(a,b){var c={};return function(d,e,g){var f;if(!G(d))return!1;for(f in a)if(c[f]=c[f]||ib(a[f],b),!1===c[f].call(g,d[f],e,g))return!1;return!0}}function jb(a){return function(b){return b===a||Ua(b,a)}}
|
||||
function ib(a,b){if(!ua(a)){if(D(a))return db(a);if(C(a))return eb(a);if(F(a))return b?gb(a):fb(a);if(va(a))return hb(a,b)}return jb(a)}function kb(a,b,c,d){return b?b.apply?b.apply(c,d||[]):F(a[b])?a[b].call(a):a[b]:a}function V(a,b,c,d){var e=+a.length;0>c&&(c=a.length+c);c=isNaN(c)?0:c;for(!0===d&&(e+=c);c<e;){d=c%a.length;if(!(d in a)){lb(a,b,c);break}if(!1===b.call(a,a[d],d,a))break;c++}}
|
||||
function lb(a,b,c){var d=[],e;for(e in a)e in a&&(e>>>0==e&&4294967295!=e)&&e>=c&&d.push(parseInt(e));d.sort().each(function(c){return b.call(a,a[c],c,a)})}function mb(a,b,c,d,e,g){var f,h,l;0<a.length&&(l=ib(b),V(a,function(b,c){if(l.call(g,b,c,a))return f=b,h=c,!1},c,d));return e?h:f}function nb(a,b){var c=[],d={},e;V(a,function(g,f){e=b?kb(g,b,a,[g,f,a]):g;ob(d,e)||c.push(g)});return c}
|
||||
function pb(a,b,c){var d=[],e={};b.each(function(a){ob(e,a)});a.each(function(a){var b=Ta(a),h=!Va(a);if(qb(e,b,a,h)!==c){var l=0;if(h)for(b=e[b];l<b.length;)b[l]===a?b.splice(l,1):l+=1;else delete e[b];d.push(a)}});return d}function rb(a,b,c){b=b||Infinity;c=c||0;var d=[];V(a,function(a){A(a)&&c<b?d=d.concat(rb(a,b,c+1)):d.push(a)});return d}function sb(a){var b=[];L(a,function(a){b=b.concat(a)});return b}function qb(a,b,c,d){var e=b in a;d&&(a[b]||(a[b]=[]),e=-1!==a[b].indexOf(c));return e}
|
||||
function ob(a,b){var c=Ta(b),d=!Va(b),e=qb(a,c,b,d);d?a[c].push(b):a[c]=b;return e}function tb(a,b,c,d){var e,g,f,h=[],l="max"===c,n="min"===c,x=p.isArray(a);for(e in a)if(a.hasOwnProperty(e)){c=a[e];f=kb(c,b,a,x?[c,parseInt(e),a]:[]);if(N(f))throw new TypeError("Cannot compare with undefined");if(f===g)h.push(c);else if(N(g)||l&&f>g||n&&f<g)h=[c],g=f}x||(h=rb(h,1));return d?h:h[0]}
|
||||
function ub(a,b){var c,d,e,g,f=0,h=0;c=p[xb];d=p[yb];var l=p[zb],n=p[Ab],x=p[Bb];a=Cb(a,c,d);b=Cb(b,c,d);do c=a.charAt(f),e=l[c]||c,c=b.charAt(f),g=l[c]||c,c=e?n.indexOf(e):null,d=g?n.indexOf(g):null,-1===c||-1===d?(c=a.charCodeAt(f)||null,d=b.charCodeAt(f)||null,x&&((c>=Ea&&c<=Fa||c>=Ga&&c<=Ha)&&(d>=Ea&&d<=Fa||d>=Ga&&d<=Ha))&&(c=Oa(a.slice(f)),d=Oa(b.slice(f)))):(e=e!==a.charAt(f),g=g!==b.charAt(f),e!==g&&0===h&&(h=e-g)),f+=1;while(null!=c&&null!=d&&c===d);return c===d?h:c-d}
|
||||
function Cb(a,b,c){z(a)||(a=s(a));c&&(a=a.toLowerCase());b&&(a=a.replace(b,""));return a}var Ab="AlphanumericSortOrder",xb="AlphanumericSortIgnore",yb="AlphanumericSortIgnoreCase",zb="AlphanumericSortEquivalents",Bb="AlphanumericSortNatural";H(p,!1,!0,{create:function(){var a=[];L(arguments,function(b){if(!ua(b)&&"length"in b&&("[object Arguments]"===v.call(b)||b.callee)||!ua(b)&&"length"in b&&!z(b)&&!va(b))b=p.prototype.slice.call(b,0);a=a.concat(b)});return a}});
|
||||
H(p,!0,!1,{find:function(a,b){ta(a);return mb(this,a,0,!1,!1,b)},findIndex:function(a,b){var c;ta(a);c=mb(this,a,0,!1,!0,b);return N(c)?-1:c}});
|
||||
H(p,!0,!0,{findFrom:function(a,b,c){return mb(this,a,b,c)},findIndexFrom:function(a,b,c){b=mb(this,a,b,c,!0);return N(b)?-1:b},findAll:function(a,b,c){var d=[],e;0<this.length&&(e=ib(a),V(this,function(a,b,c){e(a,b,c)&&d.push(a)},b,c));return d},count:function(a){return N(a)?this.length:this.findAll(a).length},removeAt:function(a,b){if(N(a))return this;N(b)&&(b=a);this.splice(a,b-a+1);return this},include:function(a,b){return this.clone().add(a,b)},exclude:function(){return p.prototype.remove.apply(this.clone(),
|
||||
arguments)},clone:function(){return xa([],this)},unique:function(a){return nb(this,a)},flatten:function(a){return rb(this,a)},union:function(){return nb(this.concat(sb(arguments)))},intersect:function(){return pb(this,sb(arguments),!1)},subtract:function(a){return pb(this,sb(arguments),!0)},at:function(){return Wa(this,arguments)},first:function(a){if(N(a))return this[0];0>a&&(a=0);return this.slice(0,a)},last:function(a){return N(a)?this[this.length-1]:this.slice(0>this.length-a?0:this.length-a)},
|
||||
from:function(a){return this.slice(a)},to:function(a){N(a)&&(a=this.length);return this.slice(0,a)},min:function(a,b){return tb(this,a,"min",b)},max:function(a,b){return tb(this,a,"max",b)},least:function(a,b){return tb(this.groupBy.apply(this,[a]),"length","min",b)},most:function(a,b){return tb(this.groupBy.apply(this,[a]),"length","max",b)},sum:function(a){a=a?this.map(a):this;return 0<a.length?a.reduce(function(a,c){return a+c}):0},average:function(a){a=a?this.map(a):this;return 0<a.length?a.sum()/
|
||||
a.length:0},inGroups:function(a,b){var c=1<arguments.length,d=this,e=[],g=Aa(this.length/a);wa(a,function(a){a*=g;var h=d.slice(a,a+g);c&&h.length<g&&wa(g-h.length,function(){h=h.add(b)});e.push(h)});return e},inGroupsOf:function(a,b){var c=[],d=this.length,e=this,g;if(0===d||0===a)return e;N(a)&&(a=1);N(b)&&(b=null);wa(Aa(d/a),function(d){for(g=e.slice(a*d,a*d+a);g.length<a;)g.push(b);c.push(g)});return c},isEmpty:function(){return 0==this.compact().length},sortBy:function(a,b){var c=this.clone();
|
||||
c.sort(function(d,e){var g,f;g=kb(d,a,c,[d]);f=kb(e,a,c,[e]);return(z(g)&&z(f)?ub(g,f):g<f?-1:g>f?1:0)*(b?-1:1)});return c},randomize:function(){for(var a=this.concat(),b=a.length,c,d;b;)c=u.random()*b|0,d=a[--b],a[b]=a[c],a[c]=d;return a},zip:function(){var a=L(arguments);return this.map(function(b,c){return[b].concat(a.map(function(a){return c in a?a[c]:null}))})},sample:function(a){var b=this.randomize();return 0<arguments.length?b.slice(0,a):b[0]},each:function(a,b,c){V(this,a,b,c);return this},
|
||||
add:function(a,b){if(!y(t(b))||isNaN(b))b=this.length;p.prototype.splice.apply(this,[b,0].concat(a));return this},remove:function(){var a=this;L(arguments,function(b){var c=0;for(b=ib(b);c<a.length;)b(a[c],c,a)?a.splice(c,1):c++});return a},compact:function(a){var b=[];V(this,function(c){A(c)?b.push(c.compact()):a&&c?b.push(c):a||(null==c||c.valueOf()!==c.valueOf())||b.push(c)});return b},groupBy:function(a,b){var c=this,d={},e;V(c,function(b,f){e=kb(b,a,c,[b,f,c]);d[e]||(d[e]=[]);d[e].push(b)});
|
||||
b&&I(d,b);return d},none:function(){return!this.any.apply(this,arguments)}});H(p,!0,!0,{all:p.prototype.every,any:p.prototype.some,insert:p.prototype.add});function Db(a,b){K(m,!1,!0,a,function(a,d){a[d]=function(a,c,f){var h=m.keys(ya(a)),l;b||(l=ib(c,!0));f=p.prototype[d].call(h,function(d){var f=a[d];return b?kb(f,c,a,[d,f,a]):l(f,d,a)},f);A(f)&&(f=f.reduce(function(b,c){b[c]=a[c];return b},{}));return f}});Ya(a,O)}
|
||||
H(m,!1,!0,{map:function(a,b){var c={},d,e;for(d in a)J(a,d)&&(e=a[d],c[d]=kb(e,b,a,[d,e,a]));return c},reduce:function(a){var b=m.keys(ya(a)).map(function(b){return a[b]});return b.reduce.apply(b,L(arguments,null,1))},each:function(a,b){ta(b);I(a,b);return a},size:function(a){return m.keys(ya(a)).length}});var Eb="any all none count find findAll isEmpty".split(" "),Fb="sum average min max least most".split(" "),Gb=["map","reduce","size"],Hb=Eb.concat(Fb).concat(Gb);
|
||||
(function(){function a(){var a=arguments;return 0<a.length&&!F(a[0])}var b=p.prototype.map;K(p,!0,a,"every,all,some,filter,any,none,find,findIndex",function(a,b){var e=p.prototype[b];a[b]=function(a){var b=ib(a);return e.call(this,function(a,c){return b(a,c,this)})}});H(p,!0,a,{map:function(a){return b.call(this,function(b,e){return kb(b,a,this,[b,e,this])})}})})();
|
||||
(function(){p[Ab]="A\u00c1\u00c0\u00c2\u00c3\u0104BC\u0106\u010c\u00c7D\u010e\u00d0E\u00c9\u00c8\u011a\u00ca\u00cb\u0118FG\u011eH\u0131I\u00cd\u00cc\u0130\u00ce\u00cfJKL\u0141MN\u0143\u0147\u00d1O\u00d3\u00d2\u00d4PQR\u0158S\u015a\u0160\u015eT\u0164U\u00da\u00d9\u016e\u00db\u00dcVWXY\u00ddZ\u0179\u017b\u017d\u00de\u00c6\u0152\u00d8\u00d5\u00c5\u00c4\u00d6".split("").map(function(a){return a+a.toLowerCase()}).join("");var a={};V("A\u00c1\u00c0\u00c2\u00c3\u00c4 C\u00c7 E\u00c9\u00c8\u00ca\u00cb I\u00cd\u00cc\u0130\u00ce\u00cf O\u00d3\u00d2\u00d4\u00d5\u00d6 S\u00df U\u00da\u00d9\u00db\u00dc".split(" "),
|
||||
function(b){var c=b.charAt(0);V(b.slice(1).split(""),function(b){a[b]=c;a[b.toLowerCase()]=c.toLowerCase()})});p[Bb]=!0;p[yb]=!0;p[zb]=a})();Db(Eb);Db(Fb,!0);Ya(Gb,O);p.AlphanumericSort=ub;
|
||||
"use strict";
|
||||
var W,Ib,Jb="ampm hour minute second ampm utc offset_sign offset_hours offset_minutes ampm".split(" "),Kb="({t})?\\s*(\\d{1,2}(?:[,.]\\d+)?)(?:{h}([0-5]\\d(?:[,.]\\d+)?)?{m}(?::?([0-5]\\d(?:[,.]\\d+)?){s})?\\s*(?:({t})|(Z)|(?:([+-])(\\d{2,2})(?::?(\\d{2,2}))?)?)?|\\s*({t}))",Lb={},Mb,Nb,Ob,Pb=[],Qb={},X={yyyy:function(a){return U(a,"FullYear")},yy:function(a){return U(a,"FullYear")%100},ord:function(a){a=U(a,"Date");return a+Pa(a)},tz:function(a){return a.getUTCOffset()},isotz:function(a){return a.getUTCOffset(!0)},
|
||||
Z:function(a){return a.getUTCOffset()},ZZ:function(a){return a.getUTCOffset().replace(/(\d{2})$/,":$1")}},Rb=[{name:"year",method:"FullYear",k:!0,b:function(a){return 864E5*(365+(a?a.isLeapYear()?1:0:0.25))}},{name:"month",error:0.919,method:"Month",k:!0,b:function(a,b){var c=30.4375,d;a&&(d=a.daysInMonth(),b<=d.days()&&(c=d));return 864E5*c}},{name:"week",method:"ISOWeek",b:aa(6048E5)},{name:"day",error:0.958,method:"Date",k:!0,b:aa(864E5)},{name:"hour",method:"Hours",b:aa(36E5)},{name:"minute",
|
||||
method:"Minutes",b:aa(6E4)},{name:"second",method:"Seconds",b:aa(1E3)},{name:"millisecond",method:"Milliseconds",b:aa(1)}],Sb={};function Tb(a){xa(this,a);this.g=Pb.concat()}
|
||||
Tb.prototype={getMonth:function(a){return y(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},addFormat:function(a,b,c,d,e){var g=c||[],f=this,h;a=a.replace(/\s+/g,"[,. ]*");a=a.replace(/\{([^,]+?)\}/g,function(a,b){var d,e,h,B=b.match(/\?$/);h=b.match(/^(\d+)\??$/);var k=b.match(/(\d)(?:-(\d))?/),E=b.replace(/[^a-z]+$/,"");h?d=f.tokens[h[1]]:f[E]?d=f[E]:f[E+"s"]&&(d=f[E+"s"],k&&(e=[],d.forEach(function(a,b){var c=b%(f.units?8:d.length);c>=k[1]&&c<=(k[2]||
|
||||
k[1])&&e.push(a)}),d=e),d=Ub(d));h?h="(?:"+d+")":(c||g.push(E),h="("+d+")");B&&(h+="?");return h});b?(b=Vb(f,e),e=["t","[\\s\\u3000]"].concat(f.timeMarker),h=a.match(/\\d\{\d,\d\}\)+\??$/),Wb(f,"(?:"+b+")[,\\s\\u3000]+?"+a,Jb.concat(g),d),Wb(f,a+"(?:[,\\s]*(?:"+e.join("|")+(h?"+":"*")+")"+b+")?",g.concat(Jb),d)):Wb(f,a,g,d)}};
|
||||
function Xb(a,b,c){var d,e,g=b[0],f=b[1],h=b[2];b=a[c]||a.relative;if(F(b))return b.call(a,g,f,h,c);e=a.units[8*(a.plural&&1<g?1:0)+f]||a.units[f];a.capitalizeUnit&&(e=Yb(e));d=a.modifiers.filter(function(a){return"sign"==a.name&&a.value==(0<h?1:-1)})[0];return b.replace(/\{(.*?)\}/g,function(a,b){switch(b){case "num":return g;case "unit":return e;case "sign":return d.src}})}function Zb(a,b){b=b||a.code;return"en"===b||"en-US"===b?!0:a.variant}
|
||||
function $b(a,b){return b.replace(q(a.num,"g"),function(b){return ac(a,b)||""})}function ac(a,b){var c;return y(b)?b:b&&-1!==(c=a.numbers.indexOf(b))?(c+1)%10:1}function Y(a,b){var c;z(a)||(a="");c=Sb[a]||Sb[a.slice(0,2)];if(!1===b&&!c)throw new TypeError("Invalid locale.");return c||Ib}
|
||||
function bc(a,b){function c(a){var b=h[a];z(b)?h[a]=b.split(","):b||(h[a]=[])}function d(a,b){a=a.split("+").map(function(a){return a.replace(/(.+):(.+)$/,function(a,b,c){return c.split("|").map(function(a){return b+a}).join("|")})}).join("|");a.split("|").forEach(b)}function e(a,b,c){var e=[];h[a].forEach(function(a,f){b&&(a+="+"+a.slice(0,3));d(a,function(a,b){e[b*c+f]=a.toLowerCase()})});h[a]=e}function g(a,b,c){a="\\d{"+a+","+b+"}";c&&(a+="|(?:"+Ub(h.numbers)+")+");return a}function f(a,b){h[a]=
|
||||
h[a]||b}var h,l;h=new Tb(b);c("modifiers");"months weekdays units numbers articles tokens timeMarker ampm timeSuffixes dateParse timeParse".split(" ").forEach(c);l=!h.monthSuffix;e("months",l,12);e("weekdays",l,7);e("units",!1,8);e("numbers",!1,10);f("code",a);f("date",g(1,2,h.digitDate));f("year","'\\d{2}|"+g(4,4));f("num",function(){var a=["-?\\d+"].concat(h.articles);h.numbers&&(a=a.concat(h.numbers));return Ub(a)}());(function(){var a=[];h.i={};h.modifiers.push({name:"day",src:"yesterday",value:-1});
|
||||
h.modifiers.push({name:"day",src:"today",value:0});h.modifiers.push({name:"day",src:"tomorrow",value:1});h.modifiers.forEach(function(b){var c=b.name;d(b.src,function(d){var e=h[c];h.i[d]=b;a.push({name:c,src:d,value:b.value});h[c]=e?e+"|"+d:d})});h.day+="|"+Ub(h.weekdays);h.modifiers=a})();h.monthSuffix&&(h.month=g(1,2),h.months="1 2 3 4 5 6 7 8 9 10 11 12".split(" ").map(function(a){return a+h.monthSuffix}));h.full_month=g(1,2)+"|"+Ub(h.months);0<h.timeSuffixes.length&&h.addFormat(Vb(h),!1,Jb);
|
||||
h.addFormat("{day}",!0);h.addFormat("{month}"+(h.monthSuffix||""));h.addFormat("{year}"+(h.yearSuffix||""));h.timeParse.forEach(function(a){h.addFormat(a,!0)});h.dateParse.forEach(function(a){h.addFormat(a)});return Sb[a]=h}function Wb(a,b,c,d){a.g.unshift({r:d,locale:a,q:q("^"+b+"$","i"),to:c})}function Yb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function Ub(a){return a.filter(function(a){return!!a}).join("|")}function cc(){var a=r.SugarNewDate;return a?a():new r}
|
||||
function dc(a,b){var c;if(G(a[0]))return a;if(y(a[0])&&!y(a[1]))return[a[0]];if(z(a[0])&&b)return[ec(a[0]),a[1]];c={};Nb.forEach(function(b,e){c[b.name]=a[e]});return[c]}function ec(a){var b,c={};if(a=a.match(/^(\d+)?\s?(\w+?)s?$/i))N(b)&&(b=parseInt(a[1])||1),c[a[2].toLowerCase()]=b;return c}function fc(a,b,c){var d;N(c)&&(c=Ob.length);for(b=b||0;b<c&&(d=Ob[b],!1!==a(d.name,d,b));b++);}
|
||||
function gc(a,b){var c={},d,e;b.forEach(function(b,f){d=a[f+1];N(d)||""===d||("year"===b&&(c.t=d.replace(/'/,"")),e=parseFloat(d.replace(/'/,"").replace(/,/,".")),c[b]=isNaN(e)?d.toLowerCase():e)});return c}function hc(a){a=a.trim().replace(/^just (?=now)|\.+$/i,"");return ic(a)}
|
||||
function ic(a){return a.replace(Mb,function(a,c,d){var e=0,g=1,f,h;if(c)return a;d.split("").reverse().forEach(function(a){a=Lb[a];var b=9<a;b?(f&&(e+=g),g*=a/(h||1),h=a):(!1===f&&(g*=10),e+=g*a);f=b});f&&(e+=g);return e})}
|
||||
function jc(a,b,c,d){function e(a){vb.push(a)}function g(){vb.forEach(function(a){a.call()})}function f(){var a=n.getWeekday();n.setWeekday(7*(k.num-1)+(a>Ba?Ba+7:Ba))}function h(){var a=B.i[k.edge];fc(function(a){if(M(k[a]))return E=a,!1},4);if("year"===E)k.e="month";else if("month"===E||"week"===E)k.e="day";n[(0>a.value?"endOf":"beginningOf")+Yb(E)]();-2===a.value&&n.reset()}function l(){var a;fc(function(b,c,d){"day"===b&&(b="date");if(M(k[b])){if(d>=wb)return n.setTime(NaN),!1;a=a||{};a[b]=k[b];
|
||||
delete k[b]}});a&&e(function(){n.set(a,!0)})}var n,x,ha,vb,B,k,E,wb,Ba,ra,ca;n=cc();vb=[];n.utc(d);C(a)?n.utc(a.isUTC()).setTime(a.getTime()):y(a)?n.setTime(a):G(a)?(n.set(a,!0),k=a):z(a)&&(ha=Y(b),a=hc(a),ha&&I(ha.o?[ha.o].concat(ha.g):ha.g,function(c,d){var g=a.match(d.q);if(g){B=d.locale;k=gc(g,d.to);B.o=d;k.utc&&n.utc();if(k.timestamp)return k=k.timestamp,!1;d.r&&(!z(k.month)&&(z(k.date)||Zb(ha,b)))&&(ca=k.month,k.month=k.date,k.date=ca);k.year&&2===k.t.length&&(k.year=100*R(U(cc(),"FullYear")/
|
||||
100)-100*R(k.year/100)+k.year);k.month&&(k.month=B.getMonth(k.month),k.shift&&!k.unit&&(k.unit=B.units[7]));k.weekday&&k.date?delete k.weekday:k.weekday&&(k.weekday=B.getWeekday(k.weekday),k.shift&&!k.unit&&(k.unit=B.units[5]));k.day&&(ca=B.i[k.day])?(k.day=ca.value,n.reset(),x=!0):k.day&&-1<(Ba=B.getWeekday(k.day))&&(delete k.day,k.num&&k.month?(e(f),k.day=1):k.weekday=Ba);k.date&&!y(k.date)&&(k.date=$b(B,k.date));k.ampm&&k.ampm===B.ampm[1]&&12>k.hour?k.hour+=12:k.ampm===B.ampm[0]&&12===k.hour&&
|
||||
(k.hour=0);if("offset_hours"in k||"offset_minutes"in k)n.utc(),k.offset_minutes=k.offset_minutes||0,k.offset_minutes+=60*k.offset_hours,"-"===k.offset_sign&&(k.offset_minutes*=-1),k.minute-=k.offset_minutes;k.unit&&(x=!0,ra=ac(B,k.num),wb=B.units.indexOf(k.unit)%8,E=W.units[wb],l(),k.shift&&(ra*=(ca=B.i[k.shift])?ca.value:0),k.sign&&(ca=B.i[k.sign])&&(ra*=ca.value),M(k.weekday)&&(n.set({weekday:k.weekday},!0),delete k.weekday),k[E]=(k[E]||0)+ra);k.edge&&e(h);"-"===k.year_sign&&(k.year*=-1);fc(function(a,
|
||||
b,c){b=k[a];var d=b%1;d&&(k[Ob[c-1].name]=R(d*("second"===a?1E3:60)),k[a]=Q(b))},1,4);return!1}}),k?x?n.advance(k):(n._utc&&n.reset(),kc(n,k,!0,!1,c)):("now"!==a&&(n=new r(a)),d&&n.addMinutes(-n.getTimezoneOffset())),g(),n.utc(!1));return{c:n,set:k}}function lc(a){var b,c=P(a),d=c,e=0;fc(function(a,f,h){b=Q(Da(c/f.b(),1));1<=b&&(d=b,e=h)},1);return[d,e,a]}
|
||||
function mc(a){var b=lc(a.millisecondsFromNow());if(6===b[1]||5===b[1]&&4===b[0]&&a.daysFromNow()>=cc().daysInMonth())b[0]=P(a.monthsFromNow()),b[1]=6;return b}function nc(a,b,c){function d(a,c){var d=U(a,"Month");return Y(c).months[d+12*b]}Z(a,d,c);Z(Yb(a),d,c,1)}function Z(a,b,c,d){X[a]=function(a,g){var f=b(a,g);c&&(f=f.slice(0,c));d&&(f=f.slice(0,d).toUpperCase()+f.slice(d));return f}}
|
||||
function oc(a,b,c){X[a]=b;X[a+a]=function(a,c){return T(b(a,c),2)};c&&(X[a+a+a]=function(a,c){return T(b(a,c),3)},X[a+a+a+a]=function(a,c){return T(b(a,c),4)})}function pc(a){var b=a.match(/(\{\w+\})|[^{}]+/g);Qb[a]=b.map(function(a){a.replace(/\{(\w+)\}/,function(b,e){a=X[e]||e;return e});return a})}
|
||||
function qc(a,b,c,d){var e;if(!a.isValid())return"Invalid Date";Date[b]?b=Date[b]:F(b)&&(e=mc(a),b=b.apply(a,e.concat(Y(d))));if(!b&&c)return e=e||mc(a),0===e[1]&&(e[1]=1,e[0]=1),a=Y(d),Xb(a,e,0<e[2]?"future":"past");b=b||"long";if("short"===b||"long"===b||"full"===b)b=Y(d)[b];Qb[b]||pc(b);var g,f;e="";b=Qb[b];g=0;for(c=b.length;g<c;g++)f=b[g],e+=F(f)?f(a,d):f;return e}
|
||||
function rc(a,b,c,d,e){var g,f,h,l=0,n=0,x=0;g=jc(b,c,null,e);0<d&&(n=x=d,f=!0);if(!g.c.isValid())return!1;if(g.set&&g.set.e){Rb.forEach(function(b){b.name===g.set.e&&(l=b.b(g.c,a-g.c)-1)});b=Yb(g.set.e);if(g.set.edge||g.set.shift)g.c["beginningOf"+b]();"month"===g.set.e&&(h=g.c.clone()["endOf"+b]().getTime());!f&&(g.set.sign&&"millisecond"!=g.set.e)&&(n=50,x=-50)}f=a.getTime();b=g.c.getTime();h=sc(a,b,h||b+l);return f>=b-n&&f<=h+x}
|
||||
function sc(a,b,c){b=new r(b);a=(new r(c)).utc(a.isUTC());23!==U(a,"Hours")&&(b=b.getTimezoneOffset(),a=a.getTimezoneOffset(),b!==a&&(c+=(a-b).minutes()));return c}
|
||||
function kc(a,b,c,d,e){function g(a){return M(b[a])?b[a]:b[a+"s"]}function f(a){return M(g(a))}var h;if(y(b)&&d)b={milliseconds:b};else if(y(b))return a.setTime(b),a;M(b.date)&&(b.day=b.date);fc(function(d,e,g){var l="day"===d;if(f(d)||l&&f("weekday"))return b.e=d,h=+g,!1;!c||("week"===d||l&&f("week"))||Sa(a,e.method,l?1:0)});Rb.forEach(function(c){var e=c.name;c=c.method;var h;h=g(e);N(h)||(d?("week"===e&&(h=(b.day||0)+7*h,c="Date"),h=h*d+U(a,c)):"month"===e&&f("day")&&Sa(a,"Date",15),Sa(a,c,h),
|
||||
d&&"month"===e&&(e=h,0>e&&(e=e%12+12),e%12!=U(a,"Month")&&Sa(a,"Date",0)))});d||(f("day")||!f("weekday"))||a.setWeekday(g("weekday"));var l;a:{switch(e){case -1:l=a>cc();break a;case 1:l=a<cc();break a}l=void 0}l&&fc(function(b,c){if((c.k||"week"===b&&f("weekday"))&&!(f(b)||"day"===b&&f("weekday")))return a[c.j](e),!1},h+1);return a}
|
||||
function Vb(a,b){var c=Kb,d={h:0,m:1,s:2},e;a=a||W;return c.replace(/{([a-z])}/g,function(c,f){var h=[],l="h"===f,n=l&&!b;if("t"===f)return a.ampm.join("|");l&&h.push(":");(e=a.timeSuffixes[d[f]])&&h.push(e+"\\s*");return 0===h.length?"":"(?:"+h.join("|")+")"+(n?"":"?")})}function tc(a,b,c){var d,e;y(a[1])?d=dc(a)[0]:(d=a[0],e=a[1]);return jc(d,e,b,c).c}
|
||||
H(r,!1,!0,{create:function(){return tc(arguments)},past:function(){return tc(arguments,-1)},future:function(){return tc(arguments,1)},addLocale:function(a,b){return bc(a,b)},setLocale:function(a){var b=Y(a,!1);Ib=b;a&&a!=b.code&&(b.code=a);return b},getLocale:function(a){return a?Y(a,!1):Ib},addFormat:function(a,b,c){Wb(Y(c),a,b)}});
|
||||
H(r,!0,!0,{set:function(){var a=dc(arguments);return kc(this,a[0],a[1])},setWeekday:function(a){if(!N(a))return Sa(this,"Date",U(this,"Date")+a-U(this,"Day"))},setISOWeek:function(a){var b=U(this,"Day")||7;if(!N(a))return this.set({month:0,date:4}),this.set({weekday:1}),1<a&&this.addWeeks(a-1),1!==b&&this.advance({days:b-1}),this.getTime()},getISOWeek:function(){var a;a=this.clone();var b=U(a,"Day")||7;a.addDays(4-b).reset();return 1+Q(a.daysSince(a.clone().beginningOfYear())/7)},beginningOfISOWeek:function(){var a=
|
||||
this.getDay();0===a?a=-6:1!==a&&(a=1);this.setWeekday(a);return this.reset()},endOfISOWeek:function(){0!==this.getDay()&&this.setWeekday(7);return this.endOfDay()},getUTCOffset:function(a){var b=this._utc?0:this.getTimezoneOffset(),c=!0===a?":":"";return!b&&a?"Z":T(Q(-b/60),2,!0)+c+T(P(b%60),2)},utc:function(a){oa(this,"_utc",!0===a||0===arguments.length);return this},isUTC:function(){return!!this._utc||0===this.getTimezoneOffset()},advance:function(){var a=dc(arguments,!0);return kc(this,a[0],a[1],
|
||||
1)},rewind:function(){var a=dc(arguments,!0);return kc(this,a[0],a[1],-1)},isValid:function(){return!isNaN(this.getTime())},isAfter:function(a,b){return this.getTime()>r.create(a).getTime()-(b||0)},isBefore:function(a,b){return this.getTime()<r.create(a).getTime()+(b||0)},isBetween:function(a,b,c){var d=this.getTime();a=r.create(a).getTime();var e=r.create(b).getTime();b=Ca(a,e);a=S(a,e);c=c||0;return b-c<d&&a+c>d},isLeapYear:function(){var a=U(this,"FullYear");return 0===a%4&&0!==a%100||0===a%400},
|
||||
daysInMonth:function(){return 32-U(new r(U(this,"FullYear"),U(this,"Month"),32),"Date")},format:function(a,b){return qc(this,a,!1,b)},relative:function(a,b){z(a)&&(b=a,a=null);return qc(this,a,!0,b)},is:function(a,b,c){var d,e;if(this.isValid()){if(z(a))switch(a=a.trim().toLowerCase(),e=this.clone().utc(c),!0){case "future"===a:return this.getTime()>cc().getTime();case "past"===a:return this.getTime()<cc().getTime();case "weekday"===a:return 0<U(e,"Day")&&6>U(e,"Day");case "weekend"===a:return 0===
|
||||
U(e,"Day")||6===U(e,"Day");case -1<(d=W.weekdays.indexOf(a)%7):return U(e,"Day")===d;case -1<(d=W.months.indexOf(a)%12):return U(e,"Month")===d}return rc(this,a,null,b,c)}},reset:function(a){var b={},c;a=a||"hours";"date"===a&&(a="days");c=Rb.some(function(b){return a===b.name||a===b.name+"s"});b[a]=a.match(/^days?/)?1:0;return c?this.set(b,!0):this},clone:function(){var a=new r(this.getTime());a.utc(!!this._utc);return a}});
|
||||
H(r,!0,!0,{iso:function(){return this.toISOString()},getWeekday:r.prototype.getDay,getUTCWeekday:r.prototype.getUTCDay});function uc(a,b){function c(){return R(this*b)}function d(){return tc(arguments)[a.j](this)}function e(){return tc(arguments)[a.j](-this)}var g=a.name,f={};f[g]=c;f[g+"s"]=c;f[g+"Before"]=e;f[g+"sBefore"]=e;f[g+"Ago"]=e;f[g+"sAgo"]=e;f[g+"After"]=d;f[g+"sAfter"]=d;f[g+"FromNow"]=d;f[g+"sFromNow"]=d;t.extend(f)}H(t,!0,!0,{duration:function(a){a=Y(a);return Xb(a,lc(this),"duration")}});
|
||||
W=Ib=r.addLocale("en",{plural:!0,timeMarker:"at",ampm:"am,pm",months:"January,February,March,April,May,June,July,August,September,October,November,December",weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",units:"millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s",numbers:"one,two,three,four,five,six,seven,eight,nine,ten",articles:"a,an,the",tokens:"the,st|nd|rd|th,of","short":"{Month} {d}, {yyyy}","long":"{Month} {d}, {yyyy} {h}:{mm}{tt}",full:"{Weekday} {Month} {d}, {yyyy} {h}:{mm}:{ss}{tt}",
|
||||
past:"{num} {unit} {sign}",future:"{num} {unit} {sign}",duration:"{num} {unit}",modifiers:[{name:"sign",src:"ago|before",value:-1},{name:"sign",src:"from now|after|from|in|later",value:1},{name:"edge",src:"last day",value:-2},{name:"edge",src:"end",value:-1},{name:"edge",src:"first day|beginning",value:1},{name:"shift",src:"last",value:-1},{name:"shift",src:"the|this",value:0},{name:"shift",src:"next",value:1}],dateParse:["{month} {year}","{shift} {unit=5-7}","{0?} {date}{1}","{0?} {edge} of {shift?} {unit=4-7?}{month?}{year?}"],
|
||||
timeParse:"{num} {unit} {sign};{sign} {num} {unit};{0} {num}{1} {day} of {month} {year?};{weekday?} {month} {date}{1?} {year?};{date} {month} {year};{date} {month};{shift} {weekday};{shift} week {weekday};{weekday} {2?} {shift} week;{num} {unit=4-5} {sign} {day};{0?} {date}{1} of {month};{0?}{month?} {date?}{1?} of {shift} {unit=6-7}".split(";")});Ob=Rb.concat().reverse();Nb=Rb.concat();Nb.splice(2,1);
|
||||
K(r,!0,!0,Rb,function(a,b,c){function d(a){a/=f;var c=a%1,d=b.error||0.999;c&&P(c%1)>d&&(a=R(a));return 0>a?Aa(a):Q(a)}var e=b.name,g=Yb(e),f=b.b(),h,l;b.j="add"+g+"s";h=function(a,b){return d(this.getTime()-r.create(a,b).getTime())};l=function(a,b){return d(r.create(a,b).getTime()-this.getTime())};a[e+"sAgo"]=l;a[e+"sUntil"]=l;a[e+"sSince"]=h;a[e+"sFromNow"]=h;a[b.j]=function(a,b){var c={};c[e]=a;return this.advance(c,b)};uc(b,f);3>c&&["Last","This","Next"].forEach(function(b){a["is"+b+g]=function(){return rc(this,
|
||||
b+" "+e,"en")}});4>c&&(a["beginningOf"+g]=function(){var a={};switch(e){case "year":a.year=U(this,"FullYear");break;case "month":a.month=U(this,"Month");break;case "day":a.day=U(this,"Date");break;case "week":a.weekday=0}return this.set(a,!0)},a["endOf"+g]=function(){var a={hours:23,minutes:59,seconds:59,milliseconds:999};switch(e){case "year":a.month=11;a.day=31;break;case "month":a.day=this.daysInMonth();break;case "week":a.weekday=6}return this.set(a,!0)})});
|
||||
W.addFormat("([+-])?(\\d{4,4})[-.]?{full_month}[-.]?(\\d{1,2})?",!0,["year_sign","year","month","date"],!1,!0);W.addFormat("(\\d{1,2})[-.\\/]{full_month}(?:[-.\\/](\\d{2,4}))?",!0,["date","month","year"],!0);W.addFormat("{full_month}[-.](\\d{4,4})",!1,["month","year"]);W.addFormat("\\/Date\\((\\d+(?:[+-]\\d{4,4})?)\\)\\/",!1,["timestamp"]);W.addFormat(Vb(W),!1,Jb);Pb=W.g.slice(0,7).reverse();W.g=W.g.slice(7).concat(Pb);oc("f",function(a){return U(a,"Milliseconds")},!0);
|
||||
oc("s",function(a){return U(a,"Seconds")});oc("m",function(a){return U(a,"Minutes")});oc("h",function(a){return U(a,"Hours")%12||12});oc("H",function(a){return U(a,"Hours")});oc("d",function(a){return U(a,"Date")});oc("M",function(a){return U(a,"Month")+1});(function(){function a(a,c){var d=U(a,"Hours");return Y(c).ampm[Q(d/12)]||""}Z("t",a,1);Z("tt",a);Z("T",a,1,1);Z("TT",a,null,2)})();
|
||||
(function(){function a(a,c){var d=U(a,"Day");return Y(c).weekdays[d]}Z("dow",a,3);Z("Dow",a,3,1);Z("weekday",a);Z("Weekday",a,null,1)})();nc("mon",0,3);nc("month",0);nc("month2",1);nc("month3",2);X.ms=X.f;X.milliseconds=X.f;X.seconds=X.s;X.minutes=X.m;X.hours=X.h;X["24hr"]=X.H;X["12hr"]=X.h;X.date=X.d;X.day=X.d;X.year=X.yyyy;K(r,!0,!0,"short,long,full",function(a,b){a[b]=function(a){return qc(this,b,!1,a)}});
|
||||
"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07".split("").forEach(function(a,b){9<b&&(b=za(10,b-9));Lb[a]=b});xa(Lb,Ka);Mb=q("([\u671f\u9031\u5468])?([\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07"+Ja+"]+)(?!\u6628)","g");
|
||||
(function(){var a=W.weekdays.slice(0,7),b=W.months.slice(0,12);K(r,!0,!0,"today yesterday tomorrow weekday weekend future past".split(" ").concat(a).concat(b),function(a,b){a["is"+Yb(b)]=function(a){return this.is(b,0,a)}})})();r.utc||(r.utc={create:function(){return tc(arguments,0,!0)},past:function(){return tc(arguments,-1,!0)},future:function(){return tc(arguments,1,!0)}});
|
||||
H(r,!1,!0,{RFC1123:"{Dow}, {dd} {Mon} {yyyy} {HH}:{mm}:{ss} {tz}",RFC1036:"{Weekday}, {dd}-{Mon}-{yy} {HH}:{mm}:{ss} {tz}",ISO8601_DATE:"{yyyy}-{MM}-{dd}",ISO8601_DATETIME:"{yyyy}-{MM}-{dd}T{HH}:{mm}:{ss}.{fff}{isotz}"});
|
||||
"use strict";function Range(a,b){this.start=vc(a);this.end=vc(b)}function vc(a){return C(a)?new r(a.getTime()):null==a?a:C(a)?a.getTime():a.valueOf()}function wc(a){a=null==a?a:C(a)?a.getTime():a.valueOf();return!!a||0===a}
|
||||
function xc(a,b){var c,d,e,g;if(y(b))return new r(a.getTime()+b);c=b[0];d=b[1];e=U(a,d);g=new r(a.getTime());Sa(g,d,e+c);return g}function yc(a,b){return s.fromCharCode(a.charCodeAt(0)+b)}function zc(a,b){return a+b}Range.prototype.toString=function(){return this.isValid()?this.start+".."+this.end:"Invalid Range"};
|
||||
H(Range,!0,!0,{isValid:function(){return wc(this.start)&&wc(this.end)&&typeof this.start===typeof this.end},span:function(){return this.isValid()?P((z(this.end)?this.end.charCodeAt(0):this.end)-(z(this.start)?this.start.charCodeAt(0):this.start))+1:NaN},contains:function(a){return null==a?!1:a.start&&a.end?a.start>=this.start&&a.start<=this.end&&a.end>=this.start&&a.end<=this.end:a>=this.start&&a<=this.end},every:function(a,b){var c,d=this.start,e=this.end,g=e<d,f=d,h=0,l=[];F(a)&&(b=a,a=null);a=
|
||||
a||1;y(d)?c=zc:z(d)?c=yc:C(d)&&(c=a,y(c)?a=c:(d=c.toLowerCase().match(/^(\d+)?\s?(\w+?)s?$/i),c=parseInt(d[1])||1,d=d[2].slice(0,1).toUpperCase()+d[2].slice(1),d.match(/hour|minute|second/i)?d+="s":"Year"===d?d="FullYear":"Day"===d&&(d="Date"),a=[c,d]),c=xc);for(g&&0<a&&(a*=-1);g?f>=e:f<=e;)l.push(f),b&&b(f,h),f=c(f,a),h++;return l},union:function(a){return new Range(this.start<a.start?this.start:a.start,this.end>a.end?this.end:a.end)},intersect:function(a){return a.start>this.end||a.end<this.start?
|
||||
new Range(NaN,NaN):new Range(this.start>a.start?this.start:a.start,this.end<a.end?this.end:a.end)},clone:function(){return new Range(this.start,this.end)},clamp:function(a){var b=this.start,c=this.end,d=c<b?c:b,b=b>c?b:c;return vc(a<d?d:a>b?b:a)}});[t,s,r].forEach(function(a){H(a,!1,!0,{range:function(b,c){a.create&&(b=a.create(b),c=a.create(c));return new Range(b,c)}})});
|
||||
H(t,!0,!0,{upto:function(a,b,c){return t.range(this,a).every(c,b)},clamp:function(a,b){return(new Range(a,b)).clamp(this)},cap:function(a){return this.clamp(void 0,a)}});H(t,!0,!0,{downto:t.prototype.upto});H(p,!1,function(a){return a instanceof Range},{create:function(a){return a.every()}});
|
||||
"use strict";function Ac(a,b,c,d,e){Infinity!==b&&(a.timers||(a.timers=[]),y(b)||(b=1),a.n=!1,a.timers.push(setTimeout(function(){a.n||c.apply(d,e||[])},b)))}
|
||||
H(Function,!0,!0,{lazy:function(a,b,c){function d(){g.length<c-(f&&b?1:0)&&g.push([this,arguments]);f||(f=!0,b?h():Ac(d,l,h));return x}var e=this,g=[],f=!1,h,l,n,x;a=a||1;c=c||Infinity;l=Aa(a);n=R(l/a)||1;h=function(){var a=g.length,b;if(0!=a){for(b=S(a-n,0);a>b;)x=Function.prototype.apply.apply(e,g.shift()),a--;Ac(d,l,function(){f=!1;h()})}};return d},throttle:function(a){return this.lazy(a,!0,1)},debounce:function(a){function b(){b.cancel();Ac(b,a,c,this,arguments)}var c=this;return b},delay:function(a){var b=
|
||||
L(arguments,null,1);Ac(this,a,this,this,b);return this},every:function(a){function b(){c.apply(c,d);Ac(c,a,b)}var c=this,d=arguments,d=1<d.length?L(d,null,1):[];Ac(c,a,b);return c},cancel:function(){var a=this.timers,b;if(A(a))for(;b=a.shift();)clearTimeout(b);this.n=!0;return this},after:function(a){var b=this,c=0,d=[];if(!y(a))a=1;else if(0===a)return b.call(),b;return function(){var e;d.push(L(arguments));c++;if(c==a)return e=b.call(this,d),c=0,d=[],e}},once:function(){return this.throttle(Infinity,
|
||||
!0)},fill:function(){var a=this,b=L(arguments);return function(){var c=L(arguments);b.forEach(function(a,b){(null!=a||b>=c.length)&&c.splice(b,0,a)});return a.apply(this,c)}}});
|
||||
"use strict";function Bc(a,b,c,d,e,g){var f=a.toFixed(20),h=f.search(/\./),f=f.search(/[1-9]/),h=h-f;0<h&&(h-=1);e=S(Ca(Q(h/3),!1===e?c.length:e),-d);d=c.charAt(e+d-1);-9>h&&(e=-3,b=P(h)-9,d=c.slice(0,1));c=g?za(2,10*e):za(10,3*e);return Da(a/c,b||0).format()+d.trim()}
|
||||
H(t,!1,!0,{random:function(a,b){var c,d;1==arguments.length&&(b=a,a=0);c=Ca(a||0,N(b)?1:b);d=S(a||0,N(b)?1:b)+1;return Q(u.random()*(d-c)+c)}});
|
||||
H(t,!0,!0,{log:function(a){return u.log(this)/(a?u.log(a):1)},abbr:function(a){return Bc(this,a,"kmbt",0,4)},metric:function(a,b){return Bc(this,a,"n\u03bcm kMGTPE",4,N(b)?1:b)},bytes:function(a,b){return Bc(this,a,"kMGTPE",0,N(b)?4:b,!0)+"B"},isInteger:function(){return 0==this%1},isOdd:function(){return!isNaN(this)&&!this.isMultipleOf(2)},isEven:function(){return this.isMultipleOf(2)},isMultipleOf:function(a){return 0===this%a},format:function(a,b,c){var d,e,g,f="";N(b)&&(b=",");N(c)&&(c=".");d=
|
||||
(y(a)?Da(this,a||0).toFixed(S(a,0)):this.toString()).replace(/^-/,"").split(".");e=d[0];g=d[1];for(d=e.length;0<d;d-=3)d<e.length&&(f=b+f),f=e.slice(S(0,d-3),d)+f;g&&(f+=c+Na("0",(a||0)-g.length)+g);return(0>this?"-":"")+f},hex:function(a){return this.pad(a||1,!1,16)},times:function(a){if(a)for(var b=0;b<this;b++)a.call(this,b);return this.toNumber()},chr:function(){return s.fromCharCode(this)},pad:function(a,b,c){return T(this,a,b,c)},ordinalize:function(){var a=P(this),a=parseInt(a.toString().slice(-2));
|
||||
return this+Pa(a)},toNumber:function(){return parseFloat(this,10)}});(function(){function a(a){return function(c){return c?Da(this,c,a):a(this)}}H(t,!0,!0,{ceil:a(Aa),round:a(R),floor:a(Q)});K(t,!0,!0,"abs,pow,sin,asin,cos,acos,tan,atan,exp,pow,sqrt",function(a,c){a[c]=function(a,b){return u[c](this,a,b)}})})();
|
||||
"use strict";var Cc=["isObject","isNaN"],Dc="keys values select reject each merge clone equal watch tap has toQueryString".split(" ");
|
||||
function Ec(a,b,c,d){var e,g,f;(g=b.match(/^(.+?)(\[.*\])$/))?(f=g[1],b=g[2].replace(/^\[|\]$/g,"").split("]["),b.forEach(function(b){e=!b||b.match(/^\d+$/);!f&&A(a)&&(f=a.length);J(a,f)||(a[f]=e?[]:{});a=a[f];f=b}),!f&&e&&(f=a.length.toString()),Ec(a,f,c,d)):a[b]=d&&"true"===c?!0:d&&"false"===c?!1:c}function Fc(a,b){var c;return A(b)||G(b)&&b.toString===v?(c=[],I(b,function(b,e){a&&(b=a+"["+b+"]");c.push(Fc(b,e))}),c.join("&")):a?Gc(a)+"="+(C(b)?b.getTime():Gc(b)):""}
|
||||
function Gc(a){return a||!1===a||0===a?encodeURIComponent(a).replace(/%20/g,"+"):""}function Hc(a,b,c){var d,e=a instanceof O?new O:{};I(a,function(a,f){d=!1;sa(b,function(b){(D(b)?b.test(a):G(b)?b[a]===f:a===s(b))&&(d=!0)},1);d===c&&(e[a]=f)});return e}H(m,!1,!0,{watch:function(a,b,c){if(ea){var d=a[b];m.defineProperty(a,b,{enumerable:!0,configurable:!0,get:function(){return d},set:function(e){d=c.call(a,b,d,e)}})}}});
|
||||
H(m,!1,function(){return 1<arguments.length},{keys:function(a,b){var c=m.keys(a);c.forEach(function(c){b.call(a,c,a[c])});return c}});
|
||||
H(m,!1,!0,{isObject:function(a){return va(a)},isNaN:function(a){return y(a)&&a.valueOf()!==a.valueOf()},equal:function(a,b){return Ua(a,b)},extended:function(a){return new O(a)},merge:function(a,b,c,d){var e,g,f,h,l,n,x;if(a&&"string"!==typeof b)for(e in b)if(J(b,e)&&a){h=b[e];l=a[e];n=M(l);g=G(h);f=G(l);x=n&&!1===d?l:h;n&&F(d)&&(x=d.call(b,e,l,h));if(c&&(g||f))if(C(h))x=new r(h.getTime());else if(D(h))x=new q(h.source,Qa(h));else{f||(a[e]=p.isArray(h)?[]:{});m.merge(a[e],h,c,d);continue}a[e]=x}return a},
|
||||
values:function(a,b){var c=[];I(a,function(d,e){c.push(e);b&&b.call(a,e)});return c},clone:function(a,b){var c;if(!G(a))return a;c=v.call(a);if(C(a,c)&&a.clone)return a.clone();if(C(a,c)||D(a,c))return new a.constructor(a);if(a instanceof O)c=new O;else if(A(a,c))c=[];else if(va(a,c))c={};else throw new TypeError("Clone must be a basic data type.");return m.merge(c,a,b)},fromQueryString:function(a,b){var c=m.extended();a=a&&a.toString?a.toString():"";a.replace(/^.*?\?/,"").split("&").forEach(function(a){a=
|
||||
a.split("=");2===a.length&&Ec(c,a[0],decodeURIComponent(a[1]),b)});return c},toQueryString:function(a,b){return Fc(b,a)},tap:function(a,b){var c=b;F(b)||(c=function(){if(b)a[b]()});c.call(a,a);return a},has:function(a,b){return J(a,b)},select:function(a){return Hc(a,arguments,!0)},reject:function(a){return Hc(a,arguments,!1)}});K(m,!1,!0,w,function(a,b){var c="is"+b;Cc.push(c);a[c]=ia[b]});
|
||||
H(m,!1,function(){return 0===arguments.length},{extend:function(){var a=Cc.concat(Dc);"undefined"!==typeof Hb&&(a=a.concat(Hb));Ya(a,m)}});Ya(Dc,O);
|
||||
"use strict";H(q,!1,!0,{escape:function(a){return Ra(a)}});H(q,!0,!0,{getFlags:function(){return Qa(this)},setFlags:function(a){return q(this.source,a)},addFlag:function(a){return this.setFlags(Qa(this,a))},removeFlag:function(a){return this.setFlags(Qa(this).replace(a,""))}});
|
||||
"use strict";
|
||||
function Ic(a){a=+a;if(0>a||Infinity===a)throw new RangeError("Invalid number");return a}function Jc(a,b){return Na(M(b)?b:" ",a)}function Kc(a,b,c,d,e){var g;if(a.length<=b)return a.toString();d=N(d)?"...":d;switch(c){case "left":return a=e?Lc(a,b,!0):a.slice(a.length-b),d+a;case "middle":return c=Aa(b/2),g=Q(b/2),b=e?Lc(a,c):a.slice(0,c),a=e?Lc(a,g,!0):a.slice(a.length-g),b+d+a;default:return b=e?Lc(a,b):a.slice(0,b),b+d}}
|
||||
function Lc(a,b,c){if(c)return Lc(a.reverse(),b).reverse();c=q("(?=["+Ma()+"])");var d=0;return a.split(c).filter(function(a){d+=a.length;return d<=b}).join("")}function Mc(a,b,c){z(b)&&(b=a.indexOf(b),-1===b&&(b=c?a.length:0));return b}var Nc,Oc;H(s,!0,!1,{repeat:function(a){a=Ic(a);return Na(this,a)}});
|
||||
H(s,!0,function(a){return D(a)||2<arguments.length},{startsWith:function(a){var b=arguments,c=b[1],b=b[2],d=this;c&&(d=d.slice(c));N(b)&&(b=!0);c=D(a)?a.source.replace("^",""):Ra(a);return q("^"+c,b?"":"i").test(d)},endsWith:function(a){var b=arguments,c=b[1],b=b[2],d=this;M(c)&&(d=d.slice(0,c));N(b)&&(b=!0);c=D(a)?a.source.replace("$",""):Ra(a);return q(c+"$",b?"":"i").test(d)}});
|
||||
H(s,!0,!0,{escapeRegExp:function(){return Ra(this)},escapeURL:function(a){return a?encodeURIComponent(this):encodeURI(this)},unescapeURL:function(a){return a?decodeURI(this):decodeURIComponent(this)},escapeHTML:function(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},unescapeHTML:function(){return this.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,
|
||||
"/").replace(/&/g,"&")},encodeBase64:function(){return Nc(unescape(encodeURIComponent(this)))},decodeBase64:function(){return decodeURIComponent(escape(Oc(this)))},each:function(a,b){var c,d,e;F(a)?(b=a,a=/[\s\S]/g):a?z(a)?a=q(Ra(a),"gi"):D(a)&&(a=q(a.source,Qa(a,"g"))):a=/[\s\S]/g;c=this.match(a)||[];if(b)for(d=0,e=c.length;d<e;d++)c[d]=b.call(this,c[d],d,c)||c[d];return c},shift:function(a){var b="";a=a||0;this.codes(function(c){b+=s.fromCharCode(c+a)});return b},codes:function(a){var b=[],
|
||||
c,d;c=0;for(d=this.length;c<d;c++){var e=this.charCodeAt(c);b.push(e);a&&a.call(this,e,c)}return b},chars:function(a){return this.each(a)},words:function(a){return this.trim().each(/\S+/g,a)},lines:function(a){return this.trim().each(/^.*$/gm,a)},paragraphs:function(a){var b=this.trim().split(/[\r\n]{2,}/);return b=b.map(function(b){if(a)var d=a.call(b);return d?d:b})},isBlank:function(){return 0===this.trim().length},has:function(a){return-1!==this.search(D(a)?a:Ra(a))},add:function(a,b){b=N(b)?
|
||||
this.length:b;return this.slice(0,b)+a+this.slice(b)},remove:function(a){return this.replace(a,"")},reverse:function(){return this.split("").reverse().join("")},compact:function(){return this.trim().replace(/([\r\n\s\u3000])+/g,function(a,b){return"\u3000"===b?b:" "})},at:function(){return Wa(this,arguments,!0)},from:function(a){return this.slice(Mc(this,a,!0))},to:function(a){N(a)&&(a=this.length);return this.slice(0,Mc(this,a))},dasherize:function(){return this.underscore().replace(/_/g,"-")},underscore:function(){return this.replace(/[-\s]+/g,
|
||||
"_").replace(s.Inflector&&s.Inflector.acronymRegExp,function(a,b){return(0<b?"_":"")+a.toLowerCase()}).replace(/([A-Z\d]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase()},camelize:function(a){return this.underscore().replace(/(^|_)([^_]+)/g,function(b,c,d,e){b=(b=s.Inflector)&&b.acronyms[d];b=z(b)?b:void 0;e=!1!==a||0<e;return b?e?b:b.toLowerCase():e?d.capitalize():d})},spacify:function(){return this.underscore().replace(/_/g," ")},stripTags:function(){var a=this;sa(0<arguments.length?
|
||||
arguments:[""],function(b){a=a.replace(q("</?"+Ra(b)+"[^<>]*>","gi"),"")});return a},removeTags:function(){var a=this;sa(0<arguments.length?arguments:["\\S+"],function(b){b=q("<("+b+")[^<>]*(?:\\/>|>.*?<\\/\\1>)","gi");a=a.replace(b,"")});return a},truncate:function(a,b,c){return Kc(this,a,b,c)},truncateOnWord:function(a,b,c){return Kc(this,a,b,c,!0)},pad:function(a,b){var c,d;a=Ic(a);c=S(0,a-this.length)/2;d=Q(c);c=Aa(c);return Jc(d,b)+this+Jc(c,b)},padLeft:function(a,b){a=Ic(a);return Jc(S(0,a-
|
||||
this.length),b)+this},padRight:function(a,b){a=Ic(a);return this+Jc(S(0,a-this.length),b)},first:function(a){N(a)&&(a=1);return this.substr(0,a)},last:function(a){N(a)&&(a=1);return this.substr(0>this.length-a?0:this.length-a)},toNumber:function(a){return Oa(this,a)},capitalize:function(a){var b;return this.toLowerCase().replace(a?/[^']/g:/^\S/,function(a){var d=a.toUpperCase(),e;e=b?a:d;b=d!==a;return e})},assign:function(){var a={};sa(arguments,function(b,c){G(b)?xa(a,b):a[c+1]=b});return this.replace(/\{([^{]+?)\}/g,
|
||||
function(b,c){return J(a,c)?a[c]:b})}});H(s,!0,!0,{insert:s.prototype.add});
|
||||
(function(a){if(ba.btoa)Nc=ba.btoa,Oc=ba.atob;else{var b=/[^A-Za-z0-9\+\/\=]/g;Nc=function(b){var d="",e,g,f,h,l,n,x=0;do e=b.charCodeAt(x++),g=b.charCodeAt(x++),f=b.charCodeAt(x++),h=e>>2,e=(e&3)<<4|g>>4,l=(g&15)<<2|f>>6,n=f&63,isNaN(g)?l=n=64:isNaN(f)&&(n=64),d=d+a.charAt(h)+a.charAt(e)+a.charAt(l)+a.charAt(n);while(x<b.length);return d};Oc=function(c){var d="",e,g,f,h,l,n=0;if(c.match(b))throw Error("String contains invalid base64 characters");c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");do e=a.indexOf(c.charAt(n++)),
|
||||
g=a.indexOf(c.charAt(n++)),h=a.indexOf(c.charAt(n++)),l=a.indexOf(c.charAt(n++)),e=e<<2|g>>4,g=(g&15)<<4|h>>2,f=(h&3)<<6|l,d+=s.fromCharCode(e),64!=h&&(d+=s.fromCharCode(g)),64!=l&&(d+=s.fromCharCode(f));while(n<c.length);return d}}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");})();
|
||||
191
modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/jquery.quicksearch.js
Executable file
191
modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/jquery.quicksearch.js
Executable file
@@ -0,0 +1,191 @@
|
||||
/* jQuery Quicksearch plugin
|
||||
by riklomas https://github.com/riklomas/quicksearch
|
||||
Modified to include childRows (for tablesorter)
|
||||
|
||||
See http://stackoverflow.com/q/20342203/145346 for
|
||||
more details
|
||||
*/
|
||||
(function($, window, document, undefined) {
|
||||
$.fn.quicksearch = function (target, opt) {
|
||||
|
||||
var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({
|
||||
delay: 100,
|
||||
selector: null,
|
||||
stripeRows: null,
|
||||
loader: null,
|
||||
noResults: '',
|
||||
childRow: 'tablesorter-childRow', // include child row with search results
|
||||
matchedResultsCount: 0,
|
||||
bind: 'keyup',
|
||||
onBefore: function () {
|
||||
return;
|
||||
},
|
||||
onAfter: function () {
|
||||
return;
|
||||
},
|
||||
show: function () {
|
||||
this.style.display = "";
|
||||
},
|
||||
hide: function () {
|
||||
this.style.display = "none";
|
||||
},
|
||||
prepareQuery: function (val) {
|
||||
return val.toLowerCase().split(' ');
|
||||
},
|
||||
testQuery: function (query, txt, _row) {
|
||||
for (var i = 0; i < query.length; i += 1) {
|
||||
if (txt.indexOf(query[i]) === -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, opt);
|
||||
|
||||
this.go = function () {
|
||||
|
||||
var i = 0,
|
||||
numMatchedRows = 0,
|
||||
noresults = true,
|
||||
query = options.prepareQuery(val),
|
||||
val_empty = (val.replace(' ', '').length === 0);
|
||||
|
||||
for (var i = 0, len = rowcache.length; i < len; i++) {
|
||||
if (val_empty || options.testQuery(query, cache[i], rowcache[i]) ||
|
||||
($(rowcache[i]).hasClass(options.childRow) && $(rowcache[i > 1 ? i - 1 : 0]).is(':visible'))) {
|
||||
options.show.apply(rowcache[i]);
|
||||
noresults = false;
|
||||
numMatchedRows++;
|
||||
} else {
|
||||
options.hide.apply(rowcache[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (noresults) {
|
||||
this.results(false);
|
||||
} else {
|
||||
this.results(true);
|
||||
this.stripe();
|
||||
}
|
||||
|
||||
this.matchedResultsCount = numMatchedRows;
|
||||
this.loader(false);
|
||||
options.onAfter();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/*
|
||||
* External API so that users can perform search programatically.
|
||||
* */
|
||||
this.search = function (submittedVal) {
|
||||
val = submittedVal;
|
||||
e.trigger();
|
||||
};
|
||||
|
||||
/*
|
||||
* External API to get the number of matched results as seen in
|
||||
* https://github.com/ruiz107/quicksearch/commit/f78dc440b42d95ce9caed1d087174dd4359982d6
|
||||
* */
|
||||
this.currentMatchedResults = function() {
|
||||
return this.matchedResultsCount;
|
||||
};
|
||||
|
||||
this.stripe = function () {
|
||||
|
||||
if (typeof options.stripeRows === "object" && options.stripeRows !== null)
|
||||
{
|
||||
var joined = options.stripeRows.join(' ');
|
||||
var stripeRows_length = options.stripeRows.length;
|
||||
|
||||
jq_results.not(':hidden').each(function (i) {
|
||||
$(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
this.strip_html = function (input) {
|
||||
var output = input.replace(new RegExp('<[^<]+\>', 'g'), "");
|
||||
output = $.trim(output.toLowerCase());
|
||||
return output;
|
||||
};
|
||||
|
||||
this.results = function (bool) {
|
||||
if (typeof options.noResults === "string" && options.noResults !== "") {
|
||||
if (bool) {
|
||||
$(options.noResults).hide();
|
||||
} else {
|
||||
$(options.noResults).show();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
this.loader = function (bool) {
|
||||
if (typeof options.loader === "string" && options.loader !== "") {
|
||||
(bool) ? $(options.loader).show() : $(options.loader).hide();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
this.cache = function () {
|
||||
|
||||
jq_results = $(target);
|
||||
|
||||
if (typeof options.noResults === "string" && options.noResults !== "") {
|
||||
jq_results = jq_results.not(options.noResults);
|
||||
}
|
||||
|
||||
var t = (typeof options.selector === "string") ?
|
||||
jq_results.find(options.selector) : $(target).not(options.noResults);
|
||||
cache = t.map(function () {
|
||||
return e.strip_html(this.innerHTML);
|
||||
});
|
||||
|
||||
rowcache = jq_results.map(function () {
|
||||
return this;
|
||||
});
|
||||
|
||||
/*
|
||||
* Modified fix for sync-ing "val".
|
||||
* Original fix https://github.com/michaellwest/quicksearch/commit/4ace4008d079298a01f97f885ba8fa956a9703d1
|
||||
* */
|
||||
val = val || this.val() || "";
|
||||
|
||||
return this.go();
|
||||
};
|
||||
|
||||
this.trigger = function () {
|
||||
this.loader(true);
|
||||
options.onBefore();
|
||||
|
||||
window.clearTimeout(timeout);
|
||||
timeout = window.setTimeout(function () {
|
||||
e.go();
|
||||
}, options.delay);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
this.cache();
|
||||
this.results(true);
|
||||
this.stripe();
|
||||
this.loader(false);
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
/*
|
||||
* Changed from .bind to .on.
|
||||
* */
|
||||
$(this).on(options.bind, function () {
|
||||
|
||||
val = $(this).val();
|
||||
e.trigger();
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
}(jQuery, this, document));
|
||||
1026
modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/semver-mod.js
Executable file
1026
modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/semver-mod.js
Executable file
File diff suppressed because it is too large
Load Diff
1011
modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/semver.js
Executable file
1011
modules/EcmReportsBackUp20151106/TableSorterNew/js/extras/semver.js
Executable file
File diff suppressed because it is too large
Load Diff
116
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.metadata.js
Executable file
116
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.metadata.js
Executable file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Metadata - jQuery plugin for parsing metadata from elements
|
||||
*
|
||||
* Copyright (c) 2006 John Resig, Yehuda Katz, Jörn Zaefferer, Paul McLanahan
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
||||
* in the JSON will become a property of the element itself.
|
||||
*
|
||||
* There are three supported types of metadata storage:
|
||||
*
|
||||
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
||||
*
|
||||
* class: Inside the class attribute, wrapped in curly braces: { }
|
||||
*
|
||||
* elem: Inside a child element (e.g. a script tag). The
|
||||
* name parameter indicates *which* element.
|
||||
*
|
||||
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
||||
*
|
||||
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
||||
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
||||
*
|
||||
* @name $.metadata.setType
|
||||
*
|
||||
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("class")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from the class attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("attr", "data")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a "data" attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
||||
* @before $.metadata.setType("elem", "script")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a nested script element
|
||||
*
|
||||
* @param String type The encoding type
|
||||
* @param String name The name of the attribute to be used to get metadata (optional)
|
||||
* @cat Plugins/Metadata
|
||||
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
||||
* @type undefined
|
||||
* @see metadata()
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.extend({
|
||||
metadata : {
|
||||
defaults : {
|
||||
type: 'class',
|
||||
name: 'metadata',
|
||||
cre: /(\{.*\})/,
|
||||
single: 'metadata'
|
||||
},
|
||||
setType: function( type, name ){
|
||||
this.defaults.type = type;
|
||||
this.defaults.name = name;
|
||||
},
|
||||
get: function( elem, opts ){
|
||||
var data, m, e, attr,
|
||||
settings = $.extend({},this.defaults,opts);
|
||||
// check for empty string in single property
|
||||
if ( !settings.single.length ) { settings.single = 'metadata'; }
|
||||
|
||||
data = $.data(elem, settings.single);
|
||||
// returned cached data if it already exists
|
||||
if ( data ) { return data; }
|
||||
|
||||
data = "{}";
|
||||
|
||||
if ( settings.type === "class" ) {
|
||||
m = settings.cre.exec( elem.className );
|
||||
if ( m ) { data = m[1]; }
|
||||
} else if ( settings.type === "elem" ) {
|
||||
if( !elem.getElementsByTagName ) { return undefined; }
|
||||
e = elem.getElementsByTagName(settings.name);
|
||||
if ( e.length ) { data = $.trim(e[0].innerHTML); }
|
||||
} else if ( elem.getAttribute !== undefined ) {
|
||||
attr = elem.getAttribute( settings.name );
|
||||
if ( attr ) { data = attr; }
|
||||
}
|
||||
|
||||
if ( data.indexOf( '{' ) <0 ) { data = "{" + data + "}"; }
|
||||
|
||||
data = eval("(" + data + ")");
|
||||
|
||||
$.data( elem, settings.single, data );
|
||||
return data;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the metadata object for the first member of the jQuery object.
|
||||
*
|
||||
* @name metadata
|
||||
* @descr Returns element's metadata object
|
||||
* @param Object opts An object contianing settings to override the defaults
|
||||
* @type jQuery
|
||||
* @cat Plugins/Metadata
|
||||
*/
|
||||
$.fn.metadata = function( opts ){
|
||||
return $.metadata.get( this[0], opts );
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
1901
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.js
Executable file
1901
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.js
Executable file
File diff suppressed because it is too large
Load Diff
5
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.min.js
vendored
Executable file
5
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,138 @@
|
||||
/*! Filter widget select2 formatter function - updated 7/17/2014 (v2.17.5)
|
||||
* requires: jQuery 1.7.2+, tableSorter 2.16+, filter widget 2.16+ and select2 v3.4.6+ plugin
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
ts.filterFormatter = ts.filterFormatter || {};
|
||||
|
||||
/************************\
|
||||
Select2 Filter Formatter
|
||||
\************************/
|
||||
ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
var o = $.extend({
|
||||
// select2 filter formatter options
|
||||
cellText : '', // Text (wrapped in a label element)
|
||||
match : true, // adds "filter-match" to header
|
||||
value : '',
|
||||
// include ANY select2 options below
|
||||
multiple : true,
|
||||
width : '100%'
|
||||
|
||||
}, select2Def ),
|
||||
arry, data,
|
||||
c = $cell.closest('table')[0].config,
|
||||
wo = c.widgetOptions,
|
||||
// Add a hidden input to hold the range values
|
||||
$input = $('<input class="filter" type="hidden">')
|
||||
.appendTo($cell)
|
||||
// hidden filter update namespace trigger by filter widget
|
||||
.bind('change' + c.namespace + 'filter', function(){
|
||||
var val = this.value;
|
||||
val = val.replace(/[/()$^]/g, '').split('|');
|
||||
$cell.find('.select2').select2('val', val);
|
||||
updateSelect2();
|
||||
}),
|
||||
$header = c.$headers.filter('[data-column="' + indx + '"]:last'),
|
||||
onlyAvail = $header.hasClass(wo.filter_onlyAvail),
|
||||
$shcell = [],
|
||||
matchPrefix = o.match ? '' : '^',
|
||||
matchSuffix = o.match ? '' : '$',
|
||||
|
||||
// this function updates the hidden input and adds the current values to the header cell text
|
||||
updateSelect2 = function() {
|
||||
var v = $cell.find('.select2').select2('val') || o.value || '';
|
||||
$input
|
||||
// add regex, so we filter exact numbers
|
||||
.val( $.isArray(v) && v.length && v.join('') !== '' ? '/(' + matchPrefix + (v || []).join(matchSuffix + '|' + matchPrefix) + matchSuffix + ')/' : '' )
|
||||
.trigger('search').end()
|
||||
.find('.select2').select2('val', v);
|
||||
// update sticky header cell
|
||||
if ($shcell.length) {
|
||||
$shcell
|
||||
.find('.select2').select2('val', v);
|
||||
}
|
||||
},
|
||||
|
||||
// get options from table cell content or filter_selectSource (v2.16)
|
||||
updateOptions = function(){
|
||||
data = [];
|
||||
arry = ts.filter.getOptionSource(c.$table[0], indx, onlyAvail) || [];
|
||||
// build select2 data option
|
||||
$.each(arry, function(i,v){
|
||||
data.push({id: v, text: v});
|
||||
});
|
||||
o.data = data;
|
||||
};
|
||||
|
||||
// get filter-match class from option
|
||||
$header.toggleClass('filter-match', o.match);
|
||||
if (o.cellText) {
|
||||
$cell.prepend('<label>' + o.cellText + '</label>');
|
||||
}
|
||||
|
||||
// don't add default in table options if either ajax or
|
||||
// data options are already defined
|
||||
if (!(o.ajax && !$.isEmptyObject(o.ajax)) && !o.data) {
|
||||
updateOptions();
|
||||
if (onlyAvail) {
|
||||
c.$table.bind('filterEnd', function(){
|
||||
updateOptions();
|
||||
$cell.add($shcell).find('.select2').select2(o);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// add a select2 hidden input!
|
||||
$('<input class="select2 select2-' + indx + '" type="hidden" />')
|
||||
.val(o.value)
|
||||
.appendTo($cell)
|
||||
.select2(o)
|
||||
.bind('change', function(){
|
||||
updateSelect2();
|
||||
});
|
||||
|
||||
// update select2 from filter hidden input, in case of saved filters
|
||||
c.$table.bind('filterFomatterUpdate', function(){
|
||||
// value = '/(^x$|^y$)/' => 'x,y'
|
||||
var val = c.$table.data('lastSearch')[indx] || '';
|
||||
val = val.replace(/[/()$^]/g, '').split('|');
|
||||
$cell.find('.select2').select2('val', val);
|
||||
updateSelect2();
|
||||
ts.filter.formatterUpdated($cell, indx);
|
||||
});
|
||||
|
||||
// has sticky headers?
|
||||
c.$table.bind('stickyHeadersInit', function(){
|
||||
$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty();
|
||||
// add a select2!
|
||||
$('<input class="select2 select2-' + indx + '" type="hidden">')
|
||||
.val(o.value)
|
||||
.appendTo($shcell)
|
||||
.select2(o)
|
||||
.bind('change', function(){
|
||||
$cell.find('.select2').select2('val', $shcell.find('.select2').select2('val') );
|
||||
updateSelect2();
|
||||
});
|
||||
if (o.cellText) {
|
||||
$shcell.prepend('<label>' + o.cellText + '</label>');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// on reset
|
||||
c.$table.bind('filterReset', function(){
|
||||
$cell.find('.select2').select2('val', o.value || '');
|
||||
setTimeout(function(){
|
||||
updateSelect2();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
updateSelect2();
|
||||
return $input;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
File diff suppressed because it is too large
Load Diff
6
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter.min.js
vendored
Executable file
6
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets-filter-formatter.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
1912
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets.js
Executable file
1912
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets.js
Executable file
File diff suppressed because it is too large
Load Diff
17
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets.min.js
vendored
Executable file
17
modules/EcmReportsBackUp20151106/TableSorterNew/js/jquery.tablesorter.widgets.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,81 @@
|
||||
/*!
|
||||
* Extract out date parsers
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
/*! extract US Long Date (ignore any other text)
|
||||
* e.g. "Sue's Birthday! Jun 26, 2004 7:22 AM (8# 2oz)"
|
||||
* demo: http://jsfiddle.net/abkNM/2293/
|
||||
*/
|
||||
$.tablesorter.addParser({
|
||||
id: "extractUSLongDate",
|
||||
is: function (s) {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function (s, table) {
|
||||
var date = s.match(/[A-Z]{3,10}\.?\s+\d{1,2},?\s+(?:\d{4})(?:\s+\d{1,2}:\d{2}(?::\d{2})?(?:\s+[AP]M)?)?/i);
|
||||
return date ? $.tablesorter.formatFloat((new Date(date[0]).getTime() || ''), table) || s : s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
/*! extract MMDDYYYY (ignore any other text)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/2418/
|
||||
*/
|
||||
$.tablesorter.addParser({
|
||||
id: "extractMMDDYYYY",
|
||||
is: function (s) {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function (s, table) {
|
||||
var date = s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(/(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i);
|
||||
return date ? $.tablesorter.formatFloat((new Date(date[0]).getTime() || ''), table) || s : s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
/*! extract DDMMYYYY (ignore any other text)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/2419/
|
||||
*/
|
||||
$.tablesorter.addParser({
|
||||
id: "extractDDMMYYYY",
|
||||
is: function (s) {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function (s, table) {
|
||||
var date = s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(/(\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i);
|
||||
if (date) {
|
||||
date = date[0].replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$2/$1/$3");
|
||||
return $.tablesorter.formatFloat((new Date(date).getTime() || ''), table) || s;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
/*! extract YYYYMMDD (ignore any other text)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/2420/
|
||||
*/
|
||||
$.tablesorter.addParser({
|
||||
id: "extractYYYYMMDD",
|
||||
is: function (s) {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function (s, table) {
|
||||
var date = s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(/(\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/i);
|
||||
if (date) {
|
||||
date = date[0].replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/, "$2/$3/$1");
|
||||
return $.tablesorter.formatFloat((new Date(date).getTime() || ''), table) || s;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,34 @@
|
||||
/*! ISO-8601 date parser
|
||||
* This parser will work with dates in ISO8601 format
|
||||
* 2013-02-18T18:18:44+00:00
|
||||
* Written by Sean Ellingham :https://github.com/seanellingham
|
||||
* See https://github.com/Mottie/tablesorter/issues/247
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var iso8601date = /^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/;
|
||||
$.tablesorter.addParser({
|
||||
id : 'iso8601date',
|
||||
is : function(s) {
|
||||
return s.match(iso8601date);
|
||||
},
|
||||
format : function(s) {
|
||||
var result = s.match(iso8601date);
|
||||
if (result) {
|
||||
var date = new Date(result[1], 0, 1);
|
||||
if (result[3]) { date.setMonth(result[3] - 1); }
|
||||
if (result[5]) { date.setDate(result[5]); }
|
||||
if (result[7]) { date.setHours(result[7]); }
|
||||
if (result[8]) { date.setMinutes(result[8]); }
|
||||
if (result[10]) { date.setSeconds(result[10]); }
|
||||
if (result[12]) { date.setMilliseconds(Number('0.' + result[12]) * 1000); }
|
||||
return date;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type : 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,33 @@
|
||||
/*! Month parser
|
||||
* Demo: http://jsfiddle.net/Mottie/abkNM/477/
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter;
|
||||
ts.dates = $.extend({}, ts.dates, {
|
||||
// *** modify this array to change match the language ***
|
||||
monthCased : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
|
||||
});
|
||||
ts.dates.monthLower = ts.dates.monthCased.join(',').toLocaleLowerCase().split(',');
|
||||
|
||||
ts.addParser({
|
||||
id: "month",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
var j = -1, c = table.config,
|
||||
n = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
||||
$.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
||||
if (j < 0 && n.match(v)) { j = i; }
|
||||
});
|
||||
// return s (original string) if there isn't a match
|
||||
// (non-weekdays will sort separately and empty cells will sort as expected)
|
||||
return j < 0 ? s : j;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,74 @@
|
||||
/*! Two digit year parser
|
||||
* Demo: http://jsfiddle.net/Mottie/abkNM/427/
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter,
|
||||
|
||||
// Make the date be within +/- range of the 2 digit year
|
||||
// so if the current year is 2020, and the 2 digit year is 80 (2080 - 2020 > 50), it becomes 1980
|
||||
// if the 2 digit year is 50 (2050 - 2020 < 50), then it becomes 2050.
|
||||
range = 50;
|
||||
|
||||
ts.dates = $.extend({}, ts.dates, {
|
||||
regxxxxyy: /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/,
|
||||
regyyxxxx: /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/
|
||||
});
|
||||
|
||||
ts.formatDate = function(s, regex, format, table){
|
||||
var n = s
|
||||
// replace separators
|
||||
.replace(/\s+/g," ").replace(/[-.,]/g, "/")
|
||||
// reformat xx/xx/xx to mm/dd/19yy;
|
||||
.replace(regex, format),
|
||||
d = new Date(n),
|
||||
y = d.getFullYear(),
|
||||
rng = table && table.config.dateRange || range,
|
||||
now = new Date().getFullYear();
|
||||
// if date > 50 years old (set range), add 100 years
|
||||
// this will work when people start using "50" and mean "2050"
|
||||
while (now - y > rng) {
|
||||
y += 100;
|
||||
}
|
||||
return d.setFullYear(y) || s;
|
||||
};
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "ddmmyy",
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
// reformat dd/mm/yy to mm/dd/19yy;
|
||||
return ts.formatDate(s, ts.dates.regxxxxyy, "$2/$1/19$3", table);
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "mmddyy",
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
// reformat mm/dd/yy to mm/dd/19yy
|
||||
return ts.formatDate(s, ts.dates.regxxxxyy, "$1/$2/19$3", table);
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "yymmdd",
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
// reformat yy/mm/dd to mm/dd/19yy
|
||||
return ts.formatDate(s, ts.dates.regyyxxxx, "$2/$3/19$1", table);
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,33 @@
|
||||
/*! Weekday parser
|
||||
* Demo: http://jsfiddle.net/Mottie/abkNM/477/
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter;
|
||||
ts.dates = $.extend({}, ts.dates, {
|
||||
// *** modify this array to change match the language ***
|
||||
weekdayCased : [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]
|
||||
});
|
||||
ts.dates.weekdayLower = ts.dates.weekdayCased.join(',').toLocaleLowerCase().split(',');
|
||||
|
||||
ts.addParser({
|
||||
id: "weekday",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
var j = -1, c = table.config;
|
||||
s = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
||||
$.each(ts.dates[ 'weekday' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
||||
if (j < 0 && s.match(v)) { j = i; }
|
||||
});
|
||||
// return s (original string) if there isn't a match
|
||||
// (non-weekdays will sort separately and empty cells will sort as expected)
|
||||
return j < 0 ? s : j;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
36
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date.js
Executable file
36
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-date.js
Executable file
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* Extract dates using popular natural language date parsers
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
/*! Sugar (http://sugarjs.com/dates#comparing_dates)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/551/
|
||||
*/
|
||||
$.tablesorter.addParser({
|
||||
id: "sugar",
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s) {
|
||||
return Date.create ? Date.create(s).getTime() || s : new Date(s).getTime() || s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
/*! Datejs (http://www.datejs.com/)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/550/
|
||||
*/
|
||||
$.tablesorter.addParser({
|
||||
id: "datejs",
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s) {
|
||||
return Date.parse && Date.parse(s) || s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,40 @@
|
||||
/*! Duration parser
|
||||
*/
|
||||
/*jshint jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
// If any number > 9999, then set table.config.durationLength = 5
|
||||
// The below regex matches this duration example: 1y 23d 12h 44m 9s
|
||||
$.tablesorter.addParser({
|
||||
id: "duration",
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
var i, time,
|
||||
c = table.config,
|
||||
t = '',
|
||||
duration = '',
|
||||
len = c.durationLength || 4,
|
||||
str = new Array(len + 1).join('0'),
|
||||
labels = (c.durationLabels || '(?:years|year|y),(?:days|day|d),(?:hours|hour|h),(?:minutes|minute|min|m),(?:seconds|second|sec|s)').split(/\s*,\s*/),
|
||||
llen = labels.length;
|
||||
// build regex
|
||||
if (!c.durationRegex) {
|
||||
for (i = 0; i < llen; i++) {
|
||||
t += '(?:(\\d+)\\s*' + labels[i] + '\\s*)?';
|
||||
}
|
||||
c.durationRegex = new RegExp(t, 'i');
|
||||
}
|
||||
// remove commas from value
|
||||
time = ( c.usNumberFormat ? s.replace(/,/g, '') : s.replace( /(\d)(?:\.|\s*)(\d)/g, '$1$2') ).match(c.durationRegex);
|
||||
for (i = 1; i < llen + 1; i++) {
|
||||
duration += ( str + ( time[i] || 0 ) ).slice(-len);
|
||||
}
|
||||
return duration;
|
||||
},
|
||||
type: "text"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,63 @@
|
||||
/*! Distance parser
|
||||
* This parser will parser numbers like 5'10" (5 foot 10 inches)
|
||||
* and 31½ into sortable values.
|
||||
* Demo: http://jsfiddle.net/Mottie/abkNM/154/
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter;
|
||||
ts.symbolRegex = /[\u215b\u215c\u215d\u215e\u00bc\u00bd\u00be]/g;
|
||||
ts.processFractions = function(n, table) {
|
||||
if (n) {
|
||||
var t, p = 0;
|
||||
n = $.trim(n.replace(/\"/,''));
|
||||
// look for a space in the first part of the number: "10 3/4" and save the "10"
|
||||
if (/\s/.test(n)) {
|
||||
p = ts.formatFloat(n.split(' ')[0], table);
|
||||
// remove stuff to the left of the space
|
||||
n = $.trim(n.substring(n.indexOf(' '), n.length));
|
||||
}
|
||||
// look for a "/" to calculate fractions
|
||||
if (/\//g.test(n)) {
|
||||
t = n.split('/');
|
||||
// turn 3/4 into .75; make sure we don't divide by zero
|
||||
n = p + parseInt(t[0], 10) / parseInt(t[1] || 1, 10);
|
||||
// look for fraction symbols
|
||||
} else if (ts.symbolRegex.test(n)) {
|
||||
n = p + n.replace(ts.symbolRegex, function(m){
|
||||
return {
|
||||
'\u215b' : '.125', // 1/8
|
||||
'\u215c' : '.375', // 3/8
|
||||
'\u215d' : '.625', // 5/8
|
||||
'\u215e' : '.875', // 7/8
|
||||
'\u00bc' : '.25', // 1/4
|
||||
'\u00bd' : '.5', // 1/2
|
||||
'\u00be' : '.75' // 3/4
|
||||
}[m];
|
||||
});
|
||||
}
|
||||
}
|
||||
return n || 0;
|
||||
};
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'distance',
|
||||
is: function() {
|
||||
// return false so this parser is not auto detected
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
if (s === '') { return ''; }
|
||||
// look for feet symbol = '
|
||||
// very generic test to catch 1.1', 1 1/2' and 1½'
|
||||
var d = (/^\s*\S*(\s+\S+)?\s*\'/.test(s)) ? s.split("'") : [0,s],
|
||||
f = ts.processFractions(d[0], table), // feet
|
||||
i = ts.processFractions(d[1], table); // inches
|
||||
return (/[\'\"]/).test(s) ? parseFloat(f) + (parseFloat(i)/12 || 0) : parseFloat(f) + parseFloat(i);
|
||||
},
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,73 @@
|
||||
/*! File Type parser
|
||||
* When a file type extension is found, the equivalent name is
|
||||
* prefixed into the parsed data, so sorting occurs in groups
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
|
||||
// To add a custom equivalent, define:
|
||||
// $.tablesorter.fileTypes.equivalents['xx'] = "A|B|C";
|
||||
$.tablesorter.fileTypes = {
|
||||
// divides filetype extensions in the equivalent list below
|
||||
separator : '|',
|
||||
equivalents : {
|
||||
"3D Image" : "3dm|3ds|dwg|max|obj",
|
||||
"Audio" : "aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma",
|
||||
"Compressed" : "7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo",
|
||||
"Database" : "csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml",
|
||||
"Development" : "asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb",
|
||||
"Document" : "doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri",
|
||||
"Executable" : "apk|app|com|exe|gadget|lnk|msi",
|
||||
"Fonts" : "eot|fnt|fon|otf|ttf|woff",
|
||||
"Icons" : "ani|cur|icns|ico",
|
||||
"Images" : "bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp",
|
||||
"Presentation" : "pps|ppt",
|
||||
"Published" : "chp|epub|lit|pub|ppp|fm|mobi",
|
||||
"Script" : "as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf",
|
||||
"Styles" : "css|less|sass",
|
||||
"Text" : "info|log|md|markdown|nfo|tex|text|txt",
|
||||
"Vectors" : "awg|ai|eps|cdr|ps|svg",
|
||||
"Video" : "asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv",
|
||||
"Web" : "asp|aspx|cer|cfm|htm|html|php|url|xhtml"
|
||||
}
|
||||
};
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'filetype',
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
var t,
|
||||
c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
i = s.lastIndexOf('.'),
|
||||
sep = $.tablesorter.fileTypes.separator,
|
||||
m = $.tablesorter.fileTypes.matching,
|
||||
types = $.tablesorter.fileTypes.equivalents;
|
||||
if (!m) {
|
||||
// make a string to "quick" match the existing equivalents
|
||||
var t = [];
|
||||
$.each(types, function(i,v){
|
||||
t.push(v);
|
||||
});
|
||||
m = $.tablesorter.fileTypes.matching = sep + t.join(sep) + sep;
|
||||
}
|
||||
if (i >= 0) {
|
||||
t = sep + s.substring(i + 1, s.length) + sep;
|
||||
if (m.indexOf(t) >= 0) {
|
||||
for (i in types) {
|
||||
if ((sep + types[i] + sep).indexOf(t) >= 0) {
|
||||
return i + (wo.group_separator ? wo.group_separator : '-') + s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: 'text'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,61 @@
|
||||
/*! Title parser - updated 9/15/2014 (v2.17.8)
|
||||
* This parser will remove "The", "A" and "An" from the beginning of a book
|
||||
* or movie title, so it sorts by the second word or number
|
||||
* Demo: http://jsfiddle.net/Mottie/abkNM/5/
|
||||
*/
|
||||
/*jshint browser: true, jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter;
|
||||
|
||||
// basic list from http://en.wikipedia.org/wiki/Article_%28grammar%29
|
||||
ts.ignoreArticles = {
|
||||
"en" : "the, a, an",
|
||||
"de" : "der, die, das, des, dem, den, ein, eine, einer, eines, einem, einen",
|
||||
"nl" : "de, het, de, een",
|
||||
"es" : "el, la, lo, los, las, un, una, unos, unas",
|
||||
"pt" : "o, a, os, as, um, uma, uns, umas",
|
||||
"fr" : "le, la, l'_, les, un, une, des",
|
||||
"it" : "il, lo, la, l'_, i, gli, le, un', uno, una, un",
|
||||
"hu" : "a, az, egy"
|
||||
};
|
||||
|
||||
// To add a custom parser, define:
|
||||
// $.tablesorter.ignoreArticles['xx'] = "A, B, C";
|
||||
// and then set the language id 'xx' in the headers option
|
||||
// ignoreArticles : 'xx'
|
||||
|
||||
ts.addParser({
|
||||
id: 'ignoreArticles',
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
var art, ignore, lang,
|
||||
c = table.config,
|
||||
str = s || '';
|
||||
if ( !(c.headers && c.headers[cellIndex] && c.headers[cellIndex].ignoreArticlesRegex) ) {
|
||||
// initialize - save regex in c.headers[cellIndex].ignoreArticlesRegex
|
||||
if (!c.headers) { c.headers = {}; }
|
||||
if (!c.headers[cellIndex]) { c.headers[cellIndex] = {}; }
|
||||
lang = ts.getData( c.$headers.eq(cellIndex), ts.getColumnData( table, c.headers, cellIndex ), 'ignoreArticles' );
|
||||
art = (ts.ignoreArticles[lang] || "the, a, an" ) + "";
|
||||
c.headers[cellIndex].ignoreArticlesRegex = new RegExp('^(' + $.trim( art.split(/\s*\,\s*/).join('\\s|') + "\\s" ).replace("_\\s","") + ')', 'i');
|
||||
// exception regex stored in c.headers[cellIndex].ignoreArticlesRegex2
|
||||
ignore = ts.getData( c.$headers.eq(cellIndex), ts.getColumnData( table, c.headers, cellIndex ), 'ignoreArticlesExcept' );
|
||||
c.headers[cellIndex].ignoreArticlesRegex2 = ignore !== '' ? new RegExp('^(' + ignore.replace(/\s/g, "\\s") + ')', 'i') : '';
|
||||
}
|
||||
art = c.headers[cellIndex].ignoreArticlesRegex;
|
||||
if (art.test(str)) {
|
||||
ignore = c.headers[cellIndex].ignoreArticlesRegex2;
|
||||
if ( !(ignore && ignore.test(str)) ) {
|
||||
return str.replace(art, '');
|
||||
}
|
||||
}
|
||||
return str;
|
||||
},
|
||||
type: 'text'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
20
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-image.js
Executable file
20
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-image.js
Executable file
@@ -0,0 +1,20 @@
|
||||
/*! image alt attribute parser for jQuery 1.7+ & tablesorter 2.7.11+
|
||||
* New 7/17/2014 (v2.17.5)
|
||||
*/
|
||||
/*jshint jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "image",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell) {
|
||||
return $(cell).find('img').attr(table.config.imgAttr || 'alt') || s;
|
||||
},
|
||||
parsed : true, // filter widget flag
|
||||
type: "text"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,161 @@
|
||||
/*! input & select parsers for jQuery 1.7+ & tablesorter 2.7.11+
|
||||
* Updated 9/15/2014 (v2.17.8)
|
||||
* Demo: http://mottie.github.com/tablesorter/docs/example-widget-grouping.html
|
||||
*/
|
||||
/*jshint browser: true, jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var resort = true, // resort table after update
|
||||
updateServer = function(event, $table, $input){
|
||||
// do something here to update your server, if needed
|
||||
// event = change event object
|
||||
// $table = jQuery object of the table that was just updated
|
||||
// $input = jQuery object of the input or select that was modified
|
||||
};
|
||||
|
||||
// Custom parser for parsing input values
|
||||
// updated dynamically using the "change" function below
|
||||
$.tablesorter.addParser({
|
||||
id: "inputs",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell) {
|
||||
return $(cell).find('input').val() || s;
|
||||
},
|
||||
parsed : true, // filter widget flag
|
||||
type: "text"
|
||||
});
|
||||
|
||||
// Custom parser for including checkbox status if using the grouping widget
|
||||
// updated dynamically using the "change" function below
|
||||
$.tablesorter.addParser({
|
||||
id: "checkbox",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
var $c = $(cell),
|
||||
$input = $c.find('input[type="checkbox"]'),
|
||||
isChecked = $input.length ? $input[0].checked : '';
|
||||
// adding class to row, indicating that a checkbox is checked; includes
|
||||
// a column index in case more than one checkbox happens to be in a row
|
||||
$c.closest('tr').toggleClass('checked-' + cellIndex, isChecked);
|
||||
// returning plain language here because this is what is shown in the
|
||||
// group headers - change it as desired
|
||||
return $input.length ? isChecked ? 'checked' : 'unchecked' : s;
|
||||
},
|
||||
parsed : true, // filter widget flag
|
||||
type: "text"
|
||||
});
|
||||
|
||||
// Custom parser which returns the currently selected options
|
||||
// updated dynamically using the "change" function below
|
||||
$.tablesorter.addParser({
|
||||
id: "select",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell) {
|
||||
return $(cell).find('select').val() || s;
|
||||
},
|
||||
parsed : true, // filter widget flag
|
||||
type: "text"
|
||||
});
|
||||
|
||||
// Select parser to get the selected text
|
||||
$.tablesorter.addParser({
|
||||
id: "select-text",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell) {
|
||||
var $s = $(cell).find('select');
|
||||
return $s.length ? $s.find('option:selected').text() || '' : s;
|
||||
},
|
||||
parsed : true, // filter widget flag
|
||||
type: "text"
|
||||
});
|
||||
|
||||
// Custom parser for parsing textarea values
|
||||
// updated dynamically using the "change" function below
|
||||
$.tablesorter.addParser({
|
||||
id: "textarea",
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell) {
|
||||
return $(cell).find('textarea').val() || s;
|
||||
},
|
||||
parsed : true, // filter widget flag
|
||||
type: "text"
|
||||
});
|
||||
|
||||
// update select and all input types in the tablesorter cache when the change event fires.
|
||||
// This method only works with jQuery 1.7+
|
||||
// you can change it to use delegate (v1.4.3+) or live (v1.3+) as desired
|
||||
// if this code interferes somehow, target the specific table $('#mytable'), instead of $('table')
|
||||
$(function(){
|
||||
$('table').on('tablesorter-initialized', function(){
|
||||
// this flag prevents the updateCell event from being spammed
|
||||
// it happens when you modify input text and hit enter
|
||||
var focused = false,
|
||||
restoreValue = function(isTbody){
|
||||
// focused = false; // uncomment this line to prevent auto-accepting changes
|
||||
// make sure we restore original values
|
||||
// isTbody is needed to prevent the select from closing in IE
|
||||
// see https://connect.microsoft.com/IE/feedbackdetail/view/962618/
|
||||
if (isTbody) {
|
||||
$(':focus').blur();
|
||||
}
|
||||
return;
|
||||
};
|
||||
// bind to .tablesorter (default class name)
|
||||
$(this).children('tbody')
|
||||
.on('mouseleave', function(e){
|
||||
restoreValue(e.target.tagName === 'TBODY');
|
||||
})
|
||||
.on('focus', 'select, input, textarea', function(){
|
||||
focused = true;
|
||||
$(this).data('ts-original-value', this.value);
|
||||
})
|
||||
.on('blur', 'input, textarea', function(){
|
||||
// restore input value;
|
||||
// "change" is triggered before "blur" so this doesn't replace the new update with the original
|
||||
this.value = $(this).data('ts-original-value');
|
||||
})
|
||||
.on('change keyup', 'select, input, textarea', function(e){
|
||||
if ( e.which === 27 ) {
|
||||
// escape: restore original value
|
||||
this.value = $(this).data('ts-original-value');
|
||||
return;
|
||||
}
|
||||
// Update cell cache using... select: change, input: enter or textarea: alt + enter
|
||||
if ( ( e.type === 'change' && focused ) ||
|
||||
( e.type === 'keyup' && e.which === 13 && ( e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' && e.altKey ) ) ) {
|
||||
var $tar = $(e.target),
|
||||
$cell = $tar.closest('td'),
|
||||
$table = $cell.closest('table'),
|
||||
indx = $cell[0].cellIndex,
|
||||
c = $table[0].config || false,
|
||||
$hdr = c && c.$headers && c.$headers.eq(indx);
|
||||
// abort if not a tablesorter table, or
|
||||
// don't use updateCell if column is set to "sorter-false" and "filter-false", or column is set to "parser-false"
|
||||
if ( !c || ( $hdr && $hdr.length && ( $hdr.hasClass('parser-false') || ( $hdr.hasClass('sorter-false') && $hdr.hasClass('filter-false') ) ) ) ) {
|
||||
return restoreValue();
|
||||
}
|
||||
// ignore change event if nothing changed
|
||||
if ($tar.val() !== $tar.data('ts-original-value')) {
|
||||
$tar.data('ts-original-value', $tar.val());
|
||||
$table.trigger('updateCell', [ $tar.closest('td'), resort, function(){
|
||||
updateServer(e, $table, $tar);
|
||||
setTimeout(function(){ focused = false; }, 10);
|
||||
} ]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
76
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-ipv6.js
Executable file
76
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-ipv6.js
Executable file
@@ -0,0 +1,76 @@
|
||||
/*! IPv6 Address parser (WIP)
|
||||
* IPv6 Address (ffff:0000:0000:0000:0000:0000:0000:0000)
|
||||
* needs to support short versions like "::8" or "1:2::7:8"
|
||||
* and "::00:192.168.10.184" (embedded IPv4 address)
|
||||
* see http://www.intermapper.com/support/tools/IPV6-Validator.aspx
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter;
|
||||
|
||||
$.extend( ts.regex, {}, {
|
||||
ipv4Validate : /((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})/,
|
||||
ipv4Extract : /([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/,
|
||||
|
||||
// simplified regex from http://www.intermapper.com/support/tools/IPV6-Validator.aspx
|
||||
// (specifically from http://download.dartware.com/thirdparty/ipv6validator.js)
|
||||
ipv6Validate : /^\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/i
|
||||
});
|
||||
|
||||
ts.addParser({
|
||||
id: "ipv6Address",
|
||||
is: function(s) {
|
||||
return ts.regex.ipv6Validate.test(s);
|
||||
},
|
||||
format: function(address, table) {
|
||||
// code modified from http://forrst.com/posts/JS_Expand_Abbreviated_IPv6_Addresses-1OR
|
||||
var i, t, sides, groups, groupsPresent,
|
||||
hex = table ? (typeof table === "boolean" ? table : table && table.config.ipv6HexFormat || false) : false,
|
||||
fullAddress = '',
|
||||
expandedAddress = '',
|
||||
validGroupCount = 8,
|
||||
validGroupSize = 4;
|
||||
// remove any extra spaces
|
||||
address = address.replace(/\s*/g, '');
|
||||
// look for embedded ipv4
|
||||
if (ts.regex.ipv4Validate.test(address)) {
|
||||
groups = address.match(ts.regex.ipv4Extract);
|
||||
t = '';
|
||||
for (i = 1; i < groups.length; i++){
|
||||
t += ('00' + (parseInt(groups[i], 10).toString(16)) ).slice(-2) + ( i === 2 ? ':' : '' );
|
||||
}
|
||||
address = address.replace( ts.regex.ipv4Extract, t );
|
||||
}
|
||||
|
||||
if (address.indexOf("::") == -1) {
|
||||
// All eight groups are present
|
||||
fullAddress = address;
|
||||
} else {
|
||||
// Consecutive groups of zeroes have been collapsed with "::".
|
||||
sides = address.split("::");
|
||||
groupsPresent = 0;
|
||||
for (i = 0; i < sides.length; i++) {
|
||||
groupsPresent += sides[i].split(":").length;
|
||||
}
|
||||
fullAddress += sides[0] + ":";
|
||||
for (i = 0; i < validGroupCount - groupsPresent; i++) {
|
||||
fullAddress += "0000:";
|
||||
}
|
||||
fullAddress += sides[1];
|
||||
}
|
||||
groups = fullAddress.split(":");
|
||||
for (i = 0; i < validGroupCount; i++) {
|
||||
// it's fastest & easiest for tablesorter to sort decimal values (vs hex)
|
||||
groups[i] = hex ? ('0000' + groups[i]).slice(-4) :
|
||||
('00000' + (parseInt(groups[i], 16) || 0)).slice(-5);
|
||||
expandedAddress += ( i != validGroupCount-1) ? groups[i] + ':' : groups[i];
|
||||
}
|
||||
return hex ? expandedAddress : expandedAddress.replace(/:/g, '');
|
||||
},
|
||||
// uses natural sort hex compare
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
77
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-metric.js
Executable file
77
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-metric.js
Executable file
@@ -0,0 +1,77 @@
|
||||
/*! Metric parser
|
||||
* Demo: http://jsfiddle.net/Mottie/abkNM/382/
|
||||
* Set the metric name in the header (defaults to "m|meter"), e.g.
|
||||
* <th data-metric-name="b|byte">HDD Size</th>
|
||||
* <th data-metric-name="m|meter">Distance</th>
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var prefixes = {
|
||||
// "prefix" : [ base 10, base 2 ]
|
||||
// skipping IEEE 1541 defined prefixes: kibibyte, mebibyte, etc, for now.
|
||||
"Y|Yotta|yotta" : [ 1e24, Math.pow(1024, 8) ], // 1024^8
|
||||
"Z|Zetta|zetta" : [ 1e21, Math.pow(1024, 7) ], // 1024^7
|
||||
"E|Exa|exa" : [ 1e18, Math.pow(1024, 6) ], // 1024^6
|
||||
"P|Peta|peta" : [ 1e15, Math.pow(1024, 5) ], // 1024^5
|
||||
"T|Tera|tera" : [ 1e12, Math.pow(1024, 4) ], // 1024^4
|
||||
"G|Giga|giga" : [ 1e9, Math.pow(1024, 3) ], // 1024^3
|
||||
"M|Mega|mega" : [ 1e6, Math.pow(1024, 2) ], // 1024^2
|
||||
"k|Kilo|kilo" : [ 1e3, 1024 ], // 1024
|
||||
// prefixes below here are rarely, if ever, used in binary
|
||||
"h|hecto" : [ 1e2, 1e2 ],
|
||||
"da|deka" : [ 1e1, 1e1 ],
|
||||
"d|deci" : [ 1e-1, 1e-1 ],
|
||||
"c|centi" : [ 1e-2, 1e-2],
|
||||
"m|milli" : [ 1e-3, 1e-3 ],
|
||||
"µ|micro" : [ 1e-6, 1e-6 ],
|
||||
"n|nano" : [ 1e-9, 1e-9 ],
|
||||
"p|pico" : [ 1e-12, 1e-12 ],
|
||||
"f|femto" : [ 1e-15, 1e-15 ],
|
||||
"a|atto" : [ 1e-18, 1e-18 ],
|
||||
"z|zepto" : [ 1e-21, 1e-21 ],
|
||||
"y|yocto" : [ 1e-24, 1e-24 ]
|
||||
},
|
||||
// the \\d+ will not catch digits with spaces, commas or decimals; so use the value from n instead
|
||||
RegLong = "(\\d+)(\\s+)?([Zz]etta|[Ee]xa|[Pp]eta|[Tt]era|[Gg]iga|[Mm]ega|kilo|hecto|deka|deci|centi|milli|micro|nano|pico|femto|atto|zepto|yocto)(",
|
||||
RegAbbr = "(\\d+)(\\s+)?(Z|E|P|T|G|M|k|h|da|d|c|m|µ|n|p|f|a|z|y)(";
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'metric',
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
var v = 'm|meter',
|
||||
b, t,
|
||||
// process number here to get a numerical format (us or eu)
|
||||
n = $.tablesorter.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table),
|
||||
$t = table.config.$headers.filter('[data-column="' + cellIndex + '"]'),
|
||||
m = $t.data('metric');
|
||||
if (!m) {
|
||||
// stored values
|
||||
t = ($t.attr('data-metric-name') || v).split('|');
|
||||
m = [ t[1] || t[0].substring(1), t[0] ];
|
||||
m[2] = new RegExp(RegLong + m[0] + "|" + m[1] + ")");
|
||||
m[3] = new RegExp(RegAbbr + m[1] + ")");
|
||||
$t.data('metric', m);
|
||||
}
|
||||
// find match to full name or abbreviation
|
||||
t = s.match(m[2]) || s.match(m[3]);
|
||||
if (t) {
|
||||
for (v in prefixes) {
|
||||
if (t[3].match(v)) {
|
||||
// exception when using binary prefix
|
||||
// change base for binary use
|
||||
b = /^[b|bit|byte|o|octet]/.test(t[4]) ? 1 : 0;
|
||||
return n * prefixes[v][b];
|
||||
}
|
||||
}
|
||||
}
|
||||
return n;
|
||||
},
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
117
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-roman.js
Executable file
117
modules/EcmReportsBackUp20151106/TableSorterNew/js/parsers/parser-roman.js
Executable file
@@ -0,0 +1,117 @@
|
||||
/*! Roman numeral parsers
|
||||
* code modified from both:
|
||||
* Steven Levithan @ http://blog.stevenlevithan.com/archives/javascript-roman-numeral-converter
|
||||
* Jonathan Snook comment @ http://blog.stevenlevithan.com/archives/javascript-roman-numeral-converter#comment-16140
|
||||
*/
|
||||
/*jshint jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
// allow lower case roman numerals, since lists use i, ii, iii, etc.
|
||||
var validator = /^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/i,
|
||||
matcher = /\b([MCDLXVI]+\b)/gi,
|
||||
lookup = { I:1, V:5, X:10, L:50, C:100, D:500, M:1000 };
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'roman',
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s) {
|
||||
var val,
|
||||
roman = s.toUpperCase().split(''),
|
||||
num = 0;
|
||||
|
||||
// roman numerals not found!
|
||||
if ( !(s && validator.test(s)) ) {
|
||||
return s;
|
||||
}
|
||||
|
||||
while (roman.length) {
|
||||
val = lookup[roman.shift()];
|
||||
num += val * (val < lookup[roman[0]] ? -1 : 1);
|
||||
}
|
||||
|
||||
return num;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'roman-ignore',
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s, table, cell, column) {
|
||||
var val, orig,
|
||||
c = table.config,
|
||||
ignore = $.isArray(c.roman_ignore) ? c.roman_ignore[column] : 0,
|
||||
// find roman numerals
|
||||
roman = ( isNaN(ignore) ?
|
||||
// ignore can be a regex or string
|
||||
$.trim( s.replace(ignore, '') ) :
|
||||
// or a number to ignore the last x letters...
|
||||
$.trim( s.substring(0, s.length - ignore) )
|
||||
).match(matcher),
|
||||
v = validator.test(roman),
|
||||
num = 0;
|
||||
|
||||
// roman numerals not found!
|
||||
if ( !(v) ) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// save roman numeral for replacement
|
||||
orig = roman[0];
|
||||
roman = orig.toUpperCase().split('');
|
||||
|
||||
while (roman.length) {
|
||||
val = lookup[roman.shift()];
|
||||
// ignore non-roman numerals
|
||||
if (val) {
|
||||
num += val * (val < lookup[roman[0]] ? -1 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
return num ? s.replace(orig, num) : s;
|
||||
},
|
||||
type: "text"
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'roman-extract',
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
format: function(s) {
|
||||
var val,
|
||||
// find roman numerals
|
||||
roman = $.grep(s.split(/\b/), function(v, i){
|
||||
return validator.test(v) ? v : '';
|
||||
}).join('').match(matcher),
|
||||
|
||||
v = roman ? validator.test(roman) : 0,
|
||||
num = 0;
|
||||
|
||||
// roman numerals not found!
|
||||
if ( !(v) ) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// save roman numeral for replacement
|
||||
roman = roman[0].toUpperCase().split('');
|
||||
|
||||
while (roman.length) {
|
||||
val = lookup[roman.shift()];
|
||||
// ignore non-roman numerals
|
||||
if (val) {
|
||||
num += val * (val < lookup[roman[0]] ? -1 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
return num ? num : s;
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
145
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-alignChar.js
Executable file
145
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-alignChar.js
Executable file
@@ -0,0 +1,145 @@
|
||||
/*! tablesorter Align Character widget - updated 3/12/2014 (core v2.15.8)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* by Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.alignChar = {
|
||||
|
||||
init : function(table, c, wo) {
|
||||
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
||||
var $this = $(this),
|
||||
vars = {
|
||||
column : this.column,
|
||||
align : $this.attr(wo.alignChar_charAttrib),
|
||||
alignIndex : parseInt( $this.attr(wo.alignChar_indexAttrib) || 0, 10),
|
||||
adjust : parseFloat($this.attr(wo.alignChar_adjustAttrib)) || 0,
|
||||
};
|
||||
vars.regex = new RegExp('\\' + vars.align, 'g');
|
||||
if (typeof vars.align !== 'undefined') {
|
||||
wo.alignChar_savedVars[this.column] = vars;
|
||||
ts.alignChar.setup(table, c, wo, vars);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setup: function(table, c, wo, v){
|
||||
// do nothing for empty tables
|
||||
if ($.isEmptyObject(c.cache)) { return; }
|
||||
var tbodyIndex, rowIndex, start, end, last, index, rows, val, count,
|
||||
len, wLeft, wRight, alignChar, $row,
|
||||
left = [],
|
||||
right = [];
|
||||
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
|
||||
rows = c.cache[tbodyIndex];
|
||||
len = rows.normalized.length;
|
||||
for (rowIndex = 0; rowIndex < len; rowIndex++) {
|
||||
// set up to work with modified cache v2.16.0+
|
||||
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
|
||||
val = $row.find('td').eq(v.column).text().replace(/[ ]/g, "\u00a0");
|
||||
// count how many "align" characters are in the string
|
||||
count = (val.match( v.regex ) || []).length;
|
||||
// set alignment @ alignIndex (one-based index)
|
||||
if (count > 0 && v.alignIndex > 0) {
|
||||
end = Math.min(v.alignIndex, count);
|
||||
start = 0;
|
||||
index = 0;
|
||||
last = 0;
|
||||
// find index of nth align character based on alignIndex (data-align-index)
|
||||
while (start++ < end) {
|
||||
last = val.indexOf(v.align, last + 1);
|
||||
index = last < 0 ? index : last;
|
||||
}
|
||||
} else {
|
||||
index = val.indexOf(v.align);
|
||||
}
|
||||
if ( index >= 0 ) {
|
||||
left.push( val.substring(0, index) || '' );
|
||||
right.push( val.substring(index, val.length) || '' );
|
||||
} else {
|
||||
// no align character found!
|
||||
// put val in right or left based on the align index
|
||||
left.push( (count >= 1 && v.alignIndex >= count) ? '' : val || '' );
|
||||
right.push( (count >= 1 && v.alignIndex >= count) ? val || '' : '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find widest segments
|
||||
wLeft = ($.extend([], left)).sort(function(a,b){ return b.length - a.length; })[0];
|
||||
wRight = ($.extend([], right)).sort(function(a,b){ return b.length - a.length; })[0];
|
||||
// calculate percentage widths
|
||||
v.width = v.width || ( Math.floor(wLeft.length / (wLeft.length + wRight.length) * 100) + v.adjust );
|
||||
wLeft = 'min-width:' + v.width + '%';
|
||||
wRight = 'min-width:' + (100 - v.width) + '%';
|
||||
|
||||
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
|
||||
rows = c.cache[tbodyIndex];
|
||||
len = rows.normalized.length;
|
||||
for (rowIndex = 0; rowIndex < len; rowIndex++) {
|
||||
alignChar = $(wo.alignChar_wrap).length ? $(wo.alignChar_wrap).html(v.align)[0].outerHTML : v.align;
|
||||
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
|
||||
$row.find('td').eq(v.column).html(
|
||||
'<span class="ts-align-wrap"><span class="ts-align-left" style="' + wLeft + '">' + left[rowIndex] + '</span>' +
|
||||
'<span class="ts-align-right" style="' + wRight + '">' + alignChar +
|
||||
right[rowIndex].slice(v.align.length) + '</span></span>'
|
||||
);
|
||||
}
|
||||
}
|
||||
wo.alignChar_initialized = true;
|
||||
|
||||
},
|
||||
remove: function(table, c, column){
|
||||
if ($.isEmptyObject(c.cache)) { return; }
|
||||
var tbodyIndex, rowIndex, len, rows, $row, $cell;
|
||||
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
|
||||
rows = c.cache[tbodyIndex];
|
||||
len = rows.normalized.length;
|
||||
for (rowIndex = 0; rowIndex < len; rowIndex++) {
|
||||
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
|
||||
$cell = $row.find('td').eq(column);
|
||||
$cell.html( $cell.text().replace(/\s/g, ' ') );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: 'alignChar',
|
||||
priority: 100,
|
||||
options: {
|
||||
alignChar_wrap : '',
|
||||
alignChar_charAttrib : 'data-align-char',
|
||||
alignChar_indexAttrib : 'data-align-index',
|
||||
alignChar_adjustAttrib : 'data-align-adjust' // percentage width adjustments
|
||||
},
|
||||
init: function(table, thisWidget, c, wo){
|
||||
wo.alignChar_initialized = false;
|
||||
wo.alignChar_savedVars = [];
|
||||
ts.alignChar.init(table, c, wo);
|
||||
c.$table.on('pagerEnd refreshAlign', function(){
|
||||
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
||||
ts.alignChar.remove(table, c, this.column);
|
||||
});
|
||||
ts.alignChar.init(table, c, wo);
|
||||
});
|
||||
},
|
||||
format : function(table, c, wo){
|
||||
// reinitialize in case table is empty when first initialized
|
||||
if (!wo.alignChar_initialized) {
|
||||
c.$table.trigger('refreshAlign');
|
||||
}
|
||||
},
|
||||
remove : function(table, c, wo){
|
||||
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
||||
ts.alignChar.remove(table, c, this.column);
|
||||
});
|
||||
wo.alignChar_initialized = false;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
453
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-build-table.js
Executable file
453
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-build-table.js
Executable file
@@ -0,0 +1,453 @@
|
||||
/*! Build Table widget for tableSorter v2.16.0 (4/23/2014)
|
||||
* by Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter = $.tablesorter || {},
|
||||
|
||||
// build a table from data (requires existing <table> tag)
|
||||
// data.header contains an array of header titles
|
||||
// data.rows contains an array of rows which contains an array of cells
|
||||
bt = ts.buildTable = function(tar, c){
|
||||
// add table if one doesn't exist
|
||||
var $tbl = tar.tagName === 'TABLE' ? $(tar) : $('<table>').appendTo(tar),
|
||||
table = $tbl[0],
|
||||
wo = c.widgetOptions = $.extend( true, {}, bt.defaults, c.widgetOptions ),
|
||||
p = wo.build_processing,
|
||||
typ = wo.build_type,
|
||||
d = wo.build_source || c.data,
|
||||
|
||||
// determine type: html, json, array, csv, object
|
||||
runType = function(d){
|
||||
var t = $.type(d),
|
||||
jq = d instanceof jQuery;
|
||||
// run any processing if set
|
||||
if ( typeof p === 'function' ) { d = p(d, wo); }
|
||||
// store processed data in table.config.data
|
||||
c.data = d;
|
||||
// String (html or unprocessed json) or jQuery object
|
||||
if ( jq || t === 'string' ) {
|
||||
// look for </tr> closing tag, then we have an HTML string
|
||||
if ( jq || /<\s*\/tr\s*>/.test(d) ) {
|
||||
return bt.html( table, d, wo );
|
||||
}
|
||||
try {
|
||||
d = $.parseJSON(d);
|
||||
if (d) {
|
||||
// valid JSON!
|
||||
return bt.object( table, d, wo );
|
||||
}
|
||||
} catch(ignore) {}
|
||||
// fall through in case it's a csv string
|
||||
}
|
||||
// Array
|
||||
if (t === 'array' || t === 'string' || typ === 'array' || typ === 'csv') {
|
||||
// build table using an array (csv & array combined script)
|
||||
return bt.csv( table, d, wo );
|
||||
}
|
||||
// if we got here, it's an object, or nothing
|
||||
return bt.object( table, d, wo );
|
||||
};
|
||||
|
||||
// store config
|
||||
table.config = c;
|
||||
|
||||
// even if wo.build_type is undefined, we can try to figure out the type
|
||||
if ( !ts.buildTable.hasOwnProperty(typ) && typ !== '' ) {
|
||||
if (c.debug) { ts.log('aborting build table widget, incorrect build type'); }
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( d instanceof jQuery ) {
|
||||
// get data from within a jQuery object (csv)
|
||||
runType( $.trim( d.html() ) );
|
||||
} else if ( d && ( d.hasOwnProperty('url') || typ === 'json' ) ) {
|
||||
// load data via ajax
|
||||
$.ajax( wo.build_source )
|
||||
.done(function(data) {
|
||||
runType(data);
|
||||
})
|
||||
.fail(function( jqXHR, textStatus, errorThrown) {
|
||||
if (c.debug) { ts.log('aborting build table widget, failed ajax load'); }
|
||||
$tbl.html('<tr><td class="error">' + jqXHR.status + ' ' + textStatus + '</td></tr>');
|
||||
});
|
||||
} else {
|
||||
runType(d);
|
||||
}
|
||||
};
|
||||
|
||||
bt.defaults = {
|
||||
// *** build widget core ***
|
||||
build_type : '', // array, csv, object, json, html
|
||||
build_source : '', // array, object, jQuery Object or ajaxObject { url: '', dataType: 'json' },
|
||||
build_processing : null, // function that returns a useable build_type (e.g. string to array)
|
||||
build_complete : 'tablesorter-build-complete', // triggered event when build completes
|
||||
|
||||
// *** CSV & Array ***
|
||||
build_headers : {
|
||||
rows : 1, // Number of header rows from the csv
|
||||
classes : [], // Header classes to apply to cells
|
||||
text : [], // Header cell text
|
||||
widths : [] // set header cell widths (set in colgroup)
|
||||
},
|
||||
build_footers : {
|
||||
rows : 1, // Number of header rows from the csv
|
||||
classes : [], // Footer classes to apply to cells
|
||||
text : [] // Footer cell text
|
||||
},
|
||||
build_numbers : {
|
||||
addColumn : false, // include row numbering column?
|
||||
sortable : false // make column sortable?
|
||||
},
|
||||
|
||||
// *** CSV only options ***
|
||||
build_csvStartLine : 0, // line within the csv to start adding to table
|
||||
build_csvSeparator : ",", // csv separator
|
||||
|
||||
// *** build object options ***
|
||||
build_objectRowKey : 'rows', // object key containing table rows
|
||||
build_objectCellKey : 'cells', // object key containing table cells (within the rows object)
|
||||
build_objectHeaderKey : 'headers', // object key containing table headers
|
||||
build_objectFooterKey : 'footers' // object key containing table footers
|
||||
};
|
||||
|
||||
bt.build = {
|
||||
colgroup : function(widths) {
|
||||
var t = '';
|
||||
// add colgroup if widths set
|
||||
if (widths && widths.length) {
|
||||
t += '<colgroup>';
|
||||
$.each(widths, function(i, w){
|
||||
t += '<col' + ( w ? ' style="width:' + w + '"' : '' ) + '>';
|
||||
});
|
||||
t += '</colgroup>';
|
||||
}
|
||||
return t;
|
||||
},
|
||||
// d = cell data; typ = 'th' or 'td'; first = save widths from first header row only
|
||||
cell : function(d, wo, typ, col, first){
|
||||
var j, $td,
|
||||
$col = first ? $('<col>') : '',
|
||||
cls = wo.build_headers.classes,
|
||||
cw = wo.build_headers.widths;
|
||||
// d is just an array
|
||||
if (/string|number/.test(typeof d)) {
|
||||
// add classes from options, but not text
|
||||
$td = $('<' + typ + (cls && cls[col] ? ' class="' + cls[col] + '"' : '') + '>' + d + '</' + typ + '>');
|
||||
// get widths from options (only from first row)
|
||||
if (first && cw && cw[col]) {
|
||||
$col.width(cw[col] || '');
|
||||
}
|
||||
} else {
|
||||
// assume we have an object
|
||||
$td = $('<' + typ + '>');
|
||||
for (j in d) {
|
||||
if (d.hasOwnProperty(j)){
|
||||
if (j === 'text' || j === 'html') {
|
||||
$td[j]( d[j] );
|
||||
} else if (first && j === 'width') {
|
||||
// set column width, but only from first row
|
||||
$col.width(d[j] || '');
|
||||
} else {
|
||||
$td.attr(j, d[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return [ $td, $col ];
|
||||
},
|
||||
// h1 = header text from data
|
||||
header : function(h1, wo){
|
||||
var h2 = wo.build_headers.text,
|
||||
cls = wo.build_headers.classes,
|
||||
t = '<tr>' + (wo.build_numbers.addColumn ? '<th' + (wo.build_numbers.sortable ? '' :
|
||||
' class="sorter-false"') + '>' + wo.build_numbers.addColumn + '</th>' : '');
|
||||
$.each(h1, function(i, h) {
|
||||
if (/<\s*\/t(d|h)\s*>/.test(h)) {
|
||||
t += h;
|
||||
} else {
|
||||
t += '<th' + (cls && cls[i] ? ' class="' + cls[i] + '"' : '') + '>' +
|
||||
(h2 && h2[i] ? h2[i] : h) + '</th>';
|
||||
}
|
||||
});
|
||||
return t + '</tr>';
|
||||
},
|
||||
rows : function(items, txt, c, wo, num, ftr){
|
||||
var h = (ftr ? 'th' : 'td'),
|
||||
t = '<tr>' + (wo.build_numbers.addColumn ? '<' + h + '>' + (ftr ? '' : num) + '</' + h + '>' : '');
|
||||
$.each(items, function(i, item) {
|
||||
// test if HTML is already included; look for closing </td>
|
||||
if (/<\s*\/t(d|h)\s*>/.test(item)) {
|
||||
t += item;
|
||||
} else {
|
||||
t += '<' + (ftr ? h + (c && c[i] ? ' class="' + c[i] + '"' : '') : h) + '>' +
|
||||
(ftr && txt && txt.length && txt[i] ? txt[i] : item) + '</' + h + '>';
|
||||
}
|
||||
});
|
||||
return t + '</tr>';
|
||||
}
|
||||
};
|
||||
|
||||
bt.buildComplete = function(table, wo){
|
||||
$(table).trigger(wo.build_complete);
|
||||
ts.setup(table, table.config);
|
||||
};
|
||||
|
||||
/* ==== Array example ====
|
||||
[
|
||||
[ "header1", "header2", ... "headerN" ],
|
||||
[ "row1cell1", "row1cell2", ... "row1cellN" ],
|
||||
[ "row2cell1", "row2cell2", ... "row2cellN" ],
|
||||
...
|
||||
[ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
|
||||
]
|
||||
*/
|
||||
bt.array = function(table, data, wo) {
|
||||
return bt.csv(table, data, wo);
|
||||
};
|
||||
|
||||
/* ==== CSV example ====
|
||||
ID, Name, Age, Date
|
||||
A42b, Parker, 28, "Jul 6, 2006 8:14 AM"
|
||||
A255, Hood, 33, "Dec 10, 2002 5:14 AM"
|
||||
A33, Kent, 18, "Jan 12, 2003 11:14 AM"
|
||||
A1, Franklin, 45, "Jan 18, 2001 9:12 AM"
|
||||
A102, Evans, 22, "Jan 18, 2007 9:12 AM"
|
||||
A42a, Everet, 22, "Jan 18, 2007 9:12 AM"
|
||||
ID, Name, Age, Date
|
||||
*/
|
||||
// Adapted & modified from csvToTable.js by Steve Sobel
|
||||
// MIT license: https://code.google.com/p/jquerycsvtotable/
|
||||
bt.csv = function(table, data, wo) {
|
||||
var c, h,
|
||||
csv = wo.build_type === 'csv' || typeof data === 'string',
|
||||
$t = $(table),
|
||||
lines = csv ? data.replace('\r','').split('\n') : data,
|
||||
len = lines.length,
|
||||
printedLines = 0,
|
||||
infooter = false,
|
||||
r = wo.build_headers.rows + (csv ? wo.build_csvStartLine : 0),
|
||||
f = wo.build_footers.rows,
|
||||
headerCount = 0,
|
||||
error = '',
|
||||
items,
|
||||
tableHTML = bt.build.colgroup( wo.build_headers.widths ) + '<thead>';
|
||||
|
||||
$.each(lines, function(n, line) {
|
||||
if ( n >= len - f ) { infooter = true; }
|
||||
// build header
|
||||
if ( (csv ? n >= wo.build_csvStartLine : true) && ( n < r ) ) {
|
||||
h = csv ? bt.splitCSV( line, wo.build_csvSeparator ) : line;
|
||||
headerCount = h.length;
|
||||
tableHTML += bt.build.header(h, wo);
|
||||
} else if ( n >= r ) {
|
||||
// build tbody & tfoot rows
|
||||
if (n === r) {
|
||||
tableHTML += '</thead><tbody>';
|
||||
}
|
||||
items = csv ? bt.splitCSV( line, wo.build_csvSeparator ) : line;
|
||||
if (infooter && f > 0) {
|
||||
tableHTML += (n === len - f ? '</tbody><tfoot>' : '') +
|
||||
(n === len ? '</tfoot>' : '');
|
||||
}
|
||||
if (items.length > 1) {
|
||||
printedLines++;
|
||||
if ( items.length !== headerCount ) {
|
||||
error += 'error on line ' + n + ': Item count (' + items.length +
|
||||
') does not match header count (' + headerCount + ') \n';
|
||||
}
|
||||
c = infooter ? wo.build_footers.classes : '';
|
||||
tableHTML += bt.build.rows(items, wo.build_footers.text, c, wo, printedLines, infooter);
|
||||
}
|
||||
}
|
||||
});
|
||||
tableHTML += (f > 0 ? '' : '</tbody>');
|
||||
if (error) {
|
||||
$t.html(error);
|
||||
} else {
|
||||
$t.html(tableHTML);
|
||||
bt.buildComplete(table, wo);
|
||||
}
|
||||
};
|
||||
|
||||
// CSV Parser by Brian Huisman (http://www.greywyvern.com/?post=258)
|
||||
bt.splitCSV = function(str, sep) {
|
||||
var x, tl,
|
||||
thisCSV = $.trim(str).split(sep = sep || ",");
|
||||
for ( x = thisCSV.length - 1; x >= 0; x-- ) {
|
||||
if ( thisCSV[x].replace(/\"\s+$/, '"').charAt(thisCSV[x].length - 1) === '"' ) {
|
||||
if ( (tl = thisCSV[x].replace(/^\s+\"/, '"')).length > 1 && tl.charAt(0) === '"' ) {
|
||||
thisCSV[x] = thisCSV[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"');
|
||||
} else if (x) {
|
||||
thisCSV.splice(x - 1, 2, [thisCSV[x - 1], thisCSV[x]].join(sep));
|
||||
} else {
|
||||
thisCSV = thisCSV.shift().split(sep).concat(thisCSV);
|
||||
}
|
||||
} else {
|
||||
thisCSV[x].replace(/""/g, '"');
|
||||
}
|
||||
}
|
||||
return thisCSV;
|
||||
};
|
||||
|
||||
// data may be a jQuery object after processing
|
||||
bt.html = function(table, data, wo) {
|
||||
var $t = $(table);
|
||||
if ( data instanceof jQuery ) {
|
||||
$t.empty().append(data);
|
||||
} else {
|
||||
$t.html(data);
|
||||
}
|
||||
bt.buildComplete(table, wo);
|
||||
};
|
||||
|
||||
/* ==== Object example ====
|
||||
data : {
|
||||
headers : [
|
||||
[
|
||||
{ text: 'First Name', class: 'fname', width: '20%' }, // row 1 cell 1
|
||||
'Last Name',
|
||||
{ text: 'Age', class: 'age', 'data-sorter' : false },
|
||||
'Total',
|
||||
{ text: 'Discount', class : 'sorter-false' },
|
||||
{ text: 'Date', class : 'date' } // row 1 cell 6
|
||||
]
|
||||
],
|
||||
footers : 'clone', // clone headers or assign array like headers
|
||||
rows : [
|
||||
// TBODY 1
|
||||
[ 'Peter', 'Parker', 28, '$9.99', '20%', 'Jul 6, 2006 8:14 AM' ], // row 1
|
||||
[ 'John', 'Hood', 33, '$19.99', '25%', 'Dec 10, 2002 5:14 AM' ], // row 2
|
||||
[ 'Clark', 'Kent', 18, '$15.89', '44%', 'Jan 12, 2003 11:14 AM' ], // row 3
|
||||
|
||||
// TBODY 2
|
||||
{ newTbody: true, class: 'tablesorter-infoOnly' },
|
||||
{ cells : [ { text: 'Info Row', colSpan: 6 } ] }, // row 4
|
||||
|
||||
// TBODY 3
|
||||
{ newTbody: true },
|
||||
[ 'Bruce', 'Evans', 22, '$13.19', '11%', 'Jan 18, 2007 9:12 AM' ], // row 5
|
||||
[ 'Brice', 'Almighty', 45, '$153.19', '44%', 'Jan 18, 2001 9:12 AM' ], // row 6
|
||||
|
||||
{ class: 'specialRow', // row 7
|
||||
cells: [
|
||||
{ text: 'Fred', class: 'fname' },
|
||||
{ text: 'Smith', class: 'lname' },
|
||||
{ text: 18, class: 'age', 'data-info': 'fake ID!, he is really 16' },
|
||||
{ text: '$22.44', class: 'total' },
|
||||
{ text: '8%', class: 'discount' },
|
||||
{ text: 'Aug 20, 2012 10:15 AM', class: 'date' }
|
||||
],
|
||||
'data-info' : 'This row likes turtles'
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
bt.object = function(table, data, wo) {
|
||||
// "rows"
|
||||
var j, l, t, $c, $t, $tb, $tr,
|
||||
c = table.config,
|
||||
kh = wo.build_objectHeaderKey,
|
||||
kr = wo.build_objectRowKey,
|
||||
h = data.hasOwnProperty(kh) && !$.isEmptyObject(data.kh) ? data.kh : data.hasOwnProperty('headers') ? data.headers : false,
|
||||
r = data.hasOwnProperty(kr) && !$.isEmptyObject(data.kr) ? data.kr : data.hasOwnProperty('rows') ? data.rows : false;
|
||||
|
||||
if (!h || !r || h.length === 0 || r.length === 0) {
|
||||
if (c.debug) { ts.log('aborting build table widget, missing data for object build'); }
|
||||
return false;
|
||||
}
|
||||
|
||||
$c = $('<colgroup>');
|
||||
$t = $('<table><thead/></table>');
|
||||
|
||||
// Build thead
|
||||
// h = [ ['headerRow1Cell1', 'headerRow1Cell2', ... 'headerRow1CellN' ], ['headerRow2Cell1', ... ] ]
|
||||
// or h = [ [ { text: 'firstCell', class: 'fc', width: '20%' }, ..., { text: 'last Cell' } ], [ /* second row */ ] ]
|
||||
$.each(h, function(i, d){
|
||||
$tr = $('<tr>').appendTo( $t.find('thead') );
|
||||
l = d.length; // header row
|
||||
for ( j = 0; j < l; j++ ) {
|
||||
// cell(cellData, widgetOptions, 'th', first row)
|
||||
t = bt.build.cell(d[j], wo, 'th', j, i === 0);
|
||||
if (t[0] && t[0].length) { t[0].appendTo( $tr ); } // add cell
|
||||
if (i === 0 && t[1]) { t[1].appendTo( $c ); } // add col to colgroup
|
||||
}
|
||||
});
|
||||
if ($c.find('col[style]').length) {
|
||||
// add colgroup if it contains col elements
|
||||
$t.prepend( $c );
|
||||
}
|
||||
|
||||
$tb = $('<tbody>');
|
||||
// Build tbody
|
||||
$.each(r, function(i, d){
|
||||
var j;
|
||||
t = $.type(d) === 'object';
|
||||
// add new tbody
|
||||
if (t && d.newTbody) {
|
||||
$tb = $('<tbody>').appendTo( $t );
|
||||
for (j in d) {
|
||||
if (d.hasOwnProperty(j) && j !== 'newTbody'){
|
||||
$tb.attr(j, d[j]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i === 0) {
|
||||
// add tbody, if the first item in the object isn't a call for a new tbody
|
||||
$tb.appendTo( $t );
|
||||
}
|
||||
|
||||
$tr = $('<tr>').appendTo( $tb );
|
||||
if (t) {
|
||||
// row defined by object
|
||||
for (j in d) {
|
||||
if (d.hasOwnProperty(j) && j !== wo.build_objectCellKey){
|
||||
$tr.attr(j, d[j]);
|
||||
}
|
||||
}
|
||||
if (d.hasOwnProperty(wo.build_objectCellKey)) {
|
||||
// cells contains each cell info
|
||||
d = d.cells;
|
||||
}
|
||||
}
|
||||
|
||||
l = d.length;
|
||||
for ( j = 0; j < l; j++ ) {
|
||||
// cell(cellData, widgetOptions, 'td')
|
||||
$c = bt.build.cell(d[j], wo, 'td', j);
|
||||
if ($c[0] && $c[0].length) { $c[0].appendTo( $tr ); } // add cell
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// add footer
|
||||
if (data.hasOwnProperty(wo.build_objectFooterKey)) {
|
||||
t = data[wo.build_objectFooterKey];
|
||||
if (t === 'clone') {
|
||||
$c = $t.find('thead').html();
|
||||
$t.append('<tfoot>' + $c + '</tfoot>');
|
||||
} else {
|
||||
$c = $('<tfoot>').appendTo( $t );
|
||||
$.each(t, function(i, d) {
|
||||
$tr = $('<tr>').appendTo( $c );
|
||||
l = d.length; // footer cells
|
||||
for ( j = 0; j < l; j++ ) {
|
||||
// cell(cellData, widgetOptions, 'th')
|
||||
$tb = bt.build.cell(d[j], wo, 'th', j);
|
||||
if ($tb[0] && $tb[0].length) { $tb[0].appendTo( $tr ); } // add cell
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(table).html( $t.html() );
|
||||
bt.buildComplete(table, wo);
|
||||
};
|
||||
|
||||
bt.ajax = bt.json = function(table, data, wo) {
|
||||
return bt.object(table, data, wo);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,317 @@
|
||||
/* Column Selector/Responsive table widget (beta) for TableSorter 5/22/2014 (v2.17.0)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* by Justin Hallett & Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter,
|
||||
namespace = '.tscolsel',
|
||||
tsColSel = ts.columnSelector = {
|
||||
|
||||
queryAll : '@media only all { [columns] { display: none; } }',
|
||||
queryBreak : '@media all and (min-width: [size]) { [columns] { display: table-cell; } }',
|
||||
|
||||
init: function(table, c, wo) {
|
||||
var $t, colSel;
|
||||
|
||||
// abort if no input is contained within the layout
|
||||
$t = $(wo.columnSelector_layout);
|
||||
if (!$t.find('input').add( $t.filter('input') ).length) {
|
||||
if (c.debug) {
|
||||
ts.log('*** ERROR: Column Selector aborting, no input found in the layout! ***');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// unique table class name
|
||||
c.tableId = 'tablesorter' + new Date().getTime();
|
||||
c.$table.addClass( c.tableId );
|
||||
|
||||
// build column selector/state array
|
||||
colSel = c.selector = { $container : $(wo.columnSelector_container || '<div>') };
|
||||
colSel.$style = $('<style></style>').prop('disabled', true).appendTo('head');
|
||||
colSel.$breakpoints = $('<style></style>').prop('disabled', true).appendTo('head');
|
||||
|
||||
colSel.isInitializing = true;
|
||||
tsColSel.setupSelector(table, c, wo);
|
||||
|
||||
if (wo.columnSelector_mediaquery) {
|
||||
tsColSel.setupBreakpoints(c, wo);
|
||||
}
|
||||
|
||||
colSel.isInitializing = false;
|
||||
if (colSel.$container.length) {
|
||||
tsColSel.updateCols(c, wo);
|
||||
}
|
||||
|
||||
c.$table
|
||||
.off('refreshColumnSelector' + namespace)
|
||||
.on('refreshColumnSelector' + namespace, function(){
|
||||
// make sure we're using current config settings
|
||||
var c = this.config;
|
||||
tsColSel.updateBreakpoints(c, c.widgetOptions);
|
||||
tsColSel.updateCols(c, c.widgetOptions);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setupSelector: function(table, c, wo) {
|
||||
var name,
|
||||
colSel = c.selector,
|
||||
$container = colSel.$container,
|
||||
useStorage = wo.columnSelector_saveColumns && ts.storage,
|
||||
// get stored column states
|
||||
saved = useStorage ? ts.storage( table, 'tablesorter-columnSelector' ) : [],
|
||||
state = useStorage ? ts.storage( table, 'tablesorter-columnSelector-auto') : {};
|
||||
|
||||
// initial states
|
||||
colSel.auto = $.isEmptyObject(state) || $.type(state.auto) !== "boolean" ? wo.columnSelector_mediaqueryState : state.auto;
|
||||
colSel.states = [];
|
||||
colSel.$column = [];
|
||||
colSel.$wrapper = [];
|
||||
colSel.$checkbox = [];
|
||||
// populate the selector container
|
||||
c.$table.children('thead').find('tr:first th', table).each(function() {
|
||||
var $this = $(this),
|
||||
// if no data-priority is assigned, default to 1, but don't remove it from the selector list
|
||||
priority = $this.attr(wo.columnSelector_priority) || 1,
|
||||
colId = $this.attr('data-column'),
|
||||
state = ts.getData(this, c.headers[colId], 'columnSelector');
|
||||
|
||||
|
||||
// if this column not hidable at all
|
||||
// include getData check (includes "columnSelector-false" class, data attribute, etc)
|
||||
if ( isNaN(priority) && priority.length > 0 || state === 'disable' ||
|
||||
( wo.columnSelector_columns[colId] && wo.columnSelector_columns[colId] === 'disable') ) {
|
||||
return true; // goto next
|
||||
}
|
||||
|
||||
// set default state; storage takes priority
|
||||
colSel.states[colId] = saved && typeof(saved[colId]) !== 'undefined' ?
|
||||
saved[colId] : typeof(wo.columnSelector_columns[colId]) !== 'undefined' ?
|
||||
wo.columnSelector_columns[colId] : (state === 'true' || !(state === 'false'));
|
||||
colSel.$column[colId] = $(this);
|
||||
|
||||
// set default col title
|
||||
name = $this.attr(wo.columnSelector_name) || $this.text();
|
||||
|
||||
if ($container.length) {
|
||||
colSel.$wrapper[colId] = $(wo.columnSelector_layout.replace(/\{name\}/g, name)).appendTo($container);
|
||||
colSel.$checkbox[colId] = colSel.$wrapper[colId]
|
||||
// input may not be wrapped within the layout template
|
||||
.find('input').add( colSel.$wrapper[colId].filter('input') )
|
||||
.attr('data-column', colId)
|
||||
.prop('checked', colSel.states[colId])
|
||||
.on('change', function(){
|
||||
colSel.states[colId] = this.checked;
|
||||
tsColSel.updateCols(c, wo);
|
||||
}).change();
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
setupBreakpoints: function(c, wo){
|
||||
var colSel = c.selector;
|
||||
|
||||
// add responsive breakpoints
|
||||
if (wo.columnSelector_mediaquery) {
|
||||
// used by window resize function
|
||||
colSel.lastIndex = -1;
|
||||
wo.columnSelector_breakpoints.sort();
|
||||
tsColSel.updateBreakpoints(c, wo);
|
||||
c.$table
|
||||
.off('updateAll' + namespace)
|
||||
.on('updateAll' + namespace, function(){
|
||||
tsColSel.updateBreakpoints(c, wo);
|
||||
tsColSel.updateCols(c, wo);
|
||||
});
|
||||
}
|
||||
|
||||
if (colSel.$container.length) {
|
||||
// Add media queries toggle
|
||||
if (wo.columnSelector_mediaquery) {
|
||||
colSel.$auto = $( wo.columnSelector_layout.replace(/\{name\}/g, wo.columnSelector_mediaqueryName) ).prependTo(colSel.$container);
|
||||
colSel.$auto
|
||||
// needed in case the input in the layout is not wrapped
|
||||
.find('input').add( colSel.$auto.filter('input') )
|
||||
.attr('data-column', 'auto')
|
||||
.prop('checked', colSel.auto)
|
||||
.on('change', function(){
|
||||
colSel.auto = this.checked;
|
||||
$.each( colSel.$checkbox, function(i, $cb){
|
||||
if ($cb) {
|
||||
$cb[0].disabled = colSel.auto;
|
||||
colSel.$wrapper[i].toggleClass('disabled', colSel.auto);
|
||||
}
|
||||
});
|
||||
if (wo.columnSelector_mediaquery) {
|
||||
tsColSel.updateBreakpoints(c, wo);
|
||||
}
|
||||
tsColSel.updateCols(c, wo);
|
||||
// copy the column selector to a popup/tooltip
|
||||
if (c.selector.$popup) {
|
||||
c.selector.$popup.find('.tablesorter-column-selector')
|
||||
.html( colSel.$container.html() )
|
||||
.find('input').each(function(){
|
||||
var indx = $(this).attr('data-column');
|
||||
$(this).prop( 'checked', indx === 'auto' ? colSel.auto : colSel.states[indx] );
|
||||
});
|
||||
}
|
||||
if (wo.columnSelector_saveColumns && ts.storage) {
|
||||
ts.storage( c.$table[0], 'tablesorter-columnSelector-auto', { auto : colSel.auto } );
|
||||
}
|
||||
}).change();
|
||||
}
|
||||
// Add a bind on update to re-run col setup
|
||||
c.$table.off('update' + namespace).on('update' + namespace, function() {
|
||||
tsColSel.updateCols(c, wo);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
updateBreakpoints: function(c, wo) {
|
||||
var priority, column, breaks,
|
||||
colSel = c.selector,
|
||||
prefix = '.' + c.tableId,
|
||||
mediaAll = [],
|
||||
breakpts = '';
|
||||
if (wo.columnSelector_mediaquery && !colSel.auto) {
|
||||
colSel.$breakpoints.prop('disabled', true);
|
||||
colSel.$style.prop('disabled', false);
|
||||
return;
|
||||
}
|
||||
|
||||
// only 6 breakpoints (same as jQuery Mobile)
|
||||
for (priority = 0; priority < 6; priority++){
|
||||
/*jshint loopfunc:true */
|
||||
breaks = [];
|
||||
c.$headers.filter('[' + wo.columnSelector_priority + '=' + (priority + 1) + ']').each(function(){
|
||||
column = parseInt($(this).attr('data-column'), 10) + 1;
|
||||
breaks.push(prefix + ' tr th:nth-child(' + column + ')');
|
||||
breaks.push(prefix + ' tr td:nth-child(' + column + ')');
|
||||
});
|
||||
if (breaks.length) {
|
||||
mediaAll = mediaAll.concat( breaks );
|
||||
breakpts += tsColSel.queryBreak
|
||||
.replace(/\[size\]/g, wo.columnSelector_breakpoints[priority])
|
||||
.replace(/\[columns\]/g, breaks.join(','));
|
||||
}
|
||||
}
|
||||
if (colSel.$style) {
|
||||
colSel.$style.prop('disabled', true);
|
||||
}
|
||||
colSel.$breakpoints
|
||||
.prop('disabled', false)
|
||||
.html( tsColSel.queryAll.replace(/\[columns\]/g, mediaAll.join(',')) + breakpts );
|
||||
},
|
||||
|
||||
updateCols: function(c, wo) {
|
||||
if (wo.columnSelector_mediaquery && c.selector.auto || c.selector.isInitializing) {
|
||||
return;
|
||||
}
|
||||
var column,
|
||||
colSel = c.selector,
|
||||
styles = [],
|
||||
prefix = '.' + c.tableId;
|
||||
colSel.$container.find('input[data-column]').filter('[data-column!="auto"]').each(function(){
|
||||
if (!this.checked) {
|
||||
column = parseInt( $(this).attr('data-column'), 10 ) + 1;
|
||||
styles.push(prefix + ' tr th:nth-child(' + column + ')');
|
||||
styles.push(prefix + ' tr td:nth-child(' + column + ')');
|
||||
}
|
||||
});
|
||||
if (wo.columnSelector_mediaquery){
|
||||
colSel.$breakpoints.prop('disabled', true);
|
||||
}
|
||||
if (colSel.$style) {
|
||||
colSel.$style.prop('disabled', false).html( styles.length ? styles.join(',') + ' { display: none; }' : '' );
|
||||
}
|
||||
if (wo.columnSelector_saveColumns && ts.storage) {
|
||||
ts.storage( c.$table[0], 'tablesorter-columnSelector', colSel.states );
|
||||
}
|
||||
},
|
||||
|
||||
attachTo : function(table, elm) {
|
||||
table = $(table)[0];
|
||||
var colSel, wo, indx,
|
||||
c = table.config,
|
||||
$popup = $(elm);
|
||||
if ($popup.length && c) {
|
||||
if (!$popup.find('.tablesorter-column-selector').length) {
|
||||
// add a wrapper to add the selector into, in case the popup has other content
|
||||
$popup.append('<span class="tablesorter-column-selector"></span>');
|
||||
}
|
||||
colSel = c.selector;
|
||||
wo = c.widgetOptions;
|
||||
$popup.find('.tablesorter-column-selector')
|
||||
.html( colSel.$container.html() )
|
||||
.find('input').each(function(){
|
||||
var indx = $(this).attr('data-column');
|
||||
$(this).prop( 'checked', indx === 'auto' ? colSel.auto : colSel.states[indx] );
|
||||
});
|
||||
colSel.$popup = $popup.on('change', 'input', function(){
|
||||
// data input
|
||||
indx = $(this).attr('data-column');
|
||||
// update original popup
|
||||
colSel.$container.find('input[data-column="' + indx + '"]')
|
||||
.prop('checked', this.checked)
|
||||
.trigger('change');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: "columnSelector",
|
||||
priority: 10,
|
||||
options: {
|
||||
// target the column selector markup
|
||||
columnSelector_container : null,
|
||||
// column status, true = display, false = hide
|
||||
// disable = do not display on list
|
||||
columnSelector_columns : {},
|
||||
// remember selected columns
|
||||
columnSelector_saveColumns: true,
|
||||
|
||||
// container layout
|
||||
columnSelector_layout : '<label><input type="checkbox">{name}</label>',
|
||||
// data attribute containing column name to use in the selector container
|
||||
columnSelector_name : 'data-selector-name',
|
||||
|
||||
/* Responsive Media Query settings */
|
||||
// enable/disable mediaquery breakpoints
|
||||
columnSelector_mediaquery: true,
|
||||
// toggle checkbox name
|
||||
columnSelector_mediaqueryName: 'Auto: ',
|
||||
// breakpoints checkbox initial setting
|
||||
columnSelector_mediaqueryState: true,
|
||||
// responsive table hides columns with priority 1-6 at these breakpoints
|
||||
// see http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/#Applyingapresetbreakpoint
|
||||
// *** set to false to disable ***
|
||||
columnSelector_breakpoints : [ '20em', '30em', '40em', '50em', '60em', '70em' ],
|
||||
// data attribute containing column priority
|
||||
// duplicates how jQuery mobile uses priorities:
|
||||
// http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/
|
||||
columnSelector_priority : 'data-priority'
|
||||
|
||||
},
|
||||
init: function(table, thisWidget, c, wo) {
|
||||
tsColSel.init(table, c, wo);
|
||||
},
|
||||
remove: function(table, c){
|
||||
var csel = c.selector;
|
||||
csel.$container.empty();
|
||||
if (csel.$popup) { csel.$popup.empty(); }
|
||||
csel.$style.remove();
|
||||
csel.$breakpoints.remove();
|
||||
c.$table.off('updateAll' + namespace + ' update' + namespace);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,70 @@
|
||||
/*! tablesorter CSS Sticky Headers widget - updated 5/5/2014 (v2.16.4)
|
||||
* Requires a modern browser, tablesorter v2.8+
|
||||
*/
|
||||
/*jshint jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
$.tablesorter.addWidget({
|
||||
id: "cssStickyHeaders",
|
||||
priority: 10,
|
||||
options: {
|
||||
cssStickyHeaders_offset : 0,
|
||||
cssStickyHeaders_addCaption : false,
|
||||
cssStickyHeaders_attachTo : null,
|
||||
cssStickyHeaders_filteredToTop : true,
|
||||
cssStickyHeaders_zIndex : 10
|
||||
},
|
||||
init : function(table, thisWidget, c, wo) {
|
||||
var $attach = $(wo.cssStickyHeaders_attachTo),
|
||||
namespace = '.cssstickyheader',
|
||||
$thead = c.$table.children('thead'),
|
||||
$caption = c.$table.find('caption'),
|
||||
$win = $attach.length ? $attach : $(window);
|
||||
$win.bind('scroll resize '.split(' ').join(namespace + ' '), function() {
|
||||
var top = $attach.length ? $attach.offset().top : $win.scrollTop(),
|
||||
// add caption height; include table padding top & border-spacing or text may be above the fold (jQuery UI themes)
|
||||
// border-spacing needed in Firefox, but not webkit... not sure if I should account for that
|
||||
captionTop = wo.cssStickyHeaders_addCaption ? $caption.outerHeight(true) +
|
||||
(parseInt(c.$table.css('padding-top'), 10) || 0) + (parseInt(c.$table.css('border-spacing'), 10) || 0) : 0,
|
||||
bottom = c.$table.height() - $thead.height() - (c.$table.find('tfoot').height() || 0) - captionTop,
|
||||
deltaY = top - $thead.offset().top + (parseInt(c.$table.css('border-top-width'), 10) || 0) +
|
||||
(wo.cssStickyHeaders_offset || 0) + captionTop,
|
||||
finalY = (deltaY > 0 && deltaY <= bottom ? deltaY : 0),
|
||||
// IE can only transform header cells - fixes #447 thanks to @gakreol!
|
||||
$cells = $thead.children().children();
|
||||
if (wo.cssStickyHeaders_addCaption) {
|
||||
$cells = $cells.add($caption);
|
||||
}
|
||||
$cells.css({
|
||||
"position" : "relative",
|
||||
"z-index" : wo.cssStickyHeaders_zIndex,
|
||||
"transform" : finalY === 0 ? "" : "translate(0px," + finalY + "px)",
|
||||
"-ms-transform" : finalY === 0 ? "" : "translate(0px," + finalY + "px)",
|
||||
"-webkit-transform" : finalY === 0 ? "" : "translate(0px," + finalY + "px)"
|
||||
});
|
||||
});
|
||||
c.$table.bind('filterEnd', function() {
|
||||
if (wo.cssStickyHeaders_filteredToTop) {
|
||||
// scroll top of table into view
|
||||
window.scrollTo(0, c.$table.position().top);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
remove: function(table, c, wo){
|
||||
var namespace = '.cssstickyheader';
|
||||
$(window).unbind('scroll resize '.split(' ').join(namespace + ' '));
|
||||
c.$table
|
||||
.unbind('update updateAll '.split(' ').join(namespace + ' '))
|
||||
.children('thead, caption').css({
|
||||
"position" : "",
|
||||
"z-index" : "",
|
||||
"transform" : "",
|
||||
"-ms-transform" : "",
|
||||
"-webkit-transform" : ""
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
200
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-editable.js
Executable file
200
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-editable.js
Executable file
@@ -0,0 +1,200 @@
|
||||
/*! tablesorter Editable Content widget - updated 9/15/2014 (core v2.17.8)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* by Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
$.tablesorter.addWidget({
|
||||
id: 'editable',
|
||||
options : {
|
||||
editable_columns : [],
|
||||
editable_enterToAccept : true,
|
||||
editable_autoAccept : true,
|
||||
editable_autoResort : false,
|
||||
editable_wrapContent : '<div>', // wrap the cell content... makes this widget work in IE, and with autocomplete
|
||||
editable_trimContent : true, // trim content inside of contenteditable (remove tabs & carriage returns)
|
||||
editable_validate : null, // function(text, originalText){ return text; }
|
||||
editable_focused : null, // function(text, columnIndex, $element) {}
|
||||
editable_blur : null, // function(text, columnIndex, $element) { }
|
||||
editable_selectAll : false, // true/false or function(text, columnIndex, $element) { return true; }
|
||||
editable_noEdit : 'no-edit',
|
||||
editable_editComplete : 'editComplete'
|
||||
},
|
||||
init: function(table, thisWidget, c, wo){
|
||||
if ( !wo.editable_columns.length ) { return; }
|
||||
var indx, tmp, $t,
|
||||
cols = [],
|
||||
editComplete = function($cell, refocus){
|
||||
$cell
|
||||
.removeClass('tseditable-last-edited-cell')
|
||||
.trigger( wo.editable_editComplete, [c] );
|
||||
// restore focus last cell after updating
|
||||
if (refocus) {
|
||||
setTimeout(function(){
|
||||
$cell.focus();
|
||||
}, 50);
|
||||
}
|
||||
},
|
||||
selectAll = function(cell){
|
||||
setTimeout(function(){
|
||||
// select all text in contenteditable
|
||||
// see http://stackoverflow.com/a/6150060/145346
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(cell);
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
if ( $.type(wo.editable_columns) === "string" && wo.editable_columns.indexOf('-') >= 0 ) {
|
||||
// editable_columns can contain a range string (i.e. "2-4" )
|
||||
tmp = wo.editable_columns.split('-');
|
||||
indx = parseInt(tmp[0],10) || 0;
|
||||
tmp = parseInt(tmp[1],10) || (c.columns - 1);
|
||||
if ( tmp > c.columns ) { tmp = c.columns - 1; }
|
||||
for ( ; indx <= tmp; indx++ ) {
|
||||
cols.push('td:nth-child(' + (indx + 1) + ')');
|
||||
}
|
||||
} else if ( $.isArray(wo.editable_columns) ) {
|
||||
$.each(wo.editable_columns, function(i, col){
|
||||
if ( col < c.columns ) {
|
||||
cols.push('td:nth-child(' + (col + 1) + ')');
|
||||
}
|
||||
});
|
||||
}
|
||||
tmp = $('<div>').wrapInner(wo.editable_wrapContent).children().length || $.isFunction(wo.editable_wrapContent);
|
||||
// IE does not allow making TR/TH/TD cells directly editable (issue #404)
|
||||
// so add a div or span inside ( it's faster than using wrapInner() )
|
||||
c.$tbodies.find( cols.join(',') ).not( '.' + wo.editable_noEdit ).each(function(){
|
||||
// test for children, if they exist, then make the children editable
|
||||
$t = $(this);
|
||||
|
||||
if (tmp && $t.children().length === 0) {
|
||||
$t.wrapInner( wo.editable_wrapContent );
|
||||
}
|
||||
if ($t.children().length) {
|
||||
// make all children content editable
|
||||
$t.children().not('.' + wo.editable_noEdit).each(function(){
|
||||
var $this = $(this);
|
||||
if (wo.editable_trimContent) {
|
||||
$this.text(function(i, txt){
|
||||
return $.trim(txt);
|
||||
});
|
||||
}
|
||||
$this.prop( 'contenteditable', true );
|
||||
});
|
||||
} else {
|
||||
if (wo.editable_trimContent) {
|
||||
$t.text(function(i, txt){
|
||||
return $.trim(txt);
|
||||
});
|
||||
}
|
||||
$t.prop( 'contenteditable', true );
|
||||
}
|
||||
});
|
||||
c.$tbodies
|
||||
.on('mouseleave.tseditable', function(){
|
||||
if ( c.$table.data('contentFocused') ) {
|
||||
// change to "true" instead of element to allow focusout to process
|
||||
c.$table.data( 'contentFocused', true );
|
||||
$(':focus').trigger('focusout');
|
||||
}
|
||||
})
|
||||
.on('focus.tseditable', '[contenteditable]', function(e){
|
||||
clearTimeout( $(this).data('timer') );
|
||||
c.$table.data( 'contentFocused', e.target );
|
||||
var $this = $(this),
|
||||
selAll = wo.editable_selectAll,
|
||||
column = $this.closest('td').index(),
|
||||
txt = $.trim( $this.text() );
|
||||
if (wo.editable_enterToAccept) {
|
||||
// prevent enter from adding into the content
|
||||
$this.on('keydown.tseditable', function(e){
|
||||
if ( e.which === 13 ) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
$this.data({ before : txt, original: txt });
|
||||
|
||||
if (typeof wo.editable_focused === 'function') {
|
||||
wo.editable_focused( txt, column, $this );
|
||||
}
|
||||
|
||||
if (selAll) {
|
||||
if (typeof selAll === 'function') {
|
||||
if ( selAll( txt, column, $this ) ) {
|
||||
selectAll($this[0]);
|
||||
}
|
||||
} else {
|
||||
selectAll($this[0]);
|
||||
}
|
||||
}
|
||||
})
|
||||
.on('blur focusout keydown '.split(' ').join('.tseditable '), '[contenteditable]', function(e){
|
||||
if ( !c.$table.data('contentFocused') ) { return; }
|
||||
var t, validate,
|
||||
valid = false,
|
||||
$this = $(e.target),
|
||||
txt = $.trim( $this.text() ),
|
||||
column = $this.closest('td').index();
|
||||
if ( e.which === 27 ) {
|
||||
// user cancelled
|
||||
$this.html( $.trim( $this.data('original') ) ).trigger('blur.tseditable');
|
||||
c.$table.data( 'contentFocused', false );
|
||||
return false;
|
||||
}
|
||||
// accept on enter (if set), alt-enter (always) or if autoAccept is set and element is blurred or unfocused
|
||||
t = e.which === 13 && ( wo.editable_enterToAccept || e.altKey ) || wo.editable_autoAccept && e.type !== 'keydown';
|
||||
// change if new or user hits enter (if option set)
|
||||
if ( t && $this.data('before') !== txt ) {
|
||||
|
||||
validate = wo.editable_validate;
|
||||
valid = txt;
|
||||
|
||||
if (typeof(validate) === "function") {
|
||||
valid = validate( txt, $this.data('original'), column, $this );
|
||||
} else if (typeof (validate = $.tablesorter.getColumnData( table, validate, column )) === 'function') {
|
||||
valid = validate( txt, $this.data('original'), column, $this );
|
||||
}
|
||||
|
||||
if ( t && valid !== false ) {
|
||||
c.$table.find('.tseditable-last-edited-cell').removeClass('tseditable-last-edited-cell');
|
||||
$this
|
||||
.addClass('tseditable-last-edited-cell')
|
||||
.html( $.trim( valid ) )
|
||||
.data('before', valid)
|
||||
.data('original', valid)
|
||||
.trigger('change');
|
||||
c.$table.trigger('updateCell', [ $this.closest('td'), false, function(){
|
||||
if (wo.editable_autoResort) {
|
||||
setTimeout(function(){
|
||||
c.$table.trigger("sorton", [ c.sortList, function(){
|
||||
editComplete(c.$table.find('.tseditable-last-edited-cell'), true);
|
||||
}, true ]);
|
||||
}, 10);
|
||||
} else {
|
||||
editComplete(c.$table.find('.tseditable-last-edited-cell'));
|
||||
}
|
||||
} ]);
|
||||
return false;
|
||||
}
|
||||
} else if ( !valid && e.type !== 'keydown' ) {
|
||||
clearTimeout( $this.data('timer') );
|
||||
$this.data('timer', setTimeout(function(){
|
||||
if ($.isFunction(wo.editable_blur)) {
|
||||
wo.editable_blur( $.trim( $this.text() ), column, $this );
|
||||
}
|
||||
}, 100));
|
||||
// restore original content on blur
|
||||
$this.html( $.trim( $this.data('original') ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
249
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-grouping.js
Executable file
249
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-grouping.js
Executable file
@@ -0,0 +1,249 @@
|
||||
/*! tablesorter Grouping widget - updated 3/7/2014 (core v2.15.6)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* by Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.grouping = {
|
||||
|
||||
types : {
|
||||
number : function(c, $column, txt, num, group){
|
||||
var value, word;
|
||||
if (num > 1 && txt !== '') {
|
||||
if ($column.hasClass(ts.css.sortAsc)) {
|
||||
value = Math.floor(parseFloat(txt)/num) * num;
|
||||
return value > parseFloat(group || 0) ? value : parseFloat(group || 0);
|
||||
} else {
|
||||
value = Math.ceil(parseFloat(txt)/num) * num;
|
||||
return value < parseFloat(group || num) - value ? parseFloat(group || num) - value : value;
|
||||
}
|
||||
} else {
|
||||
word = (txt + '').match(/\d+/g);
|
||||
return word && word.length >= num ? word[num - 1] : txt || '';
|
||||
}
|
||||
},
|
||||
separator : function(c, $column, txt, num){
|
||||
var word = (txt + '').split(c.widgetOptions.group_separator);
|
||||
return $.trim(word && num > 0 && word.length >= num ? word[(num || 1) - 1] : '');
|
||||
},
|
||||
word : function(c, $column, txt, num){
|
||||
var word = (txt + ' ').match(/\w+/g);
|
||||
return word && word.length >= num ? word[num - 1] : txt || '';
|
||||
},
|
||||
letter : function(c, $column, txt, num){
|
||||
return txt ? (txt + ' ').substring(0, num) : '';
|
||||
},
|
||||
date : function(c, $column, txt, part, group){
|
||||
var wo = c.widgetOptions,
|
||||
time = new Date(txt || ''),
|
||||
hours = time.getHours();
|
||||
return part === 'year' ? time.getFullYear() :
|
||||
part === 'month' ? wo.group_months[time.getMonth()] :
|
||||
part === 'day' ? wo.group_months[time.getMonth()] + ' ' + time.getDate() :
|
||||
part === 'week' ? wo.group_week[time.getDay()] :
|
||||
part === 'time' ? ('00' + (hours > 12 ? hours - 12 : hours === 0 ? hours + 12 : hours)).slice(-2) + ':' +
|
||||
('00' + time.getMinutes()).slice(-2) + ' ' + ('00' + wo.group_time[hours >= 12 ? 1 : 0]).slice(-2) :
|
||||
wo.group_dateString(time);
|
||||
}
|
||||
},
|
||||
|
||||
update : function(table, c, wo){
|
||||
if ($.isEmptyObject(c.cache)) { return; }
|
||||
var rowIndex, tbodyIndex, currentGroup, $rows, groupClass, grouping, time, cache, saveName, direction,
|
||||
lang = wo.grouping_language,
|
||||
group = '',
|
||||
savedGroup = false,
|
||||
column = c.sortList[0] ? c.sortList[0][0] : -1;
|
||||
c.$table
|
||||
.find('tr.group-hidden').removeClass('group-hidden').end()
|
||||
.find('tr.group-header').remove();
|
||||
if (wo.group_collapsible) {
|
||||
// clear pager saved spacer height (in case the rows are collapsed)
|
||||
c.$table.data('pagerSavedHeight', 0);
|
||||
}
|
||||
if (column >= 0 && !c.$headers.filter('[data-column="' + column + '"]:last').hasClass('group-false')) {
|
||||
if (c.debug){ time = new Date(); }
|
||||
wo.group_currentGroup = ''; // save current groups
|
||||
wo.group_currentGroups = {};
|
||||
|
||||
// group class finds "group-{word/separator/letter/number/date/false}-{optional:#/year/month/day/week/time}"
|
||||
groupClass = (c.$headers.filter('[data-column="' + column + '"]:last').attr('class') || '').match(/(group-\w+(-\w+)?)/g);
|
||||
// grouping = [ 'group', '{word/separator/letter/number/date/false}', '{#/year/month/day/week/time}' ]
|
||||
grouping = groupClass ? groupClass[0].split('-') : ['group','letter',1]; // default to letter 1
|
||||
|
||||
// save current grouping
|
||||
if (wo.group_collapsible && wo.group_saveGroups && ts.storage) {
|
||||
wo.group_currentGroups = ts.storage( table, 'tablesorter-groups' ) || {};
|
||||
// include direction when grouping numbers > 1 (reversed direction shows different range values)
|
||||
direction = (grouping[1] === 'number' && grouping[2] > 1) ? 'dir' + c.sortList[0][1] : '';
|
||||
// combine column, sort direction & grouping as save key
|
||||
saveName = wo.group_currentGroup = '' + column + direction + grouping.join('');
|
||||
if (!wo.group_currentGroups[saveName]) {
|
||||
wo.group_currentGroups[saveName] = [];
|
||||
} else {
|
||||
savedGroup = true;
|
||||
}
|
||||
}
|
||||
for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++) {
|
||||
cache = c.cache[tbodyIndex].normalized;
|
||||
group = ''; // clear grouping across tbodies
|
||||
$rows = c.$tbodies.eq(tbodyIndex).children('tr').not('.' + c.cssChildRow);
|
||||
for (rowIndex = 0; rowIndex < $rows.length; rowIndex++) {
|
||||
if ( $rows.eq(rowIndex).is(':visible') ) {
|
||||
// fixes #438
|
||||
if (ts.grouping.types[grouping[1]]) {
|
||||
currentGroup = cache[rowIndex] ?
|
||||
ts.grouping.types[grouping[1]]( c, c.$headers.filter('[data-column="' + column + '"]:last'), cache[rowIndex][column], /date/.test(groupClass) ?
|
||||
grouping[2] : parseInt(grouping[2] || 1, 10) || 1, group, lang ) : currentGroup;
|
||||
if (group !== currentGroup) {
|
||||
group = currentGroup;
|
||||
// show range if number > 1
|
||||
if (grouping[1] === 'number' && grouping[2] > 1 && currentGroup !== '') {
|
||||
currentGroup += ' - ' + (parseInt(currentGroup, 10) +
|
||||
((parseInt(grouping[2],10) - 1) * (c.$headers.filter('[data-column="' + column + '"]:last').hasClass(ts.css.sortAsc) ? 1 : -1)));
|
||||
}
|
||||
if ($.isFunction(wo.group_formatter)) {
|
||||
currentGroup = wo.group_formatter((currentGroup || '').toString(), column, table, c, wo) || currentGroup;
|
||||
}
|
||||
$rows.eq(rowIndex).before('<tr class="group-header ' + c.selectorRemove.slice(1) +
|
||||
'" unselectable="on"><td colspan="' +
|
||||
c.columns + '">' + (wo.group_collapsible ? '<i/>' : '') + '<span class="group-name">' +
|
||||
currentGroup + '</span><span class="group-count"></span></td></tr>');
|
||||
if (wo.group_saveGroups && !savedGroup && wo.group_collapsed && wo.group_collapsible) {
|
||||
// all groups start collapsed
|
||||
wo.group_currentGroups[wo.group_currentGroup].push(currentGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
c.$table.find('tr.group-header')
|
||||
.bind('selectstart', false)
|
||||
.each(function(){
|
||||
var isHidden, $label, name,
|
||||
$row = $(this),
|
||||
$rows = $row.nextUntil('tr.group-header').filter(':visible');
|
||||
if (wo.group_count || $.isFunction(wo.group_callback)) {
|
||||
$label = $row.find('.group-count');
|
||||
if ($label.length) {
|
||||
if (wo.group_count) {
|
||||
$label.html( wo.group_count.replace(/\{num\}/g, $rows.length) );
|
||||
}
|
||||
if ($.isFunction(wo.group_callback)) {
|
||||
wo.group_callback($row.find('td'), $rows, column, table);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wo.group_saveGroups && wo.group_currentGroups[wo.group_currentGroup].length) {
|
||||
name = $row.find('.group-name').text().toLowerCase();
|
||||
isHidden = $.inArray( name, wo.group_currentGroups[wo.group_currentGroup] ) > -1;
|
||||
$row.toggleClass('collapsed', isHidden);
|
||||
$rows.toggleClass('group-hidden', isHidden);
|
||||
} else if (wo.group_collapsed && wo.group_collapsible) {
|
||||
$row.addClass('collapsed');
|
||||
$rows.addClass('group-hidden');
|
||||
}
|
||||
});
|
||||
c.$table.trigger(wo.group_complete);
|
||||
if (c.debug) {
|
||||
$.tablesorter.benchmark("Applying groups widget: ", time);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
bindEvents : function(table, c, wo){
|
||||
if (wo.group_collapsible) {
|
||||
wo.group_currentGroups = [];
|
||||
// .on() requires jQuery 1.7+
|
||||
c.$table.on('click toggleGroup', 'tr.group-header', function(event){
|
||||
event.stopPropagation();
|
||||
var isCollapsed, $groups, indx,
|
||||
$this = $(this),
|
||||
name = $this.find('.group-name').text().toLowerCase();
|
||||
// use shift-click to toggle ALL groups
|
||||
if (event.type === 'click' && event.shiftKey) {
|
||||
$this.siblings('.group-header').trigger('toggleGroup');
|
||||
}
|
||||
$this.toggleClass('collapsed');
|
||||
// nextUntil requires jQuery 1.4+
|
||||
$this.nextUntil('tr.group-header').toggleClass('group-hidden', $this.hasClass('collapsed') );
|
||||
// save collapsed groups
|
||||
if (wo.group_saveGroups && ts.storage) {
|
||||
$groups = c.$table.find('.group-header');
|
||||
isCollapsed = $this.hasClass('collapsed');
|
||||
if (!wo.group_currentGroups[wo.group_currentGroup]) {
|
||||
wo.group_currentGroups[wo.group_currentGroup] = [];
|
||||
}
|
||||
if (isCollapsed && wo.group_currentGroup) {
|
||||
wo.group_currentGroups[wo.group_currentGroup].push( name );
|
||||
} else if (wo.group_currentGroup) {
|
||||
indx = $.inArray( name, wo.group_currentGroups[wo.group_currentGroup] );
|
||||
if (indx > -1) {
|
||||
wo.group_currentGroups[wo.group_currentGroup].splice( indx, 1 );
|
||||
}
|
||||
}
|
||||
ts.storage( table, 'tablesorter-groups', wo.group_currentGroups );
|
||||
}
|
||||
});
|
||||
}
|
||||
$(wo.group_saveReset).on('click', function(){
|
||||
ts.grouping.clearSavedGroups(table);
|
||||
});
|
||||
c.$table.on('pagerChange.tsgrouping', function(){
|
||||
ts.grouping.update(table, c, wo);
|
||||
});
|
||||
},
|
||||
|
||||
clearSavedGroups: function(table){
|
||||
if (table && ts.storage) {
|
||||
ts.storage(table, 'tablesorter-groups', '');
|
||||
ts.grouping.update(table, table.config, table.config.widgetOptions);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: 'group',
|
||||
priority: 100,
|
||||
options: {
|
||||
group_collapsible : true, // make the group header clickable and collapse the rows below it.
|
||||
group_collapsed : false, // start with all groups collapsed
|
||||
group_saveGroups : true, // remember collapsed groups
|
||||
group_saveReset : null, // element to clear saved collapsed groups
|
||||
group_count : ' ({num})', // if not false, the "{num}" string is replaced with the number of rows in the group
|
||||
group_separator : '-', // group name separator; used when group-separator-# class is used.
|
||||
group_formatter : null, // function(txt, column, table, c, wo) { return txt; }
|
||||
group_callback : null, // function($cell, $rows, column, table){}, callback allowing modification of the group header labels
|
||||
group_complete : 'groupingComplete', // event triggered on the table when the grouping widget has finished work
|
||||
|
||||
// change these default date names based on your language preferences
|
||||
group_months : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
|
||||
group_week : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
|
||||
group_time : [ 'AM', 'PM' ],
|
||||
// this function is used when "group-date" is set to create the date string
|
||||
// you can just return date, date.toLocaleString(), date.toLocaleDateString() or d.toLocaleTimeString()
|
||||
// reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Conversion_getter
|
||||
group_dateString : function(date) { return date.toLocaleString(); }
|
||||
},
|
||||
init: function(table, thisWidget, c, wo){
|
||||
ts.grouping.bindEvents(table, c, wo);
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
ts.grouping.update(table, c, wo);
|
||||
},
|
||||
remove : function(table, c, wo){
|
||||
c.$table
|
||||
.off('click', 'tr.group-header')
|
||||
.off('pagerChange.tsgrouping')
|
||||
.find('.group-hidden').removeClass('group-hidden').end()
|
||||
.find('tr.group-header').remove();
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,91 @@
|
||||
/*! tablesorter headerTitles widget - updated 3/5/2014 (core v2.15.6)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* by Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.addWidget({
|
||||
id: 'headerTitles',
|
||||
options: {
|
||||
// use aria-label text
|
||||
// e.g. "First Name: Ascending sort applied, activate to apply a descending sort"
|
||||
headerTitle_useAria : false,
|
||||
// add tooltip class
|
||||
headerTitle_tooltip : '',
|
||||
// custom titles [ ascending, descending, unsorted ]
|
||||
headerTitle_cur_text : [ ' sort: A - Z', ' sort: Z - A', 'ly unsorted' ],
|
||||
headerTitle_cur_numeric : [ ' sort: 0 - 9', ' sort: 9 - 0', 'ly unsorted' ],
|
||||
headerTitle_nxt_text : [ ' sort: A - Z', ' sort: Z - A', 'remove sort' ],
|
||||
headerTitle_nxt_numeric : [ ' sort: 0 - 9', ' sort: 9 - 0', 'remove sort' ],
|
||||
|
||||
// title display; {prefix} adds above prefix
|
||||
// {type} adds the current sort order from above (text or numeric)
|
||||
// {next} adds the next sort direction using the sort order above
|
||||
headerTitle_output_sorted : 'current{current}; activate to {next}',
|
||||
headerTitle_output_unsorted : 'current{current}; activate to {next} ',
|
||||
headerTitle_output_nosort : 'No sort available',
|
||||
// use this type to override the parser detection result
|
||||
// e.g. use for numerically parsed columns (e.g. dates), but you
|
||||
// want the user to see a text sort, e.g. [ 'text', 'numeric' ]
|
||||
headerTitle_type : [],
|
||||
// manipulate the title as desired
|
||||
headerTitle_callback : null // function($cell, txt) { return txt; }
|
||||
},
|
||||
init: function(table, thisWidget, c, wo){
|
||||
// force refresh
|
||||
c.$table.on('refreshHeaderTitle', function(){
|
||||
thisWidget.format(table, c, wo);
|
||||
});
|
||||
// add tooltip class
|
||||
if ($.isArray(wo.headerTitle_tooltip)) {
|
||||
c.$headers.each(function(){
|
||||
$(this).addClass( wo.headerTitle_tooltip[this.column] || '' );
|
||||
});
|
||||
} else if (wo.headerTitle_tooltip !== '') {
|
||||
c.$headers.addClass( wo.headerTitle_tooltip );
|
||||
}
|
||||
},
|
||||
format: function (table, c, wo) {
|
||||
var txt;
|
||||
c.$headers.each(function(){
|
||||
var t = this,
|
||||
$this = $(this),
|
||||
sortType = wo.headerTitle_type[t.column] || c.parsers[ t.column ].type || 'text',
|
||||
sortDirection = $this.hasClass(ts.css.sortAsc) ? 0 : $this.hasClass(ts.css.sortDesc) ? 1 : 2,
|
||||
sortNext = t.order[(t.count + 1) % (c.sortReset ? 3 : 2)];
|
||||
if (wo.headerTitle_useAria) {
|
||||
txt = $this.hasClass('sorter-false') ? wo.headerTitle_output_nosort : $this.attr('aria-label') || '';
|
||||
} else {
|
||||
txt = (wo.headerTitle_prefix || '') + // now deprecated
|
||||
($this.hasClass('sorter-false') ? wo.headerTitle_output_nosort :
|
||||
ts.isValueInArray( t.column, c.sortList ) >= 0 ? wo.headerTitle_output_sorted : wo.headerTitle_output_unsorted);
|
||||
txt = txt.replace(/\{(current|next|name)\}/gi, function(m){
|
||||
return {
|
||||
'{name}' : $this.text(),
|
||||
'{current}' : wo[ 'headerTitle_cur_' + sortType ][ sortDirection ] || '',
|
||||
'{next}' : wo[ 'headerTitle_nxt_' + sortType ][ sortNext ] || ''
|
||||
}[m.toLowerCase()];
|
||||
});
|
||||
}
|
||||
$this.attr('title', $.isFunction(wo.headerTitle_callback) ? wo.headerTitle_callback($this, txt) : txt);
|
||||
});
|
||||
},
|
||||
remove: function (table, c, wo) {
|
||||
c.$headers.attr('title', '');
|
||||
c.$table.off('refreshHeaderTitle');
|
||||
// remove tooltip class
|
||||
if ($.isArray(wo.headerTitle_tooltip)) {
|
||||
c.$headers.each(function(){
|
||||
$(this).removeClass( wo.headerTitle_tooltip[this.column] || '' );
|
||||
});
|
||||
} else if (wo.headerTitle_tooltip !== '') {
|
||||
c.$headers.removeClass( wo.headerTitle_tooltip );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
413
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-math.js
Executable file
413
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-math.js
Executable file
@@ -0,0 +1,413 @@
|
||||
/*! tablesorter math widget - beta - updated 5/28/2014 (v2.17.1)
|
||||
* Requires tablesorter v2.16+ and jQuery 1.7+
|
||||
* by Rob Garrison
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter,
|
||||
math = {
|
||||
|
||||
// get all of the row numerical values in an arry
|
||||
getRow : function(table, wo, $el, dataAttrib) {
|
||||
var $t, txt,
|
||||
c = table.config,
|
||||
arry = [],
|
||||
$row = $el.closest('tr'),
|
||||
$cells = $row.children();
|
||||
if (!$row.hasClass(wo.filter_filteredRow || 'filtered')) {
|
||||
if (wo.math_ignore.length) {
|
||||
$cells = $cells.not('[' + dataAttrib + '=ignore]').not('[data-column=' + wo.math_ignore.join('],[data-column=') + ']');
|
||||
}
|
||||
arry = $cells.not($el).map(function(){
|
||||
$t = $(this);
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
txt = this.textContent || $t.text();
|
||||
}
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
|
||||
return isNaN(txt) ? 0 : txt;
|
||||
}).get();
|
||||
}
|
||||
return arry;
|
||||
},
|
||||
|
||||
// get all of the column numerical values in an arry
|
||||
getColumn : function(table, wo, $el, type, dataAttrib){
|
||||
var i, txt, $t, len, mathAbove,
|
||||
arry = [],
|
||||
c = table.config,
|
||||
filtered = wo.filter_filteredRow || 'filtered',
|
||||
cIndex = parseInt( $el.attr('data-column'), 10 ),
|
||||
$rows = c.$table.children('tbody').children(),
|
||||
$row = $el.closest('tr');
|
||||
// make sure tfoot rows are AFTER the tbody rows
|
||||
// $rows.add( c.$table.children('tfoot').children() );
|
||||
if (type === 'above') {
|
||||
len = $rows.index($row);
|
||||
i = len;
|
||||
while (i >= 0) {
|
||||
$t = $rows.eq(i).children().filter('[data-column=' + cIndex + ']');
|
||||
mathAbove = $t.filter('[' + dataAttrib + '^=above]').length;
|
||||
// ignore filtered rows & rows with data-math="ignore" (and starting row)
|
||||
if ( ( !$rows.eq(i).hasClass(filtered) && $rows.eq(i).not('[' + dataAttrib + '=ignore]').length && i !== len ) || mathAbove && i !== len ) {
|
||||
// stop calculating "above", when encountering another "above"
|
||||
if (mathAbove) {
|
||||
i = 0;
|
||||
} else if ($t.length) {
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
txt = $t[0].textContent || $t.text();
|
||||
}
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
|
||||
arry.push(isNaN(txt) ? 0 : txt);
|
||||
}
|
||||
}
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
$rows.each(function(){
|
||||
$t = $(this).children().filter('[data-column=' + cIndex + ']');
|
||||
if (!$(this).hasClass(filtered) && $t.not('[' + dataAttrib + '^=above],[' + dataAttrib + '^=col]').length && !$t.is($el)) {
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
txt = ($t[0] ? $t[0].textContent : '') || $t.text();
|
||||
}
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
|
||||
arry.push(isNaN(txt) ? 0 : txt);
|
||||
}
|
||||
});
|
||||
}
|
||||
return arry;
|
||||
},
|
||||
|
||||
// get all of the column numerical values in an arry
|
||||
getAll : function(table, wo, dataAttrib){
|
||||
var txt, $t, col,
|
||||
arry = [],
|
||||
c = table.config,
|
||||
filtered = wo.filter_filteredRow || 'filtered',
|
||||
$rows = c.$table.children('tbody').children();
|
||||
$rows.each(function(){
|
||||
if (!$(this).hasClass(filtered)) {
|
||||
$(this).children().each(function(){
|
||||
$t = $(this);
|
||||
col = parseInt( $t.attr('data-column'), 10);
|
||||
if (!$t.filter('[' + dataAttrib + ']').length && $.inArray(col, wo.math_ignore) < 0) {
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
txt = ($t[0] ? $t[0].textContent : '') || $t.text();
|
||||
}
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table);
|
||||
arry.push(isNaN(txt) ? 0 : txt);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return arry;
|
||||
},
|
||||
|
||||
recalculate : function(table, c, wo, init){
|
||||
if (c && (!wo.math_isUpdating || init)) {
|
||||
|
||||
// add data-column attributes to all table cells
|
||||
if (init) {
|
||||
ts.computeColumnIndex( c.$table.children('tbody').children() );
|
||||
}
|
||||
|
||||
// data-attribute name (defaults to data-math)
|
||||
var dataAttrib = 'data-' + (wo.math_data || 'math'),
|
||||
|
||||
// all non-info tbody cells
|
||||
$mathCells = c.$tbodies.find('[' + dataAttrib + ']');
|
||||
math.mathType( table, wo, $mathCells, wo.math_priority, dataAttrib );
|
||||
|
||||
// only info tbody cells
|
||||
$mathCells = c.$table.find('.' + c.cssInfoBlock + ', tfoot').find('[' + dataAttrib + ']');
|
||||
math.mathType( table, wo, $mathCells, wo.math_priority, dataAttrib );
|
||||
|
||||
// find the "all" total
|
||||
math.mathType( table, wo, c.$table.find('[' + dataAttrib + '^=all]'), ['all'], dataAttrib );
|
||||
|
||||
wo.math_isUpdating = true;
|
||||
c.$table.trigger('update');
|
||||
}
|
||||
},
|
||||
|
||||
mathType : function(table, wo, $cells, priority, dataAttrib) {
|
||||
if ($cells.length) {
|
||||
var formula, t, $t, arry, getAll,
|
||||
eq = ts.equations;
|
||||
if (priority[0] === 'all') {
|
||||
// no need to get all cells more than once
|
||||
getAll = math.getAll(table, wo, dataAttrib);
|
||||
}
|
||||
$.each( priority, function(i, type) {
|
||||
$cells.filter('[' + dataAttrib + '^=' + type + ']').each(function(){
|
||||
$t = $(this);
|
||||
formula = ($t.attr(dataAttrib) || '').replace(type + '-', '');
|
||||
arry = (type === "row") ? math.getRow(table, wo, $t, dataAttrib) :
|
||||
(type === "all") ? getAll : math.getColumn(table, wo, $t, type, dataAttrib);
|
||||
if (eq[formula]) {
|
||||
t = eq[formula](arry);
|
||||
if (table.config.debug && console && console.log) {
|
||||
console.log($t.attr(dataAttrib), arry, '=', t);
|
||||
}
|
||||
math.output( $t, wo, t, arry );
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
output : function($cell, wo, value, arry) {
|
||||
// get mask from cell data-attribute: data-math-mask="#,##0.00"
|
||||
var result = ts.formatMask( $cell.attr('data-' + wo.math_data + '-mask') || wo.math_mask, value, wo.math_wrapPrefix, wo.math_wrapSuffix );
|
||||
if ($.isFunction(wo.math_complete)) {
|
||||
result = wo.math_complete($cell, wo, result, value, arry);
|
||||
}
|
||||
if (result !== false) {
|
||||
$cell.html(result);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Modified from https://code.google.com/p/javascript-number-formatter/
|
||||
/**
|
||||
* @preserve IntegraXor Web SCADA - JavaScript Number Formatter
|
||||
* http:// www.integraxor.com/
|
||||
* author: KPL, KHL
|
||||
* (c)2011 ecava
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*/
|
||||
ts.formatMask = function(m, v, tmpPrefix, tmpSuffix){
|
||||
if ( !m || isNaN(+v) ) {
|
||||
return v; // return as it is.
|
||||
}
|
||||
|
||||
var isNegative, result, decimal, group, posLeadZero, posTrailZero, posSeparator, part, szSep,
|
||||
integer, str, offset, i, l, len, start, tmp, end, inv,
|
||||
prefix = '',
|
||||
suffix = '';
|
||||
|
||||
// find prefix/suffix
|
||||
len = m.length;
|
||||
start = m.search( /[0-9\-\+#]/ );
|
||||
tmp = start > 0 ? m.substring(0, start) : '';
|
||||
prefix = tmp;
|
||||
if ( start > 0 && tmpPrefix ) {
|
||||
if ( /\{content\}/.test(tmpPrefix || '') ) {
|
||||
prefix = (tmpPrefix || '').replace(/\{content\}/g, tmp || '');
|
||||
} else {
|
||||
prefix = (tmpPrefix || '') + tmp;
|
||||
}
|
||||
}
|
||||
// reverse string: not an ideal method if there are surrogate pairs
|
||||
inv = m.split('').reverse().join('');
|
||||
end = inv.search( /[0-9\-\+#]/ );
|
||||
i = len - end;
|
||||
i += (m.substring( i, i + 1 ) === '.') ? 1 : 0;
|
||||
tmp = end > 0 ? m.substring( i, len) : '';
|
||||
suffix = tmp;
|
||||
if (tmp !== '' && tmpSuffix) {
|
||||
if ( /\{content\}/.test(tmpSuffix || '') ) {
|
||||
suffix = (tmpSuffix || '').replace(/\{content\}/g, tmp || '');
|
||||
} else {
|
||||
suffix = tmp + (tmpSuffix || '');
|
||||
}
|
||||
}
|
||||
m = m.substring(start, i);
|
||||
|
||||
// convert any string to number according to formation sign.
|
||||
v = m.charAt(0) == '-' ? -v : +v;
|
||||
isNegative = v < 0 ? v = -v : 0; // process only abs(), and turn on flag.
|
||||
|
||||
// search for separator for grp & decimal, anything not digit, not +/- sign, not #.
|
||||
result = m.match( /[^\d\-\+#]/g );
|
||||
decimal = ( result && result[result.length-1] ) || '.'; // treat the right most symbol as decimal
|
||||
group = ( result && result[1] && result[0] ) || ','; // treat the left most symbol as group separator
|
||||
|
||||
// split the decimal for the format string if any.
|
||||
m = m.split( decimal );
|
||||
// Fix the decimal first, toFixed will auto fill trailing zero.
|
||||
v = v.toFixed( m[1] && m[1].length );
|
||||
v = +(v) + ''; // convert number to string to trim off *all* trailing decimal zero(es)
|
||||
|
||||
// fill back any trailing zero according to format
|
||||
posTrailZero = m[1] && m[1].lastIndexOf('0'); // look for last zero in format
|
||||
part = v.split('.');
|
||||
// integer will get !part[1]
|
||||
if ( !part[1] || ( part[1] && part[1].length <= posTrailZero ) ) {
|
||||
v = (+v).toFixed( posTrailZero + 1 );
|
||||
}
|
||||
szSep = m[0].split( group ); // look for separator
|
||||
m[0] = szSep.join(''); // join back without separator for counting the pos of any leading 0.
|
||||
|
||||
posLeadZero = m[0] && m[0].indexOf('0');
|
||||
if ( posLeadZero > -1 ) {
|
||||
while ( part[0].length < ( m[0].length - posLeadZero ) ) {
|
||||
part[0] = '0' + part[0];
|
||||
}
|
||||
} else if ( +part[0] === 0 ) {
|
||||
part[0] = '';
|
||||
}
|
||||
|
||||
v = v.split('.');
|
||||
v[0] = part[0];
|
||||
|
||||
// process the first group separator from decimal (.) only, the rest ignore.
|
||||
// get the length of the last slice of split result.
|
||||
posSeparator = ( szSep[1] && szSep[ szSep.length - 1 ].length );
|
||||
if ( posSeparator ) {
|
||||
integer = v[0];
|
||||
str = '';
|
||||
offset = integer.length % posSeparator;
|
||||
l = integer.length;
|
||||
for ( i = 0; i < l; i++ ) {
|
||||
str += integer.charAt(i); // ie6 only support charAt for sz.
|
||||
// -posSeparator so that won't trail separator on full length
|
||||
/*jshint -W018 */
|
||||
if ( !( ( i - offset + 1 ) % posSeparator ) && i < l - posSeparator ) {
|
||||
str += group;
|
||||
}
|
||||
}
|
||||
v[0] = str;
|
||||
}
|
||||
|
||||
v[1] = ( m[1] && v[1] ) ? decimal + v[1] : "";
|
||||
// put back any negation, combine integer and fraction, and add back prefix & suffix
|
||||
return prefix + ( ( isNegative ? '-' : '' ) + v[0] + v[1] ) + suffix;
|
||||
};
|
||||
|
||||
ts.equations = {
|
||||
count : function(arry) {
|
||||
return arry.length;
|
||||
},
|
||||
sum : function(arry) {
|
||||
var total = 0;
|
||||
$.each( arry, function(i) {
|
||||
total += arry[i];
|
||||
});
|
||||
return total;
|
||||
},
|
||||
mean : function(arry) {
|
||||
var total = ts.equations.sum( arry );
|
||||
return total / arry.length;
|
||||
},
|
||||
median : function(arry) {
|
||||
// https://gist.github.com/caseyjustus/1166258
|
||||
arry.sort( function(a,b){ return a - b; } );
|
||||
var half = Math.floor( arry.length / 2 );
|
||||
return (arry.length % 2) ? arry[half] : ( arry[half - 1] + arry[half] ) / 2.0;
|
||||
},
|
||||
mode : function(arry) {
|
||||
// http://stackoverflow.com/a/3451640/145346
|
||||
if ( arry.length === 0 ) { return 'none'; }
|
||||
var i, el,
|
||||
modeMap = {},
|
||||
maxCount = 1,
|
||||
modes = [arry[0]];
|
||||
for (i = 0; i < arry.length; i++) {
|
||||
el = arry[i];
|
||||
modeMap[el] = modeMap[el] ? modeMap[el] + 1 : 1;
|
||||
if ( modeMap[el] > maxCount ) {
|
||||
modes = [el];
|
||||
maxCount = modeMap[el];
|
||||
} else if (modeMap[el] === maxCount) {
|
||||
modes.push(el);
|
||||
maxCount = modeMap[el];
|
||||
}
|
||||
}
|
||||
// returns arry of modes if there is a tie
|
||||
return modes.sort( function(a,b){ return a - b; } );
|
||||
},
|
||||
max : function(arry) {
|
||||
return Math.max.apply( Math, arry );
|
||||
},
|
||||
min : function(arry) {
|
||||
return Math.min.apply( Math, arry );
|
||||
},
|
||||
range: function(arry) {
|
||||
var v = arry.sort(function(a,b){ return a - b; });
|
||||
return v[ arry.length - 1 ] - v[0];
|
||||
},
|
||||
// common variance equation
|
||||
// (not accessible via data-attribute setting)
|
||||
variance: function(arry, population) {
|
||||
var avg = ts.equations.mean( arry ),
|
||||
v = 0,
|
||||
i = arry.length;
|
||||
while (i--) {
|
||||
v += Math.pow( ( arry[i] - avg ), 2 );
|
||||
}
|
||||
v /= ( arry.length - (population ? 0 : 1) );
|
||||
return v;
|
||||
},
|
||||
// variance (population)
|
||||
varp : function(arry) {
|
||||
return ts.equations.variance(arry, true);
|
||||
},
|
||||
// variance (sample)
|
||||
vars : function(arry) {
|
||||
return ts.equations.variance(arry);
|
||||
},
|
||||
// standard deviation (sample)
|
||||
stdevs : function(arry) {
|
||||
var vars = ts.equations.variance(arry);
|
||||
return Math.sqrt( vars );
|
||||
},
|
||||
// standard deviation (population)
|
||||
stdevp : function(arry){
|
||||
var varp = ts.equations.variance(arry, true);
|
||||
return Math.sqrt( varp );
|
||||
}
|
||||
};
|
||||
|
||||
// add new widget called repeatHeaders
|
||||
// ************************************
|
||||
ts.addWidget({
|
||||
id: "math",
|
||||
priority: 100,
|
||||
options: {
|
||||
math_data : 'math',
|
||||
// column index to ignore
|
||||
math_ignore : [],
|
||||
// mask info: https://code.google.com/p/javascript-number-formatter/
|
||||
math_mask : '#,##0.00',
|
||||
// complete executed after each fucntion
|
||||
math_complete : null, // function($cell, wo, result, value, arry){ return result; },
|
||||
// order of calculation; "all" is last
|
||||
math_priority : [ 'row', 'above', 'col' ],
|
||||
// template for or just prepend the mask prefix & suffix with this HTML
|
||||
// e.g. '<span class="red">{content}</span>'
|
||||
math_prefix : '',
|
||||
math_suffix : ''
|
||||
},
|
||||
init : function(table, thisWidget, c, wo){
|
||||
c.$table
|
||||
.bind('tablesorter-initialized update updateRows addRows updateCell filterReset filterEnd '.split(' ').join('.tsmath '), function(e){
|
||||
var init = e.type === 'tablesorter-initialized';
|
||||
if (!wo.math_isUpdating || init) {
|
||||
math.recalculate( table, c, wo, init );
|
||||
}
|
||||
})
|
||||
.bind('updateComplete.tsmath', function(){
|
||||
setTimeout(function(){
|
||||
wo.math_isUpdating = false;
|
||||
}, 500);
|
||||
});
|
||||
wo.math_isUpdating = false;
|
||||
},
|
||||
// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin
|
||||
// this function only applies to tablesorter v2.4+
|
||||
remove: function(table, c, wo){
|
||||
$(table)
|
||||
.unbind('tablesorter-initialized update updateRows addRows updateCell filterReset filterEnd '.split(' ').join('.tsmath '))
|
||||
.find('[data-' + wo.math_data + ']').empty();
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
316
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-output.js
Executable file
316
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-output.js
Executable file
@@ -0,0 +1,316 @@
|
||||
/* Output widget (beta) for TableSorter 7/17/2014 (v2.17.5)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* Modified from:
|
||||
* HTML Table to CSV: http://www.kunalbabre.com/projects/table2CSV.php (License unknown?)
|
||||
* Download-File-JS: https://github.com/PixelsCommander/Download-File-JS (http://www.apache.org/licenses/LICENSE-2.0)
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter,
|
||||
|
||||
output = ts.output = {
|
||||
|
||||
event : 'outputTable',
|
||||
|
||||
// wrap line breaks & tabs in quotes
|
||||
regexQuote : /([\n\t]|<[^<]+>)/, // test
|
||||
regexBR : /(<br([\s\/])?>|\n)/g, // replace
|
||||
regexIMG : /<img[^>]+alt\s*=\s*['"]([^'"]+)['"][^>]*>/i, // match
|
||||
regexHTML : /<[^<]+>/g, // replace
|
||||
|
||||
replaceCR : '\\n',
|
||||
replaceTab : '\\t',
|
||||
|
||||
popupTitle : 'Output',
|
||||
popupStyle : 'width:100%;height:100%;', // for textarea
|
||||
message : 'Your device does not support downloading. Please try again in desktop browser.',
|
||||
|
||||
init : function(c) {
|
||||
c.$table
|
||||
.off(output.event)
|
||||
.on(output.event, function(){
|
||||
// explicitly use table.config.widgetOptions because we want
|
||||
// the most up-to-date values; not the "wo" from initialization
|
||||
output.process(c, c.widgetOptions);
|
||||
});
|
||||
},
|
||||
|
||||
processRow: function(c, $rows, isHeader, isJSON) {
|
||||
var $this, row, col, rowlen, collen, txt,
|
||||
wo = c.widgetOptions,
|
||||
tmpRow = [],
|
||||
dupe = wo.output_duplicateSpans,
|
||||
addSpanIndex = isHeader && isJSON && wo.output_headerRows && $.isFunction(wo.output_callbackJSON),
|
||||
cellIndex = 0;
|
||||
$rows.each(function(rowIndex) {
|
||||
if (!tmpRow[rowIndex]) { tmpRow[rowIndex] = []; }
|
||||
cellIndex = 0;
|
||||
$(this).children().each(function(){
|
||||
$this = $(this);
|
||||
// process rowspans
|
||||
if ($this.filter('[rowspan]').length) {
|
||||
rowlen = parseInt( $this.attr('rowspan'), 10) - 1;
|
||||
txt = output.formatData( wo, $this.attr(wo.output_dataAttrib) || $this.html(), isHeader );
|
||||
for (row = 1; row <= rowlen; row++) {
|
||||
if (!tmpRow[rowIndex + row]) { tmpRow[rowIndex + row] = []; }
|
||||
tmpRow[rowIndex + row][cellIndex] = isHeader ? txt : dupe ? txt : '';
|
||||
}
|
||||
}
|
||||
// process colspans
|
||||
if ($this.filter('[colspan]').length) {
|
||||
collen = parseInt( $this.attr('colspan'), 10) - 1;
|
||||
txt = output.formatData( wo, $this.attr(wo.output_dataAttrib) || $this.html(), isHeader );
|
||||
for (col = 1; col <= collen; col++) {
|
||||
// if we're processing the header & making JSON, the header names need to be unique
|
||||
if ($this.filter('[rowspan]').length) {
|
||||
rowlen = parseInt( $this.attr('rowspan'), 10);
|
||||
for (row = 0; row < rowlen; row++) {
|
||||
if (!tmpRow[rowIndex + row]) { tmpRow[rowIndex + row] = []; }
|
||||
tmpRow[rowIndex + row][cellIndex + col] = addSpanIndex ?
|
||||
wo.output_callbackJSON($this, txt, cellIndex + col) || txt + '(' + (cellIndex + col) + ')' : isHeader ? txt : dupe ? txt : '';
|
||||
}
|
||||
} else {
|
||||
tmpRow[rowIndex][cellIndex + col] = addSpanIndex ?
|
||||
wo.output_callbackJSON($this, txt, cellIndex + col) || txt + '(' + (cellIndex + col) + ')' : isHeader ? txt : dupe ? txt : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// don't include hidden columns
|
||||
if ( $this.css('display') !== 'none' ) {
|
||||
// skip column if already defined
|
||||
while (typeof tmpRow[rowIndex][cellIndex] !== 'undefined') { cellIndex++; }
|
||||
tmpRow[rowIndex][cellIndex] = tmpRow[rowIndex][cellIndex] ||
|
||||
output.formatData( wo, $this.attr(wo.output_dataAttrib) || $this.html(), isHeader );
|
||||
cellIndex++;
|
||||
}
|
||||
});
|
||||
});
|
||||
return tmpRow;
|
||||
},
|
||||
|
||||
ignoreColumns : function(wo, data) {
|
||||
// ignore columns -> remove data from built array (because we've already processed any rowspan/colspan)
|
||||
$.each( data, function(indx, val){
|
||||
data[indx] = $.grep(val, function(v, cellIndx){
|
||||
return $.inArray(cellIndx, wo.output_ignoreColumns) < 0;
|
||||
});
|
||||
});
|
||||
return data;
|
||||
},
|
||||
|
||||
process : function(c, wo) {
|
||||
var mydata, $this, $rows, headers, csvData, len,
|
||||
hasStringify = window.JSON && JSON.hasOwnProperty('stringify'),
|
||||
indx = 0,
|
||||
tmpData = (wo.output_separator || ',').toLowerCase(),
|
||||
outputJSON = tmpData === 'json',
|
||||
outputArray = tmpData === 'array',
|
||||
separator = outputJSON || outputArray ? ',' : wo.output_separator,
|
||||
$el = c.$table;
|
||||
// regex to look for the set separator or HTML
|
||||
wo.output_regex = new RegExp('(' + (/\\/.test(separator) ? '\\' : '' ) + separator + ')' );
|
||||
|
||||
// get header cells
|
||||
$this = $el.find('thead tr:visible').not('.' + (ts.css.filterRow || 'tablesorter-filter-row') );
|
||||
headers = output.processRow(c, $this, true, outputJSON);
|
||||
|
||||
// all tbody rows
|
||||
$rows = $el.children('tbody').children('tr');
|
||||
// get (f)iltered, (v)isible or all rows (look for the first letter only)
|
||||
$rows = /f/.test(wo.output_saveRows) ? $rows.not('.' + (wo.filter_filteredRow || 'filtered') ) :
|
||||
/v/.test(wo.output_saveRows) ? $rows.filter(':visible') : $rows;
|
||||
|
||||
// process to array of arrays
|
||||
csvData = output.processRow(c, $rows);
|
||||
len = headers.length;
|
||||
|
||||
if (wo.output_ignoreColumns.length) {
|
||||
headers = output.ignoreColumns(wo, headers);
|
||||
csvData = output.ignoreColumns(wo, csvData);
|
||||
}
|
||||
|
||||
if (outputJSON) {
|
||||
tmpData = [];
|
||||
$.each( csvData, function(indx, val){
|
||||
// multiple header rows & output_headerRows = true, pick the last row...
|
||||
tmpData.push( output.row2Hash( headers[ (len > 1 && wo.output_headerRows) ? indx % len : len - 1], val ) );
|
||||
});
|
||||
|
||||
// requires JSON stringify; if it doesn't exist, the output will show [object Object],... in the output window
|
||||
mydata = hasStringify ? JSON.stringify(tmpData) : tmpData;
|
||||
} else {
|
||||
tmpData = output.row2CSV(wo, wo.output_headerRows ? headers : [ headers[ (len > 1 && wo.output_headerRows) ? indx % len : len - 1] ], outputArray)
|
||||
.concat( output.row2CSV(wo, csvData, outputArray) );
|
||||
|
||||
// stringify the array; if stringify doesn't exist the array will be flattened
|
||||
mydata = outputArray && hasStringify ? JSON.stringify(tmpData) : tmpData.join('\n');
|
||||
}
|
||||
|
||||
// callback; if true returned, continue processing
|
||||
if ($.isFunction(wo.output_callback) && !wo.output_callback(c, mydata)) { return; }
|
||||
|
||||
if ( /p/.test( (wo.output_delivery || '').toLowerCase() ) ) {
|
||||
output.popup(mydata, wo.output_popupStyle, outputJSON || outputArray);
|
||||
} else {
|
||||
output.download(wo, mydata);
|
||||
}
|
||||
|
||||
}, // end process
|
||||
|
||||
row2CSV : function(wo, tmpRow, outputArray) {
|
||||
var tmp, rowIndex,
|
||||
csvData = [],
|
||||
rowLen = tmpRow.length;
|
||||
for (rowIndex = 0; rowIndex < rowLen; rowIndex++) {
|
||||
// remove any blank rows
|
||||
tmp = tmpRow[rowIndex].join('').replace(/\"/g,'');
|
||||
if (tmpRow[rowIndex].length > 0 && tmp !== '') {
|
||||
csvData[csvData.length] = outputArray ? tmpRow[rowIndex] : tmpRow[rowIndex].join(wo.output_separator);
|
||||
}
|
||||
}
|
||||
return csvData;
|
||||
},
|
||||
|
||||
row2Hash : function(keys, values) {
|
||||
var json = {};
|
||||
$.each(values, function(indx, val) {
|
||||
if ( indx < keys.length ) {
|
||||
json[ keys[indx] ] = val;
|
||||
}
|
||||
});
|
||||
return json;
|
||||
},
|
||||
|
||||
formatData : function(wo, input, isHeader) {
|
||||
var txt,
|
||||
quotes = (wo.output_separator || ',').toLowerCase(),
|
||||
separator = quotes === 'json' || quotes === 'array',
|
||||
// replace " with “ if undefined
|
||||
result = input.replace(/\"/g, wo.output_replaceQuote || '\u201c');
|
||||
// replace line breaks with \\n & tabs with \\t
|
||||
result = result.replace(output.regexBR, output.replaceCR).replace(/\t/g, output.replaceTab);
|
||||
// extract img alt text
|
||||
txt = result.match(output.regexIMG);
|
||||
if (!wo.output_includeHTML && txt !== null) {
|
||||
result = txt[1];
|
||||
}
|
||||
// replace/remove html
|
||||
result = wo.output_includeHTML && !isHeader ? result : result.replace(output.regexHTML, '');
|
||||
result = wo.output_trimSpaces || isHeader ? $.trim(result) : result;
|
||||
// JSON & array outputs don't need quotes
|
||||
quotes = separator ? false : wo.output_wrapQuotes || wo.output_regex.test(result) || output.regexQuote.test(result);
|
||||
return quotes ? '"' + result + '"' : result;
|
||||
},
|
||||
|
||||
popup : function(data, style, wrap) {
|
||||
var generator = window.open('', output.popupTitle, style);
|
||||
generator.document.write(
|
||||
'<html><head><title>' + output.popupTitle + '</title></head><body>' +
|
||||
'<textarea wrap="' + (wrap ? 'on' : 'off') + '" style="' + output.popupStyle + '">' + data + '\n</textarea>' +
|
||||
'</body></html>'
|
||||
);
|
||||
generator.document.close();
|
||||
generator.focus();
|
||||
// select all text and focus within the textarea in the popup
|
||||
// $(generator.document).find('textarea').select().focus();
|
||||
return true;
|
||||
},
|
||||
|
||||
// modified from https://github.com/PixelsCommander/Download-File-JS
|
||||
// & http://html5-demos.appspot.com/static/a.download.html
|
||||
download : function (wo, data){
|
||||
|
||||
var e, blob, gotBlob,
|
||||
nav = window.navigator,
|
||||
link = document.createElement('a');
|
||||
|
||||
// iOS devices do not support downloading. We have to inform user about this.
|
||||
if (/(iP)/g.test(nav.userAgent)) {
|
||||
alert(output.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
// test for blob support
|
||||
try {
|
||||
gotBlob = !!new Blob();
|
||||
} catch (err) {
|
||||
gotBlob = false;
|
||||
}
|
||||
|
||||
// Use HTML5 Blob if browser supports it
|
||||
if ( gotBlob ) {
|
||||
|
||||
window.URL = window.webkitURL || window.URL;
|
||||
blob = new Blob([data], {type: wo.output_encoding});
|
||||
|
||||
if (nav.msSaveBlob) {
|
||||
// IE 10+
|
||||
nav.msSaveBlob(blob, wo.output_saveFileName);
|
||||
} else {
|
||||
// all other browsers
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
link.download = wo.output_saveFileName;
|
||||
// Dispatching click event; using $(link).trigger() won't work
|
||||
if (document.createEvent) {
|
||||
e = document.createEvent('MouseEvents');
|
||||
// event.initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
|
||||
e.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
link.dispatchEvent(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// fallback to force file download (whether supported by server).
|
||||
// not sure if this actually works in IE9 and older...
|
||||
window.open( wo.output_encoding + encodeURIComponent(data) + '?download' , '_self');
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
remove : function(c) {
|
||||
c.$table.off(output.event);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: "output",
|
||||
options: {
|
||||
output_separator : ',', // set to "json", "array" or any separator
|
||||
output_ignoreColumns : [], // columns to ignore [0, 1,... ] (zero-based index)
|
||||
output_dataAttrib : 'data-name', // header attrib containing modified header name
|
||||
output_headerRows : false, // if true, include multiple header rows (JSON only)
|
||||
output_delivery : 'popup', // popup, download
|
||||
output_saveRows : 'filtered', // all, visible or filtered
|
||||
output_duplicateSpans: true, // duplicate output data in tbody colspan/rowspan
|
||||
output_replaceQuote : '\u201c;', // left double quote
|
||||
output_includeHTML : false,
|
||||
output_trimSpaces : true,
|
||||
output_wrapQuotes : false,
|
||||
output_popupStyle : 'width=500,height=300',
|
||||
output_saveFileName : 'mytable.csv',
|
||||
// callback executed when processing completes
|
||||
// return true to continue download/output
|
||||
// return false to stop delivery & do something else with the data
|
||||
output_callback : function(config, data){ return true; },
|
||||
// JSON callback executed when a colspan is encountered in the header
|
||||
output_callbackJSON : function($cell, txt, cellIndex) { return txt + '(' + (cellIndex) + ')'; },
|
||||
// the need to modify this for Excel no longer exists
|
||||
output_encoding : 'data:application/octet-stream;charset=utf8,'
|
||||
|
||||
},
|
||||
init: function(table, thisWidget, c) {
|
||||
output.init(c);
|
||||
},
|
||||
remove: function(table, c){
|
||||
output.remove(c);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
975
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-pager.js
Executable file
975
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-pager.js
Executable file
@@ -0,0 +1,975 @@
|
||||
/* Pager widget for TableSorter 9/15/2014 (v2.17.8) */
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var tsp,
|
||||
ts = $.tablesorter;
|
||||
|
||||
ts.addWidget({
|
||||
id: "pager",
|
||||
priority: 55, // load pager after filter widget
|
||||
options : {
|
||||
// output default: '{page}/{totalPages}'
|
||||
// possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
||||
pager_output: '{startRow} to {endRow} of {totalRows} rows', // '{page}/{totalPages}'
|
||||
|
||||
// apply disabled classname to the pager arrows when the rows at either extreme is visible
|
||||
pager_updateArrows: true,
|
||||
|
||||
// starting page of the pager (zero based index)
|
||||
pager_startPage: 0,
|
||||
|
||||
// reset pager after filtering; set to desired page #
|
||||
// set to false to not change page at filter start
|
||||
pager_pageReset: 0,
|
||||
|
||||
// Number of visible rows
|
||||
pager_size: 10,
|
||||
|
||||
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
||||
pager_savePages: true,
|
||||
|
||||
//defines custom storage key
|
||||
pager_storageKey: 'tablesorter-pager',
|
||||
|
||||
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
||||
// table row set to a height to compensate; default is false
|
||||
pager_fixedHeight: false,
|
||||
|
||||
// count child rows towards the set page size? (set true if it is a visible table row within the pager)
|
||||
// if true, child row(s) may not appear to be attached to its parent row, may be split across pages or
|
||||
// may distort the table if rowspan or cellspans are included.
|
||||
pager_countChildRows: false,
|
||||
|
||||
// remove rows from the table to speed up the sort of large tables.
|
||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||
pager_removeRows: false, // removing rows in larger tables speeds up the sort
|
||||
|
||||
// use this format: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}"
|
||||
// where {page} is replaced by the page number, {size} is replaced by the number of records to show,
|
||||
// {sortList:col} adds the sortList to the url into a "col" array, and {filterList:fcol} adds
|
||||
// the filterList to the url into an "fcol" array.
|
||||
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
|
||||
// and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url
|
||||
pager_ajaxUrl: null,
|
||||
|
||||
// modify the url after all processing has been applied
|
||||
pager_customAjaxUrl: function(table, url) { return url; },
|
||||
|
||||
// modify the $.ajax object to allow complete control over your ajax requests
|
||||
pager_ajaxObject: {
|
||||
dataType: 'json'
|
||||
},
|
||||
|
||||
// set this to false if you want to block ajax loading on init
|
||||
pager_processAjaxOnInit: true,
|
||||
|
||||
// process ajax so that the following information is returned:
|
||||
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
|
||||
// example:
|
||||
// [
|
||||
// 100, // total rows
|
||||
// [
|
||||
// [ "row1cell1", "row1cell2", ... "row1cellN" ],
|
||||
// [ "row2cell1", "row2cell2", ... "row2cellN" ],
|
||||
// ...
|
||||
// [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
|
||||
// ],
|
||||
// [ "header1", "header2", ... "headerN" ] // optional
|
||||
// ]
|
||||
pager_ajaxProcessing: function(ajax){ return [ 0, [], null ]; },
|
||||
|
||||
// css class names of pager arrows
|
||||
pager_css: {
|
||||
container : 'tablesorter-pager',
|
||||
errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning)
|
||||
disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page)
|
||||
},
|
||||
|
||||
// jQuery selectors
|
||||
pager_selectors: {
|
||||
container : '.pager', // target the pager markup
|
||||
first : '.first', // go to first page arrow
|
||||
prev : '.prev', // previous page arrow
|
||||
next : '.next', // next page arrow
|
||||
last : '.last', // go to last page arrow
|
||||
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
||||
}
|
||||
},
|
||||
init: function(table){
|
||||
tsp.init(table);
|
||||
},
|
||||
// only update to complete sorter initialization
|
||||
format: function(table, c){
|
||||
if (!(c.pager && c.pager.initialized)){
|
||||
return tsp.initComplete(table, c);
|
||||
}
|
||||
tsp.moveToPage(table, c.pager, false);
|
||||
},
|
||||
remove: function(table, c){
|
||||
tsp.destroyPager(table, c);
|
||||
}
|
||||
});
|
||||
|
||||
/* pager widget functions */
|
||||
tsp = ts.pager = {
|
||||
|
||||
init: function(table) {
|
||||
// check if tablesorter has initialized
|
||||
if (table.hasInitialized && table.config.pager.initialized) { return; }
|
||||
var t,
|
||||
c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
s = wo.pager_selectors,
|
||||
|
||||
// save pager variables
|
||||
p = c.pager = $.extend({
|
||||
totalPages: 0,
|
||||
filteredRows: 0,
|
||||
filteredPages: 0,
|
||||
currentFilters: [],
|
||||
page: wo.pager_startPage,
|
||||
startRow: 0,
|
||||
endRow: 0,
|
||||
ajaxCounter: 0,
|
||||
$size: null,
|
||||
last: {}
|
||||
}, c.pager);
|
||||
|
||||
// pager initializes multiple times before table has completed initialization
|
||||
if (p.isInitializing) { return; }
|
||||
|
||||
p.isInitializing = true;
|
||||
if (c.debug) {
|
||||
ts.log('Pager initializing');
|
||||
}
|
||||
|
||||
p.size = $.data(table, 'pagerLastSize') || wo.pager_size;
|
||||
// added in case the pager is reinitialized after being destroyed.
|
||||
p.$container = $(s.container).addClass(wo.pager_css.container).show();
|
||||
// goto selector
|
||||
p.$goto = p.$container.find(s.gotoPage); // goto is a reserved word #657
|
||||
// page size selector
|
||||
p.$size = p.$container.find(s.pageSize);
|
||||
p.totalRows = c.$tbodies.eq(0).children('tr').not( c.widgetOptions.pager_countChildRows ? '' : '.' + c.cssChildRow ).length;
|
||||
p.oldAjaxSuccess = p.oldAjaxSuccess || wo.pager_ajaxObject.success;
|
||||
c.appender = tsp.appender;
|
||||
if (ts.filter && $.inArray('filter', c.widgets) >= 0) {
|
||||
// get any default filter settings (data-value attribute) fixes #388
|
||||
p.currentFilters = c.$table.data('lastSearch') || ts.filter.setDefaults(table, c, wo) || [];
|
||||
// set, but don't apply current filters
|
||||
ts.setFilters(table, p.currentFilters, false);
|
||||
}
|
||||
if (wo.pager_savePages && ts.storage) {
|
||||
t = ts.storage(table, wo.pager_storageKey) || {}; // fixes #387
|
||||
p.page = isNaN(t.page) ? p.page : t.page;
|
||||
p.size = ( isNaN(t.size) ? p.size : t.size ) || 10;
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
}
|
||||
|
||||
// skipped rows
|
||||
p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'') + '|' + c.cssChildRow + ')');
|
||||
|
||||
// clear initialized flag
|
||||
p.initialized = false;
|
||||
// before initialization event
|
||||
c.$table.trigger('pagerBeforeInitialized', c);
|
||||
|
||||
tsp.enablePager(table, c, false);
|
||||
|
||||
if ( typeof(wo.pager_ajaxUrl) === 'string' ) {
|
||||
// ajax pager; interact with database
|
||||
p.ajax = true;
|
||||
// When filtering with ajax, allow only custom filtering function, disable default filtering since it will be done server side.
|
||||
wo.filter_serversideFiltering = true;
|
||||
c.serverSideSorting = true;
|
||||
tsp.moveToPage(table, p);
|
||||
} else {
|
||||
p.ajax = false;
|
||||
// Regular pager; all rows stored in memory
|
||||
c.$table.trigger("appendCache", [{}, true]);
|
||||
tsp.hideRowsSetup(table, c);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
initComplete: function(table, c){
|
||||
var p = c.pager;
|
||||
tsp.changeHeight(table, c);
|
||||
tsp.bindEvents(table, c);
|
||||
tsp.setPageSize(table, 0, c); // page size 0 is ignored
|
||||
|
||||
// pager initialized
|
||||
p.initialized = true;
|
||||
p.isInitializing = false;
|
||||
c.$table.trigger('pagerInitialized', c);
|
||||
tsp.updatePageDisplay(table, c);
|
||||
},
|
||||
|
||||
bindEvents: function(table, c){
|
||||
var ctrls, fxn,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
s = wo.pager_selectors;
|
||||
|
||||
c.$table
|
||||
.unbind('filterStart filterEnd sortEnd disable enable destroy updateComplete pageSize '.split(' ').join('.pager '))
|
||||
.bind('filterStart.pager', function(e, filters) {
|
||||
p.currentFilters = filters;
|
||||
// don't change page is filters are the same (pager updating, etc)
|
||||
if (wo.pager_pageReset !== false && (c.lastCombinedFilter || '') !== (filters || []).join('')) {
|
||||
p.page = wo.pager_pageReset; // fixes #456 & #565
|
||||
}
|
||||
})
|
||||
// update pager after filter widget completes
|
||||
.bind('filterEnd.pager sortEnd.pager', function() {
|
||||
if (p.initialized) {
|
||||
if (c.delayInit && c.rowsCopy && c.rowsCopy.length === 0) {
|
||||
// make sure we have a copy of all table rows once the cache has been built
|
||||
tsp.updateCache(table);
|
||||
}
|
||||
// update page display first, so we update p.filteredPages
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
// tsp.moveToPage(table, p, false); <-- called when applyWidgets is triggered
|
||||
c.pager.last.page = -1;
|
||||
c.$table.trigger('applyWidgets');
|
||||
tsp.fixHeight(table, c);
|
||||
}
|
||||
})
|
||||
.bind('disable.pager', function(e){
|
||||
e.stopPropagation();
|
||||
tsp.showAllRows(table, c);
|
||||
})
|
||||
.on('enable.pager', function(e){
|
||||
e.stopPropagation();
|
||||
tsp.enablePager(table, c, true);
|
||||
})
|
||||
.on('destroy.pager', function(e){
|
||||
e.stopPropagation();
|
||||
tsp.destroyPager(table, c);
|
||||
})
|
||||
.on('updateComplete.pager', function(e, table, triggered){
|
||||
e.stopPropagation();
|
||||
// table can be unintentionally undefined in tablesorter v2.17.7 and earlier
|
||||
if (!table || triggered) { return; }
|
||||
tsp.fixHeight(table, c);
|
||||
var $rows = c.$tbodies.eq(0).children('tr').not(c.selectorRemove);
|
||||
p.totalRows = $rows.length - ( c.widgetOptions.pager_countChildRows ? 0 : $rows.filter('.' + c.cssChildRow).length );
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
if ($rows.length && c.rowsCopy && c.rowsCopy.length === 0) {
|
||||
// make a copy of all table rows once the cache has been built
|
||||
tsp.updateCache(table);
|
||||
}
|
||||
tsp.updatePageDisplay(table, c);
|
||||
tsp.hideRows(table, c);
|
||||
// make sure widgets are applied - fixes #450
|
||||
c.$table.trigger('applyWidgets');
|
||||
})
|
||||
.on('pageSize.pager', function(e,v){
|
||||
e.stopPropagation();
|
||||
tsp.setPageSize(table, parseInt(v, 10) || 10, c);
|
||||
tsp.hideRows(table, c);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
if (p.$size.length) { p.$size.val(p.size); } // twice?
|
||||
})
|
||||
.on('pageSet.pager', function(e,v){
|
||||
e.stopPropagation();
|
||||
p.page = (parseInt(v, 10) || 1) - 1;
|
||||
if (p.$goto.length) { p.$goto.val(c.size); } // twice?
|
||||
tsp.moveToPage(table, p, true);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
});
|
||||
|
||||
// clicked controls
|
||||
ctrls = [ s.first, s.prev, s.next, s.last ];
|
||||
fxn = [ 'moveToFirstPage', 'moveToPrevPage', 'moveToNextPage', 'moveToLastPage' ];
|
||||
p.$container.find(ctrls.join(','))
|
||||
.attr("tabindex", 0)
|
||||
.unbind('click.pager')
|
||||
.bind('click.pager', function(e){
|
||||
e.stopPropagation();
|
||||
var i,
|
||||
$c = $(this),
|
||||
l = ctrls.length;
|
||||
if ( !$c.hasClass(wo.pager_css.disabled) ) {
|
||||
for (i = 0; i < l; i++) {
|
||||
if ($c.is(ctrls[i])) {
|
||||
tsp[fxn[i]](table, p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ( p.$goto.length ) {
|
||||
p.$goto
|
||||
.unbind('change')
|
||||
.bind('change', function(){
|
||||
p.page = $(this).val() - 1;
|
||||
tsp.moveToPage(table, p, true);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
});
|
||||
}
|
||||
|
||||
if ( p.$size.length ) {
|
||||
// setting an option as selected appears to cause issues with initial page size
|
||||
p.$size.find('option').removeAttr('selected');
|
||||
p.$size
|
||||
.unbind('change.pager')
|
||||
.bind('change.pager', function() {
|
||||
p.$size.val( $(this).val() ); // in case there are more than one pagers
|
||||
if ( !$(this).hasClass(wo.pager_css.disabled) ) {
|
||||
tsp.setPageSize(table, parseInt( $(this).val(), 10 ), c);
|
||||
tsp.changeHeight(table, c);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// hide arrows at extremes
|
||||
pagerArrows: function(c, disable) {
|
||||
var p = c.pager,
|
||||
dis = !!disable,
|
||||
first = dis || p.page === 0,
|
||||
tp = Math.min( p.totalPages, p.filteredPages ),
|
||||
last = dis || p.page === tp - 1 || tp === 0,
|
||||
wo = c.widgetOptions,
|
||||
s = wo.pager_selectors;
|
||||
if ( wo.pager_updateArrows ) {
|
||||
p.$container.find(s.first + ',' + s.prev).toggleClass(wo.pager_css.disabled, first).attr('aria-disabled', first);
|
||||
p.$container.find(s.next + ',' + s.last).toggleClass(wo.pager_css.disabled, last).attr('aria-disabled', last);
|
||||
}
|
||||
},
|
||||
|
||||
updatePageDisplay: function(table, c, completed) {
|
||||
var i, pg, s, $out, regex,
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager,
|
||||
f = c.$table.hasClass('hasFilters'),
|
||||
t = [],
|
||||
sz = p.size || 10; // don't allow dividing by zero
|
||||
t = [ wo && wo.filter_filteredRow || 'filtered', c.selectorRemove.replace(/^(\w+\.)/g,'') ];
|
||||
if (wo.pager_countChildRows) { t.push(c.cssChildRow); }
|
||||
regex = new RegExp( '(' + t.join('|') + ')' );
|
||||
p.$size.add(p.$goto).removeClass(wo.pager_css.disabled).removeAttr('disabled').attr('aria-disabled', 'false');
|
||||
if (f && !wo.pager_ajaxUrl) {
|
||||
if ($.isEmptyObject(c.cache)) {
|
||||
// delayInit: true so nothing is in the cache
|
||||
p.filteredRows = p.totalRows = c.$tbodies.eq(0).children('tr').not( c.widgetOptions.pager_countChildRows ? '' : '.' + c.cssChildRow ).length;
|
||||
} else {
|
||||
p.filteredRows = 0;
|
||||
$.each(c.cache[0].normalized, function(i, el) {
|
||||
p.filteredRows += p.regexRows.test(el[c.columns].$row[0].className) ? 0 : 1;
|
||||
});
|
||||
}
|
||||
} else if (!f) {
|
||||
p.filteredRows = p.totalRows;
|
||||
}
|
||||
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
|
||||
c.totalRows = p.totalRows;
|
||||
c.filteredRows = p.filteredRows;
|
||||
p.filteredPages = Math.ceil( p.filteredRows / sz ) || 0;
|
||||
if ( Math.min( p.totalPages, p.filteredPages ) >= 0 ) {
|
||||
t = (p.size * p.page > p.filteredRows);
|
||||
p.startRow = (t) ? 1 : (p.filteredRows === 0 ? 0 : p.size * p.page + 1);
|
||||
p.page = (t) ? 0 : p.page;
|
||||
p.endRow = Math.min( p.filteredRows, p.totalRows, p.size * ( p.page + 1 ) );
|
||||
$out = p.$container.find(wo.pager_selectors.pageDisplay);
|
||||
// form the output string (can now get a new output string from the server)
|
||||
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || wo.pager_output : wo.pager_output )
|
||||
// {page} = one-based index; {page+#} = zero based index +/- value
|
||||
.replace(/\{page([\-+]\d+)?\}/gi, function(m,n){
|
||||
return p.totalPages ? p.page + (n ? parseInt(n, 10) : 1) : 0;
|
||||
})
|
||||
// {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object)
|
||||
.replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m){
|
||||
var len, indx,
|
||||
str = m.replace(/[{}\s]/g,''),
|
||||
extra = str.split(':'),
|
||||
data = p.ajaxData,
|
||||
// return zero for default page/row numbers
|
||||
deflt = /(rows?|pages?)$/i.test(str) ? 0 : '';
|
||||
if (/(startRow|page)/.test(extra[0]) && extra[1] === 'input') {
|
||||
len = ('' + (extra[0] === 'page' ? p.totalPages : p.totalRows)).length;
|
||||
indx = extra[0] === 'page' ? p.page + 1 : p.startRow;
|
||||
return '<input type="text" class="ts-' + extra[0] + '" style="max-width:' + len + 'em" value="' + indx + '"/>';
|
||||
}
|
||||
return extra.length > 1 && data && data[extra[0]] ? data[extra[0]][extra[1]] : p[str] || (data ? data[str] : deflt) || deflt;
|
||||
});
|
||||
if ($out.length) {
|
||||
$out[ ($out[0].tagName === 'INPUT') ? 'val' : 'html' ](s);
|
||||
if ( p.$goto.length ) {
|
||||
t = '';
|
||||
pg = Math.min( p.totalPages, p.filteredPages );
|
||||
for ( i = 1; i <= pg; i++ ) {
|
||||
t += '<option>' + i + '</option>';
|
||||
}
|
||||
p.$goto[0].innerHTML = t;
|
||||
p.$goto[0].value = p.page + 1;
|
||||
}
|
||||
// rebind startRow/page inputs
|
||||
$out.find('.ts-startRow, .ts-page').unbind('change').bind('change', function(){
|
||||
var v = $(this).val(),
|
||||
pg = $(this).hasClass('ts-startRow') ? Math.floor( v/p.size ) + 1 : v;
|
||||
c.$table.trigger('pageSet.pager', [ pg ]);
|
||||
});
|
||||
}
|
||||
}
|
||||
tsp.pagerArrows(c);
|
||||
if (p.initialized && completed !== false) {
|
||||
c.$table.trigger('pagerComplete', c);
|
||||
// save pager info to storage
|
||||
if (wo.pager_savePages && ts.storage) {
|
||||
ts.storage(table, wo.pager_storageKey, {
|
||||
page : p.page,
|
||||
size : p.size
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
fixHeight: function(table, c) {
|
||||
var d, h,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
$b = c.$tbodies.eq(0);
|
||||
if (wo.pager_fixedHeight) {
|
||||
$b.find('tr.pagerSavedHeightSpacer').remove();
|
||||
h = $.data(table, 'pagerSavedHeight');
|
||||
if (h) {
|
||||
d = h - $b.height();
|
||||
if ( d > 5 && $.data(table, 'pagerLastSize') === p.size && $b.children('tr:visible').length < p.size ) {
|
||||
$b.append('<tr class="pagerSavedHeightSpacer ' + wo.pager_selectors.remove.replace(/^(\w+\.)/g,'') + '" style="height:' + d + 'px;"></tr>');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
changeHeight: function(table, c) {
|
||||
var $b = c.$tbodies.eq(0);
|
||||
$b.find('tr.pagerSavedHeightSpacer').remove();
|
||||
$.data(table, 'pagerSavedHeight', $b.height());
|
||||
tsp.fixHeight(table, c);
|
||||
$.data(table, 'pagerLastSize', c.pager.size);
|
||||
},
|
||||
|
||||
hideRows: function(table, c){
|
||||
if (!c.widgetOptions.pager_ajaxUrl) {
|
||||
var i,
|
||||
lastIndex = 0,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
rows = c.$tbodies.eq(0).children('tr'),
|
||||
l = rows.length,
|
||||
s = ( p.page * p.size ),
|
||||
e = s + p.size,
|
||||
f = wo && wo.filter_filteredRow || 'filtered',
|
||||
j = 0; // size counter
|
||||
for ( i = 0; i < l; i++ ){
|
||||
if ( !rows[i].className.match(f) ) {
|
||||
if (j === s && rows[i].className.match(c.cssChildRow)) {
|
||||
// hide child rows @ start of pager (if already visible)
|
||||
rows[i].style.display = 'none';
|
||||
} else {
|
||||
rows[i].style.display = ( j >= s && j < e ) ? '' : 'none';
|
||||
// don't count child rows
|
||||
j += rows[i].className.match(c.cssChildRow + '|' + c.selectorRemove.replace(/^(\w+\.)/g,'')) && !wo.pager_countChildRows ? 0 : 1;
|
||||
if ( j === e && rows[i].style.display !== 'none' && rows[i].className.match(ts.css.cssHasChild) ) {
|
||||
lastIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// add any attached child rows to last row of pager. Fixes part of issue #396
|
||||
if ( lastIndex > 0 && rows[lastIndex].className.match(ts.css.cssHasChild) ) {
|
||||
while ( ++lastIndex < l && rows[lastIndex].className.match(c.cssChildRow) ) {
|
||||
rows[lastIndex].style.display = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hideRowsSetup: function(table, c){
|
||||
var p = c.pager;
|
||||
p.size = parseInt( p.$size.val(), 10 ) || p.size;
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
tsp.pagerArrows(c);
|
||||
if ( !c.widgetOptions.pager_removeRows ) {
|
||||
tsp.hideRows(table, c);
|
||||
c.$table.on('sortEnd.pager filterEnd.pager', function(){
|
||||
tsp.hideRows(table, c);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
renderAjax: function(data, table, c, xhr, exception){
|
||||
var p = c.pager,
|
||||
wo = c.widgetOptions;
|
||||
// process data
|
||||
if ( $.isFunction(wo.pager_ajaxProcessing) ) {
|
||||
// ajaxProcessing result: [ total, rows, headers ]
|
||||
var i, j, t, hsh, $f, $sh, th, d, l, rr_count,
|
||||
$t = c.$table,
|
||||
tds = '',
|
||||
result = wo.pager_ajaxProcessing(data, table, xhr) || [ 0, [] ],
|
||||
hl = $t.find('thead th').length;
|
||||
|
||||
// Clean up any previous error.
|
||||
ts.showError(table);
|
||||
|
||||
if ( exception ) {
|
||||
if (c.debug) {
|
||||
ts.log('Ajax Error', xhr, exception);
|
||||
}
|
||||
ts.showError(table, exception.message + ' (' + xhr.status + ')');
|
||||
c.$tbodies.eq(0).children('tr').detach();
|
||||
p.totalRows = 0;
|
||||
} else {
|
||||
// process ajax object
|
||||
if (!$.isArray(result)) {
|
||||
p.ajaxData = result;
|
||||
c.totalRows = p.totalRows = result.total;
|
||||
c.filteredRows = p.filteredRows = typeof result.filteredRows !== 'undefined' ? result.filteredRows : result.total;
|
||||
th = result.headers;
|
||||
d = result.rows;
|
||||
} else {
|
||||
// allow [ total, rows, headers ] or [ rows, total, headers ]
|
||||
t = isNaN(result[0]) && !isNaN(result[1]);
|
||||
// ensure a zero returned row count doesn't fail the logical ||
|
||||
rr_count = result[t ? 1 : 0];
|
||||
p.totalRows = isNaN(rr_count) ? p.totalRows || 0 : rr_count;
|
||||
// can't set filtered rows when returning an array
|
||||
c.totalRows = c.filteredRows = p.filteredRows = p.totalRows;
|
||||
d = p.totalRows === 0 ? [""] : result[t ? 0 : 1] || []; // row data
|
||||
th = result[2]; // headers
|
||||
}
|
||||
l = d && d.length;
|
||||
if (d instanceof jQuery) {
|
||||
if (wo.pager_processAjaxOnInit) {
|
||||
// append jQuery object
|
||||
c.$tbodies.eq(0).children('tr').detach();
|
||||
c.$tbodies.eq(0).append(d);
|
||||
}
|
||||
} else if (l) {
|
||||
// build table from array
|
||||
for ( i = 0; i < l; i++ ) {
|
||||
tds += '<tr>';
|
||||
for ( j = 0; j < d[i].length; j++ ) {
|
||||
// build tbody cells; watch for data containing HTML markup - see #434
|
||||
tds += /^\s*<td/.test(d[i][j]) ? $.trim(d[i][j]) : '<td>' + d[i][j] + '</td>';
|
||||
}
|
||||
tds += '</tr>';
|
||||
}
|
||||
// add rows to first tbody
|
||||
if (wo.pager_processAjaxOnInit) {
|
||||
c.$tbodies.eq(0).html( tds );
|
||||
}
|
||||
}
|
||||
wo.pager_processAjaxOnInit = true;
|
||||
// only add new header text if the length matches
|
||||
if ( th && th.length === hl ) {
|
||||
hsh = $t.hasClass('hasStickyHeaders');
|
||||
$sh = hsh ? wo.$sticky.children('thead:first').children('tr').children() : '';
|
||||
$f = $t.find('tfoot tr:first').children();
|
||||
// don't change td headers (may contain pager)
|
||||
c.$headers.filter('th').each(function(j){
|
||||
var $t = $(this), icn;
|
||||
// add new test within the first span it finds, or just in the header
|
||||
if ( $t.find('.' + ts.css.icon).length ) {
|
||||
icn = $t.find('.' + ts.css.icon).clone(true);
|
||||
$t.find('.tablesorter-header-inner').html( th[j] ).append(icn);
|
||||
if ( hsh && $sh.length ) {
|
||||
icn = $sh.eq(j).find('.' + ts.css.icon).clone(true);
|
||||
$sh.eq(j).find('.tablesorter-header-inner').html( th[j] ).append(icn);
|
||||
}
|
||||
} else {
|
||||
$t.find('.tablesorter-header-inner').html( th[j] );
|
||||
if (hsh && $sh.length) {
|
||||
$sh.eq(j).find('.tablesorter-header-inner').html( th[j] );
|
||||
}
|
||||
}
|
||||
$f.eq(j).html( th[j] );
|
||||
});
|
||||
}
|
||||
}
|
||||
if (c.showProcessing) {
|
||||
ts.isProcessing(table); // remove loading icon
|
||||
}
|
||||
// make sure last pager settings are saved, prevents multiple server side calls with
|
||||
// the same parameters
|
||||
p.totalPages = Math.ceil( p.totalRows / ( p.size || 10 ) );
|
||||
p.last.totalRows = p.totalRows;
|
||||
p.last.currentFilters = p.currentFilters;
|
||||
p.last.sortList = (c.sortList || []).join(',');
|
||||
tsp.updatePageDisplay(table, c);
|
||||
tsp.fixHeight(table, c);
|
||||
$t.trigger('updateCache', [function(){
|
||||
if (p.initialized) {
|
||||
// apply widgets after table has rendered & after a delay to prevent
|
||||
// multiple applyWidget blocking code from blocking this trigger
|
||||
setTimeout(function(){
|
||||
$t
|
||||
.trigger('applyWidgets')
|
||||
.trigger('pagerChange', p);
|
||||
}, 0);
|
||||
}
|
||||
}]);
|
||||
}
|
||||
if (!p.initialized) {
|
||||
c.$table.trigger('applyWidgets');
|
||||
}
|
||||
},
|
||||
|
||||
getAjax: function(table, c){
|
||||
var counter,
|
||||
url = tsp.getAjaxUrl(table, c),
|
||||
$doc = $(document),
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager;
|
||||
if ( url !== '' ) {
|
||||
if (c.showProcessing) {
|
||||
ts.isProcessing(table, true); // show loading icon
|
||||
}
|
||||
$doc.on('ajaxError.pager', function(e, xhr, settings, exception) {
|
||||
tsp.renderAjax(null, table, c, xhr, exception);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
});
|
||||
counter = ++p.ajaxCounter;
|
||||
wo.pager_ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||
wo.pager_ajaxObject.success = function(data, status, jqxhr) {
|
||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||
if (counter < p.ajaxCounter){
|
||||
return;
|
||||
}
|
||||
tsp.renderAjax(data, table, c, jqxhr);
|
||||
$doc.unbind('ajaxError.pager');
|
||||
if (typeof p.oldAjaxSuccess === 'function') {
|
||||
p.oldAjaxSuccess(data);
|
||||
}
|
||||
};
|
||||
if (c.debug) {
|
||||
ts.log('ajax initialized', wo.pager_ajaxObject);
|
||||
}
|
||||
$.ajax(wo.pager_ajaxObject);
|
||||
}
|
||||
},
|
||||
|
||||
getAjaxUrl: function(table, c) {
|
||||
var p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
url = (wo.pager_ajaxUrl) ? wo.pager_ajaxUrl
|
||||
// allow using "{page+1}" in the url string to switch to a non-zero based index
|
||||
.replace(/\{page([\-+]\d+)?\}/, function(s,n){ return p.page + (n ? parseInt(n, 10) : 0); })
|
||||
.replace(/\{size\}/g, p.size) : '',
|
||||
sl = c.sortList,
|
||||
fl = p.currentFilters || $(table).data('lastSearch') || [],
|
||||
sortCol = url.match(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/),
|
||||
filterCol = url.match(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/),
|
||||
arry = [];
|
||||
if (sortCol) {
|
||||
sortCol = sortCol[1];
|
||||
$.each(sl, function(i,v){
|
||||
arry.push(sortCol + '[' + v[0] + ']=' + v[1]);
|
||||
});
|
||||
// if the arry is empty, just add the col parameter... "&{sortList:col}" becomes "&col"
|
||||
url = url.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : sortCol );
|
||||
arry = [];
|
||||
}
|
||||
if (filterCol) {
|
||||
filterCol = filterCol[1];
|
||||
$.each(fl, function(i,v){
|
||||
if (v) {
|
||||
arry.push(filterCol + '[' + i + ']=' + encodeURIComponent(v));
|
||||
}
|
||||
});
|
||||
// if the arry is empty, just add the fcol parameter... "&{filterList:fcol}" becomes "&fcol"
|
||||
url = url.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : filterCol );
|
||||
p.currentFilters = fl;
|
||||
}
|
||||
if ( $.isFunction(wo.pager_customAjaxUrl) ) {
|
||||
url = wo.pager_customAjaxUrl(table, url);
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager ajax url: ' + url);
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
renderTable: function(table, rows) {
|
||||
var $tb, index, count, added,
|
||||
c = table.config,
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
f = c.$table.hasClass('hasFilters'),
|
||||
l = rows && rows.length || 0, // rows may be undefined
|
||||
s = ( p.page * p.size ),
|
||||
e = p.size;
|
||||
if ( l < 1 ) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: no rows for pager to render');
|
||||
}
|
||||
// empty table, abort!
|
||||
return;
|
||||
}
|
||||
if ( p.page >= p.totalPages ) {
|
||||
// lets not render the table more than once
|
||||
return tsp.moveToLastPage(table, p);
|
||||
}
|
||||
p.isDisabled = false; // needed because sorting will change the page and re-enable the pager
|
||||
if (p.initialized) { c.$table.trigger('pagerChange', c); }
|
||||
if ( !wo.pager_removeRows ) {
|
||||
tsp.hideRows(table, c);
|
||||
} else {
|
||||
ts.clearTableBody(table);
|
||||
$tb = ts.processTbody(table, c.$tbodies.eq(0), true);
|
||||
// not filtered, start from the calculated starting point (s)
|
||||
// if filtered, start from zero
|
||||
index = f ? 0 : s;
|
||||
count = f ? 0 : s;
|
||||
added = 0;
|
||||
while (added < e && index < rows.length) {
|
||||
if (!f || !/filtered/.test(rows[index][0].className)){
|
||||
count++;
|
||||
if (count > s && added <= e) {
|
||||
added++;
|
||||
$tb.append(rows[index]);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
ts.processTbody(table, $tb, false);
|
||||
}
|
||||
|
||||
tsp.updatePageDisplay(table, c);
|
||||
if ( !p.isDisabled ) { tsp.fixHeight(table, c); }
|
||||
|
||||
wo.pager_startPage = p.page;
|
||||
wo.pager_size = p.size;
|
||||
if (table.isUpdating) {
|
||||
c.$table.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
showAllRows: function(table, c){
|
||||
var p = c.pager,
|
||||
wo = c.widgetOptions;
|
||||
if ( p.ajax ) {
|
||||
tsp.pagerArrows(c, true);
|
||||
} else {
|
||||
p.isDisabled = true;
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
p.page = 0;
|
||||
p.size = p.totalRows;
|
||||
p.totalPages = 1;
|
||||
c.$table
|
||||
.addClass('pagerDisabled')
|
||||
.removeAttr('aria-describedby')
|
||||
.find('tr.pagerSavedHeightSpacer').remove();
|
||||
tsp.renderTable(table, c.rowsCopy);
|
||||
c.$table.trigger('applyWidgets');
|
||||
if (c.debug) {
|
||||
ts.log('pager disabled');
|
||||
}
|
||||
}
|
||||
// disable size selector
|
||||
p.$size.add(p.$goto).each(function(){
|
||||
$(this).attr('aria-disabled', 'true').addClass(wo.pager_css.disabled)[0].disabled = true;
|
||||
});
|
||||
},
|
||||
|
||||
// updateCache if delayInit: true
|
||||
// this is normally done by "appendToTable" function in the tablesorter core AFTER a sort
|
||||
updateCache: function(table) {
|
||||
var c = table.config,
|
||||
p = c.pager;
|
||||
c.$table.trigger('updateCache', [ function(){
|
||||
if ( !$.isEmptyObject(table.config.cache) ) {
|
||||
var i,
|
||||
rows = [],
|
||||
n = table.config.cache[0].normalized;
|
||||
p.totalRows = n.length;
|
||||
for (i = 0; i < p.totalRows; i++) {
|
||||
rows.push(n[i][c.columns].$row);
|
||||
}
|
||||
c.rowsCopy = rows;
|
||||
tsp.moveToPage(table, p, true);
|
||||
// clear out last search to force an update
|
||||
p.last.currentFilters = [' '];
|
||||
}
|
||||
} ]);
|
||||
},
|
||||
|
||||
moveToPage: function(table, p, pageMoved) {
|
||||
if ( p.isDisabled ) { return; }
|
||||
if ( pageMoved !== false && p.initialized && $.isEmptyObject(table.config.cache)) {
|
||||
return tsp.updateCache(table);
|
||||
}
|
||||
var c = table.config,
|
||||
l = p.last,
|
||||
pg = Math.min( p.totalPages, p.filteredPages );
|
||||
if ( p.page < 0 ) { p.page = 0; }
|
||||
if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
|
||||
// fixes issue where one current filter is [] and the other is ['','',''],
|
||||
// making the next if comparison think the filters as different. Fixes #202.
|
||||
l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters;
|
||||
p.currentFilters = (p.currentFilters || []).join('') === '' ? [] : p.currentFilters;
|
||||
// don't allow rendering multiple times on the same page/size/totalRows/filters/sorts
|
||||
if ( l.page === p.page && l.size === p.size && l.totalRows === p.totalRows &&
|
||||
(l.currentFilters || []).join(',') === (p.currentFilters || []).join(',') &&
|
||||
l.sortList === (c.sortList || []).join(',') ) {
|
||||
return;
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager changing to page ' + p.page);
|
||||
}
|
||||
p.last = {
|
||||
page : p.page,
|
||||
size : p.size,
|
||||
// fixes #408; modify sortList otherwise it auto-updates
|
||||
sortList : (c.sortList || []).join(','),
|
||||
totalRows : p.totalRows,
|
||||
currentFilters : p.currentFilters || []
|
||||
};
|
||||
if (p.ajax) {
|
||||
tsp.getAjax(table, c);
|
||||
} else if (!p.ajax) {
|
||||
tsp.renderTable(table, c.rowsCopy);
|
||||
}
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
if (p.initialized && pageMoved !== false) {
|
||||
c.$table
|
||||
.trigger('pageMoved', c)
|
||||
.trigger('applyWidgets');
|
||||
if (!p.ajax && table.isUpdating) {
|
||||
c.$table.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setPageSize: function(table, size, c) {
|
||||
var p = c.pager;
|
||||
p.size = size || p.size || 10;
|
||||
p.$size.val(p.size);
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
$.data(table, 'pagerLastSize', p.size);
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
p.filteredPages = Math.ceil( p.filteredRows / p.size );
|
||||
tsp.moveToPage(table, p, true);
|
||||
},
|
||||
|
||||
moveToFirstPage: function(table, p) {
|
||||
p.page = 0;
|
||||
tsp.moveToPage(table, p, true);
|
||||
},
|
||||
|
||||
moveToLastPage: function(table, p) {
|
||||
p.page = ( Math.min( p.totalPages, p.filteredPages ) - 1 );
|
||||
tsp.moveToPage(table, p, true);
|
||||
},
|
||||
|
||||
moveToNextPage: function(table, p) {
|
||||
p.page++;
|
||||
if ( p.page >= ( Math.min( p.totalPages, p.filteredPages ) - 1 ) ) {
|
||||
p.page = ( Math.min( p.totalPages, p.filteredPages ) - 1 );
|
||||
}
|
||||
tsp.moveToPage(table, p, true);
|
||||
},
|
||||
|
||||
moveToPrevPage: function(table, p) {
|
||||
p.page--;
|
||||
if ( p.page <= 0 ) {
|
||||
p.page = 0;
|
||||
}
|
||||
tsp.moveToPage(table, p, true);
|
||||
},
|
||||
|
||||
destroyPager: function(table, c){
|
||||
var p = c.pager;
|
||||
tsp.showAllRows(table, c);
|
||||
p.$container.hide(); // hide pager
|
||||
c.appender = null; // remove pager appender function
|
||||
p.initialized = false;
|
||||
delete table.config.rowsCopy;
|
||||
c.$table.unbind('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager');
|
||||
if (ts.storage) {
|
||||
ts.storage(table, c.widgetOptions.pager_storageKey, '');
|
||||
}
|
||||
},
|
||||
|
||||
enablePager: function(table, c, triggered){
|
||||
var info, p = c.pager;
|
||||
p.isDisabled = false;
|
||||
p.page = $.data(table, 'pagerLastPage') || p.page || 0;
|
||||
p.size = $.data(table, 'pagerLastSize') || parseInt(p.$size.find('option[selected]').val(), 10) || p.size || 10;
|
||||
p.$size.val(p.size); // set page size
|
||||
p.totalPages = Math.ceil( Math.min( p.totalRows, p.filteredRows ) / p.size );
|
||||
c.$table.removeClass('pagerDisabled');
|
||||
// if table id exists, include page display with aria info
|
||||
if ( table.id ) {
|
||||
info = table.id + '_pager_info';
|
||||
p.$container.find(c.widgetOptions.pager_selectors.pageDisplay).attr('id', info);
|
||||
c.$table.attr('aria-describedby', info);
|
||||
}
|
||||
if ( triggered ) {
|
||||
c.$table.trigger('updateRows');
|
||||
tsp.setPageSize(table, p.size, c);
|
||||
tsp.hideRowsSetup(table, c);
|
||||
tsp.fixHeight(table, c);
|
||||
if (c.debug) {
|
||||
ts.log('pager enabled');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
appender: function(table, rows) {
|
||||
var c = table.config,
|
||||
wo = c.widgetOptions,
|
||||
p = c.pager;
|
||||
if ( !p.ajax ) {
|
||||
c.rowsCopy = rows;
|
||||
p.totalRows = c.widgetOptions.pager_countChildRows ? c.$tbodies.eq(0).children('tr').length : rows.length;
|
||||
p.size = $.data(table, 'pagerLastSize') || p.size || wo.pager_size || 10;
|
||||
p.totalPages = Math.ceil( p.totalRows / p.size );
|
||||
tsp.moveToPage(table, p);
|
||||
// update display here in case all rows are removed
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
} else {
|
||||
tsp.moveToPage(table, p, true);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// see #486
|
||||
ts.showError = function(table, message){
|
||||
$(table).each(function(){
|
||||
var $row,
|
||||
c = this.config,
|
||||
errorRow = c.pager && c.pager.cssErrorRow || c.widgetOptions.pager_css && c.widgetOptions.pager_css.errorRow || 'tablesorter-errorRow';
|
||||
if (c) {
|
||||
if (typeof message === 'undefined') {
|
||||
c.$table.find('thead').find(c.selectorRemove).remove();
|
||||
} else {
|
||||
$row = ( /tr\>/.test(message) ? $(message) : $('<tr><td colspan="' + c.columns + '">' + message + '</td></tr>') )
|
||||
.click(function(){
|
||||
$(this).remove();
|
||||
})
|
||||
// add error row to thead instead of tbody, or clicking on the header will result in a parser error
|
||||
.appendTo( c.$table.find('thead:first') )
|
||||
.addClass( errorRow + ' ' + c.selectorRemove.replace(/^(\w+\.)/g,'') )
|
||||
.attr({
|
||||
role : 'alert',
|
||||
'aria-live' : 'assertive'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
123
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-print.js
Executable file
123
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-print.js
Executable file
@@ -0,0 +1,123 @@
|
||||
/* Print widget (beta) for TableSorter 6/18/2014 (v2.17.2)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.2.6+
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter,
|
||||
|
||||
printTable = ts.printTable = {
|
||||
|
||||
event : 'printTable',
|
||||
basicStyle : 'table, tr, td, th { border : solid 1px black; border-collapse : collapse; } td, th { padding: 2px; }',
|
||||
|
||||
init : function(c) {
|
||||
c.$table
|
||||
.unbind(printTable.event)
|
||||
.bind(printTable.event, function(){
|
||||
// explicitly use table.config.widgetOptions because we want
|
||||
// the most up-to-date values; not the "wo" from initialization
|
||||
printTable.process(c, c.widgetOptions);
|
||||
});
|
||||
},
|
||||
|
||||
process : function(c, wo) {
|
||||
var $this,
|
||||
$table = $('<div/>').append(c.$table.clone()),
|
||||
printStyle = printTable.basicStyle + 'table { width: 100% }' +
|
||||
// hide filter row
|
||||
'.tablesorter-filter-row { display: none }' +
|
||||
// hide sort arrows
|
||||
'.tablesorter-header { background-image: none !important; }';
|
||||
|
||||
// replace content with data-attribute content
|
||||
$table.find('[' + wo.print_dataAttrib + ']').each(function(){
|
||||
$this = $(this);
|
||||
$this.text( $this.attr(wo.print_dataAttrib) );
|
||||
});
|
||||
|
||||
// === rows ===
|
||||
// Assume "visible" means rows hidden by the pager (rows set to "display:none")
|
||||
// or hidden by a class name which is added to the wo.print_extraCSS definition
|
||||
if (/a/i.test(wo.print_rows)) {
|
||||
// force show of all rows
|
||||
printStyle += 'tbody tr { display: table-row !important; }';
|
||||
} else if (/f/i.test(wo.print_rows)) {
|
||||
// add definition to show all non-filtered rows (cells hidden by the pager)
|
||||
printStyle += 'tbody tr:not(.' + (wo.filter_filteredRow || 'filtered') + ') { display: table-row !important; }';
|
||||
}
|
||||
|
||||
// === columns ===
|
||||
// columnSelector -> c.selector.$style
|
||||
// Assume "visible" means hidden columns have a "display:none" style, or a class name
|
||||
// add the definition to the wo.print_extraCSS option
|
||||
if (/s/i.test(wo.print_columns) && c.selector && c.widgets.indexOf('columnSelector') >= 0) {
|
||||
// show selected (visible) columns; make a copy of the columnSelector widget css (not media queries)
|
||||
printStyle += c.selector.auto ? '' : c.selector.$style.text();
|
||||
} else if (/a/i.test(wo.print_columns)) {
|
||||
// force show all cells
|
||||
printStyle += 'td, th { display: table-cell !important; }';
|
||||
}
|
||||
|
||||
printStyle += wo.print_extraCSS;
|
||||
|
||||
// callback function
|
||||
if ( $.isFunction(wo.print_callback) ) {
|
||||
wo.print_callback( c, $table, printStyle );
|
||||
} else {
|
||||
printTable.printOutput(c, $table.html(), printStyle);
|
||||
}
|
||||
|
||||
}, // end process
|
||||
|
||||
printOutput : function(c, data, style) {
|
||||
var wo = c.widgetOptions,
|
||||
generator = window.open('', wo.print_title, 'width=500,height=300'),
|
||||
t = wo.print_title || c.$table.find('caption').text() || c.$table[0].id || document.title || 'table';
|
||||
generator.document.write(
|
||||
'<html><head><title>' + t + '</title>' +
|
||||
( wo.print_styleSheet ? '<link rel="stylesheet" href="' + wo.print_styleSheet + '">' : '' ) +
|
||||
'<style>' + style + '</style>' +
|
||||
'</head><body>' + data + '</body></html>'
|
||||
);
|
||||
generator.document.close();
|
||||
generator.print();
|
||||
generator.close();
|
||||
return true;
|
||||
},
|
||||
|
||||
remove : function(c) {
|
||||
c.$table.off(printTable.event);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: 'print',
|
||||
options: {
|
||||
print_title : '', // this option > caption > table id > "table"
|
||||
print_dataAttrib : 'data-name', // header attrib containing modified header name
|
||||
print_rows : 'filtered', // (a)ll, (v)isible or (f)iltered
|
||||
print_columns : 'selected', // (a)ll or (s)elected (if columnSelector widget is added)
|
||||
print_extraCSS : '', // add any extra css definitions for the popup window here
|
||||
print_styleSheet : '', // add the url of your print stylesheet
|
||||
// callback executed when processing completes
|
||||
// to continue printing, use the following function:
|
||||
// function( config, $table, printStyle ) {
|
||||
// // do something to the table or printStyle string
|
||||
// $.tablesorter.printTable.printOutput( config, $table.html(), printStyle );
|
||||
// }
|
||||
print_callback : null
|
||||
},
|
||||
init: function(table, thisWidget, c) {
|
||||
printTable.init(c);
|
||||
},
|
||||
remove: function(table, c){
|
||||
printTable.remove(c);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
179
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-reflow.js
Executable file
179
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-reflow.js
Executable file
@@ -0,0 +1,179 @@
|
||||
/* table reflow widget (beta) for TableSorter 3/22/2014 (v2.16.0)
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* Also, this widget requires the following default css (modify as desired)
|
||||
|
||||
/ * REQUIRED CSS: change your reflow breakpoint here (35em below) * /
|
||||
@media ( max-width: 35em ) {
|
||||
.ui-table-reflow td,
|
||||
.ui-table-reflow th {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
float: right;
|
||||
/ * if not using the stickyHeaders widget (not the css3 version)
|
||||
* the "!important" flag, and "height: auto" can be removed * /
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
}
|
||||
/ * reflow widget * /
|
||||
.ui-table-reflow tbody td[data-title]:before {
|
||||
color: #469;
|
||||
font-size: .9em;
|
||||
content: attr(data-title);
|
||||
float: left;
|
||||
width: 50%;
|
||||
white-space: pre-wrap;
|
||||
text-align: bottom;
|
||||
display: inline-block;
|
||||
}
|
||||
/ * reflow2 widget * /
|
||||
table.ui-table-reflow .ui-table-cell-label.ui-table-cell-label-top {
|
||||
display: block;
|
||||
padding: .4em 0;
|
||||
margin: .4em 0;
|
||||
text-transform: uppercase;
|
||||
font-size: .9em;
|
||||
font-weight: 400;
|
||||
}
|
||||
table.ui-table-reflow .ui-table-cell-label {
|
||||
padding: .4em;
|
||||
min-width: 30%;
|
||||
display: inline-block;
|
||||
margin: -.4em 1em -.4em -.4em;
|
||||
}
|
||||
}
|
||||
.ui-table-reflow .ui-table-cell-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
var ts = $.tablesorter,
|
||||
|
||||
tablereflow = {
|
||||
// simple reflow
|
||||
// add data-attribute to each cell which shows when media query is active
|
||||
// this widget DOES NOT WORK on a table with multiple thead rows
|
||||
init : function(table, c, wo) {
|
||||
var $this,
|
||||
title = wo.reflow_dataAttrib,
|
||||
header = wo.reflow_headerAttrib,
|
||||
headers = [];
|
||||
c.$table
|
||||
.addClass(wo.reflow_className)
|
||||
.off('refresh.tsreflow updateComplete.tsreflow2')
|
||||
// emulate jQuery Mobile refresh
|
||||
// https://api.jquerymobile.com/table-reflow/#method-refresh
|
||||
.on('refresh.tsreflow updateComplete.tsreflow2', function(){
|
||||
tablereflow.init(table, c, wo);
|
||||
});
|
||||
c.$headers.each(function(){
|
||||
$this = $(this);
|
||||
headers.push( $this.attr(header) || $this.text() );
|
||||
});
|
||||
c.$tbodies.children().each(function(){
|
||||
$(this).children().each(function(i){
|
||||
$(this).attr(title, headers[i]);
|
||||
});
|
||||
});
|
||||
},
|
||||
init2: function(table, c, wo) {
|
||||
var $this, $tbody, i, $hdr, txt, len,
|
||||
cols = c.columns,
|
||||
header = wo.reflow2_headerAttrib,
|
||||
headers = [];
|
||||
c.$table
|
||||
.addClass(wo.reflow2_className)
|
||||
.off('refresh.tsreflow2 updateComplete.tsreflow2')
|
||||
// emulate jQuery Mobile refresh
|
||||
// https://api.jquerymobile.com/table-reflow/#method-refresh
|
||||
.on('refresh.tsreflow2 updateComplete.tsreflow2', function(){
|
||||
tablereflow.init2(table, c, wo);
|
||||
});
|
||||
|
||||
// add <b> to every table cell with thead cell contents
|
||||
for (i = 0; i < cols; i++) {
|
||||
$hdr = c.$headers.filter('[data-column="' + i + '"]');
|
||||
if ($hdr.length > 1) {
|
||||
txt = [];
|
||||
$hdr.each(function(){
|
||||
$this = $(this);
|
||||
if (!$this.hasClass(wo.reflow2_classIgnore)) {
|
||||
txt.push( $this.attr(header) || $this.text() );
|
||||
}
|
||||
});
|
||||
} else {
|
||||
txt = [ $hdr.attr(header) || $hdr.text() ];
|
||||
}
|
||||
headers.push( txt );
|
||||
}
|
||||
// include "remove-me" class so these additional elements are removed before updating
|
||||
txt = '<b class="' + c.selectorRemove.slice(1) + ' ' + wo.reflow2_labelClass;
|
||||
c.$tbodies.children().each(function(){
|
||||
$tbody = ts.processTbody(table, $(this), true);
|
||||
$tbody.children().each(function(j){
|
||||
$this = $(this);
|
||||
len = headers[j].length
|
||||
i = len - 1;
|
||||
while (i >= 0) {
|
||||
$this.prepend(txt + (i === 0 && len > 1 ? ' ' + wo.reflow2_labelTop : '') + '">' + headers[j][i] + '</b>');
|
||||
i--;
|
||||
}
|
||||
});
|
||||
ts.processTbody(table, $tbody, false);
|
||||
});
|
||||
},
|
||||
remove : function(table, c, wo) {
|
||||
c.$table.removeClass(wo.reflow_className);
|
||||
},
|
||||
remove2 : function(table, c, wo) {
|
||||
c.$table.removeClass(wo.reflow2_className);
|
||||
}
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: "reflow",
|
||||
options: {
|
||||
// class name added to make it responsive (class name within media query)
|
||||
reflow_className : 'ui-table-reflow',
|
||||
// header attribute containing modified header name
|
||||
reflow_headerAttrib : 'data-name',
|
||||
// data attribute added to each tbody cell
|
||||
reflow_dataAttrib : 'data-title'
|
||||
},
|
||||
init: function(table, thisWidget, c, wo) {
|
||||
tablereflow.init(table, c, wo);
|
||||
},
|
||||
remove: function(table, c, wo){
|
||||
tablereflow.remove(table, c, wo);
|
||||
}
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: "reflow2",
|
||||
options: {
|
||||
// class name added to make it responsive (class name within media query)
|
||||
reflow2_className : 'ui-table-reflow',
|
||||
// ignore header cell content with this class name
|
||||
reflow2_classIgnore : 'ui-table-reflow-ignore',
|
||||
// header attribute containing modified header name
|
||||
reflow2_headerAttrib : 'data-name',
|
||||
// class name applied to thead labels
|
||||
reflow2_labelClass : 'ui-table-cell-label',
|
||||
// class name applied to first row thead label
|
||||
reflow2_labelTop : 'ui-table-cell-label-top'
|
||||
},
|
||||
init: function(table, thisWidget, c, wo) {
|
||||
tablereflow.init2(table, c, wo);
|
||||
},
|
||||
remove: function(table, c, wo){
|
||||
tablereflow.remove2(table, c, wo);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,50 @@
|
||||
/*! tablesorter repeatHeaders widget - updated 4/12/2013
|
||||
* Requires tablesorter v2.8+ and jQuery 1.7+
|
||||
* Original by Christian Bach from the example-widgets.html demo
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
$.tablesorter.addWidget({
|
||||
id: "repeatHeaders",
|
||||
priority: 10,
|
||||
options: {
|
||||
rowsToSkip : 4
|
||||
},
|
||||
// format is called on init and when a sorting has finished
|
||||
format: function(table, c, wo) {
|
||||
var h = '', i, $tr, l, skip;
|
||||
// cache and collect all TH headers
|
||||
if (!wo.repeatHeaders) {
|
||||
h = '<tr class="repeated-header remove-me">';
|
||||
$.each(c.headerContent, function(i,t) {
|
||||
h += '<th>' + t + '</th>';
|
||||
});
|
||||
// "remove-me" class was added in case the table needs to be updated, the "remove-me" rows will be
|
||||
// removed prior to the update to prevent including the rows in the update - see "selectorRemove" option
|
||||
wo.repeatHeaders = h + '</tr>';
|
||||
}
|
||||
|
||||
// number of rows to skip
|
||||
skip = wo && wo.rowsToSkip || 4;
|
||||
|
||||
// remove appended headers by classname
|
||||
c.$table.find("tr.repeated-header").remove();
|
||||
$tr = c.$tbodies.find('tr');
|
||||
l = $tr.length;
|
||||
// loop all tr elements and insert a copy of the "headers"
|
||||
for (i = skip; i < l; i += skip) {
|
||||
// insert a copy of the table head every X rows
|
||||
$tr.eq(i).before(wo.repeatHeaders);
|
||||
}
|
||||
},
|
||||
// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin
|
||||
// this function only applies to tablesorter v2.4+
|
||||
remove: function(table, c){
|
||||
c.$table.find("tr.repeated-header").remove();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
218
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-scroller.js
Executable file
218
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-scroller.js
Executable file
@@ -0,0 +1,218 @@
|
||||
/*!
|
||||
Copyright (C) 2011 T. Connell & Associates, Inc.
|
||||
|
||||
Dual-licensed under the MIT and GPL licenses
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Resizable scroller widget for the jQuery tablesorter plugin
|
||||
|
||||
Version 2.0 - modified by Rob Garrison 4/12/2013; updated 6/28/2014 (v2.17.3)
|
||||
Requires jQuery v1.7+
|
||||
Requires the tablesorter plugin, v2.8+, available at http://mottie.github.com/tablesorter/docs/
|
||||
|
||||
Usage:
|
||||
|
||||
$(function() {
|
||||
|
||||
$('table.tablesorter').tablesorter({
|
||||
widgets: ['zebra', 'scroller'],
|
||||
widgetOptions : {
|
||||
scroller_height : 300, // height of scroll window
|
||||
scroller_barWidth : 18, // scroll bar width
|
||||
scroller_jumpToHeader : true, // header snap to browser top when scrolling the tbody
|
||||
scroller_idPrefix : 's_' // cloned thead id prefix (random number added to end)
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Website: www.tconnell.com
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
|
||||
$.fn.hasScrollBar = function(){
|
||||
return this.get(0).scrollHeight > this.height();
|
||||
};
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.window_resize = function(){
|
||||
if (this.resize_timer) {
|
||||
clearTimeout(this.resize_timer);
|
||||
}
|
||||
this.resize_timer = setTimeout(function(){
|
||||
$(this).trigger('resizeEnd');
|
||||
}, 250);
|
||||
};
|
||||
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
var s = '<style>' +
|
||||
'.tablesorter-scroller-reset { width: auto !important; } ' +
|
||||
'.tablesorter-scroller { text-align: left; overflow: hidden; }' +
|
||||
'.tablesorter-scroller-header { overflow: hidden; }' +
|
||||
'.tablesorter-scroller-header table.tablesorter { margin-bottom: 0; }' +
|
||||
'.tablesorter-scroller-table { overflow-y: scroll; }' +
|
||||
'.tablesorter-scroller-table table.tablesorter { margin-top: 0; overflow: scroll; } ' +
|
||||
'.tablesorter-scroller-table .tablesorter-filter-row, .tablesorter-scroller-table tfoot { display: none; }' +
|
||||
'.tablesorter-scroller-table table.tablesorter thead tr.tablesorter-headerRow * {' +
|
||||
'line-height:0;height:0;border:none;background-image:none;padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;overflow:hidden;' +
|
||||
'}</style>';
|
||||
$(s).appendTo('body');
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: 'scroller',
|
||||
priority: 60, // run after the filter widget
|
||||
options: {
|
||||
scroller_height : 300,
|
||||
scroller_barWidth : 18,
|
||||
scroller_jumpToHeader: true,
|
||||
scroller_upAfterSort: true,
|
||||
scroller_idPrefix : 's_'
|
||||
},
|
||||
init: function(table, thisWidget, c, wo){
|
||||
var $win = $(window);
|
||||
// Setup window.resizeEnd event
|
||||
$win
|
||||
.bind('resize', ts.window_resize)
|
||||
.bind('resizeEnd', function() {
|
||||
// init is run before format, so scroller_resizeWidth
|
||||
// won't be defined within the "c" or "wo" parameters
|
||||
if (typeof table.config.widgetOptions.scroller_resizeWidth === 'function') {
|
||||
// IE calls resize when you modify content, so we have to unbind the resize event
|
||||
// so we don't end up with an infinite loop. we can rebind after we're done.
|
||||
$win.unbind('resize', ts.window_resize);
|
||||
table.config.widgetOptions.scroller_resizeWidth();
|
||||
$win.bind('resize', ts.window_resize);
|
||||
}
|
||||
});
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
var h, $hdr, id, t, resize, $cells,
|
||||
$win = $(window),
|
||||
$tbl = c.$table;
|
||||
|
||||
if (!c.isScrolling) {
|
||||
h = wo.scroller_height || 300;
|
||||
t = $tbl.find('tbody').height();
|
||||
if (t !== 0 && h > t) { h = t + 10; } // Table is less than h px
|
||||
id = wo.scroller_id = wo.scroller_idPrefix + Math.floor(Math.random() * 1001);
|
||||
|
||||
$hdr = $('<table class="' + $tbl.attr('class') + '" cellpadding=0 cellspacing=0><thead>' + $tbl.find('thead:first').html() + '</thead></table>');
|
||||
$tbl
|
||||
.wrap('<div id="' + id + '" class="tablesorter-scroller" />')
|
||||
.before($hdr)
|
||||
.find('.tablesorter-filter-row').addClass('hideme');
|
||||
|
||||
$cells = $hdr
|
||||
.wrap('<div class="tablesorter-scroller-header" style="width:' + $tbl.width() + ';" />')
|
||||
.find('.' + ts.css.header);
|
||||
|
||||
$tbl.wrap('<div class="tablesorter-scroller-table" style="height:' + h + 'px;width:' + $tbl.width() + ';" />');
|
||||
|
||||
// make scroller header sortable
|
||||
ts.bindEvents(table, $cells);
|
||||
|
||||
// look for filter widget
|
||||
if ($tbl.hasClass('hasFilters')) {
|
||||
ts.filter.bindSearch( $tbl, $hdr.find('.' + ts.css.filter) );
|
||||
}
|
||||
|
||||
resize = function(){
|
||||
var d, b, $h, $th, w,
|
||||
// Hide other scrollers so we can resize
|
||||
$div = $('div.scroller[id != "' + id + '"]').hide();
|
||||
|
||||
$tbl.find('thead').show();
|
||||
|
||||
// Reset sizes so parent can resize.
|
||||
$tbl
|
||||
.addClass('tablesorter-scroller-reset')
|
||||
.find('thead').find('.tablesorter-header-inner').addClass('tablesorter-scroller-reset');
|
||||
d = $tbl.parent();
|
||||
d.addClass('tablesorter-scroller-reset');
|
||||
|
||||
d.parent().trigger('resize');
|
||||
|
||||
// Shrink a bit to accommodate scrollbar
|
||||
d.width( d.parent().innerWidth() - ( d.parent().hasScrollBar() ? wo.scroller_barWidth : 0 ) );
|
||||
w = d.innerWidth() - ( d.hasScrollBar() ? wo.scroller_barWidth : 0 );
|
||||
$tbl.width( w );
|
||||
$hdr.width( w );
|
||||
$hdr.parent().width( w );
|
||||
|
||||
$tbl.closest('.tablesorter-scroller').find('.tablesorter-scroller-reset').removeClass('tablesorter-scroller-reset');
|
||||
|
||||
// include left & right border widths
|
||||
b = parseInt( $tbl.css('border-left-width'), 10 ) + parseInt( $tbl.css('border-right-width'), 10 );
|
||||
$h = $hdr.find('thead').children().children();
|
||||
|
||||
// adjust cloned header to match original table width - includes wrappers, headers, and header inner div
|
||||
$tbl.find('thead').children().children().each(function(i, c){
|
||||
$th = $(c).find('.tablesorter-header-inner');
|
||||
if ($th.length) {
|
||||
// I have no idea why this is in here anymore LOL
|
||||
w = parseInt( $th.css('min-width').replace('auto', '0').replace(/(px|em)/, ''), 10 );
|
||||
if ( $th.width() < w ) {
|
||||
$th.width(w);
|
||||
} else {
|
||||
w = $th.width();
|
||||
}
|
||||
$h.eq(i)
|
||||
.find('.tablesorter-header-inner').width(w - b)
|
||||
// set inner width first
|
||||
.parent()
|
||||
.width( $th.parent().width() - b );
|
||||
}
|
||||
});
|
||||
|
||||
$div.show();
|
||||
};
|
||||
|
||||
// Expose to external calls
|
||||
wo.scroller_resizeWidth = resize;
|
||||
|
||||
resize();
|
||||
|
||||
$tbl.find('thead').css('visibility', 'hidden');
|
||||
c.isScrolling = true;
|
||||
|
||||
t = $tbl.parent().parent().height();
|
||||
|
||||
// The header will always jump into view if scrolling the table body
|
||||
$tbl.parent().bind('scroll', function(){
|
||||
if (wo.scroller_jumpToHeader) {
|
||||
var pos = $win.scrollTop() - $hdr.offset().top;
|
||||
if ($(this).scrollTop() !== 0 && pos < t && pos > 0) {
|
||||
$win.scrollTop( $hdr.offset().top );
|
||||
}
|
||||
}
|
||||
$hdr.parent().scrollLeft( $(this).scrollLeft() );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Sorting, so scroll to top
|
||||
if (wo.scroller_upAfterSort) {
|
||||
$tbl.parent().animate({ scrollTop: 0 }, 'fast');
|
||||
}
|
||||
|
||||
},
|
||||
remove : function(table, c, wo){
|
||||
var $table = c.$table;
|
||||
$table.closest('.tablesorter-scroller').find('.tablesorter-scroller-header').remove();
|
||||
$table
|
||||
.unwrap()
|
||||
.find('.tablesorter-filter-row').removeClass('hideme').end()
|
||||
.find('thead').show().css('visibility', 'visible');
|
||||
c.isScrolling = false;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
124
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-staticRow.js
Executable file
124
modules/EcmReportsBackUp20151106/TableSorterNew/js/widgets/widget-staticRow.js
Executable file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* StaticRow widget for jQuery TableSorter 2.0
|
||||
* Version 1.2 - modified by Rob Garrison (6/28/2014 for tablesorter v2.16.1-beta+)
|
||||
* Requires:
|
||||
* jQuery v1.4+
|
||||
* tablesorter plugin, v2.8+, available at http://mottie.github.com/tablesorter/docs/
|
||||
*
|
||||
* Copyright (c) 2011 Nils Luxton
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter,
|
||||
|
||||
// events triggered on the table that update this widget
|
||||
events = 'staticRowsRefresh updateComplete '.split(' ').join('.tsstaticrows '),
|
||||
|
||||
// add/refresh row indexes
|
||||
addIndexes = function(table){
|
||||
var $tr, wo, v, indx, rows,
|
||||
c = table.config;
|
||||
// "Index" the static rows, saving their current (starting) position in the
|
||||
// table inside a data() param on the <tr> element itself for later use.
|
||||
if (c) {
|
||||
wo = c.widgetOptions;
|
||||
c.$tbodies.each(function(){
|
||||
$tr = $(this).children();
|
||||
rows = $tr.length;
|
||||
$tr.filter(wo.staticRow_class).each(function() {
|
||||
$tr = $(this);
|
||||
indx = $tr.data(wo.staticRow_index);
|
||||
if (typeof indx !== "undefined") {
|
||||
v = parseFloat(indx);
|
||||
// percentage of total rows
|
||||
indx = (/%/.test(indx)) ? Math.round(v/100 * rows) : v;
|
||||
} else {
|
||||
indx = $tr.index();
|
||||
}
|
||||
// row indexing starts over within each tbody
|
||||
$tr.data( wo.staticRow_data, indx );
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
// Give the new Widget an ID to be used in the tablesorter() call, as follows:
|
||||
// $('#myElement').tablesorter({ widgets: ['zebra', 'staticRow'] });
|
||||
id: 'staticRow',
|
||||
|
||||
options: {
|
||||
staticRow_class : '.static',
|
||||
staticRow_data : 'static-index',
|
||||
staticRow_index : 'row-index'
|
||||
},
|
||||
|
||||
init: function(table, thisWidget, c, wo){
|
||||
addIndexes(table);
|
||||
// refresh static rows after updates
|
||||
c.$table
|
||||
.unbind(events)
|
||||
.bind(events, function(){
|
||||
addIndexes(table);
|
||||
c.$table.trigger('applyWidgets');
|
||||
});
|
||||
},
|
||||
|
||||
format: function(table, c, wo) {
|
||||
// Loop thru static rows, moving them to their original "indexed" position,
|
||||
// & repeat until no more re-shuffling is needed
|
||||
var targetIndex, $thisRow, indx, numRows, $tbody, hasShuffled, $rows, max;
|
||||
|
||||
c.$tbodies.each(function(){
|
||||
$tbody = $.tablesorter.processTbody(table, $(this), true); // remove tbody
|
||||
hasShuffled = true;
|
||||
indx = 0;
|
||||
$rows = $tbody.children(wo.staticRow_class);
|
||||
numRows = $tbody.children('tr').length - 1;
|
||||
max = $rows.length;
|
||||
|
||||
// don't allow the while loop to cycle more times than the set number of static rows
|
||||
while (hasShuffled && indx < max) {
|
||||
hasShuffled = false;
|
||||
/*jshint loopfunc:true */
|
||||
$rows.each(function() {
|
||||
targetIndex = $(this).data(wo.staticRow_data);
|
||||
// allow setting target index >> num rows to always make a row last
|
||||
targetIndex = targetIndex >= numRows ? numRows : targetIndex < 0 ? 0 : targetIndex;
|
||||
if (targetIndex !== $(this).index()) {
|
||||
hasShuffled = true;
|
||||
$thisRow = $(this).detach();
|
||||
|
||||
if (targetIndex >= numRows) {
|
||||
// Are we trying to be the last row?
|
||||
$thisRow.appendTo( $tbody );
|
||||
} else if (targetIndex === 0) {
|
||||
// Are we trying to be the first row?
|
||||
$thisRow.prependTo( $tbody );
|
||||
} else {
|
||||
// No, we want to be somewhere in the middle!
|
||||
$thisRow.insertBefore( $tbody.find('tr:eq(' + targetIndex + ')') );
|
||||
}
|
||||
}
|
||||
});
|
||||
indx++;
|
||||
}
|
||||
|
||||
$.tablesorter.processTbody(table, $tbody, false); // restore tbody
|
||||
});
|
||||
|
||||
c.$table.trigger('staticRowsComplete', table);
|
||||
},
|
||||
|
||||
remove : function(table, c, wo){
|
||||
c.$table.unbind(events);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
60570
modules/EcmReportsBackUp20151106/TableSorterNew/testing/jshint-2.4.4.js
Executable file
60570
modules/EcmReportsBackUp20151106/TableSorterNew/testing/jshint-2.4.4.js
Executable file
File diff suppressed because it is too large
Load Diff
2288
modules/EcmReportsBackUp20151106/TableSorterNew/testing/qunit-1.14.0.js
Executable file
2288
modules/EcmReportsBackUp20151106/TableSorterNew/testing/qunit-1.14.0.js
Executable file
File diff suppressed because it is too large
Load Diff
590
modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing-ipv6.js
Executable file
590
modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing-ipv6.js
Executable file
@@ -0,0 +1,590 @@
|
||||
var ipv6parser = $.tablesorter.getParserById('ipv6Address').format,
|
||||
ipv6regex = $.tablesorter.regex.ipv6Validate,
|
||||
ipv6test = function(result, str, expect){
|
||||
if (result) {
|
||||
// ok( $.tablesorter.regex.ipv6Validate.test(str), "valid: " + str );
|
||||
// second parameter = true, so we get the hex format (false or undefined returns decimal)
|
||||
var t = ipv6parser(str, true);
|
||||
equal( t, expect, 'valid: ' + t + ' \u2190 "' + str + '"' );
|
||||
} else {
|
||||
ok( !ipv6regex.test(str), 'invalid: "' + str + '"' );
|
||||
}
|
||||
},
|
||||
ipv6tests = function(){
|
||||
|
||||
test( "ipv6 parser", function() {
|
||||
expect(483);
|
||||
|
||||
// IPV6 tests by Rich Brown copied from http:// download.dartware.com/thirdparty/test-ipv6-regex.pl
|
||||
// modified to compare to canonical ipv6 output using http://www.v6decode.com/ to produce the result
|
||||
ipv6test(!1,""); // empty string
|
||||
ipv6test(1,"::1", "0000:0000:0000:0000:0000:0000:0000:0001"); // loopback, compressed, non-routable
|
||||
ipv6test(1,"::", "0000:0000:0000:0000:0000:0000:0000:0000"); // unspecified, compressed, non-routable
|
||||
ipv6test(1,"0:0:0:0:0:0:0:1", "0000:0000:0000:0000:0000:0000:0000:0001"); // loopback, full
|
||||
ipv6test(1,"0:0:0:0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000"); // unspecified, full
|
||||
ipv6test(1,"2001:db8:0:0:8:800:200c:417a", "2001:0db8:0000:0000:0008:0800:200c:417a"); // unicast, full
|
||||
ipv6test(1,"ff01:0:0:0:0:0:0:101", "ff01:0000:0000:0000:0000:0000:0000:0101"); // multicast, full
|
||||
ipv6test(1,"2001:db8::8:800:200c:417a", "2001:0db8:0000:0000:0008:0800:200c:417a"); // unicast, compressed
|
||||
ipv6test(1,"ff01::101", "ff01:0000:0000:0000:0000:0000:0000:0101"); // multicast, compressed
|
||||
ipv6test(!1,"2001:db8:0:0:8:800:200c:417a:221"); // unicast, full
|
||||
ipv6test(!1,"ff01::101::2"); // multicast, compressed
|
||||
ipv6test(1,"fe80::217:f2ff:fe07:ed62", "fe80:0000:0000:0000:0217:f2ff:fe07:ed62");
|
||||
|
||||
ipv6test(1,"2001:0000:1234:0000:0000:c1c0:abcd:0876", "2001:0000:1234:0000:0000:c1c0:abcd:0876");
|
||||
ipv6test(1,"3ffe:0b00:0000:0000:0001:0000:0000:000a", "3ffe:0b00:0000:0000:0001:0000:0000:000a");
|
||||
ipv6test(1,"ff02:0000:0000:0000:0000:0000:0000:0001", "ff02:0000:0000:0000:0000:0000:0000:0001");
|
||||
ipv6test(1,"0000:0000:0000:0000:0000:0000:0000:0001", "0000:0000:0000:0000:0000:0000:0000:0001");
|
||||
ipv6test(1,"0000:0000:0000:0000:0000:0000:0000:0000", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(!1,"02001:0000:1234:0000:0000:c1c0:abcd:0876"); // extra 0 not allowed!
|
||||
ipv6test(!1,"2001:0000:1234:0000:00001:c1c0:abcd:0876"); // extra 0 not allowed!
|
||||
// ipv6test(1," 2001:0000:1234:0000:0000:c1c0:abcd:0876"); // leading space
|
||||
// ipv6test(1,"2001:0000:1234:0000:0000:c1c0:abcd:0876"); // trailing space
|
||||
// ipv6test(1," 2001:0000:1234:0000:0000:c1c0:abcd:0876 "); // leading and trailing space
|
||||
ipv6test(!1,"2001:0000:1234:0000:0000:c1c0:abcd:0876 0"); // junk after valid address
|
||||
ipv6test(!1,"2001:0000:1234: 0000:0000:c1c0:abcd:0876"); // internal space
|
||||
|
||||
ipv6test(!1,"3ffe:0b00:0000:0001:0000:0000:000a"); // seven segments
|
||||
ipv6test(!1,"ff02:0000:0000:0000:0000:0000:0000:0000:0001"); // nine segments
|
||||
ipv6test(!1,"3ffe:b00::1::a"); // double "::"
|
||||
ipv6test(!1,"::1111:2222:3333:4444:5555:6666::"); // double "::"
|
||||
ipv6test(1,"2::10", "0002:0000:0000:0000:0000:0000:0000:0010");
|
||||
ipv6test(1,"ff02::1", "ff02:0000:0000:0000:0000:0000:0000:0001");
|
||||
ipv6test(1,"fe80::", "fe80:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"2002::", "2002:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"2001:db8::", "2001:0db8:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"2001:0db8:1234::", "2001:0db8:1234:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"::ffff:0:0", "0000:0000:0000:0000:0000:ffff:0000:0000");
|
||||
ipv6test(1,"1:2:3:4:5:6:7:8", "0001:0002:0003:0004:0005:0006:0007:0008");
|
||||
ipv6test(1,"1:2:3:4:5:6::8", "0001:0002:0003:0004:0005:0006:0000:0008");
|
||||
ipv6test(1,"1:2:3:4:5::8", "0001:0002:0003:0004:0005:0000:0000:0008");
|
||||
ipv6test(1,"1:2:3:4::8", "0001:0002:0003:0004:0000:0000:0000:0008");
|
||||
ipv6test(1,"1:2:3::8", "0001:0002:0003:0000:0000:0000:0000:0008");
|
||||
ipv6test(1,"1:2::8", "0001:0002:0000:0000:0000:0000:0000:0008");
|
||||
ipv6test(1,"1::8", "0001:0000:0000:0000:0000:0000:0000:0008");
|
||||
ipv6test(1,"1::2:3:4:5:6:7", "0001:0000:0002:0003:0004:0005:0006:0007");
|
||||
ipv6test(1,"1::2:3:4:5:6", "0001:0000:0000:0002:0003:0004:0005:0006");
|
||||
ipv6test(1,"1::2:3:4:5", "0001:0000:0000:0000:0002:0003:0004:0005");
|
||||
ipv6test(1,"1::2:3:4", "0001:0000:0000:0000:0000:0002:0003:0004");
|
||||
ipv6test(1,"1::2:3", "0001:0000:0000:0000:0000:0000:0002:0003");
|
||||
ipv6test(1,"1::8", "0001:0000:0000:0000:0000:0000:0000:0008");
|
||||
ipv6test(1,"::2:3:4:5:6:7:8", "0000:0002:0003:0004:0005:0006:0007:0008");
|
||||
ipv6test(1,"::2:3:4:5:6:7", "0000:0000:0002:0003:0004:0005:0006:0007");
|
||||
ipv6test(1,"::2:3:4:5:6", "0000:0000:0000:0002:0003:0004:0005:0006");
|
||||
ipv6test(1,"::2:3:4:5", "0000:0000:0000:0000:0002:0003:0004:0005");
|
||||
ipv6test(1,"::2:3:4", "0000:0000:0000:0000:0000:0002:0003:0004");
|
||||
ipv6test(1,"::2:3", "0000:0000:0000:0000:0000:0000:0002:0003");
|
||||
ipv6test(1,"::8", "0000:0000:0000:0000:0000:0000:0000:0008");
|
||||
ipv6test(1,"1:2:3:4:5:6::", "0001:0002:0003:0004:0005:0006:0000:0000");
|
||||
ipv6test(1,"1:2:3:4:5::", "0001:0002:0003:0004:0005:0000:0000:0000");
|
||||
ipv6test(1,"1:2:3:4::", "0001:0002:0003:0004:0000:0000:0000:0000");
|
||||
ipv6test(1,"1:2:3::", "0001:0002:0003:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"1:2::", "0001:0002:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"1::", "0001:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"1:2:3:4:5::7:8", "0001:0002:0003:0004:0005:0000:0007:0008");
|
||||
ipv6test(!1,"1:2:3::4:5::7:8"); // double "::"
|
||||
ipv6test(!1,"12345::6:7:8");
|
||||
ipv6test(1,"1:2:3:4::7:8", "0001:0002:0003:0004:0000:0000:0007:0008");
|
||||
ipv6test(1,"1:2:3::7:8", "0001:0002:0003:0000:0000:0000:0007:0008");
|
||||
ipv6test(1,"1:2::7:8", "0001:0002:0000:0000:0000:0000:0007:0008");
|
||||
ipv6test(1,"1::7:8", "0001:0000:0000:0000:0000:0000:0007:0008");
|
||||
|
||||
// ipv4 addresses as dotted-quads
|
||||
ipv6test(1,"1:2:3:4:5:6:1.2.3.4", "0001:0002:0003:0004:0005:0006:0102:0304");
|
||||
ipv6test(1,"1:2:3:4:5::1.2.3.4", "0001:0002:0003:0004:0005:0000:0102:0304");
|
||||
ipv6test(1,"1:2:3:4::1.2.3.4", "0001:0002:0003:0004:0000:0000:0102:0304");
|
||||
ipv6test(1,"1:2:3::1.2.3.4", "0001:0002:0003:0000:0000:0000:0102:0304");
|
||||
ipv6test(1,"1:2::1.2.3.4", "0001:0002:0000:0000:0000:0000:0102:0304");
|
||||
ipv6test(1,"1::1.2.3.4", "0001:0000:0000:0000:0000:0000:0102:0304");
|
||||
ipv6test(1,"1:2:3:4::5:1.2.3.4", "0001:0002:0003:0004:0000:0005:0102:0304");
|
||||
ipv6test(1,"1:2:3::5:1.2.3.4", "0001:0002:0003:0000:0000:0005:0102:0304");
|
||||
ipv6test(1,"1:2::5:1.2.3.4", "0001:0002:0000:0000:0000:0005:0102:0304");
|
||||
ipv6test(1,"1::5:1.2.3.4", "0001:0000:0000:0000:0000:0005:0102:0304");
|
||||
ipv6test(1,"1::5:11.22.33.44", "0001:0000:0000:0000:0000:0005:0b16:212c");
|
||||
ipv6test(!1,"1::5:400.2.3.4");
|
||||
ipv6test(!1,"1::5:260.2.3.4");
|
||||
ipv6test(!1,"1::5:256.2.3.4");
|
||||
ipv6test(!1,"1::5:1.256.3.4");
|
||||
ipv6test(!1,"1::5:1.2.256.4");
|
||||
ipv6test(!1,"1::5:1.2.3.256");
|
||||
ipv6test(!1,"1::5:300.2.3.4");
|
||||
ipv6test(!1,"1::5:1.300.3.4");
|
||||
ipv6test(!1,"1::5:1.2.300.4");
|
||||
ipv6test(!1,"1::5:1.2.3.300");
|
||||
ipv6test(!1,"1::5:900.2.3.4");
|
||||
ipv6test(!1,"1::5:1.900.3.4");
|
||||
ipv6test(!1,"1::5:1.2.900.4");
|
||||
ipv6test(!1,"1::5:1.2.3.900");
|
||||
ipv6test(!1,"1::5:300.300.300.300");
|
||||
ipv6test(!1,"1::5:3000.30.30.30");
|
||||
ipv6test(!1,"1::400.2.3.4");
|
||||
ipv6test(!1,"1::260.2.3.4");
|
||||
ipv6test(!1,"1::256.2.3.4");
|
||||
ipv6test(!1,"1::1.256.3.4");
|
||||
ipv6test(!1,"1::1.2.256.4");
|
||||
ipv6test(!1,"1::1.2.3.256");
|
||||
ipv6test(!1,"1::300.2.3.4");
|
||||
ipv6test(!1,"1::1.300.3.4");
|
||||
ipv6test(!1,"1::1.2.300.4");
|
||||
ipv6test(!1,"1::1.2.3.300");
|
||||
ipv6test(!1,"1::900.2.3.4");
|
||||
ipv6test(!1,"1::1.900.3.4");
|
||||
ipv6test(!1,"1::1.2.900.4");
|
||||
ipv6test(!1,"1::1.2.3.900");
|
||||
ipv6test(!1,"1::300.300.300.300");
|
||||
ipv6test(!1,"1::3000.30.30.30");
|
||||
ipv6test(!1,"::400.2.3.4");
|
||||
ipv6test(!1,"::260.2.3.4");
|
||||
ipv6test(!1,"::256.2.3.4");
|
||||
ipv6test(!1,"::1.256.3.4");
|
||||
ipv6test(!1,"::1.2.256.4");
|
||||
ipv6test(!1,"::1.2.3.256");
|
||||
ipv6test(!1,"::300.2.3.4");
|
||||
ipv6test(!1,"::1.300.3.4");
|
||||
ipv6test(!1,"::1.2.300.4");
|
||||
ipv6test(!1,"::1.2.3.300");
|
||||
ipv6test(!1,"::900.2.3.4");
|
||||
ipv6test(!1,"::1.900.3.4");
|
||||
ipv6test(!1,"::1.2.900.4");
|
||||
ipv6test(!1,"::1.2.3.900");
|
||||
ipv6test(!1,"::300.300.300.300");
|
||||
ipv6test(!1,"::3000.30.30.30");
|
||||
ipv6test(1,"fe80::217:f2ff:254.7.237.98", "fe80:0000:0000:0000:0217:f2ff:fe07:ed62");
|
||||
ipv6test(1,"::ffff:192.168.1.26", "0000:0000:0000:0000:0000:ffff:c0a8:011a");
|
||||
ipv6test(!1,"2001:1:1:1:1:1:255z255x255y255"); // garbage instead of "." in ipv4
|
||||
ipv6test(!1,"::ffff:192x168.1.26"); // ditto
|
||||
ipv6test(1,"::ffff:192.168.1.1", "0000:0000:0000:0000:0000:ffff:c0a8:0101");
|
||||
ipv6test(1,"0:0:0:0:0:0:13.1.68.3", "0000:0000:0000:0000:0000:0000:0d01:4403"); // ipv4-compatible ipv6 address, full, deprecated
|
||||
ipv6test(1,"0:0:0:0:0:ffff:129.144.52.38", "0000:0000:0000:0000:0000:ffff:8190:3426"); // ipv4-mapped ipv6 address, full
|
||||
ipv6test(1,"::13.1.68.3", "0000:0000:0000:0000:0000:0000:0d01:4403"); // ipv4-compatible ipv6 address, compressed, deprecated
|
||||
ipv6test(1,"::ffff:129.144.52.38", "0000:0000:0000:0000:0000:ffff:8190:3426"); // ipv4-mapped ipv6 address, compressed
|
||||
ipv6test(1,"fe80:0:0:0:204:61ff:254.157.241.86", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
|
||||
ipv6test(1,"fe80::204:61ff:254.157.241.86", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
|
||||
ipv6test(1,"::ffff:12.34.56.78", "0000:0000:0000:0000:0000:ffff:0c22:384e");
|
||||
ipv6test(!1,"::ffff:2.3.4");
|
||||
ipv6test(!1,"::ffff:257.1.2.3");
|
||||
ipv6test(!1,"1.2.3.4");
|
||||
|
||||
ipv6test(!1,"1.2.3.4:1111:2222:3333:4444::5555"); // aeron
|
||||
ipv6test(!1,"1.2.3.4:1111:2222:3333::5555");
|
||||
ipv6test(!1,"1.2.3.4:1111:2222::5555");
|
||||
ipv6test(!1,"1.2.3.4:1111::5555");
|
||||
ipv6test(!1,"1.2.3.4::5555");
|
||||
ipv6test(!1,"1.2.3.4::");
|
||||
|
||||
// testing ipv4 addresses represented as dotted-quads
|
||||
// leading zero's in ipv4 addresses not allowed: some systems treat the leading "0" in ".086" as the start of an octal number
|
||||
// update: the bnf in rfc-3986 explicitly defines the dec-octet (for ipv4 addresses) not to have a leading zero
|
||||
ipv6test(!1,"fe80:0000:0000:0000:0204:61ff:254.157.241.086");
|
||||
ipv6test(1,"::ffff:192.0.2.128", "0000:0000:0000:0000:0000:ffff:c000:0280"); // but this is ok, since there's a single digit
|
||||
ipv6test(!1,"xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:00.00.00.00");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:000.000.000.000");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:256.256.256.256");
|
||||
|
||||
// not testing address with subnet mask
|
||||
// ipv6test(1,"2001:0db8:0000:cd30:0000:0000:0000:0000/60"); // full, with prefix
|
||||
// ipv6test(1,"2001:0db8::cd30:0:0:0:0/60"); // compressed, with prefix
|
||||
// ipv6test(1,"2001:0db8:0:cd30::/60"); // compressed, with prefix // 2
|
||||
// ipv6test(1,"::/128"); // compressed, unspecified address type, non-routable
|
||||
// ipv6test(1,"::1/128"); // compressed, loopback address type, non-routable
|
||||
// ipv6test(1,"ff00::/8"); // compressed, multicast address type
|
||||
// ipv6test(1,"fe80::/10"); // compressed, link-local unicast, non-routable
|
||||
// ipv6test(1,"fec0::/10"); // compressed, site-local unicast, deprecated
|
||||
// ipv6test(!1,"124.15.6.89/60"); // standard ipv4, prefix not allowed
|
||||
|
||||
ipv6test(1,"fe80:0000:0000:0000:0204:61ff:fe9d:f156", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
|
||||
ipv6test(1,"fe80:0:0:0:204:61ff:fe9d:f156", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
|
||||
ipv6test(1,"fe80::204:61ff:fe9d:f156", "fe80:0000:0000:0000:0204:61ff:fe9d:f156");
|
||||
ipv6test(1,"fe80::", "fe80:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"fe80::1", "fe80:0000:0000:0000:0000:0000:0000:0001");
|
||||
ipv6test(!1,":");
|
||||
ipv6test(1,"::ffff:c000:280", "0000:0000:0000:0000:0000:ffff:c000:0280");
|
||||
|
||||
// aeron supplied these test cases
|
||||
ipv6test(!1,"1111:2222:3333:4444::5555:");
|
||||
ipv6test(!1,"1111:2222:3333::5555:");
|
||||
ipv6test(!1,"1111:2222::5555:");
|
||||
ipv6test(!1,"1111::5555:");
|
||||
ipv6test(!1,"::5555:");
|
||||
ipv6test(!1,":::");
|
||||
ipv6test(!1,"1111:");
|
||||
ipv6test(!1,":");
|
||||
|
||||
ipv6test(!1,":1111:2222:3333:4444::5555");
|
||||
ipv6test(!1,":1111:2222:3333::5555");
|
||||
ipv6test(!1,":1111:2222::5555");
|
||||
ipv6test(!1,":1111::5555");
|
||||
ipv6test(!1,":::5555");
|
||||
ipv6test(!1,":::");
|
||||
|
||||
|
||||
// additional test cases
|
||||
// from http:// rt.cpan.org/public/bug/display.html?id=50693
|
||||
|
||||
ipv6test(1,"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
|
||||
ipv6test(1,"2001:db8:85a3:0:0:8a2e:370:7334", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
|
||||
ipv6test(1,"2001:db8:85a3::8a2e:370:7334", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
|
||||
ipv6test(1,"2001:0db8:0000:0000:0000:0000:1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
|
||||
ipv6test(1,"2001:0db8:0000:0000:0000::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
|
||||
ipv6test(1,"2001:0db8:0:0:0:0:1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
|
||||
ipv6test(1,"2001:0db8:0:0::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
|
||||
ipv6test(1,"2001:0db8::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
|
||||
ipv6test(1,"2001:db8::1428:57ab", "2001:0db8:0000:0000:0000:0000:1428:57ab");
|
||||
ipv6test(1,"0000:0000:0000:0000:0000:0000:0000:0001", "0000:0000:0000:0000:0000:0000:0000:0001");
|
||||
ipv6test(1,"::ffff:0c22:384e", "0000:0000:0000:0000:0000:ffff:0c22:384e");
|
||||
ipv6test(1,"2001:0db8:1234:0000:0000:0000:0000:0000", "2001:0db8:1234:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"2001:0db8:1234:ffff:ffff:ffff:ffff:ffff", "2001:0db8:1234:ffff:ffff:ffff:ffff:ffff");
|
||||
ipv6test(1,"2001:db8:a::123", "2001:0db8:000a:0000:0000:0000:0000:0123");
|
||||
ipv6test(1,"fe80::", "fe80:0000:0000:0000:0000:0000:0000:0000");
|
||||
|
||||
ipv6test(!1,"123");
|
||||
ipv6test(!1,"ldkfj");
|
||||
ipv6test(!1,"2001::ffd3::57ab");
|
||||
ipv6test(!1,"2001:db8:85a3::8a2e:37023:7334");
|
||||
ipv6test(!1,"2001:db8:85a3::8a2e:370k:7334");
|
||||
ipv6test(!1,"1:2:3:4:5:6:7:8:9");
|
||||
ipv6test(!1,"1::2::3");
|
||||
ipv6test(!1,"1:::3:4:5");
|
||||
ipv6test(!1,"1:2:3::4:5:6:7:8:9");
|
||||
|
||||
// new from aeron
|
||||
ipv6test(1,"1111:2222:3333:4444:5555:6666:7777:8888", "1111:2222:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(1,"1111:2222:3333:4444:5555:6666:7777::", "1111:2222:3333:4444:5555:6666:7777:0000");
|
||||
ipv6test(1,"1111:2222:3333:4444:5555:6666::", "1111:2222:3333:4444:5555:6666:0000:0000");
|
||||
ipv6test(1,"1111:2222:3333:4444:5555::", "1111:2222:3333:4444:5555:0000:0000:0000");
|
||||
ipv6test(1,"1111:2222:3333:4444::", "1111:2222:3333:4444:0000:0000:0000:0000");
|
||||
ipv6test(1,"1111:2222:3333::", "1111:2222:3333:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"1111:2222::", "1111:2222:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"1111::", "1111:0000:0000:0000:0000:0000:0000:0000");
|
||||
// ipv6test(1,"::", ""); // duplicate
|
||||
ipv6test(1,"1111:2222:3333:4444:5555:6666::8888", "1111:2222:3333:4444:5555:6666:0000:8888");
|
||||
ipv6test(1,"1111:2222:3333:4444:5555::8888", "1111:2222:3333:4444:5555:0000:0000:8888");
|
||||
ipv6test(1,"1111:2222:3333:4444::8888", "1111:2222:3333:4444:0000:0000:0000:8888");
|
||||
ipv6test(1,"1111:2222:3333::8888", "1111:2222:3333:0000:0000:0000:0000:8888");
|
||||
ipv6test(1,"1111:2222::8888", "1111:2222:0000:0000:0000:0000:0000:8888");
|
||||
ipv6test(1,"1111::8888", "1111:0000:0000:0000:0000:0000:0000:8888");
|
||||
ipv6test(1,"::8888", "0000:0000:0000:0000:0000:0000:0000:8888");
|
||||
ipv6test(1,"1111:2222:3333:4444:5555::7777:8888", "1111:2222:3333:4444:5555:0000:7777:8888");
|
||||
ipv6test(1,"1111:2222:3333:4444::7777:8888", "1111:2222:3333:4444:0000:0000:7777:8888");
|
||||
ipv6test(1,"1111:2222:3333::7777:8888", "1111:2222:3333:0000:0000:0000:7777:8888");
|
||||
ipv6test(1,"1111:2222::7777:8888", "1111:2222:0000:0000:0000:0000:7777:8888");
|
||||
ipv6test(1,"1111::7777:8888", "1111:0000:0000:0000:0000:0000:7777:8888");
|
||||
ipv6test(1,"::7777:8888", "0000:0000:0000:0000:0000:0000:7777:8888");
|
||||
ipv6test(1,"1111:2222:3333:4444::6666:7777:8888", "1111:2222:3333:4444:0000:6666:7777:8888");
|
||||
ipv6test(1,"1111:2222:3333::6666:7777:8888", "1111:2222:3333:0000:0000:6666:7777:8888");
|
||||
ipv6test(1,"1111:2222::6666:7777:8888", "1111:2222:0000:0000:0000:6666:7777:8888");
|
||||
ipv6test(1,"1111::6666:7777:8888", "1111:0000:0000:0000:0000:6666:7777:8888");
|
||||
ipv6test(1,"::6666:7777:8888", "0000:0000:0000:0000:0000:6666:7777:8888");
|
||||
ipv6test(1,"1111:2222:3333::5555:6666:7777:8888", "1111:2222:3333:0000:5555:6666:7777:8888");
|
||||
ipv6test(1,"1111:2222::5555:6666:7777:8888", "1111:2222:0000:0000:5555:6666:7777:8888");
|
||||
ipv6test(1,"1111::5555:6666:7777:8888", "1111:0000:0000:0000:5555:6666:7777:8888");
|
||||
ipv6test(1,"::5555:6666:7777:8888", "0000:0000:0000:0000:5555:6666:7777:8888");
|
||||
ipv6test(1,"1111:2222::4444:5555:6666:7777:8888", "1111:2222:0000:4444:5555:6666:7777:8888");
|
||||
ipv6test(1,"1111::4444:5555:6666:7777:8888", "1111:0000:0000:4444:5555:6666:7777:8888");
|
||||
ipv6test(1,"::4444:5555:6666:7777:8888", "0000:0000:0000:4444:5555:6666:7777:8888");
|
||||
ipv6test(1,"1111::3333:4444:5555:6666:7777:8888", "1111:0000:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(1,"::3333:4444:5555:6666:7777:8888", "0000:0000:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(1,"::2222:3333:4444:5555:6666:7777:8888", "0000:2222:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(1,"1111:2222:3333:4444:5555:6666:123.123.123.123", "1111:2222:3333:4444:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222:3333:4444:5555::123.123.123.123", "1111:2222:3333:4444:5555:0000:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222:3333:4444::123.123.123.123", "1111:2222:3333:4444:0000:0000:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222:3333::123.123.123.123", "1111:2222:3333:0000:0000:0000:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222::123.123.123.123", "1111:2222:0000:0000:0000:0000:7b7b:7b7b");
|
||||
ipv6test(1,"1111::123.123.123.123", "1111:0000:0000:0000:0000:0000:7b7b:7b7b");
|
||||
ipv6test(1,"::123.123.123.123", "0000:0000:0000:0000:0000:0000:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222:3333:4444::6666:123.123.123.123", "1111:2222:3333:4444:0000:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222:3333::6666:123.123.123.123", "1111:2222:3333:0000:0000:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222::6666:123.123.123.123", "1111:2222:0000:0000:0000:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111::6666:123.123.123.123", "1111:0000:0000:0000:0000:6666:7b7b:7b7b");
|
||||
ipv6test(1,"::6666:123.123.123.123", "0000:0000:0000:0000:0000:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222:3333::5555:6666:123.123.123.123", "1111:2222:3333:0000:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222::5555:6666:123.123.123.123", "1111:2222:0000:0000:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111::5555:6666:123.123.123.123", "1111:0000:0000:0000:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"::5555:6666:123.123.123.123", "0000:0000:0000:0000:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111:2222::4444:5555:6666:123.123.123.123", "1111:2222:0000:4444:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111::4444:5555:6666:123.123.123.123", "1111:0000:0000:4444:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"::4444:5555:6666:123.123.123.123", "0000:0000:0000:4444:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"1111::3333:4444:5555:6666:123.123.123.123", "1111:0000:3333:4444:5555:6666:7b7b:7b7b");
|
||||
ipv6test(1,"::2222:3333:4444:5555:6666:123.123.123.123", "0000:2222:3333:4444:5555:6666:7b7b:7b7b");
|
||||
|
||||
// playing with combinations of "0" and "::"
|
||||
// nb: these are all sytactically correct, but are bad form
|
||||
// because "0" adjacent to "::" should be combined into "::"
|
||||
ipv6test(1,"::0:0:0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"::0:0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"::0:0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"::0:0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"::0:0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"::0:0", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"::0", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"0:0:0:0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"0:0:0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"0:0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"0:0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"0:0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"0:0::", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
ipv6test(1,"0::", "0000:0000:0000:0000:0000:0000:0000:0000");
|
||||
|
||||
// new invalid from aeron
|
||||
// invalid data
|
||||
ipv6test(!1,"xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx");
|
||||
|
||||
// too many components
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888:9999");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888::");
|
||||
ipv6test(!1,"::2222:3333:4444:5555:6666:7777:8888:9999");
|
||||
|
||||
// too few components
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555");
|
||||
ipv6test(!1,"1111:2222:3333:4444");
|
||||
ipv6test(!1,"1111:2222:3333");
|
||||
ipv6test(!1,"1111:2222");
|
||||
ipv6test(!1,"1111");
|
||||
|
||||
// missing :
|
||||
ipv6test(!1,"11112222:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:22223333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:33334444:5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:44445555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444:55556666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:66667777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:77778888");
|
||||
|
||||
// missing : intended for ::
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888:");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:");
|
||||
ipv6test(!1,"1111:2222:3333:4444:");
|
||||
ipv6test(!1,"1111:2222:3333:");
|
||||
ipv6test(!1,"1111:2222:");
|
||||
ipv6test(!1,"1111:");
|
||||
ipv6test(!1,":");
|
||||
ipv6test(!1,":8888");
|
||||
ipv6test(!1,":7777:8888");
|
||||
ipv6test(!1,":6666:7777:8888");
|
||||
ipv6test(!1,":5555:6666:7777:8888");
|
||||
ipv6test(!1,":4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":2222:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555:6666:7777:8888");
|
||||
|
||||
// :::
|
||||
ipv6test(!1,":::2222:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:::3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:::4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:::5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444:::6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:::7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:::8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:::");
|
||||
|
||||
// double ::");
|
||||
ipv6test(!1,"::2222::4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,"::2222:3333::5555:6666:7777:8888");
|
||||
ipv6test(!1,"::2222:3333:4444::6666:7777:8888");
|
||||
ipv6test(!1,"::2222:3333:4444:5555::7777:8888");
|
||||
ipv6test(!1,"::2222:3333:4444:5555:7777::8888");
|
||||
ipv6test(!1,"::2222:3333:4444:5555:7777:8888::");
|
||||
|
||||
ipv6test(!1,"1111::3333::5555:6666:7777:8888");
|
||||
ipv6test(!1,"1111::3333:4444::6666:7777:8888");
|
||||
ipv6test(!1,"1111::3333:4444:5555::7777:8888");
|
||||
ipv6test(!1,"1111::3333:4444:5555:6666::8888");
|
||||
ipv6test(!1,"1111::3333:4444:5555:6666:7777::");
|
||||
|
||||
ipv6test(!1,"1111:2222::4444::6666:7777:8888");
|
||||
ipv6test(!1,"1111:2222::4444:5555::7777:8888");
|
||||
ipv6test(!1,"1111:2222::4444:5555:6666::8888");
|
||||
ipv6test(!1,"1111:2222::4444:5555:6666:7777::");
|
||||
|
||||
ipv6test(!1,"1111:2222:3333::5555::7777:8888");
|
||||
ipv6test(!1,"1111:2222:3333::5555:6666::8888");
|
||||
ipv6test(!1,"1111:2222:3333::5555:6666:7777::");
|
||||
|
||||
ipv6test(!1,"1111:2222:3333:4444::6666::8888");
|
||||
ipv6test(!1,"1111:2222:3333:4444::6666:7777::");
|
||||
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555::7777::");
|
||||
|
||||
|
||||
// too many components"
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666::1.2.3.4");
|
||||
ipv6test(!1,"::2222:3333:4444:5555:6666:7777:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:1.2.3.4.5");
|
||||
|
||||
// too few components
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:1.2.3.4");
|
||||
ipv6test(!1,"1111:1.2.3.4");
|
||||
ipv6test(!1,"1.2.3.4");
|
||||
|
||||
// missing :
|
||||
ipv6test(!1,"11112222:3333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:22223333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:33334444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:44445555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:55556666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:66661.2.3.4");
|
||||
|
||||
// missing .
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:255255.255.255");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:255.255255.255");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:255.255.255255");
|
||||
|
||||
// missing : intended for ::
|
||||
ipv6test(!1,":1.2.3.4");
|
||||
ipv6test(!1,":6666:1.2.3.4");
|
||||
ipv6test(!1,":5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":3333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":2222:3333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555:6666:1.2.3.4");
|
||||
|
||||
// :::
|
||||
ipv6test(!1,":::2222:3333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:::3333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:::4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:::5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:::6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:::1.2.3.4");
|
||||
|
||||
// double ::
|
||||
ipv6test(!1,"::2222::4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"::2222:3333::5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"::2222:3333:4444::6666:1.2.3.4");
|
||||
ipv6test(!1,"::2222:3333:4444:5555::1.2.3.4");
|
||||
|
||||
ipv6test(!1,"1111::3333::5555:6666:1.2.3.4");
|
||||
ipv6test(!1,"1111::3333:4444::6666:1.2.3.4");
|
||||
ipv6test(!1,"1111::3333:4444:5555::1.2.3.4");
|
||||
|
||||
ipv6test(!1,"1111:2222::4444::6666:1.2.3.4");
|
||||
ipv6test(!1,"1111:2222::4444:5555::1.2.3.4");
|
||||
|
||||
ipv6test(!1,"1111:2222:3333::5555::1.2.3.4");
|
||||
|
||||
// missing parts
|
||||
ipv6test(!1,"::.");
|
||||
ipv6test(!1,"::..");
|
||||
ipv6test(!1,"::...");
|
||||
ipv6test(!1,"::1...");
|
||||
ipv6test(!1,"::1.2..");
|
||||
ipv6test(!1,"::1.2.3.");
|
||||
ipv6test(!1,"::.2..");
|
||||
ipv6test(!1,"::.2.3.");
|
||||
ipv6test(!1,"::.2.3.4");
|
||||
ipv6test(!1,"::..3.");
|
||||
ipv6test(!1,"::..3.4");
|
||||
ipv6test(!1,"::...4");
|
||||
|
||||
// extra : in front
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555:6666:7777::");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555:6666::");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555::");
|
||||
ipv6test(!1,":1111:2222:3333:4444::");
|
||||
ipv6test(!1,":1111:2222:3333::");
|
||||
ipv6test(!1,":1111:2222::");
|
||||
ipv6test(!1,":1111::");
|
||||
ipv6test(!1,":::");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555:6666::8888");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555::8888");
|
||||
ipv6test(!1,":1111:2222:3333:4444::8888");
|
||||
ipv6test(!1,":1111:2222:3333::8888");
|
||||
ipv6test(!1,":1111:2222::8888");
|
||||
ipv6test(!1,":1111::8888");
|
||||
ipv6test(!1,":::8888");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555::7777:8888");
|
||||
ipv6test(!1,":1111:2222:3333:4444::7777:8888");
|
||||
ipv6test(!1,":1111:2222:3333::7777:8888");
|
||||
ipv6test(!1,":1111:2222::7777:8888");
|
||||
ipv6test(!1,":1111::7777:8888");
|
||||
ipv6test(!1,":::7777:8888");
|
||||
ipv6test(!1,":1111:2222:3333:4444::6666:7777:8888");
|
||||
ipv6test(!1,":1111:2222:3333::6666:7777:8888");
|
||||
ipv6test(!1,":1111:2222::6666:7777:8888");
|
||||
ipv6test(!1,":1111::6666:7777:8888");
|
||||
ipv6test(!1,":::6666:7777:8888");
|
||||
ipv6test(!1,":1111:2222:3333::5555:6666:7777:8888");
|
||||
ipv6test(!1,":1111:2222::5555:6666:7777:8888");
|
||||
ipv6test(!1,":1111::5555:6666:7777:8888");
|
||||
ipv6test(!1,":::5555:6666:7777:8888");
|
||||
ipv6test(!1,":1111:2222::4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":1111::4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":::4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":1111::3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":::3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":::2222:3333:4444:5555:6666:7777:8888");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":1111:2222:3333:4444:5555::1.2.3.4");
|
||||
ipv6test(!1,":1111:2222:3333:4444::1.2.3.4");
|
||||
ipv6test(!1,":1111:2222:3333::1.2.3.4");
|
||||
ipv6test(!1,":1111:2222::1.2.3.4");
|
||||
ipv6test(!1,":1111::1.2.3.4");
|
||||
ipv6test(!1,":::1.2.3.4");
|
||||
ipv6test(!1,":1111:2222:3333:4444::6666:1.2.3.4");
|
||||
ipv6test(!1,":1111:2222:3333::6666:1.2.3.4");
|
||||
ipv6test(!1,":1111:2222::6666:1.2.3.4");
|
||||
ipv6test(!1,":1111::6666:1.2.3.4");
|
||||
ipv6test(!1,":::6666:1.2.3.4");
|
||||
ipv6test(!1,":1111:2222:3333::5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":1111:2222::5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":1111::5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":::5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":1111:2222::4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":1111::4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":::4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":1111::3333:4444:5555:6666:1.2.3.4");
|
||||
ipv6test(!1,":::2222:3333:4444:5555:6666:1.2.3.4");
|
||||
|
||||
// extra : at end
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:7777:::");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666:::");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:::");
|
||||
ipv6test(!1,"1111:2222:3333:4444:::");
|
||||
ipv6test(!1,"1111:2222:3333:::");
|
||||
ipv6test(!1,"1111:2222:::");
|
||||
ipv6test(!1,"1111:::");
|
||||
ipv6test(!1,":::");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555:6666::8888:");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555::8888:");
|
||||
ipv6test(!1,"1111:2222:3333:4444::8888:");
|
||||
ipv6test(!1,"1111:2222:3333::8888:");
|
||||
ipv6test(!1,"1111:2222::8888:");
|
||||
ipv6test(!1,"1111::8888:");
|
||||
ipv6test(!1,"::8888:");
|
||||
ipv6test(!1,"1111:2222:3333:4444:5555::7777:8888:");
|
||||
ipv6test(!1,"1111:2222:3333:4444::7777:8888:");
|
||||
ipv6test(!1,"1111:2222:3333::7777:8888:");
|
||||
ipv6test(!1,"1111:2222::7777:8888:");
|
||||
ipv6test(!1,"1111::7777:8888:");
|
||||
ipv6test(!1,"::7777:8888:");
|
||||
ipv6test(!1,"1111:2222:3333:4444::6666:7777:8888:");
|
||||
ipv6test(!1,"1111:2222:3333::6666:7777:8888:");
|
||||
ipv6test(!1,"1111:2222::6666:7777:8888:");
|
||||
ipv6test(!1,"1111::6666:7777:8888:");
|
||||
ipv6test(!1,"::6666:7777:8888:");
|
||||
ipv6test(!1,"1111:2222:3333::5555:6666:7777:8888:");
|
||||
ipv6test(!1,"1111:2222::5555:6666:7777:8888:");
|
||||
ipv6test(!1,"1111::5555:6666:7777:8888:");
|
||||
ipv6test(!1,"::5555:6666:7777:8888:");
|
||||
ipv6test(!1,"1111:2222::4444:5555:6666:7777:8888:");
|
||||
ipv6test(!1,"1111::4444:5555:6666:7777:8888:");
|
||||
ipv6test(!1,"::4444:5555:6666:7777:8888:");
|
||||
ipv6test(!1,"1111::3333:4444:5555:6666:7777:8888:");
|
||||
ipv6test(!1,"::3333:4444:5555:6666:7777:8888:");
|
||||
ipv6test(!1,"::2222:3333:4444:5555:6666:7777:8888:");
|
||||
|
||||
// additional cases: http:// crisp.tweakblogs.net/blog/2031/ipv6-validation-%28and-caveats%29.html
|
||||
ipv6test(1,"0:a:b:c:d:e:f::", "0000:000a:000b:000c:000d:000e:000f:0000");
|
||||
ipv6test(1,"::0:a:b:c:d:e:f", "0000:0000:000a:000b:000c:000d:000e:000f"); // syntactically correct, but bad form (::0:... could be combined)
|
||||
ipv6test(1,"a:b:c:d:e:f:0::", "000a:000b:000c:000d:000e:000f:0000:0000");
|
||||
ipv6test(!1,"':10.0.0.1");
|
||||
});
|
||||
};
|
||||
369
modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing-widgets.js
Executable file
369
modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing-widgets.js
Executable file
@@ -0,0 +1,369 @@
|
||||
/*!
|
||||
* TableSorter QUnit Testing
|
||||
*/
|
||||
/*jshint unused: false */
|
||||
/*global start: false, asyncTest: false, equal: false, $: false, expect: false, module: false,
|
||||
tester: false, test: false, stop: false */
|
||||
|
||||
/*
|
||||
Filter widget tested parts
|
||||
========================
|
||||
OPTIONS:
|
||||
filter_defaultAttrib, filter_ignoreCase, filter_startsWith,
|
||||
filter_selectSource, filter_functions (set, not functionality)
|
||||
|
||||
CLASSES:
|
||||
filter-false, filter-match, filter-parsed
|
||||
|
||||
METHODS:
|
||||
filterReset, search (false), setFilters
|
||||
|
||||
EVENTS:
|
||||
filterInit, filterEnd
|
||||
|
||||
Not yet tested
|
||||
=========================
|
||||
OPTIONS:
|
||||
filter_childRows, filter_columnFilters, filter_cssFilter, filter_external,
|
||||
filter_filteredRow, filter_formatter, filter_hideEmpty,
|
||||
filter_hideEmpty, filter_liveSearch, filter_onlyAvail, filter_placeholder,
|
||||
filter_reset, filter_saveFilters, filter_searchDelay,
|
||||
filter_serversideFiltering, filter_useParsedData
|
||||
|
||||
CLASSES:
|
||||
filter-select, filter-select-nosort, filter-onlyAvail
|
||||
|
||||
METHODS:
|
||||
search (array), getFilters, external filters
|
||||
|
||||
EVENTS:
|
||||
filterStart
|
||||
*/
|
||||
|
||||
$(function(){
|
||||
module('Widgets');
|
||||
|
||||
var ts = $.tablesorter,
|
||||
callback = {},
|
||||
callbackName = 'init',
|
||||
|
||||
// filter widget table
|
||||
$table = $('#testblock').html('<table class="tablesorter">' +
|
||||
'<thead><tr>' +
|
||||
'<th class="rank">Rank</th>' +
|
||||
'<th class="first filter-match">First Name</th>' +
|
||||
'<th class="last">Last Name</th>' +
|
||||
'<th data-value="<20">Age</th>' +
|
||||
'<th class="total">Total</th>' +
|
||||
'<th>Discount</th>' +
|
||||
'<th>Date</th>' +
|
||||
'<th class="last2">Last Name2</th>' +
|
||||
'</tr></thead><tbody>' +
|
||||
'<tr><td>1</td><td>Philip Aaron Wong</td><td>Johnson Sr Esq</td><td>25</td><td>$5.95</td><td>22%</td><td>Jun 26, 2004 7:22 AM</td><td>Johnson Sr Esq</td></tr>' +
|
||||
'<tr><td>11</td><td>Aaron</td><td>Hibert</td><td>12</td><td>$2.99</td><td>5%</td><td>Aug 21, 2009 12:21 PM</td><td>Hibert</td></tr>' +
|
||||
'<tr><td>12</td><td>Brandon Clark</td><td>Henry Jr</td><td>51</td><td>$42.29</td><td>18%</td><td>Oct 13, 2000 1:15 PM</td><td>Henry Jr</td></tr>' +
|
||||
'<tr><td>111</td><td>Peter</td><td>Parker</td><td>28</td><td>$9.99</td><td>20%</td><td>Jul 6, 2006 8:14 AM</td><td>Parker</td></tr>' +
|
||||
'<tr><td>21</td><td>John</td><td>Hood</td><td>33</td><td>$19.99</td><td>25%</td><td>Dec 10, 2002 5:14 AM</td><td>Hood</td></tr>' +
|
||||
'<tr><td>013</td><td>Clark</td><td>Kent Sr.</td><td>18</td><td>$15.89</td><td>44%</td><td>Jan 12, 2003 11:14 AM</td><td>Kent Sr.</td></tr>' +
|
||||
'<tr><td>005</td><td>Bruce</td><td>Almighty Esq</td><td>45</td><td>$153.19</td><td>44%</td><td>Jan 18, 2021 9:12 AM</td><td>Almighty Esq</td></tr>' +
|
||||
'<tr><td>10</td><td>Alex</td><td>Dumass</td><td>13</td><td>$5.29</td><td>4%</td><td>Jan 8, 2012 5:11 PM</td><td>Dumass</td></tr>' +
|
||||
'<tr><td>16</td><td>Jim</td><td>Franco</td><td>24</td><td>$14.19</td><td>14%</td><td>Jan 14, 2004 11:23 AM</td><td>Franco</td></tr>' +
|
||||
'<tr><td>166</td><td>Bruce Lee</td><td>Evans</td><td>22</td><td>$13.19</td><td>11%</td><td>Jan 18, 2007 9:12 AM</td><td>Evans</td></tr>' +
|
||||
'<tr><td>100</td><td>Brenda Dexter</td><td>McMasters</td><td>18</td><td>$55.20</td><td>15%</td><td>Feb 12, 2010 7:23 PM</td><td>McMasters</td></tr>' +
|
||||
'<tr><td>55</td><td>Dennis</td><td>Bronson</td><td>65</td><td>$123.00</td><td>32%</td><td>Jan 20, 2001 1:12 PM</td><td>Bronson</td></tr>' +
|
||||
'<tr><td>9</td><td>Martha</td><td>delFuego</td><td>25</td><td>$22.09</td><td>17%</td><td>Jun 11, 2011 10:55 AM</td><td>delFuego</td></tr>' +
|
||||
'</tbody></table>').find('table'),
|
||||
table = $table[0],
|
||||
|
||||
/************************************************
|
||||
Filter widget
|
||||
************************************************/
|
||||
init = false,
|
||||
|
||||
runFilterTests = function(){
|
||||
|
||||
var c = table.config,
|
||||
wo = c.widgetOptions;
|
||||
|
||||
test( 'Filter: init', function() {
|
||||
expect(6);
|
||||
|
||||
equal( init, true, 'Init event' );
|
||||
equal( $table.hasClass('hasFilters'), true, '`hasFilters` class applied' );
|
||||
|
||||
equal( ts.filter.regex.child.test( c.cssChildRow ), true, 'child row regex check' );
|
||||
equal( ts.filter.regex.filtered.test( wo.filter_filteredRow ), true, 'filtered row regex check' );
|
||||
// this includes check of headers option & referencing column by class
|
||||
equal ( c.$table.find('.tablesorter-filter').eq(0).hasClass('disabled'), true, 'filter disabled & headers class name working' );
|
||||
|
||||
tester.cacheCompare( table, 3, [ 12, 18, 13, 18 ], 'starting filter value on age column', true );
|
||||
});
|
||||
|
||||
asyncTest( 'Filter searches', function() {
|
||||
expect(27);
|
||||
|
||||
callbackName = 'regular';
|
||||
callback.regular = function(){
|
||||
tester.cacheCompare( table, 1, ['Peter', 'Bruce', 'Alex', 'Bruce Lee', 'Brenda Dexter', 'Dennis'], 'search regular', true );
|
||||
};
|
||||
ts.setFilters( table, ['', 'e'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'fuzzy1';
|
||||
callback.fuzzy1 = function(){
|
||||
tester.cacheCompare( table, 1, ['Bruce Lee', 'Brenda Dexter'], 'search fuzzy', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '~bee'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'fuzzy2';
|
||||
callback.fuzzy2 = function(){
|
||||
tester.cacheCompare( table, 1, ['Philip Aaron Wong'], 'search fuzzy2', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '~piano'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'exact';
|
||||
callback.exact = function(){
|
||||
tester.cacheCompare( table, 1, ['John'], 'search exact', true );
|
||||
};
|
||||
ts.setFilters( table, ['', 'john='], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'wildcard1';
|
||||
callback.wildcard1 = function(){
|
||||
tester.cacheCompare( table, 2, ['Dumass', 'Evans'], 'search wildcard, one character (?)', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', 'a?s'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'wildcard2';
|
||||
callback.wildcard2 = function(){
|
||||
tester.cacheCompare( table, 2, ['Dumass', 'Evans', 'McMasters'], 'search wildcard, multiple characters (*)', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', 'a*s'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'regex';
|
||||
callback.regex = function(){
|
||||
tester.cacheCompare( table, 1, ['Peter', 'Brenda Dexter'], 'search regex', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '/r$/'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operator';
|
||||
callback.operator = function(){
|
||||
tester.cacheCompare( table, 4, [42.29, 19.99, 15.89, 153.19, 14.19, 13.19, 55.2, 123, 22.09], 'search operator (>10)', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '>10'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operator1';
|
||||
callback.operator1 = function(){
|
||||
tester.cacheCompare( table, 4, [153.19, 123], 'search operator (>100); ensure search filtered gets cleared', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '>100'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operator2';
|
||||
callback.operator2 = function(){
|
||||
tester.cacheCompare( table, 5, [22, 20, 25, 44, 44, 32], 'search operator (>=)', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '', '>=20'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operator3';
|
||||
callback.operator3 = function(){
|
||||
tester.cacheCompare( table, 5, [5, 4], 'search operator (<10)', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '', '<10'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operator4';
|
||||
callback.operator4 = function(){
|
||||
tester.cacheCompare( table, 5, [22, 5, 18, 20, 25, 44, 44, 4, 14, 11, 15, 32, 17], 'search operator (<100); ensure search filtered gets cleared', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '', '<100'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operator5';
|
||||
callback.operator5 = function(){
|
||||
tester.cacheCompare( table, 5, [5, 18, 20, 4, 14, 11, 15, 17], 'search operator (<=)', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '', '<=20'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'notMatch';
|
||||
callback.notMatch = function(){
|
||||
tester.cacheCompare( table, 1, ['Peter', 'John', 'Bruce', 'Jim', 'Bruce Lee', 'Dennis'], 'search not match', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '!a'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'notMatch2';
|
||||
callback.notMatch2 = function(){
|
||||
tester.cacheCompare( table, 1, ['Brandon Clark', 'Peter', 'John', 'Clark', 'Bruce', 'Alex', 'Jim', 'Bruce Lee', 'Brenda Dexter', 'Dennis', 'Martha'], 'search not match; ensure search filtered gets cleared', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '!aa'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operatorAnd';
|
||||
callback.operatorAnd = function(){
|
||||
tester.cacheCompare( table, 1, ['Brandon Clark', 'Bruce', 'Bruce Lee'], 'search and match', true );
|
||||
};
|
||||
ts.setFilters( table, ['', 'br && c'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operatorAnd2';
|
||||
callback.operatorAnd2 = function(){
|
||||
tester.cacheCompare( table, 1, ['Brandon Clark'], 'search and match; ensure search filtered gets cleared', true );
|
||||
};
|
||||
ts.setFilters( table, ['', 'br && cl'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'operatorOr';
|
||||
callback.operatorOr = function(){
|
||||
tester.cacheCompare( table, 1, ['Brandon Clark', 'Bruce', 'Alex', 'Bruce Lee', 'Brenda Dexter'], 'search OR match', true );
|
||||
};
|
||||
ts.setFilters( table, ['', 'alex|br*'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'range';
|
||||
callback.range = function(){
|
||||
tester.cacheCompare( table, 4, [5.95, 9.99, 5.29], 'search range', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '5 - 10'], true );
|
||||
stop();
|
||||
|
||||
callbackName = 'range2';
|
||||
callback.range2 = function(){
|
||||
tester.cacheCompare( table, 4, [5.95, 42.29, 9.99, 19.99, 15.89, 5.29, 14.19, 13.19, 55.2, 22.09], 'search range; ensure search filtered gets cleared', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '5 - 100'], true );
|
||||
stop();
|
||||
|
||||
// test filter_startsWith (false by default)
|
||||
wo.filter_startsWith = false;
|
||||
callbackName = 'startsWith';
|
||||
callback.startsWith = function(){
|
||||
tester.cacheCompare( table, 1, ['Philip Aaron Wong', 'Aaron'], 'search - filter_startsWith : false', true );
|
||||
};
|
||||
ts.setFilters( table, ['', 'aa'], true );
|
||||
stop();
|
||||
|
||||
// test filter_startsWith (false by default)
|
||||
wo.filter_startsWith = true;
|
||||
callbackName = 'startsWith2';
|
||||
callback.startsWith2 = function(){
|
||||
tester.cacheCompare( table, 1, ['Aaron'], 'search - filter_startsWith : true', true );
|
||||
wo.filter_startsWith = false;
|
||||
};
|
||||
c.$table.trigger('search', false);
|
||||
stop();
|
||||
|
||||
// test filter_ignoreCase (true by default)
|
||||
wo.filter_ignoreCase = false;
|
||||
callbackName = 'ignoreCase1';
|
||||
callback.ignoreCase1 = function(){
|
||||
tester.cacheCompare( table, 1, [], 'search - filter_ignoreCase : false', true );
|
||||
wo.filter_ignoreCase = true;
|
||||
};
|
||||
c.$table.trigger('search', false);
|
||||
stop();
|
||||
|
||||
// test filter-match class (added in the example code)
|
||||
callbackName = 'filterMatch';
|
||||
callback.filterMatch = function(){
|
||||
tester.cacheCompare( table, 1, ['Brandon Clark', 'Clark', 'Bruce', 'Alex', 'Bruce Lee', 'Brenda Dexter'], 'search - filter-match', true );
|
||||
};
|
||||
ts.setFilters( table, ['', 'alex|br*|c'], true );
|
||||
stop();
|
||||
|
||||
// test filter-match class
|
||||
c.$table.find('.tablesorter-header').eq(1).removeClass('filter-match');
|
||||
callbackName = 'notFilterMatch';
|
||||
callback.notFilterMatch = function(){
|
||||
tester.cacheCompare( table, 1, ['Bruce', 'Alex'], 'search - filter-match removed', true );
|
||||
};
|
||||
c.$table.trigger('search', false);
|
||||
stop();
|
||||
|
||||
// filter reset
|
||||
callbackName = 'filterReset';
|
||||
callback.filterReset = function(){
|
||||
tester.cacheCompare( table, 5, [22, 5, 18, 20, 25, 44, 44, 4, 14, 11, 15, 32, 17], 'filterReset', true );
|
||||
};
|
||||
c.$table.trigger('filterReset');
|
||||
stop();
|
||||
|
||||
// filter parsed class
|
||||
wo.filter_startsWith = false;
|
||||
callbackName = 'filterParsed';
|
||||
callback.filterParsed = function(){
|
||||
tester.cacheCompare( table, 6, [ new Date('Oct 13, 2000 1:15 PM').getTime() ], 'search - filter-parsed', true );
|
||||
};
|
||||
ts.setFilters( table, ['', '', '', '', '', '', '< 1/1/2001'], true );
|
||||
|
||||
});
|
||||
|
||||
test( 'Filter: function & selectSource', function() {
|
||||
expect(3);
|
||||
|
||||
var $t, opts = [];
|
||||
$t = c.$table.find('.tablesorter-filter-row select:last');
|
||||
equal ( $t.length !== 0, true, 'filter_functions: true working' );
|
||||
|
||||
c.$table.find('.tablesorter-filter-row select:first option').each(function(){
|
||||
opts.push( $.trim( $(this).text() ) );
|
||||
});
|
||||
equal ( opts.length === 3 && opts.join('') === '< 10> 10', true, 'filter_functions set' );
|
||||
|
||||
opts = [];
|
||||
$t.find('option').each(function(){
|
||||
opts.push( $.trim( $(this).text() ) );
|
||||
});
|
||||
equal ( opts.length === 4 && opts.join('') === 'abcdefzyx', true, 'filter_selectSource set' );
|
||||
|
||||
});
|
||||
|
||||
|
||||
$table.on('filterEnd', function(){
|
||||
start();
|
||||
if (callbackName !== '' && callback[callbackName]) {
|
||||
callback[callbackName]();
|
||||
}
|
||||
callbackName = '';
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$table
|
||||
.on('filterInit', function(){
|
||||
init = true;
|
||||
runFilterTests();
|
||||
})
|
||||
.tablesorter({
|
||||
ignoreCase: false,
|
||||
widgets: ['zebra', 'filter'],
|
||||
headers: {
|
||||
'.rank' : { filter: false }
|
||||
},
|
||||
widgetOptions: {
|
||||
filter_functions : {
|
||||
'.last2' : true,
|
||||
'.rank' : {
|
||||
"< 10" : function(e, n) { return n <= 10; },
|
||||
"> 10" : function(e, n) { return n > 10; }
|
||||
}
|
||||
},
|
||||
filter_selectSource : {
|
||||
// Alphanumeric match (prefix only)
|
||||
// added as select2 options (you could also use select2 data option)
|
||||
'.last2' : function(table, column) {
|
||||
return ['abc', 'def', 'zyx'];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
765
modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing.js
Executable file
765
modules/EcmReportsBackUp20151106/TableSorterNew/testing/testing.js
Executable file
@@ -0,0 +1,765 @@
|
||||
/*!
|
||||
* TableSorter QUnit Testing
|
||||
*/
|
||||
/*jshint unused: false */
|
||||
/*global QUnit: false, JSHINT: false, ok: false, start: false, deepEqual: false, asyncTest: false,
|
||||
strictEqual: false, jQuery: false, equal: false, $: false, expect: false, module: false,
|
||||
test: false, stop: false, ipv6tests: false */
|
||||
|
||||
/************************************************
|
||||
QUnit skip testing
|
||||
http://stackoverflow.com/q/13748129/145346
|
||||
************************************************/
|
||||
QUnit.testSkip = function( testName, callback ) {
|
||||
QUnit.test(testName + ' (SKIPPED)', function() {
|
||||
if (typeof callback === "function") {
|
||||
callback();
|
||||
}
|
||||
var $li = $('#' + QUnit.config.current.id);
|
||||
QUnit.done(function() {
|
||||
$li.addClass('skipped');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var tester = {
|
||||
|
||||
/************************************************
|
||||
JSHint testing
|
||||
************************************************/
|
||||
jsHintTest : function(name, sourceFile, options) {
|
||||
// Chrome & Opera don't allow ajax loading of script files
|
||||
if (QUnit.isLocal && /Chrome|Opera/.test(navigator.userAgent)) {
|
||||
return QUnit.testSkip(name, function(){
|
||||
ok( true, 'test cannot be done locally' );
|
||||
});
|
||||
}
|
||||
function validateFile(source) {
|
||||
var i, len, err,
|
||||
result = JSHINT(source, options),
|
||||
errors = JSHINT.errors;
|
||||
ok(result);
|
||||
if (result) {
|
||||
return;
|
||||
}
|
||||
for (i = 0, len = errors.length; i < len; i++) {
|
||||
err = errors[i];
|
||||
if (!err) {
|
||||
continue;
|
||||
}
|
||||
ok(false, err.reason + " on line " + err.line +
|
||||
", character " + err.character);
|
||||
}
|
||||
}
|
||||
return asyncTest(name, function() {
|
||||
$.ajax({
|
||||
url: sourceFile,
|
||||
dataType: 'script',
|
||||
success: function(source) {
|
||||
start();
|
||||
validateFile(source);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/************************************************
|
||||
test table data cache
|
||||
************************************************/
|
||||
cacheCompare : function(table, col, expected, txt, filtered){
|
||||
var i, j = 0, k, l,
|
||||
c = table.config,
|
||||
result = [],
|
||||
b = table.tBodies,
|
||||
l2 = c.columns;
|
||||
for (k = 0; k < b.length; k++){
|
||||
l = b[k].rows.length;
|
||||
for (j = 0; j < l; j++) {
|
||||
if (filtered && c.cache[k].normalized[j][c.columns].$row.hasClass('filtered')) {
|
||||
continue;
|
||||
}
|
||||
if (col === 'all') {
|
||||
// return all columns
|
||||
for (i = 0; i < l2; i++) {
|
||||
result.push( c.cache[k].normalized[j] ? c.cache[k].normalized[j][i] : '' );
|
||||
}
|
||||
} else {
|
||||
// return specific column
|
||||
result.push( c.cache[k].normalized[j] ? c.cache[k].normalized[j][col] : '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
deepEqual( result, expected, 'testing parser cache: ' + txt);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
Core plugin tested
|
||||
========================
|
||||
OPTIONS:
|
||||
cssAsc, cssChildRow, cssDesc, cssHeader, cssHeaderRow, cssInfoBlock, dateFormat, emptyTo, headerList,
|
||||
headers, ignoreCase, initialized, parsers, sortList, sortLocaleCompare, sortReset, stringTo, tableClass,
|
||||
usNumberFormat, widgets (just zebra), sortAppend, sortForce, sortMultiSortKey, sortResetKey, numberSorter
|
||||
|
||||
METHODS:
|
||||
addRows, applyWidgets, destroy, sorton, sortReset, update/updateRow, updateAll, updateCell
|
||||
|
||||
EVENTS:
|
||||
initialized, sortBegin, sortEnd, sortStart, updateComplete
|
||||
|
||||
Not yet tested
|
||||
=========================
|
||||
OPTIONS:
|
||||
cancelSelection, cssIcon, cssProcessing, debug, delayInit, headerTemplate, initWidgets, onRenderHeader,
|
||||
onRenderTemplate, selectorHeaders, selectorRemove, selectorSort, serverSideSorting, showProcessing,
|
||||
sortInitialOrder, sortRestart, strings,
|
||||
textExtraction, textSorter, theme, widthFixed, widgets (also need priority testing)
|
||||
|
||||
METHODS:
|
||||
appendCache, applyWidgetId, sort, refreshWidgets
|
||||
|
||||
EVENTS:
|
||||
-
|
||||
*/
|
||||
|
||||
$(function(){
|
||||
|
||||
var ts = $.tablesorter,
|
||||
$table1 = $('#table1'),
|
||||
$table2 = $('#table2'),
|
||||
$table3 = $('#table3'),
|
||||
$table4 = $('#table4'),
|
||||
$table5 = $('#table5'), // empty table
|
||||
table1 = $table1[0],
|
||||
table2 = $table2[0],
|
||||
table3 = $table3[0],
|
||||
table4 = $table4[0],
|
||||
table5 = $table5[0],
|
||||
th0 = $table1.find('th')[0], // first table header cell
|
||||
init = false,
|
||||
sortIndx = 0,
|
||||
updateIndx = 0,
|
||||
updateCallback = 0,
|
||||
events = ['sortStart', 'sortBegin', 'sortEnd', ' '],
|
||||
returnTime = function(string){
|
||||
return new Date(string).getTime();
|
||||
},
|
||||
undef, c1, c2, c3, c4, e, i, t;
|
||||
|
||||
$table1
|
||||
.bind('tablesorter-initialized', function(){
|
||||
init = true;
|
||||
})
|
||||
.tablesorter();
|
||||
|
||||
$table2.tablesorter({
|
||||
headers: {
|
||||
0: { sorter: 'text' },
|
||||
1: { sorter: 'text' },
|
||||
2: { sorter: false }
|
||||
}
|
||||
});
|
||||
|
||||
$table3.tablesorter({
|
||||
emptyTo: "bottom",
|
||||
stringTo: "max", // non-numeric content is treated as a MAX value
|
||||
headers: {
|
||||
0: { empty : "top" }, // sort empty cells to the top
|
||||
2: { string: "min" }, // non-numeric content is treated as a MIN value
|
||||
3: { sorter: "digit", empty : "zero", string : "top" }
|
||||
}
|
||||
});
|
||||
|
||||
$table4.tablesorter({
|
||||
sortAppend : [[2,0],[3,0]],
|
||||
sortForce : [[0,0],[1,0]],
|
||||
textExtraction : {
|
||||
'.te-test' : function(node){
|
||||
return $(node).find('span').text();
|
||||
},
|
||||
2 : function(node){
|
||||
return $(node).find('span').text();
|
||||
}
|
||||
},
|
||||
initialized: function(table){
|
||||
var e, c = table.config;
|
||||
// trigger sort on 5th column
|
||||
// this method is used because triggering a "sorton" would ignore sortForce/sortAppend
|
||||
c.$headers.eq(4).trigger('sort');
|
||||
e = $.Event('sort');
|
||||
e.which = 1;
|
||||
e.shiftKey = true;
|
||||
c.$headers.eq(5).trigger(e);
|
||||
},
|
||||
numberSorter: function(a, b, dir){
|
||||
return dir ? a-b : b-a;
|
||||
}
|
||||
});
|
||||
|
||||
$table5.tablesorter();
|
||||
|
||||
module('JSHint');
|
||||
/************************************************
|
||||
JSHint testing
|
||||
************************************************/
|
||||
// Run JSHint on main js files
|
||||
tester.jsHintTest('JSHint core', 'js/jquery.tablesorter.js');
|
||||
tester.jsHintTest('JSHint pager', 'addons/pager/jquery.tablesorter.pager.js');
|
||||
tester.jsHintTest('JSHint widgets', 'js/jquery.tablesorter.widgets.js');
|
||||
tester.jsHintTest('JSHint group widget', 'js/widgets/widget-grouping.js');
|
||||
tester.jsHintTest('JSHint scroller widget', 'js/widgets/widget-scroller.js');
|
||||
|
||||
module('core');
|
||||
/************************************************
|
||||
Initialization
|
||||
************************************************/
|
||||
test( "tablesorter loaded & initialized", function() {
|
||||
expect(3);
|
||||
equal( typeof ts, 'object', "tablesorter loaded");
|
||||
equal( table1.hasInitialized, true, "tablesorter initialized flag");
|
||||
equal( init, true, "tablesorter initialized event");
|
||||
});
|
||||
|
||||
c1 = table1.config;
|
||||
c2 = table2.config;
|
||||
c3 = table3.config;
|
||||
c4 = table4.config;
|
||||
|
||||
/************************************************
|
||||
Test column numbering
|
||||
************************************************/
|
||||
// later: include a table header with colspan & rowspan
|
||||
test( "column numbering", function() {
|
||||
expect(2);
|
||||
var internalColumn = true,
|
||||
dataColumn = true;
|
||||
$table4.find('thead th').each(function(i){
|
||||
internalColumn = internalColumn && this.column === i;
|
||||
dataColumn = dataColumn && $(this).attr('data-column') == i;
|
||||
});
|
||||
equal( internalColumn, true, "Correct internal column numbering" );
|
||||
equal( dataColumn, true, "Correct data-column attribute numbering" );
|
||||
});
|
||||
|
||||
/************************************************
|
||||
check isDigit function
|
||||
************************************************/
|
||||
var d = ts.isDigit;
|
||||
test( "isDigit", function() {
|
||||
expect(17);
|
||||
ok( d('-1'), "allow negative (-1)");
|
||||
ok( d('+1'), "allow plus (+1)");
|
||||
ok( d('(1)'), "allow parenthesis (1)");
|
||||
ok( d('123'), "string has numbers ('123')");
|
||||
ok( d(123), "has numbers (123)");
|
||||
ok( d('1.2'), "remove decimal (1.2)");
|
||||
ok( d('1,234'),"remove commas (1,234)");
|
||||
ok( d("11'"), "remove apostrophe's (11')"); // 11 feet
|
||||
ok( d('3\'4"'),"remove quotes (3'4\")"); // 3 foot 4 inches
|
||||
ok( d(' 12 '), "remove spaces ( 12 )");
|
||||
ok( !d('x'), "non-digit alphabet");
|
||||
ok( !d('1x'), "digit + alphabet");
|
||||
ok( !d('x1'), "alphabet + digit");
|
||||
ok( !d('@'), "non-digit symbols");
|
||||
ok( !d('1-'), "negative after (1-) not allowed?");
|
||||
ok( !d('1+'), "plus after (1+) not allowed?");
|
||||
ok( !d('$2'), "no money; the currency parser will catch these");
|
||||
});
|
||||
|
||||
/************************************************
|
||||
check formatFloat function
|
||||
************************************************/
|
||||
var ff = function(str) {
|
||||
return ts.formatFloat(str, table1);
|
||||
};
|
||||
test( "formatFloat", function() {
|
||||
expect(18);
|
||||
strictEqual( ff(''), '', 'returns empty string' );
|
||||
strictEqual( ff(5), 5, 'returns numerical values');
|
||||
|
||||
c1.usNumberFormat = false;
|
||||
strictEqual( ts.formatFloat('1,234,567.89'), 1234567.89, 'use format float without including table - defaults to US number format');
|
||||
|
||||
strictEqual( ff('1 234,56'), 1234.56, 'parse non-U.S. (French) number format');
|
||||
strictEqual( ff('1.234,56'), 1234.56, 'parse non-U.S. (German) number format');
|
||||
strictEqual( ff('-32,32'), -32.32, 'negative non-U.S. signed numbers');
|
||||
strictEqual( ff('-1.234,56'), -1234.56, 'negative non-U.S. signed numbers');
|
||||
strictEqual( ff('(32,32)'), -32.32, 'parenthesis wrapped non-U.S. negative number');
|
||||
strictEqual( ff(' (32,32) '), -32.32, 'space + parenthesis wrapped non-U.S. negative number');
|
||||
|
||||
c1.usNumberFormat = true;
|
||||
strictEqual( ff('1,234.56'), 1234.56, 'parse U.S. number format');
|
||||
strictEqual( ff('-32.32'), -32.32, 'negative U.S. signed numbers');
|
||||
strictEqual( ff('(32.32)'), -32.32, 'parenthesis wrapped U.S. negative number');
|
||||
strictEqual( ff(' (32.32)'), -32.32, 'space + parenthesis wrapped U.S. negative number');
|
||||
|
||||
strictEqual( ff('fred'), 'fred', 'return string if not a number');
|
||||
strictEqual( ff(' fred '), 'fred', 'return trimmed string if not a number');
|
||||
strictEqual( ff('fred 12'), 'fred 12', 'return string if number not at beginning');
|
||||
strictEqual( ff('12fred'), 12, 'parse number + string into number only');
|
||||
strictEqual( ff('(fred)'), '(fred)', 'leave parenthesis intact on strings');
|
||||
|
||||
});
|
||||
|
||||
/************************************************
|
||||
get data function - jQuery data > meta > headers option > header class name
|
||||
************************************************/
|
||||
var gd = function(n){
|
||||
return ts.getData( c2.$headers[n], c2.headers[n], 'sorter' );
|
||||
};
|
||||
|
||||
test( "getData", function() {
|
||||
expect(4);
|
||||
var txt = [ 'jQuery data', 'meta data', 'headers option', 'header class name' ];
|
||||
for (i = 0; i < 4; i++) {
|
||||
equal( gd(i), 'false', txt[i]); // all columns have sorter false set
|
||||
}
|
||||
});
|
||||
|
||||
/************************************************
|
||||
character equivalent replacement
|
||||
************************************************/
|
||||
test( "replace accents", function() {
|
||||
expect(6);
|
||||
strictEqual( ts.replaceAccents('\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5'), 'aaaaaaaAAAAAAA', "replaced a's");
|
||||
strictEqual( ts.replaceAccents('\u00e9\u00e8\u00ea\u00eb\u011b\u0119\u00c9\u00c8\u00ca\u00cb\u011a\u0118'), 'eeeeeeEEEEEE', "replaced e's");
|
||||
strictEqual( ts.replaceAccents('\u00ed\u00ec\u0130\u00ee\u00ef\u0131\u00cd\u00cc\u0130\u00ce\u00cf'), 'iiiiiiIIiII', "replaced i's");
|
||||
strictEqual( ts.replaceAccents('\u00f3\u00f2\u00f4\u00f5\u00f6\u00d3\u00d2\u00d4\u00d5\u00d6'), 'oooooOOOOO', "replaced o's");
|
||||
strictEqual( ts.replaceAccents('\u00fa\u00f9\u00fb\u00fc\u016f\u00da\u00d9\u00db\u00dc\u016e'), 'uuuuuUUUUU', "replaced u's");
|
||||
strictEqual( ts.replaceAccents('\u00e7\u0107\u010d\u00c7\u0106\u010c\u00df\u1e9e'), 'cccCCCssSS', "replaced c & s sharp");
|
||||
});
|
||||
|
||||
/************************************************
|
||||
detect parsers
|
||||
************************************************/
|
||||
asyncTest( "detect parsers", function() {
|
||||
expect(2);
|
||||
$('#testblock2').html('<table class="tablesorter"><thead>' +
|
||||
'<tr><th class="col-off" colspan="2">Info</th><th class="col-off" colspan="4">Details</th></tr>' +
|
||||
'<tr>' +
|
||||
'<th class="col-first">First Name</th>' +
|
||||
'<th class="col-last">Last Name</th>' +
|
||||
'<th class="col-age" id="age">Age</th>' +
|
||||
'<th class="col-total">Total</th>' +
|
||||
'<th class="col-discount">Discount</th>' +
|
||||
'<th class="col-date">Date</th>' +
|
||||
'</tr></thead>' +
|
||||
'<tbody>' +
|
||||
'<tr><td>Peter</td><td>Parker</td><td>28</td><td>$9.99</td><td>20%</td><td>Jul 6, 2006 8:14 AM</td></tr>' +
|
||||
'<tr><td>John</td><td>Hood</td><td>33</td><td>$19.99</td><td>25%</td><td>Dec 10, 2002 5:14 AM</td></tr>' +
|
||||
'<tr><td>Clark</td><td>Kent</td><td>18</td><td>$15.89</td><td>44%</td><td>Jan 12, 2003 11:14 AM</td></tr>' +
|
||||
'<tr><td>Bruce</td><td>Almighty</td><td>45</td><td>$153.19</td><td>44%</td><td>Jan 18, 2001 9:12 AM</td></tr>' +
|
||||
'<tr><td>Bruce</td><td>Evans</td><td>22</td><td>$13.19</td><td>11%</td><td>Jan 18, 2007 9:12 AM</td></tr>' +
|
||||
'</tbody></table>')
|
||||
.find('table')
|
||||
.tablesorter({
|
||||
headers : {
|
||||
0 : { sorter: false },
|
||||
1 : { sorter: false },
|
||||
3 : { sorter: 'digit' } // 3 sets the 4th column, not the 3rd header cell now
|
||||
},
|
||||
initialized: function(table){
|
||||
start();
|
||||
var i,
|
||||
result = true,
|
||||
parsers = [ 'text', 'digit', 'digit', 'currency', 'percent', 'usLongDate' ],
|
||||
c = table.config;
|
||||
for (i = 0; i < c.columns; i++){
|
||||
result = result && c.parsers[i].id === parsers[i];
|
||||
}
|
||||
equal( result, true, 'detect parsers by header index' );
|
||||
stop();
|
||||
// table inception!
|
||||
$(table)
|
||||
.trigger('destroy')
|
||||
.tablesorter({
|
||||
headers : {
|
||||
'.col-first' : { sorter: 'url' },
|
||||
'.col-off' : { sorter: false },
|
||||
'.col-total' : { sorter : 'percent' },
|
||||
'#age, .col-last' : { sorter: 'currency' },
|
||||
'.col-date' : { sorter : 'time' },
|
||||
'.col-discount' : { sorter: 'digit' }
|
||||
},
|
||||
initialized: function(table){
|
||||
var i,
|
||||
result = true,
|
||||
parsers = [ 'url', 'currency', 'currency', 'percent', 'digit', 'time' ],
|
||||
c = table.config;
|
||||
for (i = 0; i < c.columns; i++){
|
||||
result = result && c.parsers[i].id === parsers[i];
|
||||
}
|
||||
equal( result, true, 'detect parsers by class/id' );
|
||||
start();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/************************************************
|
||||
check all default parsers
|
||||
************************************************/
|
||||
var p = ts.parsers,
|
||||
// test by parser
|
||||
parserTests = 85,
|
||||
// skipping metadata parser
|
||||
sample1 = {
|
||||
'text' : { 'test': 'test', 'TesT': 'test', '\u00e1 test': '\u00e1 test' },
|
||||
'currency' : { '\u00a31': 1, '($2.23)': -2.23, '5\u20ac': 5, '(11\u00a4)': -11, '500\u00a5': 500, '25\u00a2': 25, '$1,000.50': 1000.5 },
|
||||
'ipAddress' : { '255.255.255.255': 255255255255, '32.32.32.32': 32032032032, '1.1.1.1': 1001001001 },
|
||||
'url' : { 'http://google.com': 'google.com', 'ftp://fred.com': 'fred.com', 'https://github.com': 'github.com' },
|
||||
'isoDate' : { '2012/12/12': returnTime('2012/12/12'), '2012-12/12': returnTime('2012/12/12'), '2013-1-1': returnTime('2013/1/1'), '2013/1/1 12:34:56 AM': returnTime('2013/1/1 12:34:56 AM') },
|
||||
'percent' : { '100%': 100, '22%': 22, '%2': 2, '2 %': 2, '(4%)': -4, '1,234.56 %': 1234.56 },
|
||||
'usLongDate': { 'Feb 23, 1999': returnTime('Feb 23, 1999'), 'Feb 23, 1999 12:34': returnTime('Feb 23, 1999 12:34'), 'Feb 23, 1999 12:34 AM': returnTime('Feb 23, 1999 12:34 AM'), 'Feb 23, 1999 12:34:56 PM': returnTime('Feb 23, 1999 12:34:56 PM'), '01 Jan 2013': returnTime('01 Jan 2013') },
|
||||
'shortDate' : { '1/2/2001': returnTime('1/2/2001'), '1 2 2001': returnTime('1/2/2001'), '1.2.2001': returnTime('1/2/2001'), '1-2-2001': returnTime('1/2/2001'), '1/2/2001 12:34 PM' : returnTime('1/2/2001 12:34 PM'), '1.2.2001 13:34' : returnTime('1/2/2001 13:34') },
|
||||
'time' : { '12:34 AM': returnTime('2000/01/01 12:34 AM'), '1:00 pm': returnTime('2000/01/01 1:00 pm') },
|
||||
'digit' : { '12': 12, '$23': 23, '&44^': 44, '#(33)': -33, '1,000': 1000, '12.34': 12.34 }
|
||||
},
|
||||
// switch ignoreCase, sortLocalCompare & shortDate "ddmmyyyy"
|
||||
sample2 = {
|
||||
'text' : { 'TesT': 'TesT', '\u00e1 test': 'a test' },
|
||||
'currency' : { '\u20ac 123 456,78': 123456.78, '\u20ac 123.456,78': 123456.78 },
|
||||
'shortDate' : { '2/1/2001': returnTime('1/2/2001'), '2-1-2001': returnTime('1/2/2001'), '2 1,2001': returnTime('1/2/2001') }
|
||||
},
|
||||
// shortdate to "yyyymmdd"
|
||||
sample3 = {
|
||||
'shortDate' : { '2001/1/2': returnTime('1/2/2001'), '2001-1/2': returnTime('1/2/2001'), '2001,1.2': returnTime('1/2/2001') }
|
||||
},
|
||||
report = function(s) {
|
||||
for (i = 0; i < p.length; i++) {
|
||||
t = p[i].id;
|
||||
if (s.hasOwnProperty(t)) {
|
||||
/*jshint loopfunc:true */
|
||||
$.each(s[t], function(k,v){
|
||||
// check "is" and "format" functions
|
||||
if (p[i].is(k)) {
|
||||
equal( p[i].format(k, table1, th0, 0), v, t + ' parser: "' + k + '" parsed to ' + v );
|
||||
} else {
|
||||
equal( p[i].format(k, table1, th0, 0), v, t + ' parser **NOT DETECTED**: "' + k + '", but returns ' + v );
|
||||
}
|
||||
});
|
||||
// test for undefined & null - probably overkill
|
||||
strictEqual( p[i].format(undef, table1, th0, 0), undef, t + ' parser: will return undefined values properly' );
|
||||
strictEqual( p[i].format(null, table1, th0, 0), null, t + ' parser: will return null values properly' );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
test( "testing parsers", function() {
|
||||
expect(parserTests);
|
||||
report(sample1);
|
||||
|
||||
c1.sortLocaleCompare = true;
|
||||
c1.ignoreCase = false;
|
||||
c1.usNumberFormat = false;
|
||||
th0.dateFormat = c1.dateFormat = "ddmmyyyy";
|
||||
report(sample2);
|
||||
|
||||
c1.usNumberFormat = true;
|
||||
th0.dateFormat = c1.dateFormat = "yyyymmdd";
|
||||
report(sample3);
|
||||
|
||||
// undocumented sortValue
|
||||
equal( ts.getParserById('metadata').format(null, table1, th0, 0), 'zzz', 'metadata parser found sortValue');
|
||||
c1.parserMetadataName = 'poe';
|
||||
equal( ts.getParserById('metadata').format(null, table1, th0, 0), 'nevermore', 'metadata parser found poe');
|
||||
|
||||
});
|
||||
|
||||
test( "textExtraction Method", function() {
|
||||
expect(4);
|
||||
|
||||
$table1.trigger('sorton', [[[ 0,0 ]]]);
|
||||
tester.cacheCompare( table1, 0, [ 'test1', 'test2', 'test3', '', 'testa', 'testb', 'testc' ], 'from data-attribute' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 0,1 ]]]);
|
||||
tester.cacheCompare( table3, 0, [ '', 'a255', 'a102', 'a87', 'a55', 'a43', 'a33', 'a10', 'a02', 'a1' ], 'ignore data-attribute' );
|
||||
|
||||
tester.cacheCompare( table4, 1, [ 'f11', 'f11', 'f12', 'f12', 'f12', 'f12', 'f12', 'f13', 'f13', 'f13' ], 'extract using class name' );
|
||||
|
||||
tester.cacheCompare( table4, 2, [ 'a21', 'a21', 'a23', 'a23', 'a23', 'a22', 'a22', 'a23', 'a24', 'a24' ], 'extract using column index' );
|
||||
|
||||
});
|
||||
|
||||
/************************************************
|
||||
test parser cache
|
||||
************************************************/
|
||||
test( "parser cache; sorton methods; empty & string", function() {
|
||||
expect(18);
|
||||
$table1.trigger('sortReset');
|
||||
|
||||
// lower case because table was parsed before c1.ignoreCase was changed
|
||||
tester.cacheCompare( table1, 'all', [ 'test2', 'x2', 'test1', 'x3', 'test3', 'x1', '', '', 'testb', 'x5', 'testc', 'x4', 'testa', 'x6' ], 'unsorted' );
|
||||
|
||||
$table1.trigger('sorton', [[[ 0,0 ]]]);
|
||||
tester.cacheCompare( table1, 'all', [ 'test1', 'x3', 'test2', 'x2', 'test3', 'x1', '', '', 'testa', 'x6', 'testb', 'x5', 'testc', 'x4' ], 'ascending sort' );
|
||||
|
||||
$table1.trigger('sorton', [[[ 0,1 ]]]);
|
||||
tester.cacheCompare( table1, 'all', [ 'test3', 'x1', 'test2', 'x2', 'test1', 'x3', '', '', 'testc', 'x4', 'testb', 'x5', 'testa', 'x6' ], 'descending sort' );
|
||||
|
||||
// empty cell position
|
||||
$table3.trigger('sorton', [[[ 0,0 ]]]);
|
||||
tester.cacheCompare( table3, 0, [ '', 'a1', 'a02', 'a10', 'a33', 'a43', 'a55', 'a87', 'a102', 'a255' ], 'asc sort; empty to top' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 0,1 ]]]);
|
||||
tester.cacheCompare( table3, 0, [ '', 'a255', 'a102', 'a87', 'a55', 'a43', 'a33', 'a10', 'a02', 'a1' ], 'desc sort; empty to top' );
|
||||
|
||||
// string position within number column
|
||||
$table3.trigger('sorton', [[[ 1,0 ]]]);
|
||||
tester.cacheCompare( table3, 1, [ -35, -5, -1, 1, 2, 4, 33, 44, 'nr', '' ], 'asc sort; empty to bottom; string to max' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 1,1 ]]]);
|
||||
tester.cacheCompare( table3, 1, [ 'nr', 44, 33, 4, 2, 1, -1, -5, -35, '' ], 'desc sort; empty to bottom; string to max' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 2,0 ]]]);
|
||||
tester.cacheCompare( table3, 2, [ 'nr', 'nr', 1, 2, 3, 4, 5, 6, 7, '' ], 'asc sort; empty to bottom; string to min' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 2,1 ]]]);
|
||||
tester.cacheCompare( table3, 2, [ 7, 6, 5, 4, 3, 2, 1, 'nr', 'nr', '' ], 'desc sort; empty to bottom; string to min' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 3,0 ]]]);
|
||||
tester.cacheCompare( table3, 3, [ 'n/a #2', 'n/a #1', -8.4, -2.2, -0.1, '', 5.2, 11.4, 23.6, 97.4 ], 'asc sort; empty to zero; string to top' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 3,1 ]]]);
|
||||
tester.cacheCompare( table3, 3, [ 'n/a #2', 'n/a #1', 97.4, 23.6, 11.4, 5.2, '', -0.1, -2.2, -8.4 ], 'desc sort; empty to zero; string to top' );
|
||||
|
||||
$table3.find('th:eq(3)').data('string', 'bottom');
|
||||
$table3.trigger('update');
|
||||
tester.cacheCompare( table3, 3, [ 97.4, 23.6, 11.4, 5.2, '', -0.1, -2.2, -8.4, 'n/a #1', 'n/a #2' ], 'desc sort; empty to zero; string to bottom' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 3,0 ]]]);
|
||||
tester.cacheCompare( table3, 3, [ -8.4, -2.2, -0.1, '', 5.2, 11.4, 23.6, 97.4, 'n/a #1', 'n/a #2' ], 'asc sort; empty to zero; string to bottom' );
|
||||
|
||||
$table3.find('th:eq(3)').data('string', 'none');
|
||||
c3.headers[3].empty = "bottom";
|
||||
c3.sortList = [[ 3, 1 ]]; // added to test sortList
|
||||
$table3.trigger('update');
|
||||
tester.cacheCompare( table3, 3, [ 97.4, 23.6, 11.4, 5.2, 'n/a #1', 'n/a #2', -0.1, -2.2, -8.4, '' ], 'desc sort; empty to zero; string to none/zero' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 3,0 ]]]);
|
||||
tester.cacheCompare( table3, 3, [ -8.4, -2.2, -0.1, 'n/a #1', 'n/a #2', 5.2, 11.4, 23.6, 97.4, '' ], 'asc sort; empty to zero; string to none/zero' );
|
||||
|
||||
t = [ 'x', 'X', 'y', 'Y', 'z', 'Z', 'a', 'A', 'b', 'B', 'c', 'C' ];
|
||||
deepEqual( t.sort($.tablesorter.sortText), [ 'A', 'B', 'C', 'X', 'Y', 'Z', 'a', 'b', 'c', 'x', 'y', 'z' ], 'test sortText function directly' );
|
||||
|
||||
t = [ 'a02', 'a10', 'a43', 'a255', 'a102', 'a33', '', 'a1', 'a55', 'a87' ];
|
||||
deepEqual( t.sort($.tablesorter.sortNatural), [ '', 'a1', 'a02', 'a10', 'a33', 'a43', 'a55', 'a87', 'a102', 'a255' ], 'test sortNatural function directly' );
|
||||
|
||||
tester.cacheCompare( table4, 6, [ '', '', '', '', '', '', '', '', '', '' ], 'parser-false does not extract text' );
|
||||
|
||||
});
|
||||
|
||||
test( "sorton methods", function(){
|
||||
expect(6);
|
||||
|
||||
$table3.trigger('sorton', [[[ 0,'d' ]]]);
|
||||
equal( c3.sortList + '', '0,1', 'sorton desc [0,"d"]' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 0,'a' ]]]);
|
||||
equal( c3.sortList + '', '0,0', 'sorton asc [0,"a"]' );
|
||||
|
||||
$table3.trigger('sorton', [[[ 0,'n' ]]]);
|
||||
equal( c3.sortList + '', '0,1', 'sorton next [0,"n"]' );
|
||||
$table3.trigger('sorton', [[[ 0,'n' ]]]);
|
||||
equal( c3.sortList + '', '0,0', 'sorton next [0,"n"]' );
|
||||
|
||||
$table3.trigger('sorton', [[ [ 0,'n'], [1,'o'], [2,'s'] ]]);
|
||||
equal( c3.sortList + '', '0,1,1,0,2,1', 'sorton next/opposite/same [0,"n"],[1,"o"],[2,"s"]' );
|
||||
|
||||
$table3.trigger('sorton', [[ [ 0,'n'], [1,'o'], [2,'s'] ]]);
|
||||
equal( c3.sortList + '', '0,0,1,1,2,0', 'sorton next/opposite/same [0,"n"],[1,"o"],[2,"s"]' );
|
||||
|
||||
});
|
||||
|
||||
test( "sort Events", function(){
|
||||
expect(1);
|
||||
|
||||
$table1.add($table5).bind( events.join('.testing '), function(e){
|
||||
if (e.type === events[sortIndx%3]) {
|
||||
sortIndx++;
|
||||
}
|
||||
});
|
||||
|
||||
$table1.trigger('sorton', [[[ 0,0 ]]]);
|
||||
$table1.trigger('sorton', [[[ 1,0 ]]]);
|
||||
|
||||
// ensure all sort events fire on an empty table
|
||||
$table5.trigger('sorton', [ [[0,0]] ]);
|
||||
|
||||
$table1.add($table5).unbind( events.join('.testing ') );
|
||||
|
||||
// table1 sorted twice in the above test; sortIndx = 9 then empty table5 x1 (total = 3 events x 3)
|
||||
equal( sortIndx, 9, 'sortStart, sortBegin & sortEnd fired in order x2; including empty table' );
|
||||
});
|
||||
|
||||
/************************************************
|
||||
test update methods
|
||||
************************************************/
|
||||
test( "parser cache; update methods & callbacks", function() {
|
||||
expect(10);
|
||||
var oldColMax;
|
||||
c1.ignoreCase = true;
|
||||
// updateAll
|
||||
$table1
|
||||
.trigger('sorton', [ [[0,1]] ])
|
||||
.bind('updateComplete.testing', function(){ updateIndx++; })
|
||||
.find('th:eq(1)').removeAttr('class').html('num').end()
|
||||
.find('td:nth-child(2)').html(function(i,h){
|
||||
return h.substring(1);
|
||||
});
|
||||
$table1
|
||||
.trigger('updateAll', [false, function(){
|
||||
updateCallback++;
|
||||
var nw = $table1.find('th:eq(1)')[0],
|
||||
hc = c1.headerContent[1] === 'num',
|
||||
hd = c1.$headers[1] === nw,
|
||||
hl = c1.headerList[1] === nw,
|
||||
p1 = c1.parsers[1].id === 'digit';
|
||||
equal(hc && hd && hl && p1, true, 'testing header cache: updateAll - thead');
|
||||
tester.cacheCompare( table1, 'all', [ 'test3', 1, 'test2', 2, 'test1', 3, '', '', 'testc', 4, 'testb', 5, 'testa', 6 ], 'updateAll - tbody' );
|
||||
}]);
|
||||
|
||||
// addRows
|
||||
t = $('<tr class="temp"><td>testd</td><td>7</td></tr>');
|
||||
$table1.find('tbody:last').prepend(t);
|
||||
oldColMax = c1.cache[2].colMax[1];
|
||||
$table1.trigger('addRows', [t, true, function(){
|
||||
updateCallback++;
|
||||
equal( oldColMax === 6 && c1.cache[2].colMax[1] === 7, true, 'addRows includes updating colMax value');
|
||||
tester.cacheCompare( table1, 'all', [ 'test3', 1, 'test2', 2, 'test1', 3, '', '', 'testd', 7, 'testc', 4, 'testb', 5, 'testa', 6 ], 'addRows method' );
|
||||
}]);
|
||||
|
||||
// updateCell
|
||||
t = $table1.find('td:contains("7")');
|
||||
t.html('-8');
|
||||
oldColMax = c1.cache[2].colMax[1];
|
||||
$table1.trigger('updateCell', [t[0], true, function(){
|
||||
updateCallback++;
|
||||
equal( oldColMax === 7 && c1.cache[2].colMax[1] === 8, true, 'updateCell includes updating colMax value');
|
||||
tester.cacheCompare( table1, 'all', [ 'test3', 1, 'test2', 2, 'test1', 3, '', '', 'testd', -8, 'testc', 4, 'testb', 5, 'testa', 6 ], 'updateCell method' );
|
||||
}]);
|
||||
|
||||
// update
|
||||
$table1.find('tr.temp').remove();
|
||||
oldColMax = c1.cache[2].colMax[1];
|
||||
$table1.trigger('update', [true, function(){
|
||||
updateCallback++;
|
||||
equal( oldColMax === 8 && c1.cache[2].colMax[1] === 6, true, 'update includes updating colMax value');
|
||||
tester.cacheCompare( table1, 'all', [ 'test3', 1, 'test2', 2, 'test1', 3, '', '', 'testc', 4, 'testb', 5, 'testa', 6 ], 'update method' );
|
||||
}]);
|
||||
|
||||
$table5
|
||||
.bind('updateComplete.testing', function(){ updateIndx++; })
|
||||
.trigger('update', [true, function(){
|
||||
updateCallback++;
|
||||
tester.cacheCompare( table5, 'all', [], 'update method on empty table' );
|
||||
}]);
|
||||
|
||||
$table1.add($table5).unbind('updateComplete.testing');
|
||||
|
||||
// table1 updated 4x in the above test
|
||||
// table5 updated 1x
|
||||
equal( updateIndx, updateCallback, 'updatedComplete and update callback functions working properly' );
|
||||
|
||||
});
|
||||
|
||||
/************************************************
|
||||
test sortForce, sortAppend, sortMultiSortKey and sortResetKey options
|
||||
************************************************/
|
||||
asyncTest( "sortForce, sortAppend, sortMultiSortKey & sortResetKey; and numberSorter option", function(){
|
||||
expect(3);
|
||||
var count = 0;
|
||||
tester.cacheCompare( table4, 3, [ 2, 1, 7, 6, 5, 3, 4, 8, 9, 10 ], 'force x2 + sorted x2 + append x2, ascending' );
|
||||
$table4.on('sortEnd', function(){
|
||||
count++;
|
||||
if (count === 1) {
|
||||
tester.cacheCompare( table4, 3, [ 2, 1, 6, 7, 5, 4, 3, 8, 10, 9 ], 'force x2 + sorted x2 + append x2, descending' );
|
||||
c4.sortResetKey = 'shiftKey';
|
||||
var e = $.Event('sort');
|
||||
e.which = 1;
|
||||
e.shiftKey = true; // testing sortResetKey
|
||||
c4.$headers.eq(0).trigger(e);
|
||||
} else {
|
||||
tester.cacheCompare( table4, 3, [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'sortResetKey' );
|
||||
$table4.off('sortEnd');
|
||||
start();
|
||||
}
|
||||
});
|
||||
var e = $.Event('sort');
|
||||
c4.sortMultiSortKey = 'altKey';
|
||||
e.which = 1;
|
||||
e.altKey = true; // testing sortMultiSortKey
|
||||
c4.$headers.eq(5).trigger(e);
|
||||
});
|
||||
|
||||
/************************************************
|
||||
check header css
|
||||
************************************************/
|
||||
test( "testing header css & sortReset method", function(){
|
||||
expect(7);
|
||||
t = $(th0);
|
||||
equal( $table1.hasClass(ts.css.table), true, 'table class applied');
|
||||
equal( t.hasClass(ts.css.header), true, 'Header class present' );
|
||||
equal( t.parent().hasClass(ts.css.headerRow), true, 'Header row class present' );
|
||||
equal( $table1.find('tbody:eq(1)').hasClass(c1.cssInfoBlock), true, 'Tbody info block class present' );
|
||||
$table1.trigger('sorton', [[[ 0,1 ]]] );
|
||||
equal( t.hasClass(ts.css.sortDesc), true, 'Descending class present' );
|
||||
$table1.trigger('sorton', [[[ 0,0 ]]] );
|
||||
equal( t.hasClass(ts.css.sortAsc), true, 'Ascending class present' );
|
||||
$table1.trigger('sortReset');
|
||||
equal( t.hasClass(ts.css.sortAsc) || t.hasClass(ts.css.sortDesc), false, 'Testing sortReset' );
|
||||
});
|
||||
|
||||
/************************************************
|
||||
test apply widgets function using zebra widget
|
||||
************************************************/
|
||||
var zebra = function(){
|
||||
t = true;
|
||||
var classes = ['odd','even'];
|
||||
$table2.find('tbody tr').each(function(i){
|
||||
t = t ? $(this).hasClass( classes[i%2] ) : false;
|
||||
});
|
||||
return t;
|
||||
};
|
||||
|
||||
test( "apply zebra widget", function(){
|
||||
expect(3);
|
||||
equal( zebra(), false, 'zebra not applied' );
|
||||
c2.widgets = [ 'zebra' ];
|
||||
$table2.trigger('applyWidgets');
|
||||
equal( zebra(), true, 'zebra is applied' );
|
||||
$table2
|
||||
.append('<tr><td>s</td><td>t</td><td>u</td><td>v</td></tr>')
|
||||
.trigger('update');
|
||||
equal( zebra(), true, 'zebra is applied after update' );
|
||||
});
|
||||
|
||||
/************************************************
|
||||
check destroy method
|
||||
************************************************/
|
||||
test("testing destroy method", function(){
|
||||
$table2.trigger('sorton', [[[ 0,1 ]]] );
|
||||
$table2.trigger('destroy');
|
||||
expect(7);
|
||||
t = $table2.find('th:first');
|
||||
e = jQuery._data(table2, 'events'); // get a list of all bound events
|
||||
equal( $.isEmptyObject(e), true, 'no events applied' );
|
||||
equal( $table2.data().hasOwnProperty('tablesorter'), false, 'Data removed' );
|
||||
equal( $table2.attr('class'), 'tester', 'All table classes removed' );
|
||||
equal( $table2.find('tr:first').attr('class'), '', 'Header row class removed' );
|
||||
equal( t.attr('class').match('tablesorter'), null, 'Header classes removed' );
|
||||
equal( t.children().length, 0, 'Inner wrapper removed' );
|
||||
equal( typeof (t.data().column) , 'undefined', 'data-column removed');
|
||||
|
||||
$table2.tablesorter();
|
||||
});
|
||||
|
||||
/************************************************
|
||||
ipv6 parser testing
|
||||
************************************************/
|
||||
ipv6tests();
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user