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

pull/397/head
Allan Jardine 6 years ago
commit f3db23bdb9

@ -54,9 +54,9 @@
var lastClassName = 'last'; var lastClassName = 'last';
var paginateClassName = 'paginate'; var paginateClassName = 'paginate';
var paginateOfClassName = 'paginate_of';
var paginatePageClassName = 'paginate_page'; var paginatePageClassName = 'paginate_page';
var paginateInputClassName = 'paginate_input'; var paginateInputClassName = 'paginate_input';
var paginateTotalClassName = 'paginate_total';
$.fn.dataTableExt.oPagination.input = { $.fn.dataTableExt.oPagination.input = {
'fnInit': function (oSettings, nPaging, fnCallbackDraw) { 'fnInit': function (oSettings, nPaging, fnCallbackDraw) {
@ -65,11 +65,12 @@
var nNext = document.createElement('span'); var nNext = document.createElement('span');
var nLast = document.createElement('span'); var nLast = document.createElement('span');
var nInput = document.createElement('input'); var nInput = document.createElement('input');
var nPage = document.createElement('span'); var nTotal = document.createElement('span');
var nOf = document.createElement('span'); var nInfo = document.createElement('span');
var language = oSettings.oLanguage.oPaginate; var language = oSettings.oLanguage.oPaginate;
var classes = oSettings.oClasses; var classes = oSettings.oClasses;
var info = language.info || 'Page _INPUT_ of _TOTAL_';
nFirst.innerHTML = language.sFirst; nFirst.innerHTML = language.sFirst;
nPrevious.innerHTML = language.sPrevious; nPrevious.innerHTML = language.sPrevious;
@ -81,9 +82,8 @@
nNext.className = nextClassName + ' ' + classes.sPageButton; nNext.className = nextClassName + ' ' + classes.sPageButton;
nLast.className = lastClassName + ' ' + classes.sPageButton; nLast.className = lastClassName + ' ' + classes.sPageButton;
nOf.className = paginateOfClassName;
nPage.className = paginatePageClassName;
nInput.className = paginateInputClassName; nInput.className = paginateInputClassName;
nTotal.className = paginateTotalClassName;
if (oSettings.sTableId !== '') { if (oSettings.sTableId !== '') {
nPaging.setAttribute('id', oSettings.sTableId + '_' + paginateClassName); nPaging.setAttribute('id', oSettings.sTableId + '_' + paginateClassName);
@ -94,13 +94,16 @@
} }
nInput.type = 'text'; nInput.type = 'text';
nPage.innerHTML = 'Page ';
info = info.replace(/_INPUT_/g, '</span>' + nInput.outerHTML + '<span>');
info = info.replace(/_TOTAL_/g, '</span>' + nTotal.outerHTML + '<span>');
nInfo.innerHTML = '<span>' + info + '</span>';
nPaging.appendChild(nFirst); nPaging.appendChild(nFirst);
nPaging.appendChild(nPrevious); nPaging.appendChild(nPrevious);
nPaging.appendChild(nPage); $(nInfo).children().each(function (i, n) {
nPaging.appendChild(nInput); nPaging.appendChild(n);
nPaging.appendChild(nOf); });
nPaging.appendChild(nNext); nPaging.appendChild(nNext);
nPaging.appendChild(nLast); nPaging.appendChild(nLast);
@ -136,7 +139,7 @@
} }
}); });
$(nInput).keyup(function (e) { $(nPaging).find('.' + paginateInputClassName).keyup(function (e) {
// 38 = up arrow, 39 = right arrow // 38 = up arrow, 39 = right arrow
if (e.which === 38 || e.which === 39) { if (e.which === 38 || e.which === 39) {
this.value++; this.value++;
@ -215,10 +218,10 @@
.addClass(disableClasses[lastClassName]); .addClass(disableClasses[lastClassName]);
// Paginate of N pages text // Paginate of N pages text
$(an).children('.' + paginateOfClassName).html(' of ' + iPages); $(an).find('.' + paginateTotalClassName).html(iPages);
// Current page numer input value // Current page number input value
$(an).children('.' + paginateInputClassName).val(iCurrentPage); $(an).find('.' + paginateInputClassName).val(iCurrentPage);
} }
}; };
})(jQuery); })(jQuery);

@ -18,12 +18,19 @@
jQuery.extend( jQuery.fn.dataTableExt.oSort, { jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"ip-address-pre": function ( a ) { "ip-address-pre": function ( a ) {
if (!a) { return 0 }
var i, item; var i, item;
var m = a.split("."), var m, n;
n = a.split(":"), var x, xa;
x = "",
xa = ""; if (!a) {
return 0
}
a = a.replace(/<[\s\S]*?>/g, "");
m = a.split(".");
n = a.split(":");
x = "";
xa = "";
if (m.length == 4) { if (m.length == 4) {
// IPV4 // IPV4

Loading…
Cancel
Save