Last active
August 29, 2015 14:10
-
-
Save ssig33/86407065a93867cc6c0a 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
// ==UserScript== | |
// @name My Fancy New Userscript | |
// @namespace http://your.homepage/ | |
// @version 0.1 | |
// @description enter something useful | |
// @author You | |
// @match https://www.amazon.co.jp/mn/dcw/myx.html* | |
// @grant none | |
// ==/UserScript== | |
// Generated by CoffeeScript 1.4.0 | |
var down, list, main, one; | |
console.log("FUCK"); | |
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) { | |
document.querySelector('#contentTabList_0_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, name, title; | |
title = jQuery('#title0').text(); | |
author = jQuery('#author0').text(); | |
name = "(" + author + ")" + title; | |
console.log(name); | |
if (list.indexOf(name) === -1) { | |
console.log("Download: " + name); | |
return down(name); | |
} else { | |
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