|
// Anonymous "self-invoking" function |
|
|
|
alert("Thank you for using this script created by Louis Hong (/u/loolo78)\n\nThe download will now begin."); |
|
|
|
(function() { |
|
// Load the script |
|
var script = document.createElement("SCRIPT"); |
|
script.src = 'https://code.jquery.com/jquery-latest.min.js'; |
|
script.type = 'text/javascript'; |
|
document.getElementsByTagName("head")[0].appendChild(script); |
|
|
|
// Poll for jQuery to come into existance |
|
var checkReady = function(callback) { |
|
if (window.jQuery) { |
|
callback(jQuery); |
|
} |
|
else { |
|
window.setTimeout(function() { |
|
checkReady(callback); |
|
}, 20); |
|
} |
|
} |
|
; |
|
|
|
// Start polling... |
|
checkReady(function($) { |
|
$(function() { |
|
console.log("JQuery loaded, start downloading") |
|
start() |
|
}); |
|
}); |
|
})(); |
|
|
|
// http://facebook.com/anders.tornblad |
|
// anders.tornblad@gmail.com |
|
|
|
|
|
|
|
//------ |
|
|
|
function fetchList() { |
|
console.log("Fetch all the animation in this page, you can optimized this by setting to page to 96 per page on the upper right") |
|
return $("#site > div > div > div > div.product-results > div.product-list.thumbnails-md")[0].childNodes |
|
} |
|
|
|
function nextPage() { |
|
console.log("This page is done, loading next page.") |
|
var lastButton = $("#site > div > div > div > div.product-results > div.pagination-holder > ul")[0].lastChild.firstChild |
|
lastButton.click() |
|
} |
|
|
|
function start() { |
|
list = fetchList() |
|
var i = 0 |
|
var purchased = false |
|
var newPage = false |
|
var loadingDog = false |
|
var downloadObserver = new MutationObserver(function(mutations) { |
|
|
|
if ($(".spinner-dog").length != 0) { |
|
console.log("Waiting for page to load") |
|
loadingDog = true |
|
return |
|
} |
|
|
|
if (newPage && loadingDog) { |
|
list = fetchList() |
|
if (list.length == 0) { |
|
return |
|
} |
|
window.scrollTo(0,document.body.scrollHeight); |
|
newPage = false |
|
loadingDog = false |
|
list[0].click() |
|
} |
|
|
|
var download = $("#site > div > div.product-preview-holder.col-sm-6.col-push-6 > div > div.editor.row.row-no-gutter > div.editor-sidebar.col-xs-4 > div.sidebar-header > button")[0] |
|
|
|
if (i >= list.length) { |
|
nextPage() |
|
$("#site > div > div.product-preview-holder.col-sm-6.col-push-6 > div > div.product-nav > button")[0].click() |
|
i = 0 |
|
purchased = false |
|
newPage = true |
|
return |
|
} |
|
|
|
if (download.childNodes[0].innerHTML === "Loading…") { |
|
return |
|
} |
|
|
|
if (download.childNodes[0].data === "Adding...") { |
|
return |
|
} |
|
|
|
if (download.childNodes[0].data === "View / Download") { |
|
list[i++].click() |
|
purchased = false |
|
console.log("This animation has already been downloaded") |
|
return |
|
} else { |
|
if (!purchased) { |
|
console.log("Downloading new animation") |
|
download.click() |
|
purchased = true |
|
} |
|
} |
|
} |
|
) |
|
|
|
downloadObserver.observe($("#site > div")[0], { |
|
childList: true, |
|
subtree: true, |
|
attributes: true, |
|
characterData: true |
|
}) |
|
|
|
list[0].click() |
|
} |
Wrote a new script to download all mixamo animations for a single character
https://www.youtube.com/watch?v=EuAjnKAehGI&t=5s