diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-12-10 18:49:03 -0500 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-12-10 18:49:03 -0500 |
commit | 1dbb45826d4414ed7a1acb5daff730b6e79e97c2 (patch) | |
tree | 9258a346834abccc9ce4881664ccb956f53ae9f7 /solr-8.1.1/server/solr-webapp/webapp/libs/ngtimeago.js | |
parent | 4ab742c54d600fb62b02268f48e711258558924b (diff) | |
parent | 68ccde3251622fdb51ef3d21282fddd8207da3c1 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'solr-8.1.1/server/solr-webapp/webapp/libs/ngtimeago.js')
-rw-r--r-- | solr-8.1.1/server/solr-webapp/webapp/libs/ngtimeago.js | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/solr-8.1.1/server/solr-webapp/webapp/libs/ngtimeago.js b/solr-8.1.1/server/solr-webapp/webapp/libs/ngtimeago.js deleted file mode 100644 index 5592402f3..000000000 --- a/solr-8.1.1/server/solr-webapp/webapp/libs/ngtimeago.js +++ /dev/null @@ -1,101 +0,0 @@ -/* -Copyright (c) 2014 Uttesh Kumar - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -'use strict'; - -var catalyst = angular.module('ngtimeago', []); - - -catalyst.filter('timeago', function() { - return function(input, p_allowFuture) { - - if (input === undefined) { - return "-"; - } - - var substitute = function (stringOrFunction, number, strings) { - var string = angular.isFunction(stringOrFunction) ? stringOrFunction(number, dateDifference) : stringOrFunction; - var value = (strings.numbers && strings.numbers[number]) || number; - return string.replace(/%d/i, value); - }, - nowTime = (new Date()).getTime(), - date = (new Date(input)).getTime(), - //refreshMillis= 6e4, //A minute - allowFuture = p_allowFuture || false, - strings= { - prefixAgo: ' ', - prefixFromNow: '', - suffixAgo: "ago", - suffixFromNow: "from now", - seconds: "less than a minute", - minute: "about a minute", - minutes: "%d minutes", - hour: "about an hour", - hours: "about %d hours", - day: "a day", - days: "%d days", - month: "about a month", - months: "%d months", - year: "about a year", - years: "%d years" - }, - dateDifference = nowTime - date, - words, - seconds = Math.abs(dateDifference) / 1000, - minutes = seconds / 60, - hours = minutes / 60, - days = hours / 24, - years = days / 365, - separator = strings.wordSeparator === undefined ? " " : strings.wordSeparator, - - - prefix = strings.prefixAgo, - suffix = strings.suffixAgo; - - if (allowFuture) { - if (dateDifference < 0) { - prefix = strings.prefixFromNow; - suffix = strings.suffixFromNow; - } - } - - words = seconds < 45 && substitute(strings.seconds, Math.round(seconds), strings) || - seconds < 90 && substitute(strings.minute, 1, strings) || - minutes < 45 && substitute(strings.minutes, Math.round(minutes), strings) || - minutes < 90 && substitute(strings.hour, 1, strings) || - hours < 24 && substitute(strings.hours, Math.round(hours), strings) || - hours < 42 && substitute(strings.day, 1, strings) || - days < 30 && substitute(strings.days, Math.round(days), strings) || - days < 45 && substitute(strings.month, 1, strings) || - days < 365 && substitute(strings.months, Math.round(days / 30), strings) || - years < 1.5 && substitute(strings.year, 1, strings) || - substitute(strings.years, Math.round(years), strings); - console.log(words+" "+prefix+suffix); - prefix.replace(/ /g, '') - words.replace(/ /g, '') - suffix.replace(/ /g, '') - return (prefix+' '+words+' '+suffix+' '+separator); - }; - }); - - - |