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

Unified Diff: options/time.js

Issue 8560083: adblockplusopera: Port UI code from Chrome (Closed)
Patch Set: Created Oct. 16, 2012, 2:16 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: options/time.js
===================================================================
deleted file mode 100644
--- a/options/time.js
+++ /dev/null
@@ -1,36 +0,0 @@
-const updateTime = {
- display: function() {
- var elements = document.getElementsByClassName('update_time');
- for(i = 0; i < elements.length; i++) {
- var key = elements[i].parentNode.id;
- if(preferences.exist(key + '-time')) {
- var difference = getTime() - preferences.int(key + '-time');
- elements[i].innerHTML = ' ' + this.string(difference);
- }
- else {
- elements[i].innerHTML = ' ' + translate.get('update_just');
- }
- }
- },
- string: function(time) {
- if(time < 60000) //< 1 minute
- return (translate.get('update_just'));
- if(time < 2*60000) //< 2 minutes
- return (translate.get('update_minute'));
- if(time < 60*60000) //< 1 hour
- return (translate.get('update_minutes')).replace(/%/, Math.floor(time / (60000)));
- if(time < 2*60*60000) //< 2 hours
- return (translate.get('update_hour'));
- if(time < 24*60*60000) //< 1 day
- return (translate.get('update_hours')).replace(/%/, Math.floor(time / (60*60000)));
- if(time < 2*24*60*60000) //< 2 days
- return (translate.get('update_day'));
- if(time < 30*24*60*60000) //< 1 month
- return (translate.get('update_days')).replace(/%/, Math.floor(time / (24*60*60000)));
- else //> 1 month
- return (translate.get('update_old'));
- }
-};
-
-updateTime.display();
-window.setInterval("updateTime.display();", 5000)

Powered by Google App Engine
This is Rietveld