JSFiddle - React, Tailwind, and code Playground
by Oliver Kelso
JavaScript
Bootstrapper.pulse = {
config: {
dc: "//ens-activatesandbox.activate.ensighten.com/no-content", // pulse gif url
debug: false, // debugging
fpDomain: ".domain.com", // first party domain
sessionTime: 1800000, // session timeout milliseconds
},
params: {},
metas: {},
images: [],
log: [],
/**
* Encode string
*/
encode: function (string) {
if (typeof encodeURIComponent == "function") {
return encodeURIComponent(string);
} else {
return escape(string);
}
},
/**
* Decode string
*/
decode: function (string) {
if (typeof decodeURIComponent == "function") {
return decodeURIComponent(string);
} else {
return unescape(string);
}
},
/**
* Generate epoch timestamp
*/
date: function () {
if (!Date.now) {
Date.now = function now() {
return new Date().getTime();
};
} else {
return Date.now();
}
},
/**
* Debug logging
*/
log: function (m) {
this.log.push(m);
if (this.config.debug) {
console.log("[ENS] " + m);
}
},
/**
* Parse parameter string and encode values
*/
parseParams: function (string) {
if (typeof string === 'string') {
string = (string.match("/;+$/")) ? string.replace(/;+$/, "") : string; // remove trailing semicolon
var parsed = string.split(";"); // split string on semicolon
var arrayLength = parsed.length;
for (var i = 0; i < arrayLength; i++) {
if (parsed[i] !== "undefined") {
parsed[i] = this.encode(parsed[i]); // encode array values
}
}
return parsed.join(";"); // return string
} else {
return string;
}
},
/**
...