Google Maps Widget – Ultimate Google Maps Plugin - Version 0.22

Version Description

  • 2012/08/31
  • Fixed small JS related GUI bug
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Google Maps Widget – Ultimate Google Maps Plugin
Version 0.22
Comparing to
See all releases

Code changes from version 0.21 to 0.22

Files changed (6) hide show
  1. gmw-widget.php +1 -1
  2. google-maps-widget.php +2 -1
  3. js/gmw-admin.js +20 -2
  4. js/gmw.js +2 -4
  5. js/jquery.cookie.js +89 -0
  6. readme.txt +7 -1
gmw-widget.php CHANGED
@@ -82,7 +82,7 @@ class GoogleMapsWidget extends WP_Widget {
82
  echo '<p><label for="' . $this->get_field_id('title') . '">Title:</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
83
  echo '<p><label for="' . $this->get_field_id('address') . '">Address:</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
84
 
85
- echo '<div class="gmw-tabs"><ul><li><a href="#gmw-thumb">Thumbnail map</a></li><li><a href="#gmw-lightbox">Lightbox map</a></li></ul>';
86
  echo '<div id="gmw-thumb">';
87
 
88
  echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">Map Size: </label>';
82
  echo '<p><label for="' . $this->get_field_id('title') . '">Title:</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . esc_attr($title) . '" /></p>';
83
  echo '<p><label for="' . $this->get_field_id('address') . '">Address:</label><input class="widefat" id="' . $this->get_field_id('address') . '" name="' . $this->get_field_name('address') . '" type="text" value="' . esc_attr($address) . '" /></p>';
84
 
85
+ echo '<div class="gmw-tabs" id="tab-' . $this->id . '"><ul><li><a href="#gmw-thumb">Thumbnail map</a></li><li><a href="#gmw-lightbox">Lightbox map</a></li></ul>';
86
  echo '<div id="gmw-thumb">';
87
 
88
  echo '<p><label class="gmw-label" for="' . $this->get_field_id('thumb_width') . '">Map Size: </label>';
google-maps-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Maps Widget
4
  Plugin URI: http://wordpress.org/extend/plugins/google-maps-widget/
5
  Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox.
6
  Author: Web factory Ltd
7
- Version: 0.21
8
  Author URI: http://www.webfactoryltd.com/
9
  */
10
 
@@ -126,6 +126,7 @@ class GMW {
126
  $plugin_url = plugin_dir_url(__FILE__);
127
 
128
  wp_enqueue_script('jquery-ui-tabs');
 
129
  wp_enqueue_script('gmw-admin', $plugin_url . 'js/gmw-admin.js', array(), '1.0', true);
130
  wp_enqueue_style('gmw-admin', $plugin_url . 'css/gmw-admin.css', array(), '1.0');
131
  } // if
4
  Plugin URI: http://wordpress.org/extend/plugins/google-maps-widget/
5
  Description: Display a single-image super-fast loading Google map in a widget. A larger, full featured map is available on click in a lightbox.
6
  Author: Web factory Ltd
7
+ Version: 0.22
8
  Author URI: http://www.webfactoryltd.com/
9
  */
10
 
126
  $plugin_url = plugin_dir_url(__FILE__);
127
 
128
  wp_enqueue_script('jquery-ui-tabs');
129
+ wp_enqueue_script('sn-cookie', $plugin_url . 'js/jquery.cookie.js', array('jquery'), '1.0', true);
130
  wp_enqueue_script('gmw-admin', $plugin_url . 'js/gmw-admin.js', array(), '1.0', true);
131
  wp_enqueue_style('gmw-admin', $plugin_url . 'css/gmw-admin.css', array(), '1.0');
132
  } // if
js/gmw-admin.js CHANGED
@@ -4,9 +4,27 @@
4
  */
5
 
6
  jQuery(function($) {
7
- $('.gmw-tabs').tabs();
 
 
 
 
 
 
 
 
 
 
 
 
8
 
 
9
  $('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
10
- $('.gmw-tabs').tabs();
 
 
 
 
 
11
  });
12
  }); // onload
4
  */
5
 
6
  jQuery(function($) {
7
+ $('.gmw-tabs').each(function(i, el) {
8
+ el_id = $(el).attr('id');
9
+ $(el).tabs({ selected: get_active_tab(el_id),
10
+ show: function(event, ui) { $.cookie($(this).attr('id'), $(this).tabs('option', 'selected'), { expires: 7 }); }
11
+ });
12
+ });
13
+
14
+ // get active tab index from cookie
15
+ function get_active_tab(el_id) {
16
+ id = parseInt(0 + $.cookie(el_id), 10);
17
+
18
+ return id;
19
+ } // get_active_tab
20
 
21
+ // re-tab on GUI rebuild
22
  $('div[id*="googlemapswidget"]').ajaxSuccess(function(event, request, option) {
23
+ $('.gmw-tabs').each(function(i, el) {
24
+ el_id = $(el).attr('id');
25
+ $(el).tabs({ selected: get_active_tab(el_id),
26
+ show: function(event, ui) { $.cookie($(this).attr('id'), $(this).tabs('option', 'selected'), { expires: 7 }); }
27
+ });
28
+ });
29
  });
30
  }); // onload
js/gmw.js CHANGED
@@ -9,7 +9,7 @@ jQuery(function($) {
9
  map_width = dialog.attr('data-map-width');
10
  map_height = dialog.attr('data-map-height');
11
 
12
- dialog.dialog('option', {'minWidth': map_width, 'minHeight': map_height,} ).dialog('open');
13
 
14
  return false;
15
  });
@@ -18,14 +18,12 @@ jQuery(function($) {
18
  'modal': true,
19
  'resizable': false,
20
  'zIndex': 9999,
21
- 'minWidth': 550,
22
- 'minHeight': 550,
23
  'hide': 'fade',
24
  'open': function(event, ui) { renderMap(event, ui); fixDialogClose(event, ui); },
25
  'show': 'fade',
26
  'autoOpen': false,
27
  'closeOnEscape': true
28
- });
29
  }); // onload
30
 
31
  function renderMap(event, ui) {
9
  map_width = dialog.attr('data-map-width');
10
  map_height = dialog.attr('data-map-height');
11
 
12
+ dialog.dialog('option', {'width': map_width, 'minHeight': map_height}).dialog('open');
13
 
14
  return false;
15
  });
18
  'modal': true,
19
  'resizable': false,
20
  'zIndex': 9999,
 
 
21
  'hide': 'fade',
22
  'open': function(event, ui) { renderMap(event, ui); fixDialogClose(event, ui); },
23
  'show': 'fade',
24
  'autoOpen': false,
25
  'closeOnEscape': true
26
+ });
27
  }); // onload
28
 
29
  function renderMap(event, ui) {
js/jquery.cookie.js ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jslint browser: true */ /*global jQuery: true */
2
+
3
+ /**
4
+ * jQuery Cookie plugin
5
+ *
6
+ * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
7
+ * Dual licensed under the MIT and GPL licenses:
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ * http://www.gnu.org/licenses/gpl.html
10
+ *
11
+ */
12
+
13
+ // TODO JsDoc
14
+
15
+ /**
16
+ * Create a cookie with the given key and value and other optional parameters.
17
+ *
18
+ * @example $.cookie('the_cookie', 'the_value');
19
+ * @desc Set the value of a cookie.
20
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
21
+ * @desc Create a cookie with all available options.
22
+ * @example $.cookie('the_cookie', 'the_value');
23
+ * @desc Create a session cookie.
24
+ * @example $.cookie('the_cookie', null);
25
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
26
+ * used when the cookie was set.
27
+ *
28
+ * @param String key The key of the cookie.
29
+ * @param String value The value of the cookie.
30
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
31
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
32
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
33
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
34
+ * when the the browser exits.
35
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
36
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
37
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
38
+ * require a secure protocol (like HTTPS).
39
+ * @type undefined
40
+ *
41
+ * @name $.cookie
42
+ * @cat Plugins/Cookie
43
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
44
+ */
45
+
46
+ /**
47
+ * Get the value of a cookie with the given key.
48
+ *
49
+ * @example $.cookie('the_cookie');
50
+ * @desc Get the value of a cookie.
51
+ *
52
+ * @param String key The key of the cookie.
53
+ * @return The value of the cookie.
54
+ * @type String
55
+ *
56
+ * @name $.cookie
57
+ * @cat Plugins/Cookie
58
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
59
+ */
60
+ jQuery.cookie = function (key, value, options) {
61
+
62
+ // key and value given, set cookie...
63
+ if (arguments.length > 1 && (value === null || typeof value !== "object")) {
64
+ options = jQuery.extend({}, options);
65
+
66
+ if (value === null) {
67
+ options.expires = -1;
68
+ }
69
+
70
+ if (typeof options.expires === 'number') {
71
+ var days = options.expires, t = options.expires = new Date();
72
+ t.setDate(t.getDate() + days);
73
+ }
74
+
75
+ return (document.cookie = [
76
+ encodeURIComponent(key), '=',
77
+ options.raw ? String(value) : encodeURIComponent(String(value)),
78
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
79
+ options.path ? '; path=' + options.path : '',
80
+ options.domain ? '; domain=' + options.domain : '',
81
+ options.secure ? '; secure' : ''
82
+ ].join(''));
83
+ }
84
+
85
+ // key and possibly options given, get cookie...
86
+ options = value || {};
87
+ var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
88
+ return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
89
+ };
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: google maps, maps, gmaps, widget, lightbox, map, google map
5
  License: GPLv2 or later
6
  Requires at least: 3.2
7
  Tested up to: 3.4.1
8
- Stable tag: 0.21
9
 
10
  Display a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
11
 
@@ -37,6 +37,8 @@ More features, videos and demos are coming in a few days! Till then here's the w
37
 
38
  There are no additional JS libraries included; GMW uses jQuery and jQuery UI Dialog bundled with WP. There are also no extra CSS files included. We do plan to add them in the future to provide map and dialog themes.
39
 
 
 
40
  == Installation ==
41
 
42
  Follow the usual routine;
@@ -67,6 +69,10 @@ If you can figure it out open a thread in the support forums.
67
 
68
  == Changelog ==
69
 
 
 
 
 
70
  = 0.2 =
71
  * 2012/08/28
72
  * Complete GUI rewrite
5
  License: GPLv2 or later
6
  Requires at least: 3.2
7
  Tested up to: 3.4.1
8
+ Stable tag: 0.22
9
 
10
  Display a single-image super-fast loading Google map in a widget. A larger map with all the usual features is available on click in a lightbox.
11
 
37
 
38
  There are no additional JS libraries included; GMW uses jQuery and jQuery UI Dialog bundled with WP. There are also no extra CSS files included. We do plan to add them in the future to provide map and dialog themes.
39
 
40
+ > If you need a Google Maps shortcode plugin you might be interested in purchasing our premium <a href="5sec Google Maps" href="http://5sec-gmap.webfactoryltd.com/">5sec Google Maps</a> plugin.
41
+
42
  == Installation ==
43
 
44
  Follow the usual routine;
69
 
70
  == Changelog ==
71
 
72
+ = 0.22 =
73
+ * 2012/08/31
74
+ * Fixed small JS related GUI bug
75
+
76
  = 0.2 =
77
  * 2012/08/28
78
  * Complete GUI rewrite