├── .gitignore ├── .jscsrc ├── CHANGELOG.md ├── Gruntfile.js ├── LICENSE ├── README.md ├── bower.json ├── index.html ├── jquery.word-and-character-counter.js ├── jquery.word-and-character-counter.min.js ├── js ├── load.js ├── script.js ├── shBrushCss.js ├── shBrushJScript.js └── shCore.js ├── package.json └── style.css /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | npm-debug.log 3 | 4 | .DS_Store 5 | node_modules 6 | .idea 7 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "disallowKeywords": ["with"], 3 | "disallowKeywordsOnNewLine": ["else"], 4 | "disallowMixedSpacesAndTabs": true, 5 | "disallowNewlineBeforeBlockStatements": true, 6 | "disallowQuotedKeysInObjects": true, 7 | "disallowSpaceAfterObjectKeys": true, 8 | "disallowSpaceAfterPrefixUnaryOperators": true, 9 | "disallowSpacesInsideParentheses": true, 10 | "disallowTrailingWhitespace": true, 11 | "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties", 12 | "requireCapitalizedConstructors": true, 13 | "requireCurlyBraces": [ 14 | "if", 15 | "else", 16 | "for", 17 | "while", 18 | "do", 19 | "try", 20 | "catch", 21 | "default" 22 | ], 23 | "requireSpaceAfterKeywords": [ 24 | "if", 25 | "else", 26 | "for", 27 | "while", 28 | "do", 29 | "switch", 30 | "case", 31 | "return", 32 | "try", 33 | "catch", 34 | "typeof" 35 | ], 36 | "requireSpaceAfterLineComment": true, 37 | "requireSpaceAfterBinaryOperators": true, 38 | "requireSpaceBeforeBinaryOperators": true, 39 | "requireSpaceBeforeBlockStatements": true, 40 | "requireSpaceBeforeObjectValues": true, 41 | "requireSpacesInFunction": { 42 | "beforeOpeningCurlyBrace": true 43 | }, 44 | "validateIndentation": 2, 45 | "validateLineBreaks": "LF", 46 | "validateQuoteMarks": false 47 | } 48 | 49 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | * **2.5.1** Allows for using `ctrl`/`command` `a` to select input text when a [character limit is reached #23](https://github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin/issues/23) 2 | * **2.5.0** Support jQuery 3.0 3 | * **2.4.5** 4 | * Added support for DOM elements with the `contentedtiable` attribute set to `true`. Suggested [here #17](https://github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin/issues/17) by [Globulopolis](https://github.com/Globulopolis) 5 | * **2.4.4** 6 | * For easier collaboration, support grunt to [automatically run jscs and uglify #15](https://github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin/pull/15) 7 | 8 | * Using [jsrc](http://jscs.info/overview.html) for code quality control 9 | 10 | * **2.4** 11 | * Support for adding a [custom class on the counter container #11](https://github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin/pull/11) 12 | 13 | * Using [jsrc](http://jscs.info/overview.html) for code quality control 14 | 15 | * **2.3** 16 | * Added ability to use a custom DOM element to place the counter. Also includes an update for placement of the counter (before of after the DOM element.) 17 | 18 | * **2.2** 19 | * Added ablity to use custom language message used for the default message used in this plugin. Suggested (and sample code provide) by [@johnleniel](https://twitter.com/johnleniel) 20 | * **2.1** 21 | * Added new `'Sky'` _string_ value to the `goal` option that enforces counting up without a limit. 22 | * Pasting over the limit when counting down does not show negative numbers 23 | * **2.0** 24 | * Added ability for custom messages. 25 | * Modularized functions and made enhancements. 26 | * Text only: Gives you the option to only display the amount of words/characters remaining (or counting up to), kinda like twitter. 27 | * Paste in words past limit: Before, I had it that once you paste over the allowed words, the whole field will blank out. This time, I have it so that it cuts off the extra words! 28 | * 1.0: initial release 🎂 -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | 3 | grunt.initConfig({ 4 | pkg: grunt.file.readJSON('package.json'), 5 | 6 | // Lint definitions 7 | jscs: { 8 | main: "jquery.word-and-character-counter.js", 9 | options: { 10 | config: ".jscsrc" 11 | } 12 | }, 13 | uglify: { 14 | options: { 15 | banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= pkg.repository.url %> <%= grunt.template.today("dd-mm-yyyy") %> */\n' 16 | }, 17 | dist: { 18 | files: { 19 | 'jquery.word-and-character-counter.min.js': ['jquery.word-and-character-counter.js'] 20 | } 21 | } 22 | } 23 | }); 24 | 25 | grunt.loadNpmTasks("grunt-jscs"); 26 | grunt.loadNpmTasks('grunt-contrib-uglify'); 27 | 28 | grunt.registerTask('default', ['jscs', 'uglify']); 29 | }; 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JQuery Character and Word counter plugin 2 | ========= 3 | This plug-in allows you to count characters or words, up or down. You can set a minimum or maximum goal for the counter to reach. 4 | 5 | - Create a custom message for your counter's message 6 | - Force character/word limit on user to prevent typing 7 | - Works against copy/paster's! 8 | 9 | It will insert a div with an id of the name of the input area you are counting, appended with the string "_counter". 10 | For example, if the input you want to count is called "awesome", the id of the div that keeps track of the count will be "awesome_counter". 11 | 12 | Simple? You bet your ass it is. 13 | 14 | [Demos and code samples](http://qwertypants.github.io/jQuery-Word-and-Character-Counter-Plugin/) 15 | 16 | 17 | ``` 18 | npm install jquery-word-and-character-counter-plugin 19 | ``` 20 | 21 | 22 | ## Contributing 23 | 24 | OMG you're awesome. 25 | 26 | Use the `gh-pages` branch for development. Run `npm install` to install the lint/build packages. 27 | 28 | The source file is `./jquery.word-and-character-counter.js 29 | 30 | Build with `grunt` if you have it installed globally, otherwise `npm run build`. 31 | 32 | ### Code Style 33 | 34 | Be nice and follow the [jsrc](http://jscs.info/overview.html) rules. These 35 | are checked by the Grunt build. 36 | 37 | If your text editor doesn't use it automatically, you can run it using `jscs jquery.word-and-character-counter.js`. 38 | 39 | **Minify it!** 40 | 41 | Bytes are precious. Use `uglifyjs jquery.word-and-character-counter.js -o 42 | jquery.word-and-character-counter.min.js` to minify the output file. This 43 | is run automatically by the Grunt build. 44 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-word-and-character-counter-plugin", 3 | "version": "2.5.1", 4 | "homepage": "https://github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin", 5 | "authors": [ 6 | "Wilkins F." 7 | ], 8 | "license": "MIT", 9 | "ignore": [ 10 | "**/.*", 11 | "node_modules", 12 | "bower_components", 13 | "test", 14 | "tests" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | jQuery word and Character Counter Plugin 10 | 11 | 12 | 21 |
22 |

jQuery Word and character counter plug-in!

23 |
24 | 50 |
51 |

52 | This jQuery Word and character counter plug-in allows you to count characters or words, 53 | up or down. You can set a minimum or maximum goal for the counter to reach. 54 |

55 |

56 | It will insert a 57 | 58 | div 59 | 60 | with an 61 | 62 | id 63 | 64 | of the name of the input area you are counting with a "_counter" suffix. For example, if the 65 | 66 | input 67 | 68 | you want to count is called "countMe", the 69 | 70 | id 71 | 72 | of the 73 | 74 | div 75 | 76 | that keeps track of the count will be "countMe_counter". 77 |

78 |

79 | Simple? You bet your ass it is. 80 |

81 |
    82 |
  • 83 | Show only the counter and not the additional text. 84 |
  • 85 |
  • 86 | Set a minimum number the user much reach. You set the function to be excecuted when they go above or 87 | below the minimum you set. 88 |
  • 89 |
  • 90 | Bug fixes 91 |
  • 92 |
  • 93 | Optimized 94 |
  • 95 |
96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 114 | 115 | 116 | 117 | 118 | 122 | 123 | 124 | 125 | 126 | 138 | 139 | 140 | 141 | 142 | 147 | 148 | 149 | 150 | 166 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 199 | 200 | 201 | 202 |
NameValueDescription
typechar || word 111 |

112 | Count characters or words by using 'char' or 'word' respectively. 113 |

countdown || up 119 |

120 | Count up or down to or from your goal 121 |

goal140 || x || 'sky' 127 |

128 | The goal number. If you are counting down, the counter will start on this 129 | number. If however you are counting up, the counter will end on this number. 130 |

131 |

132 | Sky's the limit! Setting the goal to the string 133 | 134 | 'sky' 135 | 136 | enables counting up, infinitely without stopping the user. 137 |

texttrue || falseSet false if you only want the numbers to show and not the words ( 143 | 144 | msg 145 | ). 146 |
msg 151 |
    152 |
  • 153 | x character(s)/word(s) left 154 |
  • 155 |
  • 156 | x character(s)/word(s) (y max) 157 |
  • 158 |
  • 159 | Your message here! 160 |
  • 161 |
  • 162 | Custom language translation 163 |
  • 164 |
165 |
167 |

168 | There are various defaults set based on the 169 | 170 | type, count 171 | 172 | options being used. You can set your own message to be added after the input field using 173 | this plugin. 174 | If you want the message off, just set the 175 | 176 | text 177 | 178 | to false. 179 |

180 |

181 | Optionally, you can use the 182 | 183 | translation 184 | 185 | option to translate the default language of the message that is shown after the input field. 186 |

targetfalse || custom selector StringPassing a valid jQuery selector will use that DOM element to place the counter on the page.
appendtrue || falseBy default, inserts the counter after the desired DOM element. If set to false, this 197 | will place the counter before the (either custom or default) target element. 198 |
203 |
204 |
205 |

Default Usage

206 |

207 | The most basic way to use the counter is to simply call the 208 | 209 | counter() 210 | 211 | method on a jQuery object. 212 |

213 |
214 |             			$("#default_usage").counter();
215 |

216 | Start typing! 217 |

218 |
219 |

220 | Bacon ipsum dolor sit amet beef short loin pork belly strip steak venison, pig bacon tenderloin 221 | ribeye ham hock pastrami fatback brisket meatloaf. Flank ribeye chicken ball tip, shoulder pastrami turkey. 222 |

223 | 224 |
225 |

226 | Copy & paste the text to the right of the input box above inside the text area. You'll notice that the 227 | text gets cut off, not allowing you to paste or type any further. 228 |

229 |
230 |

Numbers Only

231 |

232 | If you want the numbers only Twitter feel, use the 233 | 234 | text 235 | 236 | option. 237 |

238 |
239 |             			$("#default_usage_num_only").counter({
240 | 							text: false
241 | 						});       			
242 | 243 | 244 | 245 |
246 |

Content Editable

247 |

Also supports DOM elements with contenteditable set to true.

248 |
Type In Here
249 | 250 |
251 |
252 |

Character Count

253 |

254 | By default, this plugin will count characters. Also by default, it will count down. Lets 255 | see how counting up to ten will look: 256 |

257 |
258 | 			            $("#charUp").counter({
259 | 				            count: 'up',
260 | 				            goal: 10
261 | 			            });
262 |
263 |

264 | Bacon ipsum dolor sit amet beef short loin pork belly strip steak venison, pig bacon tenderloin ribeye ham hock pastrami fatback brisket meatloaf. Flank ribeye chicken ball tip, shoulder pastrami turkey. 265 |

266 | 267 |
268 |
269 |
270 |

Word Count

271 |

272 | Since by default this plugin counts characters, you have to set the 273 | 274 | type 275 | 276 | option to 277 | 278 | word 279 | 280 | like so: 281 |

282 |
283 | 					$("#wordDown").counter({
284 | 					    type: 'word',
285 | 					    goal: 20
286 | 					});
287 | New in 2.0! 288 |

289 | After a user pastes more than the words allowed, the extra words will be removed. 290 |

291 |
292 |

293 | Bacon ipsum dolor sit amet beef short loin pork belly strip steak venison, pig bacon tenderloin 294 | ribeye ham hock pastrami fatback brisket meatloaf. Flank ribeye chicken ball tip, shoulder pastrami turkey. 295 |

296 | 297 |
298 |
299 |
300 |

301 | Similarly, if you want to count words up, you would set the count option do up like so: 302 |

303 |
304 | 						$("#wordUp").counter({
305 | 						    type: 'word',
306 | 						    goal: 20,
307 | 						    count: 'up'
308 | 						});
309 |
310 |

311 | Bacon ipsum dolor sit amet beef short loin pork belly strip steak venison, pig bacon tenderloin 312 | ribeye ham hock pastrami fatback brisket meatloaf. Flank ribeye chicken ball tip, shoulder pastrami turkey. 313 |

314 | 315 |
316 |
317 |
318 |

Translate message

319 | New in 2.2! 320 |

321 | By providing a String of 4 words separated by space, you can include your own translation used to build 322 | the message you show to your users. 323 |

324 | Translate the following words (from English) 325 |
    326 |
  • 327 | character 328 |
  • 329 |
  • 330 | word 331 |
  • 332 |
  • 333 | remaining 334 |
  • 335 |
  • 336 | maximum 337 |
  • 338 |
339 |

340 | Then, all you need to do is pass them as a String (in order) as the option 'translation'. 341 |

342 |
343 | 				        $("#translate_words").counter({
344 | 					        goal : 10,
345 | 					        type : 'word',
346 | 					        translation : 'caracter palavra restante màx'
347 | 					    });
348 |
349 | 350 |
351 |
352 | 				         $("#translate_char").counter({
353 | 					        goal : 10,
354 | 					        count : 'up',
355 | 					        translation : 'caracter palavra restante màx'
356 | 					    });
357 |
358 | 359 |
360 |
361 |

Custom message

362 | New in 2.0! 363 |

364 | Let's say you don't like the default text appended to the counter. Simple, just change it. 365 |

366 |
367 | 				        $("#custom_msg").counter({
368 | 				            msg: 'words left before you fall into a pit of emptiness.'
369 | 				        });
370 |
371 | 372 |
373 |
374 |
375 | New in 2.1 376 |

377 | Sky is the limit! (Cheesy, I know.) 378 |

379 |

380 | Setting the 381 | 382 | goal 383 | 384 | to the string 385 | 386 | 'sky' 387 | 388 | (with quotes) overrides the 389 | 390 | count 391 | 392 | to 393 | 394 | up 395 | 396 | and removes the default message. You can optionaly put your own custom message by using the 397 | 398 | msg 399 | 400 | option. 401 |

402 |
403 | 					$("#keepCountingChar").counter({
404 | 						goal: 'sky'
405 | 					});
406 | 407 | 408 |
409 | 					$("#keepCountingWord").counter({
410 | 						goal: 'sky',
411 | 						type : 'word',
412 | 						msg : 'amazing words'
413 | 					});
414 | 415 |
416 |
417 | Courtesy of Gator92 418 | New in 2.1
419 |

Append/Target

420 |

With these new options, you can now place the counter anywhere on the page.

421 |

You can have the counter insert before/after the input you are counting (defaults to 422 | after/true) by setting a boolean value to the append property.

423 |

You can also target any element on the page to insert the counter by passing a jQuery selector to the 424 | target property.

425 |
426 | 			            $('#append-target').counter({
427 | 					        append: false,
428 | 					        target: '#append-here'
429 | 					    });
430 |

In this example, we are using a custom target to move the counter. We're also setting append 431 | to false so that it can be above our target area.

432 |
433 | 434 |
435 |
id = 'append-here'
436 |
437 | 438 |
439 | Courtesy of thomasgohard via pull 441 | #11 442 | 443 |

Let's say you have multilple counters on a single page and want them all to be styled the same way. In 444 | this case, we have a class named 'wrapper'. All you need to do is set the containerClass 445 | property to the name of the class.

446 |

This will add the classname to the counter, giving you an easy way to style multiple counters.

447 |
448 | 			            .wrapper {
449 | 						  font-size: 11px;
450 | 						  border: 1px solid green;
451 | 						  border-radius: 50px;
452 | 						  width: 40%;
453 | 						  padding: 10px;
454 | 						}
455 | 					
456 |
457 | 			            $('#myInput').counter( {
458 | 						   containerClass: 'wrapper'
459 | 						});
460 | 					
461 | 462 |
463 | 464 |
465 | 466 |
467 | 468 |
469 | 470 |
471 | 474 | 475 | 476 | 477 | 478 | 479 | -------------------------------------------------------------------------------- /jquery.word-and-character-counter.js: -------------------------------------------------------------------------------- 1 | // jscs:disable maximumLineLength 2 | (function ($) { 3 | "use strict"; 4 | $.fn.extend({ 5 | counter: function (options) { 6 | var defaults = { 7 | 8 | // {char || word} 9 | type: "char", 10 | 11 | // count {up || down} from or to the goal number 12 | count: "down", 13 | 14 | // count {to || from} this number 15 | goal: 140, 16 | 17 | // Show description of counter 18 | text: true, 19 | 20 | // Specify target for the counter 21 | target: false, 22 | 23 | // Append target, otherwise prepend 24 | append: true, 25 | 26 | // Provide translate text for counter message 27 | translation: "", 28 | 29 | // Custom counter message 30 | msg: "", 31 | 32 | // Custom counter container class 33 | containerClass: "" 34 | }; 35 | var $countObj = "", 36 | countIndex = "", 37 | noLimit = false, 38 | 39 | // Pass {} as first argument to preserve defaults/options for comparison 40 | options = $.extend({}, defaults, options); 41 | 42 | // Adds the counter to the page and binds counter to user input fields 43 | var methods = { 44 | init: function ($obj) { 45 | var objID = $obj.attr("id"), 46 | counterID = objID + "_count"; 47 | 48 | // Check if unlimited typing is enabled 49 | methods.isLimitless(); 50 | 51 | // Insert counter after or before text area/box 52 | $countObj = $(""); 53 | var counterDiv = $("
").attr("id", objID + "_counter").append($countObj) 54 | .append(" " + methods.setMsg()); 55 | if (options.containerClass && options.containerClass.length) { 56 | 57 | // Add the custom container class if one is specified 58 | counterDiv.addClass(options.containerClass); 59 | } 60 | if (!options.target || !$(options.target).length) { 61 | 62 | // Target is not specified or invalid 63 | options.append ? counterDiv.insertAfter($obj) : counterDiv.insertBefore($obj); 64 | } else { 65 | 66 | // Append/prepend counter to specified target 67 | options.append ? 68 | $(options.target).append(counterDiv) : 69 | $(options.target).prepend(counterDiv); 70 | } 71 | 72 | // Set aria-controls attribute of text area/box 73 | $obj.attr('aria-controls', objID + '_counter'); 74 | 75 | // Bind methods to events 76 | methods.bind($obj); 77 | }, 78 | 79 | // Bind everything! 80 | bind: function ($obj) { 81 | $obj.on( 82 | "keypress.counter keydown.counter keyup.counter blur.counter focus.counter change.counter paste.counter", 83 | methods.updateCounter); 84 | $obj.on("keydown.counter", methods.doStopTyping); 85 | $obj.trigger("keydown"); 86 | }, 87 | 88 | // Enables uninterrupted typing ( just counting ) 89 | isLimitless: function () { 90 | if (options.goal === "sky") { 91 | 92 | // Override to count up 93 | options.count = "up"; 94 | 95 | // methods.isGoalReached will always return false 96 | noLimit = true; 97 | return noLimit; 98 | } 99 | }, 100 | // Sets the appropriate message after counter 101 | setMsg: function () { 102 | 103 | // Show custom message 104 | if (options.msg !== "") { 105 | return options.msg; 106 | } 107 | 108 | // Show no message 109 | if (options.text === false) { 110 | return ""; 111 | } 112 | 113 | // Only show custom message if there is one 114 | if (noLimit) { 115 | if (options.msg !== "") { 116 | return options.msg; 117 | } else { 118 | return ""; 119 | } 120 | } 121 | this.text = options.translation || "character word left max"; 122 | this.text = this.text.split(" "); 123 | this.chars = "s ( )".split(" "); 124 | this.msg = null; 125 | switch (options.type) { 126 | case "char": 127 | if (options.count === defaults.count && options.text) { 128 | 129 | // x character( s ) left 130 | this.msg = this.text[0] + this.chars[1] + this.chars[0] + this.chars[2] + 131 | " " + this.text[2]; 132 | } else if (options.count === "up" && options.text) { 133 | 134 | // x characters ( x max ) 135 | this.msg = this.text[0] + this.chars[0] + " " + this.chars[1] + options.goal + 136 | " " + this.text[3] + this.chars[2]; 137 | } 138 | break; 139 | case "word": 140 | if (options.count === defaults.count && options.text) { 141 | 142 | // x word( s ) left 143 | this.msg = this.text[1] + this.chars[1] + this.chars[0] + this.chars[2] + 144 | " " + this.text[2]; 145 | } else if (options.count === "up" && options.text) { 146 | 147 | // x word( s ) ( x max ) 148 | this.msg = this.text[1] + this.chars[1] + this.chars[0] + this.chars[2] + 149 | " " + this.chars[1] + options.goal + " " + this.text[3] + this.chars[2]; 150 | } 151 | break; 152 | default: 153 | } 154 | return this.msg; 155 | }, 156 | /* Returns the amount of words passed in the val argument 157 | * @param val Words to count */ 158 | getWords: function (val) { 159 | if (val !== "") { 160 | return $.trim(val).replace(/\s+/g, " ").split(" ").length; 161 | } else { 162 | return 0; 163 | } 164 | }, 165 | updateCounter: function (e) { 166 | 167 | // If the element has the contentedtiable attribute, use the text value. 168 | // Otherwise use an input value 169 | var $value = ($(this).attr("contentEditable") == "true") ? $(this).text() : $(this).val(); 170 | 171 | // Is the goal amount passed? ( most common when pasting ) 172 | if (countIndex < 0 || countIndex > options.goal) { 173 | methods.passedGoal($(this)); 174 | } 175 | 176 | // Counting characters... 177 | if (options.type === defaults.type) { 178 | 179 | // ...down 180 | if (options.count === defaults.count) { 181 | countIndex = options.goal - $value.length; 182 | 183 | // Prevent negative counter 184 | if (countIndex <= 0) { 185 | $countObj.text("0"); 186 | } else { 187 | $countObj.text(countIndex); 188 | } 189 | 190 | // ...up 191 | } else if (options.count === "up") { 192 | countIndex = $value.length; 193 | $countObj.text(countIndex); 194 | } 195 | 196 | // Counting words... 197 | } else if (options.type === "word") { 198 | 199 | // ...down 200 | if (options.count === defaults.count) { 201 | 202 | // Count words 203 | countIndex = methods.getWords($value); 204 | if (countIndex <= options.goal) { 205 | 206 | // Subtract 207 | countIndex = options.goal - countIndex; 208 | 209 | // Update text 210 | $countObj.text(countIndex); 211 | } else { 212 | 213 | // Don't show negative number count 214 | $countObj.text("0"); 215 | } 216 | 217 | // ...up 218 | } else if (options.count === "up") { 219 | countIndex = methods.getWords($value); 220 | $countObj.text(countIndex); 221 | } 222 | } 223 | }, 224 | /* Stops the ability to type */ 225 | doStopTyping: function (e) { 226 | 227 | // backspace, delete, tab, left, up, right, down, end, home, spacebar 228 | var keys = [46, 8, 9, 35, 36, 37, 38, 39, 40, 32]; 229 | if (methods.isGoalReached(e)) { 230 | 231 | // NOTE: // Using !$.inArray( e.keyCode, keys as a condition causes delays 232 | if (e.keyCode !== keys[0] && e.keyCode !== keys[1] && e.keyCode !== keys[2] && 233 | e.keyCode !== keys[3] && e.keyCode !== keys[4] && e.keyCode !== keys[5] && 234 | e.keyCode !== keys[6] && e.keyCode !== keys[7] && e.keyCode !== keys[8]) { 235 | 236 | // Stop typing when counting characters 237 | if (options.type === defaults.type) { 238 | // Allows command/control 239 | if (!e.keyCode === 49 || !e.keyCode === 17) { 240 | return false; 241 | } 242 | 243 | // Counting words, only allow backspace & delete 244 | } else { 245 | return (e.keyCode !== keys[9] && e.keyCode !== keys[1] && options.type != defaults.type); 246 | } 247 | } 248 | } 249 | }, 250 | /* Checks to see if the goal number has been reached */ 251 | isGoalReached: function (e, _goal) { 252 | if (noLimit) { 253 | return false; 254 | } 255 | 256 | // Counting down 257 | if (options.count === defaults.count) { 258 | _goal = 0; 259 | return (countIndex <= _goal); 260 | } else { 261 | 262 | // Counting up 263 | _goal = options.goal; 264 | return (countIndex >= _goal); 265 | } 266 | }, 267 | /* Removes extra words when the amount of words in 268 | * the input go over the desired goal. 269 | * @param {Number} numOfWords Amount of words you would like shown 270 | * @param {String} text The full text to condense */ 271 | wordStrip: function (numOfWords, text) { 272 | 273 | // Get the word count by counting the spaces ( after eliminating trailing white space ) 274 | var wordCount = text.replace(/\s+/g, " ").split(" ").length; 275 | text = $.trim(text); 276 | 277 | // Make it worth executing 278 | if (numOfWords <= 0 || numOfWords === wordCount) { 279 | return text; 280 | } else { 281 | text = $.trim(text).split(" "); 282 | text.splice(numOfWords, wordCount, ""); 283 | return $.trim(text.join(" ")); 284 | } 285 | }, 286 | // If the goal is passed, trim the chars/words down to what is allowed. Also, reset the counter. 287 | passedGoal: function ($obj) { 288 | var userInput = $obj.val(); 289 | if (options.type === "word") { 290 | $obj.val(methods.wordStrip(options.goal, userInput)); 291 | } 292 | if (options.type === "char") { 293 | $obj.val(userInput.substring(0, options.goal)); 294 | } 295 | 296 | // Reset to 0 297 | if (options.type === "down") { 298 | $countObj.val("0"); 299 | } 300 | 301 | // Reset to goal 302 | if (options.type === "up") { 303 | $countObj.val(options.goal); 304 | } 305 | } 306 | }; 307 | return this.each(function () { 308 | methods.init($(this)); 309 | }); 310 | } 311 | }); 312 | })(jQuery); -------------------------------------------------------------------------------- /jquery.word-and-character-counter.min.js: -------------------------------------------------------------------------------- 1 | /*! jquery-word-and-character-counter-plugin 2.5.1 https://qwertypants@github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin 24-06-2017 */ 2 | !function(a){"use strict";a.fn.extend({counter:function(b){var c={type:"char",count:"down",goal:140,text:!0,target:!1,append:!0,translation:"",msg:"",containerClass:""},d="",e="",f=!1,b=a.extend({},c,b),g={init:function(c){var e=c.attr("id"),f=e+"_count";g.isLimitless(),d=a("");var h=a("
").attr("id",e+"_counter").append(d).append(" "+g.setMsg());b.containerClass&&b.containerClass.length&&h.addClass(b.containerClass),b.target&&a(b.target).length?b.append?a(b.target).append(h):a(b.target).prepend(h):b.append?h.insertAfter(c):h.insertBefore(c),c.attr("aria-controls",e+"_counter"),g.bind(c)},bind:function(a){a.on("keypress.counter keydown.counter keyup.counter blur.counter focus.counter change.counter paste.counter",g.updateCounter),a.on("keydown.counter",g.doStopTyping),a.trigger("keydown")},isLimitless:function(){if("sky"===b.goal)return b.count="up",f=!0},setMsg:function(){if(""!==b.msg)return b.msg;if(b.text===!1)return"";if(f)return""!==b.msg?b.msg:"";switch(this.text=b.translation||"character word left max",this.text=this.text.split(" "),this.chars="s ( )".split(" "),this.msg=null,b.type){case"char":b.count===c.count&&b.text?this.msg=this.text[0]+this.chars[1]+this.chars[0]+this.chars[2]+" "+this.text[2]:"up"===b.count&&b.text&&(this.msg=this.text[0]+this.chars[0]+" "+this.chars[1]+b.goal+" "+this.text[3]+this.chars[2]);break;case"word":b.count===c.count&&b.text?this.msg=this.text[1]+this.chars[1]+this.chars[0]+this.chars[2]+" "+this.text[2]:"up"===b.count&&b.text&&(this.msg=this.text[1]+this.chars[1]+this.chars[0]+this.chars[2]+" "+this.chars[1]+b.goal+" "+this.text[3]+this.chars[2])}return this.msg},getWords:function(b){return""!==b?a.trim(b).replace(/\s+/g," ").split(" ").length:0},updateCounter:function(f){var h="true"==a(this).attr("contentEditable")?a(this).text():a(this).val();(e<0||e>b.goal)&&g.passedGoal(a(this)),b.type===c.type?b.count===c.count?(e=b.goal-h.length,e<=0?d.text("0"):d.text(e)):"up"===b.count&&(e=h.length,d.text(e)):"word"===b.type&&(b.count===c.count?(e=g.getWords(h),e<=b.goal?(e=b.goal-e,d.text(e)):d.text("0")):"up"===b.count&&(e=g.getWords(h),d.text(e)))},doStopTyping:function(a){var d=[46,8,9,35,36,37,38,39,40,32];if(g.isGoalReached(a)&&a.keyCode!==d[0]&&a.keyCode!==d[1]&&a.keyCode!==d[2]&&a.keyCode!==d[3]&&a.keyCode!==d[4]&&a.keyCode!==d[5]&&a.keyCode!==d[6]&&a.keyCode!==d[7]&&a.keyCode!==d[8]){if(b.type!==c.type)return a.keyCode!==d[9]&&a.keyCode!==d[1]&&b.type!=c.type;if(49===!a.keyCode||17===!a.keyCode)return!1}},isGoalReached:function(a,d){return!f&&(b.count===c.count?(d=0,e<=d):(d=b.goal,e>=d))},wordStrip:function(b,c){var d=c.replace(/\s+/g," ").split(" ").length;return c=a.trim(c),b<=0||b===d?c:(c=a.trim(c).split(" "),c.splice(b,d,""),a.trim(c.join(" ")))},passedGoal:function(a){var c=a.val();"word"===b.type&&a.val(g.wordStrip(b.goal,c)),"char"===b.type&&a.val(c.substring(0,b.goal)),"down"===b.type&&d.val("0"),"up"===b.type&&d.val(b.goal)}};return this.each(function(){g.init(a(this))})}})}(jQuery); -------------------------------------------------------------------------------- /js/load.js: -------------------------------------------------------------------------------- 1 | /*! LAB.js (LABjs :: Loading And Blocking JavaScript) 2 | v2.0.1 (c) Kyle Simpson 3 | MIT License 4 | */ 5 | (function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b0){for(var a=0;a=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this); 6 | $LAB 7 | .script("./jquery.word-and-character-counter.js") 8 | .script("js/script.js") 9 | .script("js/shCore.js").wait() 10 | .script("js/shBrushCss.js") 11 | .script("js/shBrushJScript.js"); 12 | 13 | (function(){ 14 | var _gaq = _gaq || []; 15 | _gaq.push(['_setAccount', 'UA-25629567-1']); 16 | _gaq.push(['_trackPageview']); 17 | 18 | (function() { 19 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 20 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 21 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 22 | })(); 23 | }()); 24 | -------------------------------------------------------------------------------- /js/script.js: -------------------------------------------------------------------------------- 1 | (function ($) { 2 | $("#tabs").tabs(); 3 | $("body").fadeIn(); 4 | 5 | $("#close").click(function () { 6 | $("#notice").effect("explode"); 7 | }); 8 | 9 | $("tr:even").addClass("alt"); 10 | $("td").each(function () { 11 | $(this).attr("valign", "top"); 12 | }); 13 | $("tr").hover(function () { 14 | $(this).addClass("over"); 15 | }, function () { 16 | $(this).removeClass("over"); 17 | }); 18 | 19 | // Examples 20 | $("#default_usage").counter(); 21 | $("#default_usage_num_only").counter({ 22 | "text": false 23 | }); 24 | $("#charUp").counter({ 25 | count: "up", 26 | goal: 10 27 | }); 28 | $("#wordDown").counter({ 29 | type: "word", 30 | goal: 20 31 | }); 32 | 33 | $("#wordUp").counter({ 34 | type: "word", 35 | goal: 20, 36 | count: "up" 37 | }); 38 | 39 | $("#custom_msg").counter({ 40 | msg: "words left before you fall into a pit of emptiness." 41 | }); 42 | 43 | $("#keepCountingChar").counter({ 44 | goal: "sky" 45 | }); 46 | 47 | $("#keepCountingWord").counter({ 48 | goal: "sky", 49 | type: "word", 50 | msg: "amazing words" 51 | }); 52 | 53 | $("#translate_words").counter({ 54 | goal: 10, 55 | type: "word", 56 | translation: "caracter palavra restante màx" 57 | }); 58 | $("#translate_char").counter({ 59 | goal: 10, 60 | type: "word", 61 | count: "up", 62 | translation: "caracter palavra restante màx" 63 | }); 64 | $("#append-target").counter({ 65 | append: false, 66 | target: "#append-here" 67 | }); 68 | $("#myInput").counter({ 69 | containerClass: "wrapper" 70 | }); 71 | 72 | $(" ").insertAfter($("a[target^='_blank']")); 73 | 74 | $("#contentEditable").counter({ 75 | goal: 20 76 | }); 77 | 78 | })(jQuery); -------------------------------------------------------------------------------- /js/shBrushCss.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | function getKeywordsCSS(str) 25 | { 26 | return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; 27 | }; 28 | 29 | function getValuesCSS(str) 30 | { 31 | return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; 32 | }; 33 | 34 | var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + 35 | 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + 36 | 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + 37 | 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + 38 | 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + 39 | 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + 40 | 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + 41 | 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + 42 | 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + 43 | 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + 44 | 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + 45 | 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + 46 | 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + 47 | 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; 48 | 49 | var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+ 50 | 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+ 51 | 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+ 52 | 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+ 53 | 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+ 54 | 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+ 55 | 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+ 56 | 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+ 57 | 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+ 58 | 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+ 59 | 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+ 60 | 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+ 61 | 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+ 62 | 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; 63 | 64 | var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; 65 | 66 | this.regexList = [ 67 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 68 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 69 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 70 | { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors 71 | { regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes 72 | { regex: /!important/g, css: 'color3' }, // !important 73 | { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords 74 | { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values 75 | { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts 76 | ]; 77 | 78 | this.forHtmlScript({ 79 | left: /(<|<)\s*style.*?(>|>)/gi, 80 | right: /(<|<)\/\s*style\s*(>|>)/gi 81 | }); 82 | }; 83 | 84 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 85 | Brush.aliases = ['css']; 86 | 87 | SyntaxHighlighter.brushes.CSS = Brush; 88 | 89 | // CommonJS 90 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 91 | })(); 92 | -------------------------------------------------------------------------------- /js/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'break case catch continue ' + 25 | 'default delete do else false ' + 26 | 'for function if in instanceof ' + 27 | 'new null return super switch ' + 28 | 'this throw true try typeof var while with' 29 | ; 30 | 31 | var r = SyntaxHighlighter.regexLib; 32 | 33 | this.regexList = [ 34 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 35 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 36 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments 37 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 38 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 40 | ]; 41 | 42 | this.forHtmlScript(r.scriptScriptTags); 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['js', 'jscript', 'javascript']; 47 | 48 | SyntaxHighlighter.brushes.JScript = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | SyntaxHighlighter.all(); -------------------------------------------------------------------------------- /js/shCore.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('K M;I(M)1S 2U("2a\'t 4k M 4K 2g 3l 4G 4H");(6(){6 r(f,e){I(!M.1R(f))1S 3m("3s 15 4R");K a=f.1w;f=M(f.1m,t(f)+(e||""));I(a)f.1w={1m:a.1m,19:a.19?a.19.1a(0):N};H f}6 t(f){H(f.1J?"g":"")+(f.4s?"i":"")+(f.4p?"m":"")+(f.4v?"x":"")+(f.3n?"y":"")}6 B(f,e,a,b){K c=u.L,d,h,g;v=R;5K{O(;c--;){g=u[c];I(a&g.3r&&(!g.2p||g.2p.W(b))){g.2q.12=e;I((h=g.2q.X(f))&&h.P===e){d={3k:g.2b.W(b,h,a),1C:h};1N}}}}5v(i){1S i}5q{v=11}H d}6 p(f,e,a){I(3b.Z.1i)H f.1i(e,a);O(a=a||0;a-1},3d:6(g){e+=g}};c1&&p(e,"")>-1){a=15(J.1m,n.Q.W(t(J),"g",""));n.Q.W(f.1a(e.P),a,6(){O(K c=1;c<14.L-2;c++)I(14[c]===1d)e[c]=1d})}I(J.1w&&J.1w.19)O(K b=1;be.P&&J.12--}H e};I(!D)15.Z.1A=6(f){(f=n.X.W(J,f))&&J.1J&&!f[0].L&&J.12>f.P&&J.12--;H!!f};1r.Z.1C=6(f){M.1R(f)||(f=15(f));I(f.1J){K e=n.1C.1p(J,14);f.12=0;H e}H f.X(J)};1r.Z.Q=6(f,e){K a=M.1R(f),b,c;I(a&&1j e.58()==="3f"&&e.1i("${")===-1&&y)H n.Q.1p(J,14);I(a){I(f.1w)b=f.1w.19}Y f+="";I(1j e==="6")c=n.Q.W(J,f,6(){I(b){14[0]=1f 1r(14[0]);O(K d=0;dd.L-3;){i=1r.Z.1a.W(g,-1)+i;g=1Q.3i(g/10)}H(g?d[g]||"":"$")+i}Y{g=+i;I(g<=d.L-3)H d[g];g=b?p(b,i):-1;H g>-1?d[g+1]:h}})})}I(a&&f.1J)f.12=0;H c};1r.Z.1e=6(f,e){I(!M.1R(f))H n.1e.1p(J,14);K a=J+"",b=[],c=0,d,h;I(e===1d||+e<0)e=5D;Y{e=1Q.3i(+e);I(!e)H[]}O(f=M.3c(f);d=f.X(a);){I(f.12>c){b.U(a.1a(c,d.P));d.L>1&&d.P=e)1N}f.12===d.P&&f.12++}I(c===a.L){I(!n.1A.W(f,"")||h)b.U("")}Y b.U(a.1a(c));H b.L>e?b.1a(0,e):b};M.1h(/\\(\\?#[^)]*\\)/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"});M.1h(/\\((?!\\?)/,6(){J.19.U(N);H"("});M.1h(/\\(\\?<([$\\w]+)>/,6(f){J.19.U(f[1]);J.2N=R;H"("});M.1h(/\\\\k<([\\w$]+)>/,6(f){K e=p(J.19,f[1]);H e>-1?"\\\\"+(e+1)+(3R(f.2S.3a(f.P+f[0].L))?"":"(?:)"):f[0]});M.1h(/\\[\\^?]/,6(f){H f[0]==="[]"?"\\\\b\\\\B":"[\\\\s\\\\S]"});M.1h(/^\\(\\?([5A]+)\\)/,6(f){J.3d(f[1]);H""});M.1h(/(?:\\s+|#.*)+/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"},M.1B,6(){H J.2K("x")});M.1h(/\\./,6(){H"[\\\\s\\\\S]"},M.1B,6(){H J.2K("s")})})();1j 2e!="1d"&&(2e.M=M);K 1v=6(){6 r(a,b){a.1l.1i(b)!=-1||(a.1l+=" "+b)}6 t(a){H a.1i("3e")==0?a:"3e"+a}6 B(a){H e.1Y.2A[t(a)]}6 p(a,b,c){I(a==N)H N;K d=c!=R?a.3G:[a.2G],h={"#":"1c",".":"1l"}[b.1o(0,1)]||"3h",g,i;g=h!="3h"?b.1o(1):b.5u();I((a[h]||"").1i(g)!=-1)H a;O(a=0;d&&a\'+c+""});H a}6 n(a,b){a.1e("\\n");O(K c="",d=0;d<50;d++)c+=" ";H a=v(a,6(h){I(h.1i("\\t")==-1)H h;O(K g=0;(g=h.1i("\\t"))!=-1;)h=h.1o(0,g)+c.1o(0,b-g%b)+h.1o(g+1,h.L);H h})}6 x(a){H a.Q(/^\\s+|\\s+$/g,"")}6 D(a,b){I(a.Pb.P)H 1;Y I(a.Lb.L)H 1;H 0}6 y(a,b){6 c(k){H k[0]}O(K d=N,h=[],g=b.2D?b.2D:c;(d=b.1I.X(a))!=N;){K i=g(d,b);I(1j i=="3f")i=[1f e.2L(i,d.P,b.23)];h=h.1O(i)}H h}6 E(a){K b=/(.*)((&1G;|&1y;).*)/;H a.Q(e.3A.3M,6(c){K d="",h=N;I(h=b.X(c)){c=h[1];d=h[2]}H\'\'+c+""+d})}6 z(){O(K a=1E.36("1k"),b=[],c=0;c<1z 4I="1Z://2y.3L.3K/4L/5L"><3J><4N 1Z-4M="5G-5M" 6K="2O/1z; 6J=6I-8" /><1t>6L 1v<3B 1L="25-6M:6Q,6P,6O,6N-6F;6y-2f:#6x;2f:#6w;25-22:6v;2O-3D:3C;">1v3v 3.0.76 (72 73 3x)1Z://3u.2w/1v70 17 6U 71.6T 6X-3x 6Y 6D.6t 61 60 J 1k, 5Z 5R 5V <2R/>5U 5T 5S!\'}},1Y:{2j:N,2A:{}},1U:{},3A:{6n:/\\/\\*[\\s\\S]*?\\*\\//2c,6m:/\\/\\/.*$/2c,6l:/#.*$/2c,6k:/"([^\\\\"\\n]|\\\\.)*"/g,6o:/\'([^\\\\\'\\n]|\\\\.)*\'/g,6p:1f M(\'"([^\\\\\\\\"]|\\\\\\\\.)*"\',"3z"),6s:1f M("\'([^\\\\\\\\\']|\\\\\\\\.)*\'","3z"),6q:/(&1y;|<)!--[\\s\\S]*?--(&1G;|>)/2c,3M:/\\w+:\\/\\/[\\w-.\\/?%&=:@;]*/g,6a:{18:/(&1y;|<)\\?=?/g,1b:/\\?(&1G;|>)/g},69:{18:/(&1y;|<)%=?/g,1b:/%(&1G;|>)/g},6d:{18:/(&1y;|<)\\s*1k.*?(&1G;|>)/2T,1b:/(&1y;|<)\\/\\s*1k\\s*(&1G;|>)/2T}},16:{1H:6(a){6 b(i,k){H e.16.2o(i,k,e.13.1x[k])}O(K c=\'\',d=e.16.2x,h=d.2X,g=0;g";H c},2o:6(a,b,c){H\'<2W>\'+c+""},2b:6(a){K b=a.1F,c=b.1l||"";b=B(p(b,".20",R).1c);K d=6(h){H(h=15(h+"6f(\\\\w+)").X(c))?h[1]:N}("6g");b&&d&&e.16.2x[d].2B(b);a.3N()},2x:{2X:["21","2P"],21:{1H:6(a){I(a.V("2l")!=R)H"";K b=a.V("1t");H e.16.2o(a,"21",b?b:e.13.1x.21)},2B:6(a){a=1E.6j(t(a.1c));a.1l=a.1l.Q("47","")}},2P:{2B:6(){K a="68=0";a+=", 18="+(31.30-33)/2+", 32="+(31.2Z-2Y)/2+", 30=33, 2Z=2Y";a=a.Q(/^,/,"");a=1P.6Z("","38",a);a.2C();K b=a.1E;b.6W(e.13.1x.37);b.6V();a.2C()}}}},35:6(a,b){K c;I(b)c=[b];Y{c=1E.36(e.13.34);O(K d=[],h=0;h(.*?))\\\\]$"),s=1f M("(?<27>[\\\\w-]+)\\\\s*:\\\\s*(?<1T>[\\\\w-%#]+|\\\\[.*?\\\\]|\\".*?\\"|\'.*?\')\\\\s*;?","g");(j=s.X(k))!=N;){K o=j.1T.Q(/^[\'"]|[\'"]$/g,"");I(o!=N&&m.1A(o)){o=m.X(o);o=o.2V.L>0?o.2V.1e(/\\s*,\\s*/):[]}l[j.27]=o}g={1F:g,1n:C(i,l)};g.1n.1D!=N&&d.U(g)}H d},1M:6(a,b){K c=J.35(a,b),d=N,h=e.13;I(c.L!==0)O(K g=0;g")==o-3){m=m.4h(0,o-3);s=R}l=s?m:l}I((i.1t||"")!="")k.1t=i.1t;k.1D=j;d.2Q(k);b=d.2F(l);I((i.1c||"")!="")b.1c=i.1c;i.2G.74(b,i)}}},2E:6(a){w(1P,"4k",6(){e.1M(a)})}};e.2E=e.2E;e.1M=e.1M;e.2L=6(a,b,c){J.1T=a;J.P=b;J.L=a.L;J.23=c;J.1V=N};e.2L.Z.1q=6(){H J.1T};e.4l=6(a){6 b(j,l){O(K m=0;md)1N;Y I(g.P==c.P&&g.L>c.L)a[b]=N;Y I(g.P>=c.P&&g.P\'+c+""},3Q:6(a,b){K c="",d=a.1e("\\n").L,h=2u(J.V("2i-1s")),g=J.V("2z-1s-2t");I(g==R)g=(h+d-1).1q().L;Y I(3R(g)==R)g=0;O(K i=0;i\'+j+"":"")+i)}H a},4f:6(a){H a?"<4a>"+a+"":""},4b:6(a,b){6 c(l){H(l=l?l.1V||g:g)?l+" ":""}O(K d=0,h="",g=J.V("1D",""),i=0;i|&1y;2R\\s*\\/?&1G;/2T;I(e.13.46==R)b=b.Q(h,"\\n");I(e.13.44==R)b=b.Q(h,"");b=b.1e("\\n");h=/^\\s*/;g=4Q;O(K i=0;i0;i++){K k=b[i];I(x(k).L!=0){k=h.X(k);I(k==N){a=a;1N a}g=1Q.4q(k[0].L,g)}}I(g>0)O(i=0;i\'+(J.V("16")?e.16.1H(J):"")+\'<3Z 5z="0" 5H="0" 5J="0">\'+J.4f(J.V("1t"))+"<3T><3P>"+(1u?\'<2d 1g="1u">\'+J.3Q(a)+"":"")+\'<2d 1g="17">\'+b+""},2F:6(a){I(a===N)a="";J.17=a;K b=J.3Y("T");b.3X=J.1H(a);J.V("16")&&w(p(b,".16"),"5c",e.16.2b);J.V("3V-17")&&w(p(b,".17"),"56",f);H b},2Q:6(a){J.1c=""+1Q.5d(1Q.5n()*5k).1q();e.1Y.2A[t(J.1c)]=J;J.1n=C(e.2v,a||{});I(J.V("2k")==R)J.1n.16=J.1n.1u=11},5j:6(a){a=a.Q(/^\\s+|\\s+$/g,"").Q(/\\s+/g,"|");H"\\\\b(?:"+a+")\\\\b"},5f:6(a){J.28={18:{1I:a.18,23:"1k"},1b:{1I:a.1b,23:"1k"},17:1f M("(?<18>"+a.18.1m+")(?<17>.*?)(?<1b>"+a.1b.1m+")","5o")}}};H e}();1j 2e!="1d"&&(2e.1v=1v);',62,441,'||||||function|||||||||||||||||||||||||||||||||||||return|if|this|var|length|XRegExp|null|for|index|replace|true||div|push|getParam|call|exec|else|prototype||false|lastIndex|config|arguments|RegExp|toolbar|code|left|captureNames|slice|right|id|undefined|split|new|class|addToken|indexOf|typeof|script|className|source|params|substr|apply|toString|String|line|title|gutter|SyntaxHighlighter|_xregexp|strings|lt|html|test|OUTSIDE_CLASS|match|brush|document|target|gt|getHtml|regex|global|join|style|highlight|break|concat|window|Math|isRegExp|throw|value|brushes|brushName|space|alert|vars|http|syntaxhighlighter|expandSource|size|css|case|font|Fa|name|htmlScript|dA|can|handler|gm|td|exports|color|in|href|first|discoveredBrushes|light|collapse|object|cache|getButtonHtml|trigger|pattern|getLineHtml|nbsp|numbers|parseInt|defaults|com|items|www|pad|highlighters|execute|focus|func|all|getDiv|parentNode|navigator|INSIDE_CLASS|regexList|hasFlag|Match|useScriptTags|hasNamedCapture|text|help|init|br|input|gi|Error|values|span|list|250|height|width|screen|top|500|tagName|findElements|getElementsByTagName|aboutDialog|_blank|appendChild|charAt|Array|copyAsGlobal|setFlag|highlighter_|string|attachEvent|nodeName|floor|backref|output|the|TypeError|sticky|Za|iterate|freezeTokens|scope|type|textarea|alexgorbatchev|version|margin|2010|005896|gs|regexLib|body|center|align|noBrush|require|childNodes|DTD|xhtml1|head|org|w3|url|preventDefault|container|tr|getLineNumbersHtml|isNaN|userAgent|tbody|isLineHighlighted|quick|void|innerHTML|create|table|links|auto|smart|tab|stripBrs|tabs|bloggerMode|collapsed|plain|getCodeLinesHtml|caption|getMatchesHtml|findMatches|figureOutLineNumbers|removeNestedMatches|getTitleHtml|brushNotHtmlScript|substring|createElement|Highlighter|load|HtmlScript|Brush|pre|expand|multiline|min|Can|ignoreCase|find|blur|extended|toLowerCase|aliases|addEventListener|innerText|textContent|wasn|select|createTextNode|removeChild|option|same|frame|xmlns|dtd|twice|1999|equiv|meta|htmlscript|transitional|1E3|expected|PUBLIC|DOCTYPE|on|W3C|XHTML|TR|EN|Transitional||configured|srcElement|Object|after|run|dblclick|matchChain|valueOf|constructor|default|switch|click|round|execAt|forHtmlScript|token|gimy|functions|getKeywords|1E6|escape|within|random|sgi|another|finally|supply|MSIE|ie|toUpperCase|catch|returnValue|definition|event|border|imsx|constructing|one|Infinity|from|when|Content|cellpadding|flags|cellspacing|try|xhtml|Type|spaces|2930402|hosted_button_id|lastIndexOf|donate|active|development|keep|to|xclick|_s|Xml|please|like|you|paypal|cgi|cmd|webscr|bin|highlighted|scrollbars|aspScriptTags|phpScriptTags|sort|max|scriptScriptTags|toolbar_item|_|command|command_|number|getElementById|doubleQuotedString|singleLinePerlComments|singleLineCComments|multiLineCComments|singleQuotedString|multiLineDoubleQuotedString|xmlComments|alt|multiLineSingleQuotedString|If|https|1em|000|fff|background|5em|xx|bottom|75em|Gorbatchev|large|serif|CDATA|continue|utf|charset|content|About|family|sans|Helvetica|Arial|Geneva|3em|nogutter|Copyright|syntax|close|write|2004|Alex|open|JavaScript|highlighter|July|02|replaceChild|offset|83'.split('|'),0,{})) 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-word-and-character-counter-plugin", 3 | "version": "2.5.1", 4 | "description": "This word and character counter plugin allows you to count characters or words, up or down. You can set a minimum or maximum goal for the counter to reach. And sweet, sweet options.", 5 | "main": "jquery.word-and-character-counter.min.js", 6 | "devDependencies": { 7 | "grunt": "^1.0.1", 8 | "grunt-cli": "^1.2.0", 9 | "grunt-contrib-uglify": "^2.0.0", 10 | "grunt-jscs": "^3.0.1", 11 | "uglifyjs": "^2.4.10" 12 | }, 13 | "scripts": { 14 | "build": "grunt" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://qwertypants@github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin" 19 | }, 20 | "keywords": [ 21 | "counter", 22 | "word", 23 | "character", 24 | "jquery-plugin" 25 | ], 26 | "author": "Wilkins Fernandez ", 27 | "license": "MIT", 28 | "bugs": { 29 | "url": "https://github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin/issues" 30 | }, 31 | "homepage": "https://github.com/qwertypants/jQuery-Word-and-Character-Counter-Plugin" 32 | } 33 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | /* $Default 2 | * $SyntaxHighlighter 3 | * */ 4 | 5 | 6 | 7 | 8 | /*$SyntaxHighlighter*/ 9 | /** 10 | * SyntaxHighlighter 11 | * http://alexgorbatchev.com/SyntaxHighlighter 12 | * 13 | * SyntaxHighlighter is donationware. If you are using it, please donate. 14 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 15 | * 16 | * @version 17 | * 3.0.83 (July 02 2010) 18 | * 19 | * @copyright 20 | * Copyright (C) 2004-2010 Alex Gorbatchev. 21 | * 22 | * @license 23 | * Dual licensed under the MIT and GPL licenses. 24 | */ 25 | .syntaxhighlighter a, 26 | .syntaxhighlighter div, 27 | .syntaxhighlighter code, 28 | .syntaxhighlighter table, 29 | .syntaxhighlighter table td, 30 | .syntaxhighlighter table tr, 31 | .syntaxhighlighter table tbody, 32 | .syntaxhighlighter table thead, 33 | .syntaxhighlighter table caption, 34 | .syntaxhighlighter textarea { 35 | -moz-border-radius: 0 0 0 0 !important; 36 | -webkit-border-radius: 0 0 0 0 !important; 37 | background: none !important; 38 | border: 0 !important; 39 | bottom: auto !important; 40 | float: none !important; 41 | height: auto !important; 42 | left: auto !important; 43 | line-height: 1.1em !important; 44 | margin: 0 !important; 45 | outline: 0 !important; 46 | overflow: visible !important; 47 | padding: 0 !important; 48 | position: static !important; 49 | right: auto !important; 50 | text-align: left !important; 51 | top: auto !important; 52 | vertical-align: baseline !important; 53 | width: auto !important; 54 | box-sizing: content-box !important; 55 | font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; 56 | font-weight: normal !important; 57 | font-style: normal !important; 58 | font-size: 1em !important; 59 | min-height: inherit !important; 60 | min-height: auto !important; 61 | } 62 | 63 | .syntaxhighlighter { 64 | width: 100% !important; 65 | margin: 1em 0 1em 0 !important; 66 | position: relative !important; 67 | overflow: auto !important; 68 | font-size: 1em !important; 69 | } 70 | .syntaxhighlighter.source { 71 | overflow: hidden !important; 72 | } 73 | .syntaxhighlighter .bold { 74 | font-weight: bold !important; 75 | } 76 | .syntaxhighlighter .italic { 77 | font-style: italic !important; 78 | } 79 | .syntaxhighlighter .line { 80 | white-space: pre !important; 81 | } 82 | .syntaxhighlighter table { 83 | width: 100% !important; 84 | } 85 | .syntaxhighlighter table caption { 86 | text-align: left !important; 87 | padding: .5em 0 0.5em 1em !important; 88 | } 89 | .syntaxhighlighter table td.code { 90 | width: 100% !important; 91 | } 92 | .syntaxhighlighter table td.code .container { 93 | position: relative !important; 94 | } 95 | .syntaxhighlighter table td.code .container textarea { 96 | box-sizing: border-box !important; 97 | position: absolute !important; 98 | left: 0 !important; 99 | top: 0 !important; 100 | width: 100% !important; 101 | height: 100% !important; 102 | border: none !important; 103 | background: white !important; 104 | padding-left: 1em !important; 105 | overflow: hidden !important; 106 | white-space: pre !important; 107 | } 108 | .syntaxhighlighter table td.gutter .line { 109 | text-align: right !important; 110 | padding: 0 0.5em 0 1em !important; 111 | } 112 | .syntaxhighlighter table td.code .line { 113 | padding: 0 1em !important; 114 | } 115 | .syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { 116 | padding-left: 0em !important; 117 | } 118 | .syntaxhighlighter.show { 119 | display: block !important; 120 | } 121 | .syntaxhighlighter.collapsed table { 122 | display: none !important; 123 | } 124 | .syntaxhighlighter.collapsed .toolbar { 125 | padding: 0.1em 0.8em 0em 0.8em !important; 126 | font-size: 1em !important; 127 | position: static !important; 128 | width: auto !important; 129 | height: auto !important; 130 | } 131 | .syntaxhighlighter.collapsed .toolbar span { 132 | display: inline !important; 133 | margin-right: 1em !important; 134 | } 135 | .syntaxhighlighter.collapsed .toolbar span a { 136 | padding: 0 !important; 137 | display: none !important; 138 | } 139 | .syntaxhighlighter.collapsed .toolbar span a.expandSource { 140 | display: inline !important; 141 | } 142 | .syntaxhighlighter .toolbar { 143 | position: absolute !important; 144 | right: 1px !important; 145 | top: 1px !important; 146 | width: 11px !important; 147 | height: 11px !important; 148 | font-size: 10px !important; 149 | z-index: 10 !important; 150 | } 151 | .syntaxhighlighter .toolbar span.title { 152 | display: inline !important; 153 | } 154 | .syntaxhighlighter .toolbar a { 155 | display: block !important; 156 | text-align: center !important; 157 | text-decoration: none !important; 158 | padding-top: 1px !important; 159 | } 160 | .syntaxhighlighter .toolbar a.expandSource { 161 | display: none !important; 162 | } 163 | .syntaxhighlighter.ie { 164 | font-size: .9em !important; 165 | padding: 1px 0 1px 0 !important; 166 | } 167 | .syntaxhighlighter.ie .toolbar { 168 | line-height: 8px !important; 169 | } 170 | .syntaxhighlighter.ie .toolbar a { 171 | padding-top: 0px !important; 172 | } 173 | .syntaxhighlighter.printing .line.alt1 .content, 174 | .syntaxhighlighter.printing .line.alt2 .content, 175 | .syntaxhighlighter.printing .line.highlighted .number, 176 | .syntaxhighlighter.printing .line.highlighted.alt1 .content, 177 | .syntaxhighlighter.printing .line.highlighted.alt2 .content { 178 | background: none !important; 179 | } 180 | .syntaxhighlighter.printing .line .number { 181 | color: #bbbbbb !important; 182 | } 183 | .syntaxhighlighter.printing .line .content { 184 | color: black !important; 185 | } 186 | .syntaxhighlighter.printing .toolbar { 187 | display: none !important; 188 | } 189 | .syntaxhighlighter.printing a { 190 | text-decoration: none !important; 191 | } 192 | .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { 193 | color: black !important; 194 | } 195 | .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { 196 | color: #008200 !important; 197 | } 198 | .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { 199 | color: blue !important; 200 | } 201 | .syntaxhighlighter.printing .keyword { 202 | color: #006699 !important; 203 | font-weight: bold !important; 204 | } 205 | .syntaxhighlighter.printing .preprocessor { 206 | color: gray !important; 207 | } 208 | .syntaxhighlighter.printing .variable { 209 | color: #aa7700 !important; 210 | } 211 | .syntaxhighlighter.printing .value { 212 | color: #009900 !important; 213 | } 214 | .syntaxhighlighter.printing .functions { 215 | color: #ff1493 !important; 216 | } 217 | .syntaxhighlighter.printing .constants { 218 | color: #0066cc !important; 219 | } 220 | .syntaxhighlighter.printing .script { 221 | font-weight: bold !important; 222 | } 223 | .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { 224 | color: gray !important; 225 | } 226 | .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { 227 | color: #ff1493 !important; 228 | } 229 | .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { 230 | color: red !important; 231 | } 232 | .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { 233 | color: black !important; 234 | } 235 | 236 | .syntaxhighlighter { 237 | background-color: white !important; 238 | } 239 | .syntaxhighlighter .line.alt1 { 240 | background-color: white !important; 241 | } 242 | .syntaxhighlighter .line.alt2 { 243 | background-color: white !important; 244 | } 245 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 246 | background-color: #e0e0e0 !important; 247 | } 248 | .syntaxhighlighter .line.highlighted.number { 249 | color: black !important; 250 | } 251 | .syntaxhighlighter table caption { 252 | color: black !important; 253 | } 254 | .syntaxhighlighter .gutter { 255 | color: #afafaf !important; 256 | } 257 | .syntaxhighlighter .gutter .line { 258 | border-right: 3px solid #6ce26c !important; 259 | } 260 | .syntaxhighlighter .gutter .line.highlighted { 261 | background-color: #6ce26c !important; 262 | color: white !important; 263 | } 264 | .syntaxhighlighter.printing .line .content { 265 | border: none !important; 266 | } 267 | .syntaxhighlighter.collapsed { 268 | overflow: visible !important; 269 | } 270 | .syntaxhighlighter.collapsed .toolbar { 271 | color: blue !important; 272 | background: white !important; 273 | border: 1px solid #6ce26c !important; 274 | } 275 | .syntaxhighlighter.collapsed .toolbar a { 276 | color: blue !important; 277 | } 278 | .syntaxhighlighter.collapsed .toolbar a:hover { 279 | color: red !important; 280 | } 281 | .syntaxhighlighter .toolbar { 282 | color: white !important; 283 | background: #6ce26c !important; 284 | border: none !important; 285 | } 286 | .syntaxhighlighter .toolbar a { 287 | color: white !important; 288 | } 289 | .syntaxhighlighter .toolbar a:hover { 290 | color: black !important; 291 | } 292 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 293 | color: black !important; 294 | } 295 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 296 | color: #008200 !important; 297 | } 298 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 299 | color: blue !important; 300 | } 301 | .syntaxhighlighter .keyword { 302 | color: #006699 !important; 303 | } 304 | .syntaxhighlighter .preprocessor { 305 | color: gray !important; 306 | } 307 | .syntaxhighlighter .variable { 308 | color: #aa7700 !important; 309 | } 310 | .syntaxhighlighter .value { 311 | color: #009900 !important; 312 | } 313 | .syntaxhighlighter .functions { 314 | color: #ff1493 !important; 315 | } 316 | .syntaxhighlighter .constants { 317 | color: #0066cc !important; 318 | } 319 | .syntaxhighlighter .script { 320 | font-weight: bold !important; 321 | color: #006699 !important; 322 | background-color: none !important; 323 | } 324 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 325 | color: gray !important; 326 | } 327 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 328 | color: #ff1493 !important; 329 | } 330 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 331 | color: red !important; 332 | } 333 | 334 | .syntaxhighlighter .keyword { 335 | font-weight: bold !important; 336 | } 337 | 338 | 339 | 340 | /*$Default*/ 341 | /*************************************************/ 342 | .sm {font-size:11px} 343 | .hide {display:none} 344 | 345 | #menu{width:200px;margin:5px;padding:10px} 346 | legend{font-size:20px;font-weight:700;text-transform:uppercase} 347 | fieldset{margin:20px 0;padding:10px} 348 | 349 | #body{width:970px;margin:0 auto;} 350 | #body h1 {color:#fff; text-align:center} 351 | 352 | body{font-family:Verdana, Sans-Serif;font-size:14px;line-height:22px;margin:0} 353 | p{font-size:16px} 354 | .details{width:300px;border:1px dotted #CCC} 355 | .code{font-family:Courier New;font-size:12px} 356 | 357 | table{border:1px solid #000;border-collapse:collapse;width:100%;} 358 | table td,table th{border:1px solid #000;text-align:left;padding:5px} 359 | 360 | 361 | tr.alt td{background-color:#2C4359; color:#fff} 362 | tr.over td{background-color:#FF5E99; color:#fff} 363 | 364 | .sample { 365 | width: 750px 366 | } 367 | .sample p{float:right;width:300px;position:relative;font-size:12px;top:-10px} 368 | .sample p span{color:Red} 369 | #nav{height:100px;width:100%;border-bottom:5px solid #fff;font-size:14px;font-family:Georgia} 370 | #nav h1{font-size:14px;margin:0;padding:0} 371 | 372 | #notice{text-align:center; font-size:12px;height:50px;width:690px;margin: 10px auto 0px auto} 373 | #notice #n_body{width:600px;margin:0 auto} 374 | #notice #n_body a{font-size:11px} 375 | #notice #n_body li{display:inline;list-style-type:none;margin:0} 376 | 377 | #info{width:16px;height:16px;display:inline} 378 | a span{display:inline;float:left} 379 | table th,#nav a{font-weight:700} 380 | #nav .navContent,#notice #n_body #close{float:right} 381 | code {background-color:#CCCCCC; padding:2px;} 382 | td ul {margin:0;} 383 | 384 | #append-parent{ 385 | border:1px solid red; padding:20px; width:30%; margin:5%; 386 | } 387 | #append-here{ 388 | width:100px; height:100px; border:1px dotted #ccc; 389 | font-size:11px; padding:10px; text-align: center; position: relative; 390 | } 391 | 392 | .ui-tabs p a { 393 | font-size: 16px; 394 | } 395 | .ui-tabs a { 396 | font-size: 12px; 397 | } 398 | 399 | .ui-icon-newwin { 400 | display: inline-block; 401 | } 402 | 403 | hr { 404 | margin: 10px 0; 405 | } 406 | 407 | .wrapper { 408 | font-size: 11px; 409 | border: 1px solid green; 410 | border-radius: 50px; 411 | width: 40%; 412 | padding: 10px; 413 | } 414 | 415 | #contentEditable { 416 | border: 1px solid #000; 417 | width: 50%; 418 | padding: 5px; 419 | } --------------------------------------------------------------------------------