Created
November 12, 2014 00:24
-
-
Save tstachl/f1c4760c76f80b743dc0 to your computer and use it in GitHub Desktop.
Load all cases without pagination on the My Cases page in the desk.com portal by adding this snippet of jquery code. It basically loads the next page of each page that has a next page specified and appends all the cases to the initial page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
function nextPage(url, callback) { | |
$.get(url, function(data, textStatus, jqXHR) { | |
var cases = $(data).find('.mycases tbody tr') | |
, nextUrl = $(data).find('#pagination a.next_page'); | |
callback(cases); | |
if (nextUrl && nextUrl.attr('href')) nextPage(nextUrl.attr('href'), callback); | |
}, 'html'); | |
} | |
var nextUrl = $('#pagination a.next_page'); | |
if (nextUrl && nextUrl.attr('href')) { | |
nextPage(nextUrl.attr('href'), function(cases) { | |
$('.mycases tbody').append(cases); | |
}); | |
$('#pagination').hide(); | |
} | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment