Products.Archetypes/master: Fixed comments and clarified variable names

Valtteri Karppinen <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: Products.Archetypes
Branch: refs/heads/master
Date: 2017-07-06T10:33:55+03:00
Author: Valtteri Karppinen (vkarppinen) <[email protected]>
Commit: https://github.com/plone/Products.Archetypes/commit/7475150e2c75766199c30af83c71a6c02efe6b76

Fixed comments and clarified variable names

Files changed:
M Products/Archetypes/skins/archetypes/widgets/js/textcount.js

diff --git a/Products/Archetypes/skins/archetypes/widgets/js/textcount.js b/Products/Archetypes/skins/archetypes/widgets/js/textcount.js
index cd923e3e..b09ff827 100644
--- a/Products/Archetypes/skins/archetypes/widgets/js/textcount.js
+++ b/Products/Archetypes/skins/archetypes/widgets/js/textcount.js
@@ -1,13 +1,15 @@
-<!-- Original:  Ronnie T. Moore -->
-<!-- Dynamic 'fix' by: Nannette Thacker -->
+// Original:  Ronnie T. Moore
+// Dynamic 'fix' by: Nannette Thacker
 function textCounter(field, countfield, maxlimit) {
   var fieldval = jQuery(field).val();
-  var countfield = jQuery('input[name="' + countfield + '"]');
+  var counterElem = jQuery('input[name="' + countfield + '"]');
   if (fieldval.length > maxlimit) {
-      // if too long...trim it!
-      jQuery(field).val(fieldval.substring(0, maxlimit));
-      countfield.css('border', '1px solid red');
+    // if too long...trim it!
+    jQuery(field).val(fieldval.substring(0, maxlimit));
+    counterElem.css('border-color', 'red');
+  } else {
+    counterElem.css('border-color', '#ccc');
   }
   // update 'characters left' counter
-  countfield.attr('value', Math.max(maxlimit - fieldval.length, 0));
+  counterElem.val(Math.max(maxlimit - fieldval.length, 0));
 }



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.