This commit is contained in:
gorhill 2017-09-21 11:46:15 -04:00
parent e3c4d4d7fe
commit ac481ec1f2
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 28 additions and 7 deletions

View File

@ -7,8 +7,9 @@
<body>
<button id="cloudPush" type="button" title="cloudPush"></button>
<span data-i18n="cloudNoData"></span>
<button id="cloudPull" type="button" title="cloudPull" disabled></button>&nbsp;
<button id="cloudPull" type="button" title="cloudPull" disabled></button>
<button id="cloudPullAndMerge" type="button" title="cloudPullAndMerge" disabled></button>
<p id="cloudError"><span></span></p>
<span id="cloudCog" class="fa">&#xf013;</span>
<div id="cloudOptions">
<div>

View File

@ -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;

View File

@ -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;