Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,4 @@ init : function(el){} // Callback: func
- [diptopol](https://github.com/diptopol) - `stopInputAtMaximum` with `twoCharCarriageReturn` count fix, trimmed newline calculation fix, maximum text reached condition fix, text count overflow notification
- [trevorloflin](https://github.com/trevorloflin) - `minDisplayCutoff` and `maxDisplayCutoff` options
- [t3mujin](https://github.com/t3mujin) - autocustom support (maxlength workaround), text fixes
- [goranmiric ](https://github.com/goranmiric) - accessibility enhancements
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-text-counter",
"version": "0.8.0",
"version": "0.9.0",
"main": "textcounter.js",
"license": "MIT",
"ignore": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"minimum",
"maximum"
],
"version": "0.8.0",
"version": "0.9.0",
"author": {
"name": "ractoon",
"url": "https://www.ractoon.com"
Expand Down
2 changes: 1 addition & 1 deletion textcounter.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"minimum",
"maximum"
],
"version": "0.8.0",
"version": "0.9.0",
"author": {
"name": "ractoon",
"url": "https://www.ractoon.com"
Expand Down
11 changes: 6 additions & 5 deletions textcounter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jQuery Text Counter Plugin v0.8.0
* jQuery Text Counter Plugin v0.9.0
* https://github.com/ractoon/jQuery-Text-Counter
*
* Copyright 2014 ractoon
Expand All @@ -25,6 +25,7 @@
var counterText = base.options.countDown ? base.options.countDownText : base.options.counterText,
counterNum = base.options.countDown ? base.options.max : 0,
$formatted_counter_text = $('<div/>').addClass(base.options.textCountMessageClass)
.attr('aria-live', 'assertive').attr('aria-atomic', 'true')
.html(counterText.replace('%d', '<span class="' + base.options.textCountClass + '">' + counterNum + '</span>')),
$count_overflow_text = $('<div/>').addClass(base.options.countOverflowContainerClass);

Expand Down Expand Up @@ -70,7 +71,7 @@
}
else if (base.options.max == 'autocustom') {
var max = base.$el.attr(base.options.autoCustomAttr);

if (typeof max !== 'undefined' && max !== false) {
base.options.max = max;
}
Expand Down Expand Up @@ -161,11 +162,11 @@
base.clearErrors('max');
}
}

// hide the counter if it doesn't meet either the minimum or maximum display cutoff
if (base.options.minDisplayCutoff == -1 && base.options.maxDisplayCutoff == -1) {
base.$container.show();
} else if (textCount <= base.options.min + base.options.minDisplayCutoff) {
base.$container.show();
} else if (textCount <= base.options.min + base.options.minDisplayCutoff) {
base.$container.show();
} else if (base.options.max !== -1 && textCount >= base.options.max - base.options.maxDisplayCutoff) {
base.$container.show();
Expand Down
4 changes: 2 additions & 2 deletions textcounter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.