PageSourceSearch

https://klmitjobs.nl/wp-content/themes/klmitjobs/js/jquery.transform.js

js klmitjobs.nl collected 2026-10-08 11:58:16 UTC 5,098 bytes, 166 lines download raw bytes

1/*
2 * jquery.transform.js
3 * 
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 * 
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 * 
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 * 
22 */
23(function($) {
24	$.transform = function(o) {
25		var t = this;
26		t.c = {
27			el:o.el,
28			cache:o.cache == null?false:o.cache,
29			async:o.async == null?true:o.async,
30			xslstr:o.xslstr == null?false:o.xslstr,
31			xmlstr:o.xmlstr == null?false:o.xmlstr,
32			xslParams:o.xslParams == null?false:o.xslParams,
33			error:o.error ? o.error : throwTransformError,
34			success:o.success == null?false:o.success,
35			complete:o.complete == null?false:o.complete
36		};
37		
38		var checkReady = function(o) {
39			if(o.c.xslstr && o.c.xmlstr) {
40				var tel = $("<div>");
41				if($.browser.msie) {
42					var xml_X = ["MSXML4.DOMDocument", "MSXML3.DOMDocument", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XmlDom"];
43					var objXML = false;
44					var objXSL = false;
45					for(var i = 0; i<xml_X.length;i++) {
46						try {
47							objXML = new ActiveXObject(xml_X[i]);
48							objXSL = new ActiveXObject(xml_X[i]);
49							i = xml_X.length;
50						} catch(ex) {
51							objXML = false;
52							objXSL = false;
53						}
54					}
55					
56					objXSL.loadXML(o.c.xslstr);
57					objXML.loadXML(o.c.xmlstr);
58					
59					var addparams = function(op, xObj) {
60						for(var p in op) 
61		                {
62		                    var strParam = "//xsl:param[@name='" + p + "']";
63		                    
64		                    try {
65		                        if(isNaN(parseInt(op[p])) && op[p].indexOf("'") < 0) {
66									op[p] = op[p].indexOf("\"") >= 0 ? op[p] = op[p].replace(/"/, "'") : op[p] = "'" + op[p] + "'";
67		                        };
68		                        
69			    				var xslParam = xObj.selectSingleNode(strParam);	    				
70				    			xslParam.setAttribute("select",op[p]);
71				    		    
72				            } catch(ex) {
73				                //param failed
74				            }
75		                }
76					};
77					
78					addparams(o.c.xslParams,objXSL);
79					
80					tel.html(objXML.transformNode(objXSL));
81					
82				} else {
83					var parser = new DOMParser();
84					var processor = new XSLTProcessor();
85					
86					var objXSL = parser.parseFromString(o.c.xslstr,"text/xml");
87					var objXML = parser.parseFromString(o.c.xmlstr,"text/xml");
88					
89					var addparams = function(op) {
90						for(var p in op) {
91							processor.setParameter(null, p, op[p]);
92						}
93					};
94					
95					addparams(o.c.xslParams);
96					
97					processor.importStylesheet(objXSL);
98					var resultDoc = processor.transformToFragment(objXML, document);
99					tel.empty().append(resultDoc);
100				};
101				
102				if(o.c.el) {
103					$(o.c.el).html(tel.html());
104				};
105				
106				if(o.c.success) {
107					if(typeof(o.c.success) == "function"){
108						o.c.success(tel.html(),o.c.xslstr,o.c.xmlstr,o.c);
109					} 
110					else if(fn != null){var funcName = new Function(o.c.success);funcName(tel.html(),o.c.xslstr,o.c.xmlstr,o.c);}
111				}
112				
113				if(o.c.complete) {
114					if(typeof(o.c.complete) == "function"){
115						o.c.complete(tel.html(),o.c.xslstr,o.c.xmlstr,o.c);
116					} 
117					else if(fn != null){var funcName = new Function(o.c.complete);funcName(tel.html(),o.c.xslstr,o.c.xmlstr,o.c);}
118				}
119				return tel.html();
120			}
121		};
122		
123		var throwTransformError = function(request,status,error) { };
124		
125		if(!t.c.xslstr) {
126			$.ajax({
127				cache:false,
128				url:o.xsl,
129				dataType:"xml",
130				async:t.c.async,
131				error:t.c.error,
132				complete:function(r) {
133					t.c.xslstr = r.responseText;
134					if(t.c.async) {checkReady(t); }
135				}
136			});
137		};
138		
139		if(!t.c.xmlstr) {
140			$.ajax({
141				cache:false,
142				url:o.xml,
143				dataType:"xml",
144				async:t.c.async,
145				error:t.c.error,
146				complete:function(r) {
147					t.c.xmlstr = r.responseText;
148					if(t.c.async) {checkReady(t);}
149				}
150			});
151		};
152		
153		if(!t.c.async || t.c.xmlstr && t.c.xslstr) {
154			return checkReady(t);
155		}
156	};
157	
158	$.fn.transform = function(o) {
159		return this.each(function() {
160			o = o ? o : {};
161			o.el = this;
162			new $.transform(o);
163		});
164	};
165})(jQuery);
166

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.