Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
Fix JS Loader issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Izheil committed Apr 12, 2022
1 parent a8675fe commit 4d6402f
Show file tree
Hide file tree
Showing 210 changed files with 4,425 additions and 1,834 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// @namespace https://github.com/Izheil/Quantum-Nox-Firefox-Dark-Full-Theme
// @description Multi-row tabs draggability fix with autohiding scrollbar
// @include main
// @compatibility Firefox 70 to Firefox 94.0a1 (2021-09-14)
// @compatibility Firefox 70 to Firefox 101.0a1 (2022-04-08)
// @author Alice0775, Endor8, TroudhuK, Izheil, Merci-chao
// @version 12/04/2022 05:40 Min/Max/Close buttons resizing fix
// @version 22/01/2022 16:50 Tab sizing fixes
// @version 02/11/2021 03:15 Made pinned tabs to not have forced Proton sizing
// @version 15/09/2021 11:39 Added experimental support for tab sizing below 20px
Expand Down Expand Up @@ -136,9 +137,13 @@ function zzzz_MultiRowTabLite() {
--toolbarbutton-inner-padding: inherit !important;
}
.titlebar-buttonbox .titlebar-button {
padding-top: 8px !important;
padding-bottom: 8px !important;
/* Sizing of the titlebar buttons */
.titlebar-buttonbox {
height: var(--tab-min-height) !important;
}
.titlebar-buttonbox-container {
display: block !important;
}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
// @namespace https://github.com/Izheil/Quantum-Nox-Firefox-Dark-Full-Theme
// @description Multi-row tabs draggability fix with scrollable rows
// @include main
// @compatibility Firefox 70 to Firefox 94.0a1 (2021-09-14)
// @compatibility Firefox 70 to Firefox 101.0a1 (2022-04-08)
// @author Alice0775, Endor8, TroudhuK, Izheil, Merci-chao
// @version 22/01/2022 16:50 Tab sizing fixes
// @version 02/11/2021 03:15 Made pinned tabs to not have forced Proton sizing
// @version 12/04/2022 05:40 Min/Max/Close buttons resizing fix
// @version 15/09/2021 11:39 Added experimental support for tab sizing below 20px
// @version 10/09/2021 09:49 Fixed regression of pinned tabs icon showing unaligned
// @version 19/08/2021 03:15 Compatibility fix for FF91
Expand Down Expand Up @@ -122,36 +121,27 @@ function zzzz_MultiRowTabLite() {
}
/* These below control the padding of the new tab button and min/max/close buttons respectively.
YOU DON'T NEED TO CHANGE THESE unless you want to use values of --tab-min-height lower than 20px.
Before changing them, you need to UNCOMMENT the 2 rules below for them TO TAKE EFFECT.
The first rule (#TabsToolbar) controls the padding around the "new tab" button. Make sure to always use "px"
as unit for it to work, even on 0 value. Reducing it will allow a lower limit on the tabs height.
The second rule (.titlebar-buttonbox) has paddings control the padding of the min/max/close buttons.
Changing these are required if you want the tab bar to be smaller when having 1 row. */
YOU DON'T NEED TO CHANGE THESE unless you want to use values of --tab-min-height lower than 20px.
Before changing them, you need to UNCOMMENT the 2 rules below for them TO TAKE EFFECT. */
/*
#TabsToolbar {
--toolbarbutton-inner-padding: inherit !important;
}
.titlebar-buttonbox .titlebar-button {
padding-top: 8px !important;
padding-bottom: 8px !important;
/* Sizing of the titlebar buttons */
.titlebar-buttonbox {
height: var(--tab-min-height) !important;
}
*/
/*-------- Don't edit past here unless you know what you are doing --------*/
/* These 2 rules are a fix to make sure that tabs become smaller on smaller --tab-min-height values */
.tabbrowser-tab {
max-height: calc(var(--tab-min-height) + var(--toolbarbutton-inner-padding)) !important;
.titlebar-buttonbox-container {
display: block !important;
}
.toolbar-items {-moz-box-align: start !important}
*/
/*-------- Don't edit past here unless you know what you are doing --------*/
/* Common multirow code */
#navigator-toolbox:-moz-lwtheme {
background-color: var(--toolbar-bgcolor) !important;
}
Expand Down Expand Up @@ -192,7 +182,7 @@ function zzzz_MultiRowTabLite() {
/* A fix for pinned tabs triggering another row when only pinned tabs are shown in a row */
.tabbrowser-tab[pinned] {
max-height: calc(var(--tab-min-height) + 8px);
height: calc(var(--tab-min-height) + 8px) !important;
}
/* This fixes the new tab button overflowing to the new row alone */
Expand Down Expand Up @@ -243,6 +233,8 @@ function zzzz_MultiRowTabLite() {
tabsHavePadding = true;
}

console.log(getComputedStyle(tabBackground).getPropertyValue('--tab-block-margin').substring(0,1))

// Here the FF71+ changes
if (document.querySelector("#tabbrowser-tabs > arrowscrollbox").shadowRoot) {

Expand Down Expand Up @@ -281,7 +273,7 @@ function zzzz_MultiRowTabLite() {
`;

// This is a fix for FF89+ (Proton)
if (document.documentElement.hasAttribute("proton") || tabsHavePadding) {
if (tabsHavePadding) {
style.innerHTML += `
scrollbox {
max-height: calc((var(--tab-min-height) + 8px) * var(--max-tab-rows));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
// @namespace https://github.com/Izheil/Quantum-Nox-Firefox-Dark-Full-Theme
// @description Multi-row tabs draggability fix with unlimited rows
// @include main
// @compatibility Firefox 70 to Firefox 94.0a1 (2021-09-14)
// @compatibility Firefox 70 to Firefox 101.0a1 (2022-04-08)
// @author Alice0775, Endor8, TroudhuK, Izheil, Merci-chao
// @version 12/04/2022 05:40 Min/Max/Close buttons resizing fix
// @version 22/01/2022 16:50 Tab sizing fixes
// @version 02/11/2021 03:15 Made pinned tabs to not have forced Proton sizing
// @version 15/09/2021 11:39 Added experimental support for tab sizing below 20px
Expand Down Expand Up @@ -109,9 +110,13 @@ function zzzz_MultiRowTabLite() {
--toolbarbutton-inner-padding: inherit !important;
}
.titlebar-buttonbox .titlebar-button {
padding-top: 8px !important;
padding-bottom: 8px !important;
/* Sizing of the titlebar buttons */
.titlebar-buttonbox {
height: var(--tab-min-height) !important;
}
.titlebar-buttonbox-container {
display: block !important;
}
*/
Expand Down
28 changes: 23 additions & 5 deletions Installers/Multirow & other functions/root/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
// skip 1st line
lockPref('xpinstall.signatures.required', false);

Object = Cu.getGlobalForObject(Cu).Object;
const { freeze } = Object;
Object.freeze = obj => {
if (Components.stack.caller.filename != 'resource://gre/modules/AppConstants.jsm')
return freeze(obj);

obj.MOZ_REQUIRE_SIGNING = false;
Object.freeze = freeze;
return freeze(obj);
}

try {

let Cu = Components.utils;
Cu.import('resource://gre/modules/osfile.jsm');
Cu.import(OS.Path.toFileURI(OS.Constants.Path.profileDir)+ '/chrome/utils/boot.jsm');
let cmanifest = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('UChrm', Ci.nsIFile);
cmanifest.append('utils');
cmanifest.append('chrome.manifest');
Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(cmanifest);

} catch(ex) {};
Cu.import('chrome://userchromejs/content/BootstrapLoader.jsm');
} catch (ex) {};

try {
Cu.import('chrome://userchromejs/content/userChrome.jsm');
} catch (ex) {};
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pref("general.config.obscure_value", 0);
pref("general.config.filename", "config.js");
pref("general.config.sandbox_enabled", false);
pref("general.config.sandbox_enabled", false);
14 changes: 0 additions & 14 deletions Installers/Multirow & other functions/utils/boot.jsm

This file was deleted.

86 changes: 50 additions & 36 deletions Installers/Multirow & other functions/utils/userChrome.jsm
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
let EXPORTED_SYMBOLS = [];

const {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
const {xPref} = ChromeUtils.import('chrome://userchromejs/content/xPref.jsm');

let UC = {};
const { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm');
const { xPref } = ChromeUtils.import('chrome://userchromejs/content/xPref.jsm');
const { Management } = ChromeUtils.import('resource://gre/modules/Extension.jsm');
const { AppConstants } = ChromeUtils.import('resource://gre/modules/AppConstants.jsm');

let UC = {
webExts: new Map(),
sidebar: new Map()
};

let _uc = {
ALWAYSEXECUTE: 'userChrome.uc.js',
BROWSERCHROME: 'chrome://browser/content/browser.xhtml',
BROWSERCHROME: AppConstants.MOZ_APP_NAME == 'thunderbird' ? 'chrome://messenger/content/messenger.xhtml' : 'chrome://browser/content/browser.xhtml',
BROWSERTYPE: AppConstants.MOZ_APP_NAME == 'thunderbird' ? 'mail:3pane' : 'navigator:browser',
BROWSERNAME: AppConstants.MOZ_APP_NAME.charAt(0).toUpperCase() + AppConstants.MOZ_APP_NAME.slice(1),
PREF_ENABLED: 'userChromeJS.enabled',
PREF_SCRIPTSDISABLED: 'userChromeJS.scriptsDisabled',
BASE_FILEURI: Services.io.getProtocolHandler('file').QueryInterface(Ci.nsIFileProtocolHandler).getURLSpecFromDir(Services.dirsvc.get('UChrm', Ci.nsIFile)),

chromedir: Services.dirsvc.get('UChrm', Ci.nsIFile),
scriptsDir: '',

sss: Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService),

getScripts: function () {
Expand All @@ -24,8 +32,7 @@ let _uc = {
let fileURI = Services.io.newFileURI(file);
if (/\.uc\.js$/i.test(file.leafName)) {
_uc.getScriptData(file);
}
else if(/\.as\.css$/i.test(file.leafName)) {
} else if(/\.as\.css$/i.test(file.leafName)) {
if(!sss.sheetRegistered(fileURI, sss.AGENT_SHEET))
sss.loadAndRegisterSheet(fileURI, sss.AGENT_SHEET);
}
Expand Down Expand Up @@ -55,9 +62,8 @@ let _uc = {
return this.scripts[filename] = {
filename: filename,
file: aFile,
url: this.BASE_FILEURI + filename,
url: Services.io.getProtocolHandler('file').QueryInterface(Ci.nsIFileProtocolHandler).getURLSpecFromDir(this.chromedir) + filename,
name: (header.match(/\/\/ @name\s+(.+)\s*$/im) || def)[1],
charset: (header.match(/\/\/ @charset\s+(.+)\s*$/im) || def)[1],
description: (header.match(/\/\/ @description\s+(.+)\s*$/im) || def)[1],
version: (header.match(/\/\/ @version\s+(.+)\s*$/im) || def)[1],
author: (header.match(/\/\/ @author\s+(.+)\s*$/im) || def)[1],
Expand Down Expand Up @@ -109,11 +115,8 @@ let _uc = {
}

try {
if (script.charset) {
Services.scriptloader.loadSubScript(script.url + '?' + script.file.lastModifiedTime, win, script.charset);
} else {
Services.scriptloader.loadSubScript(script.url + '?' + script.file.lastModifiedTime, win, 'UTF-8');
}
Services.scriptloader.loadSubScript(script.url + '?' + script.file.lastModifiedTime,
script.onlyonce ? { window: win } : win);
script.isRunning = true;
if (script.startup) {
eval(script.startup);
Expand All @@ -122,12 +125,12 @@ let _uc = {
this.everLoaded.push(script.id);
}
} catch (ex) {
this.error(script.filename, ex);
Cu.reportError(ex);
}
},

windows: function (fun, onlyBrowsers = true) {
let windows = Services.wm.getEnumerator(onlyBrowsers ? 'navigator:browser' : null);
let windows = Services.wm.getEnumerator(onlyBrowsers ? this.BROWSERTYPE : null);
while (windows.hasMoreElements()) {
let win = windows.getNext();
if (!win._uc)
Expand Down Expand Up @@ -156,16 +159,6 @@ let _uc = {
el.setAttribute(att, atts[att]);
}
return el
},

error: function (aMsg, err) {
let error = Cc['@mozilla.org/scripterror;1'].createInstance(Ci.nsIScriptError);
if (typeof err == 'object') {
error.init(aMsg + '\n' + err.name + ' : ' + err.message, err.fileName || null, null, err.lineNumber, null, 2, err.name);
} else {
error.init(aMsg + '\n' + err + '\n', null, null, null, null, 2, null);
}
Services.console.logMessage(error);
}
};

Expand All @@ -177,12 +170,7 @@ if (xPref.get(_uc.PREF_SCRIPTSDISABLED) === undefined) {
xPref.set(_uc.PREF_SCRIPTSDISABLED, '', true);
}

function UserChrome_js() {
_uc.getScripts();
Services.obs.addObserver(this, 'chrome-document-global-created', false);
}

UserChrome_js.prototype = {
let UserChrome_js = {
observe: function (aSubject) {
aSubject.addEventListener('DOMContentLoaded', this, {once: true});
},
Expand All @@ -191,7 +179,14 @@ UserChrome_js.prototype = {
let document = aEvent.originalTarget;
let window = document.defaultView;
let location = window.location;
if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {

if (!this.sharedWindowOpened && location.href == 'chrome://extensions/content/dummy.xhtml') {
this.sharedWindowOpened = true;

Management.on('extension-browser-inserted', function (topic, browser) {
browser.messageManager.addMessageListener('Extension:ExtensionViewLoaded', this.messageListener.bind(this));
}.bind(this));
} else if (/^(chrome:(?!\/\/global\/content\/commonDialog\.x?html)|about:(?!blank))/i.test(location.href)) {
window.UC = UC;
window._uc = _uc;
window.xPref = xPref;
Expand All @@ -206,8 +201,27 @@ UserChrome_js.prototype = {
_uc.loadScript(_uc.scripts[_uc.ALWAYSEXECUTE], window);
}
}
},

messageListener: function (msg) {
const browser = msg.target;
const { addonId } = browser._contentPrincipal;

browser.messageManager.removeMessageListener('Extension:ExtensionViewLoaded', this.messageListener);

if (browser.ownerGlobal.location.href == 'chrome://extensions/content/dummy.xhtml') {
UC.webExts.set(addonId, browser);
Services.obs.notifyObservers(null, 'UCJS:WebExtLoaded', addonId);
} else {
let win = browser.ownerGlobal.windowRoot.ownerGlobal;
UC.sidebar.get(addonId)?.set(win, browser) || UC.sidebar.set(addonId, new Map([[win, browser]]));
Services.obs.notifyObservers(win, 'UCJS:SidebarLoaded', addonId);
}
}
};

if (!Services.appinfo.inSafeMode)
new UserChrome_js();
if (!Services.appinfo.inSafeMode) {
_uc.chromedir.append(_uc.scriptsDir);
_uc.getScripts();
Services.obs.addObserver(UserChrome_js, 'chrome-document-global-created', false);
}
2 changes: 1 addition & 1 deletion Installers/Multirow & other functions/utils/xPref.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var xPref = {

switch (typeof value) {
case 'string':
return sPrefs.setCharPref(prefPath, value) || value;
return sPrefs.setStringPref(prefPath, value) || value;
case 'number':
return sPrefs.setIntPref(prefPath, value) || value;
case 'boolean':
Expand Down
5 changes: 0 additions & 5 deletions Mod manager/utils/QNModManager/CodeMirror/.travis.yml

This file was deleted.

Loading

0 comments on commit 4d6402f

Please sign in to comment.