PageSourceSearch

https://www.lioncountrysafari.com/javascripts/jquery-extensions.js

js lioncountrysafari.com collected 2026-10-02 03:00:33 UTC 3,211 bytes, 113 lines download raw bytes

1/****************************************/
2/*--------------------------------------*/
3/*      jQuery Element Extensions       */
4/*--------------------------------------*/
5/****************************************/
6jQuery.fn.extend({
7	/* Check for selector match */
8	exists: function() {
9		if(this.length > 0) return true;
10  		else return false;
11	},
12	
13	/* Toggle element with fade animation */
14    fadeToggle: function() {
15		return this.animate({opacity: 'toggle'});
16    },
17    
18    /* 	Common method for retrieving current value 
19    	of form element */
20    getValue: function() {
21        switch(this.attr("type")) {
22            case "checkbox":
23                return this.is(":checked");
24                break;
25            case "radio":
26                return this.is(":selected");
27                break;
28            default:
29                return this.val();
30                break;
31        }
32		return this.val();
33    },
34    
35    /* 	Common method for resetting current value 
36    	of form element */
37    resetValue: function() {
38        switch(this.attr("type")) {
39            case "checkbox":
40                this.prop("checked", false);
41                break;
42            case "radio":
43                this.prop("selected", false);
44                break;
45            default:
46                this.val('');
47                break;
48        }
49    },
50    
51    /* 	Common method for setting value of form 
52    	element */
53    setValue: function(val) {
54        switch(this.attr("type")) {
55            case "checkbox":
56                this.prop("checked", val);
57                break;
58            case "radio":
59                this.prop("selected", val);
60                break;
61            default:
62                this.val(val);
63                break;
64        }
65    }
66});
67/****************************************/
68/*--------------------------------------*/
69/*      jQuery Object Extensions        */
70/*--------------------------------------*/
71/****************************************/
72jQuery.extend({
73	/* 	Simple method for capitalizing the first letter 
74		in a string */
75	capitalize_first: function(str) {
76		var s = jQuery.trim(str).toLowerCase();
77	  	var first_letter = s.substr(0,1);
78	  	return s.replace(first_letter,first_letter.toUpperCase());
79	},
80	
81	/* Check to see if block of text contains a string */
82	contains_str: function(text, str_to_find) {
83		if(typeof(text) == "string") {
84	    	result = text.indexOf(str_to_find);
85	    	if(result == -1) return false;
86	    	else return true;
87	  	} else {
88	    	return false;
89	  	}
90	},
91    
92    /* Check to see if block of text contains a string */
93	starts_with: function(text, str_to_find) {
94		if(typeof(text) == "string") {
95	    	result = text.indexOf(str_to_find);
96	    	if(result == 0) return true;
97	    	else return false;
98	  	} else {
99	    	return false;
100	  	}
101	},
102    
103    /* Trim extra whitespace from string */
104	trim: function (str) {
105	    if (str == null) return '';
106		return str.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g, '');
107	},
108	
109	/* Strip HTML tags from string */
110	strip_tags: function(str) {
111	  return str.replace(/(<.+?>)/g, '');
112	}
113});

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.