Skip to content

Commit

Permalink
Working Go button
Browse files Browse the repository at this point in the history
  • Loading branch information
aubymori committed Feb 4, 2024
1 parent 9e7cfa9 commit 27154ba
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 25 deletions.
15 changes: 15 additions & 0 deletions Echelon/Profile Folder/chrome/Echelon.urlBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -522,4 +522,19 @@
}
#main-window[echelon-style-3]:is([echelon-style-3]) #navigator-toolbox::after {
background-color: rgb(170, 188, 207) !important;
}

/* Go button */
#go-button {
display: none !important;
}
#reload-button:not([displaystop]) + #go-button + #stop-button {
display: none !important;
}

#urlbar-container[focused] + #stop-reload-button > #reload-button {
display: none !important;
}
#urlbar-container[focused] + #stop-reload-button > #reload-button:not([displaystop]) + #go-button {
display: flex !important;
}
44 changes: 32 additions & 12 deletions Echelon/Profile Folder/chrome/JS/echelon_go_button.uc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,36 @@
// @include main
// ==/UserScript==

// {
// var { waitForElement } = ChromeUtils.import("chrome://userscripts/content/echelon_utils.uc.js");
// waitForElement = waitForElement.bind(window);
{
var { waitForElement } = ChromeUtils.import("chrome://userscripts/content/echelon_utils.uc.js");
waitForElement = waitForElement.bind(window);

// waitForElement("#stop-reload-button").then((e) => {
// let goButton = window.MozXULElement.parseXULToFragment(`
// <toolbarbutton id="go-button" class="toolbarbutton-1" onclick="gURLBar.handleCommand(event);" tooltiptext="Go to the address in the Location Bar" label="Go">
// <image class="toolbarbutton-icon" label="Go"/>
// </toolbarbutton>
// `);
// e.insertBefore(goButton, e.querySelector("#stop-button"));
// });
// }
waitForElement("#stop-reload-button").then((e) => {
let goButton = window.MozXULElement.parseXULToFragment(`
<toolbarbutton id="go-button" class="toolbarbutton-1" onclick="gURLBar.handleCommand(event);" tooltiptext="Go to the address in the Location Bar" label="Go">
<image class="toolbarbutton-icon" label="Go"/>
</toolbarbutton>
`);
e.insertBefore(goButton, e.querySelector("#stop-button"));
});

let urlbar = null;

function onUrlbarFocusChange(list)
{
if (urlbar.hasAttribute("focused"))
{
urlbar.parentNode.setAttribute("focused", "true");
}
else
{
urlbar.parentNode.removeAttribute("focused");
}
}

waitForElement("#urlbar").then(e => {
urlbar = e;
let observer = new MutationObserver(onUrlbarFocusChange);
observer.observe(e, { attributes: true, attributeFilter: ["focused"] });
});
}
26 changes: 13 additions & 13 deletions Echelon/Profile Folder/chrome/echelon-scss-src/Echelon.urlBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -564,19 +564,19 @@
}
}

// /* Go button */
// #go-button {
// display: none !important;
/* Go button */
#go-button {
display: none !important;

// #reload-button:not([displaystop]) + & + #stop-button {
// display: none !important;
// }
// }
#reload-button:not([displaystop]) + & + #stop-button {
display: none !important;
}
}

// #nav-bar[urlbar-exceeds-toolbar-bounds="true"] #stop-reload-button > #reload-button {
// display: none !important;
#urlbar-container[focused] + #stop-reload-button > #reload-button {
display: none !important;

// &:not([displaystop]) + #go-button {
// display: flex !important;
// }
// }
&:not([displaystop]) + #go-button {
display: flex !important;
}
}

0 comments on commit 27154ba

Please sign in to comment.