Skip to content

Commit 6393c7b

Browse files
Merge pull request #21 from alvinjohnsonso/widget-iframe-reload-height
- Added iframe resizing on height update event. - Provided platform identifier for the widget iframe.
2 parents ded0316 + 91f6e0a commit 6393c7b

File tree

6 files changed

+40
-6
lines changed

6 files changed

+40
-6
lines changed

prestashop1.6/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>tawkto</name>
44
<displayName><![CDATA[tawk.to]]></displayName>
5-
<version><![CDATA[1.2.0]]></version>
5+
<version><![CDATA[1.2.1]]></version>
66
<description><![CDATA[tawk.to live chat integration.]]></description>
77
<author><![CDATA[tawk.to]]></author>
88
<tab><![CDATA[front_office_features]]></tab>

prestashop1.6/tawkto.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct()
3333
{
3434
$this->name = 'tawkto';
3535
$this->tab = 'front_office_features';
36-
$this->version = '1.2.0';
36+
$this->version = '1.2.1';
3737
$this->author = 'tawk.to';
3838
$this->need_instance = 0;
3939
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6');

prestashop1.6/views/templates/admin/tawkto/helpers/view/view.tpl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<script type="text/javascript">
4040
var domain = "{$domain|escape:'url':'UTF-8'}";;
4141
var currentHost = window.location.protocol + "//" + window.location.host,
42-
url = decodeURIComponent("{$iframe_url|cat:'&parentDomain='|escape:'url':'UTF-8'}") + currentHost,
42+
url = decodeURIComponent("{$iframe_url|cat:'&pltf=prestashop&pltfv=1.6&parentDomain='|escape:'url':'UTF-8'}") + currentHost,
4343
baseUrl = decodeURIComponent("{$base_url|escape:'url':'UTF-8'}"),
4444
current_id_tab = "{$tab_id|escape:'javascript':'UTF-8'}",
4545
controller = decodeURIComponent("{$controller|escape:'url':'UTF-8'}");
@@ -58,6 +58,10 @@
5858
if(e.data.action === 'removeWidget') {
5959
removeWidget(e);
6060
}
61+
62+
if(e.data.action === 'reloadHeight') {
63+
reloadIframeHeight(e.data.height);
64+
}
6165
}
6266
});
6367
@@ -111,6 +115,19 @@
111115
}
112116
});
113117
}
118+
119+
function reloadIframeHeight(height) {
120+
if (!height) {
121+
return;
122+
}
123+
124+
var iframe = jQuery('#tawkIframe');
125+
if (height === iframe.height()) {
126+
return;
127+
}
128+
129+
iframe.height(height);
130+
}
114131
{/literal}
115132
</script>
116133

prestashop1.7/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>tawkto</name>
44
<displayName><![CDATA[tawk.to]]></displayName>
5-
<version><![CDATA[1.2.0]]></version>
5+
<version><![CDATA[1.2.1]]></version>
66
<description><![CDATA[tawk.to live chat integration.]]></description>
77
<author><![CDATA[tawk.to]]></author>
88
<tab><![CDATA[front_office_features]]></tab>

prestashop1.7/tawkto.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct()
3333
{
3434
$this->name = 'tawkto';
3535
$this->tab = 'front_office_features';
36-
$this->version = '1.2.0';
36+
$this->version = '1.2.1';
3737
$this->author = 'tawk.to';
3838
$this->need_instance = 0;
3939
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.7');

prestashop1.7/views/templates/admin/tawkto/helpers/view/view.tpl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<script>
4040
var domain = "{$domain|escape:'url':'UTF-8'}";;
4141
var currentHost = window.location.protocol + "//" + window.location.host,
42-
url = decodeURIComponent("{$iframe_url|cat:'&parentDomain='|escape:'url':'UTF-8'}") + currentHost,
42+
url = decodeURIComponent("{$iframe_url|cat:'&pltf=prestashop&pltfv=1.7&parentDomain='|escape:'url':'UTF-8'}") + currentHost,
4343
baseUrl = decodeURIComponent("{$base_url|escape:'url':'UTF-8'}"),
4444
current_id_tab = "{$tab_id|escape:'javascript':'UTF-8'}",
4545
controller = decodeURIComponent("{$controller|escape:'url':'UTF-8'}");
@@ -59,6 +59,10 @@
5959
if(e.data.action === 'removeWidget') {
6060
removeWidget(e);
6161
}
62+
63+
if(e.data.action === 'reloadHeight') {
64+
reloadIframeHeight(e.data.height);
65+
}
6266
}
6367
});
6468
@@ -118,6 +122,19 @@
118122
}
119123
});
120124
}
125+
126+
function reloadIframeHeight(height) {
127+
if (!height) {
128+
return;
129+
}
130+
131+
var iframe = jQuery('#tawkIframe');
132+
if (height === iframe.height()) {
133+
return;
134+
}
135+
136+
iframe.height(height);
137+
}
121138
{/literal}
122139
</script>
123140

0 commit comments

Comments
 (0)