PluginProbe
Maps Widget for Google Maps / 1.93
Maps Widget for Google Maps v1.93
1.86 1.90 1.92 1.93 1.95 2.0 2.01 2.05 2.06 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.51 2.60 2.65 2.66 2.70 2.75 2.80 All 129 releases
google-maps-widget / js / gmw-admin.js

gmw-admin.js in Maps Widget for Google Maps 1.93, at js/gmw-admin.js

63 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2 * Google Maps Widget
3 * (c) Web factory Ltd, 2012 - 2013
4 */
5
6 jQuery(function($) {
7 $('.gmw-tabs').each(function(i, el) {
8 change_pin_type(el);
9 change_link_type(el);
10 $('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
11 $('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
12 el_id = $(el).attr('id');
13 $(el).tabs({ active: get_active_tab(el_id),
14 activate: function(event, ui) { save_active_tab(this); }
15 });
16 });
17
18 // get active tab index from cookie
19 function get_active_tab(el_id) {
20 id = parseInt(0 + $.cookie(el_id), 10);
21
22 return id;
23 } // get_active_tab
24
25 // save active tab index to cookie
26 function save_active_tab(elem) {
27 $.cookie($(elem).attr('id'), $(elem).tabs('option', 'active'), { expires: 30 });
28 } // save_active_tab
29
30 // show/hide custom link field based on user's link type choice
31 function change_link_type(widget) {
32 if ($('.gmw_thumb_link_type', widget).val() == 'custom') {
33 $('.gmw_thumb_link_section', widget).show();
34 } else {
35 $('.gmw_thumb_link_section', widget).hide();
36 }
37 } // link_type
38
39 // show/hide custom pin URL field based on user's pin type choice
40 function change_pin_type(widget) {
41 if ($('.gmw_thumb_pin_type', widget).val() == 'custom') {
42 $('.gmw_thumb_pin_type_custom_section', widget).show();
43 $('.gmw_thumb_pin_type_predefined_section', widget).hide();
44 } else {
45 $('.gmw_thumb_pin_type_custom_section', widget).hide();
46 $('.gmw_thumb_pin_type_predefined_section', widget).show();
47 }
48 } // pin_type
49
50 // re-tab on GUI rebuild
51 $('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
52 $('.gmw-tabs').each(function(i, el) {
53 change_pin_type(el);
54 change_link_type(el);
55 $('.gmw_thumb_pin_type', el).on('change', function() { change_pin_type(el) });
56 $('.gmw_thumb_link_type', el).on('change', function() { change_link_type(el) });
57 el_id = $(el).attr('id');
58 $(el).tabs({ active: get_active_tab(el_id),
59 activate: function(event, ui) { save_active_tab(this); }
60 });
61 });
62 });
63 }); // onload