mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Remove excessive word counts
Resolves:
- Duplicate event listeners are registered during every word count,
increasing the number of word counts until the browser becomes
unresponsive.
- The word count is triggered multiple times on input due to listening
to redundant events.
This commit is contained in:
parent
ed8a2696bb
commit
9de2cba061
1 changed files with 2 additions and 2 deletions
|
|
@ -133,7 +133,7 @@ function get_color() {
|
|||
function word_count(text, divId, maxcount) {
|
||||
var area = document.getElementById(text.id)
|
||||
|
||||
Countable.live(area, function(counter) {
|
||||
Countable.once(area, function(counter) {
|
||||
$('#' + divId).text(counter.words);
|
||||
if (counter.words > maxcount)
|
||||
$('#' + divId).css('color', 'red');
|
||||
|
|
@ -157,7 +157,7 @@ $( document ).ready(function() {
|
|||
.trigger('change');
|
||||
|
||||
/* Count the proposal abstract length */
|
||||
$("#event_abstract").bind('change keyup paste input', function() {
|
||||
$("#event_abstract").on('input', function() {
|
||||
var $selected = $("#event_event_type_id option:selected")
|
||||
var max = $selected.data("max-words");
|
||||
word_count(this, 'abstract-count', max);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue