Skip to content

Commit

Permalink
(JS) update restorePreProtonArrowpanels.uc.js:
Browse files Browse the repository at this point in the history
break it into script overrides as well as the script itself.
now it will require 3 files from resources/script-override/,
which should be overridden in your chrome.manifest file.
see the script's section in the readme for info.
update atoolboxButton.uc.js for latest ESMification.
(CSS) update picture-in-picture styles.
(misc) update eslint files.
  • Loading branch information
aminomancer committed Sep 11, 2022
1 parent d209a38 commit e702793
Show file tree
Hide file tree
Showing 16 changed files with 1,666 additions and 342 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,27 @@ module.exports = {
configFile: path.join(__dirname, ".babel-eslint.rc.js"),
},
},
env: {
node: false,
browser: true,
es2021: true,
"mozilla/browser-window": true,
"mozilla/jsm": true,
// "mozilla/chrome-worker": true,
// "mozilla/frame-script": true,
// "mozilla/privileged": true,
// "mozilla/simpletest": true,
// "mozilla/sjs": true,
// "mozilla/xpcshell": true,
},
settings: {
"import/extensions": [".mjs"],
},
rules: {
"no-eval": "off",
"no-implied-eval": "error",
"no-unused-vars": "off",
"mozilla/valid-lazy": "off",
"consistent-return": "off",
"no-empty": "off",
complexity: ["warn", { max: 50 }],
Expand Down
18 changes: 0 additions & 18 deletions JS/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
module.exports = {
env: {
node: false,
browser: true,
es2021: true,
"mozilla/browser-window": true,
"mozilla/jsm": true,
// "mozilla/chrome-worker": true,
// "mozilla/frame-script": true,
// "mozilla/privileged": true,
// "mozilla/simpletest": true,
// "mozilla/sjs": true,
// "mozilla/xpcshell": true,
},
parserOptions: {
sourceType: "script",
ecmaVersion: "latest",
Expand Down Expand Up @@ -39,9 +26,4 @@ module.exports = {
SyncedTabsDeckComponent: "writable",
syncedTabsDeckComponent: "writable",
},
rules: {
"no-eval": "off",
"mozilla/valid-lazy": "off",
"no-unused-vars": "off",
},
};
29 changes: 18 additions & 11 deletions JS/atoolboxButton.uc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Toolbox Button
// @version 1.2.8
// @version 1.2.9
// @author aminomancer
// @homepage https://github.com/aminomancer/uc.css.js
// @description Adds a new toolbar button that 1) opens the content toolbox on left click;
Expand Down Expand Up @@ -89,12 +89,19 @@
/^chrome:\/\/browser\/content\/browser.(xul||xhtml)$/i.test(location) &&
!CustomizableUI.getPlacementOfWidget("toolbox-button", true)
) {
const { require } = ChromeUtils.import("resource://devtools/shared/loader/Loader.jsm");
const { BrowserToolboxLauncher } = ChromeUtils.import(
"resource://devtools/client/framework/browser-toolbox/Launcher.jsm"
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
BrowserToolboxLauncher:
"resource://devtools/client/framework/browser-toolbox/Launcher.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
require: "resource://devtools/shared/loader/Loader.jsm",
});
XPCOMUtils.defineLazyGetter(
lazy,
"Actor",
() => lazy.require("devtools/shared/protocol/Actor").Actor
);
const { Actor } = require("devtools/shared/protocol/Actor");
const STATES = { DETACHED: "detached", EXITED: "exited", RUNNING: "running", PAUSED: "paused" };

CustomizableUI.createWidget({
id: "toolbox-button",
Expand Down Expand Up @@ -295,7 +302,7 @@
aDoc.defaultView.key_toggleToolbox.click();
break;
case this.mouseConfig.browserToolbox:
BrowserToolboxLauncher.getBrowserToolboxSessionState() // check if a browser toolbox window is already open
lazy.BrowserToolboxLauncher.getBrowserToolboxSessionState() // check if a browser toolbox window is already open
? CustomHint.show(toolbarbutton, l10n.alreadyOpenMsg, {
event: e,
hideCheck: true,
Expand Down Expand Up @@ -388,7 +395,7 @@
// listen for toolboxes opening and closing
function toolboxObserver(sub, top, _data) {
// whether a toolbox is open
let state = BrowserToolboxLauncher.getBrowserToolboxSessionState();
let state = lazy.BrowserToolboxLauncher.getBrowserToolboxSessionState();
// set toolbar button's badge content
badgeLabel.textContent = state ? 1 : "";
// if toolbox is open and autohide is not already enabled, enable it
Expand All @@ -415,7 +422,7 @@
}

function destroyThreadActor() {
if (this._state == STATES.PAUSED) {
if (this._state == "paused") {
this.doResume();
}

Expand All @@ -441,9 +448,9 @@
this._threadLifetimePool.destroy();
this._threadLifetimePool = null;
this._dbg = null;
this._state = STATES.EXITED;
this._state = "exited";

Actor.prototype.destroy.call(this);
lazy.Actor.prototype.destroy.call(this);
// this leads back to toolboxObserver in 200ms
setTimeout(() => Services.obs.notifyObservers(null, "devtools-thread-destroyed"), 200);
}
Expand Down
Loading

0 comments on commit e702793

Please sign in to comment.