Skip to content

Commit

Permalink
(JS) minor refactor, update a few scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
aminomancer committed May 16, 2022
1 parent 21e5576 commit ab28612
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 285 deletions.
29 changes: 20 additions & 9 deletions JS/allTabsMenuExpansionPack.uc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name All Tabs Menu Expansion Pack
// @version 2.0.5
// @version 2.0.6
// @author aminomancer
// @homepage https://github.com/aminomancer
// @description Next to the "new tab" button in Firefox there's a V-shaped button that opens a
Expand Down Expand Up @@ -796,8 +796,7 @@
(AppConstants.platform == "win" || AppConstants.platform == "macosx")
) {
delete tab.noCanvas;
let windowUtils = window.windowUtils;
let scale = windowUtils.screenPixelsPerCSSPixel / windowUtils.fullZoom;
let scale = window.devicePixelRatio;
let canvas = this._dndCanvas;
if (!canvas) {
this._dndCanvas = canvas = document.createElementNS(
Expand Down Expand Up @@ -938,7 +937,7 @@
box-shadow: none;
-moz-box-align: center;
padding-inline-end: 2px;
overflow-x: -moz-hidden-unscrollable;
overflow: hidden;
position: relative;
}
.panel-subview-body > .all-tabs-item .all-tabs-button:not([disabled], [open]):focus {
Expand All @@ -957,7 +956,7 @@
.panel-subview-body > .all-tabs-item[selected] {
font-weight: normal;
background-color: var(--arrowpanel-dimmed-further) !important;
--main-stripe-color: var(--arrowpanel-dimmed-even-further);
--main-stripe-color: var(--panel-item-active-bgcolor);
}
.panel-subview-body > .all-tabs-item .all-tabs-button {
min-height: revert;
Expand Down Expand Up @@ -1121,20 +1120,20 @@
border-image: linear-gradient(
to right,
transparent,
var(--arrowpanel-dimmed-even-further) 1%,
var(--arrowpanel-dimmed-even-further) 25%,
var(--panel-item-active-bgcolor) 1%,
var(--panel-item-active-bgcolor) 25%,
transparent 90%
);
border-image-slice: 1;
opacity: 1;
}
.panel-subview-body > .all-tabs-item[dragpos="before"]::before {
inset-block-start: 0;
border-top: 1px solid var(--arrowpanel-dimmed-even-further);
border-top: 1px solid var(--panel-item-active-bgcolor);
}
.panel-subview-body > .all-tabs-item[dragpos="after"]::before {
inset-block-end: 0;
border-bottom: 1px solid var(--arrowpanel-dimmed-even-further);
border-bottom: 1px solid var(--panel-item-active-bgcolor);
}
.panel-subview-body
> .all-tabs-item[pinned]
Expand All @@ -1145,6 +1144,18 @@
padding-inline-start: 20px;
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
}
#places-tooltip-insecure-icon {
-moz-context-properties: fill;
fill: currentColor;
width: 1em;
height: 1em;
margin-inline-start: 0;
margin-inline-end: .2em;
min-width: 1em !important;
}
#places-tooltip-insecure-icon[hidden] {
display: none;
}`;
let sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(
Ci.nsIStyleSheetService
Expand Down
10 changes: 3 additions & 7 deletions JS/restorePreProtonLibraryButton-standalone.uc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions JS/restorePreProtonLibraryButton.uc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Restore pre-Proton Library Button
// @version 1.2
// @version 1.2.1
// @author aminomancer
// @homepage https://github.com/aminomancer/uc.css.js
// @description The library toolbar button used to have an animation that played when a bookmark was added. It's another casualty of the proton updates. This script restores the library button animation in its entirety, with one small change. The library animation always looked just a tiny bit off for certain window scaling factors — the animation would appear about half a pixel from where the static icon is, causing it to appear to move when the animation finishes. In order to fix this in my version of the animation, I added some constants at the top of the script (allowScalingFix and forceScalingFix) that will adjust the icon if enabled. I don't know exactly which scaling factors or OSes have this problem, but 150% scaling on Windows 10 definitely has it. So by default the script will only enable the scaling fix if the OS is Windows and the scaling factor is 1.5. However, if you notice that you have the scaling bug too, you can toggle "forceScalingFix" to true and it will adjust the icon regardless of your OS or scaling factor. Conversely, if you're using 150% scaling on Windows but for whatever reason the scaling fix is making it look worse somehow, toggling "allowScalingFix" to false will turn the feature off entirely. This version of the script requires fx-autoconfig, userChrome.au.css, and the resources folder from my repo. If you don't want to use all that stuff, grab the standalone version instead.
Expand All @@ -14,9 +14,9 @@
constructor() {
if (
allowScalingFix &&
(forceScalingFix || (this.scalingFactor === 1.5 && this.OS === "WINNT"))
(forceScalingFix || (window.devicePixelRatio === 1.5 && this.OS === "WINNT"))
)
this.libButtonFragOrNode.setAttribute("scaling", this.scalingFactor);
this.libButtonFragOrNode.setAttribute("scaling", window.devicePixelRatio);
this._libraryButtonAnimationEndListeners = {};
this._windowResizeRunning = false;
this.animBox = document.createXULElement("box");
Expand All @@ -28,10 +28,6 @@
document.getElementById("nav-bar").appendChild(this.animBox);
}

get scalingFactor() {
return windowUtils.screenPixelsPerCSSPixel;
}

get OS() {
return Services.appinfo.OS;
}
Expand Down
Loading

0 comments on commit ab28612

Please sign in to comment.