mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
minify resources
This commit is contained in:
parent
8a6884abef
commit
661eeac16e
201 changed files with 203 additions and 52376 deletions
|
@ -1,65 +1 @@
|
|||
define(['datetime'], function (datetime) {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* Javascript Humane Dates
|
||||
* Copyright (c) 2008 Dean Landolt (deanlandolt.com)
|
||||
* Re-write by Zach Leatherman (zachleat.com)
|
||||
*
|
||||
* Adopted from the John Resig's pretty.js
|
||||
* at http://ejohn.org/blog/javascript-pretty-date
|
||||
* and henrah's proposed modification
|
||||
* at http://ejohn.org/blog/javascript-pretty-date/#comment-297458
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
function humane_date(date_str) {
|
||||
var time_formats = [[90, 'a minute'], // 60*1.5
|
||||
[3600, 'minutes', 60], // 60*60, 60
|
||||
[5400, 'an hour'], // 60*60*1.5
|
||||
[86400, 'hours', 3600], // 60*60*24, 60*60
|
||||
[129600, 'a day'], // 60*60*24*1.5
|
||||
[604800, 'days', 86400], // 60*60*24*7, 60*60*24
|
||||
[907200, 'a week'], // 60*60*24*7*1.5
|
||||
[2628000, 'weeks', 604800], // 60*60*24*(365/12), 60*60*24*7
|
||||
[3942000, 'a month'], // 60*60*24*(365/12)*1.5
|
||||
[31536000, 'months', 2628000], // 60*60*24*365, 60*60*24*(365/12)
|
||||
[47304000, 'a year'], // 60*60*24*365*1.5
|
||||
[3153600000, 'years', 31536000] // 60*60*24*365*100, 60*60*24*365
|
||||
];
|
||||
|
||||
var dt = new Date;
|
||||
var date = datetime.parseISO8601Date(date_str, true);
|
||||
|
||||
var seconds = ((dt - date) / 1000);
|
||||
var token = ' ago';
|
||||
var i = 0;
|
||||
var format;
|
||||
|
||||
if (seconds < 0) {
|
||||
seconds = Math.abs(seconds);
|
||||
//token = '';
|
||||
}
|
||||
|
||||
while (format = time_formats[i++]) {
|
||||
if (seconds < format[0]) {
|
||||
if (format.length == 2) {
|
||||
return format[1] + token;
|
||||
} else {
|
||||
return Math.round(seconds / format[2]) + ' ' + format[1] + token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// overflow for centuries
|
||||
if (seconds > 4730400000)
|
||||
return Math.round(seconds / 4730400000) + ' centuries' + token;
|
||||
|
||||
return date_str;
|
||||
}
|
||||
|
||||
window.humane_date = humane_date;
|
||||
|
||||
return humane_date;
|
||||
});
|
||||
define(["datetime"],function(datetime){"use strict";function humane_date(date_str){var format,time_formats=[[90,"a minute"],[3600,"minutes",60],[5400,"an hour"],[86400,"hours",3600],[129600,"a day"],[604800,"days",86400],[907200,"a week"],[2628e3,"weeks",604800],[3942e3,"a month"],[31536e3,"months",2628e3],[47304e3,"a year"],[31536e5,"years",31536e3]],dt=new Date,date=datetime.parseISO8601Date(date_str,!0),seconds=(dt-date)/1e3,token=" ago",i=0;for(seconds<0&&(seconds=Math.abs(seconds));format=time_formats[i++];)if(seconds<format[0])return 2==format.length?format[1]+token:Math.round(seconds/format[2])+" "+format[1]+token;return seconds>47304e5?Math.round(seconds/47304e5)+" centuries"+token:date_str}return window.humane_date=humane_date,humane_date});
|
Loading…
Add table
Add a link
Reference in a new issue