Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Last active January 2, 2016 15:49
Show Gist options
  • Save commuterjoy/8325989 to your computer and use it in GitHub Desktop.
Save commuterjoy/8325989 to your computer and use it in GitHub Desktop.
benchmark next-gen from r2
// Next-gen performance benchmark - https://gist.github.com/commuterjoy/8325989
jQ(document).ready(function () {
if ( s
&& (s.prop67 === "nextgen-compatible")
) {
jQ.get(location.pathname + '?view=mobile');
try {
var nextGenNavigation = 'http://api.nextgen.guardianapps.co.uk';
var edition = guardian.page.edition.toLowerCase();
var section = guardian.page.contentId.split("/")[1];
var path = location.pathname;
jQ.get(nextGenNavigation + '/top-stories/trails.json?page-size=10&view=link&_edition='+edition);
// Stop us requesting 'most-read' sections that don't exist
if (/profile|tone|undefined|global|identity|most-read/.test(section)) {
return;
}
jQ.get(nextGenNavigation + '/most-read/'+section+'.json?_edition='+edition);
} catch(e) {
console.log('next-gen-performance-benchmark', e);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment