-
Notifications
You must be signed in to change notification settings - Fork 3
/
debug.html
102 lines (92 loc) · 3.24 KB
/
debug.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html lang="en">
<head>
<title>Amilia Demo Organization - Debug</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon">
<script src="javascripts/jquery-2.0.3.min.js" type="text/javascript"></script>
<script src="javascripts/bootstrap.min.js" type="text/javascript"></script>
<link href="stylesheets/bootstrap.css" rel="stylesheet" type="text/css" charset="utf-8">
<script type="text/javascript">
$(document).ready(function() {
var $iframe = $('#amilia-iframe'),
$url = $('#url'),
$button = $('#status>button'),
$log = $('#status>ul'),
$diagnostics = $('#diagnostics');
$url.val($iframe.attr('src'));
$url.keydown(function(e) {
if (e.keyCode == 13)
$iframe.attr('src', $(this).val());
});
$diagnostics.change(function(e) {
if ($diagnostics.is(":checked"))
$iframe.attr('data-self-diagnose', true);
else
$iframe.removeAttr('data-self-diagnose');
});
function processMessage(e) {
var JSONdata;
try {
JSONdata = JSON.parse(e.data);
} catch (e) {
JSONdata = {};
}
if ($button.hasClass('btn-default')) {
$button.removeClass('btn-default').addClass('btn-success');
$button.children('span.text').text('Receiving messages from iframe');
}
var cmd = JSONdata.amiliaCmd;
var value = JSONdata.value;
$('#status>ul').prepend('<li><a>'+cmd+' '+value+'</a></li>');
};
// Listen for messages from iframe
if (window.addEventListener) {
window.addEventListener("message", processMessage, false);
} else {
window.attachEvent("onmessage", processMessage);
}
});
</script>
</head>
<body>
<div class="container">
<div class="row">
<h1>Amilia Demo Organization</h1>
<p>Sample site with embedded iFrame. Type in the address of your Amilia store to see what it will look like.</p>
<div class="form-group col-md-8">
<input id="url" type="text" class="form-control" />
<br/>
<label><input id="diagnostics" type="checkbox" checked="checked" /> Test and show self-diagnostics</label>
</div>
<div class="col-md-4">
<div id="status" class="form-group btn-group btn-block">
<button type="button" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown">
<span class="text">No message received from iframe</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
</ul>
</div>
</div>
</div>
<div class="row">
<!-- Embed this code in your page. Ensure to change src to your store. -->
<div id="amilia">
<iframe id="amilia-iframe"
allowtransparency="true"
frameborder="0"
width="100%"
style="width: 100%!important; border: none!important; overflow: hidden!important;"
scrolling="no"
horizontalscrolling="no"
verticalscrolling="no"
data-self-diagnose="true"
src="https://app.amilia.com/store/en/usa-amilia-group/">
</iframe>
<script src="https://app.amilia.com/scripts/amilia-iframe.js" type="text/javascript"></script>
</div>
<!-- End of Amilia embed -->
</div>
</body>
</html>