PageSourceSearch

https://tea-tron.com/teatron/js/libs/jquery.text-overflow.js

js tea-tron.com collected 2026-10-02 06:53:03 UTC 2,232 bytes, 60 lines download raw bytes

1/*
2 * MIT LICENSE
3 * Copyright (c) 2009-2011 Devon Govett.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
6 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 
8 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in all copies or substantial portions 
11 * of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
14 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
16 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 */
18
19(function($) {
20	$.fn.ellipsis = function(enableUpdating){
21		var s = document.documentElement.style;
22		if (!('textOverflow' in s || 'OTextOverflow' in s)) {
23			return this.each(function(){
24				var el = $(this);
25				if(el.css("overflow") == "hidden"){
26					var originalText = el.html();
27					var w = el.width();
28					
29					var t = $(this.cloneNode(true)).hide().css({
30                        'position': 'absolute',
31                        'width': 'auto',
32                        'overflow': 'visible',
33                        'max-width': 'inherit'
34                    });
35					el.after(t);
36					
37					var text = originalText;
38					while(text.length > 0 && t.width() > el.width()){
39						text = text.substr(0, text.length - 1);
40						t.html(text + "...");
41					}
42					el.html(t.html());
43					
44					t.remove();
45					
46					if(enableUpdating == true){
47						var oldW = el.width();
48						setInterval(function(){
49							if(el.width() != oldW){
50								oldW = el.width();
51								el.html(originalText);
52								el.ellipsis();
53							}
54						}, 200);
55					}
56				}
57			});
58		} else return this;
59	};
60})(jQuery);

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.