PageSourceSearch

https://www.ens.it/wp-content/plugins/interactive-world-maps/includes/js/shortcode.js?ver=2.5

js ens.it collected 2026-09-25 18:44:25 UTC 24,168 bytes, 936 lines download raw bytes

1var iwmMapObj = [];
2
3if (typeof google !== "undefined") {
4
5	google.charts.load('42', {
6		packages: ['geochart'],
7		mapsApiKey: iwmparam[0].apikey
8	});
9	google.charts.setOnLoadCallback(iwm_init);
10
11}
12
13
14function iwm_init() {
15
16	for (var key in iwmparam) {
17
18		var mapcontainer = document.getElementById('unique_iwm_' + iwmparam[key].unique_id);
19		if (!mapcontainer) { delete iwmparam[key]; continue; }
20
21		//zoom controls init
22		var controls = iwmparam[key]['controls'];
23		if (controls) {
24			iwm_zoom(iwmparam[key]['unique_id'], iwmparam[key]['id'], iwmparam[key]['controls_position'], iwmparam[key]['overlay']);
25		}
26	}
27
28	iwmDrawVisualization();
29}
30
31iwmObj = {};
32iwmObj.iwmoptions = [];
33iwmObj.iwmgeocharts = [];
34iwmObj.iwmdata = [];
35
36function iwmDrawVisualization(skipNotVisible) {
37
38
39	//We're loading version 42 of the API, latest version had bugs for text labels
40
41	if (typeof google.visualization !== "undefined") {
42
43		var data = {};
44		var values = {};
45		var listener_actions = {};
46		var listener_custom = {};
47		var identifier = {};
48		var mapcolours = {};
49		var index;
50
51		for (var key in iwmparam) {
52
53			var mapid = iwmparam[key].id;
54
55			if (skipNotVisible && iwmMapObj[mapid] && !iwmMapObj[mapid].div.is(':visible')) {
56				continue;
57			}
58
59			var keydiv = document.getElementById("map_canvas_" + mapid);
60			if (iwmparam[key].region && keydiv) {
61
62				var usehtml = parseInt(iwmparam[key].usehtml, 10);
63
64				/* Disable HTML Tooltips by default on iOS */
65				var isMobile = window.matchMedia("only screen and (max-width: 780px)");
66				if (isMobile.matches && iwmparam[key].htmlios === '0' && iwmparam[key].tooltip === 'focus') {
67					console.log('disabling html tooltips on iOS devices');
68					if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
69						usehtml = 0;
70					}
71				}
72
73				var iwmid = parseInt(iwmparam[key].id, 10);
74				var uniqueid = parseInt(iwmparam[key].unique_id, 10);
75				var bgcolor = iwmparam[key].bgcolor;
76				var stroke = parseInt(iwmparam[key].stroke, 10);
77				var bordercolor = iwmparam[key].bordercolor;
78				var incolor = iwmparam[key].incolor;
79				var actcolor = iwmparam[key].actcolor;
80				var width = parseInt(iwmparam[key].width, 10);
81				var height = parseInt(iwmparam[key].height, 10);
82				var ratio = (iwmparam[key].aspratio === '1');
83				var interactive = (iwmparam[key].interactive === 'true');
84				var toolt = iwmparam[key].tooltip;
85				var region = iwmparam[key].region;
86				var resolution = iwmparam[key].resolution;
87				var markersize = parseInt(iwmparam[key].markersize, 10);
88				var displaymode = iwmparam[key].displaymode;
89				var placestxt = iwmparam[key].placestxt;
90				var projection = iwmparam[key].projection;
91
92				var divid = "map_canvas_" + iwmid;
93				var uniquedivid = 'unique_iwm_' + uniqueid;
94				var divselector = '#' + uniquedivid + ' #' + divid;
95
96				var magglass = iwmparam[key].magglass;
97				var magglasszfactor = parseInt(iwmparam[key].magglasszfactor, 10);
98
99				var widthselector = iwmparam[key].widthselector;
100
101				placestxt = placestxt.replace(/^\s+|\s+$/g, '');
102
103				var action = iwmparam[key].action;
104				var customaction = iwmparam[key].custom_action;
105
106				identifier[mapid] = iwmid;
107				listener_actions[mapid] = action;
108				listener_custom[mapid] = customaction;
109
110				var places = placestxt.split(";");
111
112				data[mapid] = new google.visualization.DataTable();
113
114				if (displaymode === "markers02" || displaymode === "text02" || displaymode === "customicon") {
115
116
117
118					data[mapid].addColumn('number', 'Lat');
119					data[mapid].addColumn('number', 'Long');
120				}
121
122
123				data[mapid].addColumn('string', 'Country'); // Implicit domain label col.
124				data[mapid].addColumn('number', 'Value'); // Implicit series 1 data col.
125				data[mapid].addColumn({
126					type: 'string',
127					role: 'tooltip',
128					p: {
129						html: true
130					}
131				}); //
132
133				var colorsmap = [];
134				//var colorsindex = [];
135				var colorcount = 0;
136				var colorsmapecho = "";
137
138				values[mapid] = {};
139				dataindex = {};
140				mapcolours[mapid] = {};
141
142				//places.length-1 to eliminate empty value at the end
143				for (var i = 0; i < places.length - 1; i++) {
144					var entry = places[i].split(",");
145
146					var ttitle = entry[1].replace(/&#59/g, ";");
147					ttitle = ttitle.replace(/&#44/g, ",");
148					var ttooltip = entry[2].replace(/&#59/g, ";");
149					ttooltip = ttooltip.replace(/&#44/g, ",");
150
151					if (usehtml === 0) {
152						ttitle = jQuery("<div>").html(ttitle).text();
153						ttooltip = jQuery("<div>").html(ttooltip).text();
154					}
155
156					var iwmcode = entry[0];
157					iwmcode = iwmcode.replace(/^\s+|\s+$/g, '');
158
159					//we create an index, to use after with the setSelection functions
160					dataindex[iwmcode] = i;
161
162
163					//If data !== markers02
164					if (displaymode !== "markers02" && displaymode !== "text02" && displaymode !== "customicon") {
165
166
167						data[mapid].addRows([
168							[{
169								v: iwmcode,
170								f: ttitle
171							}, i, ttooltip]
172						]);
173						index = iwmcode;
174
175					} else {
176
177						var trim = entry[0].replace(/^\s+|\s+$/g, "");
178						var latlon = trim.split(" ");
179						var lat = parseFloat(latlon[0]);
180						var lon = parseFloat(latlon[1]);
181
182
183						//data[mapid].addRows([[lat,lon,ttitle,i,ttooltip]]);
184						data[mapid].addRows([
185							[lat, lon, ttitle, i, ttooltip]
186						]);
187
188						index = lat;
189
190
191						//finally set dislay mode of markers02 to proper value
192						//displaymode = "markers";
193
194					}
195
196
197					var colori = entry[4];
198
199					values[mapid][index] = entry[3].replace(/&#59/g, ";");
200					values[mapid][index] = values[mapid][index].replace(/&#44/g, ",");
201
202					colorsmapecho = colorsmapecho + "'" + colori + "',";
203
204					colorsmap.push(colori);
205
206					//to colour the markers with an index colour and later replace it
207					/*
208					colorsmap.push(iwmconvert2color(colorcount));
209					mapcolours[mapid][colorcount] = colori;
210
211					colorcount++;
212					*/
213
214				}
215
216				//add markers color json to map
217				//jQuery("#map_canvas_" + iwmid).attr('data-markers-colors',JSON.stringify(mapcolours[mapid]));
218
219				defmaxvalue = 0;
220				if ((places.length - 2) > 0) {
221					defmaxvalue = places.length - 2;
222				}
223
224				if (displaymode === "markers02") {
225					displaymode = "markers";
226				}
227				if (displaymode === "customicon") {
228					displaymode = "markers";
229				}
230				if (displaymode === "text02") {
231					displaymode = "text";
232				}
233
234				var htmltooltip = false;
235				if (usehtml === 1) {
236					htmltooltip = true;
237				}
238
239
240				if (widthselector) {
241
242					var wselector = jQuery(widthselector);
243					if (wselector) {
244						if (wselector.width() > 0) {
245
246							width = wselector.width();
247							height = '';
248
249						}
250
251					}
252
253				}
254
255				//in case there was a zoom event, we check the new sizes
256				if (jQuery("#map_canvas_" + iwmid).attr('data-iwm-zwidth')) {
257
258					width = jQuery("#map_canvas_" + iwmid).attr('data-iwm-zwidth');
259					height = jQuery("#map_canvas_" + iwmid).attr('data-iwm-zheight');
260
261				}
262
263				var domain = '';
264				if (region === 'IN' || region === 'world' || region === 'MM') {
265					domain = 'IN';
266				}
267
268
269				var options = {
270					projection: projection,
271					backgroundColor: {
272						fill: bgcolor,
273						stroke: bordercolor,
274						strokeWidth: stroke
275					},
276					colorAxis: {
277						minValue: 0,
278						maxValue: defmaxvalue,
279						colors: colorsmap
280					},
281					legend: 'none',
282					datalessRegionColor: incolor,
283					displayMode: displaymode,
284					enableRegionInteractivity: interactive,
285					resolution: resolution,
286					sizeAxis: {
287						minValue: 1,
288						maxValue: 1,
289						minSize: markersize,
290						maxSize: markersize
291					},
292					region: region,
293					keepAspectRatio: ratio,
294					width: width,
295					height: height,
296					magnifyingGlass: {
297						enable: magglass,
298						zoomFactor: magglasszfactor
299					},
300					tooltip: {
301						trigger: toolt,
302						isHtml: htmltooltip
303					},
304					domain: domain
305				};
306
307
308
309				var selector = document.querySelector(divselector);
310
311				iwmObj.iwmgeocharts[mapid] = new google.visualization.GeoChart(selector);
312
313				if (action !== "none") {
314
315					google.visualization.events.addListener(iwmObj.iwmgeocharts[mapid], 'select', (function (x) {
316
317						return function () {
318
319                            console.log('map click action');
320
321							var selection = iwmObj.iwmgeocharts[x].getSelection();
322
323							if (selection.length === 1) {
324								var selectedRow = selection[0].row;
325								var selectedRegion = data[x].getValue(selectedRow, 0);
326
327
328								if (values[x][selectedRegion] !== "") {
329									iwm_run_action(selectedRow, selectedRegion, values[x][selectedRegion], identifier[x], listener_actions[x], listener_custom[x]);
330									// iwm_clearSelection(x);
331								}
332							} else {
333                                iwm_clearSelection(x);
334                            }
335						};
336					})(mapid));
337
338				}
339
340				//set global variables
341				iwmObj.iwmdata[mapid] = data[mapid];
342				iwmObj.iwmoptions[mapid] = options;
343
344				//test to order the entries
345				//iwmObj.iwmdata[mapid].sort([{column: 3}]);
346
347				iwmObj.iwmgeocharts[mapid].draw(iwmObj.iwmdata[mapid], options);
348
349				//Create a new object for this map
350
351				if (!iwmMapObj[mapid]) {
352
353					iwmMapObj[mapid] = {
354						div: jQuery('#' + divid),
355						data: dataindex
356					};
357
358				}
359
360
361
362				iwmMapObj[mapid].lastWidth = iwmMapObj[mapid].div.parent().width();
363
364				google.visualization.events.addListener(iwmObj.iwmgeocharts[mapid], 'ready', function (mapid) {
365
366					jQuery('.iwm_map_canvas svg').fadeIn(300);
367
368					//to replace markers with custom icon
369					jQuery('.iwm_map_canvas.iwm_custom_icon').each(function () {
370
371						var markersize = jQuery(this).find('.i_world_map').attr('data-marker-size');
372						var imageurl = jQuery(this).find('.i_world_map').attr('data-icon-url');
373						var imageiconposition = jQuery(this).find('.i_world_map').attr('data-icon-position');
374						var width = parseInt(markersize);
375
376						//default center position
377						var intwidth = -(parseInt(width, 10) / 2);
378						var intheight = -(parseInt(width, 10) / 2);
379						//top position
380						if (imageiconposition === 'top') {
381							intheight = -(parseInt(width, 10));
382						}
383
384						var transform = 'translate(' + intwidth + ',' + intheight + ')';
385
386						var imageicon = document.createElementNS('http://www.w3.org/2000/svg', 'image');
387						imageicon.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageurl);
388						imageicon.setAttribute('transform', transform);
389						imageicon.setAttribute('height', width);
390						imageicon.setAttribute('width', width);
391						imageicon.setAttribute('preserve', 'xMaxYMax meet');
392						imageicon.setAttribute('data-color', '');
393
394						var thismap = jQuery(this).find('svg');
395						thismap.find('circle').each(function () {
396
397							var x = jQuery(this).attr('cx');
398							var y = jQuery(this).attr('cy');
399							var color = jQuery(this).attr('fill');
400
401							jQuery(this).replaceWith(jQuery(imageicon).clone().attr('x', x).attr('y', y).attr('data-color', color));
402
403						});
404
405					});
406
407					if (typeof iwm_callback === 'function') {
408						iwm_callback();
409					}
410
411
412				});
413
414			}
415		}
416
417	} else {
418		console.log('API file not loaded yet');
419	}
420
421}
422
423
424function iwm_run_action(row, selected, value, id, action, customaction) {
425
426	var newid;
427	var dropdown;
428
429    console.log('map clicked');
430
431	if (action === 'i_map_action_open_url') {
432		document.location = value;
433	}
434
435	if (action === 'i_map_action_alert') {
436
437		alert(value);
438	}
439
440	if (action === 'i_map_action_open_url_new') {
441
442		window.open(value);
443	}
444
445	if (action === 'i_map_action_content_below' || action === 'i_map_action_content_above' || action === 'i_map_action_content_right_1_3' || action === 'i_map_action_content_right_1_4' || action === 'i_map_action_content_right_1_2') {
446
447		newid = selected.toString();
448
449
450		newid = newid.replace('-', '');
451		newid = newid.replace('.', '');
452		newid = newid.replace(' ', '');
453		jQuery('#imap' + id + 'message > div').fadeOut('fast').promise().done(function () {
454			jQuery('#map_' + id + '_message_' + newid).fadeIn('fast');
455		});
456
457		console.log(selected);
458
459		//we check if there's a dropdown so we set selection to be the same as region clicked
460		dropdown = document.getElementById('imap-dropdown-' + id);
461		if (dropdown) {
462			document.getElementById('imap' + id + '-' + newid).selected = true;
463		}
464
465	}
466
467	if (action === 'i_map_action_content_below_scroll' || action === 'i_map_action_content_above_scroll') {
468
469		newid = selected.toString();
470		newid = newid.replace('-', '');
471		newid = newid.replace('.', '');
472		newid = newid.replace(' ', '');
473		jQuery('#imap' + id + 'message > div').fadeOut('fast').promise().done(function () {
474			jQuery('#map_' + id + '_message_' + newid).fadeIn('fast');
475		});
476
477		jQuery("html, body").animate({
478			scrollTop: jQuery("#imap" + id + "message").offset().top - 50
479		}, "slow");
480
481		//we check if there's a dropdown so we set selection to be the same as region clicked
482		dropdown = document.getElementById('imap-dropdown-' + id);
483		if (dropdown) {
484			document.getElementById('imap' + id + '-' + newid).selected = true;
485		}
486
487	}
488
489	if (action === 'i_map_action_colorbox_content') {
490
491		console.log('clicked lightbox');
492
493		newid = selected.toString();
494		newid = newid.replace('-', '');
495		newid = newid.replace('.', '');
496		newid = newid.replace(' ', '');
497
498		console.log( '#map_' + id + '_message_' + newid );
499
500		jQuery.colorbox({
501			//html: value,
502			inline: true,
503			href: '#map_' + id + '_message_' + newid,
504			maxWidth: '80%',
505			maxHeight: '80%',
506			//width:'80%',
507			onComplete: function () {
508				jQuery.colorbox.resize();
509			},
510			onClosed: function () {
511				//iwm_clearSelection(id);
512			}
513		});
514
515	}
516
517
518	if (action === 'i_map_action_colorbox_iframe') {
519
520		var winh = parseInt(jQuery(window).height(), 10) - 100;
521
522		jQuery.colorbox({
523			open: true,
524			href: value,
525			iframe: true,
526			width: "80%",
527			height: "80%",
528			maxHeight: winh,
529			onClosed: function () {
530				iwm_clearSelection(id);
531			}
532		});
533
534	}
535
536	if (action === 'i_map_action_colorbox_image') {
537
538		jQuery.colorbox({
539			open: true,
540			href: value,
541			photo: true,
542			maxWidth: '80%',
543			maxHeight: '80%',
544			onClosed: function () {
545				iwm_clearSelection(id);
546			}
547		});
548
549	}
550
551	if (action === 'i_map_action_colorbox_inline') {
552
553		var inline = jQuery(value);
554		jQuery.colorbox({
555			inline: true,
556			href: inline,
557			//width: '95%',
558			//height: '95%',
559			maxWidth: '95%',
560			maxHeight: '95%',
561			onClosed: function () {
562				iwm_clearSelection(id);
563			}
564		});
565
566	}
567
568	if (action === 'i_map_action_custom') {
569
570		var name = "iwm_custom_action_" + id;
571		var selectedRegion = selected;
572		window[name](value, selected);
573	}
574}
575
576
577// Functions to set selection and remove selection.
578// Can be used by externel elements to trigger the selection
579
580
581function iwm_setSelection(code, map) {
582
583	map = map || false;
584
585	if (map) {
586
587		//console.log(iwmMapObj[map]);
588
589		var index = iwmMapObj[map].data[code];
590		iwmObj.iwmgeocharts[map].setSelection([{
591			row: index,
592			column: null
593		}]);
594
595	}
596
597
598
599}
600
601function iwm_clearSelection(map) {
602	map = map || false;
603	if (map) {
604
605		iwmObj.iwmgeocharts[map].setSelection(null);
606
607        // if there are messages, reset
608        var message = jQuery('#imap' + map + 'message');
609        if(message){
610            message.find('> div').each(function(){
611                jQuery(this).fadeOut('fast');
612            });
613        }
614	}
615}
616
617function iwm_select(code, map) {
618
619	map = map || '0';
620	var index = iwmMapObj[map].data[code];
621	iwmObj.iwmgeocharts[map].setSelection([{
622		row: index,
623		column: null
624	}]);
625	google.visualization.events.trigger(iwmObj.iwmgeocharts[map], 'select', {});
626
627}
628
629
630function iwm_zoom(unique_id, id, position, overlay) {
631
632	overlay = overlay || false;
633	var thisMap = jQuery('#unique_iwm_' + unique_id + ' #map_canvas_' + id);
634	var container;
635	//init panzoom script
636	if (overlay && overlay !== id) {
637
638		jQuery('.iwm_map_overlay #unique_iwm_' + unique_id + ', .iwm_map_overlay #unique_iwm_' + unique_id + ' + div').wrapAll('<div style="overflow:hidden;" id="iwm_pan_wrapper_' + id + '" />').wrapAll('<div id="iwm_pan_container_' + id + '" />');
639		container = jQuery('#iwm_pan_container_' + id);
640
641		container.wrap('<div id="iwm_control_' + id + '" />');
642		jQuery('#iwm_control_' + id).prepend('<div data-step="0" id="iwm-control
642s-' + id + '" class="iwm-controls iwm-controls-' + position + '"></div>');
643		//container.parent().parent().prepend('<div id="iwm-controls-'+id+'" class="iwm-controls iwm-controls-'+position+'"></div>');
644
645		//thisMap = container;
646
647		container.panzoom({
648			disableZoom: false,
649			contain: 'invert',
650			cursor: "default",
651		});
652
653		container.mousedown(function () {
654			jQuery(this).css('cursor', 'move');
655		});
656		container.mouseup(function () {
657			jQuery(this).css('cursor', 'pointer');
658		});
659
660
661
662	}
663
664	if (!overlay) {
665
666		thisMap.parent().prepend('<div data-step="0" id="iwm-controls-' + id + '" class="iwm-controls iwm-controls-' + position + '"></div>');
667
668		thisMap.panzoom({
669			disableZoom: true,
670			contain: 'invert',
671			cursor: "default",
672		});
673
674
675		thisMap.mousedown(function () {
676			jQuery(this).css('cursor', 'move');
677		});
678		thisMap.mouseup(function () {
679			jQuery(this).css('cursor', 'pointer');
680		});
681
682	}
683
684	if (id !== overlay) {
685
686		jQuery('#iwm-controls-' + id).append(function () {
687
688			return jQuery('<div class="iwm-controls-zoom-in">+</div>').click(function () {
689
690				var controlparent = jQuery(this).parent();
691				var cur_click = parseInt(controlparent.attr('data-step'), 10);
692				var map = thisMap;
693				var newleft;
694				var newtop;
695				var cleft;
696				var ctop;
697				var matrix;
698				var transform;
699
700				if (parseInt(map.width(), 10) <= 6000) {
701
702					controlparent.attr('data-step', cur_click + 1);
703
704					var step = (parseInt(map.width(), 10) * 0.3);
705
706					var newh = (parseInt(map.height()) / parseInt(map.width(), 10)) * (parseInt(map.width(), 10) + step);
707					var neww = parseInt(map.width(), 10) + step;
708
709					//console.log(neww);
710
711					//we also calculate margins, so the zoom is central
712					var extrah = parseInt(newh, 10) - parseInt(map.height(), 10);
713					var extraw = parseInt(neww, 10) - parseInt(map.width(), 10);
714
715
716					if (!overlay) {
717
718						//we get the transform values and not the margins, so it works with the pan script
719						transform = map.css('transform');
720						matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
721
722						if (matrix[5] === null) {
723							matrix[5] = 0;
724							matrix[4] = 0;
725						}
726
727						ctop = parseInt(matrix[5], 10);
728						cleft = parseInt(matrix[4], 10);
729
730						newtop = ctop - (extrah / 2);
731						newleft = cleft - (extraw / 2);
732
733						//apply data
734						map.height(newh).width(neww);
735						map.attr('data-iwm-zwidth', neww).attr('data-iwm-zheight', newh);
736
737						map.css('transform', 'matrix(1, 0, 0, 1,' + newleft + ',' + newtop + ')');
738
739						iwmObj.iwmoptions[id].width = neww;
740						iwmObj.iwmoptions[id].height = newh;
741						iwmObj.iwmgeocharts[id].draw(iwmObj.iwmdata[id], iwmObj.iwmoptions[id]);
742
743						thisMap.panzoom('resetDimensions');
744
745					}
746
747
748					//to apply zoom to overlay map container instead
749					if (overlay) {
750
751						transform = container.css('transform');
752						matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
753
754						if (matrix[5] === null) {
755							matrix[5] = 0;
756							matrix[4] = 0;
757						}
758
759						ctop = parseInt(matrix[5], 10);
760						cleft = parseInt(matrix[4], 10);
761
762						newtop = ctop - (extrah / 2);
763						newleft = cleft - (extraw / 2);
764
765						container.height(newh).width(neww);
766						container.css('transform', 'matrix(1, 0, 0, 1,' + newleft + ',' + newtop + ')');
767
768						iwmObj.iwmoptions[id].width = neww;
769						iwmObj.iwmoptions[id].height = newh;
770						iwmObj.iwmgeocharts[id].draw(iwmObj.iwmdata[id], iwmObj.iwmoptions[id]);
771						iwmObj.iwmoptions[overlay].width = neww;
772						iwmObj.iwmoptions[overlay].height = newh;
773						iwmObj.iwmgeocharts[overlay].draw(iwmObj.iwmdata[overlay], iwmObj.iwmoptions[overlay]);
774						container.panzoom('resetDimensions');
775					}
776
777				} else {
778
779					//what to do if zoom limit was reached
780
781				}
782
783
784
785			});
786
787		}).append(function () {
788
789			return jQuery('<div class="iwm-controls-zoom-out">-</div>').click(function () {
790
791				controlparent = jQuery(this).parent();
792				cur_click = parseInt(controlparent.attr('data-step'), 10);
793				var parentw;
794				var parenth;
795				var transform;
796
797				if (cur_click > 0) {
798
799
800
801					map = thisMap;
802
803					var prevw = (10 * parseInt(map.width())) / 13;
804					var step = parseInt(map.width(), 10) - prevw;
805					var neww = prevw;
806
807					//console.log(neww);
808
809					if (!overlay) {
810
811						parentw = parseInt(map.parent().parent().width(), 10);
812						parenth = parseInt(map.parent().parent().height(), 10);
813
814					}
815
816					if (overlay) {
817
818						parentw = parseInt(container.parent().width(), 10);
819						parenth = parseInt(container.parent().height(), 10);
820
821					}
822
823
824					//if (cur_click >0 ) {
825
826					newh = (parseInt(map.height(), 10) / parseInt(map.width(), 10)) * (parseInt(map.width(), 10) - step);
827
828					//we also set the margins, so the zoom is central
829					var extrah = parseInt(map.height(), 10) - parseInt(newh, 10);
830					var extraw = parseInt(map.width(), 10) - parseInt(neww, 10);
831
832					if (overlay) {
833
834						transform = container.css('transform');
835
836					}
837
838					if (!overlay) {
839
840						transform = map.css('transform');
841
842					}
843
844
845					var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
846
847					var ctop = parseInt(matrix[5], 10);
848					var cleft = parseInt(matrix[4], 10);
849
850					var newtop = ctop + (extrah / 2);
851					var newleft = cleft + (extraw / 2);
852
853					//not to let map leave parent container
854					if (newleft > 0) {
855						newleft = 0;
856					}
857					if (newtop > 0) {
858						newtop = 0;
859					}
860
861					var maxh = newh - parenth;
862					maxh = maxh - (maxh) * 2;
863					if (newtop < maxh) {
864						newtop = maxh;
865					}
866
867					var maxw = neww - parentw;
868					maxw = maxw - (maxw) * 2;
869					if (newleft < maxw) {
870						newleft = maxw;
871					}
872
873					if (!overlay) {
874
875						map.height(newh);
876						map.width(neww);
877						map.attr('data-iwm-zwidth', neww).attr('data-iwm-zheight', newh);
878						map.css('transform', 'matrix(1, 0, 0, 1,' + newleft + ',' + newtop + ')');
879
880
881						iwmObj.iwmoptions[id].width = neww;
882						iwmObj.iwmoptions[id].height = newh;
883						iwmObj.iwmgeocharts[id].draw(iwmObj.iwmdata[id], iwmObj.iwmoptions[id]);
884
885						thisMap.panzoom('resetDimensions');
886
887						controlparent.attr('data-step', cur_click - 1);
888
889
890					}
891
892
893					//to apply zoom to overlay map
894					if (overlay) {
895
896						container.height(newh);
897						container.width(neww);
898						container.attr('data-iwm-zwidth', neww).attr('data-iwm-zheight', newh);
899						container.css('transform', 'matrix(1, 0, 0, 1,' + newleft + ',' + newtop + ')');
900
901						iwmObj.iwmoptions[id].width = neww;
902						iwmObj.iwmoptions[id].height = newh;
903						iwmObj.iwmgeocharts[id].draw(iwmObj.iwmdata[id], iwmObj.iwmoptions[id]);
904
905						iwmObj.iwmoptions[overlay].width = neww;
906						iwmObj.iwmoptions[overlay].height = newh;
907						iwmObj.iwmgeocharts[overlay].draw(iwmObj.iwmdata[overlay], iwmObj.iwmoptions[overlay]);
908						container.panzoom('resetDimensions');
909
910						controlparent.attr('data-step', cur_click - 1);
911
912
913					}
914
915					//}
916
917				}
918
919			});
920
921		});
922
923	}
924
925}
926
927//simple sort function. We use it in the connect marker function
928function iwm_sortNumber(a, b) {
929	return a - b;
930}
931
932function iwmconvert2color(colorstring) {
933	var color = '00000' + colorstring.toString();
934	color = color.slice(-6);
935	return '#' + color;
936}

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.