PageSourceSearch

https://www.discoveringbritain.org/assets/templates/db2/1.83/js/gb-map.js

js discoveringbritain.org collected 2026-10-02 07:15:21 UTC 3,031 bytes, 136 lines download raw bytes

1
2	
3	Core.prototype.pageFuncs = function() {
4		
5		var me = this;
6		me.gbMap();
7
8	
9	}
10
11	Core.prototype.gbMap = function() {
12
13		w = $(window).width();
14		h = $(window).height();
15		$('.uk-map').css({'height':h+'px'})
16
17
18
19		$(window).resize(function() {
20			
21			h = $(window).height();
22			$('.uk-map').css({'height':h+'px'})
23			if ($(window).height() > 700) {
24				$('.filters').css({'height':h+'px'})
25			} else {
26				$('.filters').removeAttr('style');
27			}
28
29			var centerpos = $('[class=center_pos]').offset().left;
30
31		})
32
33		var groups = $('#UK g');
34		var popuptitle = $('.popup h4');
35		var popuplist = $('.popup ul');
36 
37
38		var centerpos = $('[class=center_pos]').offset().left;
39
40
41		groups.on("touchstart", function (e) {
42			 var t = $(this);
43
44			 if ($(this).data('clicked_once')) {
45		        // element has been tapped (hovered), reset 'clicked_once' data flag and return true
46		        t.data('clicked_once', false);
47				id = t.attr('id');
48				window.location.href = config[id].url;
49		        return true;
50		    } else {
51		        // element has not been tapped (hovered) yet, set 'clicked_once' data flag to true
52		        e.preventDefault();
53		        t.trigger("mouseenter"); //optional: trigger the hover state, as preventDefault(); breaks this.
54		        t.data('clicked_once', true);
55		        mapHover(e,this)
56		    }
57			
58		})
59
60
61		groups.hover(function(e) {
62			mapHover(e,this)
63		})
64
65		groups.on('mousedown',function(e) {
66			var t = $(this);
67			id = t.attr('id');
68			window.location.href = config[id].url;
69		})
70
71		// groups.mouseenter(function(e) {
72		// 	mapHover(e,this)
73		// })
74
75
76		function mapHover(e,t) {
77
78			var t = $(t);
79			var o = t.offset();
80
81			id = t.attr('id');
82			if (id) {
83				popuptitle.text(config[id].nicename);
84				html = "<li>"+config[id].walks+"</li>";
85				html += "<li>"+config[id].trails+"</li>";
86				html += "<li>"+config[id].viewpoints+"</li>";
87				html += "<li>"+config[id].aerial+"</li>";
88				popuplist.html(html);
89			}
90
91			if ($('[class=marker]',t).length) {
92
93				var box = $('[class=marker]',t).offset();
94
95				var left = box.left + 10;
96				var centerpos = $('[class=center_pos]').offset().left;
97
98				if (left < centerpos && matchMedia('only screen and (min-width: 768px)').matches) {
99					$('.popup').addClass('switch');
100					$('.popup').css({'margin-left':'-'+$('.popup').outerWidth()+'px'})
101				} else {
102					$('.popup').removeClass('switch')
103					$('.popup').css({'margin-left':0})
104				}
105
106				var top = box.top - ($('.popup').height() /2) ;
107
108				//if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) top = top + (h * 0.12);
109				
110				$('#UK *').attr('fill','#797e01');
111				$('*',t).attr('fill','#f54c00');
112				
113				if (w > 768) {
114					$('.popup').css({'left':left+'px','top':top+'px','opacity':'1'})
115				} else {
116					$('.popup').css({'opacity':'1'})
117				}
118
119			}
120
121		}
122
123
124		// $('#UK g').click(function() {
125		// 	var t = $(this);
126		// 	id = t.attr('id');
127		// 	window.location.href = config[id].url;
128		// })
129
130		$('#UK').mouseout(function() {
131			$('*',this).attr('fill','#797e01');
132		})
133
134
135	}
136

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.