diff --git a/ajax/libs/jquery-timeago/0.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.1/jquery.timeago.js new file mode 100644 index 000000000..6ed7803fe --- /dev/null +++ b/ajax/libs/jquery-timeago/0.1/jquery.timeago.js @@ -0,0 +1,76 @@ +/* + * Time Ago (for jQuery) version: 0.1 (07/18/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + // TODO: should take a Date, ISO8601, or element[title=iso8601] + // return words if date or iso8601; convert and return element if element + alert("jQuery.timeago helper not implemented yet"); + }; + + $.extend($.timeago, { + settings: { + refreshSeconds: 60 + }, + inWords: function(distanceMillis) { + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && "less than a minute" || + seconds < 90 && "about 1 minute" || + minutes < 45 && Math.round(minutes) + " minutes" || + minutes < 90 && "about 1 hour" || + hours < 24 && Math.round(hours) + " hours" || + hours < 48 && "about 1 day" || + days < 30 && Math.floor(days) + " days" || + days < 60 && "about 1 month" || + days < 365 && Math.floor(days / 30) + " months" || + years < 2 && "about 1 year" || + Math.floor(years) + " years"; + + return words + " ago"; + }, + parse: function(iso8601) { + var s = iso8601.replace(/^\s+/, '').replace(/\s+$/, ''); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $.timeago.settings; + if ($s.refreshSeconds > 0) { + setInterval(function() { self.each(refresh); }, ($s.refreshSeconds * 1000)); + } + }; + + function refresh() { + var date = $.timeago.parse(this.title); + $(this).text($.timeago.inWords(distance(date))); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } +})(jQuery); + diff --git a/ajax/libs/jquery-timeago/0.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.1/jquery.timeago.min.js new file mode 100644 index 000000000..793713af2 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(e){function t(){var t=e.timeago.parse(this.title);e(this).text(e.timeago.inWords(a(t)))}function a(e){return(new Date).getTime()-e.getTime()}e.timeago=function(){alert("jQuery.timeago helper not implemented yet")},e.extend(e.timeago,{settings:{refreshSeconds:60},inWords:function(e){var t=e/1e3,a=t/60,r=a/60,n=r/24,o=n/365,i=45>t&&"less than a minute"||90>t&&"about 1 minute"||45>a&&Math.round(a)+" minutes"||90>a&&"about 1 hour"||24>r&&Math.round(r)+" hours"||48>r&&"about 1 day"||30>n&&Math.floor(n)+" days"||60>n&&"about 1 month"||365>n&&Math.floor(n/30)+" months"||2>o&&"about 1 year"||Math.floor(o)+" years";return i+" ago"},parse:function(e){var t=e.replace(/^\s+/,"").replace(/\s+$/,"");return t=t.replace(/-/,"/").replace(/-/,"/"),t=t.replace(/T/," ").replace(/Z/," UTC"),t=t.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(t)}}),e.fn.timeago=function(){var a=this;a.each(t);var r=e.timeago.settings;r.refreshSeconds>0&&setInterval(function(){a.each(t)},1e3*r.refreshSeconds)}}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.10.0/jquery.timeago.js b/ajax/libs/jquery-timeago/0.10.0/jquery.timeago.js new file mode 100644 index 000000000..24ac69c79 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.10.0/jquery.timeago.js @@ -0,0 +1,146 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.10.0 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/0.10.0/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.10.0/jquery.timeago.min.js new file mode 100644 index 000000000..5e69d4871 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.10.0/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());r.length>0&&e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||48>u&&r(a.day,1)||30>m&&r(a.days,Math.floor(m))||60>m&&r(a.month,1)||365>m&&r(a.months,Math.floor(m/30))||2>d&&r(a.year,1)||r(a.years,Math.floor(d));return t.trim([n,f,i].join(" "))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r="time"===t(e).get(0).tagName.toLowerCase(),a=t(e).attr(r?"datetime":"title");return i.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.10.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.10.1/jquery.timeago.js new file mode 100644 index 000000000..bb20c421c --- /dev/null +++ b/ajax/libs/jquery-timeago/0.10.1/jquery.timeago.js @@ -0,0 +1,147 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.10.1 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join($l.wordSeparator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/0.10.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.10.1/jquery.timeago.min.js new file mode 100644 index 000000000..7cc408e62 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.10.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());r.length>0&&e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||48>u&&r(a.day,1)||30>m&&r(a.days,Math.floor(m))||60>m&&r(a.month,1)||365>m&&r(a.months,Math.floor(m/30))||2>d&&r(a.year,1)||r(a.years,Math.floor(d));return t.trim([n,f,i].join(a.wordSeparator))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r="time"===t(e).get(0).tagName.toLowerCase(),a=t(e).attr(r?"datetime":"title");return i.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.11.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.11.1/jquery.timeago.js new file mode 100644 index 000000000..77ef5a3d3 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11.1/jquery.timeago.js @@ -0,0 +1,148 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.11.1 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator; + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/0.11.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.11.1/jquery.timeago.min.js new file mode 100644 index 000000000..5df2e2e71 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());r.length>0&&e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||42>u&&r(a.day,1)||30>m&&r(a.days,Math.round(m))||45>m&&r(a.month,1)||365>m&&r(a.months,Math.round(m/30))||1.5>d&&r(a.year,1)||r(a.years,Math.round(d)),h=void 0===a.wordSeparator?" ":a.wordSeparator;return t.trim([n,f,i].join(h))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r="time"===t(e).get(0).tagName.toLowerCase(),a=t(e).attr(r?"datetime":"title");return i.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.11.2/jquery.timeago.js b/ajax/libs/jquery-timeago/0.11.2/jquery.timeago.js new file mode 100644 index 000000000..bd9efbb1a --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11.2/jquery.timeago.js @@ -0,0 +1,150 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.11.2 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator; + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/0.11.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.11.2/jquery.timeago.min.js new file mode 100644 index 000000000..e3da2ec58 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());!(r.length>0)||i.isTime(e)&&e.attr("title")||e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||42>u&&r(a.day,1)||30>m&&r(a.days,Math.round(m))||45>m&&r(a.month,1)||365>m&&r(a.months,Math.round(m/30))||1.5>d&&r(a.year,1)||r(a.years,Math.round(d)),h=void 0===a.wordSeparator?" ":a.wordSeparator;return t.trim([n,f,i].join(h))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r=t(e).attr(i.isTime(e)?"datetime":"title");return i.parse(r)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.11.3/jquery.timeago.js b/ajax/libs/jquery-timeago/0.11.3/jquery.timeago.js new file mode 100644 index 000000000..141774739 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11.3/jquery.timeago.js @@ -0,0 +1,152 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.11.3 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2012, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator === undefined ? " " : $l.wordSeparator; + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/0.11.3/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.11.3/jquery.timeago.min.js new file mode 100644 index 000000000..706be3062 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11.3/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());!(r.length>0)||i.isTime(e)&&e.attr("title")||e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||42>u&&r(a.day,1)||30>m&&r(a.days,Math.round(m))||45>m&&r(a.month,1)||365>m&&r(a.months,Math.round(m/30))||1.5>d&&r(a.year,1)||r(a.years,Math.round(d)),h=void 0===a.wordSeparator?" ":a.wordSeparator;return t.trim([n,f,i].join(h))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r=t(e).attr(i.isTime(e)?"datetime":"title");return i.parse(r)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.11/jquery.timeago.js b/ajax/libs/jquery-timeago/0.11/jquery.timeago.js new file mode 100644 index 000000000..3a8f0046a --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11/jquery.timeago.js @@ -0,0 +1,147 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 0.11 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + return $.trim([prefix, words, suffix].join($l.wordSeparator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/0.11/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.11/jquery.timeago.min.js new file mode 100644 index 000000000..54a21afb4 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.11/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());r.length>0&&e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||42>u&&r(a.day,1)||30>m&&r(a.days,Math.round(m))||45>m&&r(a.month,1)||365>m&&r(a.months,Math.round(m/30))||1.5>d&&r(a.year,1)||r(a.years,Math.round(d));return t.trim([n,f,i].join(a.wordSeparator))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r="time"===t(e).get(0).tagName.toLowerCase(),a=t(e).attr(r?"datetime":"title");return i.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.2/jquery.timeago.js b/ajax/libs/jquery-timeago/0.2/jquery.timeago.js new file mode 100644 index 000000000..ad7a85a50 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.2/jquery.timeago.js @@ -0,0 +1,78 @@ +/* + * Time Ago (for jQuery) version: 0.2 (07/19/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + // TODO: should take a Date, ISO8601, or element[title=iso8601] + // return words if date or iso8601; convert and return element if element + alert("jQuery.timeago helper not implemented yet"); + }; + + $.extend($.timeago, { + settings: { + refreshSeconds: 60 + }, + inWords: function(distanceMillis) { + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && "less than a minute" || + seconds < 90 && "about a minute" || + minutes < 45 && Math.round(minutes) + " minutes" || + minutes < 90 && "about an hour" || + hours < 24 && "about " + Math.round(hours) + " hours" || + hours < 48 && "a day" || + days < 30 && Math.floor(days) + " days" || + days < 60 && "about a month" || + days < 365 && Math.floor(days / 30) + " months" || + years < 2 && "about a year" || + Math.floor(years) + " years"; + + return words + " ago"; + }, + parse: function(iso8601) { + var s = iso8601.replace(/^\s+/, '').replace(/\s+$/, ''); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $.timeago.settings; + if ($s.refreshSeconds > 0) { + setInterval(function() { self.each(refresh); }, ($s.refreshSeconds * 1000)); + } + }; + + function refresh() { + var date = $.timeago.parse(this.title); + if (!isNaN(date)) { + $(this).text($.timeago.inWords(distance(date))); + } + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } +})(jQuery); + diff --git a/ajax/libs/jquery-timeago/0.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.2/jquery.timeago.min.js new file mode 100644 index 000000000..3ced335eb --- /dev/null +++ b/ajax/libs/jquery-timeago/0.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(e){function t(){var t=e.timeago.parse(this.title);isNaN(t)||e(this).text(e.timeago.inWords(a(t)))}function a(e){return(new Date).getTime()-e.getTime()}e.timeago=function(){alert("jQuery.timeago helper not implemented yet")},e.extend(e.timeago,{settings:{refreshSeconds:60},inWords:function(e){var t=e/1e3,a=t/60,n=a/60,r=n/24,o=r/365,i=45>t&&"less than a minute"||90>t&&"about a minute"||45>a&&Math.round(a)+" minutes"||90>a&&"about an hour"||24>n&&"about "+Math.round(n)+" hours"||48>n&&"a day"||30>r&&Math.floor(r)+" days"||60>r&&"about a month"||365>r&&Math.floor(r/30)+" months"||2>o&&"about a year"||Math.floor(o)+" years";return i+" ago"},parse:function(e){var t=e.replace(/^\s+/,"").replace(/\s+$/,"");return t=t.replace(/-/,"/").replace(/-/,"/"),t=t.replace(/T/," ").replace(/Z/," UTC"),t=t.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(t)}}),e.fn.timeago=function(){var a=this;a.each(t);var n=e.timeago.settings;n.refreshSeconds>0&&setInterval(function(){a.each(t)},1e3*n.refreshSeconds)}}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.3.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.3.1/jquery.timeago.js new file mode 100644 index 000000000..b79e71992 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.3.1/jquery.timeago.js @@ -0,0 +1,84 @@ +/* + * Time Ago (for jQuery) version: 0.3.1 (07/20/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse(timestamp.title)); + }; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000 + }, + inWords: function(distanceMillis) { + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && "less than a minute" || + seconds < 90 && "about a minute" || + minutes < 45 && Math.round(minutes) + " minutes" || + minutes < 90 && "about an hour" || + hours < 24 && "about " + Math.round(hours) + " hours" || + hours < 48 && "a day" || + days < 30 && Math.floor(days) + " days" || + days < 60 && "about a month" || + days < 365 && Math.floor(days / 30) + " months" || + years < 2 && "about a year" || + Math.floor(years) + " years"; + + return words + " ago"; + }, + parse: function(iso8601) { + var s = iso8601.replace(/^\s+/, '').replace(/\s+$/, ''); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $.timeago.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $.timeago.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $.timeago.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } +})(jQuery); + diff --git a/ajax/libs/jquery-timeago/0.3.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.3.1/jquery.timeago.min.js new file mode 100644 index 000000000..6fa6d4f07 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.3.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(e){function t(){var t=e.timeago.parse(this.title);return isNaN(t)||e(this).text(a(t)),this}function a(t){return e.timeago.inWords(r(t))}function r(e){return(new Date).getTime()-e.getTime()}e.timeago=function(t){return a(t instanceof Date?t:"string"==typeof t?e.timeago.parse(t):e.timeago.parse(t.title))},e.extend(e.timeago,{settings:{refreshMillis:6e4},inWords:function(e){var t=e/1e3,a=t/60,r=a/60,n=r/24,i=n/365,o=45>t&&"less than a minute"||90>t&&"about a minute"||45>a&&Math.round(a)+" minutes"||90>a&&"about an hour"||24>r&&"about "+Math.round(r)+" hours"||48>r&&"a day"||30>n&&Math.floor(n)+" days"||60>n&&"about a month"||365>n&&Math.floor(n/30)+" months"||2>i&&"about a year"||Math.floor(i)+" years";return o+" ago"},parse:function(e){var t=e.replace(/^\s+/,"").replace(/\s+$/,"");return t=t.replace(/-/,"/").replace(/-/,"/"),t=t.replace(/T/," ").replace(/Z/," UTC"),t=t.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(t)}}),e.fn.timeago=function(){var a=this;a.each(t);var r=e.timeago.settings;return r.refreshMillis>0&&setInterval(function(){a.each(t)},r.refreshMillis),a}}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.3.2/jquery.timeago.js b/ajax/libs/jquery-timeago/0.3.2/jquery.timeago.js new file mode 100644 index 000000000..c2eaedbf7 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.3.2/jquery.timeago.js @@ -0,0 +1,84 @@ +/* + * timeago: a jQuery plugin, version: 0.3.2 (07/30/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000 + }, + inWords: function(distanceMillis) { + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && "less than a minute" || + seconds < 90 && "about a minute" || + minutes < 45 && Math.round(minutes) + " minutes" || + minutes < 90 && "about an hour" || + hours < 24 && "about " + Math.round(hours) + " hours" || + hours < 48 && "a day" || + days < 30 && Math.floor(days) + " days" || + days < 60 && "about a month" || + days < 365 && Math.floor(days / 30) + " months" || + years < 2 && "about a year" || + Math.floor(years) + " years"; + + return words + " ago"; + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $.timeago.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $.timeago.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $.timeago.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } +})(jQuery); + diff --git a/ajax/libs/jquery-timeago/0.3.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.3.2/jquery.timeago.min.js new file mode 100644 index 000000000..440b97f35 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.3.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=t.timeago.parse(this.title);return isNaN(e)||t(this).text(a(e)),this}function a(e){return t.timeago.inWords(r(e))}function r(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.parse(t(e).attr("title")))},t.extend(t.timeago,{settings:{refreshMillis:6e4},inWords:function(t){var e=t/1e3,a=e/60,r=a/60,n=r/24,i=n/365,o=45>e&&"less than a minute"||90>e&&"about a minute"||45>a&&Math.round(a)+" minutes"||90>a&&"about an hour"||24>r&&"about "+Math.round(r)+" hours"||48>r&&"a day"||30>n&&Math.floor(n)+" days"||60>n&&"about a month"||365>n&&Math.floor(n/30)+" months"||2>i&&"about a year"||Math.floor(i)+" years";return o+" ago"},parse:function(e){var a=t.trim(e);return a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(a)}}),t.fn.timeago=function(){var a=this;a.each(e);var r=t.timeago.settings;return r.refreshMillis>0&&setInterval(function(){a.each(e)},r.refreshMillis),a}}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.4/jquery.timeago.js b/ajax/libs/jquery-timeago/0.4/jquery.timeago.js new file mode 100644 index 000000000..b88c41f94 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.4/jquery.timeago.js @@ -0,0 +1,91 @@ +/* + * timeago: a jQuery plugin, version: 0.4 (08/05/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false + }, + inWords: function(distanceMillis) { + var suffix = " ago"; + if (this.settings.allowFuture) { + if (distanceMillis < 0) suffix = " from now"; + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && "less than a minute" || + seconds < 90 && "about a minute" || + minutes < 45 && Math.round(minutes) + " minutes" || + minutes < 90 && "about an hour" || + hours < 24 && "about " + Math.round(hours) + " hours" || + hours < 48 && "a day" || + days < 30 && Math.floor(days) + " days" || + days < 60 && "about a month" || + days < 365 && Math.floor(days / 30) + " months" || + years < 2 && "about a year" || + Math.floor(years) + " years"; + + return words + suffix; + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $.timeago.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $.timeago.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $.timeago.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } +})(jQuery); + diff --git a/ajax/libs/jquery-timeago/0.4/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.4/jquery.timeago.min.js new file mode 100644 index 000000000..727ac4dd8 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.4/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=t.timeago.parse(this.title);return isNaN(e)||t(this).text(a(e)),this}function a(e){return t.timeago.inWords(r(e))}function r(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.parse(t(e).attr("title")))},t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1},inWords:function(t){var e=" ago";this.settings.allowFuture&&(0>t&&(e=" from now"),t=Math.abs(t));var a=t/1e3,r=a/60,n=r/60,i=n/24,o=i/365,s=45>a&&"less than a minute"||90>a&&"about a minute"||45>r&&Math.round(r)+" minutes"||90>r&&"about an hour"||24>n&&"about "+Math.round(n)+" hours"||48>n&&"a day"||30>i&&Math.floor(i)+" days"||60>i&&"about a month"||365>i&&Math.floor(i/30)+" months"||2>o&&"about a year"||Math.floor(o)+" years";return s+e},parse:function(e){var a=t.trim(e);return a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(a)}}),t.fn.timeago=function(){var a=this;a.each(e);var r=t.timeago.settings;return r.refreshMillis>0&&setInterval(function(){a.each(e)},r.refreshMillis),a}}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.5.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.5.1/jquery.timeago.js new file mode 100644 index 000000000..f67780533 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.5.1/jquery.timeago.js @@ -0,0 +1,117 @@ +/* + * timeago: a jQuery plugin, version: 0.5.1 (08/20/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + ago: "ago", + fromNow: "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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var suffix = $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) suffix = $l.fromNow; + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && sprintf($l.seconds, Math.round(seconds)) || + seconds < 90 && $l.minute || + minutes < 45 && sprintf($l.minutes, Math.round(minutes)) || + minutes < 90 && $l.hour || + hours < 24 && sprintf($l.hours, Math.round(hours)) || + hours < 48 && $l.day || + days < 30 && sprintf($l.days, Math.floor(days)) || + days < 60 && $l.month || + days < 365 && sprintf($l.months, Math.floor(days / 30)) || + years < 2 && $l.year || + sprintf($l.years, Math.floor(years)); + + return words + " " + suffix; + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $t.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // lame sprintf implementation + function sprintf(string, value) { + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + if ($.browser.msie && $.browser.version < 7.0) { + document.createElement('abbr'); + } +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.5.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.5.1/jquery.timeago.min.js new file mode 100644 index 000000000..94c240eae --- /dev/null +++ b/ajax/libs/jquery-timeago/0.5.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=o.parse(this.title);return isNaN(e)||t(this).text(r(e)),this}function r(t){return o.inWords(a(t))}function a(t){return(new Date).getTime()-t.getTime()}function n(t,e){return t.replace(/%d/i,e)}t.timeago=function(e){return r(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.parse(t(e).attr("title")))};var o=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{ago:"ago",fromNow:"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"}},inWords:function(t){var e=this.settings.strings,r=e.ago;this.settings.allowFuture&&(0>t&&(r=e.fromNow),t=Math.abs(t));var a=t/1e3,o=a/60,s=o/60,i=s/24,u=i/365,h=45>a&&n(e.seconds,Math.round(a))||90>a&&e.minute||45>o&&n(e.minutes,Math.round(o))||90>o&&e.hour||24>s&&n(e.hours,Math.round(s))||48>s&&e.day||30>i&&n(e.days,Math.floor(i))||60>i&&e.month||365>i&&n(e.months,Math.floor(i/30))||2>u&&e.year||n(e.years,Math.floor(u));return h+" "+r},parse:function(e){var r=t.trim(e);return r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=o.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},t.browser.msie&&t.browser.version<7&&document.createElement("abbr")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.5/jquery.timeago.js b/ajax/libs/jquery-timeago/0.5/jquery.timeago.js new file mode 100644 index 000000000..e32fd844b --- /dev/null +++ b/ajax/libs/jquery-timeago/0.5/jquery.timeago.js @@ -0,0 +1,112 @@ +/* + * timeago: a jQuery plugin, version: 0.5 (08/19/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + ago: "ago", + fromNow: "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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var suffix = $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) suffix = $l.fromNow; + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && sprintf($l.seconds, Math.round(seconds)) || + seconds < 90 && $l.minute || + minutes < 45 && sprintf($l.minutes, Math.round(minutes)) || + minutes < 90 && $l.hour || + hours < 24 && sprintf($l.hours, Math.round(hours)) || + hours < 48 && $l.day || + days < 30 && sprintf($l.days, Math.floor(days)) || + days < 60 && $l.month || + days < 365 && sprintf($l.months, Math.floor(days / 30)) || + years < 2 && $l.year || + sprintf($l.years, Math.floor(years)); + + return words + " " + suffix; + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $t.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // lame sprintf implementation + function sprintf(string, value) { + return string.replace(/%d/i, value); + } +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.5/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.5/jquery.timeago.min.js new file mode 100644 index 000000000..b7ce815ac --- /dev/null +++ b/ajax/libs/jquery-timeago/0.5/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=o.parse(this.title);return isNaN(e)||t(this).text(r(e)),this}function r(t){return o.inWords(a(t))}function a(t){return(new Date).getTime()-t.getTime()}function n(t,e){return t.replace(/%d/i,e)}t.timeago=function(e){return r(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.parse(t(e).attr("title")))};var o=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{ago:"ago",fromNow:"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"}},inWords:function(t){var e=this.settings.strings,r=e.ago;this.settings.allowFuture&&(0>t&&(r=e.fromNow),t=Math.abs(t));var a=t/1e3,o=a/60,s=o/60,i=s/24,u=i/365,h=45>a&&n(e.seconds,Math.round(a))||90>a&&e.minute||45>o&&n(e.minutes,Math.round(o))||90>o&&e.hour||24>s&&n(e.hours,Math.round(s))||48>s&&e.day||30>i&&n(e.days,Math.floor(i))||60>i&&e.month||365>i&&n(e.months,Math.floor(i/30))||2>u&&e.year||n(e.years,Math.floor(u));return h+" "+r},parse:function(e){var r=t.trim(e);return r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=o.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t}}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.6.2/jquery.timeago.js b/ajax/libs/jquery-timeago/0.6.2/jquery.timeago.js new file mode 100644 index 000000000..34cdd7fd3 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.6.2/jquery.timeago.js @@ -0,0 +1,125 @@ +/* + * timeago: a jQuery plugin, version: 0.6.2 (10/14/2008) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + ago: null, // DEPRECATED, use suffixAgo + fromNow: null, // DEPRECATED, use suffixFromNow + 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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo || $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow || $l.fromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && sprintf($l.seconds, Math.round(seconds)) || + seconds < 90 && $l.minute || + minutes < 45 && sprintf($l.minutes, Math.round(minutes)) || + minutes < 90 && $l.hour || + hours < 24 && sprintf($l.hours, Math.round(hours)) || + hours < 48 && $l.day || + days < 30 && sprintf($l.days, Math.floor(days)) || + days < 60 && $l.month || + days < 365 && sprintf($l.months, Math.floor(days / 30)) || + years < 2 && $l.year || + sprintf($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $t.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // lame sprintf implementation + function sprintf(string, value) { + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + if ($.browser.msie && $.browser.version < 7.0) { + document.createElement('abbr'); + } +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.6.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.6.2/jquery.timeago.min.js new file mode 100644 index 000000000..a73a02dc8 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.6.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(e){function t(){var t=a.parse(this.title);return isNaN(t)||e(this).text(r(t)),this}function r(e){return a.inWords(o(e))}function o(e){return(new Date).getTime()-e.getTime()}function n(e,t){return e.replace(/%d/i,t)}e.timeago=function(t){return r(t instanceof Date?t:"string"==typeof t?e.timeago.parse(t):e.timeago.parse(e(t).attr("title")))};var a=e.timeago;e.extend(e.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",ago:null,fromNow:null,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"}},inWords:function(t){var r=this.settings.strings,o=r.prefixAgo,a=r.suffixAgo||r.ago;this.settings.allowFuture&&(0>t&&(o=r.prefixFromNow,a=r.suffixFromNow||r.fromNow),t=Math.abs(t));var i=t/1e3,s=i/60,u=s/60,f=u/24,m=f/365,l=45>i&&n(r.seconds,Math.round(i))||90>i&&r.minute||45>s&&n(r.minutes,Math.round(s))||90>s&&r.hour||24>u&&n(r.hours,Math.round(u))||48>u&&r.day||30>f&&n(r.days,Math.floor(f))||60>f&&r.month||365>f&&n(r.months,Math.floor(f/30))||2>m&&r.year||n(r.years,Math.floor(m));return e.trim([o,l,a].join(" "))},parse:function(t){var r=e.trim(t);return r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)}}),e.fn.timeago=function(){var e=this;e.each(t);var r=a.settings;return r.refreshMillis>0&&setInterval(function(){e.each(t)},r.refreshMillis),e},e.browser.msie&&e.browser.version<7&&document.createElement("abbr")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.7.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.7.1/jquery.timeago.js new file mode 100644 index 000000000..690f9b9e7 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.7.1/jquery.timeago.js @@ -0,0 +1,125 @@ +/* + * timeago: a jQuery plugin, version: 0.7.1 (2009-02-18) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2009, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + ago: null, // DEPRECATED, use suffixAgo + fromNow: null, // DEPRECATED, use suffixFromNow + 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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo || $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow || $l.fromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $t.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + function substitute(stringOrFunction, value) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(value) : stringOrFunction; + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + if ($.browser.msie && $.browser.version < 7.0) { + document.createElement('abbr'); + } +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.7.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.7.1/jquery.timeago.min.js new file mode 100644 index 000000000..57e7f150c --- /dev/null +++ b/ajax/libs/jquery-timeago/0.7.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(e){function t(){var t=a.parse(this.title);return isNaN(t)||e(this).text(r(t)),this}function r(e){return a.inWords(o(e))}function o(e){return(new Date).getTime()-e.getTime()}function n(t,r){var o=e.isFunction(t)?t(r):t;return o.replace(/%d/i,r)}e.timeago=function(t){return r(t instanceof Date?t:"string"==typeof t?e.timeago.parse(t):e.timeago.parse(e(t).attr("title")))};var a=e.timeago;e.extend(e.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",ago:null,fromNow:null,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"}},inWords:function(t){var r=this.settings.strings,o=r.prefixAgo,a=r.suffixAgo||r.ago;this.settings.allowFuture&&(0>t&&(o=r.prefixFromNow,a=r.suffixFromNow||r.fromNow),t=Math.abs(t));var i=t/1e3,s=i/60,u=s/60,f=u/24,m=f/365,l=45>i&&n(r.seconds,Math.round(i))||90>i&&n(r.minute,1)||45>s&&n(r.minutes,Math.round(s))||90>s&&n(r.hour,1)||24>u&&n(r.hours,Math.round(u))||48>u&&n(r.day,1)||30>f&&n(r.days,Math.floor(f))||60>f&&n(r.month,1)||365>f&&n(r.months,Math.floor(f/30))||2>m&&n(r.year,1)||n(r.years,Math.floor(m));return e.trim([o,l,a].join(" "))},parse:function(t){var r=e.trim(t);return r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)}}),e.fn.timeago=function(){var e=this;e.each(t);var r=a.settings;return r.refreshMillis>0&&setInterval(function(){e.each(t)},r.refreshMillis),e},e.browser.msie&&e.browser.version<7&&document.createElement("abbr")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.7.2/jquery.timeago.js b/ajax/libs/jquery-timeago/0.7.2/jquery.timeago.js new file mode 100644 index 000000000..54524a68f --- /dev/null +++ b/ajax/libs/jquery-timeago/0.7.2/jquery.timeago.js @@ -0,0 +1,123 @@ +/* + * timeago: a jQuery plugin, version: 0.7.2 (2009-07-30) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2009, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + ago: null, // DEPRECATED, use suffixAgo + fromNow: null, // DEPRECATED, use suffixFromNow + 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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo || $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow || $l.fromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $t.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + function substitute(stringOrFunction, value) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(value) : stringOrFunction; + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + document.createElement('abbr'); +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.7.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.7.2/jquery.timeago.min.js new file mode 100644 index 000000000..072295280 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.7.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=a.parse(this.title);return isNaN(e)||t(this).text(r(e)),this}function r(t){return a.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}function o(e,r){var n=t.isFunction(e)?e(r):e;return n.replace(/%d/i,r)}t.timeago=function(e){return r(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.parse(t(e).attr("title")))};var a=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",ago:null,fromNow:null,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"}},inWords:function(e){var r=this.settings.strings,n=r.prefixAgo,a=r.suffixAgo||r.ago;this.settings.allowFuture&&(0>e&&(n=r.prefixFromNow,a=r.suffixFromNow||r.fromNow),e=Math.abs(e));var i=e/1e3,s=i/60,u=s/60,f=u/24,l=f/365,m=45>i&&o(r.seconds,Math.round(i))||90>i&&o(r.minute,1)||45>s&&o(r.minutes,Math.round(s))||90>s&&o(r.hour,1)||24>u&&o(r.hours,Math.round(u))||48>u&&o(r.day,1)||30>f&&o(r.days,Math.floor(f))||60>f&&o(r.month,1)||365>f&&o(r.months,Math.floor(f/30))||2>l&&o(r.year,1)||o(r.years,Math.floor(l));return t.trim([n,m,a].join(" "))},parse:function(e){var r=t.trim(e);return r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=a.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.7/jquery.timeago.js b/ajax/libs/jquery-timeago/0.7/jquery.timeago.js new file mode 100644 index 000000000..11b2cd213 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.7/jquery.timeago.js @@ -0,0 +1,125 @@ +/* + * timeago: a jQuery plugin, version: 0.7 (2009-02-14) + * @requires jQuery v1.2 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2009, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.parse($(timestamp).attr("title"))); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + ago: null, // DEPRECATED, use suffixAgo + fromNow: null, // DEPRECATED, use suffixFromNow + 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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo || $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow || $l.fromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && $l.minute || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && $l.hour || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && $l.day || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && $l.month || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && $l.year || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var date = $t.parse(this.title); + if (!isNaN(date)) { + $(this).text(inWords(date)); + } + return this; + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + function substitute(stringOrFunction, value) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(value) : stringOrFunction; + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + if ($.browser.msie && $.browser.version < 7.0) { + document.createElement('abbr'); + } +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.7/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.7/jquery.timeago.min.js new file mode 100644 index 000000000..e690e66fe --- /dev/null +++ b/ajax/libs/jquery-timeago/0.7/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(e){function t(){var t=a.parse(this.title);return isNaN(t)||e(this).text(r(t)),this}function r(e){return a.inWords(o(e))}function o(e){return(new Date).getTime()-e.getTime()}function n(t,r){var o=e.isFunction(t)?t(r):t;return o.replace(/%d/i,r)}e.timeago=function(t){return r(t instanceof Date?t:"string"==typeof t?e.timeago.parse(t):e.timeago.parse(e(t).attr("title")))};var a=e.timeago;e.extend(e.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",ago:null,fromNow:null,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"}},inWords:function(t){var r=this.settings.strings,o=r.prefixAgo,a=r.suffixAgo||r.ago;this.settings.allowFuture&&(0>t&&(o=r.prefixFromNow,a=r.suffixFromNow||r.fromNow),t=Math.abs(t));var i=t/1e3,s=i/60,u=s/60,f=u/24,m=f/365,l=45>i&&n(r.seconds,Math.round(i))||90>i&&r.minute||45>s&&n(r.minutes,Math.round(s))||90>s&&r.hour||24>u&&n(r.hours,Math.round(u))||48>u&&r.day||30>f&&n(r.days,Math.floor(f))||60>f&&r.month||365>f&&n(r.months,Math.floor(f/30))||2>m&&r.year||n(r.years,Math.floor(m));return e.trim([o,l,a].join(" "))},parse:function(t){var r=e.trim(t);return r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)}}),e.fn.timeago=function(){var e=this;e.each(t);var r=a.settings;return r.refreshMillis>0&&setInterval(function(){e.each(t)},r.refreshMillis),e},e.browser.msie&&e.browser.version<7&&document.createElement("abbr")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.8.0/jquery.timeago.js b/ajax/libs/jquery-timeago/0.8.0/jquery.timeago.js new file mode 100644 index 000000000..9fd0284c4 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.8.0/jquery.timeago.js @@ -0,0 +1,138 @@ +/* + * timeago: a jQuery plugin, version: 0.8.0 (2009-10-25) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2009, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + ago: null, // DEPRECATED, use suffixAgo + fromNow: null, // DEPRECATED, use suffixFromNow + 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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo || $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow || $l.fromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $(elem).is('time') ? $(elem).attr('datetime') : $(elem).attr('title'); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (element.data("timeago") === undefined) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + function substitute(stringOrFunction, value) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(value) : stringOrFunction; + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + document.createElement('abbr'); + document.createElement('time'); +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.8.0/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.8.0/jquery.timeago.min.js new file mode 100644 index 000000000..4ed2215bf --- /dev/null +++ b/ajax/libs/jquery-timeago/0.8.0/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=a(this);return isNaN(e.datetime)||t(this).text(r(e.datetime)),this}function a(e){if(e=t(e),void 0===e.data("timeago")){e.data("timeago",{datetime:o.datetime(e)});var a=t.trim(e.text());a.length>0&&e.attr("title",a)}return e.data("timeago")}function r(t){return o.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}function i(e,a){var r=t.isFunction(e)?e(a):e;return r.replace(/%d/i,a)}t.timeago=function(e){return r(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var o=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",ago:null,fromNow:null,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"}},inWords:function(e){var a=this.settings.strings,r=a.prefixAgo,n=a.suffixAgo||a.ago;this.settings.allowFuture&&(0>e&&(r=a.prefixFromNow,n=a.suffixFromNow||a.fromNow),e=Math.abs(e));var o=e/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&i(a.seconds,Math.round(o))||90>o&&i(a.minute,1)||45>s&&i(a.minutes,Math.round(s))||90>s&&i(a.hour,1)||24>u&&i(a.hours,Math.round(u))||48>u&&i(a.day,1)||30>m&&i(a.days,Math.floor(m))||60>m&&i(a.month,1)||365>m&&i(a.months,Math.floor(m/30))||2>d&&i(a.year,1)||i(a.years,Math.floor(d));return t.trim([r,f,n].join(" "))},parse:function(e){var a=t.trim(e);return a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(a)},datetime:function(e){var a=t(e).attr(t(e).is("time")?"datetime":"title");return o.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var a=o.settings;return a.refreshMillis>0&&setInterval(function(){t.each(e)},a.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.8.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.8.1/jquery.timeago.js new file mode 100644 index 000000000..a85a9211c --- /dev/null +++ b/ajax/libs/jquery-timeago/0.8.1/jquery.timeago.js @@ -0,0 +1,140 @@ +/* + * timeago: a jQuery plugin, version: 0.8.1 (2010-01-04) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + ago: null, // DEPRECATED, use suffixAgo + fromNow: null, // DEPRECATED, use suffixFromNow + 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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo || $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow || $l.fromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == 'time'; // $(elem).is('time'); + var iso8601 = isTime ? $(elem).attr('datetime') : $(elem).attr('title'); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (element.data("timeago") === undefined) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + function substitute(stringOrFunction, value) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(value) : stringOrFunction; + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + document.createElement('abbr'); + document.createElement('time'); +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.8.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.8.1/jquery.timeago.min.js new file mode 100644 index 000000000..5957a9cba --- /dev/null +++ b/ajax/libs/jquery-timeago/0.8.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=a(this);return isNaN(e.datetime)||t(this).text(r(e.datetime)),this}function a(e){if(e=t(e),void 0===e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var a=t.trim(e.text());a.length>0&&e.attr("title",a)}return e.data("timeago")}function r(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}function o(e,a){var r=t.isFunction(e)?e(a):e;return r.replace(/%d/i,a)}t.timeago=function(e){return r(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",ago:null,fromNow:null,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"}},inWords:function(e){var a=this.settings.strings,r=a.prefixAgo,n=a.suffixAgo||a.ago;this.settings.allowFuture&&(0>e&&(r=a.prefixFromNow,n=a.suffixFromNow||a.fromNow),e=Math.abs(e));var i=e/1e3,s=i/60,u=s/60,m=u/24,d=m/365,f=45>i&&o(a.seconds,Math.round(i))||90>i&&o(a.minute,1)||45>s&&o(a.minutes,Math.round(s))||90>s&&o(a.hour,1)||24>u&&o(a.hours,Math.round(u))||48>u&&o(a.day,1)||30>m&&o(a.days,Math.floor(m))||60>m&&o(a.month,1)||365>m&&o(a.months,Math.floor(m/30))||2>d&&o(a.year,1)||o(a.years,Math.floor(d));return t.trim([r,f,n].join(" "))},parse:function(e){var a=t.trim(e);return a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(a)},datetime:function(e){var a="time"==t(e).get(0).tagName.toLowerCase(),r=t(e).attr(a?"datetime":"title");return i.parse(r)}}),t.fn.timeago=function(){var t=this;t.each(e);var a=i.settings;return a.refreshMillis>0&&setInterval(function(){t.each(e)},a.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.8.2/jquery.timeago.js b/ajax/libs/jquery-timeago/0.8.2/jquery.timeago.js new file mode 100644 index 000000000..7bce69023 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.8.2/jquery.timeago.js @@ -0,0 +1,140 @@ +/* + * timeago: a jQuery plugin, version: 0.8.2 (2010-02-16) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + ago: null, // DEPRECATED, use suffixAgo + fromNow: null, // DEPRECATED, use suffixFromNow + 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" + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo || $l.ago; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow || $l.fromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + function substitute(stringOrFunction, value) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(value) : stringOrFunction; + return string.replace(/%d/i, value); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.8.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.8.2/jquery.timeago.min.js new file mode 100644 index 000000000..a1c9bc914 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.8.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=a(this);return isNaN(e.datetime)||t(this).text(r(e.datetime)),this}function a(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var a=t.trim(e.text());a.length>0&&e.attr("title",a)}return e.data("timeago")}function r(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}function o(e,a){var r=t.isFunction(e)?e(a):e;return r.replace(/%d/i,a)}t.timeago=function(e){return r(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",ago:null,fromNow:null,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"}},inWords:function(e){var a=this.settings.strings,r=a.prefixAgo,n=a.suffixAgo||a.ago;this.settings.allowFuture&&(0>e&&(r=a.prefixFromNow,n=a.suffixFromNow||a.fromNow),e=Math.abs(e));var i=e/1e3,s=i/60,u=s/60,m=u/24,f=m/365,d=45>i&&o(a.seconds,Math.round(i))||90>i&&o(a.minute,1)||45>s&&o(a.minutes,Math.round(s))||90>s&&o(a.hour,1)||24>u&&o(a.hours,Math.round(u))||48>u&&o(a.day,1)||30>m&&o(a.days,Math.floor(m))||60>m&&o(a.month,1)||365>m&&o(a.months,Math.floor(m/30))||2>f&&o(a.year,1)||o(a.years,Math.floor(f));return t.trim([r,d,n].join(" "))},parse:function(e){var a=t.trim(e);return a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(a)},datetime:function(e){var a="time"==t(e).get(0).tagName.toLowerCase(),r=t(e).attr(a?"datetime":"title");return i.parse(r)}}),t.fn.timeago=function(){var t=this;t.each(e);var a=i.settings;return a.refreshMillis>0&&setInterval(function(){t.each(e)},a.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.9.1/jquery.timeago.js b/ajax/libs/jquery-timeago/0.9.1/jquery.timeago.js new file mode 100644 index 000000000..50b7a6e7d --- /dev/null +++ b/ajax/libs/jquery-timeago/0.9.1/jquery.timeago.js @@ -0,0 +1,141 @@ +/* + * timeago: a jQuery plugin, version: 0.9.1 (2010-08-30) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.9.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.9.1/jquery.timeago.min.js new file mode 100644 index 000000000..b75dcf327 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.9.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());r.length>0&&e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",numbers:[]}},inWords:function(e){function r(e,r){var n=t.isFunction(e)?e(r):e,i=a.numbers&&a.numbers[r]||r;return n.replace(/%d/i,i)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&(0>e&&(n=a.prefixFromNow,i=a.suffixFromNow),e=Math.abs(e));var o=e/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||48>u&&r(a.day,1)||30>m&&r(a.days,Math.floor(m))||60>m&&r(a.month,1)||365>m&&r(a.months,Math.floor(m/30))||2>d&&r(a.year,1)||r(a.years,Math.floor(d));return t.trim([n,f,i].join(" "))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r="time"==t(e).get(0).tagName.toLowerCase(),a=t(e).attr(r?"datetime":"title");return i.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.9.2/jquery.timeago.js b/ajax/libs/jquery-timeago/0.9.2/jquery.timeago.js new file mode 100644 index 000000000..9e05568f1 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.9.2/jquery.timeago.js @@ -0,0 +1,141 @@ +/* + * timeago: a jQuery plugin, version: 0.9.2 (2010-09-14) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.9.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.9.2/jquery.timeago.min.js new file mode 100644 index 000000000..2b08f4021 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.9.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());r.length>0&&e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&(0>e&&(n=a.prefixFromNow,i=a.suffixFromNow),e=Math.abs(e));var o=e/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||48>u&&r(a.day,1)||30>m&&r(a.days,Math.floor(m))||60>m&&r(a.month,1)||365>m&&r(a.months,Math.floor(m/30))||2>d&&r(a.year,1)||r(a.years,Math.floor(d));return t.trim([n,f,i].join(" "))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r="time"==t(e).get(0).tagName.toLowerCase(),a=t(e).attr(r?"datetime":"title");return i.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/0.9/jquery.timeago.js b/ajax/libs/jquery-timeago/0.9/jquery.timeago.js new file mode 100644 index 000000000..0ada770a9 --- /dev/null +++ b/ajax/libs/jquery-timeago/0.9/jquery.timeago.js @@ -0,0 +1,141 @@ +/* + * timeago: a jQuery plugin, version: 0.9 (2010-06-21) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/ajax/libs/jquery-timeago/0.9/jquery.timeago.min.js b/ajax/libs/jquery-timeago/0.9/jquery.timeago.min.js new file mode 100644 index 000000000..ae63fd14a --- /dev/null +++ b/ajax/libs/jquery-timeago/0.9/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());r.length>0&&e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",numbers:[]}},inWords:function(e){function r(e,r){var n=t.isFunction(e)?e(r):e,i=a.numbers&&a.numbers[r]||r;return n.replace(/%d/i,i)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&(0>e&&(n=a.prefixFromNow,i=a.suffixFromNow),e=Math.abs(e));var o=e/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||48>u&&r(a.day,1)||30>m&&r(a.days,Math.floor(m))||60>m&&r(a.month,1)||365>m&&r(a.months,Math.floor(m/30))||2>d&&r(a.year,1)||r(a.years,Math.floor(d));return t.trim([n,f,i].join(" "))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d\d\d/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r="time"==t(e).get(0).tagName.toLowerCase(),a=t(e).attr(r?"datetime":"title");return i.parse(a)}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/1.0.0/jquery.timeago.js b/ajax/libs/jquery-timeago/1.0.0/jquery.timeago.js new file mode 100644 index 000000000..defd48dda --- /dev/null +++ b/ajax/libs/jquery-timeago/1.0.0/jquery.timeago.js @@ -0,0 +1,153 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 1.0.0 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator || ""; + if ($l.wordSeparator === undefined) { separator = " "; } + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/1.0.0/jquery.timeago.min.js b/ajax/libs/jquery-timeago/1.0.0/jquery.timeago.min.js new file mode 100644 index 000000000..9755b8cc2 --- /dev/null +++ b/ajax/libs/jquery-timeago/1.0.0/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());!(r.length>0)||i.isTime(e)&&e.attr("title")||e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||42>u&&r(a.day,1)||30>m&&r(a.days,Math.round(m))||45>m&&r(a.month,1)||365>m&&r(a.months,Math.round(m/30))||1.5>d&&r(a.year,1)||r(a.years,Math.round(d)),h=a.wordSeparator||"";return void 0===a.wordSeparator&&(h=" "),t.trim([n,f,i].join(h))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r=t(e).attr(i.isTime(e)?"datetime":"title");return i.parse(r)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/1.0.1/jquery.timeago.js b/ajax/libs/jquery-timeago/1.0.1/jquery.timeago.js new file mode 100644 index 000000000..f7651c769 --- /dev/null +++ b/ajax/libs/jquery-timeago/1.0.1/jquery.timeago.js @@ -0,0 +1,153 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 1.0.1 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator || ""; + if ($l.wordSeparator === undefined) { separator = " "; } + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +}(jQuery)); diff --git a/ajax/libs/jquery-timeago/1.0.1/jquery.timeago.min.js b/ajax/libs/jquery-timeago/1.0.1/jquery.timeago.min.js new file mode 100644 index 000000000..9755b8cc2 --- /dev/null +++ b/ajax/libs/jquery-timeago/1.0.1/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){function e(){var e=r(this);return isNaN(e.datetime)||t(this).text(a(e.datetime)),this}function r(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:i.datetime(e)});var r=t.trim(e.text());!(r.length>0)||i.isTime(e)&&e.attr("title")||e.attr("title",r)}return e.data("timeago")}function a(t){return i.inWords(n(t))}function n(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return a(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var i=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function r(r,n){var i=t.isFunction(r)?r(n,e):r,o=a.numbers&&a.numbers[n]||n;return i.replace(/%d/i,o)}var a=this.settings.strings,n=a.prefixAgo,i=a.suffixAgo;this.settings.allowFuture&&0>e&&(n=a.prefixFromNow,i=a.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&r(a.seconds,Math.round(o))||90>o&&r(a.minute,1)||45>s&&r(a.minutes,Math.round(s))||90>s&&r(a.hour,1)||24>u&&r(a.hours,Math.round(u))||42>u&&r(a.day,1)||30>m&&r(a.days,Math.round(m))||45>m&&r(a.month,1)||365>m&&r(a.months,Math.round(m/30))||1.5>d&&r(a.year,1)||r(a.years,Math.round(d)),h=a.wordSeparator||"";return void 0===a.wordSeparator&&(h=" "),t.trim([n,f,i].join(h))},parse:function(e){var r=t.trim(e);return r=r.replace(/\.\d+/,""),r=r.replace(/-/,"/").replace(/-/,"/"),r=r.replace(/T/," ").replace(/Z/," UTC"),r=r.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(r)},datetime:function(e){var r=t(e).attr(i.isTime(e)?"datetime":"title");return i.parse(r)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}}),t.fn.timeago=function(){var t=this;t.each(e);var r=i.settings;return r.refreshMillis>0&&setInterval(function(){t.each(e)},r.refreshMillis),t},document.createElement("abbr"),document.createElement("time")}(jQuery); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/1.2.0/jquery.timeago.js b/ajax/libs/jquery-timeago/1.2.0/jquery.timeago.js new file mode 100644 index 000000000..bdc54274c --- /dev/null +++ b/ajax/libs/jquery-timeago/1.2.0/jquery.timeago.js @@ -0,0 +1,189 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 1.2.0 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + localeTitle: false, + cutoff: 0, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator || ""; + if ($l.wordSeparator === undefined) { separator = " "; } + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + // functions that can be called via $(el).timeago('action') + // init is default when no action is given + // functions are called with context of a single element + var functions = { + init: function(){ + var refresh_el = $.proxy(refresh, this); + refresh_el(); + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(refresh_el, $s.refreshMillis); + } + }, + update: function(time){ + $(this).data('timeago', { datetime: $t.parse(time) }); + refresh.apply(this); + } + }; + + $.fn.timeago = function(action, options) { + var fn = action ? functions[action] : functions.init; + if(!fn){ + throw new Error("Unknown function name '"+ action +"' for timeago"); + } + // each over objects here and call the requested function + this.each(function(){ + fn.call(this, options); + }); + return this; + }; + + function refresh() { + var data = prepareData(this); + var $s = $t.settings; + + if (!isNaN(data.datetime)) { + if ( $s.cutoff == 0 || distance(data.datetime) < $s.cutoff) { + $(this).text(inWords(data.datetime)); + } + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if ($t.settings.localeTitle) { + element.attr("title", element.data('timeago').datetime.toLocaleString()); + } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})); diff --git a/ajax/libs/jquery-timeago/1.2.0/jquery.timeago.min.js b/ajax/libs/jquery-timeago/1.2.0/jquery.timeago.min.js new file mode 100644 index 000000000..2b6ec8770 --- /dev/null +++ b/ajax/libs/jquery-timeago/1.2.0/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(){var e=a(this),o=n.settings;return isNaN(e.datetime)||(0==o.cutoff||r(e.datetime)0)||n.isTime(e)&&e.attr("title")||e.attr("title",a)}return e.data("timeago")}function i(t){return n.inWords(r(t))}function r(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return i(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var n=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,localeTitle:!1,cutoff:0,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function a(a,r){var n=t.isFunction(a)?a(r,e):a,o=i.numbers&&i.numbers[r]||r;return n.replace(/%d/i,o)}var i=this.settings.strings,r=i.prefixAgo,n=i.suffixAgo;this.settings.allowFuture&&0>e&&(r=i.prefixFromNow,n=i.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&a(i.seconds,Math.round(o))||90>o&&a(i.minute,1)||45>s&&a(i.minutes,Math.round(s))||90>s&&a(i.hour,1)||24>u&&a(i.hours,Math.round(u))||42>u&&a(i.day,1)||30>m&&a(i.days,Math.round(m))||45>m&&a(i.month,1)||365>m&&a(i.months,Math.round(m/30))||1.5>d&&a(i.year,1)||a(i.years,Math.round(d)),c=i.wordSeparator||"";return void 0===i.wordSeparator&&(c=" "),t.trim([r,f,n].join(c))},parse:function(e){var a=t.trim(e);return a=a.replace(/\.\d+/,""),a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(a)},datetime:function(e){var a=t(e).attr(n.isTime(e)?"datetime":"title");return n.parse(a)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}});var o={init:function(){var a=t.proxy(e,this);a();var i=n.settings;i.refreshMillis>0&&setInterval(a,i.refreshMillis)},update:function(a){t(this).data("timeago",{datetime:n.parse(a)}),e.apply(this)}};t.fn.timeago=function(t,e){var a=t?o[t]:o.init;if(!a)throw new Error("Unknown function name '"+t+"' for timeago");return this.each(function(){a.call(this,e)}),this},document.createElement("abbr"),document.createElement("time")}); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/1.3.0/jquery.timeago.js b/ajax/libs/jquery-timeago/1.3.0/jquery.timeago.js new file mode 100644 index 000000000..4d58026ef --- /dev/null +++ b/ajax/libs/jquery-timeago/1.3.0/jquery.timeago.js @@ -0,0 +1,193 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 1.3.0 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + localeTitle: false, + cutoff: 0, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator || ""; + if ($l.wordSeparator === undefined) { separator = " "; } + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + // functions that can be called via $(el).timeago('action') + // init is default when no action is given + // functions are called with context of a single element + var functions = { + init: function(){ + var refresh_el = $.proxy(refresh, this); + refresh_el(); + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(refresh_el, $s.refreshMillis); + } + }, + update: function(time){ + $(this).data('timeago', { datetime: $t.parse(time) }); + refresh.apply(this); + }, + updateFromDOM: function(){ + $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) }); + refresh.apply(this); + } + }; + + $.fn.timeago = function(action, options) { + var fn = action ? functions[action] : functions.init; + if(!fn){ + throw new Error("Unknown function name '"+ action +"' for timeago"); + } + // each over objects here and call the requested function + this.each(function(){ + fn.call(this, options); + }); + return this; + }; + + function refresh() { + var data = prepareData(this); + var $s = $t.settings; + + if (!isNaN(data.datetime)) { + if ( $s.cutoff == 0 || distance(data.datetime) < $s.cutoff) { + $(this).text(inWords(data.datetime)); + } + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if ($t.settings.localeTitle) { + element.attr("title", element.data('timeago').datetime.toLocaleString()); + } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})); diff --git a/ajax/libs/jquery-timeago/1.3.0/jquery.timeago.min.js b/ajax/libs/jquery-timeago/1.3.0/jquery.timeago.min.js new file mode 100644 index 000000000..03c0a833d --- /dev/null +++ b/ajax/libs/jquery-timeago/1.3.0/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(){var e=a(this),o=n.settings;return isNaN(e.datetime)||(0==o.cutoff||r(e.datetime)0)||n.isTime(e)&&e.attr("title")||e.attr("title",a)}return e.data("timeago")}function i(t){return n.inWords(r(t))}function r(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return i(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var n=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,localeTitle:!1,cutoff:0,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function a(a,r){var n=t.isFunction(a)?a(r,e):a,o=i.numbers&&i.numbers[r]||r;return n.replace(/%d/i,o)}var i=this.settings.strings,r=i.prefixAgo,n=i.suffixAgo;this.settings.allowFuture&&0>e&&(r=i.prefixFromNow,n=i.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,f=45>o&&a(i.seconds,Math.round(o))||90>o&&a(i.minute,1)||45>s&&a(i.minutes,Math.round(s))||90>s&&a(i.hour,1)||24>u&&a(i.hours,Math.round(u))||42>u&&a(i.day,1)||30>m&&a(i.days,Math.round(m))||45>m&&a(i.month,1)||365>m&&a(i.months,Math.round(m/30))||1.5>d&&a(i.year,1)||a(i.years,Math.round(d)),c=i.wordSeparator||"";return void 0===i.wordSeparator&&(c=" "),t.trim([r,f,n].join(c))},parse:function(e){var a=t.trim(e);return a=a.replace(/\.\d+/,""),a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(a)},datetime:function(e){var a=t(e).attr(n.isTime(e)?"datetime":"title");return n.parse(a)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}});var o={init:function(){var a=t.proxy(e,this);a();var i=n.settings;i.refreshMillis>0&&setInterval(a,i.refreshMillis)},update:function(a){t(this).data("timeago",{datetime:n.parse(a)}),e.apply(this)},updateFromDOM:function(){t(this).data("timeago",{datetime:n.parse(t(this).attr(n.isTime(this)?"datetime":"title"))}),e.apply(this)}};t.fn.timeago=function(t,e){var a=t?o[t]:o.init;if(!a)throw new Error("Unknown function name '"+t+"' for timeago");return this.each(function(){a.call(this,e)}),this},document.createElement("abbr"),document.createElement("time")}); \ No newline at end of file diff --git a/ajax/libs/jquery-timeago/1.3.2/jquery.timeago.js b/ajax/libs/jquery-timeago/1.3.2/jquery.timeago.js new file mode 100644 index 000000000..91452a529 --- /dev/null +++ b/ajax/libs/jquery-timeago/1.3.2/jquery.timeago.js @@ -0,0 +1,202 @@ +/** + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * @name timeago + * @version 1.3.2 + * @requires jQuery v1.2.3+ + * @author Ryan McGeary + * @license MIT License - http://www.opensource.org/licenses/mit-license.php + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Copyright (c) 2008-2013, Ryan McGeary (ryan -[at]- mcgeary [*dot*] org) + */ + +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) { + return inWords(timestamp); + } else if (typeof timestamp === "string") { + return inWords($.timeago.parse(timestamp)); + } else if (typeof timestamp === "number") { + return inWords(new Date(timestamp)); + } else { + return inWords($.timeago.datetime(timestamp)); + } + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + localeTitle: false, + cutoff: 0, + strings: { + prefixAgo: null, + prefixFromNow: null, + 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", + wordSeparator: " ", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + } + + var seconds = Math.abs(distanceMillis) / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 42 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.round(days)) || + days < 45 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.round(days / 30)) || + years < 1.5 && substitute($l.year, 1) || + substitute($l.years, Math.round(years)); + + var separator = $l.wordSeparator || ""; + if ($l.wordSeparator === undefined) { separator = " "; } + return $.trim([prefix, words, suffix].join(separator)); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d+/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + s = s.replace(/([\+\-]\d\d)$/," $100"); // +09 -> +0900 + return new Date(s); + }, + datetime: function(elem) { + var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + }, + isTime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time"); + } + }); + + // functions that can be called via $(el).timeago('action') + // init is default when no action is given + // functions are called with context of a single element + var functions = { + init: function(){ + var refresh_el = $.proxy(refresh, this); + refresh_el(); + var $s = $t.settings; + if ($s.refreshMillis > 0) { + this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis); + } + }, + update: function(time){ + var parsedTime = $t.parse(time); + $(this).data('timeago', { datetime: parsedTime }); + if($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString()); + refresh.apply(this); + }, + updateFromDOM: function(){ + $(this).data('timeago', { datetime: $t.parse( $t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title") ) }); + refresh.apply(this); + }, + dispose: function () { + if (this._timeagoInterval) { + window.clearInterval(this._timeagoInterval); + this._timeagoInterval = null; + } + } + }; + + $.fn.timeago = function(action, options) { + var fn = action ? functions[action] : functions.init; + if(!fn){ + throw new Error("Unknown function name '"+ action +"' for timeago"); + } + // each over objects here and call the requested function + this.each(function(){ + fn.call(this, options); + }); + return this; + }; + + function refresh() { + var data = prepareData(this); + var $s = $t.settings; + + if (!isNaN(data.datetime)) { + if ( $s.cutoff == 0 || distance(data.datetime) < $s.cutoff) { + $(this).text(inWords(data.datetime)); + } + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if ($t.settings.localeTitle) { + element.attr("title", element.data('timeago').datetime.toLocaleString()); + } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) { + element.attr("title", text); + } + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})); diff --git a/ajax/libs/jquery-timeago/1.3.2/jquery.timeago.min.js b/ajax/libs/jquery-timeago/1.3.2/jquery.timeago.min.js new file mode 100644 index 000000000..473a367a9 --- /dev/null +++ b/ajax/libs/jquery-timeago/1.3.2/jquery.timeago.min.js @@ -0,0 +1 @@ +!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(){var e=a(this),o=n.settings;return isNaN(e.datetime)||(0==o.cutoff||r(e.datetime)0)||n.isTime(e)&&e.attr("title")||e.attr("title",a)}return e.data("timeago")}function i(t){return n.inWords(r(t))}function r(t){return(new Date).getTime()-t.getTime()}t.timeago=function(e){return i(e instanceof Date?e:"string"==typeof e?t.timeago.parse(e):"number"==typeof e?new Date(e):t.timeago.datetime(e))};var n=t.timeago;t.extend(t.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,localeTitle:!1,cutoff:0,strings:{prefixAgo:null,prefixFromNow:null,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",wordSeparator:" ",numbers:[]}},inWords:function(e){function a(a,r){var n=t.isFunction(a)?a(r,e):a,o=i.numbers&&i.numbers[r]||r;return n.replace(/%d/i,o)}var i=this.settings.strings,r=i.prefixAgo,n=i.suffixAgo;this.settings.allowFuture&&0>e&&(r=i.prefixFromNow,n=i.suffixFromNow);var o=Math.abs(e)/1e3,s=o/60,u=s/60,m=u/24,d=m/365,l=45>o&&a(i.seconds,Math.round(o))||90>o&&a(i.minute,1)||45>s&&a(i.minutes,Math.round(s))||90>s&&a(i.hour,1)||24>u&&a(i.hours,Math.round(u))||42>u&&a(i.day,1)||30>m&&a(i.days,Math.round(m))||45>m&&a(i.month,1)||365>m&&a(i.months,Math.round(m/30))||1.5>d&&a(i.year,1)||a(i.years,Math.round(d)),f=i.wordSeparator||"";return void 0===i.wordSeparator&&(f=" "),t.trim([r,l,n].join(f))},parse:function(e){var a=t.trim(e);return a=a.replace(/\.\d+/,""),a=a.replace(/-/,"/").replace(/-/,"/"),a=a.replace(/T/," ").replace(/Z/," UTC"),a=a.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),a=a.replace(/([\+\-]\d\d)$/," $100"),new Date(a)},datetime:function(e){var a=t(e).attr(n.isTime(e)?"datetime":"title");return n.parse(a)},isTime:function(e){return"time"===t(e).get(0).tagName.toLowerCase()}});var o={init:function(){var a=t.proxy(e,this);a();var i=n.settings;i.refreshMillis>0&&(this._timeagoInterval=setInterval(a,i.refreshMillis))},update:function(a){var i=n.parse(a);t(this).data("timeago",{datetime:i}),n.settings.localeTitle&&t(this).attr("title",i.toLocaleString()),e.apply(this)},updateFromDOM:function(){t(this).data("timeago",{datetime:n.parse(t(this).attr(n.isTime(this)?"datetime":"title"))}),e.apply(this)},dispose:function(){this._timeagoInterval&&(window.clearInterval(this._timeagoInterval),this._timeagoInterval=null)}};t.fn.timeago=function(t,e){var a=t?o[t]:o.init;if(!a)throw new Error("Unknown function name '"+t+"' for timeago");return this.each(function(){a.call(this,e)}),this},document.createElement("abbr"),document.createElement("time")}); \ No newline at end of file