helpers.js
745 Bytes
module.exports = {
image(url, width, height, mode, quality) {
mode = _.isNumber(mode) ? mode : 2;
url = url || '';
url = url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode);
if (url.indexOf('imageView2') > 0) {
quality = _.isNumber(quality) ? quality : 90;
url += '/q/' + quality;
}
return url.replace('http:', '');
},
queryString() {
let vars = [], hash;
let hashes = window.location.search.slice(1).split('&');
for (let i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
}