Restore Dev/Troubleshooting Mode warning after redesign

Show label after tabs menu, and adjust Troubleshooting Mode color for
dark mode
This commit is contained in:
Dan Stillman 2024-01-10 05:57:25 -05:00
parent 0f4a9e1482
commit 5167ac2d6f
2 changed files with 37 additions and 19 deletions

View file

@ -450,28 +450,31 @@ var ZoteroPane = new function()
// Show warning in toolbar for 'dev' channel builds and troubleshooting mode
try {
let afterElement = 'zotero-tb-tabs-menu';
let isDevBuild = Zotero.version.includes('-dev');
let isSafeMode = Services.appinfo.inSafeMode;
// Uncomment to test
//isDevBuild = true;
if (isDevBuild) {
let label = document.createXULElement('label');
label.setAttribute('style', 'font-weight: bold; color: red; cursor: pointer; margin: 0 .5em 0 1em');
label.onclick = function () {
Zotero.launchURL('https://www.zotero.org/support/kb/test_builds');
};
label.value = 'TEST BUILD — DO NOT USE';
let syncError = document.getElementById('zotero-tb-sync-error');
syncError.parentNode.insertBefore(label, syncError);
}
else if (Services.appinfo.inSafeMode) {
let label = document.createElement('span');
label.setAttribute('style', 'font-weight: bold; color: darkblue; cursor: pointer; margin-right: .5em');
label.onclick = function () {
Zotero.Utilities.Internal.quit(true);
};
label.textContent = 'Troubleshooting Mode';
let syncStop = document.getElementById('zotero-tb-sync-stop');
syncStop.parentNode.insertBefore(label, syncStop);
//isSafeMode = true;
if (isDevBuild || isSafeMode) {
let label = document.createElement('div');
label.className = "toolbar-mode-warning";
let msg = '';
if (isDevBuild) {
label.onclick = function () {
Zotero.launchURL('https://www.zotero.org/support/kb/test_builds');
};
msg = 'TEST BUILD — DO NOT USE';
}
else if (isSafeMode) {
label.classList.add('safe-mode');
label.onclick = function () {
Zotero.Utilities.Internal.quit(true);
};
msg = 'Troubleshooting Mode';
}
label.textContent = msg;
document.getElementById(afterElement).after(label);
}
}
catch (e) {

View file

@ -113,3 +113,18 @@
.zotero-tb-button {
-moz-user-focus: normal;
}
/* Label in toolbar for dev mode or troubleshooting mode */
.toolbar-mode-warning {
font-weight: bold;
cursor: pointer;
margin: 0 .8em 0 .2em;
color: red;
&.safe-mode {
color: darkblue;
@media (prefers-color-scheme: dark) {
color: lightblue;
}
}
}