Added assets + dependencies

This commit is contained in:
Bill Zimmerman
2015-02-25 14:08:14 +01:00
parent cb37f12f56
commit d5678d622e
748 changed files with 154165 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
div.alphabet {
position: relative;
display: table;
width: 100%;
margin-bottom: 1em;
}
div.alphabet span {
display: table-cell;
color: #3174c7;
cursor: pointer;
text-align: center;
width: 3.5%
}
div.alphabet span:hover {
text-decoration: underline;
}
div.alphabet span.active {
color: black;
}
div.alphabet span.empty {
color: red;
}
div.alphabetInfo {
display: block;
position: absolute;
background-color: #111;
border-radius: 3px;
color: white;
top: 2em;
height: 1.8em;
padding-top: 0.4em;
text-align: center;
z-index: 1;
}

View File

@@ -0,0 +1,162 @@
/*! AlphabetSearch for DataTables v1.0.0
* 2014 SpryMedia Ltd - datatables.net/license
*/
/**
* @summary AlphabetSearch
* @description Show an set of alphabet buttons alongside a table providing
* search input options
* @version 1.0.0
* @file dataTables.alphabetSearch.js
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact
* @copyright Copyright 2014 SpryMedia Ltd.
*
* License MIT - http://datatables.net/license/mit
*
* For more detailed information please see:
* http://datatables.net/blog/2014-09-22
*/
(function(){
// Search function
$.fn.dataTable.Api.register( 'alphabetSearch()', function ( searchTerm ) {
this.iterator( 'table', function ( context ) {
context.alphabetSearch = searchTerm;
} );
return this;
} );
// Recalculate the alphabet display for updated data
$.fn.dataTable.Api.register( 'alphabetSearch.recalc()', function ( searchTerm ) {
this.iterator( 'table', function ( context ) {
draw(
new $.fn.dataTable.Api( context ),
$('div.alphabet', this.table().container())
);
} );
return this;
} );
// Search plug-in
$.fn.dataTable.ext.search.push( function ( context, searchData ) {
// Ensure that there is a search applied to this table before running it
if ( ! context.alphabetSearch ) {
return true;
}
if ( searchData[0].charAt(0) === context.alphabetSearch ) {
return true;
}
return false;
} );
// Private support methods
function bin ( data ) {
var letter, bins = {};
for ( var i=0, ien=data.length ; i<ien ; i++ ) {
letter = data[i].charAt(0).toUpperCase();
if ( bins[letter] ) {
bins[letter]++;
}
else {
bins[letter] = 1;
}
}
return bins;
}
function draw ( table, alphabet )
{
alphabet.empty();
alphabet.append( 'Search: ' );
var columnData = table.column(0).data();
var bins = bin( columnData );
$('<span class="clear active"/>')
.data( 'letter', '' )
.data( 'match-count', columnData.length )
.html( 'None' )
.appendTo( alphabet );
for ( var i=0 ; i<26 ; i++ ) {
var letter = String.fromCharCode( 65 + i );
$('<span/>')
.data( 'letter', letter )
.data( 'match-count', bins[letter] || 0 )
.addClass( ! bins[letter] ? 'empty' : '' )
.html( letter )
.appendTo( alphabet );
}
$('<div class="alphabetInfo"></div>')
.appendTo( alphabet );
}
$.fn.dataTable.AlphabetSearch = function ( context ) {
var table = new $.fn.dataTable.Api( context );
var alphabet = $('<div class="alphabet"/>');
draw( table, alphabet );
// Trigger a search
alphabet.on( 'click', 'span', function () {
alphabet.find( '.active' ).removeClass( 'active' );
$(this).addClass( 'active' );
table
.alphabetSearch( $(this).data('letter') )
.draw();
} );
// Mouse events to show helper information
alphabet
.on( 'mouseenter', 'span', function () {
alphabet
.find('div.alphabetInfo')
.css( {
opacity: 1,
left: $(this).position().left,
width: $(this).width()
} )
.html( $(this).data('match-count') );
} )
.on( 'mouseleave', 'span', function () {
alphabet
.find('div.alphabetInfo')
.css('opacity', 0);
} );
// API method to get the alphabet container node
this.node = function () {
return alphabet;
};
};
$.fn.DataTable.AlphabetSearch = $.fn.dataTable.AlphabetSearch;
// Register a search plug-in
$.fn.dataTable.ext.feature.push( {
fnInit: function ( settings ) {
var search = new $.fn.dataTable.AlphabetSearch( settings );
return search.node();
},
cFeature: 'A'
} );
}());

View File

@@ -0,0 +1,8 @@
/*!
AlphabetSearch for DataTables v1.0.0
2014 SpryMedia Ltd - datatables.net/license
*/
(function(){function f(b,c){c.empty();c.append("Search: ");for(var a=b.column(0).data(),d,e={},g=0,f=a.length;g<f;g++)d=a[g].charAt(0).toUpperCase(),e[d]?e[d]++:e[d]=1;$('<span class="clear active"/>').data("letter","").data("match-count",a.length).html("None").appendTo(c);for(a=0;26>a;a++)d=String.fromCharCode(65+a),$("<span/>").data("letter",d).data("match-count",e[d]||0).addClass(!e[d]?"empty":"").html(d).appendTo(c);$('<div class="alphabetInfo"></div>').appendTo(c)}$.fn.dataTable.Api.register("alphabetSearch()",
function(b){this.iterator("table",function(c){c.alphabetSearch=b});return this});$.fn.dataTable.Api.register("alphabetSearch.recalc()",function(){this.iterator("table",function(b){f(new $.fn.dataTable.Api(b),$("div.alphabet",this.table().container()))});return this});$.fn.dataTable.ext.search.push(function(b,c){return!b.alphabetSearch||c[0].charAt(0)===b.alphabetSearch?!0:!1});$.fn.dataTable.AlphabetSearch=function(b){var c=new $.fn.dataTable.Api(b),a=$('<div class="alphabet"/>');f(c,a);a.on("click",
"span",function(){a.find(".active").removeClass("active");$(this).addClass("active");c.alphabetSearch($(this).data("letter")).draw()});a.on("mouseenter","span",function(){a.find("div.alphabetInfo").css({opacity:1,left:$(this).position().left,width:$(this).width()}).html($(this).data("match-count"))}).on("mouseleave","span",function(){a.find("div.alphabetInfo").css("opacity",0)});this.node=function(){return a}};$.fn.DataTable.AlphabetSearch=$.fn.dataTable.AlphabetSearch;$.fn.dataTable.ext.feature.push({fnInit:function(b){return(new $.fn.dataTable.AlphabetSearch(b)).node()},
cFeature:"A"})})();

View File

@@ -0,0 +1,4 @@
div.dataTables_length a.active {
color: black;
}

View File

@@ -0,0 +1,90 @@
/*! Page length control via links for DataTables
* 2014 SpryMedia Ltd - datatables.net/license
*/
/**
* @summary LengthLinks
* @description Page length control via links for DataTables
* @version 1.1.0
* @file dataTables.searchHighlight.js
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact
* @copyright Copyright 2014 SpryMedia Ltd.
*
* License MIT - http://datatables.net/license/mit
*
* This feature plug-in for DataTables adds page length control links to the
* DataTable. The `dom` option can be used to insert the control using the `L`
* character option and it uses the `lengthMenu` options of DataTables to
* determine what to display.
*
* @example
* $('#myTable').DataTable( {
* dom: 'Lfrtip'
* } );
*
* @example
* $('#myTable').DataTable( {
* lengthMenu: [ [10, 25, 50, -1], [10, 25, 50, "All"] ]
* dom: 'Lfrtip'
* } );
*/
(function(window, document, $, undefined) {
$.fn.dataTable.LengthLinks = function ( inst ) {
var api = new $.fn.dataTable.Api( inst );
var settings = api.settings()[0];
var container = $('<div></div>').addClass( settings.oClasses.sLength );
var lastLength = -1;
// API so the feature wrapper can return the node to insert
this.container = function () {
return container[0];
};
// Listen for events to change the page length
container.on( 'click.dtll', 'a', function (e) {
e.preventDefault();
api.page.len( $(this).data('length')*1 ).draw( false );
} );
// Update on each draw
api.on( 'draw', function () {
// No point in updating - nothing has changed
if ( api.page.len() === lastLength ) {
return;
}
var menu = settings.aLengthMenu;
var lang = menu.length===2 && $.isArray(menu[0]) ? menu[1] : menu;
var lens = menu.length===2 && $.isArray(menu[0]) ? menu[0] : menu;
var out = $.map( lens, function (el, i) {
return el == api.page.len() ?
'<a class="active" data-length="'+lens[i]+'">'+lang[i]+'</a>' :
'<a data-length="'+lens[i]+'">'+lang[i]+'</a>';
} );
container.html( settings.oLanguage.sLengthMenu.replace( '_MENU_', out.join(' | ') ) );
lastLength = api.page.len();
} );
api.on( 'destroy', function () {
container.off( 'click.dtll', 'a' );
} );
};
// Subscribe the feature plug-in to DataTables, ready for use
$.fn.dataTable.ext.feature.push( {
"fnInit": function( settings ) {
var l = new $.fn.dataTable.LengthLinks( settings );
return l.container();
},
"cFeature": "L",
"sFeature": "LengthLinks"
} );
})(window, document, jQuery);

View File

@@ -0,0 +1,6 @@
/*!
Page length control via links for DataTables
2014 SpryMedia Ltd - datatables.net/license
*/
(function(i,j,a){a.fn.dataTable.LengthLinks=function(d){var c=new a.fn.dataTable.Api(d),f=c.settings()[0],e=a("<div></div>").addClass(f.oClasses.sLength),h=-1;this.container=function(){return e[0]};e.on("click.dtll","a",function(b){b.preventDefault();c.page.len(1*a(this).data("length")).draw(!1)});c.on("draw",function(){if(c.page.len()!==h){var b=f.aLengthMenu,d=2===b.length&&a.isArray(b[0])?b[1]:b,g=2===b.length&&a.isArray(b[0])?b[0]:b,b=a.map(g,function(b,a){return b==c.page.len()?'<a class="active" data-length="'+
g[a]+'">'+d[a]+"</a>":'<a data-length="'+g[a]+'">'+d[a]+"</a>"});e.html(f.oLanguage.sLengthMenu.replace("_MENU_",b.join(" | ")));h=c.page.len()}});c.on("destroy",function(){e.off("click.dtll","a")})};a.fn.dataTable.ext.feature.push({fnInit:function(d){return(new a.fn.dataTable.LengthLinks(d)).container()},cFeature:"L",sFeature:"LengthLinks"})})(window,document,jQuery);

View File

@@ -0,0 +1,6 @@
table.dataTable span.highlight {
background-color: #FFFF88;
}

View File

@@ -0,0 +1,67 @@
/*! SearchHighlight for DataTables v1.0.1
* 2014 SpryMedia Ltd - datatables.net/license
*/
/**
* @summary SearchHighlight
* @description Search term highlighter for DataTables
* @version 1.0.1
* @file dataTables.searchHighlight.js
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact
* @copyright Copyright 2014 SpryMedia Ltd.
*
* License MIT - http://datatables.net/license/mit
*
* This feature plug-in for DataTables will highlight search terms in the
* DataTable as they are entered into the main search input element, or via the
* `search()` API method.
*
* It depends upon the jQuery Highlight plug-in by Bartek Szopka:
* http://bartaz.github.io/sandbox.js/jquery.highlight.js
*
* Search highlighting in DataTables can be enabled by:
*
* * Adding the class `searchHighlight` to the HTML table
* * Setting the `searchHighlight` parameter in the DataTables initialisation to
* be true
* * Setting the `searchHighlight` parameter to be true in the DataTables
* defaults (thus causing all tables to have this feature) - i.e.
* `$.fn.dataTable.defaults.searchHighlight = true`.
*
* For more detailed information please see:
* http://datatables.net/blog/2014-10-22
*/
(function(window, document, $){
// Listen for DataTables initialisations
$(document).on( 'init.dt.dth', function (e, settings, json) {
var table = new $.fn.dataTable.Api( settings );
var body = $( table.table().body() );
if (
$( table.table().node() ).hasClass( 'searchHighlight' ) || // table has class
settings.oInit.searchHighlight || // option specified
$.fn.dataTable.defaults.searchHighlight // default set
) {
table
.on( 'draw.dt.dth column-visibility.dt.dth', function () {
// On each draw highlight search results, removing the old ones
body.unhighlight();
// Don't highlight the "not found" row
if ( table.rows( { filter: 'applied' } ).data().length ) {
body.highlight( table.search().split(' ') );
}
} )
.on( 'destroy', function () {
// Remove event handler
table.off( 'draw.dt.dth column-visibility.dt.dth' );
} );
}
} );
})(window, document, jQuery);

View File

@@ -0,0 +1,5 @@
/*!
SearchHighlight for DataTables v1.0.1
2014 SpryMedia Ltd - datatables.net/license
*/
(function(f,c,b){b(c).on("init.dt.dth",function(c,d){var a=new b.fn.dataTable.Api(d),e=b(a.table().body());if(b(a.table().node()).hasClass("searchHighlight")||d.oInit.searchHighlight||b.fn.dataTable.defaults.searchHighlight)a.on("draw.dt.dth column-visibility.dt.dth",function(){e.unhighlight();a.rows({filter:"applied"}).data().length&&e.highlight(a.search().split(" "))}).on("destroy",function(){a.off("draw.dt.dth column-visibility.dt.dth")})})})(window,document,jQuery);