Created
November 24, 2014 10:42
-
-
Save ssig33/c9513ede3b6df19e49fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by CoffeeScript 1.4.0 | |
var down, list, main, one; | |
list = localStorage.downlist; | |
if (!list) { | |
list = []; | |
} else { | |
list = JSON.parse(list); | |
} | |
one = function(name) { | |
document.querySelector("#contentAction_download_myx").click(); | |
return setTimeout((function() { | |
document.querySelector("#dialogButton_ok_myx").click(); | |
list.push(name); | |
localStorage.downlist = JSON.stringify(list); | |
return setTimeout((function() { | |
return location.reload(); | |
}), 6000); | |
}), 1000); | |
}; | |
down = function(name, i) { | |
document.querySelector("#contentTabList_" + i + "_myx > div > div > div > div > div.a-fixed-left-grid-col.a-col-left > div > div.a-column.a-span7.a-span-last > div > a > span > button").click(); | |
return setTimeout((function() { | |
return one(name); | |
}), 1500); | |
}; | |
main = function() { | |
var author, i, name, title, _i, _len, _ref; | |
_ref = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
i = _ref[_i]; | |
title = jQuery("#title" + i).text(); | |
author = jQuery("#author" + i).text(); | |
name = "(" + author + ")" + title; | |
console.log(name); | |
if (list.indexOf(name) === -1) { | |
console.log("Download: " + name); | |
down(name, i); | |
break; | |
} | |
} | |
return setTimeout((function() { | |
return location.reload(); | |
}), 600 * 1000); | |
}; | |
setTimeout((function() { | |
return main(); | |
}), 4000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment