| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. |
| 5 |
| 6 window.SwarmingBehaviors.BotPageBehavior contains any shared functions and |
| 7 constants used by the bot-page and its sub-elements. |
| 8 |
| 9 To use it, include |
| 10 behaviors: [SwarmingBehaviors.BotPageBehavior] |
| 11 in the creation of your Polymer element. |
| 12 --> |
| 13 <link rel="import" href="/res/imp/common/common-behavior.html"> |
| 14 <script> |
| 15 (function(){ |
| 16 |
| 17 |
| 18 // This behavior wraps up all the shared bot-page functionality by |
| 19 // extending SwarmingBehaviors.CommonBehavior |
| 20 SwarmingBehaviors.BotPageBehavior = [SwarmingBehaviors.CommonBehavior, { |
| 21 |
| 22 // timeDiffApprox returns the approximate difference between now and |
| 23 // the specified date. |
| 24 _timeDiffApprox: function(date){ |
| 25 if (!date) { |
| 26 return "eons"; |
| 27 } |
| 28 return sk.human.diffDate(date.getTime()); |
| 29 }, |
| 30 |
| 31 // timeDiffExact returns the exact difference between the two specified |
| 32 // dates. E.g. 2d 22h 22m 28s ago If a second date is not provided, |
| 33 // now is used. |
| 34 _timeDiffExact: function(first, second){ |
| 35 if (!first) { |
| 36 return "eons"; |
| 37 } |
| 38 if (!second) { |
| 39 second = new Date(); |
| 40 } |
| 41 return sk.human.strDuration((second.getTime() - first.getTime())/1000); |
| 42 }, |
| 43 |
| 44 }]; |
| 45 })() |
| 46 </script> |
| OLD | NEW |