|
require(["jquery", "knockout", "moment", "md5"], function ($, ko, moment, md5) {
ko.bindingHandlers.dateString = {
update: function (element, valueAccessor) {
var valueUnwrapped = ko.utils.unwrapObservable(valueAccessor());
var formattedTime = moment(valueUnwrapped).format("YYYY-MM-DD HH:mm");
$(element).text(formattedTime);
}
};
ko.bindingHandlers.gravatar = {
update: function (element, valueAccessor) {
var valueUnwrapped = ko.utils.unwrapObservable(valueAccessor());
var src = "http://www.gravatar.com/avatar/" + md5(valueUnwrapped.trim().toLowerCase()) + ".jpg?s=40";
$(element).attr("src", src);
}
};
});
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software engineer with an application development experience.
MCSD: Web Applications
MCSD: Windows Store Apps Using C#