1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Add support for minute unit

This commit is contained in:
Raymond Hill 2023-11-14 13:53:17 -05:00
parent 143fc84f40
commit 6a9c69aa94
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -51,11 +51,13 @@ let remoteServerFriendly = false;
const stringIsNotEmpty = s => typeof s === 'string' && s !== '';
const parseExpires = s => {
const matches = s.match(/(\d+)\s*([dh])?/i);
const matches = s.match(/(\d+)\s*([dhm]?)/i);
if ( matches === null ) { return 0; }
let updateAfter = parseInt(matches[1], 10);
if ( matches[2] === 'h' ) {
updateAfter = Math.max(updateAfter, 4) / 24;
} else if ( matches[2] === 'm' ) {
updateAfter = Math.max(updateAfter, 240) / 1440;
}
return updateAfter;
};