diff --git a/src/cloud-ui.html b/src/cloud-ui.html index 0d11edeab..3053d7ab8 100644 --- a/src/cloud-ui.html +++ b/src/cloud-ui.html @@ -7,8 +7,9 @@ -  + +

diff --git a/src/css/cloud-ui.css b/src/css/cloud-ui.css index a9519fc69..609b3cddc 100644 --- a/src/css/cloud-ui.css +++ b/src/css/cloud-ui.css @@ -2,7 +2,7 @@ background: url("../img/cloud.png") hsl(216, 100%, 93%); border-radius: 3px; margin: 0.5em 0; - padding: 1em; + padding: 1em 1em 0 1em; position: relative; } #cloudWidget.hide { @@ -22,6 +22,9 @@ #cloudWidget > button[disabled] { visibility: hidden; } +#cloudWidget > button.error { + color: red; + } #cloudPush:after { content: '\f0ee'; } @@ -29,6 +32,9 @@ #cloudPullAndMerge:before { content: '\f0ed'; } +#cloudPullAndMerge { + margin: 0 0.25em; + } #cloudPullAndMerge:after { content: '\f067'; font-size: 50%; @@ -45,7 +51,13 @@ vertical-align: bottom; white-space: pre; } -#cloudWidget > .nodata { +#cloudError { + color: red; + margin: 0; + padding: 0.5em 0; + } +#cloudError > span { + font-size: x-small; } #cloudWidget > #cloudCog { cursor: pointer; diff --git a/src/js/cloud-ui.js b/src/js/cloud-ui.js index fc3a596da..45a1f73a0 100644 --- a/src/js/cloud-ui.js +++ b/src/js/cloud-ui.js @@ -1,7 +1,7 @@ /******************************************************************************* uBlock Origin - a browser extension to block requests. - Copyright (C) 2015-2016 Raymond Hill + Copyright (C) 2015-2017 Raymond Hill This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ var messaging = vAPI.messaging; /******************************************************************************/ var onCloudDataReceived = function(entry) { - if ( typeof entry !== 'object' || entry === null ) { + if ( entry instanceof Object === false ) { return; } @@ -106,7 +106,15 @@ var pushData = function() { datakey: self.cloud.datakey, data: self.cloud.onPush() }, - fetchCloudData + function(error) { + var failed = typeof error === 'string'; + document.getElementById('cloudPush') + .classList + .toggle('error', failed); + document.querySelector('#cloudError > span') + .textContent = failed ? error : ''; + fetchCloudData(); + } ); }; @@ -149,7 +157,7 @@ var closeOptions = function(ev) { var submitOptions = function() { var onOptions = function(options) { - if ( typeof options !== 'object' || options === null ) { + if ( options instanceof Object === false ) { return; } self.cloud.options = options;