Created
March 8, 2010 07:03
-
-
Save anandkunal/324954 to your computer and use it in GitHub Desktop.
Gmail Pagination Hack
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
// 1: older page for all mail | |
49: function() { | |
currentPage = GrabCurrentAllMailPage(); | |
if (currentPage >= 2) { | |
window.location.hash = "#all/p" + (currentPage-1); | |
} | |
}, | |
// 2: newer page for all mail | |
50: function() { | |
currentPage = GrabCurrentAllMailPage(); | |
if (currentPage) | |
{ | |
window.location.hash = "#all/p" + (currentPage+1); | |
} | |
else | |
{ | |
window.location.hash = "#all/p2"; | |
} | |
} | |
// Check the url for a pagination link - if you see /p# extract the # | |
// I should get a bit smarter and check the current page to do inbox routing | |
function GrabCurrentAllMailPage() { | |
var pageArray = window.location.hash.match(/^(.*)(\/)(p)([0-9]+)(.*)$/); | |
// If there is no hash, or the regex fails, then test for properties | |
if (pageArray) | |
{ | |
if (pageArray.length != 6) { | |
return 1; | |
} | |
else { | |
return parseInt(pageArray[4]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment