WhatsApp me - Version 2.1.2

Version Description

  • FIX javascript error on iOS Safari private browsing.
Download this release

Release Info

Developer creapuntome
Plugin Icon 128x128 WhatsApp me
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

Files changed (3) hide show
  1. README.txt +4 -1
  2. public/js/whatsappme.js +21 -6
  3. whatsappme.php +2 -2
README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: whatsapp, button, chat, support, contact
5
Requires at least: 3.0.1
6
Tested up to: 4.9.4
7
Requires PHP: 5.3
8
- Stable tag: 2.1.1
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -61,6 +61,9 @@ WhatsApp me don't save any personal data and don't use cookies.
61
62
== Changelog ==
63
64
= 2.1.1 =
65
* FIX javascript error on IE11.
66
5
Requires at least: 3.0.1
6
Tested up to: 4.9.4
7
Requires PHP: 5.3
8
+ Stable tag: 2.1.2
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
61
62
== Changelog ==
63
64
+ = 2.1.2 =
65
+ * FIX javascript error on iOS Safari private browsing.
66
+
67
= 2.1.1 =
68
* FIX javascript error on IE11.
69
public/js/whatsappme.js CHANGED
@@ -6,6 +6,21 @@
6
var $whatsappme = $('.whatsappme');
7
var $badge = $whatsappme.find('.whatsappme__badge');
8
var wame_settings = $whatsappme.data('settings');
9
10
// In some strange cases data settings are empty
11
if (typeof (wame_settings) == 'undefined') {
@@ -27,15 +42,15 @@
27
var message_hash, is_viewed, timeoutID;
28
29
// stored values
30
- var messages_viewed = (localStorage.whatsappme_hashes || '').split(',').filter(Boolean);
31
- var is_second_visit = localStorage.whatsappme_visited == 'yes';
32
33
if (has_cta) {
34
message_hash = hash(wame_settings.message_text).toString();
35
is_viewed = messages_viewed.indexOf(message_hash) > -1;
36
}
37
38
- localStorage.whatsappme_visited = 'yes';
39
40
if (!wame_settings.mobile_only || is_mobile) {
41
// show button
@@ -87,7 +102,7 @@
87
function save_message_viewed() {
88
if (has_cta && !is_viewed) {
89
messages_viewed.push(message_hash)
90
- localStorage.whatsappme_hashes = messages_viewed.join(',');
91
is_viewed = true;
92
}
93
}
@@ -131,12 +146,12 @@
131
}
132
133
// Math.imul polyfill (source https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul#Polyfill)
134
- Math.imul = Math.imul || function(a, b) {
135
var ah = (a >>> 16) & 0xffff;
136
var al = a & 0xffff;
137
var bh = (b >>> 16) & 0xffff;
138
var bl = b & 0xffff;
139
- return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
140
};
141
142
}(jQuery));
6
var $whatsappme = $('.whatsappme');
7
var $badge = $whatsappme.find('.whatsappme__badge');
8
var wame_settings = $whatsappme.data('settings');
9
+ var store;
10
+
11
+ // Fallback if localStorage not supported (iOS incognito)
12
+ // Implements functional storage in memory and will not persist between page loads
13
+ try {
14
+ localStorage.setItem('test', 1);
15
+ localStorage.removeItem('test');
16
+ store = localStorage;
17
+ } catch (e) {
18
+ store = {
19
+ _data: {},
20
+ setItem: function (id, val) { this._data[id] = String(val); },
21
+ getItem: function (id) { return this._data.hasOwnProperty(id) ? this._data[id] : null; }
22
+ };
23
+ }
24
25
// In some strange cases data settings are empty
26
if (typeof (wame_settings) == 'undefined') {
42
var message_hash, is_viewed, timeoutID;
43
44
// stored values
45
+ var messages_viewed = (store.getItem('whatsappme_hashes') || '').split(',').filter(Boolean);
46
+ var is_second_visit = store.getItem('whatsappme_visited') == 'yes';
47
48
if (has_cta) {
49
message_hash = hash(wame_settings.message_text).toString();
50
is_viewed = messages_viewed.indexOf(message_hash) > -1;
51
}
52
53
+ store.setItem('whatsappme_visited', 'yes');
54
55
if (!wame_settings.mobile_only || is_mobile) {
56
// show button
102
function save_message_viewed() {
103
if (has_cta && !is_viewed) {
104
messages_viewed.push(message_hash)
105
+ store.setItem('whatsappme_hashes', messages_viewed.join(','));
106
is_viewed = true;
107
}
108
}
146
}
147
148
// Math.imul polyfill (source https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul#Polyfill)
149
+ Math.imul = Math.imul || function (a, b) {
150
var ah = (a >>> 16) & 0xffff;
151
var al = a & 0xffff;
152
var bh = (b >>> 16) & 0xffff;
153
var bl = b & 0xffff;
154
+ return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
155
};
156
157
}(jQuery));
whatsappme.php CHANGED
@@ -9,7 +9,7 @@
9
* Plugin Name: WhatsApp me
10
* Plugin URI: http://wame.chat
11
* Description: Add support to your clients directly with WhatsApp.
12
- * Version: 2.1.1
13
* Author: Creame
14
* Author URI: https://crea.me
15
* License: GPL-2.0+
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
* Currently plugin version.
28
* Start at version 1.0.0 and use SemVer - https://semver.org
29
*/
30
- define( 'WHATSAPPME_VERSION', '2.1.1' );
31
32
/**
33
* The core plugin class that is used to define internationalization,
9
* Plugin Name: WhatsApp me
10
* Plugin URI: http://wame.chat
11
* Description: Add support to your clients directly with WhatsApp.
12
+ * Version: 2.1.2
13
* Author: Creame
14
* Author URI: https://crea.me
15
* License: GPL-2.0+
27
* Currently plugin version.
28
* Start at version 1.0.0 and use SemVer - https://semver.org
29
*/
30
+ define( 'WHATSAPPME_VERSION', '2.1.2' );
31
32
/**
33
* The core plugin class that is used to define internationalization,