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

Add max width to zoomed pictures. #1309

Closed
wants to merge 10 commits into from
Closed
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
12 changes: 12 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@
"message": "Multiply the size of zoomed images by this amount",
"description": "[options] Tooltip for adjust the size of zoomed images option"
},
"optMaxWidth": {
"message": "Set max width of zoomed images:",
"description": "[options] Adjust the size of zoomed images option"
},
"optMaxWidthUnitName": {
"message": "px",
"description": "[options] Unit name (px) for zoomed images size option"
},
"optMaxWidthTooltip": {
"message": "Set max width of zoomed images by this amount (if 0 then no max width)",
"description": "[options] Tooltip for adjust the size of zoomed images option"
},
"optCaptionLocation": {
"message": "Caption position:",
"description": "[options] Adjust the position of the caption"
Expand Down
12 changes: 12 additions & 0 deletions _locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@
"message": "Умножить размер увеличенного изображения на это число",
"description": "[options] Tooltip for adjust the size of zoomed images option"
},
"optMaxWidth": {
"message": "Указать максимальный размер увеличенного изображения:",
"description": "[options] Adjust the size of zoomed images option"
},
"optMaxWidthUnitName": {
"message": "пиксели",
"description": "[options] Unit name (px) for zoomed images size option"
},
"optMaxWidthTooltip": {
"message": "Ширина увеличенного изображения не будет превышать это число (если 0, то ограничения не будет)",
"description": "[options] Tooltip for adjust the size of zoomed images option"
},
"optCaptionLocation": {
"message": "Расположение подписей к изображениям:",
"description": "[options] Adjust the position of the caption"
Expand Down
8 changes: 8 additions & 0 deletions html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ <h1 class="ten columns text-center" data-i18n="optTitle"></h1>
<fieldset>
<legend data-i18n="optSectionView"></legend>
<ul>
<div class="ttip" data-i18n-tooltip="optMaxWidthTooltip">
<li class="append field">
<label class="inline" for="txtMaxWidth">
<div style="display:inline" data-i18n="optMaxWidth"></div>
<input class="xnarrow text input" type="text" id="txtMaxWidth"><span class="adjoined xnarrow" data-i18n="optMaxWidthUnitName"></span>
</label>
</li>
</div>
<div class="ttip" data-i18n-tooltip="optZoomFactorTooltip">
<li class="append field">
<label class="inline" for="txtZoomFactor">
Expand Down
2 changes: 2 additions & 0 deletions js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var factorySettings = {
extensionEnabled : true,
darkMode : false,
zoomFactor : 1,
maxWidth : 0,
zoomVideos : true,
videoPositionStep : 10,
muteVideos : false,
Expand Down Expand Up @@ -87,6 +88,7 @@ function loadOptions() {
options.extensionEnabled = options.hasOwnProperty('extensionEnabled') ? options.extensionEnabled : factorySettings.extensionEnabled;
options.darkMode = options.hasOwnProperty('darkMode') ? options.darkMode : factorySettings.darkMode;
options.zoomFactor = options.hasOwnProperty('zoomFactor') ? options.zoomFactor : factorySettings.zoomFactor;
options.maxWidth = options.hasOwnProperty('maxWidth') ? options.maxWidth : factorySettings.maxWidth;
options.zoomVideos = options.hasOwnProperty('zoomVideos') ? options.zoomVideos : factorySettings.zoomVideos;
options.videoPositionStep = options.hasOwnProperty('videoPositionStep') ? options.videoPositionStep : factorySettings.videoPositionStep;
options.muteVideos = options.hasOwnProperty('muteVideos') ? options.muteVideos : factorySettings.muteVideos;
Expand Down
6 changes: 6 additions & 0 deletions js/hoverzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,11 @@ var hoverZoom = {
audioControlsCss.margin = audioControlsWithVideoCss.margin = thickness + 'px';
}

// set max width in pixels
function maxWidth(width) {
imgFullSizeCss['max-width'] = (width > 0) ? width + 'px' : 'none';
}

// set font size in pixel(s)
function fontSize(size) {
size = parseInt(size);
Expand Down Expand Up @@ -3494,6 +3499,7 @@ var hoverZoom = {
frameBackgroundColor(options.frameBackgroundColor);
frameThickness(options.frameThickness);
fontSize(options.fontSize);
maxWidth(options.maxWidth);

webSiteExcluded = null;
body100pct = (body.css('position') != 'static') || (body.css('padding-left') == '0px' && body.css('padding-right') == '0px' && body.css('margin-left') == '0px' && body.css('margin-right') == '0px');
Expand Down
2 changes: 2 additions & 0 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function saveOptions() {
options.extensionEnabled = $('#chkExtensionEnabled')[0].checked;
options.darkMode = $('#chkDarkMode')[0].checked;
options.zoomFactor = $('#txtZoomFactor')[0].value;
options.maxWidth = $('#txtMaxWidth')[0].value;
options.zoomVideos = $('#chkZoomVideos')[0].checked;
options.videoPositionStep = $('#txtVideoPositionStep')[0].value;
options.muteVideos = $('#chkMuteVideos')[0].checked;
Expand Down Expand Up @@ -170,6 +171,7 @@ function restoreOptions(optionsFromFactorySettings) {
$('#chkExtensionEnabled').trigger(options.extensionEnabled ? 'gumby.check' : 'gumby.uncheck');
$('#chkDarkMode').trigger(options.darkMode ? 'gumby.check' : 'gumby.uncheck');
$('#txtZoomFactor')[0].value = options.zoomFactor;
$('#txtMaxWidth')[0].value = options.maxWidth;
$('#chkZoomVideos').trigger(options.zoomVideos ? 'gumby.check' : 'gumby.uncheck');
$('#txtVideoPositionStep')[0].value = options.videoPositionStep;
$('#chkMuteVideos').trigger(options.muteVideos ? 'gumby.check' : 'gumby.uncheck');
Expand Down