Permalink
Browse files

* imagebin.org: replaced timeout kludge with a bit more proper callback

  • Loading branch information...
l29ah committed Nov 23, 2011
1 parent 0ee5821 commit f8805d9d777630934a456facc581090974ae49fe
Showing with 12 additions and 8 deletions.
  1. +12 −8 imagebin.org/imagebin
View
@@ -6,21 +6,25 @@ if (phantom.args.length !== 1) {
phantom.exit();
} else {
fname = phantom.args[0];
var loads = 0;
page.open("http://imagebin.org/index.php?page=add", function () {
page.uploadFile('input[name=image]', fname);
page.evaluate(function () {
document.querySelector('input[name=nickname]').value = 'phantom';
document.querySelector('input[name=disclaimer_agree]').click()
document.querySelector('form').submit();
});
window.setTimeout(function () {
loads++;
if (loads == 2) {
page.uploadFile('input[name=image]', fname);
page.evaluate(function () {
document.querySelector('input[name=nickname]').value = 'phantom';
document.querySelector('input[name=disclaimer_agree]').click()
document.querySelector('form').submit();
});
}
if (loads == 4) {
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.evaluate(function () {
console.log(document.URL);
});
phantom.exit();
}, 3000);
}
});
}

0 comments on commit f8805d9

Please sign in to comment.