viewHistorySidebar
29 lines
// mozilla.cfg file needs to start with a comment line
// mozilla.cfg file needs to start with a comment line
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Services.obs.addObserver(function (aSubject, aTopic, aData) {
Services.obs.addObserver(function (aSubject, aTopic, aData) {
var chromeWindow = aSubject;
var chromeWindow = aSubject;
chromeWindow.setTimeout(function () {
chromeWindow.setTimeout(function () {
try {
try {
if (chromeWindow.userChromeJsTweak) return;
if (chromeWindow.userChromeJsTweak) return;
chromeWindow.userChromeJsTweak = true;
chromeWindow.userChromeJsTweak = true;
chromeWindow.SidebarUI.browser.addEventListener("load", function onLoad(aEvent) {
chromeWindow.SidebarUI.browser.addEventListener("load", function onLoad(aEvent) {
var win = aEvent.currentTarget.ownerGlobal;
var win = aEvent.currentTarget.ownerGlobal;
if (win.SidebarUI.currentID === "viewHistorySidebar") {
if (win.SidebarUI.currentID === "viewHistorySidebar") {
win.setTimeout(function () {
win.setTimeout(function () {
var tree = win.SidebarUI.browser.contentWindow.gHistoryTree;
var tree = win.SidebarUI.browser.contentWindow.gHistoryTree;
if (tree) {
if (tree) {
for (var i = 0; i < tree.view.rowCount; i++) {
for (var i = 0; i < tree.view.rowCount; i++) {
if (tree.view.isContainer(i) && !tree.view.isContainerOpen(i)) {
if (tree.view.isContainer(i) && !tree.view.isContainerOpen(i)) {
tree.view.toggleOpenState(i);
var text = tree.view.getCellText(i, tree.columns.getColumnAt(0));
if (text === "Today" || text === "Yesterday") {
tree.view.toggleOpenState(i);
}
}
}
}
}
}
}
}, 1000);
}, 1000);
}
}
}, true);
}, true);
} catch (aError) {
} catch (aError) {
Components.utils.reportError(aError); // [check] Show Content Messages
Components.utils.reportError(aError); // [check] Show Content Messages
}
}
}, 10);
}, 10);
}, "browser-delayed-startup-finished", false);
}, "browser-delayed-startup-finished", false);