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

View file

@ -113,3 +113,18 @@
.zotero-tb-button { .zotero-tb-button {
-moz-user-focus: normal; -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;
}
}
}