Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
AdminerRestoreMenuScroll plugin for Adminer
/** Remembers and restores scollbar position of side menu
* @author Jiří @NoxArt Petruželka,
* @license Apache License, Version 2.0
* @license GNU General Public License, version 2 (one or other)
class AdminerRestoreMenuScroll {
protected $script;
* @param string text to append before first calendar usage
public function __construct($script = "<script type='text/javascript'>\n(function(){\nvar executed = false;\nvar saveAndRestore = function() {\nif( executed ) {\nreturn;\n}\n
executed = true;\nvar menu = document.getElementById('menu');\nvar scrolled = localStorage.getItem('_adminerScrolled');\nif( scrolled && scrolled >= 0 ) {\nmenu.scrollTop = scrolled;\n}\n
window.addEventListener('unload', function(){\nlocalStorage.setItem('_adminerScrolled', menu.scrollTop);\n});\n};\ndocument.addEventListener && document.addEventListener('DOMContentLoaded', saveAndRestore);\ndocument.attachEvent && document.attachEvent('onreadystatechange', saveAndRestore);\n})();\n</script>")
$this->script = $script;
public function head()
echo $this->script;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.