PageSourceSearch

https://freehotelcoupons.com/wp-content/plugins/InteractiveMapBuilder/js/generator.js?ver=2.0

js freehotelcoupons.com collected 2026-09-26 13:04:50 UTC 5,972 bytes, 216 lines download raw bytes

1// Objects to access chart data. 
2var charts        = {};
3//var tables        = {};
4var gtables       = {};
5var options       = {};
6//var actions       = {};
7var map_functions = {};
8var actions_store = {};
9var element_store = {};
10
11// Load Google Geochart API
12//google.load('visualization', '1', {'packages': ['geochart']});
13//google.charts.load('current', {'packages':['geochart']});
14google.charts.load('42', {
15    packages: ['geochart']
16});
17//google.setOnLoadCallback(drawMarkersMap);
18google.charts.setOnLoadCallback(drawMarkersMap);
19
20// OnLoad Callback Function
21function drawMarkersMap() {
22	var _map_click = map_click;
23	jQuery(".interactive_map_finder").each(function() {
24		var id     = jQuery(this).attr("imap");
25		var css_id = jQuery(this).attr("id");
26		var __map_click = _map_click;
27		
28		var table   = map_table_preloader();
29		var opt     = map_options_preloader();
30		if(table !== null) {
31			map_generator["maps"][id]["gtable"] = table;
32		}
33		if(opt !== null) {
34			map_generator["maps"][id]["options"] = opt;
35		}
36		
37		gtables[id] = new google.visualization.DataTable( map_generator["maps"][id]["gtable"] );
38		charts[id]  = new google.visualization.GeoChart(document.getElementById(css_id));
39		charts[id].draw(gtables[id], map_generator["maps"][id]["options"]);
40		var _chart = charts[id];
41		
42		// Callbacks for preview
43		google.visualization.events.addListener(charts[id], 'select', function() {
44			var selection = _chart.getSelection();
45			if(selection.length == 1) {
46				interactive_map_select_event(selection[0].row);
47			}
48		});
49		google.visualization.events.addListener(charts[id], 'regionClick', function(e) { 
50			interactive_map_regionClick_event(e.region); 
51		});
52		google.visualization.events.addListener(charts[id], 'ready', function() {
53			interactive_map_ready_event();
54		});
55		google.visualization.events.addListener(charts[id], 'error', function(id, msg) {
56			//alert("Error");
57		});
58		
59		// Callback for click action
60		google.visualization.events.addListener(charts[id], 'select', function() {
61			if(check_to_run_click_action()) {
62				
63				//map_functions[id]();
64				__map_click(id);
65			}
66		});
67		
68		actions_store[id] = null;
69		element_store[id] = new Object();
70		
71		// Add class if map is using html tooltips
72		if(map_generator["maps"][id]["options"]["tooltip"]["isHtml"] == "true") {
73			jQuery(this).addClass("with_html_tooltips");
74		}
75	});
76	  
77};
78
79
80var line_start = null;
81
82var map_click = function(id) {
83	var $=null;
84	if(typeof jQuery !== "undefined") $=jQuery;
85	
86	var selection = charts[id].getSelection();
87	if (selection.length == 1) {
88		var i            = selection[0].row;
89		var click_values = map_generator["maps"][id]["actions"];
90		var click_value  = click_values[i];
91		var cssid        = map_generator["maps"][id]["cssid"];
92		var map_storage  = actions_store[id];
93		if(typeof element_store[id][i] == "undefined") {
94			element_store[id][i] = null;
95		}
96		var storage     = element_store[id][i];
97		
98		if(line_start===null && typeof (new Error()).lineNumber  === "number") {
99			line_start=(new Error()).lineNumber + 3;
100		}
101		try {
102			eval(map_generator["maps"][id]["javascript"]);
103			console.log("here");
104		} catch(err) {
105			var line_end = null;
106			var line     = null;
107			if(typeof err.lineNumber  === "number") {
108				line_end = err.lineNumber;
109				line     = line_end - line_start+1;
110			}
111			interactive_map_code_error(err, line, {});
112		}
113		actions_store[id]    = map_storage;
114		element_store[id][i] = storage;
115		
116		//charts[id].setSelection(null);
117	}
118}
119
120
121// Debounce Function for the redraw of the map.
122var debounce = function (func, threshold, execAsap) {
123	var timeout;
124	return function debounced () {
125		var obj = this, args = arguments;
126		function delayed () {
127			if (!execAsap)
128				func.apply(obj, args);
129			timeout = null; 
130		};
131 
132		if (timeout)
133			clearTimeout(timeout);
134		else if (execAsap)
135			func.apply(obj, args);
136 
137		timeout = setTimeout(delayed, threshold || 100); 
138	};
139};
140
141// Resize map if the window is resized
142jQuery( window ).resize(debounce(function() {
143	jQuery.each(charts, function(id, key) {
144		charts[id].draw(gtables[id], map_generator["maps"][id]["options"]);
145	});
146	//drawMarkersMap();
147}, 250, false));
148
149function test_top_function_exists(name) {
150	try {
151		if(typeof top == "object" && typeof top[name] == "function") {
152			return true;
153		}
154	} catch(err) {
155		return false;
156	}
157	return false;
158}
159
160function interactive_map_select_event(i) {
161	//if(typeof top == "object" && typeof top.receive_map_event == "function") {
162	if(test_top_function_exists("receive_map_event")) {
163		top.receive_map_event(i);
164	}
165}
166
167function interactive_map_regionClick_event(i) {
168	//if(typeof top == "object" && typeof top.open_dialog == "function") {
169	if(test_top_function_exists("open_dialog")) {
170		top.open_dialog(i);
171	}
172}
173
174function interactive_map_ready_event() {
175	//if(typeof top == "object" && typeof top.receive_map_ready_event == "function") {
176	if(test_top_function_exists("receive_map_ready_event")) {
177		top.receive_map_ready_event();
178	}
179	if(typeof set_iframe_height == "function") {
180		set_iframe_height();
181	}
182}
183
184function interactive_map_code_error(error, line, state) {
185	//if(typeof top == "object" && typeof top.get_code_error == "function") {
186	if(test_top_function_exists("get_code_error")) {
187		top.get_code_error(error, line, state);
188	}
189}
190
191function map_table_preloader() {
192	var table = null;
193	//if(typeof top == "object" && typeof top.get_map_table == "function") {
194	if(test_top_function_exists("get_map_table")) {
195		table = top.get_map_table();
196	}
197	return table;
198}
199
200function map_options_preloader() {
201	var table = null;
202	//if(typeof top == "object" && typeof top.get_map_options == "function") {
203	if(test_top_function_exists("get_map_options")) {
204		table = top.get_map_options();
205	}
206	return table;
207}
208
209function check_to_run_click_action() {
210	//if(typeof top == "object" && typeof top.has_to_run_click_action == "function") {
211	if(test_top_function_exists("has_to_run_click_action")) {
212		return top.has_to_run_click_action();
213	}
214	return true;
215}
216

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.