1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-18 08:52:26 +02:00

make cloud storage support optional

(currently not supported on FF-webext and MS Edge)
This commit is contained in:
gorhill 2016-10-16 13:04:31 -04:00
parent fff8e71ac0
commit 2e953b45c9
4 changed files with 25 additions and 13 deletions

View File

@ -37,7 +37,9 @@ div > p:last-child {
input[type="number"] {
width: 5em;
}
input[type="checkbox"][disabled] + label {
opacity: 0.4;
}
.para {
width: 40em;
}

View File

@ -648,16 +648,18 @@ vAPI.messaging.listen('elementPicker', onMessage);
/******************************************************************************/
var µb = µBlock;
/******************************************************************************/
var onMessage = function(request, sender, callback) {
// Cloud storage support is optional.
if ( vAPI.cloud instanceof Object === false ) {
callback();
return;
}
// Async
switch ( request.what ) {
case 'cloudGetOptions':
vAPI.cloud.getOptions(function(options) {
options.enabled = µb.userSettings.cloudStorageEnabled === true;
options.enabled = µBlock.userSettings.cloudStorageEnabled === true;
callback(options);
});
return;
@ -722,7 +724,8 @@ var getLocalData = function(callback) {
lastRestoreFile: o.lastRestoreFile,
lastRestoreTime: o.lastRestoreTime,
lastBackupFile: o.lastBackupFile,
lastBackupTime: o.lastBackupTime
lastBackupTime: o.lastBackupTime,
cloudStorageSupported: vAPI.cloud instanceof Object
});
};

View File

@ -138,6 +138,10 @@ var onLocalDataReceived = function(details) {
uDom('#localData > ul > li:nth-of-type(3) > ul > li:nth-of-type(2)').text(lastRestoreFile);
uDom('#localData > ul > li:nth-of-type(3)').css('display', '');
}
if ( details.cloudStorageSupported === false ) {
uDom('#cloud-storage-enabled').attr('disabled', '');
}
};
/******************************************************************************/

View File

@ -67,12 +67,15 @@ var onAllReady = function() {
// for launch time.
µb.assets.remoteFetchBarrier -= 1;
vAPI.cloud.start([
'tpFiltersPane',
'myFiltersPane',
'myRulesPane',
'whitelistPane'
]);
// vAPI.cloud is optional.
if ( vAPI.cloud instanceof Object ) {
vAPI.cloud.start([
'tpFiltersPane',
'myFiltersPane',
'myRulesPane',
'whitelistPane'
]);
}
//quickProfiler.stop(0);