forked from mluvii/customization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoffline_form.html
177 lines (161 loc) · 5.01 KB
/
offline_form.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css'>
<style type="text/css">
html, body {
background-color: transparent;
font-family: "SF Optimized", system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", "Segoe UI", "Roboto", sans-serif;
}
.whiteBox {
flex: 1;
display: flex;
flex-direction: column;
box-sizing: border-box;
justify-content: center;
background-color: #fff;
box-shadow: 0 2px 8px 0 rgba(0,0,0,0.06);
border-radius: 16px;
margin-bottom: 10px;
padding: 24px;
}
.customInput, .customTextArea {
height: 48px;
color: #304558;
font-size: 14px;
padding: 12px;
border-radius: 8px;
border: 2px solid #DADDE0;
outline: none;
box-sizing: border-box;
transition: border 0.2s ease;
}
.customTextArea:focus, .customInput:focus{
border: 2px solid #00275A;
}
.customTextArea {
flex-grow: 1;
height: 80px;
overflow: auto;
resize: none;
}
.customLabel {
margin: 8px 0;
color: #B4BEC8;
font-size: 14px;
margin-top: 4px;
margin-bottom: 0;
}
.customText {
text-align: center;
margin: 24px 16px 16px;
font-size: 14px;
}
.btn[type="submit"] {
width: 100px;
margin: auto;
background-color: #00275A;
color: white; /* Barva textu tlačítka */
cursor: pointer;
}
.btn-info{
border-color: #00275A;
}
#offlineText{
margin-top: 0;
font-size: 14px;
color: #414141;
}
.customInput:focus + .customLabel{
color: #00275A;
}
.customTextArea:focus + .customLabel{
color: #00275A;
}
#mailPhoneLabel{
order: 1;
}
#contact{
order: 2;
}
#phoneLabel{
order: 3;
}
#phone{
order: 4;
}
#messageLabel{
order: 5;
}
#message{
order: 6;
}
</style>
</head>
<body>
<div class=customText" id="offlineText">
</div>
<form id="custom_form">
<div class="whiteBox">
<input
required
class="customInput"
id="contact"
name="contact"
></input>
<label class="customLabel" for="contact" id="mailPhoneLabel">Email</label>
<input
class="customInput"
id="phone"
name="phone"
></input>
<label class="customLabel" for="phone" id="phoneLabel">Telephone</label>
<textarea
required
class="customTextArea"
name="message"
id="message"></textarea>
<label class="customLabel" for="message" id="messageLabel">Message</label>
</div>
<button class="btn btn-info btn-block" type="submit" id="sendButton">Send</button>
</form>
<script type="text/javascript">
(function () {
var userLang = navigator.language || navigator.userLanguage;
console.log("User lang: ", userLang);
if(userLang =="cs-CZ" || userLang =="cs"){
document.getElementById("offlineText").innerHTML = "Je nám to líto, ale právě teď nejsme online. Zanechte nám kontakt a my se vám co nejdříve ozveme zpět.";
document.getElementById("mailPhoneLabel").innerHTML = "E-mail";
document.getElementById("phoneLabel").innerHTML = "Telefon";
document.getElementById("messageLabel").innerHTML = "Zpráva";
document.getElementById("sendButton").innerHTML = "Odeslat";
} else {
document.getElementById("offlineText").innerHTML = "We apologize but we are unable to connect you to any available operators. Please, leave your contact information and we will contact you back later.";
document.getElementById("mailPhoneLabel").innerHTML = "E-mail";
document.getElementById("phoneLabel").innerHTML = "Phone";
document.getElementById("messageLabel").innerHTML = "Message";
document.getElementById("sendButton").innerHTML = "Send";
}
})();
</script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.0.8/popper.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/js/bootstrap.min.js'></script>
<script type="text/javascript">
const form = document.getElementById('custom_form');
form.onsubmit = function (e) {
e.preventDefault();
const contact = document.getElementById('contact').value;
const message = document.getElementById('message').value;
const phone = document.getElementById('phone').value;
const mes = "Telefon: "+ phone +" - Zpráva: "+message;
window.parent.postMessage({
type: "OFFLINE_ACTION",
contact:contact,
message: mes
}, "*");
};
</script>
</body>
</html>