Created
September 30, 2014 11:19
-
-
Save allouis/58265080df2b46ff6031 to your computer and use it in GitHub Desktop.
Github next issue
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
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