DataTables added for use on History Grid.

This commit is contained in:
Mark McDowall 2012-02-08 00:17:40 -08:00
parent e42f0222dc
commit 6ffc429ae0
254 changed files with 154683 additions and 56 deletions

View file

@ -0,0 +1,121 @@
(function() {
var showingNav = true;
$(document).ready( function () {
var jqNav = $('div.fw_nav');
jqNav.css('right', ($(window).width() - $('div.fw_container').width()) /2);
var n = $('div.nav_blocker')[0];
n.style.height = $(jqNav).outerHeight()+"px";
n.style.width = $(jqNav).outerWidth()+"px";
SyntaxHighlighter.highlight();
$('#private_toggle').click( function () {
if ( $('input[name=show_private]').val() == 0 ) {
$('input[name=show_private]').val( 1 );
$('#private_label').html('Showing');
$('.private').css('display', 'block');
} else {
$('input[name=show_private]').val( 0 );
$('#private_label').html('Hiding');
$('.private').css('display', 'none');
}
fnWriteCookie();
return false;
} );
$('#extended_toggle').click( function () {
if ( $('input[name=show_extended]').val() == 0 ) {
$('input[name=show_extended]').val( 1 );
$('#extended_label').html('Showing');
$('.augmented').css('display', 'block');
} else {
$('input[name=show_extended]').val( 0 );
$('#extended_label').html('Hiding');
$('.augmented').css('display', 'none');
}
fnWriteCookie();
return false;
} );
var savedHeight = $(jqNav).height();
$('div.fw_nav h2').click( function () {
if ( showingNav ) {
$('div.fw_nav').animate( {
"height": 10,
"opacity": 0.3
} );
showingNav = false;
} else {
$('div.fw_nav').animate( {
"height": savedHeight,
"opacity": 1
} );
showingNav = true;
}
fnWriteCookie();
} );
var cookie = fnReadCookie( 'SpryMedia_JSDoc' );
if ( cookie != null ) {
var a = cookie.split('-');
if ( a[0] == 1 ) {
$('#private_toggle').click();
}
if ( a[1] == 0 ) {
$('#extended_toggle').click();
}
if ( a[2] == 'false' ) {
$('div.fw_nav').css('height', 10).css('opacity', 0.3);
showingNav = false;
}
}
} );
function fnWriteCookie()
{
var sVal =
$('input[name=show_private]').val()+'-'+
$('input[name=show_extended]').val()+'-'+
showingNav;
fnCreateCookie( 'SpryMedia_JSDoc', sVal );
}
function fnCreateCookie( sName, sValue )
{
var iDays = 365;
var date = new Date();
date.setTime( date.getTime()+(iDays*24*60*60*1000) );
var sExpires = "; expires="+date.toGMTString();
document.cookie = sName+"="+sValue+sExpires+"; path=/";
}
function fnReadCookie( sName )
{
var sNameEQ = sName + "=";
var sCookieContents = document.cookie.split(';');
for( var i=0 ; i<sCookieContents.length ; i++ ) {
var c = sCookieContents[i];
while (c.charAt(0)==' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(sNameEQ) == 0) {
return c.substring(sNameEQ.length,c.length);
}
}
return null;
}
})();

View file

@ -0,0 +1,52 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'break case catch continue ' +
'default delete do else false ' +
'for function if in instanceof ' +
'new null return super switch ' +
'this throw true try typeof var while with'
;
var r = SyntaxHighlighter.regexLib;
this.regexList = [
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
];
this.forHtmlScript(r.scriptScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['js', 'jscript', 'javascript'];
SyntaxHighlighter.brushes.JScript = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,820 @@
/*
* File: AutoFill.js
* Version: 1.1.2
* CVS: $Id$
* Description: AutoFill for DataTables
* Author: Allan Jardine (www.sprymedia.co.uk)
* Created: Mon 6 Sep 2010 16:54:41 BST
* Modified: $Date$ by $Author$
* Language: Javascript
* License: GPL v2 or BSD 3 point
* Project: DataTables
* Contact: www.sprymedia.co.uk/contact
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, available at:
* http://datatables.net/license_gpl2
* http://datatables.net/license_bsd
*
*/
/* Global scope for AutoFill */
var AutoFill;
(function($) {
/**
* AutoFill provides Excel like auto fill features for a DataTable
* @class AutoFill
* @constructor
* @param {object} DataTables settings object
* @param {object} Configuration object for AutoFill
*/
AutoFill = function( oDT, oConfig )
{
/* Santiy check that we are a new instance */
if ( !this.CLASS || this.CLASS != "AutoFill" )
{
alert( "Warning: AutoFill must be initialised with the keyword 'new'" );
return;
}
if ( !$.fn.dataTableExt.fnVersionCheck('1.7.0') )
{
alert( "Warning: AutoFill requires DataTables 1.7 or greater - www.datatables.net/download");
return;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public class variables
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @namespace Settings object which contains customisable information for AutoFill instance
*/
this.s = {
/**
* @namespace Cached information about the little dragging icon (the filler)
*/
"filler": {
"height": 0,
"width": 0
},
/**
* @namespace Cached information about the border display
*/
"border": {
"width": 2
},
/**
* @namespace Store for live information for the current drag
*/
"drag": {
"startX": -1,
"startY": -1,
"startTd": null,
"endTd": null,
"dragging": false
},
/**
* @namespace Data cache for information that we need for scrolling the screen when we near
* the edges
*/
"screen": {
"interval": null,
"y": 0,
"height": 0,
"scrollTop": 0
},
/**
* @namespace Data cache for the position of the DataTables scrolling element (when scrolling
* is enabled)
*/
"scroller": {
"top": 0,
"bottom": 0
},
/**
* @namespace Information stored for each column. An array of objects
*/
"columns": []
};
/**
* @namespace Common and useful DOM elements for the class instance
*/
this.dom = {
"table": null,
"filler": null,
"borderTop": null,
"borderRight": null,
"borderBottom": null,
"borderLeft": null,
"currentTarget": null
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public class methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Retreieve the settings object from an instance
* @method fnSettings
* @returns {object} AutoFill settings object
*/
this.fnSettings = function () {
return this.s;
};
/* Constructor logic */
this._fnInit( oDT, oConfig );
return this;
};
AutoFill.prototype = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods (they are of course public in JS, but recommended as private)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Initialisation
* @method _fnInit
* @param {object} oDT DataTables settings object
* @param {object} oConfig Configuration object for AutoFill
* @returns void
*/
"_fnInit": function ( oDT, oConfig )
{
var
that = this,
i, iLen;
/*
* Settings
*/
this.s.dt = oDT.fnSettings();
this.dom.table = this.s.dt.nTable;
/* Add and configure the columns */
for ( i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
{
this._fnAddColumn( i );
}
if ( typeof oConfig != 'undefined' && typeof oConfig.aoColumnDefs != 'undefined' )
{
this._fnColumnDefs( oConfig.aoColumnDefs );
}
if ( typeof oConfig != 'undefined' && typeof oConfig.aoColumns != 'undefined' )
{
this._fnColumnsAll( oConfig.aoColumns );
}
/*
* DOM
*/
/* Auto Fill click and drag icon */
var filler = document.createElement('div');
filler.className = "AutoFill_filler";
document.body.appendChild( filler );
this.dom.filler = filler;
filler.style.display = "block";
this.s.filler.height = $(filler).height();
this.s.filler.width = $(filler).width();
filler.style.display = "none";
/* Border display - one div for each side. We can't just use a single one with a border, as
* we want the events to effectively pass through the transparent bit of the box
*/
var border;
var appender = document.body;
if ( that.s.dt.oScroll.sY !== "" )
{
that.s.dt.nTable.parentNode.style.position = "relative";
appender = that.s.dt.nTable.parentNode;
}
border = document.createElement('div');
border.className = "AutoFill_border";
appender.appendChild( border );
this.dom.borderTop = border;
border = document.createElement('div');
border.className = "AutoFill_border";
appender.appendChild( border );
this.dom.borderRight = border;
border = document.createElement('div');
border.className = "AutoFill_border";
appender.appendChild( border );
this.dom.borderBottom = border;
border = document.createElement('div');
border.className = "AutoFill_border";
appender.appendChild( border );
this.dom.borderLeft = border;
/*
* Events
*/
$(filler).mousedown( function (e) {
this.onselectstart = function() { return false; };
that._fnFillerDragStart.call( that, e );
return false;
} );
$('tbody>tr>td', this.dom.table).live( 'mouseover mouseout', function (e) {
that._fnFillerDisplay.call( that, e );
} );
},
"_fnColumnDefs": function ( aoColumnDefs )
{
var
i, j, k, iLen, jLen, kLen,
aTargets;
/* Loop over the column defs array - loop in reverse so first instace has priority */
for ( i=aoColumnDefs.length-1 ; i>=0 ; i-- )
{
/* Each column def can target multiple columns, as it is an array */
aTargets = aoColumnDefs[i].aTargets;
for ( j=0, jLen=aTargets.length ; j<jLen ; j++ )
{
if ( typeof aTargets[j] == 'number' && aTargets[j] >= 0 )
{
/* 0+ integer, left to right column counting. */
this._fnColumnOptions( aTargets[j], aoColumnDefs[i] );
}
else if ( typeof aTargets[j] == 'number' && aTargets[j] < 0 )
{
/* Negative integer, right to left column counting */
this._fnColumnOptions( this.s.dt.aoColumns.length+aTargets[j], aoColumnDefs[i] );
}
else if ( typeof aTargets[j] == 'string' )
{
/* Class name matching on TH element */
for ( k=0, kLen=this.s.dt.aoColumns.length ; k<kLen ; k++ )
{
if ( aTargets[j] == "_all" ||
this.s.dt.aoColumns[k].nTh.className.indexOf( aTargets[j] ) != -1 )
{
this._fnColumnOptions( k, aoColumnDefs[i] );
}
}
}
}
}
},
"_fnColumnsAll": function ( aoColumns )
{
for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
{
this._fnColumnOptions( i, aoColumns[i] );
}
},
"_fnAddColumn": function ( i )
{
this.s.columns[i] = {
"enable": true,
"read": this._fnReadCell,
"write": this._fnWriteCell,
"step": this._fnStep,
"complete": null
};
},
"_fnColumnOptions": function ( i, opts )
{
if ( typeof opts.bEnable != 'undefined' )
{
this.s.columns[i].enable = opts.bEnable;
}
if ( typeof opts.fnRead != 'undefined' )
{
this.s.columns[i].read = opts.fnRead;
}
if ( typeof opts.fnWrite != 'undefined' )
{
this.s.columns[i].write = opts.fnWrite;
}
if ( typeof opts.fnStep != 'undefined' )
{
this.s.columns[i].step = opts.fnStep;
}
if ( typeof opts.fnCallback != 'undefined' )
{
this.s.columns[i].complete = opts.fnCallback;
}
},
/**
* Find out the coordinates of a given TD cell in a table
* @method _fnTargetCoords
* @param {Node} nTd
* @returns {Object} x and y properties, for the position of the cell in the tables DOM
*/
"_fnTargetCoords": function ( nTd )
{
var nTr = $(nTd).parents('tr')[0];
return {
"x": $('td', nTr).index(nTd),
"y": $('tr', nTr.parentNode).index(nTr)
};
},
/**
* Display the border around one or more cells (from start to end)
* @method _fnUpdateBorder
* @param {Node} nStart Starting cell
* @param {Node} nEnd Ending cell
* @returns void
*/
"_fnUpdateBorder": function ( nStart, nEnd )
{
var
border = this.s.border.width,
offsetStart = $(nStart).offset(),
offsetEnd = $(nEnd).offset(),
x1 = offsetStart.left - border,
x2 = offsetEnd.left + $(nEnd).outerWidth(),
y1 = offsetStart.top - border,
y2 = offsetEnd.top + $(nEnd).outerHeight(),
width = offsetEnd.left + $(nEnd).outerWidth() - offsetStart.left + (2*border),
height = offsetEnd.top + $(nEnd).outerHeight() - offsetStart.top + (2*border),
oStyle;
if ( this.s.dt.oScroll.sY !== "" )
{
/* The border elements are inside the DT scroller - so position relative to that */
var
offsetScroll = $(this.s.dt.nTable.parentNode).offset(),
scrollTop = $(this.s.dt.nTable.parentNode).scrollTop(),
scrollLeft = $(this.s.dt.nTable.parentNode).scrollLeft();
x1 -= offsetScroll.left - scrollLeft;
x2 -= offsetScroll.left - scrollLeft;
y1 -= offsetScroll.top - scrollTop;
y2 -= offsetScroll.top - scrollTop;
}
/* Top */
oStyle = this.dom.borderTop.style;
oStyle.top = y1+"px";
oStyle.left = x1+"px";
oStyle.height = this.s.border.width+"px";
oStyle.width = width+"px";
/* Bottom */
oStyle = this.dom.borderBottom.style;
oStyle.top = y2+"px";
oStyle.left = x1+"px";
oStyle.height = this.s.border.width+"px";
oStyle.width = width+"px";
/* Left */
oStyle = this.dom.borderLeft.style;
oStyle.top = y1+"px";
oStyle.left = x1+"px";
oStyle.height = height+"px";
oStyle.width = this.s.border.width+"px";
/* Right */
oStyle = this.dom.borderRight.style;
oStyle.top = y1+"px";
oStyle.left = x2+"px";
oStyle.height = height+"px";
oStyle.width = this.s.border.width+"px";
},
/**
* Mouse down event handler for starting a drag
* @method _fnFillerDragStart
* @param {Object} e Event object
* @returns void
*/
"_fnFillerDragStart": function (e)
{
var that = this;
var startingTd = this.dom.currentTarget;
this.s.drag.dragging = true;
that.dom.borderTop.style.display = "block";
that.dom.borderRight.style.display = "block";
that.dom.borderBottom.style.display = "block";
that.dom.borderLeft.style.display = "block";
var coords = this._fnTargetCoords( startingTd );
this.s.drag.startX = coords.x;
this.s.drag.startY = coords.y;
this.s.drag.startTd = startingTd;
this.s.drag.endTd = startingTd;
this._fnUpdateBorder( startingTd, startingTd );
$(document).bind('mousemove.AutoFill', function (e) {
that._fnFillerDragMove.call( that, e );
} );
$(document).bind('mouseup.AutoFill', function (e) {
that._fnFillerFinish.call( that, e );
} );
/* Scrolling information cache */
this.s.screen.y = e.pageY;
this.s.screen.height = $(window).height();
this.s.screen.scrollTop = $(document).scrollTop();
if ( this.s.dt.oScroll.sY !== "" )
{
this.s.scroller.top = $(this.s.dt.nTable.parentNode).offset().top;
this.s.scroller.bottom = this.s.scroller.top + $(this.s.dt.nTable.parentNode).height();
}
/* Scrolling handler - we set an interval (which is cancelled on mouse up) which will fire
* regularly and see if we need to do any scrolling
*/
this.s.screen.interval = setInterval( function () {
var iScrollTop = $(document).scrollTop();
var iScrollDelta = iScrollTop - that.s.screen.scrollTop;
that.s.screen.y += iScrollDelta;
if ( that.s.screen.height - that.s.screen.y + iScrollTop < 50 )
{
$('html, body').animate( {
"scrollTop": iScrollTop + 50
}, 240, 'linear' );
}
else if ( that.s.screen.y - iScrollTop < 50 )
{
$('html, body').animate( {
"scrollTop": iScrollTop - 50
}, 240, 'linear' );
}
if ( that.s.dt.oScroll.sY !== "" )
{
if ( that.s.screen.y > that.s.scroller.bottom - 50 )
{
$(that.s.dt.nTable.parentNode).animate( {
"scrollTop": $(that.s.dt.nTable.parentNode).scrollTop() + 50
}, 240, 'linear' );
}
else if ( that.s.screen.y < that.s.scroller.top + 50 )
{
$(that.s.dt.nTable.parentNode).animate( {
"scrollTop": $(that.s.dt.nTable.parentNode).scrollTop() - 50
}, 240, 'linear' );
}
}
}, 250 );
},
/**
* Mouse move event handler for during a move. See if we want to update the display based on the
* new cursor position
* @method _fnFillerDragMove
* @param {Object} e Event object
* @returns void
*/
"_fnFillerDragMove": function (e)
{
if ( e.target && e.target.nodeName.toUpperCase() == "TD" &&
e.target != this.s.drag.endTd )
{
var coords = this._fnTargetCoords( e.target );
if ( coords.x != this.s.drag.startX )
{
e.target = $('tbody>tr:eq('+coords.y+')>td:eq('+this.s.drag.startX+')', this.dom.table)[0];
coords = this._fnTargetCoords( e.target );
}
if ( coords.x == this.s.drag.startX )
{
var drag = this.s.drag;
drag.endTd = e.target;
if ( coords.y >= this.s.drag.startY )
{
this._fnUpdateBorder( drag.startTd, drag.endTd );
}
else
{
this._fnUpdateBorder( drag.endTd, drag.startTd );
}
this._fnFillerPosition( e.target );
}
}
/* Update the screen information so we can perform scrolling */
this.s.screen.y = e.pageY;
this.s.screen.scrollTop = $(document).scrollTop();
if ( this.s.dt.oScroll.sY !== "" )
{
this.s.scroller.scrollTop = $(this.s.dt.nTable.parentNode).scrollTop();
this.s.scroller.top = $(this.s.dt.nTable.parentNode).offset().top;
this.s.scroller.bottom = this.s.scroller.top + $(this.s.dt.nTable.parentNode).height();
}
},
/**
* Mouse release handler - end the drag and take action to update the cells with the needed values
* @method _fnFillerFinish
* @param {Object} e Event object
* @returns void
*/
"_fnFillerFinish": function (e)
{
var that = this;
$(document).unbind('mousemove.AutoFill');
$(document).unbind('mouseup.AutoFill');
this.dom.borderTop.style.display = "none";
this.dom.borderRight.style.display = "none";
this.dom.borderBottom.style.display = "none";
this.dom.borderLeft.style.display = "none";
this.s.drag.dragging = false;
clearInterval( this.s.screen.interval );
var coordsStart = this._fnTargetCoords( this.s.drag.startTd );
var coordsEnd = this._fnTargetCoords( this.s.drag.endTd );
var aTds = [];
var bIncrement;
if ( coordsStart.y <= coordsEnd.y )
{
bIncrement = true;
for ( i=coordsStart.y ; i<=coordsEnd.y ; i++ )
{
aTds.push( $('tbody>tr:eq('+i+')>td:eq('+coordsStart.x+')', this.dom.table)[0] );
}
}
else
{
bIncrement = false;
for ( i=coordsStart.y ; i>=coordsEnd.y ; i-- )
{
aTds.push( $('tbody>tr:eq('+i+')>td:eq('+coordsStart.x+')', this.dom.table)[0] );
}
}
var iColumn = coordsStart.x;
var bLast = false;
var aoEdited = [];
var sStart = this.s.columns[iColumn].read.call( this, this.s.drag.startTd );
var oPrepped = this._fnPrep( sStart );
for ( i=0, iLen=aTds.length ; i<iLen ; i++ )
{
if ( i==iLen-1 )
{
bLast = true;
}
var original = this.s.columns[iColumn].read.call( this, aTds[i] );
var step = this.s.columns[iColumn].step.call( this, aTds[i], oPrepped, i, bIncrement,
'SPRYMEDIA_AUTOFILL_STEPPER' );
this.s.columns[iColumn].write.call( this, aTds[i], step, bLast );
aoEdited.push( {
"td": aTds[i],
"newValue": step,
"oldValue": original
} );
}
if ( this.s.columns[iColumn].complete !== null )
{
this.s.columns[iColumn].complete.call( this, aoEdited );
}
},
/**
* Chunk a string such that it can be filled in by the stepper function
* @method _fnPrep
* @param {String} sStr String to prep
* @returns {Object} with parameters, iStart, sStr and sPostFix
*/
"_fnPrep": function ( sStr )
{
var aMatch = sStr.match(/[\d\.]+/g);
if ( !aMatch || aMatch.length === 0 )
{
return {
"iStart": 0,
"sStr": sStr,
"sPostFix": ""
};
}
var sLast = aMatch[ aMatch.length-1 ];
var num = parseInt(sLast, 10);
var regex = new RegExp( '^(.*)'+sLast+'(.*?)$' );
var decimal = sLast.match(/\./) ? "."+sLast.split('.')[1] : "";
return {
"iStart": num,
"sStr": sStr.replace(regex, "$1SPRYMEDIA_AUTOFILL_STEPPER$2"),
"sPostFix": decimal
};
},
/**
* Render a string for it's position in the table after the drag (incrememt numbers)
* @method _fnStep
* @param {Node} nTd Cell being written to
* @param {Object} oPrepped Prepared object for the stepper (from _fnPrep)
* @param {Int} iDiff Step difference
* @param {Boolean} bIncrement Increment (true) or decriment (false)
* @param {String} sToken Token to replace
* @returns {String} Rendered information
*/
"_fnStep": function ( nTd, oPrepped, iDiff, bIncrement, sToken )
{
var iReplace = bIncrement ? (oPrepped.iStart+iDiff) : (oPrepped.iStart-iDiff);
if ( isNaN(iReplace) )
{
iReplace = "";
}
return oPrepped.sStr.replace( sToken, iReplace+oPrepped.sPostFix );
},
/**
* Read informaiton from a cell, possibly using live DOM elements if suitable
* @method _fnReadCell
* @param {Node} nTd Cell to read
* @returns {String} Read value
*/
"_fnReadCell": function ( nTd )
{
var jq = $('input', nTd);
if ( jq.length > 0 )
{
return $(jq).val();
}
jq = $('select', nTd);
if ( jq.length > 0 )
{
return $(jq).val();
}
return nTd.innerHTML;
},
/**
* Write informaiton to a cell, possibly using live DOM elements if suitable
* @method _fnWriteCell
* @param {Node} nTd Cell to write
* @param {String} sVal Value to write
* @param {Boolean} bLast Flag to show if this is that last update
* @returns void
*/
"_fnWriteCell": function ( nTd, sVal, bLast )
{
var jq = $('input', nTd);
if ( jq.length > 0 )
{
$(jq).val( sVal );
return;
}
jq = $('select', nTd);
if ( jq.length > 0 )
{
$(jq).val( sVal );
return;
}
var pos = this.s.dt.oInstance.fnGetPosition( nTd );
this.s.dt.oInstance.fnUpdate( sVal, pos[0], pos[2], bLast );
},
/**
* Display the drag handle on mouse over cell
* @method _fnFillerDisplay
* @param {Object} e Event object
* @returns void
*/
"_fnFillerDisplay": function (e)
{
/* Don't display automatically when dragging */
if ( this.s.drag.dragging)
{
return;
}
/* Check that we are allowed to AutoFill this column or not */
var nTd = (e.target.nodeName.toLowerCase() == 'td') ? e.target : $(e.target).parents('td')[0];
var iX = this._fnTargetCoords(nTd).x;
if ( !this.s.columns[iX].enable )
{
return;
}
var filler = this.dom.filler;
if (e.type == 'mouseover')
{
this.dom.currentTarget = nTd;
this._fnFillerPosition( nTd );
filler.style.display = "block";
}
else if ( !e.relatedTarget || !e.relatedTarget.className.match(/AutoFill/) )
{
filler.style.display = "none";
}
},
/**
* Position the filler icon over a cell
* @method _fnFillerPosition
* @param {Node} nTd Cell to position filler icon over
* @returns void
*/
"_fnFillerPosition": function ( nTd )
{
var offset = $(nTd).offset();
var filler = this.dom.filler;
filler.style.top = (offset.top - (this.s.filler.height / 2)-1 + $(nTd).outerHeight())+"px";
filler.style.left = (offset.left - (this.s.filler.width / 2)-1 + $(nTd).outerWidth())+"px";
}
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constants
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Name of this class
* @constant CLASS
* @type String
* @default AutoFill
*/
AutoFill.prototype.CLASS = "AutoFill";
/**
* AutoFill version
* @constant VERSION
* @type String
* @default 1.1.2
*/
AutoFill.VERSION = "1.1.2";
AutoFill.prototype.VERSION = AutoFill.VERSION;
})(jQuery);

View file

@ -0,0 +1,33 @@
/*
* File: AutoFill.min.js
* Version: 1.1.2
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD (3 point) style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
var AutoFill;
(function(e){AutoFill=function(b,a){if(!this.CLASS||"AutoFill"!=this.CLASS)alert("Warning: AutoFill must be initialised with the keyword 'new'");else{if(e.fn.dataTableExt.fnVersionCheck("1.7.0"))return this.s={filler:{height:0,width:0},border:{width:2},drag:{startX:-1,startY:-1,startTd:null,endTd:null,dragging:!1},screen:{interval:null,y:0,height:0,scrollTop:0},scroller:{top:0,bottom:0},columns:[]},this.dom={table:null,filler:null,borderTop:null,borderRight:null,borderBottom:null,borderLeft:null,currentTarget:null},
this.fnSettings=function(){return this.s},this._fnInit(b,a),this;alert("Warning: AutoFill requires DataTables 1.7 or greater - www.datatables.net/download")}};AutoFill.prototype={_fnInit:function(b,a){var c=this,d,f;this.s.dt=b.fnSettings();this.dom.table=this.s.dt.nTable;for(d=0,f=this.s.dt.aoColumns.length;d<f;d++)this._fnAddColumn(d);"undefined"!=typeof a&&"undefined"!=typeof a.aoColumnDefs&&this._fnColumnDefs(a.aoColumnDefs);"undefined"!=typeof a&&"undefined"!=typeof a.aoColumns&&this._fnColumnsAll(a.aoColumns);
d=document.createElement("div");d.className="AutoFill_filler";document.body.appendChild(d);this.dom.filler=d;d.style.display="block";this.s.filler.height=e(d).height();this.s.filler.width=e(d).width();d.style.display="none";var h=document.body;if(""!==c.s.dt.oScroll.sY)c.s.dt.nTable.parentNode.style.position="relative",h=c.s.dt.nTable.parentNode;f=document.createElement("div");f.className="AutoFill_border";h.appendChild(f);this.dom.borderTop=f;f=document.createElement("div");f.className="AutoFill_border";
h.appendChild(f);this.dom.borderRight=f;f=document.createElement("div");f.className="AutoFill_border";h.appendChild(f);this.dom.borderBottom=f;f=document.createElement("div");f.className="AutoFill_border";h.appendChild(f);this.dom.borderLeft=f;e(d).mousedown(function(a){this.onselectstart=function(){return!1};c._fnFillerDragStart.call(c,a);return!1});e("tbody>tr>td",this.dom.table).live("mouseover mouseout",function(a){c._fnFillerDisplay.call(c,a)})},_fnColumnDefs:function(b){var a,c,d,e,h,g;for(a=
b.length-1;0<=a;a--){g=b[a].aTargets;for(c=0,e=g.length;c<e;c++)if("number"==typeof g[c]&&0<=g[c])this._fnColumnOptions(g[c],b[a]);else if("number"==typeof g[c]&&0>g[c])this._fnColumnOptions(this.s.dt.aoColumns.length+g[c],b[a]);else if("string"==typeof g[c])for(d=0,h=this.s.dt.aoColumns.length;d<h;d++)("_all"==g[c]||-1!=this.s.dt.aoColumns[d].nTh.className.indexOf(g[c]))&&this._fnColumnOptions(d,b[a])}},_fnColumnsAll:function(b){for(var a=0,c=this.s.dt.aoColumns.length;a<c;a++)this._fnColumnOptions(a,
b[a])},_fnAddColumn:function(b){this.s.columns[b]={enable:!0,read:this._fnReadCell,write:this._fnWriteCell,step:this._fnStep,complete:null}},_fnColumnOptions:function(b,a){if("undefined"!=typeof a.bEnable)this.s.columns[b].enable=a.bEnable;if("undefined"!=typeof a.fnRead)this.s.columns[b].read=a.fnRead;if("undefined"!=typeof a.fnWrite)this.s.columns[b].write=a.fnWrite;if("undefined"!=typeof a.fnStep)this.s.columns[b].step=a.fnStep;if("undefined"!=typeof a.fnCallback)this.s.columns[b].complete=a.fnCallback},
_fnTargetCoords:function(b){var a=e(b).parents("tr")[0];return{x:e("td",a).index(b),y:e("tr",a.parentNode).index(a)}},_fnUpdateBorder:function(b,a){var c=this.s.border.width,d=e(b).offset(),f=e(a).offset(),h=d.left-c,g=f.left+e(a).outerWidth(),j=d.top-c,k=f.top+e(a).outerHeight(),l=f.left+e(a).outerWidth()-d.left+2*c,c=f.top+e(a).outerHeight()-d.top+2*c;if(""!==this.s.dt.oScroll.sY)var d=e(this.s.dt.nTable.parentNode).offset(),f=e(this.s.dt.nTable.parentNode).scrollTop(),m=e(this.s.dt.nTable.parentNode).scrollLeft(),
h=h-(d.left-m),g=g-(d.left-m),j=j-(d.top-f),k=k-(d.top-f);d=this.dom.borderTop.style;d.top=j+"px";d.left=h+"px";d.height=this.s.border.width+"px";d.width=l+"px";d=this.dom.borderBottom.style;d.top=k+"px";d.left=h+"px";d.height=this.s.border.width+"px";d.width=l+"px";d=this.dom.borderLeft.style;d.top=j+"px";d.left=h+"px";d.height=c+"px";d.width=this.s.border.width+"px";d=this.dom.borderRight.style;d.top=j+"px";d.left=g+"px";d.height=c+"px";d.width=this.s.border.width+"px"},_fnFillerDragStart:function(b){var a=
this,c=this.dom.currentTarget;this.s.drag.dragging=!0;a.dom.borderTop.style.display="block";a.dom.borderRight.style.display="block";a.dom.borderBottom.style.display="block";a.dom.borderLeft.style.display="block";var d=this._fnTargetCoords(c);this.s.drag.startX=d.x;this.s.drag.startY=d.y;this.s.drag.startTd=c;this.s.drag.endTd=c;this._fnUpdateBorder(c,c);e(document).bind("mousemove.AutoFill",function(b){a._fnFillerDragMove.call(a,b)});e(document).bind("mouseup.AutoFill",function(b){a._fnFillerFinish.call(a,
b)});this.s.screen.y=b.pageY;this.s.screen.height=e(window).height();this.s.screen.scrollTop=e(document).scrollTop();if(""!==this.s.dt.oScroll.sY)this.s.scroller.top=e(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom=this.s.scroller.top+e(this.s.dt.nTable.parentNode).height();this.s.screen.interval=setInterval(function(){var b=e(document).scrollTop();a.s.screen.y+=b-a.s.screen.scrollTop;50>a.s.screen.height-a.s.screen.y+b?e("html, body").animate({scrollTop:b+50},240,"linear"):50>a.s.screen.y-
b&&e("html, body").animate({scrollTop:b-50},240,"linear");""!==a.s.dt.oScroll.sY&&(a.s.screen.y>a.s.scroller.bottom-50?e(a.s.dt.nTable.parentNode).animate({scrollTop:e(a.s.dt.nTable.parentNode).scrollTop()+50},240,"linear"):a.s.screen.y<a.s.scroller.top+50&&e(a.s.dt.nTable.parentNode).animate({scrollTop:e(a.s.dt.nTable.parentNode).scrollTop()-50},240,"linear"))},250)},_fnFillerDragMove:function(b){if(b.target&&"TD"==b.target.nodeName.toUpperCase()&&b.target!=this.s.drag.endTd){var a=this._fnTargetCoords(b.target);
if(a.x!=this.s.drag.startX)b.target=e("tbody>tr:eq("+a.y+")>td:eq("+this.s.drag.startX+")",this.dom.table)[0],a=this._fnTargetCoords(b.target);if(a.x==this.s.drag.startX){var c=this.s.drag;c.endTd=b.target;a.y>=this.s.drag.startY?this._fnUpdateBorder(c.startTd,c.endTd):this._fnUpdateBorder(c.endTd,c.startTd);this._fnFillerPosition(b.target)}}this.s.screen.y=b.pageY;this.s.screen.scrollTop=e(document).scrollTop();if(""!==this.s.dt.oScroll.sY)this.s.scroller.scrollTop=e(this.s.dt.nTable.parentNode).scrollTop(),
this.s.scroller.top=e(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom=this.s.scroller.top+e(this.s.dt.nTable.parentNode).height()},_fnFillerFinish:function(){e(document).unbind("mousemove.AutoFill");e(document).unbind("mouseup.AutoFill");this.dom.borderTop.style.display="none";this.dom.borderRight.style.display="none";this.dom.borderBottom.style.display="none";this.dom.borderLeft.style.display="none";this.s.drag.dragging=!1;clearInterval(this.s.screen.interval);var b=this._fnTargetCoords(this.s.drag.startTd),
a=this._fnTargetCoords(this.s.drag.endTd),c=[],d;if(b.y<=a.y){d=!0;for(i=b.y;i<=a.y;i++)c.push(e("tbody>tr:eq("+i+")>td:eq("+b.x+")",this.dom.table)[0])}else{d=!1;for(i=b.y;i>=a.y;i--)c.push(e("tbody>tr:eq("+i+")>td:eq("+b.x+")",this.dom.table)[0])}var b=b.x,a=!1,f=[],h=this._fnPrep(this.s.columns[b].read.call(this,this.s.drag.startTd));for(i=0,iLen=c.length;i<iLen;i++){i==iLen-1&&(a=!0);var g=this.s.columns[b].read.call(this,c[i]),j=this.s.columns[b].step.call(this,c[i],h,i,d,"SPRYMEDIA_AUTOFILL_STEPPER");
this.s.columns[b].write.call(this,c[i],j,a);f.push({td:c[i],newValue:j,oldValue:g})}null!==this.s.columns[b].complete&&this.s.columns[b].complete.call(this,f)},_fnPrep:function(b){var a=b.match(/[\d\.]+/g);if(!a||0===a.length)return{iStart:0,sStr:b,sPostFix:""};var c=a[a.length-1],a=parseInt(c,10),d=RegExp("^(.*)"+c+"(.*?)$"),c=c.match(/\./)?"."+c.split(".")[1]:"";return{iStart:a,sStr:b.replace(d,"$1SPRYMEDIA_AUTOFILL_STEPPER$2"),sPostFix:c}},_fnStep:function(b,a,c,d,e){b=d?a.iStart+c:a.iStart-c;
isNaN(b)&&(b="");return a.sStr.replace(e,b+a.sPostFix)},_fnReadCell:function(b){var a=e("input",b);if(0<a.length)return e(a).val();a=e("select",b);return 0<a.length?e(a).val():b.innerHTML},_fnWriteCell:function(b,a,c){var d=e("input",b);0<d.length?e(d).val(a):(d=e("select",b),0<d.length?e(d).val(a):(b=this.s.dt.oInstance.fnGetPosition(b),this.s.dt.oInstance.fnUpdate(a,b[0],b[2],c)))},_fnFillerDisplay:function(b){if(!this.s.drag.dragging){var a="td"==b.target.nodeName.toLowerCase()?b.target:e(b.target).parents("td")[0];
if(this.s.columns[this._fnTargetCoords(a).x].enable){var c=this.dom.filler;if("mouseover"==b.type)this.dom.currentTarget=a,this._fnFillerPosition(a),c.style.display="block";else if(!b.relatedTarget||!b.relatedTarget.className.match(/AutoFill/))c.style.display="none"}}},_fnFillerPosition:function(b){var a=e(b).offset(),c=this.dom.filler;c.style.top=a.top-this.s.filler.height/2-1+e(b).outerHeight()+"px";c.style.left=a.left-this.s.filler.width/2-1+e(b).outerWidth()+"px"}};AutoFill.prototype.CLASS="AutoFill";
AutoFill.VERSION="1.1.2";AutoFill.prototype.VERSION=AutoFill.VERSION})(jQuery);

View file

@ -0,0 +1,121 @@
(function() {
var showingNav = true;
$(document).ready( function () {
var jqNav = $('div.fw_nav');
jqNav.css('right', ($(window).width() - $('div.fw_container').width()) /2);
var n = $('div.nav_blocker')[0];
n.style.height = $(jqNav).outerHeight()+"px";
n.style.width = $(jqNav).outerWidth()+"px";
SyntaxHighlighter.highlight();
$('#private_toggle').click( function () {
if ( $('input[name=show_private]').val() == 0 ) {
$('input[name=show_private]').val( 1 );
$('#private_label').html('Showing');
$('.private').css('display', 'block');
} else {
$('input[name=show_private]').val( 0 );
$('#private_label').html('Hiding');
$('.private').css('display', 'none');
}
fnWriteCookie();
return false;
} );
$('#extended_toggle').click( function () {
if ( $('input[name=show_extended]').val() == 0 ) {
$('input[name=show_extended]').val( 1 );
$('#extended_label').html('Showing');
$('.augmented').css('display', 'block');
} else {
$('input[name=show_extended]').val( 0 );
$('#extended_label').html('Hiding');
$('.augmented').css('display', 'none');
}
fnWriteCookie();
return false;
} );
var savedHeight = $(jqNav).height();
$('div.fw_nav h2').click( function () {
if ( showingNav ) {
$('div.fw_nav').animate( {
"height": 10,
"opacity": 0.3
} );
showingNav = false;
} else {
$('div.fw_nav').animate( {
"height": savedHeight,
"opacity": 1
} );
showingNav = true;
}
fnWriteCookie();
} );
var cookie = fnReadCookie( 'SpryMedia_JSDoc' );
if ( cookie != null ) {
var a = cookie.split('-');
if ( a[0] == 1 ) {
$('#private_toggle').click();
}
if ( a[1] == 0 ) {
$('#extended_toggle').click();
}
if ( a[2] == 'false' ) {
$('div.fw_nav').css('height', 10).css('opacity', 0.3);
showingNav = false;
}
}
} );
function fnWriteCookie()
{
var sVal =
$('input[name=show_private]').val()+'-'+
$('input[name=show_extended]').val()+'-'+
showingNav;
fnCreateCookie( 'SpryMedia_JSDoc', sVal );
}
function fnCreateCookie( sName, sValue )
{
var iDays = 365;
var date = new Date();
date.setTime( date.getTime()+(iDays*24*60*60*1000) );
var sExpires = "; expires="+date.toGMTString();
document.cookie = sName+"="+sValue+sExpires+"; path=/";
}
function fnReadCookie( sName )
{
var sNameEQ = sName + "=";
var sCookieContents = document.cookie.split(';');
for( var i=0 ; i<sCookieContents.length ; i++ ) {
var c = sCookieContents[i];
while (c.charAt(0)==' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(sNameEQ) == 0) {
return c.substring(sNameEQ.length,c.length);
}
}
return null;
}
})();

View file

@ -0,0 +1,52 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'break case catch continue ' +
'default delete do else false ' +
'for function if in instanceof ' +
'new null return super switch ' +
'this throw true try typeof var while with'
;
var r = SyntaxHighlighter.regexLib;
this.regexList = [
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
];
this.forHtmlScript(r.scriptScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['js', 'jscript', 'javascript'];
SyntaxHighlighter.brushes.JScript = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,957 @@
/*
* File: ColReorder.js
* Version: 1.0.5
* CVS: $Id$
* Description: Controls for column visiblity in DataTables
* Author: Allan Jardine (www.sprymedia.co.uk)
* Created: Wed Sep 15 18:23:29 BST 2010
* Modified: $Date$ by $Author$
* Language: Javascript
* License: GPL v2 or BSD 3 point style
* Project: DataTables
* Contact: www.sprymedia.co.uk/contact
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, available at:
* http://datatables.net/license_gpl2
* http://datatables.net/license_bsd
*
*/
(function($, window, document) {
/**
* Switch the key value pairing of an index array to be value key (i.e. the old value is now the
* key). For example consider [ 2, 0, 1 ] this would be returned as [ 1, 2, 0 ].
* @method fnInvertKeyValues
* @param array aIn Array to switch around
* @returns array
*/
function fnInvertKeyValues( aIn )
{
var aRet=[];
for ( var i=0, iLen=aIn.length ; i<iLen ; i++ )
{
aRet[ aIn[i] ] = i;
}
return aRet;
}
/**
* Modify an array by switching the position of two elements
* @method fnArraySwitch
* @param array aArray Array to consider, will be modified by reference (i.e. no return)
* @param int iFrom From point
* @param int iTo Insert point
* @returns void
*/
function fnArraySwitch( aArray, iFrom, iTo )
{
var mStore = aArray.splice( iFrom, 1 )[0];
aArray.splice( iTo, 0, mStore );
}
/**
* Switch the positions of nodes in a parent node (note this is specifically designed for
* table rows). Note this function considers all element nodes under the parent!
* @method fnDomSwitch
* @param string sTag Tag to consider
* @param int iFrom Element to move
* @param int Point to element the element to (before this point), can be null for append
* @returns void
*/
function fnDomSwitch( nParent, iFrom, iTo )
{
var anTags = [];
for ( var i=0, iLen=nParent.childNodes.length ; i<iLen ; i++ )
{
if ( nParent.childNodes[i].nodeType == 1 )
{
anTags.push( nParent.childNodes[i] );
}
}
var nStore = anTags[ iFrom ];
if ( iTo !== null )
{
nParent.insertBefore( nStore, anTags[iTo] );
}
else
{
nParent.appendChild( nStore );
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables plug-in API functions
*
* This are required by ColReorder in order to perform the tasks required, and also keep this
* code portable, to be used for other column reordering projects with DataTables, if needed.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Plug-in for DataTables which will reorder the internal column structure by taking the column
* from one position (iFrom) and insert it into a given point (iTo).
* @method $.fn.dataTableExt.oApi.fnColReorder
* @param object oSettings DataTables settings object - automatically added by DataTables!
* @param int iFrom Take the column to be repositioned from this point
* @param int iTo and insert it into this point
* @returns void
*/
$.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
{
var i, iLen, j, jLen, iCols=oSettings.aoColumns.length, nTrs, oCol;
/* Sanity check in the input */
if ( iFrom == iTo )
{
/* Pointless reorder */
return;
}
if ( iFrom < 0 || iFrom >= iCols )
{
this.oApi._fnLog( oSettings, 1, "ColReorder 'from' index is out of bounds: "+iFrom );
return;
}
if ( iTo < 0 || iTo >= iCols )
{
this.oApi._fnLog( oSettings, 1, "ColReorder 'to' index is out of bounds: "+iTo );
return;
}
/*
* Calculate the new column array index, so we have a mapping between the old and new
*/
var aiMapping = [];
for ( i=0, iLen=iCols ; i<iLen ; i++ )
{
aiMapping[i] = i;
}
fnArraySwitch( aiMapping, iFrom, iTo );
var aiInvertMapping = fnInvertKeyValues( aiMapping );
/*
* Convert all internal indexing to the new column order indexes
*/
/* Sorting */
for ( i=0, iLen=oSettings.aaSorting.length ; i<iLen ; i++ )
{
oSettings.aaSorting[i][0] = aiInvertMapping[ oSettings.aaSorting[i][0] ];
}
/* Fixed sorting */
if ( oSettings.aaSortingFixed !== null )
{
for ( i=0, iLen=oSettings.aaSortingFixed.length ; i<iLen ; i++ )
{
oSettings.aaSortingFixed[i][0] = aiInvertMapping[ oSettings.aaSortingFixed[i][0] ];
}
}
/* Data column sorting (the column which the sort for a given column should take place on) */
for ( i=0, iLen=iCols ; i<iLen ; i++ )
{
oCol = oSettings.aoColumns[i];
for ( j=0, jLen=oCol.aDataSort.length ; j<jLen ; j++ )
{
oCol.aDataSort[j] = aiInvertMapping[ oCol.aDataSort[j] ];
}
}
/* Update the Get and Set functions for each column */
for ( i=0, iLen=iCols ; i<iLen ; i++ )
{
oCol = oSettings.aoColumns[i];
if ( typeof oCol.mDataProp == 'number' ) {
oCol.mDataProp = aiInvertMapping[ oCol.mDataProp ];
oCol.fnGetData = oSettings.oApi._fnGetObjectDataFn( oCol.mDataProp );
oCol.fnSetData = oSettings.oApi._fnSetObjectDataFn( oCol.mDataProp );
}
}
/*
* Move the DOM elements
*/
if ( oSettings.aoColumns[iFrom].bVisible )
{
/* Calculate the current visible index and the point to insert the node before. The insert
* before needs to take into account that there might not be an element to insert before,
* in which case it will be null, and an appendChild should be used
*/
var iVisibleIndex = this.oApi._fnColumnIndexToVisible( oSettings, iFrom );
var iInsertBeforeIndex = null;
i = iTo < iFrom ? iTo : iTo + 1;
while ( iInsertBeforeIndex === null && i < iCols )
{
iInsertBeforeIndex = this.oApi._fnColumnIndexToVisible( oSettings, i );
i++;
}
/* Header */
nTrs = oSettings.nTHead.getElementsByTagName('tr');
for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
{
fnDomSwitch( nTrs[i], iVisibleIndex, iInsertBeforeIndex );
}
/* Footer */
if ( oSettings.nTFoot !== null )
{
nTrs = oSettings.nTFoot.getElementsByTagName('tr');
for ( i=0, iLen=nTrs.length ; i<iLen ; i++ )
{
fnDomSwitch( nTrs[i], iVisibleIndex, iInsertBeforeIndex );
}
}
/* Body */
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
{
if ( oSettings.aoData[i].nTr !== null )
{
fnDomSwitch( oSettings.aoData[i].nTr, iVisibleIndex, iInsertBeforeIndex );
}
}
}
/*
* Move the internal array elements
*/
/* Columns */
fnArraySwitch( oSettings.aoColumns, iFrom, iTo );
/* Search columns */
fnArraySwitch( oSettings.aoPreSearchCols, iFrom, iTo );
/* Array array - internal data anodes cache */
for ( i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
{
if ( $.isArray( oSettings.aoData[i]._aData ) ) {
fnArraySwitch( oSettings.aoData[i]._aData, iFrom, iTo );
}
fnArraySwitch( oSettings.aoData[i]._anHidden, iFrom, iTo );
}
/* Reposition the header elements in the header layout array */
for ( i=0, iLen=oSettings.aoHeader.length ; i<iLen ; i++ )
{
fnArraySwitch( oSettings.aoHeader[i], iFrom, iTo );
}
if ( oSettings.aoFooter !== null )
{
for ( i=0, iLen=oSettings.aoFooter.length ; i<iLen ; i++ )
{
fnArraySwitch( oSettings.aoFooter[i], iFrom, iTo );
}
}
/*
* Update DataTables' event handlers
*/
/* Sort listener */
for ( i=0, iLen=iCols ; i<iLen ; i++ )
{
$(oSettings.aoColumns[i].nTh).unbind('click');
this.oApi._fnSortAttachListener( oSettings, oSettings.aoColumns[i].nTh, i );
}
/*
* Any extra operations for the other plug-ins
*/
if ( typeof ColVis != 'undefined' )
{
ColVis.fnRebuild( oSettings.oInstance );
}
if ( typeof oSettings.oInstance._oPluginFixedHeader != 'undefined' )
{
oSettings.oInstance._oPluginFixedHeader.fnUpdate();
}
};
/**
* ColReorder provides column visiblity control for DataTables
* @class ColReorder
* @constructor
* @param {object} DataTables object
* @param {object} ColReorder options
*/
ColReorder = function( oTable, oOpts )
{
/* Santiy check that we are a new instance */
if ( !this.CLASS || this.CLASS != "ColReorder" )
{
alert( "Warning: ColReorder must be initialised with the keyword 'new'" );
}
if ( typeof oOpts == 'undefined' )
{
oOpts = {};
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public class variables
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @namespace Settings object which contains customisable information for ColReorder instance
*/
this.s = {
/**
* DataTables settings object
* @property dt
* @type Object
* @default null
*/
"dt": null,
/**
* Initialisation object used for this instance
* @property init
* @type object
* @default {}
*/
"init": oOpts,
/**
* Number of columns to fix (not allow to be reordered)
* @property fixed
* @type int
* @default 0
*/
"fixed": 0,
/**
* Callback function for once the reorder has been done
* @property dropcallback
* @type function
* @default null
*/
"dropCallback": null,
/**
* @namespace Information used for the mouse drag
*/
"mouse": {
"startX": -1,
"startY": -1,
"offsetX": -1,
"offsetY": -1,
"target": -1,
"targetIndex": -1,
"fromIndex": -1
},
/**
* Information which is used for positioning the insert cusor and knowing where to do the
* insert. Array of objects with the properties:
* x: x-axis position
* to: insert point
* @property aoTargets
* @type array
* @default []
*/
"aoTargets": []
};
/**
* @namespace Common and useful DOM elements for the class instance
*/
this.dom = {
/**
* Dragging element (the one the mouse is moving)
* @property drag
* @type element
* @default null
*/
"drag": null,
/**
* The insert cursor
* @property pointer
* @type element
* @default null
*/
"pointer": null
};
/* Constructor logic */
this.s.dt = oTable.fnSettings();
this._fnConstruct();
/* Store the instance for later use */
ColReorder.aoInstances.push( this );
return this;
};
ColReorder.prototype = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
"fnReset": function ()
{
var a = [];
for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
{
a.push( this.s.dt.aoColumns[i]._ColReorder_iOrigCol );
}
this._fnOrderColumns( a );
},
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods (they are of course public in JS, but recommended as private)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Constructor logic
* @method _fnConstruct
* @returns void
* @private
*/
"_fnConstruct": function ()
{
var that = this;
var i, iLen;
/* Columns discounted from reordering - counting left to right */
if ( typeof this.s.init.iFixedColumns != 'undefined' )
{
this.s.fixed = this.s.init.iFixedColumns;
}
/* Drop callback initialisation option */
if ( typeof this.s.init.fnReorderCallback != 'undefined' )
{
this.s.dropCallback = this.s.init.fnReorderCallback;
}
/* Add event handlers for the drag and drop, and also mark the original column order */
for ( i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
{
if ( i > this.s.fixed-1 )
{
this._fnMouseListener( i, this.s.dt.aoColumns[i].nTh );
}
/* Mark the original column order for later reference */
this.s.dt.aoColumns[i]._ColReorder_iOrigCol = i;
}
/* State saving */
this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
that._fnStateSave.call( that, oData );
}, "ColReorder_State" );
/* An initial column order has been specified */
var aiOrder = null;
if ( typeof this.s.init.aiOrder != 'undefined' )
{
aiOrder = this.s.init.aiOrder.slice();
}
/* State loading, overrides the column order given */
if ( this.s.dt.oLoadedState && typeof this.s.dt.oLoadedState.ColReorder != 'undefined' &&
this.s.dt.oLoadedState.ColReorder.length == this.s.dt.aoColumns.length )
{
aiOrder = this.s.dt.oLoadedState.ColReorder;
}
/* If we have an order to apply - do so */
if ( aiOrder )
{
/* We might be called during or after the DataTables initialisation. If before, then we need
* to wait until the draw is done, if after, then do what we need to do right away
*/
if ( !that.s.dt._bInitComplete )
{
var bDone = false;
this.s.dt.aoDrawCallback.push( {
"fn": function () {
if ( !that.s.dt._bInitComplete && !bDone )
{
bDone = true;
var resort = fnInvertKeyValues( aiOrder );
that._fnOrderColumns.call( that, resort );
}
},
"sName": "ColReorder_Pre"
} );
}
else
{
var resort = fnInvertKeyValues( aiOrder );
that._fnOrderColumns.call( that, resort );
}
}
},
/**
* Set the column order from an array
* @method _fnOrderColumns
* @param array a An array of integers which dictate the column order that should be applied
* @returns void
* @private
*/
"_fnOrderColumns": function ( a )
{
if ( a.length != this.s.dt.aoColumns.length )
{
this.s.dt.oInstance.oApi._fnLog( oDTSettings, 1, "ColReorder - array reorder does not "+
"match known number of columns. Skipping." );
return;
}
for ( var i=0, iLen=a.length ; i<iLen ; i++ )
{
var currIndex = $.inArray( i, a );
if ( i != currIndex )
{
/* Reorder our switching array */
fnArraySwitch( a, currIndex, i );
/* Do the column reorder in the table */
this.s.dt.oInstance.fnColReorder( currIndex, i );
}
}
/* When scrolling we need to recalculate the column sizes to allow for the shift */
if ( this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== "" )
{
this.s.dt.oInstance.fnAdjustColumnSizing();
}
/* Save the state */
this.s.dt.oInstance.oApi._fnSaveState( this.s.dt );
},
/**
* Because we change the indexes of columns in the table, relative to their starting point
* we need to reorder the state columns to what they are at the starting point so we can
* then rearrange them again on state load!
* @method _fnStateSave
* @param object oState DataTables state
* @returns string JSON encoded cookie string for DataTables
* @private
*/
"_fnStateSave": function ( oState )
{
var i, iLen, aCopy, iOrigColumn;
var oSettings = this.s.dt;
/* Sorting */
for ( i=0 ; i<oState.aaSorting.length ; i++ )
{
oState.aaSorting[i][0] = oSettings.aoColumns[ oState.aaSorting[i][0] ]._ColReorder_iOrigCol;
}
aSearchCopy = $.extend( true, [], oState.aoSearchCols );
oState.ColReorder = [];
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
iOrigColumn = oSettings.aoColumns[i]._ColReorder_iOrigCol;
/* Column filter */
oState.aoSearchCols[ iOrigColumn ] = aSearchCopy[i];
/* Visibility */
oState.abVisCols[ iOrigColumn ] = oSettings.aoColumns[i].bVisible;
/* Column reordering */
oState.ColReorder.push( iOrigColumn );
}
},
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mouse drop and drag
*/
/**
* Add a mouse down listener to a particluar TH element
* @method _fnMouseListener
* @param int i Column index
* @param element nTh TH element clicked on
* @returns void
* @private
*/
"_fnMouseListener": function ( i, nTh )
{
var that = this;
$(nTh).bind( 'mousedown.ColReorder', function (e) {
that._fnMouseDown.call( that, e, nTh );
return false;
} );
},
/**
* Mouse down on a TH element in the table header
* @method _fnMouseDown
* @param event e Mouse event
* @param element nTh TH element to be dragged
* @returns void
* @private
*/
"_fnMouseDown": function ( e, nTh )
{
var
that = this,
aoColumns = this.s.dt.aoColumns;
/* Store information about the mouse position */
var nThTarget = e.target.nodeName == "TH" ? e.target : $(e.target).parents('TH')[0];
var offset = $(nThTarget).offset();
this.s.mouse.startX = e.pageX;
this.s.mouse.startY = e.pageY;
this.s.mouse.offsetX = e.pageX - offset.left;
this.s.mouse.offsetY = e.pageY - offset.top;
this.s.mouse.target = nTh;
this.s.mouse.targetIndex = $('th', nTh.parentNode).index( nTh );
this.s.mouse.fromIndex = this.s.dt.oInstance.oApi._fnVisibleToColumnIndex( this.s.dt,
this.s.mouse.targetIndex );
/* Calculate a cached array with the points of the column inserts, and the 'to' points */
this.s.aoTargets.splice( 0, this.s.aoTargets.length );
this.s.aoTargets.push( {
"x": $(this.s.dt.nTable).offset().left,
"to": 0
} );
var iToPoint = 0;
for ( var i=0, iLen=aoColumns.length ; i<iLen ; i++ )
{
/* For the column / header in question, we want it's position to remain the same if the
* position is just to it's immediate left or right, so we only incremement the counter for
* other columns
*/
if ( i != this.s.mouse.fromIndex )
{
iToPoint++;
}
if ( aoColumns[i].bVisible )
{
this.s.aoTargets.push( {
"x": $(aoColumns[i].nTh).offset().left + $(aoColumns[i].nTh).outerWidth(),
"to": iToPoint
} );
}
}
/* Disallow columns for being reordered by drag and drop, counting left to right */
if ( this.s.fixed !== 0 )
{
this.s.aoTargets.splice( 0, this.s.fixed );
}
/* Add event handlers to the document */
$(document).bind( 'mousemove.ColReorder', function (e) {
that._fnMouseMove.call( that, e );
} );
$(document).bind( 'mouseup.ColReorder', function (e) {
that._fnMouseUp.call( that, e );
} );
},
/**
* Deal with a mouse move event while dragging a node
* @method _fnMouseMove
* @param event e Mouse event
* @returns void
* @private
*/
"_fnMouseMove": function ( e )
{
var that = this;
if ( this.dom.drag === null )
{
/* Only create the drag element if the mouse has moved a specific distance from the start
* point - this allows the user to make small mouse movements when sorting and not have a
* possibly confusing drag element showing up
*/
if ( Math.pow(
Math.pow(e.pageX - this.s.mouse.startX, 2) +
Math.pow(e.pageY - this.s.mouse.startY, 2), 0.5 ) < 5 )
{
return;
}
this._fnCreateDragNode();
}
/* Position the element - we respect where in the element the click occured */
this.dom.drag.style.left = (e.pageX - this.s.mouse.offsetX) + "px";
this.dom.drag.style.top = (e.pageY - this.s.mouse.offsetY) + "px";
/* Based on the current mouse position, calculate where the insert should go */
var bSet = false;
for ( var i=1, iLen=this.s.aoTargets.length ; i<iLen ; i++ )
{
if ( e.pageX < this.s.aoTargets[i-1].x + ((this.s.aoTargets[i].x-this.s.aoTargets[i-1].x)/2) )
{
this.dom.pointer.style.left = this.s.aoTargets[i-1].x +"px";
this.s.mouse.toIndex = this.s.aoTargets[i-1].to;
bSet = true;
break;
}
}
/* The insert element wasn't positioned in the array (less than operator), so we put it at
* the end
*/
if ( !bSet )
{
this.dom.pointer.style.left = this.s.aoTargets[this.s.aoTargets.length-1].x +"px";
this.s.mouse.toIndex = this.s.aoTargets[this.s.aoTargets.length-1].to;
}
},
/**
* Finish off the mouse drag and insert the column where needed
* @method _fnMouseUp
* @param event e Mouse event
* @returns void
* @private
*/
"_fnMouseUp": function ( e )
{
var that = this;
$(document).unbind( 'mousemove.ColReorder' );
$(document).unbind( 'mouseup.ColReorder' );
if ( this.dom.drag !== null )
{
/* Remove the guide elements */
document.body.removeChild( this.dom.drag );
document.body.removeChild( this.dom.pointer );
this.dom.drag = null;
this.dom.pointer = null;
/* Actually do the reorder */
this.s.dt.oInstance.fnColReorder( this.s.mouse.fromIndex, this.s.mouse.toIndex );
/* When scrolling we need to recalculate the column sizes to allow for the shift */
if ( this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== "" )
{
this.s.dt.oInstance.fnAdjustColumnSizing();
}
if ( this.s.dropCallback !== null )
{
this.s.dropCallback.call( this );
}
/* Save the state */
this.s.dt.oInstance.oApi._fnSaveState( this.s.dt );
}
},
/**
* Copy the TH element that is being drags so the user has the idea that they are actually
* moving it around the page.
* @method _fnCreateDragNode
* @returns void
* @private
*/
"_fnCreateDragNode": function ()
{
var that = this;
this.dom.drag = $(this.s.dt.nTHead.parentNode).clone(true)[0];
this.dom.drag.className += " DTCR_clonedTable";
while ( this.dom.drag.getElementsByTagName('caption').length > 0 )
{
this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('caption')[0] );
}
while ( this.dom.drag.getElementsByTagName('tbody').length > 0 )
{
this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('tbody')[0] );
}
while ( this.dom.drag.getElementsByTagName('tfoot').length > 0 )
{
this.dom.drag.removeChild( this.dom.drag.getElementsByTagName('tfoot')[0] );
}
$('thead tr:eq(0)', this.dom.drag).each( function () {
$('th:not(:eq('+that.s.mouse.targetIndex+'))', this).remove();
} );
$('tr', this.dom.drag).height( $('tr:eq(0)', that.s.dt.nTHead).height() );
$('thead tr:gt(0)', this.dom.drag).remove();
$('thead th:eq(0)', this.dom.drag).each( function (i) {
this.style.width = $('th:eq('+that.s.mouse.targetIndex+')', that.s.dt.nTHead).width()+"px";
} );
this.dom.drag.style.position = "absolute";
this.dom.drag.style.top = "0px";
this.dom.drag.style.left = "0px";
this.dom.drag.style.width = $('th:eq('+that.s.mouse.targetIndex+')', that.s.dt.nTHead).outerWidth()+"px";
this.dom.pointer = document.createElement( 'div' );
this.dom.pointer.className = "DTCR_pointer";
this.dom.pointer.style.position = "absolute";
if ( this.s.dt.oScroll.sX === "" && this.s.dt.oScroll.sY === "" )
{
this.dom.pointer.style.top = $(this.s.dt.nTable).offset().top+"px";
this.dom.pointer.style.height = $(this.s.dt.nTable).height()+"px";
}
else
{
this.dom.pointer.style.top = $('div.dataTables_scroll', this.s.dt.nTableWrapper).offset().top+"px";
this.dom.pointer.style.height = $('div.dataTables_scroll', this.s.dt.nTableWrapper).height()+"px";
}
document.body.appendChild( this.dom.pointer );
document.body.appendChild( this.dom.drag );
}
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Static parameters
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Array of all ColReorder instances for later reference
* @property ColReorder.aoInstances
* @type array
* @default []
* @static
*/
ColReorder.aoInstances = [];
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Static functions
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Reset the column ordering for a DataTables instance
* @method ColReorder.fnReset
* @param object oTable DataTables instance to consider
* @returns void
* @static
*/
ColReorder.fnReset = function ( oTable )
{
for ( var i=0, iLen=ColReorder.aoInstances.length ; i<iLen ; i++ )
{
if ( ColReorder.aoInstances[i].s.dt.oInstance == oTable )
{
ColReorder.aoInstances[i].fnReset();
}
}
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constants
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Name of this class
* @constant CLASS
* @type String
* @default ColReorder
*/
ColReorder.prototype.CLASS = "ColReorder";
/**
* ColReorder version
* @constant VERSION
* @type String
* @default As code
*/
ColReorder.VERSION = "1.0.5";
ColReorder.prototype.VERSION = ColReorder.VERSION;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Initialisation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Register a new feature with DataTables
*/
if ( typeof $.fn.dataTable == "function" &&
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
$.fn.dataTableExt.fnVersionCheck('1.9.0') )
{
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) {
var oTable = oDTSettings.oInstance;
if ( typeof oTable._oPluginColReorder == 'undefined' ) {
var opts = typeof oDTSettings.oInit.oColReorder != 'undefined' ?
oDTSettings.oInit.oColReorder : {};
oTable._oPluginColReorder = new ColReorder( oDTSettings.oInstance, opts );
} else {
oTable.oApi._fnLog( oDTSettings, 1, "ColReorder attempted to initialise twice. Ignoring second" );
}
return null; /* No node to insert */
},
"cFeature": "R",
"sFeature": "ColReorder"
} );
}
else
{
alert( "Warning: ColReorder requires DataTables 1.9.0 or greater - www.datatables.net/download");
}
})(jQuery, window, document);

View file

@ -0,0 +1,33 @@
/*
* File: ColReorder.min.js
* Version: 1.0.5
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD (3 point) style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
(function(f,o,i){function m(a){for(var c=[],d=0,b=a.length;d<b;d++)c[a[d]]=d;return c}function j(a,c,d){c=a.splice(c,1)[0];a.splice(d,0,c)}function n(a,c,d){for(var b=[],e=0,f=a.childNodes.length;e<f;e++)1==a.childNodes[e].nodeType&&b.push(a.childNodes[e]);c=b[c];null!==d?a.insertBefore(c,b[d]):a.appendChild(c)}f.fn.dataTableExt.oApi.fnColReorder=function(a,c,d){var b,e,g,l,k=a.aoColumns.length,h;if(c!=d)if(0>c||c>=k)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+c);else if(0>d||
d>=k)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+d);else{g=[];for(b=0,e=k;b<e;b++)g[b]=b;j(g,c,d);var i=m(g);for(b=0,e=a.aaSorting.length;b<e;b++)a.aaSorting[b][0]=i[a.aaSorting[b][0]];if(null!==a.aaSortingFixed)for(b=0,e=a.aaSortingFixed.length;b<e;b++)a.aaSortingFixed[b][0]=i[a.aaSortingFixed[b][0]];for(b=0,e=k;b<e;b++){h=a.aoColumns[b];for(g=0,l=h.aDataSort.length;g<l;g++)h.aDataSort[g]=i[h.aDataSort[g]]}for(b=0,e=k;b<e;b++)if(h=a.aoColumns[b],"number"==typeof h.mDataProp)h.mDataProp=
i[h.mDataProp],h.fnGetData=a.oApi._fnGetObjectDataFn(h.mDataProp),h.fnSetData=a.oApi._fnSetObjectDataFn(h.mDataProp);if(a.aoColumns[c].bVisible){l=this.oApi._fnColumnIndexToVisible(a,c);h=null;for(b=d<c?d:d+1;null===h&&b<k;)h=this.oApi._fnColumnIndexToVisible(a,b),b++;g=a.nTHead.getElementsByTagName("tr");for(b=0,e=g.length;b<e;b++)n(g[b],l,h);if(null!==a.nTFoot){g=a.nTFoot.getElementsByTagName("tr");for(b=0,e=g.length;b<e;b++)n(g[b],l,h)}for(b=0,e=a.aoData.length;b<e;b++)null!==a.aoData[b].nTr&&
n(a.aoData[b].nTr,l,h)}j(a.aoColumns,c,d);j(a.aoPreSearchCols,c,d);for(b=0,e=a.aoData.length;b<e;b++)f.isArray(a.aoData[b]._aData)&&j(a.aoData[b]._aData,c,d),j(a.aoData[b]._anHidden,c,d);for(b=0,e=a.aoHeader.length;b<e;b++)j(a.aoHeader[b],c,d);if(null!==a.aoFooter)for(b=0,e=a.aoFooter.length;b<e;b++)j(a.aoFooter[b],c,d);for(b=0,e=k;b<e;b++)f(a.aoColumns[b].nTh).unbind("click"),this.oApi._fnSortAttachListener(a,a.aoColumns[b].nTh,b);"undefined"!=typeof ColVis&&ColVis.fnRebuild(a.oInstance);"undefined"!=
typeof a.oInstance._oPluginFixedHeader&&a.oInstance._oPluginFixedHeader.fnUpdate()}};ColReorder=function(a,c){(!this.CLASS||"ColReorder"!=this.CLASS)&&alert("Warning: ColReorder must be initialised with the keyword 'new'");"undefined"==typeof c&&(c={});this.s={dt:null,init:c,fixed:0,dropCallback:null,mouse:{startX:-1,startY:-1,offsetX:-1,offsetY:-1,target:-1,targetIndex:-1,fromIndex:-1},aoTargets:[]};this.dom={drag:null,pointer:null};this.s.dt=a.fnSettings();this._fnConstruct();ColReorder.aoInstances.push(this);
return this};ColReorder.prototype={fnReset:function(){for(var a=[],c=0,d=this.s.dt.aoColumns.length;c<d;c++)a.push(this.s.dt.aoColumns[c]._ColReorder_iOrigCol);this._fnOrderColumns(a)},_fnConstruct:function(){var a=this,c,d;if("undefined"!=typeof this.s.init.iFixedColumns)this.s.fixed=this.s.init.iFixedColumns;if("undefined"!=typeof this.s.init.fnReorderCallback)this.s.dropCallback=this.s.init.fnReorderCallback;for(c=0,d=this.s.dt.aoColumns.length;c<d;c++)c>this.s.fixed-1&&this._fnMouseListener(c,
this.s.dt.aoColumns[c].nTh),this.s.dt.aoColumns[c]._ColReorder_iOrigCol=c;this.s.dt.oApi._fnCallbackReg(this.s.dt,"aoStateSaveParams",function(b,c){a._fnStateSave.call(a,c)},"ColReorder_State");var b=null;"undefined"!=typeof this.s.init.aiOrder&&(b=this.s.init.aiOrder.slice());if(this.s.dt.oLoadedState&&"undefined"!=typeof this.s.dt.oLoadedState.ColReorder&&this.s.dt.oLoadedState.ColReorder.length==this.s.dt.aoColumns.length)b=this.s.dt.oLoadedState.ColReorder;if(b)if(a.s.dt._bInitComplete)c=m(b),
a._fnOrderColumns.call(a,c);else{var e=!1;this.s.dt.aoDrawCallback.push({fn:function(){if(!a.s.dt._bInitComplete&&!e){e=!0;var c=m(b);a._fnOrderColumns.call(a,c)}},sName:"ColReorder_Pre"})}},_fnOrderColumns:function(a){if(a.length!=this.s.dt.aoColumns.length)this.s.dt.oInstance.oApi._fnLog(oDTSettings,1,"ColReorder - array reorder does not match known number of columns. Skipping.");else{for(var c=0,d=a.length;c<d;c++){var b=f.inArray(c,a);c!=b&&(j(a,b,c),this.s.dt.oInstance.fnColReorder(b,c))}(""!==
this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing();this.s.dt.oInstance.oApi._fnSaveState(this.s.dt)}},_fnStateSave:function(a){var c,d,b,e=this.s.dt;for(c=0;c<a.aaSorting.length;c++)a.aaSorting[c][0]=e.aoColumns[a.aaSorting[c][0]]._ColReorder_iOrigCol;aSearchCopy=f.extend(!0,[],a.aoSearchCols);a.ColReorder=[];for(c=0,d=e.aoColumns.length;c<d;c++)b=e.aoColumns[c]._ColReorder_iOrigCol,a.aoSearchCols[b]=aSearchCopy[c],a.abVisCols[b]=e.aoColumns[c].bVisible,a.ColReorder.push(b)},
_fnMouseListener:function(a,c){var d=this;f(c).bind("mousedown.ColReorder",function(a){d._fnMouseDown.call(d,a,c);return!1})},_fnMouseDown:function(a,c){var d=this,b=this.s.dt.aoColumns,e="TH"==a.target.nodeName?a.target:f(a.target).parents("TH")[0],e=f(e).offset();this.s.mouse.startX=a.pageX;this.s.mouse.startY=a.pageY;this.s.mouse.offsetX=a.pageX-e.left;this.s.mouse.offsetY=a.pageY-e.top;this.s.mouse.target=c;this.s.mouse.targetIndex=f("th",c.parentNode).index(c);this.s.mouse.fromIndex=this.s.dt.oInstance.oApi._fnVisibleToColumnIndex(this.s.dt,
this.s.mouse.targetIndex);this.s.aoTargets.splice(0,this.s.aoTargets.length);this.s.aoTargets.push({x:f(this.s.dt.nTable).offset().left,to:0});for(var g=e=0,j=b.length;g<j;g++)g!=this.s.mouse.fromIndex&&e++,b[g].bVisible&&this.s.aoTargets.push({x:f(b[g].nTh).offset().left+f(b[g].nTh).outerWidth(),to:e});0!==this.s.fixed&&this.s.aoTargets.splice(0,this.s.fixed);f(i).bind("mousemove.ColReorder",function(a){d._fnMouseMove.call(d,a)});f(i).bind("mouseup.ColReorder",function(a){d._fnMouseUp.call(d,a)})},
_fnMouseMove:function(a){if(null===this.dom.drag){if(5>Math.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5))return;this._fnCreateDragNode()}this.dom.drag.style.left=a.pageX-this.s.mouse.offsetX+"px";this.dom.drag.style.top=a.pageY-this.s.mouse.offsetY+"px";for(var c=!1,d=1,b=this.s.aoTargets.length;d<b;d++)if(a.pageX<this.s.aoTargets[d-1].x+(this.s.aoTargets[d].x-this.s.aoTargets[d-1].x)/2){this.dom.pointer.style.left=this.s.aoTargets[d-1].x+"px";this.s.mouse.toIndex=
this.s.aoTargets[d-1].to;c=!0;break}if(!c)this.dom.pointer.style.left=this.s.aoTargets[this.s.aoTargets.length-1].x+"px",this.s.mouse.toIndex=this.s.aoTargets[this.s.aoTargets.length-1].to},_fnMouseUp:function(){f(i).unbind("mousemove.ColReorder");f(i).unbind("mouseup.ColReorder");if(null!==this.dom.drag)i.body.removeChild(this.dom.drag),i.body.removeChild(this.dom.pointer),this.dom.drag=null,this.dom.pointer=null,this.s.dt.oInstance.fnColReorder(this.s.mouse.fromIndex,this.s.mouse.toIndex),(""!==
this.s.dt.oScroll.sX||""!==this.s.dt.oScroll.sY)&&this.s.dt.oInstance.fnAdjustColumnSizing(),null!==this.s.dropCallback&&this.s.dropCallback.call(this),this.s.dt.oInstance.oApi._fnSaveState(this.s.dt)},_fnCreateDragNode:function(){var a=this;this.dom.drag=f(this.s.dt.nTHead.parentNode).clone(!0)[0];for(this.dom.drag.className+=" DTCR_clonedTable";0<this.dom.drag.getElementsByTagName("caption").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("caption")[0]);for(;0<this.dom.drag.getElementsByTagName("tbody").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("tbody")[0]);
for(;0<this.dom.drag.getElementsByTagName("tfoot").length;)this.dom.drag.removeChild(this.dom.drag.getElementsByTagName("tfoot")[0]);f("thead tr:eq(0)",this.dom.drag).each(function(){f("th:not(:eq("+a.s.mouse.targetIndex+"))",this).remove()});f("tr",this.dom.drag).height(f("tr:eq(0)",a.s.dt.nTHead).height());f("thead tr:gt(0)",this.dom.drag).remove();f("thead th:eq(0)",this.dom.drag).each(function(){this.style.width=f("th:eq("+a.s.mouse.targetIndex+")",a.s.dt.nTHead).width()+"px"});this.dom.drag.style.position=
"absolute";this.dom.drag.style.top="0px";this.dom.drag.style.left="0px";this.dom.drag.style.width=f("th:eq("+a.s.mouse.targetIndex+")",a.s.dt.nTHead).outerWidth()+"px";this.dom.pointer=i.createElement("div");this.dom.pointer.className="DTCR_pointer";this.dom.pointer.style.position="absolute";""===this.s.dt.oScroll.sX&&""===this.s.dt.oScroll.sY?(this.dom.pointer.style.top=f(this.s.dt.nTable).offset().top+"px",this.dom.pointer.style.height=f(this.s.dt.nTable).height()+"px"):(this.dom.pointer.style.top=
f("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top+"px",this.dom.pointer.style.height=f("div.dataTables_scroll",this.s.dt.nTableWrapper).height()+"px");i.body.appendChild(this.dom.pointer);i.body.appendChild(this.dom.drag)}};ColReorder.aoInstances=[];ColReorder.fnReset=function(a){for(var c=0,d=ColReorder.aoInstances.length;c<d;c++)ColReorder.aoInstances[c].s.dt.oInstance==a&&ColReorder.aoInstances[c].fnReset()};ColReorder.prototype.CLASS="ColReorder";ColReorder.VERSION="1.0.5";ColReorder.prototype.VERSION=
ColReorder.VERSION;"function"==typeof f.fn.dataTable&&"function"==typeof f.fn.dataTableExt.fnVersionCheck&&f.fn.dataTableExt.fnVersionCheck("1.9.0")?f.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var c=a.oInstance;"undefined"==typeof c._oPluginColReorder?c._oPluginColReorder=new ColReorder(a.oInstance,"undefined"!=typeof a.oInit.oColReorder?a.oInit.oColReorder:{}):c.oApi._fnLog(a,1,"ColReorder attempted to initialise twice. Ignoring second");return null},cFeature:"R",sFeature:"ColReorder"}):
alert("Warning: ColReorder requires DataTables 1.9.0 or greater - www.datatables.net/download")})(jQuery,window,document);

View file

@ -0,0 +1,121 @@
(function() {
var showingNav = true;
$(document).ready( function () {
var jqNav = $('div.fw_nav');
jqNav.css('right', ($(window).width() - $('div.fw_container').width()) /2);
var n = $('div.nav_blocker')[0];
n.style.height = $(jqNav).outerHeight()+"px";
n.style.width = $(jqNav).outerWidth()+"px";
SyntaxHighlighter.highlight();
$('#private_toggle').click( function () {
if ( $('input[name=show_private]').val() == 0 ) {
$('input[name=show_private]').val( 1 );
$('#private_label').html('Showing');
$('.private').css('display', 'block');
} else {
$('input[name=show_private]').val( 0 );
$('#private_label').html('Hiding');
$('.private').css('display', 'none');
}
fnWriteCookie();
return false;
} );
$('#extended_toggle').click( function () {
if ( $('input[name=show_extended]').val() == 0 ) {
$('input[name=show_extended]').val( 1 );
$('#extended_label').html('Showing');
$('.augmented').css('display', 'block');
} else {
$('input[name=show_extended]').val( 0 );
$('#extended_label').html('Hiding');
$('.augmented').css('display', 'none');
}
fnWriteCookie();
return false;
} );
var savedHeight = $(jqNav).height();
$('div.fw_nav h2').click( function () {
if ( showingNav ) {
$('div.fw_nav').animate( {
"height": 10,
"opacity": 0.3
} );
showingNav = false;
} else {
$('div.fw_nav').animate( {
"height": savedHeight,
"opacity": 1
} );
showingNav = true;
}
fnWriteCookie();
} );
var cookie = fnReadCookie( 'SpryMedia_JSDoc' );
if ( cookie != null ) {
var a = cookie.split('-');
if ( a[0] == 1 ) {
$('#private_toggle').click();
}
if ( a[1] == 0 ) {
$('#extended_toggle').click();
}
if ( a[2] == 'false' ) {
$('div.fw_nav').css('height', 10).css('opacity', 0.3);
showingNav = false;
}
}
} );
function fnWriteCookie()
{
var sVal =
$('input[name=show_private]').val()+'-'+
$('input[name=show_extended]').val()+'-'+
showingNav;
fnCreateCookie( 'SpryMedia_JSDoc', sVal );
}
function fnCreateCookie( sName, sValue )
{
var iDays = 365;
var date = new Date();
date.setTime( date.getTime()+(iDays*24*60*60*1000) );
var sExpires = "; expires="+date.toGMTString();
document.cookie = sName+"="+sValue+sExpires+"; path=/";
}
function fnReadCookie( sName )
{
var sNameEQ = sName + "=";
var sCookieContents = document.cookie.split(';');
for( var i=0 ; i<sCookieContents.length ; i++ ) {
var c = sCookieContents[i];
while (c.charAt(0)==' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(sNameEQ) == 0) {
return c.substring(sNameEQ.length,c.length);
}
}
return null;
}
})();

View file

@ -0,0 +1,52 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'break case catch continue ' +
'default delete do else false ' +
'for function if in instanceof ' +
'new null return super switch ' +
'this throw true try typeof var while with'
;
var r = SyntaxHighlighter.regexLib;
this.regexList = [
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
];
this.forHtmlScript(r.scriptScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['js', 'jscript', 'javascript'];
SyntaxHighlighter.brushes.JScript = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,995 @@
/*
* File: ColVis.js
* Version: 1.0.7
* CVS: $Id$
* Description: Controls for column visiblity in DataTables
* Author: Allan Jardine (www.sprymedia.co.uk)
* Created: Wed Sep 15 18:23:29 BST 2010
* Modified: $Date$ by $Author$
* Language: Javascript
* License: GPL v2 or BSD 3 point style
* Project: Just a little bit of fun :-)
* Contact: www.sprymedia.co.uk/contact
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, available at:
* http://datatables.net/license_gpl2
* http://datatables.net/license_bsd
*/
(function($) {
/**
* ColVis provides column visiblity control for DataTables
* @class ColVis
* @constructor
* @param {object} DataTables settings object
*/
ColVis = function( oDTSettings, oInit )
{
/* Santiy check that we are a new instance */
if ( !this.CLASS || this.CLASS != "ColVis" )
{
alert( "Warning: ColVis must be initialised with the keyword 'new'" );
}
if ( typeof oInit == 'undefined' )
{
oInit = {};
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public class variables
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @namespace Settings object which contains customisable information for ColVis instance
*/
this.s = {
/**
* DataTables settings object
* @property dt
* @type Object
* @default null
*/
"dt": null,
/**
* Customisation object
* @property oInit
* @type Object
* @default passed in
*/
"oInit": oInit,
/**
* Callback function to tell the user when the state has changed
* @property fnStateChange
* @type function
* @default null
*/
"fnStateChange": null,
/**
* Mode of activation. Can be 'click' or 'mouseover'
* @property activate
* @type String
* @default click
*/
"activate": "click",
/**
* Position of the collection menu when shown - align "left" or "right"
* @property sAlign
* @type String
* @default right
*/
"sAlign": "left",
/**
* Text used for the button
* @property buttonText
* @type String
* @default Show / hide columns
*/
"buttonText": "Show / hide columns",
/**
* Flag to say if the collection is hidden
* @property hidden
* @type boolean
* @default true
*/
"hidden": true,
/**
* List of columns (integers) which should be excluded from the list
* @property aiExclude
* @type Array
* @default []
*/
"aiExclude": [],
/**
* Store the original viisbility settings so they could be restored
* @property abOriginal
* @type Array
* @default []
*/
"abOriginal": [],
/**
* Show Show-All button
* @property bShowAll
* @type Array
* @default []
*/
"bShowAll": false,
/**
* Show All button text
* @property sShowAll
* @type String
* @default Restore original
*/
"sShowAll": "Show All",
/**
* Show restore button
* @property bRestore
* @type Array
* @default []
*/
"bRestore": false,
/**
* Restore button text
* @property sRestore
* @type String
* @default Restore original
*/
"sRestore": "Restore original",
/**
* Overlay animation duration in mS
* @property iOverlayFade
* @type Integer
* @default 500
*/
"iOverlayFade": 500,
/**
* Label callback for column names. Takes three parameters: 1. the column index, 2. the column
* title detected by DataTables and 3. the TH node for the column
* @property fnLabel
* @type Function
* @default null
*/
"fnLabel": null,
/**
* Indicate if ColVis should automatically calculate the size of buttons or not. The default
* is for it to do so. Set to "css" to disable the automatic sizing
* @property sSize
* @type String
* @default auto
*/
"sSize": "auto",
/**
* Indicate if the column list should be positioned by Javascript, visually below the button
* or allow CSS to do the positioning
* @property bCssPosition
* @type boolean
* @default false
*/
"bCssPosition": false
};
/**
* @namespace Common and useful DOM elements for the class instance
*/
this.dom = {
/**
* Wrapper for the button - given back to DataTables as the node to insert
* @property wrapper
* @type Node
* @default null
*/
"wrapper": null,
/**
* Activation button
* @property button
* @type Node
* @default null
*/
"button": null,
/**
* Collection list node
* @property collection
* @type Node
* @default null
*/
"collection": null,
/**
* Background node used for shading the display and event capturing
* @property background
* @type Node
* @default null
*/
"background": null,
/**
* Element to position over the activation button to catch mouse events when using mouseover
* @property catcher
* @type Node
* @default null
*/
"catcher": null,
/**
* List of button elements
* @property buttons
* @type Array
* @default []
*/
"buttons": [],
/**
* Restore button
* @property restore
* @type Node
* @default null
*/
"restore": null
};
/* Store global reference */
ColVis.aInstances.push( this );
/* Constructor logic */
this.s.dt = oDTSettings;
this._fnConstruct();
return this;
};
ColVis.prototype = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Rebuild the list of buttons for this instance (i.e. if there is a column header update)
* @method fnRebuild
* @returns void
*/
"fnRebuild": function ()
{
/* Remove the old buttons */
for ( var i=this.dom.buttons.length-1 ; i>=0 ; i-- )
{
if ( this.dom.buttons[i] !== null )
{
this.dom.collection.removeChild( this.dom.buttons[i] );
}
}
this.dom.buttons.splice( 0, this.dom.buttons.length );
if ( this.dom.restore )
{
this.dom.restore.parentNode( this.dom.restore );
}
/* Re-add them (this is not the optimal way of doing this, it is fast and effective) */
this._fnAddButtons();
/* Update the checkboxes */
this._fnDrawCallback();
},
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods (they are of course public in JS, but recommended as private)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Constructor logic
* @method _fnConstruct
* @returns void
* @private
*/
"_fnConstruct": function ()
{
this._fnApplyCustomisation();
var that = this;
this.dom.wrapper = document.createElement('div');
this.dom.wrapper.className = "ColVis TableTools";
this.dom.button = this._fnDomBaseButton( this.s.buttonText );
this.dom.button.className += " ColVis_MasterButton";
this.dom.wrapper.appendChild( this.dom.button );
this.dom.catcher = this._fnDomCatcher();
this.dom.collection = this._fnDomCollection();
this.dom.background = this._fnDomBackground();
this._fnAddButtons();
/* Store the original visbility information */
for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
{
this.s.abOriginal.push( this.s.dt.aoColumns[i].bVisible );
}
/* Update on each draw */
this.s.dt.aoDrawCallback.push( {
"fn": function () {
that._fnDrawCallback.call( that );
},
"sName": "ColVis"
} );
},
/**
* Apply any customisation to the settings from the DataTables initialisation
* @method _fnApplyCustomisation
* @returns void
* @private
*/
"_fnApplyCustomisation": function ()
{
var oConfig = this.s.oInit;
if ( typeof oConfig.activate != 'undefined' )
{
this.s.activate = oConfig.activate;
}
if ( typeof oConfig.buttonText != 'undefined' )
{
this.s.buttonText = oConfig.buttonText;
}
if ( typeof oConfig.aiExclude != 'undefined' )
{
this.s.aiExclude = oConfig.aiExclude;
}
if ( typeof oConfig.bRestore != 'undefined' )
{
this.s.bRestore = oConfig.bRestore;
}
if ( typeof oConfig.sRestore != 'undefined' )
{
this.s.sRestore = oConfig.sRestore;
}
if ( typeof oConfig.bShowAll != 'undefined' )
{
this.s.bShowAll = oConfig.bShowAll;
}
if ( typeof oConfig.sShowAll != 'undefined' )
{
this.s.sShowAll = oConfig.sShowAll;
}
if ( typeof oConfig.sAlign != 'undefined' )
{
this.s.sAlign = oConfig.sAlign;
}
if ( typeof oConfig.fnStateChange != 'undefined' )
{
this.s.fnStateChange = oConfig.fnStateChange;
}
if ( typeof oConfig.iOverlayFade != 'undefined' )
{
this.s.iOverlayFade = oConfig.iOverlayFade;
}
if ( typeof oConfig.fnLabel != 'undefined' )
{
this.s.fnLabel = oConfig.fnLabel;
}
if ( typeof oConfig.sSize != 'undefined' )
{
this.s.sSize = oConfig.sSize;
}
if ( typeof oConfig.bCssPosition != 'undefined' )
{
this.s.bCssPosition = oConfig.bCssPosition;
}
},
/**
* On each table draw, check the visiblity checkboxes as needed. This allows any process to
* update the table's column visiblity and ColVis will still be accurate.
* @method _fnDrawCallback
* @returns void
* @private
*/
"_fnDrawCallback": function ()
{
var aoColumns = this.s.dt.aoColumns;
for ( var i=0, iLen=aoColumns.length ; i<iLen ; i++ )
{
if ( this.dom.buttons[i] !== null )
{
if ( aoColumns[i].bVisible )
{
$('input', this.dom.buttons[i]).attr('checked','checked');
}
else
{
$('input', this.dom.buttons[i]).removeAttr('checked');
}
}
}
},
/**
* Loop through the columns in the table and as a new button for each one.
* @method _fnAddButtons
* @returns void
* @private
*/
"_fnAddButtons": function ()
{
var
nButton,
sExclude = ","+this.s.aiExclude.join(',')+",";
for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
{
if ( sExclude.indexOf( ","+i+"," ) == -1 )
{
nButton = this._fnDomColumnButton( i );
this.dom.buttons.push( nButton );
this.dom.collection.appendChild( nButton );
}
else
{
this.dom.buttons.push( null );
}
}
if ( this.s.bRestore )
{
nButton = this._fnDomRestoreButton();
nButton.className += " ColVis_Restore";
this.dom.buttons.push( nButton );
this.dom.collection.appendChild( nButton );
}
if ( this.s.bShowAll )
{
nButton = this._fnDomShowAllButton();
nButton.className += " ColVis_ShowAll";
this.dom.buttons.push( nButton );
this.dom.collection.appendChild( nButton );
}
},
/**
* Create a button which allows a "restore" action
* @method _fnDomRestoreButton
* @returns {Node} Created button
* @private
*/
"_fnDomRestoreButton": function ()
{
var
that = this,
nButton = document.createElement('button'),
nSpan = document.createElement('span');
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
"ColVis_Button TableTools_Button ui-button ui-state-default";
nButton.appendChild( nSpan );
$(nSpan).html( '<span class="ColVis_title">'+this.s.sRestore+'</span>' );
$(nButton).click( function (e) {
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
{
that.s.dt.oInstance.fnSetColumnVis( i, that.s.abOriginal[i], false );
}
that._fnAdjustOpenRows();
that.s.dt.oInstance.fnDraw( false );
} );
return nButton;
},
/**
* Create a button which allows a "show all" action
* @method _fnDomShowAllButton
* @returns {Node} Created button
* @private
*/
"_fnDomShowAllButton": function ()
{
var
that = this,
nButton = document.createElement('button'),
nSpan = document.createElement('span');
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
"ColVis_Button TableTools_Button ui-button ui-state-default";
nButton.appendChild( nSpan );
$(nSpan).html( '<span class="ColVis_title">'+this.s.sShowAll+'</span>' );
$(nButton).click( function (e) {
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
{
if (that.s.aiExclude.indexOf(i) === -1)
{
that.s.dt.oInstance.fnSetColumnVis( i, true, false );
}
}
that._fnAdjustOpenRows();
that.s.dt.oInstance.fnDraw( false );
} );
return nButton;
},
/**
* Create the DOM for a show / hide button
* @method _fnDomColumnButton
* @param {int} i Column in question
* @returns {Node} Created button
* @private
*/
"_fnDomColumnButton": function ( i )
{
var
that = this,
oColumn = this.s.dt.aoColumns[i],
nButton = document.createElement('button'),
nSpan = document.createElement('span'),
dt = this.s.dt;
nButton.className = !dt.bJUI ? "ColVis_Button TableTools_Button" :
"ColVis_Button TableTools_Button ui-button ui-state-default";
nButton.appendChild( nSpan );
var sTitle = this.s.fnLabel===null ? oColumn.sTitle : this.s.fnLabel( i, oColumn.sTitle, oColumn.nTh );
$(nSpan).html(
'<span class="ColVis_radio"><input type="checkbox"/></span>'+
'<span class="ColVis_title">'+sTitle+'</span>' );
$(nButton).click( function (e) {
var showHide = !$('input', this).is(":checked");
if ( e.target.nodeName.toLowerCase() == "input" )
{
showHide = $('input', this).is(":checked");
}
/* Need to consider the case where the initialiser created more than one table - change the
* API index that DataTables is using
*/
var oldIndex = $.fn.dataTableExt.iApiIndex;
$.fn.dataTableExt.iApiIndex = that._fnDataTablesApiIndex.call(that);
// Optimisation for server-side processing when scrolling - don't do a full redraw
if ( dt.oFeatures.bServerSide && (dt.oScroll.sX !== "" || dt.oScroll.sY !== "" ) )
{
that.s.dt.oInstance.fnSetColumnVis( i, showHide, false );
that.s.dt.oInstance.oApi._fnScrollDraw( that.s.dt );
that._fnDrawCallback();
}
else
{
that.s.dt.oInstance.fnSetColumnVis( i, showHide );
}
$.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */
if ( that.s.fnStateChange !== null )
{
that.s.fnStateChange.call( that, i, showHide );
}
} );
return nButton;
},
/**
* Get the position in the DataTables instance array of the table for this instance of ColVis
* @method _fnDataTablesApiIndex
* @returns {int} Index
* @private
*/
"_fnDataTablesApiIndex": function ()
{
for ( var i=0, iLen=this.s.dt.oInstance.length ; i<iLen ; i++ )
{
if ( this.s.dt.oInstance[i] == this.s.dt.nTable )
{
return i;
}
}
return 0;
},
/**
* Create the DOM needed for the button and apply some base properties. All buttons start here
* @method _fnDomBaseButton
* @param {String} text Button text
* @returns {Node} DIV element for the button
* @private
*/
"_fnDomBaseButton": function ( text )
{
var
that = this,
nButton = document.createElement('button'),
nSpan = document.createElement('span'),
sEvent = this.s.activate=="mouseover" ? "mouseover" : "click";
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
"ColVis_Button TableTools_Button ui-button ui-state-default";
nButton.appendChild( nSpan );
nSpan.innerHTML = text;
$(nButton).bind( sEvent, function (e) {
that._fnCollectionShow();
e.preventDefault();
} );
return nButton;
},
/**
* Create the element used to contain list the columns (it is shown and hidden as needed)
* @method _fnDomCollection
* @returns {Node} div container for the collection
* @private
*/
"_fnDomCollection": function ()
{
var that = this;
var nHidden = document.createElement('div');
nHidden.style.display = "none";
nHidden.className = !this.s.dt.bJUI ? "ColVis_collection TableTools_collection" :
"ColVis_collection TableTools_collection ui-buttonset ui-buttonset-multi";
if ( !this.s.bCssPosition )
{
nHidden.style.position = "absolute";
}
$(nHidden).css('opacity', 0);
return nHidden;
},
/**
* An element to be placed on top of the activate button to catch events
* @method _fnDomCatcher
* @returns {Node} div container for the collection
* @private
*/
"_fnDomCatcher": function ()
{
var
that = this,
nCatcher = document.createElement('div');
nCatcher.className = "ColVis_catcher TableTools_catcher";
$(nCatcher).click( function () {
that._fnCollectionHide.call( that, null, null );
} );
return nCatcher;
},
/**
* Create the element used to shade the background, and capture hide events (it is shown and
* hidden as needed)
* @method _fnDomBackground
* @returns {Node} div container for the background
* @private
*/
"_fnDomBackground": function ()
{
var that = this;
var nBackground = document.createElement('div');
nBackground.style.position = "absolute";
nBackground.style.left = "0px";
nBackground.style.top = "0px";
nBackground.className = "ColVis_collectionBackground TableTools_collectionBackground";
$(nBackground).css('opacity', 0);
$(nBackground).click( function () {
that._fnCollectionHide.call( that, null, null );
} );
/* When considering a mouse over action for the activation, we also consider a mouse out
* which is the same as a mouse over the background - without all the messing around of
* bubbling events. Use the catcher element to avoid messing around with bubbling
*/
if ( this.s.activate == "mouseover" )
{
$(nBackground).mouseover( function () {
that.s.overcollection = false;
that._fnCollectionHide.call( that, null, null );
} );
}
return nBackground;
},
/**
* Show the show / hide list and the background
* @method _fnCollectionShow
* @returns void
* @private
*/
"_fnCollectionShow": function ()
{
var that = this, i, iLen;
var oPos = $(this.dom.button).offset();
var nHidden = this.dom.collection;
var nBackground = this.dom.background;
var iDivX = parseInt(oPos.left, 10);
var iDivY = parseInt(oPos.top + $(this.dom.button).outerHeight(), 10);
if ( !this.s.bCssPosition )
{
nHidden.style.top = iDivY+"px";
nHidden.style.left = iDivX+"px";
}
nHidden.style.display = "block";
$(nHidden).css('opacity',0);
var iWinHeight = $(window).height(), iDocHeight = $(document).height(),
iWinWidth = $(window).width(), iDocWidth = $(document).width();
nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px";
nBackground.style.width = ((iWinWidth<iDocWidth)? iWinWidth : iDocWidth) +"px";
var oStyle = this.dom.catcher.style;
oStyle.height = $(this.dom.button).outerHeight()+"px";
oStyle.width = $(this.dom.button).outerWidth()+"px";
oStyle.top = oPos.top+"px";
oStyle.left = iDivX+"px";
document.body.appendChild( nBackground );
document.body.appendChild( nHidden );
document.body.appendChild( this.dom.catcher );
/* Resize the buttons */
if ( this.s.sSize == "auto" )
{
var aiSizes = [];
this.dom.collection.style.width = "auto";
for ( i=0, iLen=this.dom.buttons.length ; i<iLen ; i++ )
{
if ( this.dom.buttons[i] !== null )
{
this.dom.buttons[i].style.width = "auto";
aiSizes.push( $(this.dom.buttons[i]).outerWidth() );
}
}
iMax = Math.max.apply(window, aiSizes);
for ( i=0, iLen=this.dom.buttons.length ; i<iLen ; i++ )
{
if ( this.dom.buttons[i] !== null )
{
this.dom.buttons[i].style.width = iMax+"px";
}
}
this.dom.collection.style.width = iMax+"px";
}
/* Visual corrections to try and keep the collection visible */
if ( !this.s.bCssPosition )
{
nHidden.style.left = this.s.sAlign=="left" ?
iDivX+"px" : (iDivX-$(nHidden).outerWidth()+$(this.dom.button).outerWidth())+"px";
var iDivWidth = $(nHidden).outerWidth();
var iDivHeight = $(nHidden).outerHeight();
if ( iDivX + iDivWidth > iDocWidth )
{
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
}
}
/* This results in a very small delay for the end user but it allows the animation to be
* much smoother. If you don't want the animation, then the setTimeout can be removed
*/
setTimeout( function () {
$(nHidden).animate({"opacity": 1}, that.s.iOverlayFade);
$(nBackground).animate({"opacity": 0.1}, that.s.iOverlayFade, 'linear', function () {
/* In IE6 if you set the checked attribute of a hidden checkbox, then this is not visually
* reflected. As such, we need to do it here, once it is visible. Unbelievable.
*/
if ( jQuery.browser.msie && jQuery.browser.version == "6.0" )
{
that._fnDrawCallback();
}
});
}, 10 );
this.s.hidden = false;
},
/**
* Hide the show / hide list and the background
* @method _fnCollectionHide
* @returns void
* @private
*/
"_fnCollectionHide": function ( )
{
var that = this;
if ( !this.s.hidden && this.dom.collection !== null )
{
this.s.hidden = true;
$(this.dom.collection).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
this.style.display = "none";
} );
$(this.dom.background).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
document.body.removeChild( that.dom.background );
document.body.removeChild( that.dom.catcher );
} );
}
},
/**
* Alter the colspan on any fnOpen rows
*/
"_fnAdjustOpenRows": function ()
{
var aoOpen = this.s.dt.aoOpenRows;
var iVisible = this.s.dt.oApi._fnVisbleColumns( this.s.dt );
for ( var i=0, iLen=aoOpen.length ; i<iLen ; i++ ) {
aoOpen[i].nTr.getElementsByTagName('td')[0].colSpan = iVisible;
}
}
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Static object methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Rebuild the collection for a given table, or all tables if no parameter given
* @method ColVis.fnRebuild
* @static
* @param object oTable DataTable instance to consider - optional
* @returns void
*/
ColVis.fnRebuild = function ( oTable )
{
var nTable = null;
if ( typeof oTable != 'undefined' )
{
nTable = oTable.fnSettings().nTable;
}
for ( var i=0, iLen=ColVis.aInstances.length ; i<iLen ; i++ )
{
if ( typeof oTable == 'undefined' || nTable == ColVis.aInstances[i].s.dt.nTable )
{
ColVis.aInstances[i].fnRebuild();
}
}
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Static object propterties
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Collection of all ColVis instances
* @property ColVis.aInstances
* @static
* @type Array
* @default []
*/
ColVis.aInstances = [];
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constants
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Name of this class
* @constant CLASS
* @type String
* @default ColVis
*/
ColVis.prototype.CLASS = "ColVis";
/**
* ColVis version
* @constant VERSION
* @type String
* @default See code
*/
ColVis.VERSION = "1.0.7";
ColVis.prototype.VERSION = ColVis.VERSION;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Initialisation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Register a new feature with DataTables
*/
if ( typeof $.fn.dataTable == "function" &&
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
$.fn.dataTableExt.fnVersionCheck('1.7.0') )
{
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) {
var init = (typeof oDTSettings.oInit.oColVis == 'undefined') ?
{} : oDTSettings.oInit.oColVis;
var oColvis = new ColVis( oDTSettings, init );
return oColvis.dom.wrapper;
},
"cFeature": "C",
"sFeature": "ColVis"
} );
}
else
{
alert( "Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download");
}
})(jQuery);

View file

@ -0,0 +1,33 @@
/*
* File: ColVis.min.js
* Version: 1.0.7
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD (3 point) style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
(function(d){ColVis=function(a,b){(!this.CLASS||"ColVis"!=this.CLASS)&&alert("Warning: ColVis must be initialised with the keyword 'new'");"undefined"==typeof b&&(b={});this.s={dt:null,oInit:b,fnStateChange:null,activate:"click",sAlign:"left",buttonText:"Show / hide columns",hidden:!0,aiExclude:[],abOriginal:[],bShowAll:!1,sShowAll:"Show All",bRestore:!1,sRestore:"Restore original",iOverlayFade:500,fnLabel:null,sSize:"auto",bCssPosition:!1};this.dom={wrapper:null,button:null,collection:null,background:null,
catcher:null,buttons:[],restore:null};ColVis.aInstances.push(this);this.s.dt=a;this._fnConstruct();return this};ColVis.prototype={fnRebuild:function(){for(var a=this.dom.buttons.length-1;0<=a;a--)null!==this.dom.buttons[a]&&this.dom.collection.removeChild(this.dom.buttons[a]);this.dom.buttons.splice(0,this.dom.buttons.length);this.dom.restore&&this.dom.restore.parentNode(this.dom.restore);this._fnAddButtons();this._fnDrawCallback()},_fnConstruct:function(){this._fnApplyCustomisation();var a=this;
this.dom.wrapper=document.createElement("div");this.dom.wrapper.className="ColVis TableTools";this.dom.button=this._fnDomBaseButton(this.s.buttonText);this.dom.button.className+=" ColVis_MasterButton";this.dom.wrapper.appendChild(this.dom.button);this.dom.catcher=this._fnDomCatcher();this.dom.collection=this._fnDomCollection();this.dom.background=this._fnDomBackground();this._fnAddButtons();for(var b=0,c=this.s.dt.aoColumns.length;b<c;b++)this.s.abOriginal.push(this.s.dt.aoColumns[b].bVisible);this.s.dt.aoDrawCallback.push({fn:function(){a._fnDrawCallback.call(a)},
sName:"ColVis"})},_fnApplyCustomisation:function(){var a=this.s.oInit;if("undefined"!=typeof a.activate)this.s.activate=a.activate;if("undefined"!=typeof a.buttonText)this.s.buttonText=a.buttonText;if("undefined"!=typeof a.aiExclude)this.s.aiExclude=a.aiExclude;if("undefined"!=typeof a.bRestore)this.s.bRestore=a.bRestore;if("undefined"!=typeof a.sRestore)this.s.sRestore=a.sRestore;if("undefined"!=typeof a.bShowAll)this.s.bShowAll=a.bShowAll;if("undefined"!=typeof a.sShowAll)this.s.sShowAll=a.sShowAll;
if("undefined"!=typeof a.sAlign)this.s.sAlign=a.sAlign;if("undefined"!=typeof a.fnStateChange)this.s.fnStateChange=a.fnStateChange;if("undefined"!=typeof a.iOverlayFade)this.s.iOverlayFade=a.iOverlayFade;if("undefined"!=typeof a.fnLabel)this.s.fnLabel=a.fnLabel;if("undefined"!=typeof a.sSize)this.s.sSize=a.sSize;if("undefined"!=typeof a.bCssPosition)this.s.bCssPosition=a.bCssPosition},_fnDrawCallback:function(){for(var a=this.s.dt.aoColumns,b=0,c=a.length;b<c;b++)null!==this.dom.buttons[b]&&(a[b].bVisible?
d("input",this.dom.buttons[b]).attr("checked","checked"):d("input",this.dom.buttons[b]).removeAttr("checked"))},_fnAddButtons:function(){for(var a,b=","+this.s.aiExclude.join(",")+",",c=0,d=this.s.dt.aoColumns.length;c<d;c++)-1==b.indexOf(","+c+",")?(a=this._fnDomColumnButton(c),this.dom.buttons.push(a),this.dom.collection.appendChild(a)):this.dom.buttons.push(null);this.s.bRestore&&(a=this._fnDomRestoreButton(),a.className+=" ColVis_Restore",this.dom.buttons.push(a),this.dom.collection.appendChild(a));
this.s.bShowAll&&(a=this._fnDomShowAllButton(),a.className+=" ColVis_ShowAll",this.dom.buttons.push(a),this.dom.collection.appendChild(a))},_fnDomRestoreButton:function(){var a=this,b=document.createElement("button"),c=document.createElement("span");b.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";b.appendChild(c);d(c).html('<span class="ColVis_title">'+this.s.sRestore+"</span>");d(b).click(function(){for(var b=0,c=a.s.abOriginal.length;b<
c;b++)a.s.dt.oInstance.fnSetColumnVis(b,a.s.abOriginal[b],!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnDraw(!1)});return b},_fnDomShowAllButton:function(){var a=this,b=document.createElement("button"),c=document.createElement("span");b.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";b.appendChild(c);d(c).html('<span class="ColVis_title">'+this.s.sShowAll+"</span>");d(b).click(function(){for(var b=0,c=a.s.abOriginal.length;b<
c;b++)-1===a.s.aiExclude.indexOf(b)&&a.s.dt.oInstance.fnSetColumnVis(b,!0,!1);a._fnAdjustOpenRows();a.s.dt.oInstance.fnDraw(!1)});return b},_fnDomColumnButton:function(a){var b=this,c=this.s.dt.aoColumns[a],e=document.createElement("button"),g=document.createElement("span"),f=this.s.dt;e.className=!f.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";e.appendChild(g);c=null===this.s.fnLabel?c.sTitle:this.s.fnLabel(a,c.sTitle,c.nTh);d(g).html('<span class="ColVis_radio"><input type="checkbox"/></span><span class="ColVis_title">'+
c+"</span>");d(e).click(function(c){var e=!d("input",this).is(":checked");"input"==c.target.nodeName.toLowerCase()&&(e=d("input",this).is(":checked"));c=d.fn.dataTableExt.iApiIndex;d.fn.dataTableExt.iApiIndex=b._fnDataTablesApiIndex.call(b);f.oFeatures.bServerSide&&(""!==f.oScroll.sX||""!==f.oScroll.sY)?(b.s.dt.oInstance.fnSetColumnVis(a,e,!1),b.s.dt.oInstance.oApi._fnScrollDraw(b.s.dt),b._fnDrawCallback()):b.s.dt.oInstance.fnSetColumnVis(a,e);d.fn.dataTableExt.iApiIndex=c;null!==b.s.fnStateChange&&
b.s.fnStateChange.call(b,a,e)});return e},_fnDataTablesApiIndex:function(){for(var a=0,b=this.s.dt.oInstance.length;a<b;a++)if(this.s.dt.oInstance[a]==this.s.dt.nTable)return a;return 0},_fnDomBaseButton:function(a){var b=this,c=document.createElement("button"),e=document.createElement("span"),g="mouseover"==this.s.activate?"mouseover":"click";c.className=!this.s.dt.bJUI?"ColVis_Button TableTools_Button":"ColVis_Button TableTools_Button ui-button ui-state-default";c.appendChild(e);e.innerHTML=a;d(c).bind(g,
function(a){b._fnCollectionShow();a.preventDefault()});return c},_fnDomCollection:function(){var a=document.createElement("div");a.style.display="none";a.className=!this.s.dt.bJUI?"ColVis_collection TableTools_collection":"ColVis_collection TableTools_collection ui-buttonset ui-buttonset-multi";if(!this.s.bCssPosition)a.style.position="absolute";d(a).css("opacity",0);return a},_fnDomCatcher:function(){var a=this,b=document.createElement("div");b.className="ColVis_catcher TableTools_catcher";d(b).click(function(){a._fnCollectionHide.call(a,
null,null)});return b},_fnDomBackground:function(){var a=this,b=document.createElement("div");b.style.position="absolute";b.style.left="0px";b.style.top="0px";b.className="ColVis_collectionBackground TableTools_collectionBackground";d(b).css("opacity",0);d(b).click(function(){a._fnCollectionHide.call(a,null,null)});"mouseover"==this.s.activate&&d(b).mouseover(function(){a.s.overcollection=!1;a._fnCollectionHide.call(a,null,null)});return b},_fnCollectionShow:function(){var a=this,b,c;b=d(this.dom.button).offset();
var e=this.dom.collection,g=this.dom.background,f=parseInt(b.left,10),h=parseInt(b.top+d(this.dom.button).outerHeight(),10);if(!this.s.bCssPosition)e.style.top=h+"px",e.style.left=f+"px";e.style.display="block";d(e).css("opacity",0);c=d(window).height();var i=d(document).height(),j=d(window).width(),h=d(document).width();g.style.height=(c>i?c:i)+"px";g.style.width=(j<h?j:h)+"px";c=this.dom.catcher.style;c.height=d(this.dom.button).outerHeight()+"px";c.width=d(this.dom.button).outerWidth()+"px";c.top=
b.top+"px";c.left=f+"px";document.body.appendChild(g);document.body.appendChild(e);document.body.appendChild(this.dom.catcher);if("auto"==this.s.sSize){i=[];this.dom.collection.style.width="auto";for(b=0,c=this.dom.buttons.length;b<c;b++)if(null!==this.dom.buttons[b])this.dom.buttons[b].style.width="auto",i.push(d(this.dom.buttons[b]).outerWidth());iMax=Math.max.apply(window,i);for(b=0,c=this.dom.buttons.length;b<c;b++)if(null!==this.dom.buttons[b])this.dom.buttons[b].style.width=iMax+"px";this.dom.collection.style.width=
iMax+"px"}if(!this.s.bCssPosition&&(e.style.left="left"==this.s.sAlign?f+"px":f-d(e).outerWidth()+d(this.dom.button).outerWidth()+"px",b=d(e).outerWidth(),d(e).outerHeight(),f+b>h))e.style.left=h-b+"px";setTimeout(function(){d(e).animate({opacity:1},a.s.iOverlayFade);d(g).animate({opacity:0.1},a.s.iOverlayFade,"linear",function(){jQuery.browser.msie&&"6.0"==jQuery.browser.version&&a._fnDrawCallback()})},10);this.s.hidden=!1},_fnCollectionHide:function(){var a=this;if(!this.s.hidden&&null!==this.dom.collection)this.s.hidden=
!0,d(this.dom.collection).animate({opacity:0},a.s.iOverlayFade,function(){this.style.display="none"}),d(this.dom.background).animate({opacity:0},a.s.iOverlayFade,function(){document.body.removeChild(a.dom.background);document.body.removeChild(a.dom.catcher)})},_fnAdjustOpenRows:function(){for(var a=this.s.dt.aoOpenRows,b=this.s.dt.oApi._fnVisbleColumns(this.s.dt),c=0,d=a.length;c<d;c++)a[c].nTr.getElementsByTagName("td")[0].colSpan=b}};ColVis.fnRebuild=function(a){var b=null;if("undefined"!=typeof a)b=
a.fnSettings().nTable;for(var c=0,d=ColVis.aInstances.length;c<d;c++)("undefined"==typeof a||b==ColVis.aInstances[c].s.dt.nTable)&&ColVis.aInstances[c].fnRebuild()};ColVis.aInstances=[];ColVis.prototype.CLASS="ColVis";ColVis.VERSION="1.0.7";ColVis.prototype.VERSION=ColVis.VERSION;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.7.0")?d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){return(new ColVis(a,"undefined"==typeof a.oInit.oColVis?
{}:a.oInit.oColVis)).dom.wrapper},cFeature:"C",sFeature:"ColVis"}):alert("Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download")})(jQuery);

View file

@ -0,0 +1,121 @@
(function() {
var showingNav = true;
$(document).ready( function () {
var jqNav = $('div.fw_nav');
jqNav.css('right', ($(window).width() - $('div.fw_container').width()) /2);
var n = $('div.nav_blocker')[0];
n.style.height = $(jqNav).outerHeight()+"px";
n.style.width = $(jqNav).outerWidth()+"px";
SyntaxHighlighter.highlight();
$('#private_toggle').click( function () {
if ( $('input[name=show_private]').val() == 0 ) {
$('input[name=show_private]').val( 1 );
$('#private_label').html('Showing');
$('.private').css('display', 'block');
} else {
$('input[name=show_private]').val( 0 );
$('#private_label').html('Hiding');
$('.private').css('display', 'none');
}
fnWriteCookie();
return false;
} );
$('#extended_toggle').click( function () {
if ( $('input[name=show_extended]').val() == 0 ) {
$('input[name=show_extended]').val( 1 );
$('#extended_label').html('Showing');
$('.augmented').css('display', 'block');
} else {
$('input[name=show_extended]').val( 0 );
$('#extended_label').html('Hiding');
$('.augmented').css('display', 'none');
}
fnWriteCookie();
return false;
} );
var savedHeight = $(jqNav).height();
$('div.fw_nav h2').click( function () {
if ( showingNav ) {
$('div.fw_nav').animate( {
"height": 10,
"opacity": 0.3
} );
showingNav = false;
} else {
$('div.fw_nav').animate( {
"height": savedHeight,
"opacity": 1
} );
showingNav = true;
}
fnWriteCookie();
} );
var cookie = fnReadCookie( 'SpryMedia_JSDoc' );
if ( cookie != null ) {
var a = cookie.split('-');
if ( a[0] == 1 ) {
$('#private_toggle').click();
}
if ( a[1] == 0 ) {
$('#extended_toggle').click();
}
if ( a[2] == 'false' ) {
$('div.fw_nav').css('height', 10).css('opacity', 0.3);
showingNav = false;
}
}
} );
function fnWriteCookie()
{
var sVal =
$('input[name=show_private]').val()+'-'+
$('input[name=show_extended]').val()+'-'+
showingNav;
fnCreateCookie( 'SpryMedia_JSDoc', sVal );
}
function fnCreateCookie( sName, sValue )
{
var iDays = 365;
var date = new Date();
date.setTime( date.getTime()+(iDays*24*60*60*1000) );
var sExpires = "; expires="+date.toGMTString();
document.cookie = sName+"="+sValue+sExpires+"; path=/";
}
function fnReadCookie( sName )
{
var sNameEQ = sName + "=";
var sCookieContents = document.cookie.split(';');
for( var i=0 ; i<sCookieContents.length ; i++ ) {
var c = sCookieContents[i];
while (c.charAt(0)==' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(sNameEQ) == 0) {
return c.substring(sNameEQ.length,c.length);
}
}
return null;
}
})();

View file

@ -0,0 +1,52 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'break case catch continue ' +
'default delete do else false ' +
'for function if in instanceof ' +
'new null return super switch ' +
'this throw true try typeof var while with'
;
var r = SyntaxHighlighter.regexLib;
this.regexList = [
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
];
this.forHtmlScript(r.scriptScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['js', 'jscript', 'javascript'];
SyntaxHighlighter.brushes.JScript = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,47 @@
/*
* File: FixedColumns.min.js
* Version: 2.0.2
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2010-2010 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, available at:
* http://datatables.net/license_gpl2
* http://datatables.net/license_bsd
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
/*
GPL v2 or BSD 3 point style
@contact www.sprymedia.co.uk/contact
@copyright Copyright 2010-2011 Allan Jardine, all rights reserved.
This source file is free software, under either the GPL v2 license or a
BSD style license, available at:
http://datatables.net/license_gpl2
http://datatables.net/license_bsd
*/
var FixedColumns;
(function(c,m){FixedColumns=function(a,d){!this instanceof FixedColumns?alert("FixedColumns warning: FixedColumns must be initialised with the 'new' keyword."):("undefined"==typeof d&&(d={}),this.s={dt:a.fnSettings(),iTableColumns:a.fnSettings().aoColumns.length,aiWidths:[],bOldIE:c.browser.msie&&("6.0"==c.browser.version||"7.0"==c.browser.version)},this.dom={scroller:null,header:null,body:null,footer:null,grid:{wrapper:null,dt:null,left:{wrapper:null,head:null,body:null,foot:null},right:{wrapper:null,
head:null,body:null,foot:null}},clone:{left:{header:null,body:null,footer:null},right:{header:null,body:null,footer:null}}},this.s.dt.oFixedColumns=this,this._fnConstruct(d))};FixedColumns.prototype={fnUpdate:function(){this._fnDraw(!0)},fnRedrawLayout:function(){this._fnGridLayout()},fnRecalculateHeight:function(a){a._DTTC_iHeight=null;a.style.height="auto"},fnSetRowHeight:function(a,d){var b=c(a).children(":first"),b=b.outerHeight()-b.height();c.browser.mozilla||c.browser.opera?a.style.height=d+
"px":c(a).children().height(d-b)},_fnConstruct:function(a){var d,b=this;if("function"!=typeof this.s.dt.oInstance.fnVersionCheck||!0!==this.s.dt.oInstance.fnVersionCheck("1.8.0"))alert("FixedColumns "+FixedColumns.VERSION+" required DataTables 1.8.0 or later. Please upgrade your DataTables installation");else if(""===this.s.dt.oScroll.sX)this.s.dt.oInstance.oApi._fnLog(this.s.dt,1,"FixedColumns is not needed (no x-scrolling in DataTables enabled), so no action will be taken. Use 'FixedHeader' for column fixing when scrolling is not enabled");
else{this.s=c.extend(!0,this.s,FixedColumns.defaults,a);this.dom.grid.dt=c(this.s.dt.nTable).parents("div.dataTables_scroll")[0];this.dom.scroller=c("div.dataTables_scrollBody",this.dom.grid.dt)[0];var a=c(this.dom.grid.dt).width(),f=0,g=0;c("tbody>tr:eq(0)>td",this.s.dt.nTable).each(function(a){d=c(this).outerWidth();b.s.aiWidths.push(d);a<b.s.iLeftColumns&&(f+=d);b.s.iTableColumns-b.s.iRightColumns<=a&&(g+=d)});if(null===this.s.iLeftWidth)this.s.iLeftWidth="fixed"==this.s.sLeftWidth?f:100*(f/a);
if(null===this.s.iRightWidth)this.s.iRightWidth="fixed"==this.s.sRightWidth?g:100*(g/a);this._fnGridSetup();for(a=0;a<this.s.iLeftColumns;a++)this.s.dt.oInstance.fnSetColumnVis(a,!1);for(a=this.s.iTableColumns-this.s.iRightColumns;a<this.s.iTableColumns;a++)this.s.dt.oInstance.fnSetColumnVis(a,!1);c(this.dom.scroller).scroll(function(){b.dom.grid.left.body.scrollTop=b.dom.scroller.scrollTop;if(0<b.s.iRightColumns)b.dom.grid.right.body.scrollTop=b.dom.scroller.scrollTop});c(m).resize(function(){b._fnGridLayout.call(b)});
var e=!0;this.s.dt.aoDrawCallback=[{fn:function(){b._fnDraw.call(b,e);b._fnGridHeight(b);e=!1},sName:"FixedColumns"}].concat(this.s.dt.aoDrawCallback);this._fnGridLayout();this._fnGridHeight();this.s.dt.oInstance.fnDraw(!1)}},_fnGridSetup:function(){this.dom.body=this.s.dt.nTable;this.dom.header=this.s.dt.nTHead.parentNode;this.dom.header.parentNode.parentNode.style.position="relative";var a=c('<div class="DTFC_ScrollWrapper" style="position:relative; clear:both;"><div class="DTFC_LeftWrapper" style="position:absolute; top:0; left:0;"><div class="DTFC_LeftHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div><div class="DTFC_LeftBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div><div class="DTFC_LeftFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div></div><div class="DTFC_RightWrapper" style="position:absolute; top:0; left:0;"><div class="DTFC_RightHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div><div class="DTFC_RightBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div><div class="DTFC_RightFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div></div></div>')[0];
nLeft=a.childNodes[0];nRight=a.childNodes[1];this.dom.grid.wrapper=a;this.dom.grid.left.wrapper=nLeft;this.dom.grid.left.head=nLeft.childNodes[0];this.dom.grid.left.body=nLeft.childNodes[1];if(0<this.s.iRightColumns)this.dom.grid.right.wrapper=nRight,this.dom.grid.right.head=nRight.childNodes[0],this.dom.grid.right.body=nRight.childNodes[1];if(this.s.dt.nTFoot&&(this.dom.footer=this.s.dt.nTFoot.parentNode,this.dom.grid.left.foot=nLeft.childNodes[2],0<this.s.iRightColumns))this.dom.grid.right.foot=
nRight.childNodes[2];a.appendChild(nLeft);this.dom.grid.dt.parentNode.insertBefore(a,this.dom.grid.dt);a.appendChild(this.dom.grid.dt);this.dom.grid.dt.style.position="absolute";this.dom.grid.dt.style.top="0px";this.dom.grid.dt.style.left=this.s.iLeftWidth+"px";this.dom.grid.dt.style.width=c(this.dom.grid.dt).width()-this.s.iLeftWidth-this.s.iRightWidth+"px"},_fnGridLayout:function(){var a=this.dom.grid,d=c(a.wrapper).width(),b=0,f=0,b=0,b="fixed"==this.s.sLeftWidth?this.s.iLeftWidth:this.s.iLeftWidth/
100*d,f="fixed"==this.s.sRightWidth?this.s.iRightWidth:this.s.iRightWidth/100*d;a.left.wrapper.style.width=b+"px";a.dt.style.width=d-b-f+"px";a.dt.style.left=b+"px";if(0<this.s.iRightColumns)a.right.wrapper.style.width=f+"px",a.right.wrapper.style.left=d-f+"px"},_fnGridHeight:function(){var a=this.dom.grid,d=c(this.dom.grid.dt).height();a.wrapper.style.height=d+"px";a.left.body.style.height=c(this.dom.scroller).height()+"px";a.left.wrapper.style.height=d+"px";if(0<this.s.iRightColumns)a.right.wrapper.style.height=
d+"px",a.right.body.style.height=c(this.dom.scroller).height()+"px"},_fnDraw:function(a){this._fnCloneLeft(a);this._fnCloneRight(a);null!==this.s.fnDrawCallback&&this.s.fnDrawCallback.call(this,this.dom.clone.left,this.dom.clone.right);c(this).trigger("draw",{leftClone:this.dom.clone.left,rightClone:this.dom.clone.right})},_fnCloneRight:function(a){if(!(0>=this.s.iRightColumns)){var c,b=[];for(c=this.s.iTableColumns-this.s.iRightColumns;c<this.s.iTableColumns;c++)b.push(c);this._fnClone(this.dom.clone.right,
this.dom.grid.right,b,a)}},_fnCloneLeft:function(a){if(!(0>=this.s.iLeftColumns)){var c,b=[];for(c=0;c<this.s.iLeftColumns;c++)b.push(c);this._fnClone(this.dom.clone.left,this.dom.grid.left,b,a)}},_fnCopyLayout:function(a,d){for(var b=[],f=[],g=[],e=0,k=a.length;e<k;e++){var l=[];l.nTr=c(a[e].nTr).clone(!0)[0];for(var i=0,h=this.s.iTableColumns;i<h;i++)if(-1!==c.inArray(i,d)){var j=c.inArray(a[e][i].cell,g);-1===j?(j=c(a[e][i].cell).clone(!0)[0],f.push(j),g.push(a[e][i].cell),l.push({cell:j,unique:a[e][i].unique})):
l.push({cell:f[j],unique:a[e][i].unique})}b.push(l)}return b},_fnClone:function(a,d,b,f){var g=this,e,k,l,i,h;if(f){null!==a.header&&a.header.parentNode.removeChild(a.header);a.header=c(this.dom.header).clone(!0)[0];a.header.className+=" DTFC_Cloned";a.header.style.width="100%";d.head.appendChild(a.header);var j=this._fnCopyLayout(this.s.dt.aoHeader,b),o=c(">thead",a.header);o.empty();for(e=0,k=j.length;e<k;e++)o[0].appendChild(j[e].nTr);this.s.dt.oApi._fnDrawHead(this.s.dt,j,!0)}else for(h=0;h<b.length;h++)c(">thead th:eq("+
h+")",a.header)[0].className=this.s.dt.aoColumns[b[h]].nTh.className,c(">thead th:eq("+h+") span.DataTables_sort_icon",a.header).each(function(a){this.className=c("span.DataTables_sort_icon",g.s.dt.aoColumns[b[h]].nTh)[a].className});this._fnEqualiseHeights("thead",this.dom.header,a.header);"auto"==this.s.sHeightMatch&&c(">tbody>tr",g.dom.body).css("height","auto");if(null!==a.body)a.body.parentNode.removeChild(a.body),a.body=null;a.body=c(this.dom.body).clone(!0)[0];a.body.className+=" DTFC_Cloned";
a.body.style.paddingBottom=this.s.dt.oScroll.iBarWidth+"px";a.body.style.marginBottom=2*this.s.dt.oScroll.iBarWidth+"px";null!==a.body.getAttribute("id")&&a.body.removeAttribute("id");c(">thead>tr",a.body).empty();c(">tfoot",a.body).empty();var n=c("tbody",a.body)[0];c(n).empty();0<this.s.dt.aiDisplay.length?c(">tbody>tr",g.dom.body).each(function(a){var d=this.cloneNode(!1),a=!1===g.s.dt.oFeatures.bServerSide?g.s.dt.aiDisplay[g.s.dt._iDisplayStart+a]:a;for(h=0;h<b.length;h++)if(l=b[h],"undefined"!=
typeof g.s.dt.aoData[a]._anHidden[l])i=c(g.s.dt.aoData[a]._anHidden[l]).clone(!0)[0],i.style.width=g.s.aiWidths[l]+"px",d.appendChild(i);n.appendChild(d)}):c(">tbody>tr",g.dom.body).each(function(){i=this.cloneNode(!0);i.className+=" DTFC_NoData";c("td",i).html("");n.appendChild(i)});a.body.style.width="100%";d.body.appendChild(a.body);this._fnEqualiseHeights("tbody",g.dom.body,a.body);if(null!==this.s.dt.nTFoot){if(f){null!==a.footer&&a.footer.parentNode.removeChild(a.footer);a.footer=c(this.dom.footer).clone(!0)[0];
a.footer.className+=" DTFC_Cloned";a.footer.style.width="100%";d.foot.appendChild(a.footer);j=this._fnCopyLayout(this.s.dt.aoFooter,b);d=c(">tfoot",a.footer);d.empty();for(e=0,k=j.length;e<k;e++)d[0].appendChild(j[e].nTr);this.s.dt.oApi._fnDrawHead(this.s.dt,j,!0)}else for(h=0;h<b.length;h++)c(">tfoot th:eq("+h+")",a.footer)[0].className=this.s.dt.aoColumns[b[h]].nTf.className;this._fnEqualiseHeights("tfoot",this.dom.footer,a.footer)}e=c(">tbody>tr:eq(0)",a.body);var m=c(">thead>tr:eq(0)",a.header);
if(null!==this.s.dt.nTFoot)var p=c(">tfoot>tr:eq(0)",a.footer);e.children().each(function(a){var b=c(this).width();m.children(":eq("+a+")").width(b);null!==g.s.dt.nTFoot&&p.children(":eq("+a+")").width(b)})},_fnGetTrNodes:function(a){for(var c=[],b=0,f=a.childNodes.length;b<f;b++)"TR"==a.childNodes[b].nodeName.toUpperCase()&&c.push(a.childNodes[b]);return c},_fnEqualiseHeights:function(a,d,b){if(!("none"==this.s.sHeightMatch&&"thead"!==a&&"tfoot"!==a)){var f,g,e=d.getElementsByTagName(a)[0],b=b.getElementsByTagName(a)[0],
a=c(">"+a+">tr:eq(0)",d).children(":first"),a=a.outerHeight()-a.height(),e=this._fnGetTrNodes(e),k=this._fnGetTrNodes(b);for(b=0,d=k.length;b<d;b++)if("semiauto"==this.s.sHeightMatch&&"undefined"!=typeof e[b]._DTTC_iHeight&&null!==e[b]._DTTC_iHeight)c.browser.msie&&c(k[b]).children().height(e[b]._DTTC_iHeight-a);else{f=e[b].offsetHeight;g=k[b].offsetHeight;f=g>f?g:f;if("semiauto"==this.s.sHeightMatch)e[b]._DTTC_iHeight=f;c.browser.msie&&8>c.browser.version?(c(k[b]).children().height(f-a),c(e[b]).children().height(f-
a)):(k[b].style.height=f+"px",e[b].style.height=f+"px")}}}};FixedColumns.defaults={iLeftColumns:1,iRightColumns:0,fnDrawCallback:null,sLeftWidth:"fixed",iLeftWidth:null,sRightWidth:"fixed",iRightWidth:null,sHeightMatch:"semiauto"};FixedColumns.prototype.CLASS="FixedColumns";FixedColumns.VERSION="2.0.2"})(jQuery,window,document);

View file

@ -0,0 +1,121 @@
(function() {
var showingNav = true;
$(document).ready( function () {
var jqNav = $('div.fw_nav');
jqNav.css('right', ($(window).width() - $('div.fw_container').width()) /2);
var n = $('div.nav_blocker')[0];
n.style.height = $(jqNav).outerHeight()+"px";
n.style.width = $(jqNav).outerWidth()+"px";
SyntaxHighlighter.highlight();
$('#private_toggle').click( function () {
if ( $('input[name=show_private]').val() == 0 ) {
$('input[name=show_private]').val( 1 );
$('#private_label').html('Showing');
$('.private').css('display', 'block');
} else {
$('input[name=show_private]').val( 0 );
$('#private_label').html('Hiding');
$('.private').css('display', 'none');
}
fnWriteCookie();
return false;
} );
$('#extended_toggle').click( function () {
if ( $('input[name=show_extended]').val() == 0 ) {
$('input[name=show_extended]').val( 1 );
$('#extended_label').html('Showing');
$('.augmented').css('display', 'block');
} else {
$('input[name=show_extended]').val( 0 );
$('#extended_label').html('Hiding');
$('.augmented').css('display', 'none');
}
fnWriteCookie();
return false;
} );
var savedHeight = $(jqNav).height();
$('div.fw_nav h2').click( function () {
if ( showingNav ) {
$('div.fw_nav').animate( {
"height": 10,
"opacity": 0.3
} );
showingNav = false;
} else {
$('div.fw_nav').animate( {
"height": savedHeight,
"opacity": 1
} );
showingNav = true;
}
fnWriteCookie();
} );
var cookie = fnReadCookie( 'SpryMedia_JSDoc' );
if ( cookie != null ) {
var a = cookie.split('-');
if ( a[0] == 1 ) {
$('#private_toggle').click();
}
if ( a[1] == 0 ) {
$('#extended_toggle').click();
}
if ( a[2] == 'false' ) {
$('div.fw_nav').css('height', 10).css('opacity', 0.3);
showingNav = false;
}
}
} );
function fnWriteCookie()
{
var sVal =
$('input[name=show_private]').val()+'-'+
$('input[name=show_extended]').val()+'-'+
showingNav;
fnCreateCookie( 'SpryMedia_JSDoc', sVal );
}
function fnCreateCookie( sName, sValue )
{
var iDays = 365;
var date = new Date();
date.setTime( date.getTime()+(iDays*24*60*60*1000) );
var sExpires = "; expires="+date.toGMTString();
document.cookie = sName+"="+sValue+sExpires+"; path=/";
}
function fnReadCookie( sName )
{
var sNameEQ = sName + "=";
var sCookieContents = document.cookie.split(';');
for( var i=0 ; i<sCookieContents.length ; i++ ) {
var c = sCookieContents[i];
while (c.charAt(0)==' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(sNameEQ) == 0) {
return c.substring(sNameEQ.length,c.length);
}
}
return null;
}
})();

View file

@ -0,0 +1,52 @@
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
* @copyright
* Copyright (C) 2004-2010 Alex Gorbatchev.
*
* @license
* Dual licensed under the MIT and GPL licenses.
*/
;(function()
{
// CommonJS
typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
function Brush()
{
var keywords = 'break case catch continue ' +
'default delete do else false ' +
'for function if in instanceof ' +
'new null return super switch ' +
'this throw true try typeof var while with'
;
var r = SyntaxHighlighter.regexLib;
this.regexList = [
{ regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
{ regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
{ regex: r.singleLineCComments, css: 'comments' }, // one line comments
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
{ regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
];
this.forHtmlScript(r.scriptScriptTags);
};
Brush.prototype = new SyntaxHighlighter.Highlighter();
Brush.aliases = ['js', 'jscript', 'javascript'];
SyntaxHighlighter.brushes.JScript = Brush;
// CommonJS
typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,804 @@
/**
* @summary Scroller
* @description Virtual rendering for DataTables
* @file Scroller.js
* @version 1.0.1
* @author Allan Jardine (www.sprymedia.co.uk)
* @license GPL v2 or BSD 3 point style
* @contact www.sprymedia.co.uk/contact
*
* @copyright Copyright 2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, available at:
* http://datatables.net/license_gpl2
* http://datatables.net/license_bsd
*/
(function($, window, document) {
/**
* Scroller is a virtual rendering plug-in for DataTables which allows large
* datasets to be drawn on screen every quickly. What the virtual rendering means
* is that only the visible portion of the table (and a bit to either side to make
* the scrolling smooth) is drawn, while the scrolling container gives the
* visual impression that the whole table is visible. This is done by making use
* of the pagination abilities of DataTables and moving the table around in the
* scrolling container DataTables adds to the page. The scrolling container is
* forced to the height it would be for the full table display using an extra
* element.
*
* Note that rows in the table MUST all be the same hight. Information in a cell
* which expands on to multiple lines will cause some odd behaviour in the scrolling.
*
* Scroller is initialised by simply including the letter 'S' in the sDom for the
* table you want to have this feature enabled on. Note that the 'S' must come
* AFTER the 't' parameter in sDom.
*
* Key features include:
* <ul class="limit_length">
* <li>Speed! The aim of Scroller for DataTables is to make rendering large data sets fast</li>
* <li>Full compatibility with deferred rendering in DataTables 1.8 for maximum speed</li>
* <li>Correct visual scrolling implementation, similar to "infinite scrolling" in DataTable core</li>
* <li>Integration with state saving in DataTables (scrolling position is saved)</li>
* <li>Easy to use</li>
* </ul>
*
* @class
* @constructor
* @param {object} oDT DataTables settings object
* @param {object} [oOpts={}] Configuration object for FixedColumns. Options are defined by {@link Scroller.oDefaults}
*
* @requires jQuery 1.4+
* @requires DataTables 1.8.0+
*
* @example
* $(document).ready(function() {
* $('#example').dataTable( {
* "sScrollY": "200px",
* "sAjaxSource": "media/dataset/large.txt",
* "sDom": "frtiS",
* "bDeferRender": true
* } );
* } );
*/
var Scroller = function ( oDTSettings, oOpts ) {
/* Sanity check - you just know it will happen */
if ( ! this instanceof Scroller )
{
alert( "Scroller warning: Scroller must be initialised with the 'new' keyword." );
return;
}
if ( typeof oOpts == 'undefined' )
{
oOpts = {};
}
/**
* Settings object which contains customisable information for the Scroller instance
* @namespace
* @extends Scroller.DEFAULTS
*/
this.s = $.extend( {
/**
* DataTables settings object
* @type object
* @default Passed in as first parameter to constructor
*/
"dt": oDTSettings,
/**
* Pixel location of the top of the drawn table in the viewport
* @type int
* @default 0
*/
"tableTop": 0,
/**
* Pixel location of the bottom of the drawn table in the viewport
* @type int
* @default 0
*/
"tableBottom": 0,
/**
* Pixel location of the boundary for when the next data set should be loaded and drawn
* when scrolling up the way.
* @type int
* @default 0
* @private
*/
"redrawTop": 0,
/**
* Pixel location of the boundary for when the next data set should be loaded and drawn
* when scrolling down the way. Note that this is actually caluated as the offset from
* the top.
* @type int
* @default 0
* @private
*/
"redrawBottom": 0,
/**
* Height of rows in the table
* @type int
* @default 0
*/
"rowHeight": null,
/**
* Auto row height or not indicator
* @type bool
* @default 0
*/
"autoHeight": true,
/**
* Pixel height of the viewport
* @type int
* @default 0
*/
"viewportHeight": 0,
/**
* Number of rows calculated as visible in the visible viewport
* @type int
* @default 0
*/
"viewportRows": 0,
/**
* setTimeout reference for state saving, used when state saving is enabled in the DataTable
* and when the user scrolls the viewport in order to stop the cookie set taking too much
* CPU!
* @type int
* @default 0
*/
"stateTO": null,
/**
* setTimeout reference for the redraw, used when server-side processing is enabled in the
* DataTables in order to prevent DoSing the server
* @type int
* @default null
*/
"drawTO": null
}, Scroller.oDefaults, oOpts );
/**
* DOM elements used by the class instance
* @namespace
*
*/
this.dom = {
"force": document.createElement('div'),
"scroller": null,
"table": null
};
/* Attach the instance to the DataTables instance so it can be accessed */
this.s.dt.oScroller = this;
/* Let's do it */
this._fnConstruct();
};
Scroller.prototype = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Calculate the pixel position from the top of the scrolling container for a given row
* @param {int} iRow Row number to calculate the position of
* @returns {int} Pixels
* @example
* $(document).ready(function() {
* $('#example').dataTable( {
* "sScrollY": "200px",
* "sAjaxSource": "media/dataset/large.txt",
* "sDom": "frtiS",
* "bDeferRender": true,
* "fnInitComplete": function (o) {
* // Find where row 25 is
* alert( o.oScroller.fnRowToPixels( 25 ) );
* }
* } );
* } );
*/
"fnRowToPixels": function ( iRow )
{
return iRow * this.s.rowHeight;
},
/**
* Calculate the row number that will be found at the given pixel position (y-scroll)
* @param {int} iPixels Offset from top to caluclate the row number of
* @returns {int} Row index
* @example
* $(document).ready(function() {
* $('#example').dataTable( {
* "sScrollY": "200px",
* "sAjaxSource": "media/dataset/large.txt",
* "sDom": "frtiS",
* "bDeferRender": true,
* "fnInitComplete": function (o) {
* // Find what row number is at 500px
* alert( o.oScroller.fnPixelsToRow( 500 ) );
* }
* } );
* } );
*/
"fnPixelsToRow": function ( iPixels )
{
return parseInt( iPixels / this.s.rowHeight, 10 );
},
/**
* Calculate the row number that will be found at the given pixel position (y-scroll)
* @param {int} iRow Row index to scroll to
* @param {bool} [bAnimate=true] Animate the transision or not
* @returns {void}
* @example
* $(document).ready(function() {
* $('#example').dataTable( {
* "sScrollY": "200px",
* "sAjaxSource": "media/dataset/large.txt",
* "sDom": "frtiS",
* "bDeferRender": true,
* "fnInitComplete": function (o) {
* // Immediately scroll to row 1000
* o.oScroller.fnScrollToRow( 1000 );
* }
* } );
*
* // Sometime later on use the following to scroll to row 500...
* var oSettings = $('#example').dataTable().fnSettings();
* oSettings.oScroller.fnScrollToRow( 500 );
* } );
*/
"fnScrollToRow": function ( iRow, bAnimate )
{
var px = this.fnRowToPixels( iRow );
if ( typeof bAnimate == 'undefined' || bAnimate )
{
$(this.dom.scroller).animate( {
"scrollTop": px
} );
}
else
{
$(this.dom.scroller).scrollTop( px );
}
},
/**
* Calculate and store information about how many rows are to be displayed in the scrolling
* viewport, based on current dimensions in the browser's rendering. This can be particularly
* useful if the table is initially drawn in a hidden element - for example in a tab.
* @param {bool} [bRedraw=true] Redraw the table automatically after the recalculation, with
* the new dimentions forming the basis for the draw.
* @returns {void}
* @example
* $(document).ready(function() {
* // Make the example container hidden to throw off the browser's sizing
* document.getElementById('container').style.display = "none";
* var oTable = $('#example').dataTable( {
* "sScrollY": "200px",
* "sAjaxSource": "media/dataset/large.txt",
* "sDom": "frtiS",
* "bDeferRender": true,
* "fnInitComplete": function (o) {
* // Immediately scroll to row 1000
* o.oScroller.fnScrollToRow( 1000 );
* }
* } );
*
* setTimeout( function () {
* // Make the example container visible and recalculate the scroller sizes
* document.getElementById('container').style.display = "block";
* oTable.fnSettings().oScroller.fnMeasure();
* }, 3000 );
*/
"fnMeasure": function ( bRedraw )
{
if ( this.s.autoHeight )
{
this._fnCalcRowHeight();
}
this.s.viewportHeight = $(this.dom.scroller).height();
this.s.viewportRows = parseInt( this.s.viewportHeight/this.s.rowHeight, 10 )+1;
this.s.dt._iDisplayLength = this.s.viewportRows * 3;
if ( this.s.trace )
{
console.log(
'Row height: '+this.s.rowHeight +' '+
'Viewport height: '+this.s.viewportHeight +' '+
'Viewport rows: '+ this.s.viewportRows +' '+
'Display rows: '+ this.s.dt._iDisplayLength
);
}
if ( typeof bRedraw == 'undefined' || bRedraw )
{
this.s.dt.oInstance.fnDraw();
}
},
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods (they are of course public in JS, but recommended as private)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Initialisation for Scroller
* @returns {void}
* @private
*/
"_fnConstruct": function ()
{
var that = this;
/* Insert a div element that we can use to force the DT scrolling container to
* the height that would be required if the whole table was being displayed
*/
this.dom.force.style.position = "absolute";
this.dom.force.style.top = "0px";
this.dom.force.style.left = "0px";
this.dom.force.style.width = "1px";
//this.dom.force.style.backgroundColor = "blue";
this.dom.scroller = $('div.dataTables_scrollBody', this.s.dt.nTableWrapper)[0];
this.dom.scroller.appendChild( this.dom.force );
this.dom.scroller.style.position = "relative";
this.dom.table = $('>table', this.dom.scroller)[0];
this.dom.table.style.position = "absolute";
this.dom.table.style.top = "0px";
this.dom.table.style.left = "0px";
/* Initial size calculations */
if ( this.s.rowHeight != 'auto' )
{
this.s.rowHeight = false;
}
this.fnMeasure();
/* Scrolling callback to see if a page change is needed */
$(this.dom.scroller).scroll( function () {
that._fnScroll.call( that );
} );
/* Update the scroller when the DataTable is redrawn */
this.s.dt.aoDrawCallback.push( {
"fn": function () {
that._fnDrawCallback.call( that );
},
"sName": "Scroller"
} );
/* Add a state saving parameter to the DT state saving so we can restore the exact
* position of the scrolling
*/
this.s.dt.aoStateSave.push( {
"fn": function (oS, sVal) {
return sVal+',"iScroller":'+that.dom.scroller.scrollTop;
},
"sName": "Scroller_State"
} );
},
/**
* Scrolling function - fired whenever the scrolling position is changed. This method needs
* to use the stored values to see if the table should be redrawn as we are moving towards
* the end of the information that is currently drawn or not. If needed, then it will redraw
* the table based on the new position.
* @returns {void}
* @private
*/
"_fnScroll": function ()
{
var
that = this,
iScrollTop = this.dom.scroller.scrollTop,
iTopRow;
if ( this.s.trace )
{
console.log(
'Scroll: '+iScrollTop+'px - boundaries: '+this.s.redrawTop+' / '+this.s.redrawBottom+'. '+
' Showing rows '+this.fnPixelsToRow(iScrollTop)+
' to '+this.fnPixelsToRow(iScrollTop+$(this.dom.scroller).height())+
' in the viewport, with rows '+this.s.dt._iDisplayStart+
' to '+(this.s.dt._iDisplayEnd)+' rendered by the DataTable'
);
}
/* Update the table's information display for what is now in the viewport */
this._fnInfo();
/* We dont' want to state save on every scroll event - that's heavy handed, so
* use a timeout to update the state saving only when the scrolling has finished
*/
clearTimeout( this.s.stateTO );
this.s.stateTO = setTimeout( function () {
that.s.dt.oApi._fnSaveState( that.s.dt );
}, 250 );
/* Check if the scroll point is outside the trigger boundary which would required
* a DataTables redraw
*/
if ( iScrollTop < this.s.redrawTop || iScrollTop > this.s.redrawBottom )
{
iTopRow = parseInt( iScrollTop / this.s.rowHeight, 10 ) - this.s.viewportRows;
if ( iTopRow < 0 )
{
/* At the start of the table */
iTopRow = 0;
}
else if ( iTopRow + this.s.dt._iDisplayLength > this.s.dt.fnRecordsDisplay() )
{
/* At the end of the table */
iTopRow = this.s.dt.fnRecordsDisplay() - this.s.dt._iDisplayLength;
if ( iTopRow < 0 )
{
iTopRow = 0;
}
}
else if ( iTopRow % 2 !== 0 )
{
/* For the row-striping classes (odd/even) we want only to start on evens
* otherwise the stripes will change between draws and look rubbish
*/
iTopRow++;
}
if ( iTopRow != this.s.dt._iDisplayStart )
{
/* Cache the new table position for quick lookups */
this.s.tableTop = $(this.s.dt.nTable).offset().top;
this.s.tableBottom = $(this.s.dt.nTable).height() + this.s.tableTop;
/* Do the DataTables redraw based on the calculated start point - note that when
* using server-side processing we introduce a small delay to not DoS the server...
*/
if ( this.s.dt.oFeatures.bServerSide ) {
clearTimeout( this.s.drawTO );
this.s.drawTO = setTimeout( function () {
that.s.dt._iDisplayStart = iTopRow;
that.s.dt.oApi._fnCalculateEnd( that.s.dt );
that.s.dt.oApi._fnDraw( that.s.dt );
}, this.s.serverWait );
}
else
{
this.s.dt._iDisplayStart = iTopRow;
this.s.dt.oApi._fnCalculateEnd( this.s.dt );
this.s.dt.oApi._fnDraw( this.s.dt );
}
if ( this.s.trace )
{
console.log( 'Scroll forcing redraw - top DT render row: '+ iTopRow );
}
}
}
},
/**
* Draw callback function which is fired when the DataTable is redrawn. The main function of
* this method is to position the drawn table correctly the scrolling container for the rows
* that is displays as a result of the scrolling position.
* @returns {void}
* @private
*/
"_fnDrawCallback": function ()
{
var
that = this,
iScrollTop = this.dom.scroller.scrollTop;
/* Set the height of the scrolling forcer to be suitable for the number of rows
* in this draw
*/
this.dom.force.style.height = (this.s.rowHeight * this.s.dt.fnRecordsDisplay())+"px";
/* Calculate the position that the top of the table should be at */
var iTableTop = (this.s.rowHeight*this.s.dt._iDisplayStart);
if ( this.s.dt._iDisplayStart === 0 )
{
iTableTop = 0;
}
else if ( this.s.dt._iDisplayStart === this.s.dt.fnRecordsDisplay() - this.s.dt._iDisplayLength )
{
iTableTop = this.s.rowHeight * this.s.dt._iDisplayStart;
}
this.dom.table.style.top = iTableTop+"px";
/* Cache some information for the scroller */
this.s.tableTop = iTableTop;
this.s.tableBottom = $(this.s.dt.nTable).height() + this.s.tableTop;
this.s.redrawTop = iScrollTop - (this.s.viewportHeight/2);
this.s.redrawBottom = this.s.tableBottom - (1.5 * this.s.viewportHeight);
if ( this.s.trace )
{
console.log(
"Table redraw. Table top: "+iTableTop+"px "+
"Table bottom: "+this.s.tableBottom+" "+
"Scroll boundary top: "+this.s.redrawTop+" "+
"Scroll boundary bottom: "+this.s.redrawBottom+" "+
"Rows drawn: "+this.s.dt._iDisplayLength);
}
/* Because of the order of the DT callbacks, the info update will
* take precidence over the one we want here. So a 'thread' break is
* needed
*/
setTimeout( function () {
that._fnInfo.call( that );
}, 0 );
/* Restore the scrolling position that was saved by DataTable's state saving
* Note that this is done on the second draw when data is Ajax sourced, and the
* first draw when DOM soured
*/
if ( this.s.dt.oFeatures.bStateSave && this.s.dt.oLoadedState !== null &&
typeof this.s.dt.oLoadedState.iScroller != 'undefined' )
{
if ( (this.s.dt.sAjaxSource !== null && this.s.dt.iDraw == 2) ||
(this.s.dt.sAjaxSource === null && this.s.dt.iDraw == 1) )
{
setTimeout( function () {
$(that.dom.scroller).scrollTop( that.s.dt.oLoadedState.iScroller );
that.s.redrawTop = that.s.dt.oLoadedState.iScroller - (that.s.viewportHeight/2);
}, 0 );
}
}
},
/**
* Automatic calculation of table row height. This is just a little tricky here as using
* initialisation DataTables has tale the table out of the document, so we need to create
* a new table and insert it into the document, calculate the row height and then whip the
* table out.
* @returns {void}
* @private
*/
"_fnCalcRowHeight": function ()
{
var
nDiv = document.createElement('div'),
nTable = this.s.dt.nTable.cloneNode( false ),
nBody = document.createElement( 'tbody' ),
nTr = document.createElement('tr'),
nTd = document.createElement('td');
nTd.innerHTML = "&nbsp;";
nTr.appendChild( nTd );
nBody.appendChild( nTr );
nTable.appendChild( nBody );
nDiv.className = this.s.dt.oClasses.sScrollBody;
nDiv.appendChild( nTable );
document.body.appendChild( nDiv );
this.s.rowHeight = $(nTr).height();
document.body.removeChild( nDiv );
},
/**
* Update any information elements that are controlled by the DataTable based on the scrolling
* viewport and what rows are visible in it. This function basically acts in the same way as
* _fnUpdateInfo in DataTables, and effectively replaces that function.
* @returns {void}
* @private
*/
"_fnInfo": function ()
{
if ( !this.s.dt.oFeatures.bInfo )
{
return;
}
var
dt = this.s.dt,
iScrollTop = this.dom.scroller.scrollTop,
iStart = this.fnPixelsToRow(iScrollTop)+1,
iMax = dt.fnRecordsTotal(),
iTotal = dt.fnRecordsDisplay(),
iPossibleEnd = this.fnPixelsToRow(iScrollTop+$(this.dom.scroller).height()),
iEnd = iTotal < iPossibleEnd ? iTotal : iPossibleEnd,
sStart = dt.fnFormatNumber( iStart ),
sEnd = dt.fnFormatNumber( iEnd ),
sMax = dt.fnFormatNumber( iMax ),
sTotal = dt.fnFormatNumber( iTotal ),
sOut;
if ( dt.fnRecordsDisplay() === 0 &&
dt.fnRecordsDisplay() == dt.fnRecordsTotal() )
{
/* Empty record set */
sOut = dt.oLanguage.sInfoEmpty+ dt.oLanguage.sInfoPostFix;
}
else if ( dt.fnRecordsDisplay() === 0 )
{
/* Rmpty record set after filtering */
sOut = dt.oLanguage.sInfoEmpty +' '+
dt.oLanguage.sInfoFiltered.replace('_MAX_', sMax)+
dt.oLanguage.sInfoPostFix;
}
else if ( dt.fnRecordsDisplay() == dt.fnRecordsTotal() )
{
/* Normal record set */
sOut = dt.oLanguage.sInfo.
replace('_START_', sStart).
replace('_END_', sEnd).
replace('_TOTAL_', sTotal)+
dt.oLanguage.sInfoPostFix;
}
else
{
/* Record set after filtering */
sOut = dt.oLanguage.sInfo.
replace('_START_', sStart).
replace('_END_', sEnd).
replace('_TOTAL_', sTotal) +' '+
dt.oLanguage.sInfoFiltered.replace('_MAX_',
dt.fnFormatNumber(dt.fnRecordsTotal()))+
dt.oLanguage.sInfoPostFix;
}
var n = dt.aanFeatures.i;
if ( typeof n != 'undefined' )
{
for ( var i=0, iLen=n.length ; i<iLen ; i++ )
{
$(n[i]).html( sOut );
}
}
}
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Statics
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Scroller default settings for initialisation
* @namespace
* @static
*/
Scroller.oDefaults = {
/**
* Indicate if Scroller show show trace information on the console or not. This can be
* useful when debugging Scroller or if just curious as to what it is doing, but should
* be turned off for production.
* @type bool
* @default false
* @static
* @example
* var oTable = $('#example').dataTable( {
* "sScrollY": "200px",
* "sDom": "frtiS",
* "bDeferRender": true
* "oScroller": {
* "trace": true
* }
* } );
*/
"trace": false,
/**
* Scroller will attempt to automatically calculate the height of rows for it's internal
* calculations. However the height that is used can be overridden using this parameter.
* @type int|string
* @default auto
* @static
* @example
* var oTable = $('#example').dataTable( {
* "sScrollY": "200px",
* "sDom": "frtiS",
* "bDeferRender": true
* "oScroller": {
* "rowHeight": 30
* }
* } );
*/
"rowHeight": "auto",
/**
* When using server-side processing, Scroller will wait a small amount of time to allow
* the scrolling to finish before requesting more data from the server. This prevents
* you from DoSing your own server! The wait time can be configured by this parameter.
* @type int
* @default 200
* @static
* @example
* var oTable = $('#example').dataTable( {
* "sScrollY": "200px",
* "sDom": "frtiS",
* "bDeferRender": true
* "oScroller": {
* "serverWait": 100
* }
* } );
*/
"serverWait": 200
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constants
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* Name of this class
* @constant CLASS
* @type String
* @default Scroller
*/
Scroller.prototype.CLASS = "Scroller";
/**
* Scroller version
* @constant Scroller.VERSION
* @type String
* @default See code
* @static
*/
Scroller.VERSION = "1.0.1";
Scroller.prototype.CLASS = Scroller.VERSION;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Initialisation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Register a new feature with DataTables
*/
if ( typeof $.fn.dataTable == "function" &&
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
$.fn.dataTableExt.fnVersionCheck('1.8.0') )
{
$.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) {
var init = (typeof oDTSettings.oInit.oScroller == 'undefined') ?
{} : oDTSettings.oInit.oScroller;
var oScroller = new Scroller( oDTSettings, init );
return oScroller.dom.wrapper;
},
"cFeature": "S",
"sFeature": "Scroller"
} );
}
else
{
alert( "Warning: Scroller requires DataTables 1.8.0 or greater - www.datatables.net/download");
}
})(jQuery, window, document);

View file

@ -0,0 +1,38 @@
/*
* File: Scroller.min.js
* Version: 1.0.1
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD (3 point) style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
/*
GPL v2 or BSD 3 point style
@contact www.sprymedia.co.uk/contact
@copyright Copyright 2011 Allan Jardine, all rights reserved.
This source file is free software, under either the GPL v2 license or a
BSD style license, available at:
http://datatables.net/license_gpl2
http://datatables.net/license_bsd
*/
(function(d,i,h){var g=function(a,c){!this instanceof g?alert("Scroller warning: Scroller must be initialised with the 'new' keyword."):("undefined"==typeof c&&(c={}),this.s=d.extend({dt:a,tableTop:0,tableBottom:0,redrawTop:0,redrawBottom:0,rowHeight:null,autoHeight:!0,viewportHeight:0,viewportRows:0,stateTO:null,drawTO:null},g.oDefaults,c),this.dom={force:h.createElement("div"),scroller:null,table:null},this.s.dt.oScroller=this,this._fnConstruct())};g.prototype={fnRowToPixels:function(a){return a*
this.s.rowHeight},fnPixelsToRow:function(a){return parseInt(a/this.s.rowHeight,10)},fnScrollToRow:function(a,c){var b=this.fnRowToPixels(a);"undefined"==typeof c||c?d(this.dom.scroller).animate({scrollTop:b}):d(this.dom.scroller).scrollTop(b)},fnMeasure:function(a){this.s.autoHeight&&this._fnCalcRowHeight();this.s.viewportHeight=d(this.dom.scroller).height();this.s.viewportRows=parseInt(this.s.viewportHeight/this.s.rowHeight,10)+1;this.s.dt._iDisplayLength=3*this.s.viewportRows;this.s.trace&&console.log("Row height: "+
this.s.rowHeight+" Viewport height: "+this.s.viewportHeight+" Viewport rows: "+this.s.viewportRows+" Display rows: "+this.s.dt._iDisplayLength);("undefined"==typeof a||a)&&this.s.dt.oInstance.fnDraw()},_fnConstruct:function(){var a=this;this.dom.force.style.position="absolute";this.dom.force.style.top="0px";this.dom.force.style.left="0px";this.dom.force.style.width="1px";this.dom.scroller=d("div.dataTables_scrollBody",this.s.dt.nTableWrapper)[0];this.dom.scroller.appendChild(this.dom.force);this.dom.scroller.style.position=
"relative";this.dom.table=d(">table",this.dom.scroller)[0];this.dom.table.style.position="absolute";this.dom.table.style.top="0px";this.dom.table.style.left="0px";if("auto"!=this.s.rowHeight)this.s.rowHeight=!1;this.fnMeasure();d(this.dom.scroller).scroll(function(){a._fnScroll.call(a)});this.s.dt.aoDrawCallback.push({fn:function(){a._fnDrawCallback.call(a)},sName:"Scroller"});this.s.dt.aoStateSave.push({fn:function(c,b){return b+',"iScroller":'+a.dom.scroller.scrollTop},sName:"Scroller_State"})},
_fnScroll:function(){var a=this,c=this.dom.scroller.scrollTop,b;this.s.trace&&console.log("Scroll: "+c+"px - boundaries: "+this.s.redrawTop+" / "+this.s.redrawBottom+". Showing rows "+this.fnPixelsToRow(c)+" to "+this.fnPixelsToRow(c+d(this.dom.scroller).height())+" in the viewport, with rows "+this.s.dt._iDisplayStart+" to "+this.s.dt._iDisplayEnd+" rendered by the DataTable");this._fnInfo();clearTimeout(this.s.stateTO);this.s.stateTO=setTimeout(function(){a.s.dt.oApi._fnSaveState(a.s.dt)},250);
if(c<this.s.redrawTop||c>this.s.redrawBottom)if(b=parseInt(c/this.s.rowHeight,10)-this.s.viewportRows,0>b?b=0:b+this.s.dt._iDisplayLength>this.s.dt.fnRecordsDisplay()?(b=this.s.dt.fnRecordsDisplay()-this.s.dt._iDisplayLength,0>b&&(b=0)):0!==b%2&&b++,b!=this.s.dt._iDisplayStart)this.s.tableTop=d(this.s.dt.nTable).offset().top,this.s.tableBottom=d(this.s.dt.nTable).height()+this.s.tableTop,this.s.dt.oFeatures.bServerSide?(clearTimeout(this.s.drawTO),this.s.drawTO=setTimeout(function(){a.s.dt._iDisplayStart=
b;a.s.dt.oApi._fnCalculateEnd(a.s.dt);a.s.dt.oApi._fnDraw(a.s.dt)},this.s.serverWait)):(this.s.dt._iDisplayStart=b,this.s.dt.oApi._fnCalculateEnd(this.s.dt),this.s.dt.oApi._fnDraw(this.s.dt)),this.s.trace&&console.log("Scroll forcing redraw - top DT render row: "+b)},_fnDrawCallback:function(){var a=this,c=this.dom.scroller.scrollTop;this.dom.force.style.height=this.s.rowHeight*this.s.dt.fnRecordsDisplay()+"px";var b=this.s.rowHeight*this.s.dt._iDisplayStart;0===this.s.dt._iDisplayStart?b=0:this.s.dt._iDisplayStart===
this.s.dt.fnRecordsDisplay()-this.s.dt._iDisplayLength&&(b=this.s.rowHeight*this.s.dt._iDisplayStart);this.dom.table.style.top=b+"px";this.s.tableTop=b;this.s.tableBottom=d(this.s.dt.nTable).height()+this.s.tableTop;this.s.redrawTop=c-this.s.viewportHeight/2;this.s.redrawBottom=this.s.tableBottom-1.5*this.s.viewportHeight;this.s.trace&&console.log("Table redraw. Table top: "+b+"px Table bottom: "+this.s.tableBottom+" Scroll boundary top: "+this.s.redrawTop+" Scroll boundary bottom: "+this.s.redrawBottom+
" Rows drawn: "+this.s.dt._iDisplayLength);setTimeout(function(){a._fnInfo.call(a)},0);this.s.dt.oFeatures.bStateSave&&null!==this.s.dt.oLoadedState&&"undefined"!=typeof this.s.dt.oLoadedState.iScroller&&(null!==this.s.dt.sAjaxSource&&2==this.s.dt.iDraw||null===this.s.dt.sAjaxSource&&1==this.s.dt.iDraw)&&setTimeout(function(){d(a.dom.scroller).scrollTop(a.s.dt.oLoadedState.iScroller);a.s.redrawTop=a.s.dt.oLoadedState.iScroller-a.s.viewportHeight/2},0)},_fnCalcRowHeight:function(){var a=h.createElement("div"),
c=this.s.dt.nTable.cloneNode(!1),b=h.createElement("tbody"),e=h.createElement("tr"),f=h.createElement("td");f.innerHTML="&nbsp;";e.appendChild(f);b.appendChild(e);c.appendChild(b);a.className=this.s.dt.oClasses.sScrollBody;a.appendChild(c);h.body.appendChild(a);this.s.rowHeight=d(e).height();h.body.removeChild(a)},_fnInfo:function(){if(this.s.dt.oFeatures.bInfo){var a=this.s.dt,c=this.dom.scroller.scrollTop,b=this.fnPixelsToRow(c)+1,e=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),c=this.fnPixelsToRow(c+
d(this.dom.scroller).height()),c=f<c?f:c,b=a.fnFormatNumber(b),c=a.fnFormatNumber(c),e=a.fnFormatNumber(e),f=a.fnFormatNumber(f),f=0===a.fnRecordsDisplay()&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:0===a.fnRecordsDisplay()?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",e)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",b).replace("_END_",c).replace("_TOTAL_",f)+a.oLanguage.sInfoPostFix:
a.oLanguage.sInfo.replace("_START_",b).replace("_END_",c).replace("_TOTAL_",f)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix,a=a.aanFeatures.i;if("undefined"!=typeof a){e=0;for(b=a.length;e<b;e++)d(a[e]).html(f)}}}};g.oDefaults={trace:!1,rowHeight:"auto",serverWait:200};g.prototype.CLASS="Scroller";g.VERSION="1.0.1";g.prototype.CLASS=g.VERSION;"function"==typeof d.fn.dataTable&&"function"==typeof d.fn.dataTableExt.fnVersionCheck&&d.fn.dataTableExt.fnVersionCheck("1.8.0")?
d.fn.dataTableExt.aoFeatures.push({fnInit:function(a){return(new g(a,"undefined"==typeof a.oInit.oScroller?{}:a.oInit.oScroller)).dom.wrapper},cFeature:"S",sFeature:"Scroller"}):alert("Warning: Scroller requires DataTables 1.8.0 or greater - www.datatables.net/download")})(jQuery,window,document);

View file

@ -0,0 +1,81 @@
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(a){"string"==typeof a&&(a=document.getElementById(a));if(!a.addClass)a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a);this.className+=" "+a},a.removeClass=function(a){this.className=this.className.replace(RegExp("\\s*"+a+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")},a.hasClass=function(a){return!!this.className.match(RegExp("\\s*"+
a+"\\s*"))};return a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){(a=this.clients[a])&&a.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a){var b={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};if(""!=a.style.width)b.width=a.style.width.replace("px","");if(""!=a.style.height)b.height=a.style.height.replace("px","");for(;a;)b.left+=a.offsetLeft,b.top+=a.offsetTop,a=a.offsetParent;return b},
Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);a&&this.glue(a)}};
ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:!0,cssEffects:!0,handlers:null,sized:!1,glue:function(a,b){this.domElement=ZeroClipboard.$(a);var c=99;this.domElement.style.zIndex&&(c=parseInt(this.domElement.style.zIndex)+1);var d=ZeroClipboard.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var e=this.div.style;e.position="absolute";e.left=this.domElement.offsetLeft+"px";e.top=this.domElement.offsetTop+
"px";e.width=d.width+"px";e.height=d.height+"px";e.zIndex=c;if("undefined"!=typeof b&&""!=b)this.div.title=b;if(0!=d.width&&0!=d.height)this.sized=!0;this.domElement.parentNode.appendChild(this.div);this.div.innerHTML=this.getHTML(d.width,d.height)},positionElement:function(){var a=ZeroClipboard.getDOMObjectPosition(this.domElement),b=this.div.style;b.position="absolute";b.left=this.domElement.offsetLeft+"px";b.top=this.domElement.offsetTop+"px";b.width=a.width+"px";b.height=a.height+"px";if(0!=a.width&&
0!=a.height)this.sized=!0,b=this.div.childNodes[0],b.width=a.width,b.height=a.height},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/))var e=location.href.match(/^https/i)?"https://":"http://",c=c+('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+a+'" height="'+b+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+
ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+d+'"/><param name="wmode" value="transparent"/></object>');else c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+a+'" height="'+b+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+
d+'" wmode="transparent" />';return c},hide:function(){if(this.div)this.div.style.left="-2000px"},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.div=this.domElement=null}},reposition:function(a){if(a)(this.domElement=ZeroClipboard.$(a))||this.hide();if(this.domElement&&this.div){var a=ZeroClipboard.getDOMObjectPosition(this.domElement),b=
this.div.style;b.left=""+a.left+"px";b.top=""+a.top+"px"}},clearText:function(){this.clipText="";this.ready&&this.movie.clearText()},appendText:function(a){this.clipText+=a;this.ready&&this.movie.appendText(a)},setText:function(a){this.clipText=a;this.ready&&this.movie.setText(a)},setCharSet:function(a){this.charSet=a;this.ready&&this.movie.setCharSet(a)},setBomInc:function(a){this.incBom=a;this.ready&&this.movie.setBomInc(a)},setFileName:function(a){this.fileName=a;this.ready&&this.movie.setFileName(a)},
setAction:function(a){this.action=a;this.ready&&this.movie.setAction(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");this.handlers[a]||(this.handlers[a]=[]);this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a;this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");switch(a){case "load":this.movie=document.getElementById(this.movieId);
if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setCharSet(this.charSet);this.movie.setBomInc(this.incBom);this.movie.setHandCursor(this.handCursorEnabled);
break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&this.domElement.addClass("active");break;case "mouseout":if(this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")))this.domElement.removeClass("active"),this.recoverActive=!0;break;case "mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case "mouseup":if(this.domElement&&this.cssEffects)this.domElement.removeClass("active"),this.recoverActive=!1}if(this.handlers[a])for(var d=
0,e=this.handlers[a].length;d<e;d++){var f=this.handlers[a][d];if("function"==typeof f)f(this,b);else if("object"==typeof f&&2==f.length)f[0][f[1]](this,b);else if("string"==typeof f)window[f](this,b)}}};
/*
* File: TableTools.min.js
* Version: 2.0.2
* Author: Allan Jardine (www.sprymedia.co.uk)
*
* Copyright 2009-2011 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD (3 point) style license, as supplied with this software.
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
var TableTools;
(function(e,n,h){TableTools=function(a,b){(!this.CLASS||"TableTools"!=this.CLASS)&&alert("Warning: TableTools must be initialised with the keyword 'new'");this.s={that:this,dt:null,print:{saveStart:-1,saveLength:-1,saveScroll:-1,funcEnd:function(){}},buttonCounter:0,select:{type:"",selected:[],preRowSelect:null,postSelected:null,postDeselected:null,all:!1,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:!1};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null,
background:null}};this.fnSettings=function(){return this.s};"undefined"==typeof b&&(b={});this.s.dt=a.fnSettings();this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(){return this._fnGetMasterSettings().select.selected},fnGetSelectedData:function(){for(var a=this._fnGetMasterSettings().select.selected,b=[],c=0,d=a.length;c<d;c++)b.push(this.s.dt.oInstance.fnGetData(a[c]));return b},fnIsSelected:function(a){for(var b=this.fnGetSelected(),c=0,d=b.length;c<d;c++)if(a==b[c])return!0;
return!1},fnSelectAll:function(){this._fnGetMasterSettings().that._fnRowSelectAll()},fnSelectNone:function(){this._fnGetMasterSettings().that._fnRowDeselectAll()},fnSelect:function(a){this.fnIsSelected(a)||("single"==this.s.select.type?this._fnRowSelectSingle(a):"multi"==this.s.select.type&&this._fnRowSelectMulti(a))},fnDeselect:function(a){this.fnIsSelected(a)&&("single"==this.s.select.type?this._fnRowSelectSingle(a):"multi"==this.s.select.type&&this._fnRowSelectMulti(a))},fnGetTitle:function(a){var b=
"";if("undefined"!=typeof a.sTitle&&""!==a.sTitle)b=a.sTitle;else if(a=h.getElementsByTagName("title"),0<a.length)b=a[0].innerHTML;return 4>"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns,a=this._fnColumnTargets(a.mColumns),c=[],d=0,e=0,f,g;for(f=0,g=a.length;f<g;f++)if(a[f])d=b[f].nTh.offsetWidth,e+=d,c.push(d);for(f=0,g=c.length;f<g;f++)c[f]/=e;return c.join("\t")},
fnGetTableData:function(a){if(this.s.dt)return this._fnGetDataTablesData(a)},fnSetText:function(a,b){this._fnFlashSetText(a,b)},fnResizeButtons:function(){for(var a in ZeroClipboard.clients)if(a){var b=ZeroClipboard.clients[a];"undefined"!=typeof b.domElement&&b.domElement.parentNode==this.dom.container&&b.positionElement()}},fnResizeRequired:function(){for(var a in ZeroClipboard.clients)if(a){var b=ZeroClipboard.clients[a];if("undefined"!=typeof b.domElement&&b.domElement.parentNode==this.dom.container&&
!1===b.sized)return!0}return!1},_fnConstruct:function(a){var b=this;this._fnCustomiseSettings(a);this.dom.container=h.createElement("div");this.dom.container.className=!this.s.dt.bJUI?"DTTT_container":"DTTT_container ui-buttonset ui-buttonset-multi";"none"!=this.s.select.type&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container);this.s.dt.aoDestroyCallback.push({sName:"TableTools",fn:function(){b.dom.container.innerHTML=""}})},_fnCustomiseSettings:function(a){if("undefined"==
typeof this.s.dt._TableToolsInit)this.s.master=!0,this.s.dt._TableToolsInit=!0;this.dom.table=this.s.dt.nTable;this.s.custom=e.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;if("undefined"!=typeof ZeroClipboard)ZeroClipboard.moviePath=this.s.swfPath;this.s.select.type=this.s.custom.sRowSelect;this.s.select.preRowSelect=this.s.custom.fnPreRowSelect;this.s.select.postSelected=this.s.custom.fnRowSelected;this.s.select.postDeselected=this.s.custom.fnRowDeselected;this.s.select.selectedClass=
this.s.custom.sSelectedClass;this.s.buttonSet=this.s.custom.aButtons},_fnButtonDefinations:function(a,b){for(var c,d=0,j=a.length;d<j;d++){if("string"==typeof a[d]){if("undefined"==typeof TableTools.BUTTONS[a[d]]){alert("TableTools: Warning - unknown button type: "+a[d]);continue}c=e.extend({},TableTools.BUTTONS[a[d]],!0)}else{if("undefined"==typeof TableTools.BUTTONS[a[d].sExtends]){alert("TableTools: Warning - unknown button type: "+a[d].sExtends);continue}c=e.extend({},TableTools.BUTTONS[a[d].sExtends],
!0);c=e.extend(c,a[d],!0)}this.s.dt.bJUI&&(c.sButtonClass+=" ui-button ui-state-default",c.sButtonClassHover+=" ui-state-hover");b.appendChild(this._fnCreateButton(c))}},_fnCreateButton:function(a){var b="div"==a.sAction?this._fnDivBase(a):this._fnButtonBase(a);"print"==a.sAction?this._fnPrintConfig(b,a):a.sAction.match(/flash/)?this._fnFlashConfig(b,a):"text"==a.sAction?this._fnTextConfig(b,a):"div"==a.sAction?this._fnTextConfig(b,a):"collection"==a.sAction&&(this._fnTextConfig(b,a),this._fnCollectionConfig(b,
a));return b},_fnButtonBase:function(a){var b=h.createElement("button"),c=h.createElement("span"),d=this._fnGetMasterSettings();b.className="DTTT_button "+a.sButtonClass;b.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+d.buttonCounter);b.appendChild(c);c.innerHTML=a.sButtonText;d.buttonCounter++;return b},_fnDivBase:function(a){var b=h.createElement("div"),c=this._fnGetMasterSettings();b.className=a.sButtonClass;b.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+c.buttonCounter);b.innerHTML=
a.sButtonText;null!==a.nContent&&b.appendChild(a.nContent);c.buttonCounter++;return b},_fnGetMasterSettings:function(){if(this.s.master)return this.s;for(var a=TableTools._aInstances,b=0,c=a.length;b<c;b++)if(this.dom.table==a[b].s.dt.nTable)return a[b].s},_fnCollectionConfig:function(a,b){var c=h.createElement("div");c.style.display="none";c.className=!this.s.dt.bJUI?"DTTT_collection":"DTTT_collection ui-buttonset ui-buttonset-multi";b._collection=c;this._fnButtonDefinations(b.aButtons,c)},_fnCollectionShow:function(a,
b){var c=this,d=e(a).offset(),j=b._collection,f=d.left,d=d.top+e(a).outerHeight(),g=e(n).height(),l=e(h).height(),m=e(n).width(),o=e(h).width();j.style.position="absolute";j.style.left=f+"px";j.style.top=d+"px";j.style.display="block";e(j).css("opacity",0);var k=h.createElement("div");k.style.position="absolute";k.style.left="0px";k.style.top="0px";k.style.height=(g>l?g:l)+"px";k.style.width=(m>o?m:o)+"px";k.className="DTTT_collection_background";e(k).css("opacity",0);h.body.appendChild(k);h.body.appendChild(j);
g=e(j).outerWidth();m=e(j).outerHeight();if(f+g>o)j.style.left=o-g+"px";if(d+m>l)j.style.top=d-m-e(a).outerHeight()+"px";this.dom.collection.collection=j;this.dom.collection.background=k;setTimeout(function(){e(j).animate({opacity:1},500);e(k).animate({opacity:0.25},500)},10);e(k).click(function(){c._fnCollectionHide.call(c,null,null)})},_fnCollectionHide:function(a,b){if(!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection)e(this.dom.collection.collection).animate({opacity:0},
500,function(){this.style.display="none"}),e(this.dom.collection.background).animate({opacity:0},500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null},_fnRowSelectConfig:function(){if(this.s.master){var a=this;e(a.s.dt.nTable).addClass("DTTT_selectable");e("tr",a.s.dt.nTBody).live("click",function(b){if(this.parentNode==a.s.dt.nTBody){var c=a.s.dt.oInstance.fnGetNodes();-1===e.inArray(this,c)||null!==a.s.select.preRowSelect&&!a.s.select.preRowSelect.call(a,
b)||("single"==a.s.select.type?a._fnRowSelectSingle.call(a,this):a._fnRowSelectMulti.call(a,this))}});a.s.dt.aoDrawCallback.push({fn:function(){a.s.select.all&&a.s.dt.oFeatures.bServerSide&&a.fnSelectAll()},sName:"TableTools_select"})}},_fnRowSelectSingle:function(a){this.s.master&&!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)&&(e(a).hasClass(this.s.select.selectedClass)?this._fnRowDeselect(a):(0!==this.s.select.selected.length&&this._fnRowDeselectAll(),this.s.select.selected.push(a),e(a).addClass(this.s.select.selectedClass),
null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,a)),TableTools._fnEventDispatch(this,"select",a))},_fnRowSelectMulti:function(a){this.s.master&&!e("td",a).hasClass(this.s.dt.oClasses.sRowEmpty)&&(e(a).hasClass(this.s.select.selectedClass)?this._fnRowDeselect(a):(this.s.select.selected.push(a),e(a).addClass(this.s.select.selectedClass),null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,a)),TableTools._fnEventDispatch(this,"select",a))},_fnRowSelectAll:function(){if(this.s.master){for(var a,
b=0,c=this.s.dt.aiDisplayMaster.length;b<c;b++)a=this.s.dt.aoData[this.s.dt.aiDisplayMaster[b]].nTr,e(a).hasClass(this.s.select.selectedClass)||(this.s.select.selected.push(a),e(a).addClass(this.s.select.selectedClass));null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,null);this.s.select.all=!0;TableTools._fnEventDispatch(this,"select",null)}},_fnRowDeselectAll:function(){if(this.s.master){for(var a=this.s.select.selected.length-1;0<=a;a--)this._fnRowDeselect(a,!1);null!==this.s.select.postDeselected&&
this.s.select.postDeselected.call(this,null);this.s.select.all=!1;TableTools._fnEventDispatch(this,"select",null)}},_fnRowDeselect:function(a,b){"undefined"!=typeof a.nodeName&&(a=e.inArray(a,this.s.select.selected));var c=this.s.select.selected[a];e(c).removeClass(this.s.select.selectedClass);this.s.select.selected.splice(a,1);("undefined"==typeof b||b)&&null!==this.s.select.postDeselected&&this.s.select.postDeselected.call(this,c);this.s.select.all=!1},_fnTextConfig:function(a,b){var c=this;null!==
b.fnInit&&b.fnInit.call(this,a,b);if(""!==b.sToolTip)a.title=b.sToolTip;e(a).hover(function(){e(a).addClass(b.sButtonClassHover);null!==b.fnMouseover&&b.fnMouseover.call(this,a,b,null)},function(){e(a).removeClass(b.sButtonClassHover);null!==b.fnMouseout&&b.fnMouseout.call(this,a,b,null)});null!==b.fnSelect&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){d.preventDefault();null!==b.fnClick&&b.fnClick.call(c,a,b,null);null!==b.fnComplete&&b.fnComplete.call(c,
a,b,null,null);c._fnCollectionHide(a,b)})},_fnFlashConfig:function(a,b){var c=this,d=new ZeroClipboard.Client;null!==b.fnInit&&b.fnInit.call(this,a,b);d.setHandCursor(!0);"flash_save"==b.sAction?(d.setAction("save"),d.setCharSet("utf16le"==b.sCharSet?"UTF16LE":"UTF8"),d.setBomInc(b.bBomInc),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):"flash_pdf"==b.sAction?(d.setAction("pdf"),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):d.setAction("copy");d.addEventListener("mouseOver",
function(){e(a).addClass(b.sButtonClassHover);null!==b.fnMouseover&&b.fnMouseover.call(c,a,b,d)});d.addEventListener("mouseOut",function(){e(a).removeClass(b.sButtonClassHover);null!==b.fnMouseout&&b.fnMouseout.call(c,a,b,d)});d.addEventListener("mouseDown",function(){null!==b.fnClick&&b.fnClick.call(c,a,b,d)});d.addEventListener("complete",function(e,f){null!==b.fnComplete&&b.fnComplete.call(c,a,b,d,f);c._fnCollectionHide(a,b)});this._fnFlashGlue(d,a,b.sToolTip)},_fnFlashGlue:function(a,b,c){var d=
this,e=b.getAttribute("id");if(h.getElementById(e)){if(a.glue(b,c),a.domElement.parentNode!=a.div.parentNode&&"undefined"==typeof d.__bZCWarning)d.s.dt.oApi._fnLog(this.s.dt,0,"It looks like you are using the version of ZeroClipboard which came with TableTools 1. Please update to use the version that came with TableTools 2."),d.__bZCWarning=!0}else setTimeout(function(){d._fnFlashGlue(a,b,c)},100)},_fnFlashSetText:function(a,b){var c=this._fnChunkData(b,8192);a.clearText();for(var d=0,e=c.length;d<
e;d++)a.appendText(c[d])},_fnColumnTargets:function(a){var b=[],c=this.s.dt;if("object"==typeof a){for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(!1);for(i=0,iLen=a.length;i<iLen;i++)b[a[i]]=!0}else if("visible"==a)for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!0:!1);else if("hidden"==a)for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!1:!0);else if("sortable"==a)for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bSortable?!0:!1);
else for(i=0,iLen=c.aoColumns.length;i<iLen;i++)b.push(!0);return b},_fnNewline:function(a){return"auto"==a.sNewLine?navigator.userAgent.match(/Windows/)?"\r\n":"\n":a.sNewLine},_fnGetDataTablesData:function(a){var b,c,d,j,f="",g="",h=this.s.dt,m=RegExp(a.sFieldBoundary,"g"),o=this._fnColumnTargets(a.mColumns),k=this._fnNewline(a),n="undefined"!=typeof a.bSelectedOnly?a.bSelectedOnly:!1;if(a.bHeader){for(b=0,c=h.aoColumns.length;b<c;b++)o[b]&&(g=h.aoColumns[b].sTitle.replace(/\n/g," ").replace(/<.*?>/g,
"").replace(/^\s+|\s+$/g,""),g=this._fnHtmlDecode(g),f+=this._fnBoundData(g,a.sFieldBoundary,m)+a.sFieldSeperator);f=f.slice(0,-1*a.sFieldSeperator.length);f+=k}for(d=0,j=h.aiDisplay.length;d<j;d++)if("none"==this.s.select.type||n&&e(h.aoData[h.aiDisplay[d]].nTr).hasClass(this.s.select.selectedClass)||n&&0==this.s.select.selected.length){for(b=0,c=h.aoColumns.length;b<c;b++)o[b]&&(g=h.oApi._fnGetCellData(h,h.aiDisplay[d],b,"display"),a.fnCellRender?g=a.fnCellRender(g,b)+"":"string"==typeof g?(g=g.replace(/\n/g,
" "),g=g.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi,"$1$2$3"),g=g.replace(/<.*?>/g,"")):g+="",g=g.replace(/^\s+/,"").replace(/\s+$/,""),g=this._fnHtmlDecode(g),f+=this._fnBoundData(g,a.sFieldBoundary,m)+a.sFieldSeperator);f=f.slice(0,-1*a.sFieldSeperator.length);f+=k}f.slice(0,-1);if(a.bFooter){for(b=0,c=h.aoColumns.length;b<c;b++)o[b]&&null!==h.aoColumns[b].nTf&&(g=h.aoColumns[b].nTf.innerHTML.replace(/\n/g," ").replace(/<.*?>/g,""),g=this._fnHtmlDecode(g),f+=this._fnBoundData(g,
a.sFieldBoundary,m)+a.sFieldSeperator);f=f.slice(0,-1*a.sFieldSeperator.length)}return _sLastData=f},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,e=0;e<d;e+=b)e+b<d?c.push(a.substring(e,e+b)):c.push(a.substring(e,d));return c},_fnHtmlDecode:function(a){if(-1==a.indexOf("&"))return a;var a=this._fnChunkData(a,2048),b=h.createElement("div"),c,d,e,f="";for(c=0,d=a.length;c<d;c++)e=a[c].lastIndexOf("&"),-1!=e&&8<=a[c].length&&e>a[c].length-
8&&(a[c].substr(e),a[c]=a[c].substr(0,e)),b.innerHTML=a[c],f+=b.childNodes[0].nodeValue;return f},_fnPrintConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);if(""!==b.sToolTip)a.title=b.sToolTip;e(a).hover(function(){e(a).addClass(b.sButtonClassHover)},function(){e(a).removeClass(b.sButtonClassHover)});null!==b.fnSelect&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){d.preventDefault();c._fnPrintStart.call(c,d,b);null!==
b.fnClick&&b.fnClick.call(c,a,b,null);null!==b.fnComplete&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnPrintStart:function(a,b){var c=this,d=this.s.dt;this._fnPrintHideNodes(d.nTable);this.s.print.saveStart=d._iDisplayStart;this.s.print.saveLength=d._iDisplayLength;if(b.bShowAll)d._iDisplayStart=0,d._iDisplayLength=-1,d.oApi._fnCalculateEnd(d),d.oApi._fnDraw(d);(""!==d.oScroll.sX||""!==d.oScroll.sY)&&this._fnPrintScrollStart(d);var d=d.aanFeatures,j;for(j in d)if("i"!=j&&"t"!=
j&&1==j.length)for(var f=0,g=d[j].length;f<g;f++)this.dom.print.hidden.push({node:d[j][f],display:"block"}),d[j][f].style.display="none";e(h.body).addClass("DTTT_Print");if(""!==b.sInfo){var l=h.createElement("div");l.className="DTTT_print_info";l.innerHTML=b.sInfo;h.body.appendChild(l);setTimeout(function(){e(l).fadeOut("normal",function(){h.body.removeChild(l)})},2E3)}if(""!==b.sMessage)this.dom.print.message=h.createElement("div"),this.dom.print.message.className="DTTT_PrintMessage",this.dom.print.message.innerHTML=
b.sMessage,h.body.insertBefore(this.dom.print.message,h.body.childNodes[0]);this.s.print.saveScroll=e(n).scrollTop();n.scrollTo(0,0);this.s.print.funcEnd=function(a){c._fnPrintEnd.call(c,a)};e(h).bind("keydown",null,this.s.print.funcEnd)},_fnPrintEnd:function(a){if(27==a.keyCode){a.preventDefault();var a=this.s.dt,b=this.s.print,c=this.dom.print;this._fnPrintShowNodes();(""!==a.oScroll.sX||""!==a.oScroll.sY)&&this._fnPrintScrollEnd();n.scrollTo(0,b.saveScroll);if(null!==c.message)h.body.removeChild(c.message),
c.message=null;e(h.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength=b.saveLength;a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);e(h).unbind("keydown",this.s.print.funcEnd);this.s.print.funcEnd=null}},_fnPrintScrollStart:function(){var a=this.s.dt;a.nScrollHead.getElementsByTagName("div")[0].getElementsByTagName("table");var b=a.nTable.parentNode,c=a.nTable.getElementsByTagName("thead");0<c.length&&a.nTable.removeChild(c[0]);null!==a.nTFoot&&(c=a.nTable.getElementsByTagName("tfoot"),
0<c.length&&a.nTable.removeChild(c[0]));c=a.nTHead.cloneNode(!0);a.nTable.insertBefore(c,a.nTable.childNodes[0]);null!==a.nTFoot&&(c=a.nTFoot.cloneNode(!0),a.nTable.insertBefore(c,a.nTable.childNodes[1]));if(""!==a.oScroll.sX)a.nTable.style.width=e(a.nTable).outerWidth()+"px",b.style.width=e(a.nTable).outerWidth()+"px",b.style.overflow="visible";if(""!==a.oScroll.sY)b.style.height=e(a.nTable).outerHeight()+"px",b.style.overflow="visible"},_fnPrintScrollEnd:function(){var a=this.s.dt,b=a.nTable.parentNode;
if(""!==a.oScroll.sX)b.style.width=a.oApi._fnStringToCss(a.oScroll.sX),b.style.overflow="auto";if(""!==a.oScroll.sY)b.style.height=a.oApi._fnStringToCss(a.oScroll.sY),b.style.overflow="auto"},_fnPrintShowNodes:function(){for(var a=this.dom.print.hidden,b=0,c=a.length;b<c;b++)a[b].node.style.display=a[b].display;a.splice(0,a.length)},_fnPrintHideNodes:function(a){for(var b=this.dom.print.hidden,c=a.parentNode,d=c.childNodes,j=0,f=d.length;j<f;j++)if(d[j]!=a&&1==d[j].nodeType){var g=e(d[j]).css("display");
if("none"!=g)b.push({node:d[j],display:g}),d[j].style.display="none"}"BODY"!=c.nodeName&&this._fnPrintHideNodes(c)}};TableTools._aInstances=[];TableTools._aListeners=[];TableTools.fnGetMasters=function(){for(var a=[],b=0,c=TableTools._aInstances.length;b<c;b++)TableTools._aInstances[b].s.master&&a.push(TableTools._aInstances[b]);return a};TableTools.fnGetInstance=function(a){"object"!=typeof a&&(a=h.getElementById(a));for(var b=0,c=TableTools._aInstances.length;b<c;b++)if(TableTools._aInstances[b].s.master&&
TableTools._aInstances[b].dom.table==a)return TableTools._aInstances[b];return null};TableTools._fnEventListen=function(a,b,c){TableTools._aListeners.push({that:a,type:b,fn:c})};TableTools._fnEventDispatch=function(a,b,c){for(var d=TableTools._aListeners,e=0,f=d.length;e<f;e++)a.dom.table==d[e].that.dom.table&&d[e].type==b&&d[e].fn(c)};TableTools.BUTTONS={csv:{sAction:"flash_save",sCharSet:"utf8",bBomInc:!1,sFileName:"*.csv",sFieldBoundary:'"',sFieldSeperator:",",sNewLine:"auto",sTitle:"",sToolTip:"",
sButtonClass:"DTTT_button_csv",sButtonClassHover:"DTTT_button_csv_hover",sButtonText:"CSV",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},xls:{sAction:"flash_save",sCharSet:"utf16le",bBomInc:!0,sFileName:"*.csv",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"auto",sTitle:"",sToolTip:"",sButtonClass:"DTTT_button_xls",sButtonClassHover:"DTTT_button_xls_hover",
sButtonText:"Excel",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},copy:{sAction:"flash_copy",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"auto",sToolTip:"",sButtonClass:"DTTT_button_copy",sButtonClassHover:"DTTT_button_copy_hover",sButtonText:"Copy",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,
fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnSelect:null,fnComplete:function(a,b,c,d){a=d.split("\n").length;a=null===this.s.dt.nTFoot?a-1:a-2;alert("Copied "+a+" row"+(1==a?"":"s")+" to the clipboard")},fnInit:null,fnCellRender:null},pdf:{sAction:"flash_pdf",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"\n",sFileName:"*.pdf",sToolTip:"",sTitle:"",sButtonClass:"DTTT_button_pdf",sButtonClassHover:"DTTT_button_pdf_hover",sButtonText:"PDF",mColumns:"all",bHeader:!0,bFooter:!1,
bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+"\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},print:{sAction:"print",sInfo:"<h6>Print view</h6><p>Please use your browser's print function to print this table. Press escape when finished.",
sMessage:"",bShowAll:!0,sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonClassHover:"DTTT_button_print_hover",sButtonText:"Print",fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null},text:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Text button",mColumns:"all",bHeader:!0,bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,
fnComplete:null,fnInit:null,fnCellRender:null},select:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select button",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},select_single:{sAction:"text",
sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Select button",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},select_all:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",
sButtonText:"Select all",mColumns:"all",bHeader:!0,bFooter:!0,fnMouseover:null,fnMouseout:null,fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==this.s.dt.fnRecordsDisplay()?e(a).addClass("DTTT_disabled"):e(a).removeClass("DTTT_disabled")},fnComplete:null,fnInit:null,fnCellRender:null},select_none:{sAction:"text",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Deselect all",mColumns:"all",bHeader:!0,bFooter:!0,
fnMouseover:null,fnMouseout:null,fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass("DTTT_disabled"):e(a).addClass("DTTT_disabled")},fnComplete:null,fnInit:function(a){e(a).addClass("DTTT_disabled")},fnCellRender:null},ajax:{sAction:"text",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"\n",sAjaxUrl:"/xhr.php",sToolTip:"",sButtonClass:"DTTT_button_text",sButtonClassHover:"DTTT_button_text_hover",sButtonText:"Ajax button",mColumns:"all",bHeader:!0,
bFooter:!0,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:function(a,b){var c=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete,dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnSelect:null,fnComplete:null,fnInit:null,fnAjaxComplete:function(){alert("Ajax complete")},fnCellRender:null},div:{sAction:"div",sToolTip:"",sButtonClass:"DTTT_nonbutton",sButtonClassHover:"",
sButtonText:"Text button",fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,nContent:null,fnCellRender:null},collection:{sAction:"collection",sToolTip:"",sButtonClass:"DTTT_button_collection",sButtonClassHover:"DTTT_button_collection_hover",sButtonText:"Collection",fnMouseover:null,fnMouseout:null,fnClick:function(a,b){this._fnCollectionShow(a,b)},fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_cvs_xls_pdf.swf",
sRowSelect:"none",sSelectedClass:"DTTT_selected",fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"]};TableTools.prototype.CLASS="TableTools";TableTools.VERSION="2.0.2";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.8.2")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a=new TableTools(a.oInstance,"undefined"!=typeof a.oInit.oTableTools?
a.oInit.oTableTools:{});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.8.2 or newer - www.datatables.net/download")})(jQuery,window,document);

View file

@ -0,0 +1,367 @@
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard = {
version: "1.0.4-TableTools2",
clients: {}, // registered upload clients on page, indexed by id
moviePath: '', // URL to movie
nextId: 1, // ID of next movie
$: function(thingy) {
// simple DOM lookup utility function
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
if (!thingy.addClass) {
// extend element with a few useful methods
thingy.hide = function() { this.style.display = 'none'; };
thingy.show = function() { this.style.display = ''; };
thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
thingy.removeClass = function(name) {
this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, '');
};
thingy.hasClass = function(name) {
return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
}
}
return thingy;
},
setMoviePath: function(path) {
// set path to ZeroClipboard.swf
this.moviePath = path;
},
dispatch: function(id, eventName, args) {
// receive event from flash movie, send to client
var client = this.clients[id];
if (client) {
client.receiveEvent(eventName, args);
}
},
register: function(id, client) {
// register new client to receive events
this.clients[id] = client;
},
getDOMObjectPosition: function(obj) {
// get absolute coordinates for dom element
var info = {
left: 0,
top: 0,
width: obj.width ? obj.width : obj.offsetWidth,
height: obj.height ? obj.height : obj.offsetHeight
};
if ( obj.style.width != "" )
info.width = obj.style.width.replace("px","");
if ( obj.style.height != "" )
info.height = obj.style.height.replace("px","");
while (obj) {
info.left += obj.offsetLeft;
info.top += obj.offsetTop;
obj = obj.offsetParent;
}
return info;
},
Client: function(elem) {
// constructor for new simple upload client
this.handlers = {};
// unique ID
this.id = ZeroClipboard.nextId++;
this.movieId = 'ZeroClipboardMovie_' + this.id;
// register client with singleton to receive flash events
ZeroClipboard.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
ZeroClipboard.Client.prototype = {
id: 0, // unique ID for us
ready: false, // whether movie is ready to receive events or not
movie: null, // reference to movie object
clipText: '', // text to copy to clipboard
fileName: '', // default file save name
action: 'copy', // action to perform
handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
cssEffects: true, // enable CSS mouse effects on dom container
handlers: null, // user event handlers
sized: false,
glue: function(elem, title) {
// glue to DOM element
// elem can be ID or actual DOM element object
this.domElement = ZeroClipboard.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
if (this.domElement.style.zIndex) {
zIndex = parseInt(this.domElement.style.zIndex) + 1;
}
// find X/Y position of domElement
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
// create floating DIV above element
this.div = document.createElement('div');
var style = this.div.style;
style.position = 'absolute';
style.left = (this.domElement.offsetLeft)+'px';
//style.left = (this.domElement.offsetLeft+2)+'px';
style.top = this.domElement.offsetTop+'px';
style.width = (box.width) + 'px';
//style.width = (box.width-4) + 'px';
style.height = box.height + 'px';
style.zIndex = zIndex;
if ( typeof title != "undefined" && title != "" ) {
this.div.title = title;
}
if ( box.width != 0 && box.height != 0 ) {
this.sized = true;
}
// style.backgroundColor = '#f00'; // debug
this.domElement.parentNode.appendChild(this.div);
this.div.innerHTML = this.getHTML( box.width, box.height );
},
positionElement: function() {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.position = 'absolute';
style.left = (this.domElement.offsetLeft)+'px';
style.top = this.domElement.offsetTop+'px';
style.width = box.width + 'px';
style.height = box.height + 'px';
if ( box.width != 0 && box.height != 0 ) {
this.sized = true;
} else {
return;
}
var flash = this.div.childNodes[0];
flash.width = box.width;
flash.height = box.height;
},
getHTML: function(width, height) {
// return HTML for movie
var html = '';
var flashvars = 'id=' + this.id +
'&width=' + width +
'&height=' + height;
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
}
else {
// all other browsers get an EMBED tag
html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
}
return html;
},
hide: function() {
// temporarily hide floater offscreen
if (this.div) {
this.div.style.left = '-2000px';
}
},
show: function() {
// show ourselves after a call to hide()
this.reposition();
},
destroy: function() {
// destroy control and floater
if (this.domElement && this.div) {
this.hide();
this.div.innerHTML = '';
var body = document.getElementsByTagName('body')[0];
try { body.removeChild( this.div ); } catch(e) {;}
this.domElement = null;
this.div = null;
}
},
reposition: function(elem) {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
this.domElement = ZeroClipboard.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
}
},
clearText: function() {
// clear the text to be copy / saved
this.clipText = '';
if (this.ready) this.movie.clearText();
},
appendText: function(newText) {
// append text to that which is to be copied / saved
this.clipText += newText;
if (this.ready) { this.movie.appendText(newText) ;}
},
setText: function(newText) {
// set text to be copied to be copied / saved
this.clipText = newText;
if (this.ready) { this.movie.setText(newText) ;}
},
setCharSet: function(charSet) {
// set the character set (UTF16LE or UTF8)
this.charSet = charSet;
if (this.ready) { this.movie.setCharSet(charSet) ;}
},
setBomInc: function(bomInc) {
// set if the BOM should be included or not
this.incBom = bomInc;
if (this.ready) { this.movie.setBomInc(bomInc) ;}
},
setFileName: function(newText) {
// set the file name
this.fileName = newText;
if (this.ready) this.movie.setFileName(newText);
},
setAction: function(newText) {
// set action (save or copy)
this.action = newText;
if (this.ready) this.movie.setAction(newText);
},
addEventListener: function(eventName, func) {
// add user event listener for event
// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
if (!this.handlers[eventName]) this.handlers[eventName] = [];
this.handlers[eventName].push(func);
},
setHandCursor: function(enabled) {
// enable hand cursor (true), or default arrow cursor (false)
this.handCursorEnabled = enabled;
if (this.ready) this.movie.setHandCursor(enabled);
},
setCSSEffects: function(enabled) {
// enable or disable CSS effects on DOM container
this.cssEffects = !!enabled;
},
receiveEvent: function(eventName, args) {
// receive event from flash
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
// special behavior for certain events
switch (eventName) {
case 'load':
// movie claims it is ready, but in IE this isn't always the case...
// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
this.movie = document.getElementById(this.movieId);
if (!this.movie) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 1 );
return;
}
// firefox on pc needs a "kick" in order to set these in certain cases
if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 100 );
this.ready = true;
return;
}
this.ready = true;
this.movie.clearText();
this.movie.appendText( this.clipText );
this.movie.setFileName( this.fileName );
this.movie.setAction( this.action );
this.movie.setCharSet( this.charSet );
this.movie.setBomInc( this.incBom );
this.movie.setHandCursor( this.handCursorEnabled );
break;
case 'mouseover':
if (this.domElement && this.cssEffects) {
//this.domElement.addClass('hover');
if (this.recoverActive) this.domElement.addClass('active');
}
break;
case 'mouseout':
if (this.domElement && this.cssEffects) {
this.recoverActive = false;
if (this.domElement.hasClass('active')) {
this.domElement.removeClass('active');
this.recoverActive = true;
}
//this.domElement.removeClass('hover');
}
break;
case 'mousedown':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('active');
}
break;
case 'mouseup':
if (this.domElement && this.cssEffects) {
this.domElement.removeClass('active');
this.recoverActive = false;
}
break;
} // switch eventName
if (this.handlers[eventName]) {
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
var func = this.handlers[eventName][idx];
if (typeof(func) == 'function') {
// actual function reference
func(this, args);
}
else if ((typeof(func) == 'object') && (func.length == 2)) {
// PHP style object + method, i.e. [myObject, 'myMethod']
func[0][ func[1] ](this, args);
}
else if (typeof(func) == 'string') {
// name of function
window[func](this, args);
}
} // foreach event handler defined
} // user defined handler for event
}
};