From 49cc5a61b0e199dc1be58f24296f53110a314c5c Mon Sep 17 00:00:00 2001 From: joelthorner Date: Wed, 31 Oct 2018 00:34:18 +0100 Subject: [PATCH 1/2] Fix autosave timeout --- js/optionsActions.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/js/optionsActions.js b/js/optionsActions.js index 541943aa..4c3740ae 100644 --- a/js/optionsActions.js +++ b/js/optionsActions.js @@ -15,23 +15,23 @@ var defaults = { var sto_saveOptions = null; function saveOptions(deelay) { - chrome.storage.sync.set({ - - optLcBgActive: $('#opt-lc-bg-active').prop('checked'), - optLcBgValue: $('[name="opt-lc-bg"]:checked').val(), - optLcPagridActive: $('#opt-lc-pagrid-active').prop('checked'), - optLcDevBarActive: $('#opt-lc-dev-bar-active').prop('checked'), - optDevForceview: $('#opt-dev-forceview').prop('checked'), - optDevStealFa: $('#opt-dev-steal-fa').prop('checked'), - optProfileName: $('#opt-profile-name').val(), - optProfileAvatar: $('[name="opt-profile-avatar"]:checked').val(), - optLcBigControls: $('#opt-lc-big-controls').prop('checked'), - optLcHolidays: $('#opt-lc-holidays').prop('checked') - - }, function() { - // Update status to let user know options were saved. - clearTimeout(sto_saveOptions); - sto_saveOptions = setTimeout(function() { + clearTimeout(sto_saveOptions); + sto_saveOptions = setTimeout(function() { + chrome.storage.sync.set({ + + optLcBgActive: $('#opt-lc-bg-active').prop('checked'), + optLcBgValue: $('[name="opt-lc-bg"]:checked').val(), + optLcPagridActive: $('#opt-lc-pagrid-active').prop('checked'), + optLcDevBarActive: $('#opt-lc-dev-bar-active').prop('checked'), + optDevForceview: $('#opt-dev-forceview').prop('checked'), + optDevStealFa: $('#opt-dev-steal-fa').prop('checked'), + optProfileName: $('#opt-profile-name').val(), + optProfileAvatar: $('[name="opt-profile-avatar"]:checked').val(), + optLcBigControls: $('#opt-lc-big-controls').prop('checked'), + optLcHolidays: $('#opt-lc-holidays').prop('checked') + + }, function() { + // Update status to let user know options were saved. var dataObj = { message: "Options saved", actionText: 'Close', From f48b8ec451e6a34fe5ce1ff301ea8dc4c78ce936 Mon Sep 17 00:00:00 2001 From: joelthorner Date: Wed, 31 Oct 2018 00:34:46 +0100 Subject: [PATCH 2/2] Improvements unsplash photo API --- css/main.css | 70 +++++++++++++++++++++++-- css/main.css.map | 2 +- js/optionsActions.js | 114 ++++++++++++++++++++++++++++------------- js/optionsData.js | 7 +++ manifest.json | 2 +- src/options/index.html | 9 +++- 6 files changed, 160 insertions(+), 44 deletions(-) diff --git a/css/main.css b/css/main.css index de802339..37a254bf 100644 --- a/css/main.css +++ b/css/main.css @@ -823,7 +823,7 @@ h1, h2, h3, h4, h5, h6 { clear: both; } -.grid-backgrounds .background-item { +.background-item, #opt-lc-bg-image { overflow: hidden; position: relative; margin-right: 10px; @@ -834,18 +834,28 @@ h1, h2, h3, h4, h5, h6 { border: 2px solid transparent; } -.grid-backgrounds .background-item.active { +.background-item.not-found, #opt-lc-bg-image.not-found { + text-align: center; + width: 100%; + margin-right: 0; + color: #999; + font-size: 15px; + padding-top: 10px; + padding-bottom: 10px; +} + +.background-item.active, .background-item.active-persistant, #opt-lc-bg-image.active, #opt-lc-bg-image.active-persistant { border-color: #007aff; } -.grid-backgrounds .aspect16by9 { +.background-item .aspect16by9, #opt-lc-bg-image .aspect16by9 { display: block; padding-bottom: 56.25%; background-size: cover; background-position: center; } -.grid-backgrounds input[type="radio"] { +.background-item input[type="radio"], #opt-lc-bg-image input[type="radio"] { position: absolute; width: 1px; height: 1px; @@ -867,4 +877,56 @@ h1, h2, h3, h4, h5, h6 { white-space: normal; } +#opt-lc-bg-image { + margin: 0; + width: 120px; + position: absolute; + top: 47px; + right: 20px; + cursor: pointer; +} + +#opt-lc-bg-image .restore-bg { + display: none; +} + +#opt-lc-bg-image .bg-dark { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + background-color: transparent; +} + +#opt-lc-bg-image:hover .bg-dark { + background-color: rgba(0, 0, 0, 0.5); +} + +#opt-lc-bg-image:hover .restore-bg { + display: block; + position: absolute; + z-index: 100; + height: 45px; + width: 45px; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + fill: #FFF; +} + +.option-bg-lc .option { + width: calc(100% - 140px); +} + +.profile-text { + font-weight: 400; + color: #9d9d9d; + letter-spacing: .01786em; + font-size: 13px; + margin-top: 8px; +} + /*# sourceMappingURL=main.css.map */ \ No newline at end of file diff --git a/css/main.css.map b/css/main.css.map index f94f691b..43384594 100644 --- a/css/main.css.map +++ b/css/main.css.map @@ -1 +1 @@ -{"version":3,"sources":["..\\scss\\main.scss"],"names":[],"mappings":"AAAA,yCAAO;AACP,0EAAY;AAyBZ;EACC,6BAAoB;EACpB,+BAAsB;CACtB;;AAED;EACC,+BAAsB;EAAtB,uBAAsB;CACtB;;AAED;EACC,UAAS;EACT,YAnBW;EAoBX,sBAAqB;EACrB,gBAAe;CACf;;AAED;EACC,qBAAoB;EACpB,mBAAkB;EAClB,qBAAoB;CACpB;;AAED;EACC,iBAAgB;CAChB;;AAED;EACC,gBAzCyB;EA0CzB,iBA1CyB;CA2CzB;;AACD;EACC,oBAAmB;CACnB;;AAED;EACC,oBAAmB;EACnB,iBAAgB;CAChB;;AAED;EACC,0BAlDiB;CAmDjB;;AAED;EAGE,+BAA8B;EAC9B,aAAY;EACZ,yBA9DwB;EA+DxB,+CAAsC;EAAtC,uCAAsC;EACtC,2BAhEwB;EAiExB,mBAAkB;EAClB,oBAAmB;EACnB,oBAnEwB;CAoExB;;AAXF;EAcE,SAAQ;EACR,UAAS;EACT,oBAAmB;EACnB,mBAAkB;EAClB,YAAW;EACX,iCAAgC;CAChC;;AApBF;EAsBE,mBAAkB;CAWlB;;AAjCF;EAwBG,4BAA2B;EAC3B,+BAA8B;EAC9B,gCAA+B;EAC/B,iCAAgC;EAChC,UAAS;EACT,sBAAqB;EACrB,cAAa;EACb,iBAAgB;CAChB;;AAhCH;EAmCE,kBAAiB;CAWjB;;AA9CF;EAqCG,4BAA2B;EAC3B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ACvB,oBAAmB;EACnB,YAAW;EACX,sBAAqB;EACrB,8BAA6B;CAK7B;;AAxBF;EAsBG,sBAhuBe;CAiuBf;;AAvBH;EA0BE,eAAc;EACd,uBAAsB;EACtB,uBAAsB;EACtB,4BAA2B;CAC3B;;AA9BF;EAgCE,mBAAkB;EAClB,WAAU;EACV,YAAW;EACX,WAAU;EACV,iBAAgB;EAChB,uBAAsB;EACtB,oBAAmB;EACnB,8BAA6B;EAC7B,sBAAqB;EACrB,UAAS;CACT;;AAGF;EAEE,aAAY;EACZ,wBA9vBwB;CA+vBxB;;AAJF;EAME,oBAAmB;CACnB"} \ No newline at end of file +{"version":3,"sources":["..\\scss\\main.scss"],"names":[],"mappings":"AAAA,yCAAO;AACP,0EAAY;AAyBZ;EACC,6BAAoB;EACpB,+BAAsB;CACtB;;AAED;EACC,+BAAsB;EAAtB,uBAAsB;CACtB;;AAED;EACC,UAAS;EACT,YAnBW;EAoBX,sBAAqB;EACrB,gBAAe;CACf;;AAED;EACC,qBAAoB;EACpB,mBAAkB;EAClB,qBAAoB;CACpB;;AAED;EACC,iBAAgB;CAChB;;AAED;EACC,gBAzCyB;EA0CzB,iBA1CyB;CA2CzB;;AACD;EACC,oBAAmB;CACnB;;AAED;EACC,oBAAmB;EACnB,iBAAgB;CAChB;;AAED;EACC,0BAlDiB;CAmDjB;;AAED;EAGE,+BAA8B;EAC9B,aAAY;EACZ,yBA9DwB;EA+DxB,+CAAsC;EAAtC,uCAAsC;EACtC,2BAhEwB;EAiExB,mBAAkB;EAClB,oBAAmB;EACnB,oBAnEwB;CAoExB;;AAXF;EAcE,SAAQ;EACR,UAAS;EACT,oBAAmB;EACnB,mBAAkB;EAClB,YAAW;EACX,iCAAgC;CAChC;;AApBF;EAsBE,mBAAkB;CAWlB;;AAjCF;EAwBG,4BAA2B;EAC3B,+BAA8B;EAC9B,gCAA+B;EAC/B,iCAAgC;EAChC,UAAS;EACT,sBAAqB;EACrB,cAAa;EACb,iBAAgB;CAChB;;AA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,iBAAgB;EAChB,mBAAkB;EAClB,mBAAkB;EAClB,wBAAuB;EACvB,oBAAmB;EACnB,YAAW;EACX,sBAAqB;EACrB,8BAA6B;CAiC7B;;AAzCD;EAWE,mBAAkB;EAClB,YAAW;EACX,gBAAe;EACf,YAAW;EACX,gBAAe;EACf,kBAAiB;EACjB,qBAAoB;CACpB;;AAlBF;EAqBE,sBA3uBgB;CA4uBhB;;AAtBF;EAwBE,eAAc;EACd,uBAAsB;EACtB,uBAAsB;EACtB,4BAA2B;CAC3B;;AA5BF;EA8BE,mBAAkB;EAClB,WAAU;EACV,YAAW;EACX,WAAU;EACV,iBAAgB;EAChB,uBAAsB;EACtB,oBAAmB;EACnB,8BAA6B;EAC7B,sBAAqB;EACrB,UAAS;CACT;;AAGF;EAEE,aAAY;EACZ,wBAxwBwB;CAywBxB;;AAJF;EAME,oBAAmB;CACnB;;AAEF;EACC,UAAS;EACT,aAAY;EACZ,mBAAkB;EAClB,UAAS;EACT,YAAW;EACX,gBAAe;CA8Bf;;AApCD;EAQE,cAAa;CACb;;AATF;EAWE,mBAAkB;EAClB,QAAO;EACP,SAAQ;EACR,OAAM;EACN,UAAS;EACT,8BAA6B;CAC7B;;AAjBF;EAoBG,qCAAgC;CAChC;;AArBH;EAuBG,eAAc;EACd,mBAAkB;EAClB,aAAY;EACZ,aAAY;EACZ,YAAW;EACX,QAAO;EACP,SAAQ;EACR,OAAM;EACN,UAAS;EACT,aAAY;EACZ,WAAU;CACV;;AAGH;EACC,0BAAyB;CACzB;;AACD;EACC,iBAAgB;EAChB,eAAc;EACd,yBAAwB;EACxB,gBAAe;EACf,gBAAe;CACf"} \ No newline at end of file diff --git a/js/optionsActions.js b/js/optionsActions.js index 4c3740ae..b67caa1b 100644 --- a/js/optionsActions.js +++ b/js/optionsActions.js @@ -41,8 +41,8 @@ function saveOptions(deelay) { }; snackbar.show(dataObj); - }, deelay); - }); + }); + }, deelay); } // Restores select box and checkbox state using the preferences @@ -64,13 +64,11 @@ function restoreOptions() { } }) - $('.grid-backgrounds') - .append(` -
- - -
- `) + $('#opt-lc-bg-image') + .find('label') + .css('background-image', 'url(' + items.optLcBgValue.replace('w=1920', 'w=200') + ')') + .prev('input') + .val(items.optLcBgValue.replace('w=1920', 'w=200')); $('#opt-lc-pagrid-active') .prop('checked', items.optLcPagridActive) @@ -148,36 +146,63 @@ function resetOptions() { // https://medium.com/@whiletruedothis/aprende-a-consumir-la-api-de-unsplash-%EF%B8%8F-c325c0bad53c const accesKey = '***REMOVED***'; const endPoint = 'https://api.unsplash.com'; +var GLOBAL_RAND_DEFAULT; -async function getImages(query, count) { - let response = await fetch(endPoint + '/photos/random?w=350&query=' + encodeURI(query) + '&count=' + count + '&orientation=landscape&client_id=' + accesKey); - - let jsonResponse = await response.json(); - let imagesList = await jsonResponse.results; - createImages(jsonResponse); +async function getImages(query, page, count) { + + if ($.trim(query).length) { + // let response = await fetch(endPoint + '/photos/random?w=200&query=' + encodeURI(query) + '&count=' + count + '&orientation=landscape&client_id=' + accesKey); + let response = await fetch(endPoint + '/search/photos?query=' + encodeURI($.trim(query)) + '&page=' + page + '&per_page=' + count + '&orientation=landscape&client_id=' + accesKey); + let jsonResponse = await response.json(); + let imagesList = await jsonResponse.results; + + createImages(imagesList); + imagesPaginator(jsonResponse, page); + } else { + createImages(GLOBAL_RAND_DEFAULT); + $('#load-more-bg').remove(); + } } async function getRandom(count) { - let response = await fetch(endPoint + '/photos/random?w=350&query=wallpaper&count=' + count + '&orientation=landscape&client_id=' + accesKey); + let response = await fetch(endPoint + '/photos/random?w=200&query=wallpaper&count=' + count + '&orientation=landscape&client_id=' + accesKey); let jsonResponse = await response.json(); createImages(jsonResponse); + GLOBAL_RAND_DEFAULT = jsonResponse; +} + +function imagesPaginator(jsonResponse, actualPage) { + $('#load-more-bg').remove(); + if ((actualPage + 1) <= jsonResponse.total_pages) { + $('.option-backgrounds').append(` + + `); + window.mdc.autoInit(); + } } function createImages(imagesList) { - $.each(imagesList, function(index, obj) { - console.log(obj); + if (imagesList.length) { + $.each(imagesList, function(index, obj) { + $('.grid-backgrounds').append(` +
+ + +
+ `); + }); + } else { $('.grid-backgrounds').append(` -
- - +
+ Not found images 😞
`); - }); + } } $(document).ready(function() { - getRandom(15); + getRandom(16); restoreOptions(); $('[name="opt-profile-avatar"]').change(function(event) { @@ -188,26 +213,26 @@ $(document).ready(function() { $(document).on('change', '[name="opt-lc-bg"]', function(event) { $('.background-item').removeClass('active'); $(this).parents('.background-item').addClass('active'); + + $('#opt-lc-bg-image') + .find('label') + .css('background-image', 'url(' + $(this).val().replace('w=1920', 'w=200') + ')') + .prev('input') + .val($(this).val().replace('w=1920', 'w=200')); }); - $('#load-more-bg').click(function(event) { - var val = $('#search-background').val(); - - if (val.length) { - getImages(val, 16) - } else { - getRandom(16) - } + $(document).on('click', '#load-more-bg', function(event) { + getImages($('#search-background').val(), $('#load-more-bg').data('load-page'), 16); }); // autosaves $(document) .on('change', '.panel-options [type="checkbox"], .panel-options [type="radio"]', function(event) { - saveOptions(250); + saveOptions(750); }); $('#opt-profile-name').keyup(function(event) { - saveOptions(1500); + saveOptions(2000); }); // end autosaves @@ -224,22 +249,24 @@ $(document).ready(function() { snackbar.show(dataObj); }); + // search keyup background var sto_searchBg = null; $('#search-background').keyup(function(event) { var val = $(this).val(); clearTimeout(sto_searchBg); if (event.keyCode == 13) { - $('.background-item').not('.active').remove(); - getImages(val, 15) + $('.background-item').not('#opt-lc-bg-image').remove(); + getImages(val, 1, 16) } else { sto_searchBg = setTimeout(function() { - $('.background-item').not('.active').remove(); - getImages(val, 15) + $('.background-item').not('#opt-lc-bg-image').remove(); + getImages(val, 1, 16) }, 3000); } }); + // conditioned background option by check $('#opt-lc-bg-active') .change(function(event) { if ($(this).prop('checked')) { @@ -248,4 +275,17 @@ $(document).ready(function() { $('.option-bg-lc').addClass('disabled'); } }) + + // reset bg + $('#opt-lc-bg-image').click(function(event) { + $(this) + .find('label') + .css('background-image', 'url(' + defaults.optLcBgValue + ')') + .prev('input') + .val(defaults.optLcBgValue); + + $('.background-item').removeClass('active'); + + saveOptions(250); + }); }); \ No newline at end of file diff --git a/js/optionsData.js b/js/optionsData.js index e72fdb20..10e625c5 100644 --- a/js/optionsData.js +++ b/js/optionsData.js @@ -98,6 +98,13 @@ var AVATARS /* The legend of Aang */ = [ var CHANGELOG = [ { + version: "2.1.5", + date: "30 Oct 2018", + lines: [ + "Fix autosave timeout", + "Improvements unsplash photo API" + ] + }, { version: "2.1.4", date: "26 Oct 2018", lines: [ diff --git a/manifest.json b/manifest.json index 8ebdda01..69f3e138 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "__MSG_appName__", - "version": "2.1.4", + "version": "2.1.5", "manifest_version": 2, "description": "__MSG_appDesc__", "homepage_url": "https://github.com/joelthorner/TLmanaGer", diff --git a/src/options/index.html b/src/options/index.html index 503bc283..875d0e1f 100644 --- a/src/options/index.html +++ b/src/options/index.html @@ -150,6 +150,7 @@

Developert

Profile

+ Usa el teu usuari de la intranet per possibles easter eggs
@@ -171,11 +172,17 @@

Background

+
+ + +
+ +
+
-