Add Zotero.isPDFBuild feature flag

Currently limited to PDF opening (which is then dependant on
the beta.useInternalPDFReader pref)
This commit is contained in:
Dan Stillman 2021-02-11 04:44:08 -05:00
parent 10f41547aa
commit 88dc6638fe
5 changed files with 18 additions and 4 deletions

View file

@ -41,6 +41,10 @@ Zotero_Preferences.General = {
var menuitem = document.getElementById('fileHandler-internal'); var menuitem = document.getElementById('fileHandler-internal');
menuitem.setAttribute('label', Zotero.appName); menuitem.setAttribute('label', Zotero.appName);
if (Zotero.isPDFBuild) {
document.getElementById('useInternalPDFReader-checkbox').hidden = false;
}
this.updateAutoRenameFilesUI(); this.updateAutoRenameFilesUI();
this._updateFileHandlerUI(); this._updateFileHandlerUI();
}, },

View file

@ -80,8 +80,10 @@
</menulist> </menulist>
</hbox> </hbox>
<checkbox <checkbox
id="useInternalPDFReader-checkbox"
label="Use Zotero PDF reader for My Library (beta)" label="Use Zotero PDF reader for My Library (beta)"
preference="pref-useInternalPDFReader"/> preference="pref-useInternalPDFReader"
hidden="true"/>
</groupbox> </groupbox>
<groupbox id="zotero-prefpane-miscellaneous-groupbox"> <groupbox id="zotero-prefpane-miscellaneous-groupbox">

View file

@ -36,7 +36,9 @@ Zotero.OpenPDF = {
else { else {
let item = pathOrItem; let item = pathOrItem;
let library = Zotero.Libraries.get(item.libraryID); let library = Zotero.Libraries.get(item.libraryID);
if (library.libraryType == 'user' && Zotero.Prefs.get('beta.useInternalPDFReader')) { if (Zotero.isPDFBuild
&& library.libraryType == 'user'
&& Zotero.Prefs.get('beta.useInternalPDFReader')) {
let location = { let location = {
pageIndex: page - 1 pageIndex: page - 1
}; };

View file

@ -228,7 +228,11 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
var version = yield deferred.promise; var version = yield deferred.promise;
} }
Zotero.version = version; Zotero.version = version;
Zotero.isDevBuild = Zotero.version.includes('beta') || Zotero.version.includes('SOURCE'); Zotero.isDevBuild = Zotero.version.includes('beta')
|| Zotero.version.includes('dev')
|| Zotero.version.includes('SOURCE');
Zotero.isPDFBuild = true // Toggle for testing
&& (Zotero.version.includes('dev') || Zotero.version.includes('SOURCE'));
// OS platform // OS platform
var win = Components.classes["@mozilla.org/appshell/appShellService;1"] var win = Components.classes["@mozilla.org/appshell/appShellService;1"]

View file

@ -4098,7 +4098,9 @@ var ZoteroPane = new function()
let item = await Zotero.Items.getAsync(itemID); let item = await Zotero.Items.getAsync(itemID);
let library = Zotero.Libraries.get(item.libraryID); let library = Zotero.Libraries.get(item.libraryID);
// TEMP // TEMP
if (library.libraryType == 'user' && Zotero.Prefs.get('beta.useInternalPDFReader')) { if (Zotero.isPDFBuild
&& library.libraryType == 'user'
&& Zotero.Prefs.get('beta.useInternalPDFReader')) {
this.viewPDF(itemID, event && event.shiftKey); this.viewPDF(itemID, event && event.shiftKey);
return; return;
} }