JSFiddle - React, Tailwind, and code Playground
by web-nfo.com
JavaScript
//var cwInfinity_operator = "85001286";
console.log(window.location.hostname);
/*
* Custom script for cref tracking on photoservice homepage
* Note: prefix 'cwInfinity_' is used for global variables/functions
*/
// Operator
if(typeof cwInfinity_operator == 'undefined') {
switch(window.location.hostname) {
case "nl.kruidvat.be":
var cwInfinity_operator = "85001287";
break;
}
case "fr.kruidvat.be": {
var cwInfinity_operator = "85001286";
break;
}
default: {
var cwInfinity_operator = "85100005";
}
}
}
// Keyaccount
if(typeof cwInfinity_keyaccount == 'undefined') {
switch(cwInfinity_operator) {
case "85001287":
case "85701287": {
var cwInfinity_keyaccount = "1287";
break;
}
case "85001286":
case "85701286": {
var cwInfinity_keyaccount = "1286";
break;
}
default: {
var cwInfinity_keyaccount = "5";
}
}
}
// Console log (for debugging)
function cwInfinity_cLog(msg) { // Console log (if available)
if(typeof console == 'object' && typeof console.log == 'function') {
console.log(msg);
}
}
// Fetch the cref from the url
function cwInfinity_fetchCrefFromUrl()
{
return "bmi_sem_a_b_c_d";
// Fetch an url parameter
var parameter = 'cref';
HTTP_GET_VARS = new Array();
strGET = document.location.search.substr(1, document.location.search.length);
if (strGET != '') {
gArr = strGET.split('&');
for(var i=0; i<gArr.length; ++i) {
v = '';
vArr = gArr[i].split('=');
if(vArr.length > 1) {
v = vArr[1];
}
HTTP_GET_VARS[unescape(vArr[0])] = unescape(v);
}
}
if (!HTTP_GET_VARS[parameter]) {
return '';
}
return HTTP_GET_VARS[parameter];
}
// Generate an unique cref hash
function cwInfinity_generateCrefHash()
{
var letters = 'abcdefghijklmnopqrstuvwxyz';
...