Skip to content

Instantly share code, notes, and snippets.

@allouis
Created September 30, 2014 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allouis/58265080df2b46ff6031 to your computer and use it in GitHub Desktop.
Save allouis/58265080df2b46ff6031 to your computer and use it in GitHub Desktop.
Github next issue
var nextButtonHTML = '<button type="button" class="minibutton js-next-issue">Next</button>';
var buttonsContainer = document.querySelector('.gh-header-actions');
var currentURL = window.location.href;
var parts = currentURL.split('/');
parts[parts.length - 1]--; // next issue - but going back because usually start at the end
var nextURL = parts.join('/');
buttonsContainer.innerHTML += nextButtonHTML;
var nextButton = buttonsContainer.querySelector('.js-next-issue');
nextButton.addEventListener('click', function () {
window.location.href = nextURL;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment