diff --git a/css/app.css b/css/app.css index 90e7a02..554c8a0 100644 --- a/css/app.css +++ b/css/app.css @@ -8,6 +8,10 @@ ul { margin: 0; padding: 0; } +img { + max-width: 100%; +} + .titlebar { -webkit-user-select: none; -webkit-app-region: drag; @@ -20,12 +24,21 @@ ul { float: right; line-height: 0; } + button { -webkit-app-region: no-drag; - background: none; - border: none; - outline: none; + background-color: #000000; + color: #fff; + border: 1px solid #252525; + padding: 5px 10px; + margin: -1px 0px 0px 0px; + font-family: 'Inconsolata', monospace; } + header button { + background: none; + border: none; + outline: none; + } #close-btn, #min-btn { @@ -405,4 +418,20 @@ ul { background: #252525; color: white; pointer-events: none; - } \ No newline at end of file + } + +/*Offline*/ +.error { + text-align: center; +} + .error h2, + .error h4 { + font-family: Arial,Helvetica,sans-serif; + } + .error button.refresh { + cursor: pointer; + background: #41BB2E; + border: none; + color: #000; + font-weight: bold; + } \ No newline at end of file diff --git a/images/offline_doge.jpg b/images/offline_doge.jpg new file mode 100644 index 0000000..87b847f Binary files /dev/null and b/images/offline_doge.jpg differ diff --git a/js/app_common.js b/js/app_common.js index b2bb311..b61f940 100644 --- a/js/app_common.js +++ b/js/app_common.js @@ -27,7 +27,7 @@ settings.set('developer', { } (function() { - + // Settings - list of coins function loadJSON(callback) { var file = 'https://www.cryptocompare.com/api/data/coinlist/'; var xobj = new XMLHttpRequest(); @@ -189,12 +189,31 @@ function initData() { }); //sortable }); //response.json + updateData(); } //function(response) ) //.then .catch(function(err) { - console.log('Fetch Error :-S', err); + console.log('Unable to connect!'); + + + // Parse JSON string into object + var mainDiv = document.getElementById("main"); + + var errorDiv = document.createElement('div'); + + errorDiv.className = 'error'; + + errorDiv.innerHTML = '

Uh-oh! Looks like you're offline.

\ + \ +

Reconnect, then reload the app.

\ + '; + + document.getElementById('main').appendChild(errorDiv); + + + }); - updateData(); + } function updateData() { @@ -268,6 +287,10 @@ function updateData() { //console.log(coinDISPLAY); let li = document.getElementById("coin-"+[key]), span = document.querySelector("#coin-"+[key]+" span"); + //when adding a new coin, default sortorder to 999 + if( li.getAttribute('sortorder')=="undefined" ) { + li.setAttribute("sortorder", 999); + } span.setAttribute("class", "draggable"); let coinSymbol = coinRAW[base].FROMSYMBOL; @@ -303,6 +326,16 @@ function updateData() { change.classList.remove("negative"); } + // Apply Sorting + sortChildren( + document.getElementById('prices'), + function(li) { return +li.getAttribute('sortorder') } + ); + sortChildren( + document.getElementById('portfolio-list'), + function(li) { return +li.getAttribute('sortorder') } + ); + // Portfolio let quantityValue = document.querySelector("#coin-"+[key]+" .quantity-value"); let quantityNumber = settings.get('quantity.'+[key]); diff --git a/release-builds/Crypto Price Widget-macOS.zip b/release-builds/Crypto Price Widget-macOS.zip deleted file mode 100644 index 1837f60..0000000 Binary files a/release-builds/Crypto Price Widget-macOS.zip and /dev/null differ diff --git a/release-builds/Crypto Price Widget-windows.zip b/release-builds/Crypto Price Widget-windows.zip deleted file mode 100644 index a8c4e46..0000000 Binary files a/release-builds/Crypto Price Widget-windows.zip and /dev/null differ