Skip to content

Instantly share code, notes, and snippets.

@martinshaw
Created May 20, 2018 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinshaw/20be5f8542373a1a866c6225f46458cb to your computer and use it in GitHub Desktop.
Save martinshaw/20be5f8542373a1a866c6225f46458cb to your computer and use it in GitHub Desktop.
Moodle PDF Download JS Code
var list = [];
$(".activity.resource.modtype_resource ").find("a").each(
function(){
if($(this).attr("onclick").split("window.open(\'")[1] != undefined){
if ($(this).find("img").attr("src") == "https://moodle.mmu.ac.uk/theme/image.php/mmu/core/1526789056/f/pdf-24") {
list.push($(this).attr("onclick").split("window.open(\'")[1].split("\', ''")[0]);
}
}
}
);
list = list.join("\n");
console.log(list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment