Skip to content

Commit

Permalink
Update all scripts metadata for new fx-autoconfig.
Browse files Browse the repository at this point in the history
Also fix tabTooltipNavButtons.uc.js
  • Loading branch information
aminomancer committed Jan 18, 2023
1 parent b8d8a7c commit 3f8e86a
Show file tree
Hide file tree
Showing 47 changed files with 698 additions and 457 deletions.
31 changes: 20 additions & 11 deletions JS/aboutCfg.uc.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
// ==UserScript==
// @name about:cfg
// @version 1.2.5
// @version 1.2.6
// @author aminomancer
// @homepageURL https://github.com/aminomancer/uc.css.js
// @description Registers the old-school [about:config][] page to the URL about:cfg. Intended for use with earthlng's [aboutconfig module][]. That module restores the old about:config page, but gives it a long-winded URL like "chrome://userchromejs/content/aboutconfig/config.xhtml" which takes a lot longer to type in and doesn't look very elegant. This script finds the URL for that module and registers it to an about: URL so it counts as a chrome UI page. We're not just faking it, this makes it a bona-fide about: page. That means you can navigate to it by just typing about:cfg in the urlbar, and also means the identity icon will show it as a secure system page rather than a local file. It even means about:cfg will show up on the about:about page!
//
// This technically also makes using the aboutconfig module safer, because it denies the document access to some privileged stuff that it would have with a chrome:// URI. For instructions on installing earthlng's aboutconfig module for fx-autoconfig, please see the script description for App Menu about:config Button. This has only been tested with fx-autoconfig, but it may work with xiaoxiaoflood's loader. I don't think it will work with Alice0775's loader but I haven't tested it. Compatible with my [appMenuAboutConfigButton][] script. That button will automatically navigate to about:cfg if this script is installed. I recommend editing earthlng's config.xhtml file to remove line 13: `title="about:config"` This sets the tab title to about:config, which isn't necessary or desirable since we're changing the URL to about:cfg. Without the title attribute, firefox will automatically set the title to the tab's URL, which (with this script) is about:cfg.
//
// [about:config]: about:config
// [aboutconfig module]: https://github.com/earthlng/aboutconfig
// [appMenuAboutConfigButton]: https://github.com/aminomancer/uc.css.js#app-menu-aboutconfig-button
// @long-description
// @description
/*
Registers the old-school <about:config> page to the URL <about:cfg>. Intended for use with earthlng's [aboutconfig module][]. That module restores the old about:config page, and now includes a version of this script, but that version isn't compatible with fx-autoconfig. This script finds the URL for that module and registers it to an about: URL so it counts as a chrome UI page.
We're not just faking it, this makes it a bona-fide about: page. That means you can navigate to it by just typing about:cfg in the urlbar, and also means the identity icon will show it as a secure system page rather than a local file. It even means about:cfg will show up on the about:about page!
This technically also makes using the aboutconfig module safer, because it denies the document access to some privileged stuff that it would have with a `chrome://` URI. For instructions on installing earthlng's aboutconfig module for fx-autoconfig, please see the script description for [App Menu about:config Button][appMenuAboutConfigButton].
This has only been tested with fx-autoconfig, but it may work with xiaoxiaoflood's loader. I don't think it will work with Alice0775's loader but I haven't tested it.
Compatible with my [appMenuAboutConfigButton][] script. That button will automatically navigate to <about:cfg> if this script is installed. I recommend editing earthlng's config.xhtml file to remove line 13: `title="about:config"` This sets the tab title to `about:config`, which isn't necessary or desirable since we're changing the URL to `about:cfg`. Without the title attribute, firefox will automatically set the title to the tab's URL, which (with this script) is `about:cfg`.
[aboutconfig module]: https://github.com/earthlng/aboutconfig
[appMenuAboutConfigButton]: https://github.com/aminomancer/uc.css.js#app-menu-aboutconfig-button
*/
// @downloadURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/aboutCfg.uc.js
// @updateURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/aboutCfg.uc.js
// @license This Source Code Form is subject to the terms of the Creative Commons Attribution-NonCommercial-ShareAlike International License, v. 4.0. If a copy of the CC BY-NC-SA 4.0 was not distributed with this file, You can obtain one at http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
// @backgroundmodule
// ==/UserScript==

let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

/**
* @settings (edit in about:config):
*
Expand Down Expand Up @@ -43,9 +54,7 @@ const config = {
pathOverride: Services.prefs.getStringPref("aboutCfg.pathOverride", ""),
};

let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
let { manager: Cm } = Components;
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);

function findAboutConfig() {
if (config.pathOverride) return config.pathOverride;
Expand Down
53 changes: 30 additions & 23 deletions JS/allTabsMenuExpansionPack.uc.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
// ==UserScript==
// @name All Tabs Menu Expansion Pack
// @version 2.1.5
// @version 2.1.6
// @author aminomancer
// @homepageURL https://github.com/aminomancer
// @description Next to the "new tab" button in Firefox there's a V-shaped button that opens a big scrolling menu containing all the tabs. This script adds several new features to the "all tabs menu" to help it catch up to the functionality of the regular tabs bar.
//
// 1. Allows you to drag and drop tabs in the all tabs menu.
// 2. Adds an animated close button for every tab in this menu.
// 3. Allows you to multiselect tabs in the all tabs menu and close an unlimited number of tabs at once without closing/blurring the popup.
// 4. Significantly improves the mute/unmute button by making it work like the mute button in the tabs bar used to work.
// ␠ - If you only have one tab selected, it mutes/unmutes that tab.
// ␠ - If you have multiple tabs selected, it mutes/unmutes all of them.
// ␠ - This also adds a tooltip to the mute button.
// 5. By default, Firefox doesn't do anything to differentiate loaded tabs from unloaded tabs. But for the regular tab bar, unloaded tabs gain an attribute `pending="true"` which you can use to dim them. This way you know which tabs are already initialized and which will actually start up when you click them. Pretty useful if you frequently have 100+ tabs like me.
// ␠ - This script adds the same functionality to the all tabs menu, but does not add "pending" styling to regular tabs since it's outside the scope of this project. To do it yourself just add a rule like `.tabbrowser-tab .tab-content{opacity:.6;}`
// ␠ - If you use [Unread Tab Mods](https://github.com/aminomancer/uc.css.js/blob/master/JS/unreadTabMods.uc.js), this integrates with it to make unread tabs display with italic text.
// 6. Adds color stripes to multiselected tabs and container tabs in the "all tabs menu" so you can differentiate them from normal tabs.
// 7. Includes a preference `userChrome.tabs.all-tabs-menu.reverse-order` that lets you reverse the order of the tabs so that newer tabs are displayed on top rather than on bottom.
// 8. Modifies the all tabs button's tooltip to display the number of tabs as well as the shortcut to open the all tabs menu, Ctrl+Shift+Tab.
// 9. Allows the panel to display pinned tabs, and displays a pin icon on them.
// 10. Makes the sound icon show if the tab has blocked media or media in picture-in-picture, just like regular tabs.
// 11. Adds an optional preference `userChrome.ctrlTab.skip-show-all-button` that lets you skip past the "List All x Tabs" button when hitting Ctrl+Tab.
// 12. And a few other subtle improvements. All the relevant CSS for this is already included in and loaded by the script. It's designed to look consistent with my theme as well as with the latest vanilla (proton) Firefox. If you need to change anything, see the "const css" line in here, or the end of uc-tabs-bar.css on my repo.
// @long-description
// @description
/*
Next to the "new tab" button in Firefox there's a V-shaped button that opens a big scrolling menu containing all the tabs. This script adds several new features to the "all tabs menu" to help it catch up to the functionality of the regular tabs bar.
1. Allows you to drag and drop tabs in the all tabs menu.
2. Adds an animated close button for every tab in this menu.
3. Allows you to multiselect tabs in the all tabs menu and close an unlimited number of tabs at once without closing/blurring the popup.
4. Significantly improves the mute/unmute button by making it work like the mute button in the tabs bar used to work.
- If you only have one tab selected, it mutes/unmutes that tab.
- If you have multiple tabs selected, it mutes/unmutes all of them.
- This also adds a tooltip to the mute button.
5. By default, Firefox doesn't do anything to differentiate loaded tabs from unloaded tabs. But for the regular tab bar, unloaded tabs gain an attribute `pending="true"` which you can use to dim them. This way you know which tabs are already initialized and which will actually start up when you click them. Pretty useful if you frequently have 100+ tabs like me.
- This script adds the same functionality to the all tabs menu, but does not add "pending" styling to regular tabs since it's outside the scope of this project. To do it yourself just add a rule like `.tabbrowser-tab .tab-content{opacity:.6;}`
- If you use [Unread Tab Mods][], this integrates with it to make unread tabs display with italic text.
6. Adds color stripes to multiselected tabs and container tabs in the "all tabs menu" so you can differentiate them from normal tabs.
7. Includes a preference `userChrome.tabs.all-tabs-menu.reverse-order` that lets you reverse the order of the tabs so that newer tabs are displayed on top rather than on bottom.
8. Modifies the all tabs button's tooltip to display the number of tabs as well as the shortcut to open the all tabs menu, Ctrl+Shift+Tab.
9. Allows the panel to display pinned tabs, and displays a pin icon on them.
10. Makes the sound icon show if the tab has blocked media or media in picture-in-picture, just like regular tabs.
11. Adds an optional preference `userChrome.ctrlTab.skip-show-all-button` that lets you skip past the "List All x Tabs" button when hitting Ctrl+Tab.
12. And a few other subtle improvements. All the relevant CSS for this is already included in and loaded by the script. It's designed to look consistent with my theme as well as with the latest vanilla (proton) Firefox. If you need to change anything, see the "const css" line in here, or the end of uc-tabs-bar.css on my repo.
[Unread Tab Mods]: https://github.com/aminomancer/uc.css.js/blob/master/JS/unreadTabMods.uc.js
*/
// @downloadURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/allTabsMenuExpansionPack.uc.js
// @updateURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/allTabsMenuExpansionPack.uc.js
// @license This Source Code Form is subject to the terms of the Creative Commons Attribution-NonCommercial-ShareAlike International License, v. 4.0. If a copy of the CC BY-NC-SA 4.0 was not distributed with this file, You can obtain one at http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
Expand Down Expand Up @@ -1234,9 +1240,10 @@
sss.loadAndRegisterSheet(uri, sss.AUTHOR_SHEET);
}

