Created
August 7, 2015 13:49
-
-
Save herejia/6d30c61febef4c1d5877 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name scroll bottom | |
// @namespace net.herezia | |
// @include http://srv-hudson:8080/job/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var intervalId = null; | |
var button = document.createElement('input'); | |
with(button) { | |
setAttribute('value', 'Auto-scroll bottom'); | |
setAttribute('type', 'button'); | |
setStyle('position: fixed; z-index: 1000; top: 0; right: 0'); | |
} | |
button.addEventListener('click', function() { | |
if (!intervalId) { | |
intervalId = setInterval(function() { window.scrollTo(0, document.getElementById('main-panel-content').offsetHeight); }, 500); | |
button.setValue('Stop'); | |
} else { | |
button.setValue('Start'); | |
clearInterval(intervalId); | |
intervalId = null; | |
} | |
}); | |
document.getElementsByTagName('body')[0].appendChild(button); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment