War & PoliticsBrexit deal nigh or nyet?

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Peter (BOUGHTONP)  
 To:  Manthorp     
42264.191 In reply to 42264.189 
> The Live posts are again chronological, but in pages so you have to click on at the bottom of each one

No, they're backwards. It's not chronological is you don't start at the beginning. :@

Anyway, I made a script to grab all the pages and reverse the order - browse to the first live page, open the console, paste the following script, hit return, and when it's done it'll scroll to the first entry. If I could be arsed I'd probably make it a GreaseMonkey script or something.

(function fixGuardianLive()
{
	var BlockSelector = '.blocks';
	var NavSelector = '.liveblog-navigation__link[data-link-name="older page"]';

	var Blocks = document.querySelector(BlockSelector);
	var FixedBlocks = [];

	appendBlocks(Blocks.children);
	http_get( document.querySelector(NavSelector).attributes.href.value , addNextPage );


	function complete()
	{
		Blocks.innerHTML = FixedBlocks.reverse().join() ;
		Blocks.children[0].scrollIntoView();
	}
	
	function appendBlocks(Items)
	{
		for ( var c = 0 ; c < Items.length ; ++c )
			FixedBlocks.push( Items[c].outerHTML );
	}

	function addNextPage()
	{
		if ( this.status !== 200 )
		{
			console.error('Failed to append next page')
			console.log(this);
			return;
		}

		var Content = document.createElement('div');
		Content.innerHTML = this.responseText;

		appendBlocks( Content.querySelector(BlockSelector).children );

		var NextPageUrl = Content.querySelector(NavSelector).attributes.href;

		if ( typeof NextPageUrl !== 'undefined' )
		{
			http_get( NextPageUrl.value , this.onload );
		}
		else
		{
			complete();
		}
	};

	function http_get(url,onload)
	{
		var request = new XMLHttpRequest();
		request.open('GET',url,true);
		request.onload = onload;
		request.onerror = function(){console.error('Connection error');console.log(this);};
		request.send();
	}
})()
0/0
 Reply   Quote More 

Reply to All    
 

1–20  …  141–160  161–180  181–191

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2019 Project Beehive Forum

Forum Stats