mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Fix classic compose caption counter
This commit is contained in:
parent
752c98a086
commit
4a986bfa5b
1 changed files with 19 additions and 0 deletions
|
@ -19,6 +19,25 @@ $(document).ready(function() {
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#content'
|
el: '#content'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.metro-classic-compose textarea[name="caption"]').on('click', function(e) {
|
||||||
|
let el = $(this);
|
||||||
|
el.attr('rows', 4);
|
||||||
|
});
|
||||||
|
$('.metro-classic-compose textarea[name="caption"]').on('change keyup paste', function(e) {
|
||||||
|
let el = $(this);
|
||||||
|
let len = el.val().length;
|
||||||
|
let limit = el.attr('data-limit');
|
||||||
|
|
||||||
|
let res = len;
|
||||||
|
|
||||||
|
if(len > limit) {
|
||||||
|
res = '<span class="text-danger">' + (limit - len) + '</span>';
|
||||||
|
} else {
|
||||||
|
res = '<span>' + len + '</span>';
|
||||||
|
}
|
||||||
|
$('.metro-classic-compose .caption-counter').html(res);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
Loading…
Reference in a new issue