Skip to content

Instantly share code, notes, and snippets.

@Tomanow
Created February 7, 2017 05:35
Show Gist options
  • Save Tomanow/97c698136e357756e9a3bb632c54fbb7 to your computer and use it in GitHub Desktop.
Save Tomanow/97c698136e357756e9a3bb632c54fbb7 to your computer and use it in GitHub Desktop.
Cart for Vika
/**
* ===============================================
* Sets bodybuilding.com cookies...
* ...home-made chocolate chip cookies that is.
*
* @author tomcat.meowface -.-
* ===============================================
*/
(function(window, document) {
var cookies = {
c: '-5366709280842709321',
elm: '598CB4DEF70DEC039D4D4CDD464BE61D',
m: 'E675441A-2500-48FA-BE37-EC7D2B6A3C6C',
commerceitemCount: 7,
JSESSIONID: '598CB4DEF70DEC039D4D4CDD464BE61D'
};
function _tomSetCart() {
var inc = 0;
for (var prop in cookies) {
if (cookies.hasOwnProperty(prop)) {
document.cookie = prop + '=' + cookies[prop];
inc++;
}
}
return inc;
}
if (_tomSetCart() === 5) {
console.log('#######################################');
console.log('## --------------------------------- ##');
console.log('## SUCCESS! -- 5/5 cookies were set! ##');
console.log('## Nicely done, Vika! :D ##');
console.log('## Go checkout the shopping cart! ##');
console.log('## --------------------------------- ##');
console.log('#######################################');
} else {
console.log('OOPS! Something went wrong. Yell at Tom!')
}
})(window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment