Add Zotero.hiDPISuffix to avoid "@2x" logic each time
Can use Zotero.hiDPISuffix directly in URLs to automatically substitute "@2x" on HiDPI displays.
This commit is contained in:
parent
71d79e1f08
commit
d6064cfeba
6 changed files with 8 additions and 12 deletions
|
@ -874,13 +874,11 @@ Zotero_Browser.Tab.prototype.getCaptureState = function () {
|
|||
* current page, or false if the page cannot be scraped
|
||||
*/
|
||||
Zotero_Browser.Tab.prototype.getCaptureIcon = function (hiDPI) {
|
||||
var suffix = hiDPI ? "@2x" : "";
|
||||
|
||||
switch (this.getCaptureState()) {
|
||||
case this.CAPTURE_STATE_TRANSLATABLE:
|
||||
var itemType = this.getPageObject().translators[0].itemType;
|
||||
return (itemType === "multiple"
|
||||
? "chrome://zotero/skin/treesource-collection" + suffix + ".png"
|
||||
? "chrome://zotero/skin/treesource-collection" + Zotero.hiDPISuffix + ".png"
|
||||
: Zotero.ItemTypes.getImageSrc(itemType));
|
||||
|
||||
default:
|
||||
|
@ -890,8 +888,7 @@ Zotero_Browser.Tab.prototype.getCaptureIcon = function (hiDPI) {
|
|||
|
||||
// TODO: Show icons for images, PDFs, etc.?
|
||||
Zotero_Browser.Tab.prototype.getWebPageCaptureIcon = function (hiDPI) {
|
||||
var suffix = hiDPI ? "@2x" : "";
|
||||
return "chrome://zotero/skin/treeitem-webpage" + suffix + ".png";
|
||||
return "chrome://zotero/skin/treeitem-webpage" + Zotero.hiDPISuffix + ".png";
|
||||
}
|
||||
|
||||
Zotero_Browser.Tab.prototype.getCaptureTooltip = function() {
|
||||
|
|
|
@ -87,8 +87,9 @@ var ZoteroOverlay = new function()
|
|||
|
||||
observerService.addObserver(zoteroObserver, "browser-delayed-startup-finished", false);
|
||||
|
||||
// Set a flag for hi-res displays
|
||||
// Set flags for hi-res displays
|
||||
Zotero.hiDPI = window.devicePixelRatio > 1;
|
||||
Zotero.hiDPISuffix = Zotero.hiDPI ? "@2x" : "";
|
||||
|
||||
// Clear old Zotero icon pref
|
||||
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
|
|
|
@ -711,7 +711,7 @@ Zotero.CollectionTreeView.prototype.getCellText = function(row, column)
|
|||
|
||||
Zotero.CollectionTreeView.prototype.getImageSrc = function(row, col)
|
||||
{
|
||||
var suffix = Zotero.hiDPI ? "@2x" : "";
|
||||
var suffix = Zotero.hiDPISuffix;
|
||||
|
||||
var treeRow = this.getRow(row);
|
||||
var collectionType = treeRow.type;
|
||||
|
|
|
@ -441,7 +441,7 @@ Zotero.ItemTypes = new function() {
|
|||
}
|
||||
|
||||
this.getImageSrc = function (itemType) {
|
||||
var suffix = Zotero.hiDPI ? "@2x" : "";
|
||||
var suffix = Zotero.hiDPISuffix;
|
||||
|
||||
if (this.isCustom(itemType)) {
|
||||
var id = this.getID(itemType) - this.customIDOffset;
|
||||
|
|
|
@ -91,8 +91,7 @@ Zotero.defineProperty(Zotero.Collection.prototype, 'collectionTreeViewID', {
|
|||
|
||||
Zotero.defineProperty(Zotero.Collection.prototype, 'collectionTreeViewImage', {
|
||||
get: function () {
|
||||
var suffix = Zotero.hiDPI ? "@2x" : "";
|
||||
return "chrome://zotero/skin/treesource-collection" + suffix + ".png";
|
||||
return "chrome://zotero/skin/treesource-collection" + Zotero.hiDPISuffix + ".png";
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -182,8 +182,7 @@ Zotero.defineProperty(Zotero.Library.prototype, 'collectionTreeViewID', {
|
|||
|
||||
Zotero.defineProperty(Zotero.Library.prototype, 'collectionTreeViewImage', {
|
||||
get: function () {
|
||||
var suffix = Zotero.hiDPI ? "@2x" : "";
|
||||
return "chrome://zotero/skin/treesource-library" + suffix + ".png";
|
||||
return "chrome://zotero/skin/treesource-library" + Zotero.hiDPISuffix + ".png";
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue