fix "purge all" button not disabled when there is nothing left to purge

This commit is contained in:
gorhill 2017-05-26 08:31:19 -04:00
parent c77830995b
commit 8d2319e011
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 7 additions and 3 deletions

View File

@ -276,7 +276,10 @@ var renderFilterLists = function(soft) {
var renderWidgets = function() { var renderWidgets = function() {
uDom('#buttonApply').toggleClass('disabled', filteringSettingsHash === hashFromCurrentFromSettings()); uDom('#buttonApply').toggleClass('disabled', filteringSettingsHash === hashFromCurrentFromSettings());
uDom('#buttonPurgeAll').toggleClass('disabled', document.querySelector('#lists .listEntry.cached') === null); uDom('#buttonPurgeAll').toggleClass(
'disabled',
document.querySelector('#lists .listEntry.cached:not(.obsolete)') === null
);
uDom('#buttonUpdate').toggleClass('disabled', document.querySelector('body:not(.updating) #lists .listEntry.obsolete > input[type="checkbox"]:checked') === null); uDom('#buttonUpdate').toggleClass('disabled', document.querySelector('body:not(.updating) #lists .listEntry.obsolete > input[type="checkbox"]:checked') === null);
}; };

View File

@ -75,13 +75,14 @@
return th; return th;
}, },
// https://github.com/chrisaljoudi/uBlock/issues/1118
// We limit to a maximum number of tokens.
_tokenize: function() { _tokenize: function() {
var tokens = this._tokens, var tokens = this._tokens,
url = this._urlOut, url = this._urlOut,
l = url.length; l = url.length;
if ( l === 0 ) { tokens[0] = 0; return; } if ( l === 0 ) { tokens[0] = 0; return; }
// https://github.com/chrisaljoudi/uBlock/issues/1118
// We limit to a maximum number of tokens.
if ( l > 2048 ) { if ( l > 2048 ) {
url = url.slice(0, 2048); url = url.slice(0, 2048);
l = 2048; l = 2048;