Permalink
Browse files

[bug 886558] Fix character counter on AoA

  • Loading branch information...
1 parent 457aeea commit dc94f1d0483dfd4bf991dc55900f594f9c9cc359 @rehandalal rehandalal committed Dec 18, 2013
View
@@ -250,9 +250,9 @@
'js/wiki.dashboard.js',
),
'customercare': (
- 'js/libs/jquery.NobleCount.js',
'js/libs/jquery.cookie.js',
'js/libs/jquery.bullseye-1.0.min.js',
+ 'js/libs/twitter-text.js',
'js/customercare.js',
'js/users.js',
),
@@ -210,7 +210,16 @@
this._tweet = new Tweet(this.$tweet_el);
this.$textarea = this.$el.find("#reply-message");
- this.$textarea.NobleCount('.character-counter');
+ this.$textarea.on('keydown', function() {
+ var delta = 140 - twttr.txt.getTweetLength($(this).val());
+ var $counter = $('.character-counter').text(delta);
+
+ if (delta < 0) {
+ $counter.addClass('too-many');
+ } else {
+ $counter.removeClass('too-many');
+ }
+ });
this.action = this.$el.find("form").attr('action');
this.$success_msg = this.$el.find("#submit-message");
Oops, something went wrong.

0 comments on commit dc94f1d

Please sign in to comment.