Skip to content

Commit

Permalink
Merge pull request #9 from alvinjohnsonso/widget-iframe-reload-height
Browse files Browse the repository at this point in the history
- Added signal receiver for `reloadHeight` to automatically adjust the height when the iframe content's height adjusts.
- Provided platform identifier for the widget iframe
  • Loading branch information
alvinjohnsonso authored Apr 9, 2021
2 parents 4ea8272 + da2a8b6 commit 10171eb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Visit our [Help Center](https://help.tawk.to/) for answers to FAQs

## Changelog

### 1.4.1
* Added function for widget selection iframe to auto resize.
* Provided platform identifier to widget selection iframe.

### 1.4.0
* Added enable/disable option for visitor recognition feature.

Expand Down
19 changes: 18 additions & 1 deletion admin/view/template/extension/module/tawkto.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@

<script>
var currentHost = window.location.protocol + '//' + window.location.host,
url = '<?php echo $iframe_url ?>&parentDomain=' + currentHost,
url = '<?php echo $iframe_url ?>&pltf=opencart&pltfv=2&parentDomain=' + currentHost,
baseUrl = '<?php echo $base_url ?>',
storeHierarchy = <?php echo json_encode($hierarchy) ?>;
Expand All @@ -210,9 +210,26 @@ window.addEventListener('message', function(e) {
if(e.data.action === 'getIdValues') {
e.source.postMessage({action: 'idValues', values : storeHierarchy}, baseUrl);
}
if(e.data.action === 'reloadHeight') {
reloadIframeHeight(e.data.height);
}
}
});
function reloadIframeHeight(height) {
if (!height) {
return;
}
var iframe = jQuery('#tawkIframe');
if (height === iframe.height()) {
return;
}
iframe.height(height);
}
function setTawkWidget(e) {
var store_layout = e.data.id;
jQuery.post('<?php echo $url['set_widget_url']; ?>', {
Expand Down

0 comments on commit 10171eb

Please sign in to comment.