Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2036)

Unified Diff: Tools/GardeningServer/scripts/base.js

Issue 336033002: Cleanup some garden-o-matic cruft and dead code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Tools/GardeningServer/scripts/base.js
diff --git a/Tools/GardeningServer/scripts/base.js b/Tools/GardeningServer/scripts/base.js
index e4fdd2ed73c0e89ebde048566272f9bc9ba28336..7a783b3a3f6023ea85c285832c4958a851f65407 100644
--- a/Tools/GardeningServer/scripts/base.js
+++ b/Tools/GardeningServer/scripts/base.js
@@ -261,55 +261,6 @@ base.extends = function(base, prototype)
return extended;
}
-function createRelativeTimeDescriptor(divisorInMilliseconds, unit)
-{
- return function(delta) {
- var deltaInUnits = delta / divisorInMilliseconds;
- return (deltaInUnits).toFixed(0) + ' ' + unit + (deltaInUnits >= 1.5 ? 's' : '') + ' ago';
- }
-}
-
-var kMinuteInMilliseconds = 60 * 1000;
-var kRelativeTimeSlots = [
- {
- maxMilliseconds: kMinuteInMilliseconds,
- describe: function(delta) { return 'Just now'; }
- },
- {
- maxMilliseconds: 60 * kMinuteInMilliseconds,
- describe: createRelativeTimeDescriptor(kMinuteInMilliseconds, 'minute')
- },
- {
- maxMilliseconds: 24 * 60 * kMinuteInMilliseconds,
- describe: createRelativeTimeDescriptor(60 * kMinuteInMilliseconds, 'hour')
- },
- {
- maxMilliseconds: Number.MAX_VALUE,
- describe: createRelativeTimeDescriptor(24 * 60 * kMinuteInMilliseconds, 'day')
- }
-];
-
-/*
- Represent time as descriptive text, relative to now and gradually decreasing in precision:
- delta < 1 minutes => Just Now
- delta < 60 minutes => X minute[s] ago
- delta < 24 hours => X hour[s] ago
- delta < inf => X day[s] ago
-*/
-base.relativizeTime = function(time)
-{
- var result;
- var delta = new Date().getTime() - time;
- kRelativeTimeSlots.some(function(slot) {
- if (delta >= slot.maxMilliseconds)
- return false;
-
- result = slot.describe(delta);
- return true;
- });
- return result;
-}
-
base.getURLParameter = function(name)
{
var match = RegExp(name + '=' + '(.+?)(&|$)').exec(location.search);
« no previous file with comments | « no previous file | Tools/GardeningServer/scripts/base_unittests.js » ('j') | Tools/GardeningServer/scripts/config.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698