Skip to content

Instantly share code, notes, and snippets.

@cherenkov
Created June 16, 2009 10:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cherenkov/130635 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name remember sidebar scroll position
// @namespace http://d.hatena.ne.jp/Cherenkov/
// @description http://d.hatena.ne.jp/Cherenkov/20090616/p1
// @include chrome://browser/content/bookmarks/bookmarksPanel.xul
// ==/UserScript==
(function(){
var gPrefService = Components.classes[
"@mozilla.org/preferences-service;1"].
getService( Components.interfaces.nsIPrefBranch);
document.getElementById("bookmarks-view-children").addEventListener("scroll", function() {
var getRow = document.getElementById("bookmarks-view").boxObject.getFirstVisibleRow();
gPrefService.setIntPref("userChrome.bookmarksPanel.rowPosition", getRow);
},false);
var pos = gPrefService.getIntPref("userChrome.bookmarksPanel.rowPosition");
document.getElementById("bookmarks-view").boxObject.scrollToRow(pos);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment