Fix JSHint warnings

pull/126/head
Allan Jardine 10 years ago
parent e1a6d572aa
commit 037c891ba8

@ -61,66 +61,66 @@ $.fn.dataTableExt.oPagination.input = {
nPaging.appendChild( nNext ); nPaging.appendChild( nNext );
nPaging.appendChild( nLast ); nPaging.appendChild( nLast );
$(nFirst).click( function () $(nFirst).click( function ()
{ {
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1; var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage != 1) if (iCurrentPage != 1)
{ {
oSettings.oApi._fnPageChange( oSettings, "first" ); oSettings.oApi._fnPageChange( oSettings, "first" );
fnCallbackDraw( oSettings ); fnCallbackDraw( oSettings );
$(nFirst).addClass('disabled'); $(nFirst).addClass('disabled');
$(nPrevious).addClass('disabled'); $(nPrevious).addClass('disabled');
$(nNext).removeClass('disabled'); $(nNext).removeClass('disabled');
$(nLast).removeClass('disabled'); $(nLast).removeClass('disabled');
} }
} ); } );
$(nPrevious).click( function() $(nPrevious).click( function()
{ {
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1; var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage != 1) if (iCurrentPage != 1)
{ {
oSettings.oApi._fnPageChange(oSettings, "previous"); oSettings.oApi._fnPageChange(oSettings, "previous");
fnCallbackDraw(oSettings); fnCallbackDraw(oSettings);
if (iCurrentPage == 2) if (iCurrentPage == 2)
{ {
$(nFirst).addClass('disabled'); $(nFirst).addClass('disabled');
$(nPrevious).addClass('disabled'); $(nPrevious).addClass('disabled');
} }
$(nNext).removeClass('disabled'); $(nNext).removeClass('disabled');
$(nLast).removeClass('disabled'); $(nLast).removeClass('disabled');
} }
} ); } );
$(nNext).click( function() $(nNext).click( function()
{ {
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1; var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage != Math.ceil((oSettings.fnRecordsDisplay() / oSettings._iDisplayLength))) if (iCurrentPage != Math.ceil((oSettings.fnRecordsDisplay() / oSettings._iDisplayLength)))
{ {
oSettings.oApi._fnPageChange(oSettings, "next"); oSettings.oApi._fnPageChange(oSettings, "next");
fnCallbackDraw(oSettings); fnCallbackDraw(oSettings);
if (iCurrentPage == (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1)) if (iCurrentPage == (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1))
{ {
$(nNext).addClass('disabled'); $(nNext).addClass('disabled');
$(nLast).addClass('disabled'); $(nLast).addClass('disabled');
} }
$(nFirst).removeClass('disabled'); $(nFirst).removeClass('disabled');
$(nPrevious).removeClass('disabled'); $(nPrevious).removeClass('disabled');
} }
} ); } );
$(nLast).click( function() $(nLast).click( function()
{ {
var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1; var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;
if (iCurrentPage != Math.ceil((oSettings.fnRecordsDisplay() / oSettings._iDisplayLength))) if (iCurrentPage != Math.ceil((oSettings.fnRecordsDisplay() / oSettings._iDisplayLength)))
{ {
oSettings.oApi._fnPageChange(oSettings, "last"); oSettings.oApi._fnPageChange(oSettings, "last");
fnCallbackDraw(oSettings); fnCallbackDraw(oSettings);
$(nFirst).removeClass('disabled'); $(nFirst).removeClass('disabled');
$(nPrevious).removeClass('disabled'); $(nPrevious).removeClass('disabled');
$(nNext).addClass('disabled'); $(nNext).addClass('disabled');
$(nLast).addClass('disabled'); $(nLast).addClass('disabled');
} }
} ); } );
$(nInput).keyup( function (e) { $(nInput).keyup( function (e) {
@ -143,36 +143,36 @@ $.fn.dataTableExt.oPagination.input = {
} }
var iNewStart = oSettings._iDisplayLength * (this.value - 1); var iNewStart = oSettings._iDisplayLength * (this.value - 1);
if (iNewStart < 0) if (iNewStart < 0)
{ {
iNewStart = 0; iNewStart = 0;
} }
if (iNewStart > oSettings.fnRecordsDisplay()) if (iNewStart > oSettings.fnRecordsDisplay())
{ {
iNewStart = (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength; iNewStart = (Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength;
} }
if (iNewStart == 0) if (iNewStart === 0)
{ {
$(nFirst).addClass('disabled'); $(nFirst).addClass('disabled');
$(nPrevious).addClass('disabled'); $(nPrevious).addClass('disabled');
$(nNext).removeClass('disabled'); $(nNext).removeClass('disabled');
$(nLast).removeClass('disabled'); $(nLast).removeClass('disabled');
} }
else if (iNewStart == ((Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength)) else if (iNewStart == ((Math.ceil((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength))
{ {
$(nNext).addClass('disabled'); $(nNext).addClass('disabled');
$(nLast).addClass('disabled'); $(nLast).addClass('disabled');
$(nFirst).removeClass('disabled'); $(nFirst).removeClass('disabled');
$(nPrevious).removeClass('disabled'); $(nPrevious).removeClass('disabled');
} }
else else
{ {
$(nFirst).removeClass('disabled'); $(nFirst).removeClass('disabled');
$(nPrevious).removeClass('disabled'); $(nPrevious).removeClass('disabled');
$(nNext).removeClass('disabled'); $(nNext).removeClass('disabled');
$(nLast).removeClass('disabled'); $(nLast).removeClass('disabled');
} }
oSettings._iDisplayStart = iNewStart; oSettings._iDisplayStart = iNewStart;
fnCallbackDraw( oSettings ); fnCallbackDraw( oSettings );
@ -186,7 +186,7 @@ $.fn.dataTableExt.oPagination.input = {
var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength); var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);
if(iPages <= 1) if(iPages <= 1)
{ {
$(nPaging).hide(); $(nPaging).hide();
} }
}, },
@ -203,18 +203,18 @@ $.fn.dataTableExt.oPagination.input = {
var an = oSettings.aanFeatures.p; var an = oSettings.aanFeatures.p;
if (iPages <= 1) // hide paging when we can't page if (iPages <= 1) // hide paging when we can't page
{ {
$(an).hide(); $(an).hide();
} }
else else
{ {
/* Loop over each instance of the pager */ /* Loop over each instance of the pager */
for (var i = 0, iLen = an.length ; i < iLen ; i++) for (var i = 0, iLen = an.length ; i < iLen ; i++)
{ {
var spans = an[i].getElementsByTagName('span'); var spans = an[i].getElementsByTagName('span');
var inputs = an[i].getElementsByTagName('input'); var inputs = an[i].getElementsByTagName('input');
spans[3].innerHTML = " of " + iPages; spans[3].innerHTML = " of " + iPages;
inputs[0].value = iCurrentPage; inputs[0].value = iCurrentPage;
} }
} }
} }
}; };

Loading…
Cancel
Save