Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: options/time.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Patch Set: Created Oct. 2, 2012, 1:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 const updateTime = {
2 display: function() {
3 var elements = document.getElementsByClassName('update_time');
4 for(i = 0; i < elements.length; i++) {
5 var key = elements[i].parentNode.id;
6 if(preferences.exist(key + '-time')) {
7 var difference = getTime() - preferences.int(key + '-time');
8 elements[i].innerHTML = ' ' + this.string(differ ence);
9 }
10 else {
11 elements[i].innerHTML = ' ' + translate.get('upd ate_just');
12 }
13 }
14 },
15 string: function(time) {
16 if(time < 60000) //< 1 minute
17 return (translate.get('update_just'));
18 if(time < 2*60000) //< 2 minutes
19 return (translate.get('update_minute'));
20 if(time < 60*60000) //< 1 hour
21 return (translate.get('update_minutes')).replace(/%/, Ma th.floor(time / (60000)));
22 if(time < 2*60*60000) //< 2 hours
23 return (translate.get('update_hour'));
24 if(time < 24*60*60000) //< 1 day
25 return (translate.get('update_hours')).replace(/%/, Math .floor(time / (60*60000)));
26 if(time < 2*24*60*60000) //< 2 days
27 return (translate.get('update_day'));
28 if(time < 30*24*60*60000) //< 1 month
29 return (translate.get('update_days')).replace(/%/, Math. floor(time / (24*60*60000)));
30 else //> 1 month
31 return (translate.get('update_old'));
32 }
33 };
34
35 updateTime.display();
36 window.setInterval("updateTime.display();", 5000)
OLDNEW
« files/sources.js ('K') | « options/privacy.js ('k') | options/whitelist.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld