PageSourceSearch

https://michaelshomes.com/wps/rest/63330/l/recip/tmpl2.js?4.5.22.522

js michaelshomes.com collected 2026-10-04 04:05:40 UTC 15,608 bytes, 488 lines download raw bytes

1if( !window._mrp_tmpl2_inited ) {
2
3	var __LazyLoad=function(a){function h(b,c){var e,d=a.createElement(b);for(e in c)c.hasOwnProperty(e)&&d.setAttribute(e,c[e]);return d}function i(a){var c,g,b=d[a];b&&(c=b.callback,g=b.urls,g.shift(),e=0,g.length||(c&&c.call(b.context,b.obj),d[a]=null,f[a].length&&k(a)))}function j(){var c=navigator.userAgent;b={async:a.createElement("script").async===!0},(b.webkit=/AppleWebKit\//.test(c))||(b.ie=/MSIE|Trident/.test(c))||(b.opera=/Opera/.test(c))||(b.gecko=/Gecko\//.test(c))||(b.unknown=!0)}function k(e,g,k,n,o){var s,t,u,v,w,x,p=function(){i(e)},q="css"===e,r=[];if(b||j(),g)if(g="string"==typeof g?[g]:g.concat(),q||b.async||b.gecko||b.opera)f[e].push({urls:g,callback:k,obj:n,context:o});else for(s=0,t=g.length;s<t;++s)f[e].push({urls:[g[s]],callback:s===t-1?k:null,obj:n,context:o});if(!d[e]&&(v=d[e]=f[e].shift())){for(c||(c=a.head||a.getElementsByTagName("head")[0]),w=v.urls.concat(),s=0,t=w.length;s<t;++s)x=w[s],q?u=b.gecko?h("style"):h("link",{href:x,rel:"stylesheet"}):(u=h("script",{src:x}),u.async=!1),u.className="lazyload",u.setAttribute("charset","utf-8"),b.ie&&!q&&"onreadystatechange"in u&&!("draggable"in u)?u.onreadystatechange=function(){/loaded|complete/.test(u.readyState)&&(u.onreadystatechange=null,p())}:q&&(b.gecko||b.webkit)?b.webkit?(v.urls[s]=u.href,m()):(u.innerHTML='@import "'+x+'";',l(u)):u.onload=u.onerror=p,r.push(u);for(s=0,t=r.length;s<t;++s)c.appendChild(r[s])}}function l(a){var b;try{b=!!a.sheet.cssRules}catch(c){return e+=1,void(e<200?setTimeout(function(){l(a)},50):b&&i("css"))}i("css")}function m(){var b,a=d.css;if(a){for(b=g.length;--b>=0;)if(g[b].href===a.urls[0]){i("css");break}e+=1,a&&(e<200?setTimeout(m,50):i("css"))}}var b,c,d={},e=0,f={css:[],js:[]},g=a.styleSheets;return{css:function(a,b,c,d){k("css",a,b,c,d)},js:function(a,b,c,d){k("js",a,b,c,d)}}}(this.document);
4
5	window.mrp_jquery_ready = function( callback ) {
6		if( window.mrp_jquery_loaded ) {
7			callback();
8		}
9		else {
10			document.addEventListener( "mrp_jquery_ready", callback );
11		}
12	};
13	
14	window.mrp_vendor_ready = function( callback ) {
15		if( window.mrp_vendor_loaded ) {
16			callback();
17		}
18		else {
19			document.addEventListener( "mrp_vendor_ready", callback );
20		}
21	};
22	
23	window.mrp_v2_ready = function( callback ) {
24	
25		if( document.mrp_v2_loaded ) {
26			callback();
27		}
28		else {
29			document.addEventListener( "mrp_v2_ready", callback );
30		}
31	};
32	
33	window.mrp_v2_map_ready = function( callback ) {
34	
35		if( document.mrp_v2_map_loaded ) {
36			callback();
37		}
38		else {
39			document.addEventListener( "mrp_v2_map_ready", callback );
40		}
41	};
42
43	window._mrp_tmpl2_inited = true;
44	
45			window.mrp_vowLoggedIn = false;
46
47	function checkjQuery() {
48	
49		function checkVersion( ver ) {
50
51			// if jQuery is present by version is not, we are past 3.x
52			if( window.jQuery && !ver ) {
53				return true;
54			}
55
56			if( !ver ) {
57				return false;
58			}
59			var tks = ver.split( "." );
60			if( tks.length == 0 ) {
61				return false;
62			}
63			// noinspection RedundantIfStatementJS
64			if( parseInt( tks[0] ) > 1 || (parseInt( tks[0] ) == 1 && parseInt( tks[1] ) >= 10 )) {
65				return true;
66			}
67			else {
68				return false;
69			}
70		}
71
72		if( typeof jQuery == "undefined" ) {
73			return false;
74		}
75		
76		if( window.$ ) {
77			// we shouldn't really be doing this, but some sites load multiple jQuery instances
78			// and if these are different it wreaks havoc on our code; the 'onload' event ends up
79			// firing on a different instance of jquery; one we don't have access to.
80			window.jQuery = window.$;
81		}
82		return true;
83	}
84	
85	function hasWebGL () {
86		if( isIE() ) {
87			return false;
88		}
89		try {
90			var canvas = document.createElement("canvas");
91			var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
92			return gl && gl instanceof WebGLRenderingContext;
93		}
94		catch( e ) {
95			return false;
96		}
97	}
98	
99	function jQueryPromise( callback ) {
100	
101		function fireReady() {
102			
103			window.mrp_jquery_loaded = true;
104			
105			try {
106				callback();
107			}
108			catch( e ) {
109				console.error( e );
110			}
111			
112			try {
113				if(document.createEventObject) {
114					document.fireEvent("mrp_jquery_ready");
115				} 
116				else {
117					var evt = new Event("mrp_jquery_ready");
118					//var evt = document.createEvent("HTMLEvents");
119					//evt.initEvent("mrp_jquery_ready", false, true);
120					document.dispatchEvent(evt);
121				}
122			}
123			catch( e ) {
124				console.error( e );
125			}
126		}
127		
128		if( !checkjQuery()  ) {
129			__LazyLoad.js( '//res.myrealpage.com/wps/js/jquery-1.10.2.min.js', function() {
130				fireReady();
131			});
132		}
133		else {
134			fireReady();
135		}
136	}
137	
138	function isIE() {
139
140		var ua = window.navigator.userAgent;
141		var msie = ua.indexOf("MSIE ");
142
143		// noinspection RedundantIfStatementJS,RegExpRedundantEscape
144		if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))  // If Internet Explorer, return version number
145		{
146        	return true;
147		}
148		else  // If another browser, return 0
149		{
150        	return false;
151		}
152	}
153	
154	if( /loaded|complete/.test(document.readyState) ) {
155		// too late
156		console.log( "cannot use mrp scripts in a loaded document" );
157	}
158	else {
159		var stage1_scripts = [];
160		var stage2_scripts = [];
161		var stage3_scripts = [];
162		var stage4_scripts = [];
163		
164		var stage5_scripts = [];
165		
166		/*
167		if( !checkjQuery()  ) {
168			stage1_scripts.push( "//res.myrealpage.com/wps/js/jquery-1.10.2.min.js" );
169		}
170		*/
171		
172		
173		const prevGlobalHistoryPushState = window.history.pushState;
174		window.history.pushState = function( state, title, url ) {
175			// this exists in order to account for a discrepancy in mrp
176			// <base> tag and visible pathname. when invoked page('#!foo')
177			// the browser's default impl will do /[base-tag-url]#!foo
178			// but we need it go actually use /pathname#!foo
179		
180			// if condition below ensures there is a base tag and URL looks like MRP's
181			if( url
182				&& url.indexOf( "#!" ) === 0
183				&& document.querySelector( "base" ) != null 
184				&& window.location.pathname 
185				&& window.location.pathname.indexOf( ".html" ) != -1 ) {
186				url = window.location.pathname + url;
187			}
188			prevGlobalHistoryPushState.call( window.history, state, title, url );
189		};
190				
191		var initNode = document.createElement( "script" );
192		initNode.className = "mrp-init";
193		initNode.type = "text/plain";
194		initNode.setAttribute( "RES_URL", "//res.myrealpage.com/wps/" );
195		initNode.setAttribute( "ROOT_URL", "//res.myrealpage.com/wps/" );
196		initNode.setAttribute( "ACCOUNT_ID", "63330" );
197		initNode.setAttribute( "CONTEXT", "recip" );
198		initNode.setAttribute( "ROOT_PATH", "/wps" );
199		initNode.setAttribute( "country", "CA" );
200		initNode.setAttribute( "map", "PRINCE-EDWARD-ISLAND" );
201		initNode.setAttribute( "region", "DDF" );
202		initNode.setAttribute( "LISTINGS_SERVER", "listings.myrealpage.com" );
203
204		initNode.setAttribute( "VOWP_IS", "300");
205		initNode.setAttribute( "VOWP_RT", "3");
206		initNode.setAttribute( "VOWP_RI", "300");
207		initNode.setAttribute( "VOWP_FF", "true");
208		initNode.setAttribute( "VOWP_DV", "");
209		initNode.setAttribute( "VOW_SIGNUP_TYPE", "");
210
211		document.body.appendChild( initNode );
212				
213		
214		stage1_scripts.push( "//res.myrealpage.com/wps/js/ng/v2/listing-vendor-combined.js?v=8" );
215
216		stage3_scripts.push( "//res.myrealpage.com/wps/js/ng/waf-token.js" );
217		stage3_scripts.push( "//res.myrealpage.com/wps/js/ng/v2/listings/listing-common.js?v=115" );
218		
219		stage4_scripts.push( "//res.myrealpage.com/wps/js/ng/v2/listings/listing-vow.js?v=98" );
220		stage4_scripts.push( "//res.myrealpage.com/wps/js/ng/v2/listings/listing-results.js?v=36" );
221		stage4_scripts.push( "//res.myrealpage.com/wps/js/ng/v2/listings/listing-details.js?v=67" );
222		
223		
224		function buildIdxURLs() {
225		
226			var idxURL = "//res.myrealpage.com/wps/js/ng/v2/listings/listing-idx-form.js?v=18";
227			
228			var isGoogleMap = ( window.location.hash && window.location.hash.indexOf( "googlemap=true" ) != -1 ) || window.googlemap_idx || !hasWebGL();
229			
230			var jsURLs = [];
231			var cssURLs = [];
232			
233			if( !isGoogleMap ) {
234				jsURLs.push( "https://api.tiles.mapbox.com/mapbox-gl-js/v0.54.1/mapbox-gl.js" );
235				jsURLs.push( "//res.myrealpage.com/wps/js/ng/v2/listings/listing-idx-form-v2.js?v100" );
236			}
237			else {
238				jsURLs.push( "//res.myrealpage.com/wps/js/ng/v2/listings/listing-idx-form.js?v=17" );
239			}
240			
241			return { jsURLs: jsURLs, cssURLs: cssURLs };
242		}
243		
244		
245		if( !window.mrp_no_idx_scripts ) {
246		
247			var urls = buildIdxURLs();
248			
249			for( var i=0; i < urls.jsURLs.length; ++i ) {
250				stage4_scripts.push( urls.jsURLs[i] );
251			}
252			
253			if( urls.cssURLs.length > 0 ) {
254				__LazyLoad.css( urls.cssURLs );
255			}
256		}	
257		
258		
259		// https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css
260		// brands font loaded from mrp-bootstrap.less
261		// __LazyLoad.css( "//res.myrealpage.com/wps//fontawesome-free-5.4.1-web/css/all.css" );
262			
263		jQueryPromise( function() {
264			__LazyLoad.js( stage1_scripts, function() {
265			
266				// mrp_vendor_ready
267				window.mrp_vendor_loaded = true;
268				try {
269					if(document.createEventObject) {
270						document.fireEvent("mrp_vendor_ready");
271					} 
272					else {
273						var evt = new Event("mrp_vendor_ready");
274						document.dispatchEvent(evt);
275					}
276				}
277				catch( e ) {
278					console.error( e );
279				}
280				
281				__LazyLoad.js( stage3_scripts, function() {
282					__LazyLoad.js( stage4_scripts, function() {
283					
284						_gmrp.accountId = 63330;
285						
286						_gmrp.loadBaseCSS = function( callback ) {
287	
288							var styles = [];
289							styles.push( "//res.myrealpage.com/wps/less/v2/mrp-bootstrap.less?v1.2" );
290							styles.push( "//res.myrealpage.com/wps/less/v2/listings/common.less?v4.1" );
291							styles.push( "https://fonts.googleapis.com/css?family=Open+Sans:400italic,700,400" );
292							
293							_gmrp.MRP_IDX.loadStylesheets( styles, callback );
294						};
295						
296						function loadPostMapbox( callback ) {
297						
298							function _done() {
299								if(document.createEventObject) {
300									document.fireEvent("mrp_v2_map_ready");
301								} 
302								else {
303									var evt = new Event("mrp_v2_map_ready");
304									//var evt = document.createEvent("HTMLEvents");
305									//evt.initEvent("mrp_v2_ready", false, true);
306									document.dispatchEvent(evt);
307								}
308								document.mrp_v2_map_loaded = true;
309								
310								if( callback ) {
311									callback();
312								}
313							}
314						
315							if( window.mapboxgl ) {
316								window.mapboxgl.accessToken = "pk.eyJ1IjoibXlyZWFscGFnZSIsImEiOiJjbXB5a2NqdnYwN3EyMnRuM3BjaDk4azZ5In0.jMuTPO0WO6IO5ce3ydzwkw";
317window._gmrp_geoFilter = function(item,index,items) {
318
319	var overrides = {
320		"Greenwood, Nova Scotia, Canada" : { // Greenwood, Nova Scotia
321			center: [-64.934722, 44.971944],
322			// sw, ne trigge 'mrp.debug.map.bounds' on document to dump
323			bbox : [-64.98192887852869,44.95217585223236,-64.87687211583203,44.990491318266294]
324		},
325		"neighborhood.7899298212961420" : {
326			// replacing "Scarborough City Centre, M1P 4P5, Etobicoke, Ontario, Canada"
327			// with more appropriate "Scarborough, Toronto"
328			text: "Scarborough, Toronto",
329			place_name: "Scarborough, Toronto",
330			center: [-79.3128433, 43.7589442 ],
331			bbox: [ -79.36823308452246, 43.707401993492596, -79.09305989726784, 43.81241425080441 ]
332		}
333	};
334
335
336	if( item.place_name ) {
337		var override = overrides[item.place_name];
338		if( override ) {
339			item.center = override.center;
340			item.bbox = override.bbox;
341		}
342		override = overrides[item.id];
343		if( override ) {
344			item.place_name = override.place_name;
345			item.text = override.text || item.text;
346			item.center = override.center;
347			item.bbox = override.bbox;
348		}
349	}
350	return true;
351}
352								
353								_done();
354							}
355						}
356						
357						loadPostMapbox();
358						
359						_gmrp.loadMap = function( callback ) {
360						
361							callback = callback || function() {};
362
363							if( document.mrp_v2_map_loaded && _gmrp.IDX && _gmrp.IDX.Map ) {
364								return callback();
365							}
366							var urls = buildIdxURLs();
367							
368							if( urls.cssURLs.length > 0 ) {
369								__LazyLoad.css( urls.cssURLs );
370							}
371				
372							if( urls.jsURLs.length > 0 ) {
373								__LazyLoad.js( urls.jsURLs, function() {
374									loadPostMapbox( callback );
375								});
376							}
377						}
378						
379						_gmrp.settings.isWP = false;
380						_gmrp.settings.hasRecip = true;
381						_gmrp.settings.hasVow = true;
382						_gmrp.settings.hasOmnibox = true;
383						_gmrp.settings.defaultSoldOnOff = "";
384						_gmrp.settings.defaultSoldRange = "";
385						_gmrp.settings.vowName = "";
386						// FULL INIT
387
388						if(document.createEventObject) {
389							document.fireEvent("mrp_v2_ready");
390						} 
391						else {
392							var evt = new Event("mrp_v2_ready");
393							//var evt = document.createEvent("HTMLEvents");
394							//evt.initEvent("mrp_v2_ready", false, true);
395							document.dispatchEvent(evt);
396						}
397						
398						//console.log( "ALL LOADED" );
399						//document.dispatchEvent( new Event( "mrp_v2_ready" ) );
400						document.mrp_v2_loaded = true;
401						
402
403						try {
404							// mrpt
405							var __s = document.querySelector( "[data-rel='mrpt']" );
406    						if( !__s ) {
407								var mrpt = document.createElement("script");
408								mrpt.setAttribute("src", "/wps/js/_mrpt.js?1");
409								mrpt.setAttribute("async", "");
410								mrpt.setAttribute("data-rel", "mrpt");
411								mrpt.setAttribute("data-a", "63330");
412								document.body.appendChild(mrpt);
413							}
414							else {
415								console.log( "_mrpt skipped; already exists" );
416							}
417						}
418						catch( e ) {
419						}
420						
421						if( window.location.href.indexOf( "showsignup" ) != -1 || window.location.hash == "#showsignup" ) {
422							let params = _gmrp.Utils.getURLParams();
423							_gmrp.loadBaseCSS( function() {
424								var accountId = _gmrp.accountId;
425								if( !accountId ) {
426									return;
427								}
428								var form = new _gmrp.VowSignupForm( {
429									accountId : accountId,
430									prefill: params
431								} ).open();
432								
433								console.log( "Params", params );
434							});
435						}
436						
437						else if( window.location.href.indexOf( "showlogin" ) != -1 || window.location.hash == "#showlogin" ) {
438							if( document.querySelector('html').classList.contains('vow-ok')) {
439								return;
440							}
441							let params = _gmrp.Utils.getURLParams();
442							_gmrp.loadBaseCSS( function() {
443								var accountId = _gmrp.accountId;
444								if( !accountId ) {
445									return;
446								}
447								var form = new _gmrp.VowLoginForm( {
448									accountId : accountId,
449									prefill: params
450								} ).open();
451								
452								console.log( "Params", params );
453							});
454						}
455									
456						else if( window.location.href && window.location.href.indexOf( 'offmarket' ) != -1 ) {
457							
458							if( _gmrp.$( ".mrp-popup" ).length > 0 ) {
459							 	// bill; not to conflict with default IDX one at times
460							 	return;
461							}
462							if( _gmrp.$( ".sp-listing-details" ).length > 0 ) {
463								// bill: not to conflict with single property listing details block
464								return;
465							}
466							
467							
468							var styles = [];
469							styles.push( "//res.myrealpage.com/wps/less/v2/mrp-bootstrap.less?v1.2" );
470							styles.push( "//res.myrealpage.com/wps/less/v2/listings/common.less?v4.1" );
471							styles.push( "https://fonts.googleapis.com/css?family=Open+Sans:400italic,700,400" );
472							
473							_gmrp.MRP_IDX.loadStylesheets( styles, function() {
474								
475								new _gmrp.MessageBox( "Sorry, the listing you are looking for is no longer available", {
476										hasCloseButton : true,
477										customClass: "offmarket-popup",
478									}).show();
479							});
480						}
481			
482					}); // __LazyLoad.js( stage4_scripts
483				}); // __LazyLoad.js( stage3_scripts
484			});	// __LazyLoad.js( stage1_scripts
485		}); // jQueryPromise
486	}
487}
488

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.