[Feature Request] add loader to use other loader
Closed this issue · 14 comments
Hi, can You add loader to use other loader, i use Xiao Fleaud
my load script
// ==UserScript==
// @name Second Sidebar for Firefox
// @description A Firefox userChrome.js script for adding a second sidebar with web panels like in Vivaldi/Floorp/Zen.
// @author aminought
// @include main
// @homepageURL https://github.com/aminought/firefox-second-sidebar
// ==/UserScript==
if (location.href.startsWith("chrome://browser/content/browser.x")) {
(async url => {
(await ChromeUtils.compileScript(`data:,"use strict";import("${url}").catch(console.error)`)).executeInGlobal(window);
})(Services.io.newURI(Components.stack.filename).resolve("second_sidebar.uc.mjs"));
}
I'm sorry, I'm not really a web developer, and I don't understand some things. What exactly is going on in this code, and why doesn't it work without it?
I have done some research on the topic and tried the loader myself. To be honest, I wasn't very impressed, but that doesn't matter. I just can't see this script fitting into the codebase at the moment. However, I can include it in the installation instructions and mention you there.
Thank You. Yes you can...
no more need, you use fx-config API
I'm using alice0775's loader.
In addition to this script, I also need to modify second_sidebar.uc.mjs
change
UC_API.Runtime.startupFinished().then(run);
to
run();
@benzBrake does this loader support *.mjs
scripts?
@benzBrake does this loader support
*.mjs
scripts?
As far as I know, only fx-autoconfig adds the function of automatically loading mjs, and other Loaders require the script from @dimdamin
In addition to this script, I also need to modify
second_sidebar.uc.mjs
I think I'll replace it with something like this:
if (typeof UC_API !== 'undefined') {
UC_API.Runtime.startupFinished().then(run);
} else {
run();
}
FYI
// ==UserScript==
// @name Second Sidebar for Firefox
// @description A Firefox userChrome.js script for adding a second sidebar with web panels like in Vivaldi/Floorp/Zen.
// @author aminought
// @homepageURL https://github.com/aminought/firefox-second-sidebar
// ==/UserScript==
import { SidebarDecorator } from "./second_sidebar/sidebar_decorator.mjs";
import { SidebarInjector } from "./second_sidebar/sidebar_injector.mjs";
//const run = () => {
(async () => {
await delayedStartupPromise;
SidebarInjector.inject();
SidebarDecorator.decorate();
})();
//UC_API.Runtime.startupFinished().then(run);
await delayedStartupPromise;
This is an internal Firefox command in window and is available immediately when the script is loaded. The only thing left to do is to wait - “await window.delayedStartupPromise;” event “browser-delayed-startup-finished”
P.S. It`s not example, it working script or working solution
OK:
if (typeof UC_API !== 'undefined') {
UC_API.Runtime.startupFinished().then(run);
} else {
delayedStartupPromise.then(run);
}
Firefox native function => work on all loader`szzzzz
(async () => {
await delayedStartupPromise;
SidebarInjector.inject();
SidebarDecorator.decorate();
})();
native function work on all loader`szzzzz
delayedStartupPromise.then(run);
external function work only in fx-autoconfig
UC_API.Runtime.startupFinished().then(run);
please close this issues with don`t planet...
OK:
if (typeof UC_API !== 'undefined') { UC_API.Runtime.startupFinished().then(run); } else { delayedStartupPromise.then(run); }
OMG, this code works on all loaders.
Let's figure out something. This is a script for fx-autoconfig
, which I'm only testing in this loader. However, I have tried to write the rest of the code, excluding second_sidebar.uc.mjs
, so that it will be supported everywhere. For second_sidebar.uc.mjs
, I have proposed a solution that will work everywhere, but will take advantage of fx-autoconfig
when used.
@dimdamin I don't enjoy your way of communication. I'm starting to regret not using the fx-autoconfig
API as much as possible.