mirror of
https://github.com/zotero/zotero.git
synced 2026-10-04 02:31:47 +00:00
Merge da69bb246b into 06e16c297c
This commit is contained in:
commit
70451b1dbf
2 changed files with 30 additions and 0 deletions
|
|
@ -1085,6 +1085,35 @@ async function toJavaScriptConsole() {
|
|||
win.document.querySelector(".flexible-output-input textarea").setAttribute("aria-label", "Input line");
|
||||
}
|
||||
|
||||
function launchDeveloperToolbox() {
|
||||
let prefs = ['devtools.chrome.enabled', 'devtools.debugger.remote-enabled'];
|
||||
let enabled = prefs.every(pref => !!Zotero.Prefs.get(pref, true));
|
||||
if (!enabled) {
|
||||
let ps = Services.prompt;
|
||||
let shouldEnable = ps.confirm(
|
||||
null,
|
||||
'Remote Debugging Disabled',
|
||||
'Enable remote debugging? This will allow Firefox instances on this machine to control ' + Zotero.appName + '.'
|
||||
+ '\n\nThis is inherently a security risk and is NOT RECOMMENDED for normal use.'
|
||||
);
|
||||
if (shouldEnable) {
|
||||
for (let pref of prefs) {
|
||||
Zotero.Prefs.set(pref, true, /* global */ true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const { BrowserToolboxLauncher } = ChromeUtils.import("resource://devtools/client/framework/browser-toolbox/Launcher.jsm");
|
||||
// Don't launch if already open
|
||||
// (Can we focus the existing toolbox process?)
|
||||
if (!BrowserToolboxLauncher.getBrowserToolboxSessionState()) {
|
||||
BrowserToolboxLauncher.init();
|
||||
}
|
||||
}
|
||||
|
||||
function openRunJSWindow() {
|
||||
openWindowByType(
|
||||
'chrome://zotero/content/runJS.html',
|
||||
|
|
|
|||
|
|
@ -761,6 +761,7 @@
|
|||
label="&developer.label;">
|
||||
<menupopup>
|
||||
<menuitem id="menu_errorConsole" label="Error Console" oncommand="toJavaScriptConsole()"/>
|
||||
<menuitem id="menu_developerToolbox" label="Developer Toolbox" oncommand="launchDeveloperToolbox()"/>
|
||||
<menuitem id="menu_runJS" label="Run JavaScript" oncommand="openRunJSWindow()"/>
|
||||
<menuitem id="style-editor-menu-item" label="Style Editor" oncommand="openStyleEditor()"/>
|
||||
<menuitem id="scaffold-menu-item" label="Translator Editor" oncommand="openScaffold()"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue