PageSourceSearch

https://fastfinders.co.uk/includes/javascript_global.js

js fastfinders.co.uk collected 2026-10-04 22:00:30 UTC 3,083 bytes, 113 lines download raw bytes

1function htmlspecialchars(str) {
2    if(typeof(str) == "string") {
3        str = str.replace(/&/g, "&")
4        .replace(/"/g, """)
5        .replace(/'/g, "'")
6        .replace(/</g, "&lt;")
7        .replace(/>/g, "&gt;");
8    }
9    return str;
10}
11
12function newWindow(mypage,myname,w,h,features) {
13    if(screen.width) {
14          var winl = (screen.width-w)/2;
15          var wint = (screen.height-h)/2;
16      } else {
17          winl = 0;wint =0;
18      }
19
20      if (winl < 0) winl = 0;
21      if (wint < 0) wint = 0;
22
23      var settings = 'height=' + h + ',';
24      settings += 'width=' + w + ',';
25      settings += 'top=' + wint + ',';
26      settings += 'left=' + winl + ',';
27      settings += features;
28      settings += ' scrollbars=yes ';
29
30      win = window.open(mypage,myname,settings);
31
32      win.window.focus();
33}
34
35var timer_handles = [];
36function set_timer(id,code,time) {
37    if(id in timer_handles) {
38        clearTimeout(timer_handles[id]);
39    }
40    timer_handles[id] = setTimeout(code,time)
41}
42
43$(document).ready(function(){
44    $.ajaxSetup({
45        error: function(x,e){
46            if(x.status==0) {
47                // Do nothing, this results in bad popups if changing pages fast
48            } else if(x.status==404) {
49                alert('Requested URL not found.');
50            } else if(x.status==401) {
51                window.location = x.responseText;
52            } else if(x.status==302) {
53                window.location = x.responseText;
54            } else if(x.status==500) {
55                if(x.responseText == 'Bad Token') {
56                    location.reload(true);
57                } else {
58                    alert('Internal Server Error\n'+x.responseText);
59                }
60            } else if(e=='parsererror') {
61                alert('Error.\nParsing request failed.');
62            } else if(e=='timeout') {
63                alert('Request Time out.');
64            } else {
65                alert('Unknown Error.\n'+x.responseText);
66            }
67        }
68    });
69});
70var _started_lookups = 0;
71function nearby_locations() {
72
73	$.ajax({
74		url : $(location).attr('href'),
75		type : 'GET',
76		data : { 'nearby' : 1 },
77		dataType : 'json',
78		success : function(r) {
79			if(r.length) {
80				_started_lookups = r.length;
81				for(var i=0; i<r.length; i++) {
82					get_nearby_location(r[i]);
83				}
84			}
85		}
86	});
87}
88function get_nearby_location(loc) {
89	$.ajax({
90		url : $(location).attr('href'),
91		type : 'GET',
92		data : { 'listings_count' : loc.id },
93		success : function(r) {
94			_started_lookups--;
95			must_hide_search_anim();
96			if(r > 0) {
97				$('#nearby_results').append('<a href="'+loc.url+'">'+loc.location+' ('+r+')</a> &nbsp; ~'+loc.distance+' miles<br /><br />');
98			}
99		},
100		error : function() {
101			_started_lookups--;
102			must_hide_search_anim();
103		}
104	});
105}
106function must_hide_search_anim() {
107	if(_started_lookups<=0) {
108		$('#nearby_search_status').hide();
109		var app = '';
110		if($('#nearby_results a').length) app = '<br /><br /><strong>Please check in nearby locations blow:</strong><br />';
111		$('#listing_no_results').append(app);
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.