Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for red spinner: now not displayed by default #671

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@
"message": "%",
"description": "[options] Unit name (percentage) for opacity option"
},
"optDisplayImageLoaderTooltip": {
"message": "Display a little spinner as image is loading (green:loading, orange:skipped, red:error). Orange & red spinners are optional.",
"description": "[options] Tooltip for display image loader option"
},
"optDisplayImageLoader": {
"message": "Display image loader",
"description": "[options] Display image loader option"
},
"optUseSeparateTabOrWindowForUnloadableUrlsTooltip": {
"message": "Useful for HTTPS sites such as Google Images that prevent loading of HTTP images",
"description": "[options] Tooltip for using separate tab or window for unloadable urls option"
Expand Down
8 changes: 8 additions & 0 deletions html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,14 @@ <h1 class="ten columns text-center" data-i18n="optTitle"></h1>
<input class="xnarrow text input" type="text" id="txtPicturesOpacity"><span class="adjoined xnarrow" data-i18n="optOpacityUnitName"></span>
</label>
</li>
<div class="ttip" data-i18n-tooltip="optDisplayImageLoaderTooltip">
<li class="field">
<label class="checkbox" for="chkDisplayImageLoader">
<input type="checkbox" id="chkDisplayImageLoader"><span></span>
<div style="display:inline" data-i18n="optDisplayImageLoader"></div>
</label>
</li>
</div>
<div class="ttip" data-i18n-tooltip="optDownloadFolderTooltip">
<li class="append field">
<label class="inline" style="padding-right:10px">
Expand Down
2 changes: 1 addition & 1 deletion js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var factorySettings = {
disabledPlugins : [],
centerImages : false,
frameBackgroundColor: "#ffffff",
displayImageLoader: true,
displayImageLoader: false,
enlargementThresholdEnabled : true,
enlargementThreshold : 2,
displayedSizeThresholdEnabled : true,
Expand Down
20 changes: 15 additions & 5 deletions js/hoverzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ var hoverZoom = {

imgFullSize.width('auto').height('auto');
hz.hzImg.width('auto').height('auto');
hz.hzImg.css('visibility', 'visible');
//hz.hzImg.css('visibility', 'visible');

// image natural dimensions
imgDetails.naturalWidth = imgFullSize.width() * options.zoomFactor;
Expand Down Expand Up @@ -727,13 +727,17 @@ var hoverZoom = {
function displayFullSizeImage() {
cLog('displayFullSizeImage');

hz.hzImgLoader.remove();
hz.hzImgLoader = null;
if (hz.hzImgLoader) {
hz.hzImgLoader.remove();
hz.hzImgLoader = null;
}

hz.hzImg.stop(true, true);
hz.hzImg.offset({top:-9000, left:-9000}); // hides the image while making it available for size calculations
hz.hzImg.empty();

hz.hzImg.css('visibility', 'visible');

clearTimeout(cursorHideTimeout);
hz.hzImg.css('cursor', 'none');
hz.hzImg.css('pointer-events', 'none');
Expand Down Expand Up @@ -1656,10 +1660,16 @@ var hoverZoom = {
}
},

// create and display the loading image container

// handle the loading image spinner
// its color depends on loading staus:
// - green: loading started
// - orange: img skipped (reason depends on Options settings: image already big enough, etc)
// - red: an error occured (displayed in console)
displayImgLoader:function (status, position) {

// orange & red spinners are optional
if (options.displayImageLoader == false && (status == 'skipped' || status == 'error')) return;

// check that loader exists
if (hoverZoom.hzImgLoader == null) {
hoverZoom.hzImgLoader = $('<div id="hzImgLoader"><img src="' + chrome.extension.getURL('images/loading.gif') + '" style="opacity: 0.8; padding: 0; margin: 0" /></div>');
Expand Down
1 change: 1 addition & 0 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function saveOptions() {
options.enableGalleries = $('#chkEnableGalleries')[0].checked;
options.picturesOpacity = $('#txtPicturesOpacity')[0].value / 100;
options.captionLocation = $('#selectCaptionLocation').val();
options.displayImageLoader = $('#chkDisplayImageLoader')[0].checked;
options.downloadFolder = $('#txtDownloadFolder')[0].value;
options.useSeparateTabOrWindowForUnloadableUrlsEnabled = $('#chkUseSeparateTabOrWindowForUnloadableUrlsEnabled')[0].checked;
options.useSeparateTabOrWindowForUnloadableUrls = $('#selectUseSeparateTabOrWindowForUnloadableUrls').val();
Expand Down