Skip to content

Instantly share code, notes, and snippets.

@dim0xff
Last active August 29, 2015 14:04
Show Gist options
  • Save dim0xff/3937914013dba7069637 to your computer and use it in GitHub Desktop.
Save dim0xff/3937914013dba7069637 to your computer and use it in GitHub Desktop.
javascript:(function(){
var getXmlHttp = function () {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
};
var initGame = function (cb) {
var xmlhttp = getXmlHttp();
xmlhttp.open('GET', '/game/AjaxPlayGame.do?gameId=81901', true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
var res = JSON.parse(xmlhttp.responseText);
var cd = 60;
var cdInterval;
cdInterval = setInterval ( function () {
document.getElementsByTagName("h1")[0].innerHTML = cd--;
if ( cd <= 0 ) {
clearInterval(cdInterval);
cb(res);
}
}, 1000);
}
}
};
xmlhttp.send(null);
};
var play;
play = function () {
initGame(function (res) {
if (!res.success) {
alert('Done');
return;
}
var playRecordId = res.playRecordId;
var xmlhttp = getXmlHttp();
xmlhttp.open('GET', '/game/AjaxFinishGame.do?score=200&playRecordId=' + playRecordId, true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
var res = JSON.parse(xmlhttp.responseText);
setTimeout(function () {play()}, 3000);
}
}
};
xmlhttp.send(null);
});
};
play();
}());
@dim0xff
Copy link
Author

dim0xff commented Aug 5, 2014

  1. Create bookmarklet
  2. Go to http://promotion.aliexpress.com/
  3. Run created bookmarklet (you should win ~600points)

@dim0xff
Copy link
Author

dim0xff commented Aug 6, 2014

Holy Macaroni! Need 4 (four!!!) minutes to win points. Seems it's coffee time! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment