Update Wayback Machine Toolbar Toggler to 1.1.0
- Sync up the toolbar hidden state for all tabs
This commit is contained in:
parent
35231b7410
commit
f733e10bda
|
@ -4,7 +4,8 @@
|
||||||
// @match https://web.archive.org/web/*
|
// @match https://web.archive.org/web/*
|
||||||
// @grant GM.getValue
|
// @grant GM.getValue
|
||||||
// @grant GM.setValue
|
// @grant GM.setValue
|
||||||
// @version 1.0.0
|
// @grant GM_addValueChangeListener
|
||||||
|
// @version 1.1.0
|
||||||
// @author blankie
|
// @author blankie
|
||||||
// @description Replaces the "close this toolbar" button with one that lets you reopen the toolbar; its collapsed state is also saved
|
// @description Replaces the "close this toolbar" button with one that lets you reopen the toolbar; its collapsed state is also saved
|
||||||
// @inject-into page
|
// @inject-into page
|
||||||
|
@ -22,6 +23,7 @@ function hideToolbar() {
|
||||||
let openA = wmIpp.querySelector("#wmtt-open-toolbar");
|
let openA = wmIpp.querySelector("#wmtt-open-toolbar");
|
||||||
let baseHeight = wmIpp.querySelector("#donato").offsetHeight + openA.offsetHeight + (wmIpp.querySelector("#wm-ipp-inside").offsetHeight - wmIpp.querySelector("#wm-capinfo").offsetHeight);
|
let baseHeight = wmIpp.querySelector("#donato").offsetHeight + openA.offsetHeight + (wmIpp.querySelector("#wm-ipp-inside").offsetHeight - wmIpp.querySelector("#wm-capinfo").offsetHeight);
|
||||||
wmIppBase.style.height = `${baseHeight}px`;
|
wmIppBase.style.height = `${baseHeight}px`;
|
||||||
|
|
||||||
openA.style.display = "";
|
openA.style.display = "";
|
||||||
|
|
||||||
GM.setValue("autoHideToolbar", true).catch(function(error) {
|
GM.setValue("autoHideToolbar", true).catch(function(error) {
|
||||||
|
@ -91,7 +93,18 @@ function handleWmIpp() {
|
||||||
hideToolbar();
|
hideToolbar();
|
||||||
}
|
}
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
console.log("Failed to fetch autoHideToolbar:", error);
|
console.error("Failed to fetch autoHideToolbar:", error);
|
||||||
|
});
|
||||||
|
GM_addValueChangeListener("autoHideToolbar", function(name, oldValue, autoHideToolbar, remote) {
|
||||||
|
if (!remote) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (autoHideToolbar) {
|
||||||
|
hideToolbar();
|
||||||
|
} else {
|
||||||
|
showToolbar();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue