Skip to content

Commit

Permalink
Added support for Modern Firefox fork on 7
Browse files Browse the repository at this point in the history
- This fork doesn't change the name, doesn't add a media query, so there's no way to differentiate it from real Firefox. The code added to check for it is based on an assumption.
  • Loading branch information
angelbruni committed Feb 7, 2025
1 parent 3f16305 commit 0801aee
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 35 deletions.
32 changes: 30 additions & 2 deletions Profile Folder/chrome/JS/Geckium_utils.uc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const specialCharacters = {
// Firefox version check
const ffVersion = AppConstants.MOZ_APP_VERSION_DISPLAY;
const majorVersion = parseInt(ffVersion.split(".")[0]);
const checkedVersions = [117, 120, 122, 133, 134, 136];
const checkedVersions = [116, 117, 120, 122, 133, 134, 136];
const versionFlags = {};
checkedVersions.forEach(version => {
if (majorVersion >= version) {
Expand All @@ -43,9 +43,37 @@ function isWindows10() {
return false;
}

/**
* lookForChangesInAttributes - Used to quickly understand which attributes change after certain conditions.
*
* @elm: Element for observing.
*/
function lookForChangesInAttributes(elm) {
if (!elm || !(elm instanceof Element)) {
console.error("Invalid element provided.");
return;
}

const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.type === "attributes")
console.log(`'${mutation.attributeName}': '${mutation.oldValue}' -> '${elm.getAttribute(mutation.attributeName)}'`);
});
});

observer.observe(elm, {
attributes: true,
attributeOldValue: true
});

console.log("Started observing attributes of the element.");
return observer;
}

function getNCPatched() {
if (AppConstants.platform == "win") {
if (window.matchMedia("(-moz-ev-native-controls-patch)").matches) // Native Controls Patch
if (window.matchMedia("(-moz-ev-native-controls-patch)").matches // Native Controls Patch
|| versionFlags.is116Plus && !isWindows10()) // We are gonna assume that if the current Firefox version shouldn't be running on older Windows versions but it is, then it's a patched install.
return "patch";
else if (isWindows10() && window.matchMedia("(-moz-native-controls)").matches) // Marble
return "marble";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
appearance: none !important;
}
// Temporary fix due to Mozilla's removal of the `#titlebar` element.
&[is133Plus][isWindows10][nativeControls="win10"][sizemode="maximized"] #navigator-toolbox {
&[is133Plus][nativeControls][sizemode="maximized"] #navigator-toolbox {
appearance: -moz-window-titlebar-maximized !important;
}
// Windows 10 + Native Controls Patch quirks
Expand Down Expand Up @@ -539,25 +539,31 @@


// Titlebar styles
&[chromemargin]:not([macOSNativeFullscreen]) {
// Windows
&[gktitstyle="win"] {
@import "titlebar/borders/win";
}
// Windows 10
&[gktitstyle="win10"] {
@import "titlebar/borders/win10";
}
// Mac OS X / macOS
&[gktitstyle="macos"] {
@import "titlebar/borders/macos";
}
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
&:not([is136Plus])[tabsintitlebar],
&[is136Plus][nativeControls][tabsintitlebar],
&[is136Plus]:not([nativeControls])[customtitlebar] {
&:not([macOSNativeFullscreen]) {
// Windows
&[gktitstyle="win"] {
@import "titlebar/borders/win";
}
// Windows 10
&[gktitstyle="win10"] {
@import "titlebar/borders/win10";
}
// Mac OS X / macOS
&[gktitstyle="macos"] {
@import "titlebar/borders/macos";
}
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
}
}
}
&:not([chromemargin]), // Native (titlebar enabled)
&:not([is136Plus]):not([tabsintitlebar]), // Native (titlebar enabled)
&[is136Plus][nativeControls]:not([tabsintitlebar]),
&[is136Plus]:not([nativeControls], [customtitlebar]),
&[macOSNativeFullscreen] { //Fullscreen (macOS)
@import "titlebar/borders/native";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
}

// Updated titlebar styles
&[chromemargin]:not([macOSNativeFullscreen]) {
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
}
&:not([is136Plus])[tabsintitlebar],
&[is136Plus][nativeControls][tabsintitlebar],
&[is136Plus]:not([nativeControls])[customtitlebar] {
&:not([macOSNativeFullscreen]) {
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
}
}
}

// New and updated titlebutton styles
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Updated titlebar styles
&[chromemargin]:not([macOSNativeFullscreen]) {
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
&:not([is136Plus])[tabsintitlebar],
&[is136Plus][nativeControls][tabsintitlebar],
&[is136Plus]:not([nativeControls])[customtitlebar] {
&:not([macOSNativeFullscreen]) {
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
}

//Updated titlebar styles
&[chromemargin]:not([macOSNativeFullscreen]) {
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
&:not([is136Plus])[tabsintitlebar],
&[is136Plus][nativeControls][tabsintitlebar],
&[is136Plus]:not([nativeControls])[customtitlebar] {
&:not([macOSNativeFullscreen]) {
// Chromium OS
&[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
}

// Updated titlebar styles
&[chromemargin]:not([macOSNativeFullscreen]) {
&:not([is136Plus])[tabsintitlebar],
&[is136Plus][nativeControls][tabsintitlebar],
&[is136Plus]:not([nativeControls])[customtitlebar] {
// Chromium OS
&[gktitstyle="chromiumos"] {
&:not([macOSNativeFullscreen])[gktitstyle="chromiumos"] {
@import "titlebar/borders/chromiumos";
}
}
Expand Down

0 comments on commit 0801aee

Please sign in to comment.