Skip to content

Commit

Permalink
Merge pull request #785 from GrosPoulet/master
Browse files Browse the repository at this point in the history
New option + new imgs details
  • Loading branch information
GrosPoulet authored Aug 28, 2021
2 parents 1d5629e + 9238e7a commit a727cc3
Show file tree
Hide file tree
Showing 7 changed files with 273 additions and 141 deletions.
8 changes: 8 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@
"message": "If unchecked, zoomed images will be resized dynamically",
"description": "[options] Tooltip for extend zoomed images below the mouse cursor option"
},
"optHideMouseCursor": {
"message": "Hide mouse cursor after:",
"description": "[options] Hide mouse cursor option"
},
"optHideMouseCursorTooltip": {
"message": "If checked, mouse cursor will be hidden after delay",
"description": "[options] Tooltip for hide mouse cursor option"
},
"optPageActionEnabled": {
"message": "Show icon in address bar",
"description": "[options] Show icon in address bar option"
Expand Down
4 changes: 4 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ select.picker {
pointer-events: none;
opacity: 0.5;
}

legend {
font-weight: bold;
}
9 changes: 9 additions & 0 deletions html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@ <h1 class="ten columns text-center" data-i18n="optTitle"></h1>
<input class="xnarrow text input" type="text" id="txtFadeDuration"><span class="adjoined xnarrow" data-i18n="optDurationUnitName"></span>
</label>
</li>
<div class="ttip" data-i18n-tooltip="optHideMouseCursorTooltip">
<li class="append field">
<label class="checkbox inline" style="padding-right:10px" for="chkHideMouseCursor">
<input type="checkbox" id="chkHideMouseCursor"><span></span>
<div style="display:inline" data-i18n="optHideMouseCursor"></div>
</label>
<div id="divHideMouseCursor" style="display:inline"><input class="xnarrow text input" type="text" id="txtHideMouseCursor"><span class="adjoined xnarrow" data-i18n="optDurationUnitName"></span></div>
</li>
</div>
</ul>
</fieldset>
</form>
Expand Down
20 changes: 15 additions & 5 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@ function ajaxRequest(request, callback) {

var xhr = new XMLHttpRequest();
var response = request.response;
var method = request.method;
var url = request.url;
xhr.onreadystatechange = function () {

if (xhr.readyState == 4) {
if (xhr.status == 200) {
if (response === 'URL') {
callback(xhr.responseURL);
}
else {
callback(xhr.responseText);
if (method == 'HEAD') {
callback({url:url, headers:xhr.getAllResponseHeaders()});
} else {
if (response === 'URL') {
callback(xhr.responseURL);
} else {
callback(xhr.responseText);
}
}
} else {
callback(null);
}
}
}

xhr.open(request.method, request.url, true);
for (var i in request.headers) {
xhr.setRequestHeader(request.headers[i].header, request.headers[i].value);
Expand All @@ -42,6 +49,9 @@ function onMessage(message, sender, callback) {
case 'ajaxGet':
ajaxRequest({url:message.url, response:message.response, method:'GET'}, callback);
return true;
case 'ajaxGetHeaders':
ajaxRequest({url:message.url, response:message.response, method:'HEAD'}, callback);
return true;
case 'ajaxRequest':
ajaxRequest(message, callback);
return true;
Expand Down
4 changes: 4 additions & 0 deletions js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var factorySettings = {
picturesOpacity : 1,
showWhileLoading : true,
mouseUnderlap : true,
hideMouseCursor : false,
hideMouseCursorDelay : 500,
filterNSFW : false,
enableGalleries : true,
ambilightEnabled : false,
Expand Down Expand Up @@ -96,6 +98,8 @@ function loadOptions() {
options.picturesOpacity = options.hasOwnProperty('picturesOpacity') ? options.picturesOpacity : factorySettings.picturesOpacity;
options.showWhileLoading = options.hasOwnProperty('showWhileLoading') ? options.showWhileLoading : factorySettings.showWhileLoading;
options.mouseUnderlap = options.hasOwnProperty('mouseUnderlap') ? options.mouseUnderlap : factorySettings.mouseUnderlap;
options.hideMouseCursor = options.hasOwnProperty('hideMouseCursor') ? options.hideMouseCursor : factorySettings.hideMouseCursor;
options.hideMouseCursorDelay = options.hasOwnProperty('hideMouseCursorDelay') ? options.hideMouseCursorDelay : factorySettings.hideMouseCursorDelay;
options.filterNSFW = options.hasOwnProperty('filterNSFW') ? options.filterNSFW : factorySettings.filterNSFW;
options.enableGalleries = options.hasOwnProperty('enableGalleries') ? options.enableGalleries : factorySettings.enableGalleries;
options.ambilightEnabled = options.hasOwnProperty('ambilightEnabled') ? options.ambilightEnabled : factorySettings.ambilightEnabled;
Expand Down
Loading

0 comments on commit a727cc3

Please sign in to comment.