PageSourceSearch

https://www.eastsussexww1.org.uk/wp-content/plugins/escc/js/escc.js?ver=1.0.0

js eastsussexww1.org.uk collected 2026-10-02 12:44:12 UTC 6,214 bytes, 232 lines download raw bytes

1var ESCC = {
2	/**
3     * Map display
4     */
5    map:{
6    	/**
7    	 * The map icons to use
8    	 *
9    	 * @var object
10    	 */
11    	_icons:{
12    		event: '/wp-content/plugins/escc/img/map-pin-event.png',
13    		poi: '/wp-content/plugins/escc/img/map-pin-poi.png'
14    	},
15		_infoWindow: null,
16    	/**
17    	 * The Google map
18    	 *
19    	 * @var google.maps.Map
20    	 */
21    	_map: null,
22		/**
23		 * Add a key to the map
24		 *
25		 * @return void
26		 */
27		_addKey: function(){
28			$('#map-canvas').after('<div id="map-key"><h2>Key</h2><ul><li class="event">Events</li><li class="poi">Point of Interest</li></ul></div>');
29		},
30    	/**
31    	 * Add a data feed (JSON) for markers
32    	 *
33    	 * @param string url
34    	 *
35    	 * @return void
36    	 */
37		addC24Data: function(url){
38    		$.ajax({
39    			dataType: 'json',
40    			success: function(data){
41
42    				// alert(JSON.stringify(data.result));
43    				$.each(data.result.items, function(i, v){
44    					try{
45	    					var infowindow = new google.maps.InfoWindow({
46	    						content: '<h1 style="font-size:1.25em;font-weight:bold;margin:0 0 5px 0;padding:0;"><a href="'+v.link+'" target="_blank">'+v.name+'</a></h1>'+
47	    								 '<p>'+v.shortDescription+'</p>'+
48	    								 '<ul>'+
49	    								 	'<li><strong>Type:</strong> '+v.type.join(' / ')+'</li>'+
50	    								 	'<li><strong>Date:</strong> '+v.instance[0].startDate+' - '+v.instance[0].endDate+'</li>'+
51	    								 '</ul>'
52	    					});
53	    					var marker = new google.maps.Marker({
54	    						title: v.name,
55	    						position: new google.maps.LatLng(v.latitude, v.longitude),
56	    						icon: ESCC.map._icons.event,
57	    						map: ESCC.map._map
58	    					});
59	    					google.maps.event.addListener(marker, 'click', function() {
60								try{ESCC.map._infoWindow.close();}catch(e){}
61	    						infowindow.open(ESCC.map._map, marker);
62								ESCC.map._infoWindow = infowindow;
63	    					});
64
65
66    					}catch(e){
67    						try{console.log(v)}catch(e){}
68    					}
69					});
70    			},
71    			url: url
72    		})
73    	},
74    	/**
75    	 * Add a data feed (JSON) for markers
76    	 *
77    	 * @param string url
78    	 *
79    	 * @return void
80    	 */
81		addCBData: function(url){
82    		$.ajax({
83    			dataType: 'json',
84    			success: function(data){
85    				$.each(data.features, function(i, v){
86    					if(v.geometry.type=='Point')
87    					{
88    						var title = v.properties.title;
89    						var description = v.properties.description;
90    						var link = 'http://www.thekeep.info'+v.properties.link;
91	    					var infowindow = new google.maps.InfoWindow({
92	    						content: '<h1 style="font-size:1.25em;font-weight:bold;margin:0 0 5px 0;padding:0;"><a href="'+link+'" target="_blank">'+title+'</a></h1><p>'+description+'</p>'
93	    					});
94	    					var marker = new google.maps.Marker({
95	    						title: v.name,
96	    						position: new google.maps.LatLng(v.geometry.coordinates[1], v.geometry.coordinates[0]),
97	    						icon: ESCC.map._icons.poi,
98	    						map: ESCC.map._map
99	    					});
100	    					google.maps.event.addListener(marker, 'click', function() {
101								try{ESCC.map._infoWindow.close();}catch(e){}
102	    						infowindow.open(ESCC.map._map, marker);
103								ESCC.map._infoWindow = infowindow;
104	    					});
105    					}
106					});
107    			},
108    			url: url
109    		})
110    	},
111    	/**
112    	 * Set up the map, if the canvas is found
113    	 *
114    	 * @return void
115    	 */
116    	setup: function()
117		{
118    		if($('#map-canvas'))
119    		{
120    			//$('#map-canvas').css('height',$(window).height()-$('#map-canvas').offset().top);
121    			var mapOptions = {
122					zoom:10,
123			    	center: new google.maps.LatLng(50.949, 0.323),
124			    	styles:[{
125			    		"stylers": [{
126			    			"saturation": -100
127			    		}]
128			    	},{
129			    	    "featureType": "road.highway",
130			    	    "stylers": [
131			    	      { "visibility": "off" }
132			    	    ]
133			    	}]
134			    };
135			    this._map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
136			    this._addKey();
137    		}
138		}
139    },
140    /**
141     * Your stories sliders
142     */
143    yourstories:{
144    	/**
145    	 * Handler for the next/prev buttons
146    	 *
147    	 * @param Event e
148    	 *
149    	 * @return void
150    	 */
151    	onDateClick: function(e){
152
153    		var $e = $(e.currentTarget);
154    		var p = e.currentTarget.parentNode;
155    		var tds = $e.parent().find('.scroller td');
156    		var curr, $nextEl;
157
158    		if(undefined==p._current)
159    		{
160    			// Default to the first element
161    			p._current = 1;
162    		}
163
164    		// Find the next/prev elements
165    		curr = p._current + ($e.index()==0 ? -3 : 3);
166    		if(curr > tds.length - 2)
167    		{
168    			curr = tds.length - 2;
169    			try{console.log('last');console.log(curr)}catch(e){}
170    			if(tds.length % 3 == 0)
171    			{
172    				return;
173    			}
174    		}
175    		else if(curr < 1)
176    		{
177    			curr = 1;
178    			try{console.log('first')}catch(e){}
179    		}
180
181    		// No movement required
182    		if(curr==p._current)
183    		{
184    			return;
185    		}
186
187    		// Find the nth element to scroll to
188    		$nextEl = $e.parent().find('.scroller td:nth-child('+curr+')');
189    		if($nextEl.length)
190    		{
191    			// All the other browsers
192    			var offset = 20;
193    			if($.browser.msie && $.browser.version == '8.0')
194    			{
195    				// Perhaps not needed - Leigh's other fixes today appear to have resolved the issue.
196    			}
197    			var scrollTo = $nextEl.offset().left - $nextEl.parent().offset().left - offset;
198    			if (!e.offsetX){
199    				// FireFox Fix - behaves differently for fixed elements
200    				scrollTo+= offset;
201    			}
202
203
204
205    			// Animate the scroll
206	    		$e.parent().find('.scroller').animate({scrollLeft:scrollTo}, 500, 'swing');
207	    		p._current = curr;
208    		}
209    	},
210    	/**
211    	 * Set up the click events
212    	 *
213    	 * @return void
214    	 */
215    	setup: function(){
216    		if($('body').hasClass('page_your-stories'))
217    		{
218    			// Create the side links for display purposes
219    			$('.escc-section').each(function(i,v){
220    				var $v = $(v);
221    				$v.find('.left,.right').each(function(i,v){
222    					var $v = $(v);
223    					$v.click(ESCC.yourstories.onDateClick);
224    				});
225    			});
226    		}
227    	}
228    }
229}
230$(function(){
231	ESCC.yourstories.setup();
232});

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.