PageSourceSearch

https://www.mulgrave-derry.ca/js/jquery.jqEasyCharCounter.js?r=1782398423

js mulgrave-derry.ca collected 2026-10-02 21:59:20 UTC 4,906 bytes, 167 lines download raw bytes

1
2/* 
3 ************************************************************************************
4 * Tout le pluggin a été restructuré par Steeve pour utiliser la function upload
5 ************************************************************************************
6 *
7 * jQuery jqEasyCharCounter plugin
8 * Examples and documentation at: http://www.jqeasy.com/
9 * Version: 1.0 (05/07/2010)
10 * No license. Use it however you want. Just keep this notice included.
11 * Requires: jQuery v1.3+
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 
23(function( $ ){
24	
25  var tableauOptions=new Array();
26  var langue = cfg.langueAbr;
27  var libelle = 'Caractères';
28  if (langue != null && langue != "")
29  {
30	  switch (langue)
31	  {
32		case "en":
33			libelle = 'Characters';
34		break;
35		
36		case "es":
37			libelle = 'ESCaractères';
38		break;
39	  }
40  }
41
42  var methods = {
43    init : function( givenOptions ) {
44			return this.each(function() {
45						var $this = $(this),
46							options = $.extend({
47								maxChars: 100,
48								msgAppendMethod: 'insertAfter'
49							}, givenOptions);
50				
51						if(options.maxChars <= 0) return;
52						
53						// create counter element
54						var jqEasyCounterMsg = $("<div class=\"jqEasyCounterMsg\">&nbsp;</div>");
55
56						// append counter element to DOM
57						jqEasyCounterMsg[options.msgAppendMethod]($this);
58						
59						tableauOptions[$this.attr("id")] = options;
60						
61						// bind events to this element
62						$this
63							.bind('keydown keyup keypress', doCount)
64							.bind('focus paste', function(){setTimeout(doCount, 10);});
65										
66						doCount(); // Ajout de Steeve
67						
68						jqEasyCounterMsg.stop().fadeTo( 'fast', 1);
69						
70						function doCount(){
71							var val = $this.val(),
72								length = val.length
73							
74							if(length >= tableauOptions[$this.attr("id")].maxChars) {
75								val = val.substring(0, tableauOptions[$this.attr("id")].maxChars); 				
76							};
77							
78							if(length > tableauOptions[$this.attr("id")].maxChars){
79								// keep scroll bar position
80								var originalScrollTopPosition = $this.scrollTop();
81								$this.val(val.substring(0, tableauOptions[$this.attr("id")].maxChars));
82								$this.scrollTop(originalScrollTopPosition);
83							};
84				
85							jqEasyCounterMsg.html(libelle + ' : ' + $this.val().length + "/" + tableauOptions[$this.attr("id")].maxChars);
86						};
87					});	
88	},
89		
90    update : function( content ) {
91		var $this = $(this);
92		$.extend(tableauOptions[$this.attr("id")], content);
93		$(this).next('.jqEasyCounterMsg').html(libelle + ' : ' + $this.val().length + "/" + tableauOptions[$this.attr("id")].maxChars);
94	}
95  };
96
97  $.fn.jqEasyCounter = function( method ) {
98    
99    // Method calling logic
100    if ( methods[method] ) {
101      return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
102    } else if ( typeof method === 'object' || ! method ) {
103      return methods.init.apply( this, arguments );
104    } else {
105      $.error( 'Method ' +  method + ' does not exist on jQuery.jqEasyCounter' );
106    }    
107  
108  };
109
110})( jQuery ); 
111 
112/* 
113 
114(function($) {
115
116$.fn.extend({
117    jqEasyCounter: function(givenOptions) {
118        return this.each(function() {
119            var $this = $(this),
120                options = $.extend({
121                    maxChars: 100,
122					msgAppendMethod: 'insertAfter'
123                }, givenOptions);
124	
125			if(options.maxChars <= 0) return;
126			
127			// create counter element
128			var jqEasyCounterMsg = $("<div class=\"jqEasyCounterMsg\">&nbsp;</div>");
129
130			// append counter element to DOM
131			jqEasyCounterMsg[options.msgAppendMethod]($this);
132			
133			// bind events to this element
134			$this
135				.bind('keydown keyup keypress', doCount)
136				.bind('focus paste', function(){setTimeout(doCount, 10);});
137							
138			doCount(); // Ajout de Steeve
139			
140			jqEasyCounterMsg.stop().fadeTo( 'fast', 1);
141			
142			function doCount(){
143				var val = $this.val(),
144					length = val.length
145				
146				if(length >= options.maxChars) {
147					val = val.substring(0, options.maxChars); 				
148				};
149				
150				if(length > options.maxChars){
151					// keep scroll bar position
152					var originalScrollTopPosition = $this.scrollTop();
153					$this.val(val.substring(0, options.maxChars));
154					$this.scrollTop(originalScrollTopPosition);
155				};
156								
157				jqEasyCounterMsg.html('Caractères : ' + $this.val().length + "/" + options.maxChars);
158			};
159        });
160    },
161	jqEasyCounterUpdate: function(givenOptions) {
162        alert(1);
163    }	
164});
165
166})(jQuery);
167*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.