From 4a986bfa5b9e65f4c2fbf5a714738e375a6a95b9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 24 Apr 2019 22:49:51 -0600 Subject: [PATCH] Fix classic compose caption counter --- resources/views/status/compose.blade.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/resources/views/status/compose.blade.php b/resources/views/status/compose.blade.php index 1b8cd069..e2447f38 100644 --- a/resources/views/status/compose.blade.php +++ b/resources/views/status/compose.blade.php @@ -19,6 +19,25 @@ $(document).ready(function() { new Vue({ 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 = '' + (limit - len) + ''; + } else { + res = '' + len + ''; + } + $('.metro-classic-compose .caption-counter').html(res); + }) }); @endpush \ No newline at end of file