By riddle
—
Last update
May 24, 2009
—
Installed
88 times.
// ==UserScript==
// @name Twitter Pager
// @description Replaces Ajax "more" loader with ol’ plain links.
// @namespace twitter.pager
// @include http://twitter.com/*
// @include https://twitter.com/*
// ==/UserScript==
var id = document.body.id || '';
if ((id == 'profile') || (id == 'home')) {
var pagination = document.getElementById('pagination');
if (pagination) {
var links = pagination.getElementsByTagName('a');
if (links.length) {
var more = links[0],
href = more.href.split('?'),
params = href[1].split('&'),
next_page = 2;
for (var i=0; i < params.length; i++) {
var param = params[i].split('=');
if (param[0] == 'page') {
next_page = parseInt(param[1]);
break;
}
}
pagination.innerHTML = '';
function createButton(page_index, caption, position) {
var button = document.createElement('a');
var label = document.createTextNode(caption);
button.className = 'round more';
button.style.cssText = 'margin-bottom: 2em; width: auto; padding: 6px 10px; float: ' + position;
button.href = href[0] + '?page=' + page_index;
button.appendChild(label);
pagination.appendChild(button);
}
if (next_page > 2) {
createButton(next_page - 2, 'previous page', 'left');
}
createButton(next_page, 'next page', 'right');
} // if links
}
}