mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Feature/autofac tidyup (#2096)
* Move service config service back into shared .NET Framework Library * Move Content files into shared folder. Make autoface load different assembilies depending on what framework is using it. * Change my mind on what the shared module should be called. Common Module is too bland. * DotNet4.SocksProxy is not yet publically .NET Standard. Revert to previous SocksWebProxy package. * Check in unstaged change to test dependency injection setup.
This commit is contained in:
37
src/Jackett.Common/Content/libs/handlebarsmoment.js
Normal file
37
src/Jackett.Common/Content/libs/handlebarsmoment.js
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
Handlebars.registerHelper('dateFormat', function (context, block) {
|
||||
if (window.moment) {
|
||||
var f = block.hash.format || "MMM DD, YYYY hh:mm:ss A";
|
||||
return moment(context).format(f); //had to remove Date(context)
|
||||
} else {
|
||||
return context; // moment plugin not available. return data as is.
|
||||
};
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('jacketTimespan', function (context, block) {
|
||||
var now = moment();
|
||||
var from = moment(context);
|
||||
var timeSpan = moment.duration(now.diff(from));
|
||||
|
||||
var minutes = timeSpan.asMinutes();
|
||||
if (minutes < 120) {
|
||||
return Math.round(minutes) + 'm ago';
|
||||
}
|
||||
|
||||
var hours = timeSpan.asHours();
|
||||
if (hours < 48) {
|
||||
return Math.round(hours) + 'h ago';
|
||||
}
|
||||
|
||||
var days = timeSpan.asDays();
|
||||
if (days < 365) {
|
||||
return Math.round(days) + 'd ago';
|
||||
}
|
||||
|
||||
var years = timeSpan.asYears();
|
||||
return Math.round(years) + 'y ago';
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('jacketSize', function (context, block) {
|
||||
return filesize(context, { round: 1 });
|
||||
});
|
Reference in New Issue
Block a user