if (!prefSvc.prefHasUserValue(reversePref)) {
prefSvc.setBoolPref(reversePref, false);
}
const defaultPrefs = prefSvc.getDefaultBranch("");
defaultPrefs.setBoolPref(reversePref, false);
// Necessary for the tab close button to render correctly
defaultPrefs.setBoolPref("svg.context-properties.content.enabled", true);
prefSvc.addObserver(reversePref, prefHandler);

if (gBrowserInit.delayedStartupFinished) {
Expand Down
16 changes: 12 additions & 4 deletions JS/appMenuAboutConfigButton.uc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
// ==UserScript==
// @name App Menu about:config Button
// @version 1.2.4
// @version 1.2.5
// @author aminomancer
// @homepageURL https://github.com/aminomancer/uc.css.js
// @description Adds an [about:config](about:config) shortcut button to the main app menu panel, under the built-in Settings button. It can open the built-in about:config page, or it can open the old-school about:config page with [earthlng's aboutconfig module](https://github.com/earthlng/aboutconfig) To use that with fx-autoconfig, download ONLY the [profile/chrome/utils/aboutconfig](https://github.com/earthlng/aboutconfig/tree/master/profile/chrome/utils/aboutconfig) folder and place it inside your `profile/chrome/resources` folder. Then open `config.xhtml` and find & replace `userchromejs` with `userchrome` and save. Now [chrome://userchrome/content/aboutconfig/config.xhtml](chrome://userchrome/content/aboutconfig/config.xhtml) should be the correct URL.
//
// By default the script will open to that link, so if you don't have that module installed the button will open to a blank page. If you can't get the module to work or if you just prefer Firefox's built-in page, you can change the constant on line 10 below to `about:config` and it'll open to the same page you'd get if you typed about:config in the address bar. (the URL must be in quotes) That said, typing about:config is already easy enough. The reason I made this script was to make a clean shortcut to reach the old-school page, and in a more central location than a bookmark. FYI I added an icon for this button (and for all the other main app menu buttons too) in [uc-app-menu.css](https://github.com/aminomancer/uc.css.js/blob/master/uc-app-menu.css).
// @long-description
// @description
/*
Adds an <about:config> shortcut button to the main app menu panel, under the built-in Settings button. It can open the built-in about:config page, or it can open the old-school about:config page with earthlng's [aboutconfig module][] To use that with fx-autoconfig, download ONLY the [profile/chrome/utils/aboutconfig][] folder and place it inside your `profile/chrome/resources` folder. Then open `config.xhtml` and find & replace `userchromejs` with `userchrome` and save. Now <chrome://userchrome/content/aboutconfig/config.xhtml> should be the correct URL.
By default the script will open to that link, so if you don't have that module installed the button will open to a blank page. If you can't get the module to work or if you just prefer Firefox's built-in page, you can change the constant on line 10 below to `about:config` and it'll open to the same page you'd get if you typed about:config in the address bar. (the URL must be in quotes) That said, typing about:config is already easy enough. The reason I made this script was to make a clean shortcut to reach the old-school page, and in a more central location than a bookmark. FYI I added an icon for this button (and for all the other main app menu buttons too) in [uc-app-menu.css][].
[aboutconfig module]: https://github.com/earthlng/aboutconfig
[profile/chrome/utils/aboutconfig]: https://github.com/earthlng/aboutconfig/tree/master/profile/chrome/utils/aboutconfig
[uc-app-menu.css]: https://github.com/aminomancer/uc.css.js/blob/master/uc-app-menu.css
*/
// @downloadURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/appMenuAboutConfigButton.uc.js
// @updateURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/appMenuAboutConfigButton.uc.js
// @license This Source Code Form is subject to the terms of the Creative Commons Attribution-NonCommercial-ShareAlike International License, v. 4.0. If a copy of the CC BY-NC-SA 4.0 was not distributed with this file, You can obtain one at http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
Expand Down
33 changes: 30 additions & 3 deletions JS/appMenuMods.uc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name App Menu Mods
// @version 1.4.3
// @version 1.4.4
// @author aminomancer
// @homepageURL https://github.com/aminomancer/uc.css.js
// @description Makes some minor modifications to the app menu (the popup opened by clicking the hamburger button on the far right of the navbar). It adds a restart button to the app menu and it adds a separator under the "Manage Account" button in the profile/account panel. I'll continue adding more mods to this script as I think of them.
Expand Down Expand Up @@ -57,8 +57,35 @@
id: "appMenu-restart-button2",
class: "subviewbutton",
label: await strings.formatValue(["restart-button-label"]),
oncommand: `if (event.shiftKey || (AppConstants.platform == "macosx" ? event.metaKey : event.ctrlKey)) Services.appinfo.invalidateCachesOnRestart(); setTimeout(() => Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit), 300); PanelMultiView.forNode(this.closest("panelmultiview")).hidePopup(); event.preventDefault();`,
onclick: `if (event.button === 0) return; Services.appinfo.invalidateCachesOnRestart(); setTimeout(() => Services.startup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit), 300); PanelMultiView.forNode(this.closest("panelmultiview")).hidePopup(); event.preventDefault();`,
oncommand: /* javascript */ `
if (
event.shiftKey ||
(AppConstants.platform == "macosx" ? event.metaKey : event.ctrlKey)
)
Services.appinfo.invalidateCachesOnRestart();
setTimeout(
() =>
Services.startup.quit(
Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit
),
300
);
PanelMultiView.forNode(this.closest("panelmultiview")).hidePopup();
event.preventDefault();
`,
onclick: /* javascript */ `
if (event.button === 0) return;
Services.appinfo.invalidateCachesOnRestart();
setTimeout(
() =>
Services.startup.quit(
Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit
),
300
);
PanelMultiView.forNode(this.closest("panelmultiview")).hidePopup();
event.preventDefault();
`,
});
let exitButton = document.getElementById("appMenu-quit-button2");
if (exitButton) {
Expand Down
Loading

0 comments on commit 3f8e86a

Please sign in to comment.