mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 09:31:01 +01:00
this fixes #313
This commit is contained in:
parent
86c52305c8
commit
e7479dd4be
3 changed files with 55 additions and 1 deletions
|
@ -523,6 +523,30 @@
|
|||
"message":"µBlock: Add the following URL to your custom filter lists?\n\nTitle: \"{{title}}\"\nURL: {{url}}",
|
||||
"description":"English: The message seen by the user to confirm subscription to a ABP filter list"
|
||||
},
|
||||
"elapsedOneMinuteAgo":{
|
||||
"message":"a minute ago",
|
||||
"description":"English: a minute ago"
|
||||
},
|
||||
"elapsedManyMinutesAgo":{
|
||||
"message":"{{value}} minutes ago",
|
||||
"description":"English: {{value}} minutes ago"
|
||||
},
|
||||
"elapsedOneHourAgo":{
|
||||
"message":"a hour ago",
|
||||
"description":"English: a hour ago"
|
||||
},
|
||||
"elapsedManyHoursAgo":{
|
||||
"message":"{{value}} hours ago",
|
||||
"description":"English: {{value}} hours ago"
|
||||
},
|
||||
"elapsedOneDayAgo":{
|
||||
"message":"a day ago",
|
||||
"description":"English: a day ago"
|
||||
},
|
||||
"elapsedManyDaysAgo":{
|
||||
"message":"{{value}} days ago",
|
||||
"description":"English: {{value}} days ago"
|
||||
},
|
||||
"dummy":{
|
||||
"message":"This entry must be the last one",
|
||||
"description":"so we dont need to deal with comma for last entry"
|
||||
|
|
|
@ -127,7 +127,9 @@ var renderBlacklists = function() {
|
|||
|
||||
// In cache
|
||||
if ( asset.cached ) {
|
||||
li.descendants('span.status.purge').css('display', '');
|
||||
elem = li.descendants('span.status.purge');
|
||||
elem.css('display', '');
|
||||
elem.attr('title', renderElapsedTime(asset.lastModified));
|
||||
hasCachedContent = true;
|
||||
}
|
||||
return li;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
|
||||
/* global vAPI, uDom */
|
||||
/* exported renderElapsedTime */
|
||||
|
||||
'use strict';
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -46,3 +48,29 @@ uDom.onLoad(function() {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var renderElapsedTime = function(tstamp) {
|
||||
var value = (Date.now() - tstamp) / 60000;
|
||||
if ( value < 2 ) {
|
||||
return vAPI.i18n('elapsedOneMinuteAgo');
|
||||
}
|
||||
if ( value < 60 ) {
|
||||
return vAPI.i18n('elapsedManyMinutesAgo').replace('{{value}}', Math.floor(value).toLocaleString());
|
||||
}
|
||||
value /= 60;
|
||||
if ( value < 2 ) {
|
||||
return vAPI.i18n('elapsedOneHourAgo');
|
||||
}
|
||||
if ( value < (24 * 60) ) {
|
||||
return vAPI.i18n('elapsedManyHoursAgo').replace('{{value}}', Math.floor(value).toLocaleString());
|
||||
}
|
||||
value /= 24;
|
||||
if ( value < 2 ) {
|
||||
return vAPI.i18n('elapsedOneDayAgo');
|
||||
}
|
||||
return vAPI.i18n('elapsedManyDaysAgo').replace('{{value}}', Math.floor(value).toLocaleString());
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
Loading…
Reference in a new issue