forked from I2P_Developers/i2p.i2p
i2ptunnel, SusiDNS: Replace onblur with CSP-safe js
This commit is contained in:
@ -1,3 +1,21 @@
|
||||
function initResetScroll()
|
||||
{
|
||||
var buttons = document.getElementsByClassName("resetScrollLeft");
|
||||
for(index = 0; index < buttons.length; index++)
|
||||
{
|
||||
var button = buttons[index];
|
||||
addBlurHandler(button);
|
||||
}
|
||||
}
|
||||
|
||||
function addBlurHandler(elem)
|
||||
{
|
||||
elem.addEventListener("blur", function() {
|
||||
resetScrollLeft(elem);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// resets scroll position of element
|
||||
// use with onblur to clear scroll position when element loses focus
|
||||
|
||||
@ -9,7 +27,11 @@ function resetScrollLeft(element) {
|
||||
}
|
||||
|
||||
// reset scroll to top position
|
||||
|
||||
// unused
|
||||
function resetScrollTop(element) {
|
||||
element.scrollTop = 0;
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
initResetScroll();
|
||||
}, true);
|
||||
|
Reference in New Issue
Block a user