Mergte branch 'master' of github.com:DataTables/Plugins

pull/223/head
Allan Jardine 9 years ago
commit 5928f6086c

@ -6,7 +6,7 @@
* @summary LengthLinks * @summary LengthLinks
* @description Page length control via links for DataTables * @description Page length control via links for DataTables
* @version 1.1.0 * @version 1.1.0
* @file dataTables.searchHighlight.js * @file dataTables.lengthLinks.js
* @author SpryMedia Ltd (www.sprymedia.co.uk) * @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact * @contact www.sprymedia.co.uk/contact
* @copyright Copyright 2014 SpryMedia Ltd. * @copyright Copyright 2014 SpryMedia Ltd.

@ -39,13 +39,13 @@ jQuery.fn.DataTable.ext.type.search.string = function ( data ) {
'' : '' :
typeof data === 'string' ? typeof data === 'string' ?
data data
.replace( /έ/g, 'ε') .replace( /έ/g, 'ε' )
.replace( /ύ/g, 'υ') .replace( /[ύϋΰ]/g, 'υ' )
.replace( /ό/g, 'ο') .replace( /ό/g, 'ο' )
.replace( /ώ/g, 'ω') .replace( /ώ/g, 'ω' )
.replace( /ά/g, 'α') .replace( /ά/g, 'α' )
.replace( /ί/g, 'ι') .replace( /[ίϊΐ]/g, 'ι' )
.replace( /ή/g, 'η') .replace( /ή/g, 'η' )
.replace( /\n/g, ' ' ) .replace( /\n/g, ' ' )
.replace( /á/g, 'a' ) .replace( /á/g, 'a' )
.replace( /é/g, 'e' ) .replace( /é/g, 'e' )

@ -10,7 +10,7 @@
"sSearch": "Rechercher :", "sSearch": "Rechercher :",
"sLengthMenu": "Afficher _MENU_ éléments", "sLengthMenu": "Afficher _MENU_ éléments",
"sInfo": "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments", "sInfo": "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 éléments", "sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 élément",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)", "sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "", "sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...", "sLoadingRecords": "Chargement en cours...",

@ -3,22 +3,33 @@
* @name Greek * @name Greek
* @anchor Greek * @anchor Greek
* @author Abraam Ziogas * @author Abraam Ziogas
* @author Leonidas Arvanitis
*/ */
{ {
"sProcessing": "Επεξεργασία...", "sDecimal": ",",
"sLengthMenu": "Δείξε _MENU_ εγγραφές", "sEmptyTable": "Δεν υπάρχουν δεδομένα στον πίνακα",
"sZeroRecords": "Δεν βρέθηκαν εγγραφές που να ταιριάζουν", "sInfo": "Εμφανίζονται _START_ έως _END_ από _TOTAL_ εγγραφές",
"sInfo": "Δείχνοντας _START_ εως _END_ από _TOTAL_ εγγραφές", "sInfoEmpty": "Εμφανίζονται 0 έως 0 από 0 εγγραφές",
"sInfoEmpty": "Δείχνοντας 0 εως 0 από 0 εγγραφές", "sInfoFiltered": "(φιλτραρισμένες από _MAX_ συνολικά εγγραφές)",
"sInfoFiltered": "(φιλτραρισμένες από _MAX_ συνολικά εγγραφές)", "sInfoPostFix": "",
"sInfoPostFix": "", "sInfoThousands": ".",
"sSearch": "Αναζήτηση:", "sLengthMenu": "Δείξε _MENU_ εγγραφές",
"sUrl": "", "sLoadingRecords": "Φόρτωση...",
"sProcessing": "Επεξεργασία...",
"sSearch": "Αναζήτηση:",
"sSearchPlaceholder": "Αναζήτηση",
"sThousands": ".",
"sUrl": "",
"sZeroRecords": "Δεν βρέθηκαν εγγραφές που να ταιριάζουν",
"oPaginate": { "oPaginate": {
"sFirst": "Πρώτη", "sFirst": "Πρώτη",
"sPrevious": "Προηγούμενη", "sPrevious": "Προηγούμενη",
"sNext": "Επόμενη", "sNext": "Επόμενη",
"sLast": "Τελευταία" "sLast": "Τελευταία"
},
"oAria": {
"sSortAscending": ": ενεργοποιήστε για αύξουσα ταξινόμηση της στήλης",
"sSortDescending": ": ενεργοποιήστε για φθίνουσα ταξινόμηση της στήλης"
} }
} }

@ -11,7 +11,7 @@
"sInfoEmpty": "Vista da 0 a 0 di 0 elementi", "sInfoEmpty": "Vista da 0 a 0 di 0 elementi",
"sInfoFiltered": "(filtrati da _MAX_ elementi totali)", "sInfoFiltered": "(filtrati da _MAX_ elementi totali)",
"sInfoPostFix": "", "sInfoPostFix": "",
"sInfoThousands": ",", "sInfoThousands": ".",
"sLengthMenu": "Visualizza _MENU_ elementi", "sLengthMenu": "Visualizza _MENU_ elementi",
"sLoadingRecords": "Caricamento...", "sLoadingRecords": "Caricamento...",
"sProcessing": "Elaborazione...", "sProcessing": "Elaborazione...",

@ -0,0 +1,30 @@
/**
* Welsh translation
* @name Welsh
* @anchor Welsh
* @author <a href="https://eveoh.nl/">Marco Krikke</a>
*/
{
"sEmptyTable": "Dim data ar gael yn y tabl",
"sInfo": "Dangos _START_ i _END_ o _TOTAL_ cofnod",
"sInfoEmpty": "Dangos 0 i 0 o 0 cofnod",
"sInfoFiltered": "(wedi hidlo o gyfanswm o _MAX_ cofnod)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Dangos _MENU_ cofnod",
"sLoadingRecords": "Wrthi'n llwytho...",
"sProcessing": "Wrthi'n prosesu...",
"sSearch": "Chwilio:",
"sZeroRecords": "Heb ddod o hyd i gofnodion sy'n cyfateb",
"oPaginate": {
"sFirst": "Cyntaf",
"sLast": "Olaf",
"sNext": "Nesaf",
"sPrevious": "Blaenorol"
},
"oAria": {
"sSortAscending": ": rhoi ar waith i drefnu colofnau o'r lleiaf i'r mwyaf",
"sSortDescending": ": rhoi ar waith i drefnu colofnau o'r mwyaf i'r lleiaf"
}
}

@ -8,215 +8,217 @@
* @name Navigation with text input * @name Navigation with text input
* @summary Shows an input element into which the user can type a page number * @summary Shows an input element into which the user can type a page number
* @author [Allan Jardine](http://sprymedia.co.uk) * @author [Allan Jardine](http://sprymedia.co.uk)
* @author [Gordey Doronin](http://github.com/GDoronin)
* *
* @example * @example
* $(document).ready(function() { * $(document).ready(function() {
* $('#example').dataTable( { * $('#example').dataTable( {
* "sPaginationType": "input" * "pagingType": "input"
* } ); * } );
* } ); * } );
*/ */
$.fn.dataTableExt.oPagination.input = { (function ($) {
"fnInit": function ( oSettings, nPaging, fnCallbackDraw ) function calcDisableClasses(oSettings) {
{ var start = oSettings._iDisplayStart;
var nFirst = document.createElement( 'span' ); var length = oSettings._iDisplayLength;
var nPrevious = document.createElement( 'span' ); var visibleRecords = oSettings.fnRecordsDisplay();
var nNext = document.createElement( 'span' ); var all = length === -1;
var nLast = document.createElement( 'span' );
var nInput = document.createElement( 'input' ); // Gordey Doronin: Re-used this code from main jQuery.dataTables source code. To be consistent.
var nPage = document.createElement( 'span' ); var page = all ? 0 : Math.ceil(start / length);
var nOf = document.createElement( 'span' ); var pages = all ? 1 : Math.ceil(visibleRecords / length);
nFirst.innerHTML = oSettings.oLanguage.oPaginate.sFirst; var disableFirstPrevClass = (page > 0 ? '' : oSettings.oClasses.sPageButtonDisabled);
nPrevious.innerHTML = oSettings.oLanguage.oPaginate.sPrevious; var disableNextLastClass = (page < pages - 1 ? '' : oSettings.oClasses.sPageButtonDisabled);
nNext.innerHTML = oSettings.oLanguage.oPaginate.sNext;
nLast.innerHTML = oSettings.oLanguage.oPaginate.sLast; return {
'first': disableFirstPrevClass,
nFirst.className = "paginate_button first disabled"; 'previous': disableFirstPrevClass,
nPrevious.className = "paginate_button previous disabled"; 'next': disableNextLastClass,
nNext.className="paginate_button next"; 'last': disableNextLastClass
nLast.className = "paginate_button last"; };
nOf.className = "paginate_of"; }
nPage.className = "paginate_page";
nInput.className = "paginate_input";
if ( oSettings.sTableId !== '' )
{
nPaging.setAttribute( 'id', oSettings.sTableId+'_paginate' );
nPrevious.setAttribute( 'id', oSettings.sTableId+'_previous' );
nPrevious.setAttribute( 'id', oSettings.sTableId+'_previous' );
nNext.setAttribute( 'id', oSettings.sTableId+'_next' );
nLast.setAttribute( 'id', oSettings.sTableId+'_last' );
}
nInput.type = "text"; function calcCurrentPage(oSettings) {
nPage.innerHTML = "Page "; return Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
}
nPaging.appendChild( nFirst );
nPaging.appendChild( nPrevious ); function calcPages(oSettings) {
nPaging.appendChild( nPage ); return Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength);
nPaging.appendChild( nInput ); }
nPaging.appendChild( nOf );
nPaging.appendChild( nNext ); var firstClassName = 'first';
nPaging.appendChild( nLast ); var previousClassName = 'previous';
var nextClassName = 'next';
$(nFirst).click( function () var lastClassName = 'last';
{
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1; var paginateClassName = 'paginate';
if (iCurrentPage != 1) var paginateOfClassName = 'paginate_of';
{ var paginatePageClassName = 'paginate_page';
oSettings.oApi._fnPageChange( oSettings, "first" ); var paginateInputClassName = 'paginate_input';
fnCallbackDraw( oSettings );
$(nFirst).addClass('disabled'); $.fn.dataTableExt.oPagination.input = {
$(nPrevious).addClass('disabled'); 'fnInit': function (oSettings, nPaging, fnCallbackDraw) {
$(nNext).removeClass('disabled'); var nFirst = document.createElement('span');
$(nLast).removeClass('disabled'); var nPrevious = document.createElement('span');
} var nNext = document.createElement('span');
} ); var nLast = document.createElement('span');
var nInput = document.createElement('input');
$(nPrevious).click( function() var nPage = document.createElement('span');
{ var nOf = document.createElement('span');
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage != 1) var language = oSettings.oLanguage.oPaginate;
{ var classes = oSettings.oClasses;
oSettings.oApi._fnPageChange(oSettings, "previous");
fnCallbackDraw(oSettings); nFirst.innerHTML = language.sFirst;
if (iCurrentPage == 2) nPrevious.innerHTML = language.sPrevious;
{ nNext.innerHTML = language.sNext;
$(nFirst).addClass('disabled'); nLast.innerHTML = language.sLast;
$(nPrevious).addClass('disabled');
} nFirst.className = firstClassName + ' ' + classes.sPageButton;
$(nNext).removeClass('disabled'); nPrevious.className = previousClassName + ' ' + classes.sPageButton;
$(nLast).removeClass('disabled'); nNext.className = nextClassName + ' ' + classes.sPageButton;
nLast.className = lastClassName + ' ' + classes.sPageButton;
nOf.className = paginateOfClassName;
nPage.className = paginatePageClassName;
nInput.className = paginateInputClassName;
if (oSettings.sTableId !== '') {
nPaging.setAttribute('id', oSettings.sTableId + '_' + paginateClassName);
nFirst.setAttribute('id', oSettings.sTableId + '_' + firstClassName);
nPrevious.setAttribute('id', oSettings.sTableId + '_' + previousClassName);
nNext.setAttribute('id', oSettings.sTableId + '_' + nextClassName);
nLast.setAttribute('id', oSettings.sTableId + '_' + lastClassName);
} }
} );
$(nNext).click( function() nInput.type = 'text';
{ nPage.innerHTML = 'Page ';
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage != Math.ceil((oSettings.fnRecordsDisplay() / oSettings._iDisplayLength))) nPaging.appendChild(nFirst);
{ nPaging.appendChild(nPrevious);
oSettings.oApi._fnPageChange(oSettings, "next"); nPaging.appendChild(nPage);
fnCallbackDraw(oSettings); nPaging.appendChild(nInput);
if (iCurrentPage == (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1)) nPaging.appendChild(nOf);
{ nPaging.appendChild(nNext);
$(nNext).addClass('disabled'); nPaging.appendChild(nLast);
$(nLast).addClass('disabled');
$(nFirst).click(function() {
var iCurrentPage = calcCurrentPage(oSettings);
if (iCurrentPage !== 1) {
oSettings.oApi._fnPageChange(oSettings, 'first');
fnCallbackDraw(oSettings);
} }
$(nFirst).removeClass('disabled'); });
$(nPrevious).removeClass('disabled');
} $(nPrevious).click(function() {
} ); var iCurrentPage = calcCurrentPage(oSettings);
if (iCurrentPage !== 1) {
$(nLast).click( function() oSettings.oApi._fnPageChange(oSettings, 'previous');
{
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage != Math.ceil((oSettings.fnRecordsDisplay() / oSettings._iDisplayLength)))
{
oSettings.oApi._fnPageChange(oSettings, "last");
fnCallbackDraw(oSettings); fnCallbackDraw(oSettings);
$(nFirst).removeClass('disabled');
$(nPrevious).removeClass('disabled');
$(nNext).addClass('disabled');
$(nLast).addClass('disabled');
} }
} ); });
$(nInput).keyup( function (e) { $(nNext).click(function() {
// 38 = up arrow, 39 = right arrow var iCurrentPage = calcCurrentPage(oSettings);
if ( e.which == 38 || e.which == 39 ) if (iCurrentPage !== calcPages(oSettings)) {
{ oSettings.oApi._fnPageChange(oSettings, 'next');
this.value++; fnCallbackDraw(oSettings);
} }
// 37 = left arrow, 40 = down arrow });
else if ( (e.which == 37 || e.which == 40) && this.value > 1 )
{
this.value--;
}
if ( this.value === "" || this.value.match(/[^0-9]/) ) $(nLast).click(function() {
{ var iCurrentPage = calcCurrentPage(oSettings);
/* Nothing entered or non-numeric character */ if (iCurrentPage !== calcPages(oSettings)) {
this.value = this.value.replace(/[^\d]/g, ''); // don't even allow anything but digits oSettings.oApi._fnPageChange(oSettings, 'last');
return; fnCallbackDraw(oSettings);
} }
});
var iNewStart = oSettings._iDisplayLength * (this.value - 1); $(nInput).keyup(function (e) {
if (iNewStart < 0) // 38 = up arrow, 39 = right arrow
{ if (e.which === 38 || e.which === 39) {
iNewStart = 0; this.value++;
} }
if (iNewStart >= oSettings.fnRecordsDisplay()) // 37 = left arrow, 40 = down arrow
{ else if ((e.which === 37 || e.which === 40) && this.value > 1) {
iNewStart = (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength; this.value--;
} }
if (iNewStart === 0) if (this.value === '' || this.value.match(/[^0-9]/)) {
{ /* Nothing entered or non-numeric character */
$(nFirst).addClass('disabled'); this.value = this.value.replace(/[^\d]/g, ''); // don't even allow anything but digits
$(nPrevious).addClass('disabled'); return;
$(nNext).removeClass('disabled');
$(nLast).removeClass('disabled');
} }
else if (iNewStart == ((Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength))
{ var iNewStart = oSettings._iDisplayLength * (this.value - 1);
$(nNext).addClass('disabled'); if (iNewStart < 0) {
$(nLast).addClass('disabled'); iNewStart = 0;
$(nFirst).removeClass('disabled');
$(nPrevious).removeClass('disabled');
} }
else if (iNewStart >= oSettings.fnRecordsDisplay()) {
{ iNewStart = (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength;
$(nFirst).removeClass('disabled');
$(nPrevious).removeClass('disabled');
$(nNext).removeClass('disabled');
$(nLast).removeClass('disabled');
} }
oSettings._iDisplayStart = iNewStart; oSettings._iDisplayStart = iNewStart;
fnCallbackDraw( oSettings ); fnCallbackDraw(oSettings);
} ); });
/* Take the brutal approach to cancelling text selection */
$('span', nPaging).bind( 'mousedown', function () { return false; } );
$('span', nPaging).bind( 'selectstart', function () { return false; } );
// If we can't page anyway, might as well not show it
var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);
if(iPages <= 1)
{
$(nPaging).hide();
}
},
// Take the brutal approach to cancelling text selection.
$('span', nPaging).bind('mousedown', function () { return false; });
$('span', nPaging).bind('selectstart', function() { return false; });
"fnUpdate": function ( oSettings, fnCallbackDraw ) // If we can't page anyway, might as well not show it.
{ var iPages = calcPages(oSettings);
if ( !oSettings.aanFeatures.p ) if (iPages <= 1) {
{ $(nPaging).hide();
return; }
} },
var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
var an = oSettings.aanFeatures.p; 'fnUpdate': function (oSettings) {
if (iPages <= 1) // hide paging when we can't page if (!oSettings.aanFeatures.p) {
{ return;
$(an).hide(); }
}
else
{
$(an).show();
/* Loop over each instance of the pager */ var iPages = calcPages(oSettings);
for (var i = 0, iLen = an.length ; i < iLen ; i++) var iCurrentPage = calcCurrentPage(oSettings);
var an = oSettings.aanFeatures.p;
if (iPages <= 1) // hide paging when we can't page
{ {
var spans = an[i].getElementsByTagName('span'); $(an).hide();
var inputs = an[i].getElementsByTagName('input'); return;
spans[3].innerHTML = " of " + iPages;
inputs[0].value = iCurrentPage;
} }
var disableClasses = calcDisableClasses(oSettings);
$(an).show();
// Enable/Disable `first` button.
$(an).children('.' + firstClassName)
.removeClass(oSettings.oClasses.sPageButtonDisabled)
.addClass(disableClasses[firstClassName]);
// Enable/Disable `prev` button.
$(an).children('.' + previousClassName)
.removeClass(oSettings.oClasses.sPageButtonDisabled)
.addClass(disableClasses[previousClassName]);
// Enable/Disable `next` button.
$(an).children('.' + nextClassName)
.removeClass(oSettings.oClasses.sPageButtonDisabled)
.addClass(disableClasses[nextClassName]);
// Enable/Disable `last` button.
$(an).children('.' + lastClassName)
.removeClass(oSettings.oClasses.sPageButtonDisabled)
.addClass(disableClasses[lastClassName]);
// Paginate of N pages text
$(an).children('.' + paginateOfClassName).html(' of ' + iPages);
// Current page numer input value
$(an).children('.' + paginateInputClassName).val(iCurrentPage);
} }
} };
}; })(jQuery);

Loading…
Cancel
Save