Skip to content

Commit

Permalink
Possible fix (need to clean up)
Browse files Browse the repository at this point in the history
  • Loading branch information
p1usminus committed May 27, 2023
1 parent 341f490 commit a7cbab9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
25 changes: 20 additions & 5 deletions src/content/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,20 @@
},

resizeOptions: function() {
let options = document.getElementById("roomybookmarkstoolbarPreferences");
let options = document.getElementById("roomybookmarkstoolbarPreferences");
let pl = parseInt(getComputedStyle(options).getPropertyValue("-moz-padding-start"), 10);
let pr = parseInt(getComputedStyle(options).getPropertyValue("-moz-padding-end"), 10);
window.requestAnimationFrame(() => {
window.resizeTo(document.getElementById("roomybookmarkstoolbarTabBox").scrollWidth+pl+pr, window.outerHeight); // this works!
});
options.addEventListener("dialogextra1", function(event) {
window.resizeBy(20,0);
//window.resizeBy(20,0);
//window.resizeTo(options.clientWidth+50, window.outerHeight); //document.getElementById("roomybookmarkstoolbarPreferences").clientHeight
window.resizeTo(document.getElementById("roomybookmarkstoolbarTabBox").scrollWidth+pl+pr, window.outerHeight);
//window.resizeTo(options.clientWidth+pl+pr, window.outerHeight); // works but dialog box grows with every button click ???
//window.resizeTo(options.scrollWidth, window.outerHeight); //scrollWidth almost works
console.log("Window width: "+window.outerWidth);
//console.log(getComputedStyle(options));
//console.log("Tabpanel width: "+options.width);
console.log("Dialog width: "+options.clientWidth);
});
Expand All @@ -120,9 +130,14 @@
this.location();
this.resizeOptions();
Preferences.forceEnableInstantApply();
console.log(window);
console.log(window.outerWidth);
window.sizeToContent();
//console.log(window); // too much information
//console.log(window.outerWidth); // = 1
//console.log(window.clientWidth); // = undefined
//console.log(document.getElementById("roomybookmarkstoolbarPreferences")); // initially clientWidth = scrollWidth = 0, but when opened again, clientWidth = 518, scrollWidth = 526
// console.log(document.getElementById("roomybookmarkstoolbarTabBox")); // clientWidth = 500, scrollWidth = 518
// I think 18 pixel difference between dialog and TabBox = 10px padding-left, 8px padding-right or paddingInlineStart/End
//console.log(document.getElementById("roomybookmarkstoolbar.options.tab1")); // clientWidth = scrollWidth = 150, the width of the actual tab at the top, cannot use this
//window.sizeToContent();
/* window.requestAnimationFrame(() => {
window.sizeToContent();
}); */
Expand Down
11 changes: 6 additions & 5 deletions src/content/options.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
buttonlabelextra1="Resize"
resizable="yes"
flex="1"
style="padding-left:50px; padding-right:50px"

This comment has been minimized.

Copy link
@p1usminus

p1usminus May 28, 2023

Author Owner

Alternative fix: set padding-left/right: 0px

I think -moz-padding-start/end is more 'correct' as the layout is inline

xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

Expand All @@ -29,7 +30,7 @@
<tabpanel id="roomybookmarkstoolbar.options.tab1" orient="vertical">
<html:fieldset>
<html:legend>&roomybookmarkstoolbar.options.multirowBarGroup.label;</html:legend>
<vbox flex="1">
<vbox>
<hbox>
<checkbox preference="extensions.roomybookmarkstoolbar.multirowBar" id="multirowBarPerf" label="&roomybookmarkstoolbar.options.multirowEnable.label;" oncommand="roomybookmarkstoolbarOptions.location()"/>
<html:span>&roomybookmarkstoolbar.options.opacityIn.label; </html:span>
Expand All @@ -45,7 +46,7 @@

<html:fieldset>
<html:legend>&roomybookmarkstoolbar.options.timeGroup.label;</html:legend>
<vbox flex="1">
<vbox>
<hbox><html:span id="autoHideBarDisabled"></html:span></hbox>
<hbox>
<checkbox preference="extensions.roomybookmarkstoolbar.autoHideBar" id="autoHideBarPerf" label="&roomybookmarkstoolbar.options.autohideBar.label;" oncommand="roomybookmarkstoolbarOptions.autoHideBar(); roomybookmarkstoolbarOptions.autoHideZone();" />
Expand Down Expand Up @@ -88,14 +89,14 @@
</html:fieldset>
<html:fieldset>
<html:legend>&roomybookmarkstoolbar.options.location.label;</html:legend>
<vbox flex="1">
<vbox>
<checkbox preference="extensions.roomybookmarkstoolbar.bookmarksAboveTab" id="bookmarksAboveTabPerf" label="&roomybookmarkstoolbar.options.bookmarksAboveTab.label;" disabled="false" oncommand="roomybookmarkstoolbarOptions.topOnPage()" />
<checkbox preference="extensions.roomybookmarkstoolbar.overPage" id="overPagePerf" label="&roomybookmarkstoolbar.options.overPage.label;" disabled="false" oncommand="roomybookmarkstoolbarOptions.topOnPage()" />
</vbox>
</html:fieldset>
<html:fieldset>
<html:legend>&roomybookmarkstoolbar.options.alignment.label;</html:legend>
<vbox flex="1">
<vbox>
<hbox>
<radiogroup preference="extensions.roomybookmarkstoolbar.location" id="locationPerf" orient="horizontal" disabled="false">
<radio id="location0" value="0" label="&roomybookmarkstoolbar.options.alignment0.label;" />
Expand All @@ -107,7 +108,7 @@
</html:fieldset>
<html:fieldset>
<html:legend>Misc - restart required</html:legend>
<vbox flex="1">
<vbox>
<checkbox preference="extensions.roomybookmarkstoolbar.hide_warning" id="hideWarning" label="Hide unsigned addon warning in about:addons" />
</vbox>
</html:fieldset>
Expand Down

0 comments on commit a7cbab9

Please sign in to comment.