mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Improve trusted-set-local-storage-item
scriptlet
Related discussion:
df1041c616 (commitcomment-141265533)
This commit is contained in:
parent
f0cfc77170
commit
2ccc3135c1
1 changed files with 8 additions and 6 deletions
|
@ -1052,12 +1052,14 @@ function setLocalStorageItemFn(
|
|||
];
|
||||
|
||||
if ( trusted ) {
|
||||
if ( value === '$now$' ) {
|
||||
value = Date.now();
|
||||
} else if ( value === '$currentDate$' ) {
|
||||
value = `${Date()}`;
|
||||
} else if ( value === '$currentISODate$' ) {
|
||||
value = (new Date()).toISOString();
|
||||
if ( value.includes('$now$') ) {
|
||||
value.replaceAll('$now$', Date.now());
|
||||
}
|
||||
if ( value.includes('$currentDate$') ) {
|
||||
value.replaceAll('$currentDate$', `${Date()}`);
|
||||
}
|
||||
if ( value.includes('$currentISODate$') ) {
|
||||
value.replaceAll('$currentISODate$', (new Date()).toISOString());
|
||||
}
|
||||
} else {
|
||||
const normalized = value.toLowerCase();
|
||||
|
|
Loading…
Reference in a new issue