-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·303 lines (253 loc) · 10.1 KB
/
index.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-89570951-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-89570951-1');
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>Dog Chef Promo - Fresh Pet Food</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/cover.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="assets/js/ie-emulation-modes-warning.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.core.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/fechanique/material-loading/master/material-loading.css">
<script src="https://cdn.rawgit.com/fechanique/material-loading/master/material-loading.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
[v-cloak] {display: none}
</style>
</head>
<body>
<div class="site-wrapper bg-img-1" id="app">
<div class="site-wrapper-inner" v-cloak>
<div class="cover-container">
<div class="masthead clearfix">
<div class="inner">
<nav>
<ul class="nav masthead-nav">
<li :class="(lg == 'en') ? 'active' : null" @click="lg = 'en'"><a href="#">EN</a></li>
<li :class="(lg == 'fr') ? 'active' : null" @click="lg = 'fr'"><a href="#">FR</a></li>
<li :class="(lg == 'nl') ? 'active' : null" @click="lg = 'nl'"><a href="#">NL</a></li>
</ul>
</nav>
</div>
</div>
<div class="inner cover">
<img src="img/logo.png" class="logo">
<form :action="'https://'+countryData.website" method="get" @submit.prevent="submit">
<transition name="fade">
<div>
<div>
<p v-if="country" class="lead">{{ countryData.code }}</p>
<p v-else class="lead">{{ get('country') }}</p>
<div class="form-group">
<label v-for="c in countries">
<input v-model="country" @click="selectLanguage(c.mainLanguage)" type="radio" name="country" :value="c.code">
<img :src="'./img/' + c.image">
</label>
</div>
</div>
</div>
</transition>
<transition name="fade">
<div v-if="country">
<div>
<p class="lead">{{ get('action') }}</p>
<div class="form-group">
<label for="coupon" class="sr-only">Coupon code</label>
<input v-model="coupon" type="text" name="coupon" class="form-control input-lg text-center" id="coupon" placeholder="CODE">
<input type="hidden" name="utm_source" value="samples">
<input type="hidden" name="utm_medium" value="samples">
<input type="hidden" name="utm_campaign" value="samples">
<input type="hidden" name="checkCoupon" value="1">
</div>
<button type="submit" class="btn btn-lg btn-default">{{ get('submit') }}</button>
<div style="margin-top:20px;">
<a :href="'https://' + countryData.website + '?utm_medium=samples&utm_source=samples&utm_campaign=nocoupon'">{{get('no_coupon')}}</a>
</div>
</div>
</div>
</transition>
</form>
</div>
<div class="mastfoot" v-if="country">
<div class="inner">
<p>Dog Chef - {{countryData.phone}} - <a :href="'mailto:'+countryData.email">{{countryData.email}}</a></p>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="assets/js/ie10-viewport-bug-workaround.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!',
error: null,
coupon: null,
country: null,
countries: [
{
code:'BE',
image:'006-belgium.png',
mainLanguage: null,
phone: '02 808 13 58',
email: '[email protected]',
website: 'www.dogchef.be'
},
{
code:'FR',
image:'001-france.png',
mainLanguage: 'fr',
phone: '07 57 93 59 24',
email: '[email protected]',
website: 'www.dogchef.fr'
},
{
code:'LU',
image:'008-luxembourg.png',
mainLanguage: null,
phone: '+352 28 48 74 78',
email: '[email protected]',
website: 'www.dogchef.lu'
},
{
code:'NL',
image:'007-netherlands.png',
mainLanguage: 'nl',
phone: '+32 2 808 13 58',
email: '[email protected]',
website: 'www.dogchef.nl'
}
],
lg: 'en',
strings: {
title: {
en: "Welcome on Dog Chef ",
fr: "Bienvenue chez Dog Chef",
nl: "Welkom bij Dog Chef",
},
page_title: {
en: "Dog Chef - Fresh Pet Food",
fr: "Dog Chef - Nourriture Fraiche pour chiens",
nl: "Dog Chef - Verse hondenvoeding",
},
country: {
en: "Select your country",
fr: "Sélectionnez votre pays",
nl: "Kies uw land",
},
action: {
en: "Enter your coupon code to secure your discount",
fr: "Introduisez votre code coupon pour sécuriser votre réduction",
nl: "Voer uw promo code in om te genieten van de korting",
},
submit: {
en: "Submit",
fr: "Valider",
nl: "Invoeren",
},
no_coupon: {
en: "I do not have a coupon code",
fr: "Je n'ai pas de code coupon",
nl: "Ik heb geen coupon",
},
error: {
en: "Please enter a coupon code or click on the link I do not have a coupon below",
fr: "Introduisez le code du coupon ou cliquez sur le lien je n'ai pas de code coupon",
nl: "Gelieve de promo code in te voeren of op de link te drukken ik heb geen promo code",
},
}
},
mounted: function(){
var userLang = navigator.language || navigator.userLanguage;
userLang = userLang.substring(0, 2).toLowerCase();
if(userLang == "fr" || userLang == "nl"){
this.lg = userLang;
}
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
self = this;
urlParams = {};
while (match = search.exec(query)){
urlParams[decode(match[1])] = decode(match[2]);
if(decode(match[1]) == "c"){
self.coupon = decode(match[2]);
}
if(decode(match[1]) == "l"){
self.selectLanguage(match[2].toLocaleLowerCase());
}
if(decode(match[1]) == "lg"){
self.selectLanguage(match[2].toLocaleLowerCase());
}
}
},
computed: {
countryData: function(){
if(this.country == null){
return {
phone:null,
email:null,
website:null
};
}
return _.find(this.countries, {code: this.country});
}
},
methods: {
get: function(key){
return (typeof this.strings[key][this.lg] != "undefined") ? this.strings[key][this.lg] : this.strings[key]['en'];
},
selectLanguage: function(language){
if(language != null){
this.lg = language;
}
},
submit: function(event){
if(this.coupon == null || this.coupon == ''){
this.error = this.get('error');
alert(this.error);
return false;
}
materialLoading(true);
var $form = $(event.target);
$form.submit();
}
}
});
</script>
</body>
</html>