0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/core/client/helpers/gh-count-down-characters.js

19 lines
475 B
JavaScript
Raw Normal View History

var countDownCharacters = Ember.Handlebars.makeBoundHelper(function (content, maxCharacters) {
var el = document.createElement('span'),
length = content ? content.length : 0;
el.className = 'word-count';
if (length > maxCharacters) {
el.style.color = '#E25440';
} else {
el.style.color = '#9FBB58';
}
el.innerHTML = length;
return new Ember.Handlebars.SafeString(el.outerHTML);
});
export default countDownCharacters;