Skip to content

Instantly share code, notes, and snippets.

@gbaman
Last active November 21, 2019 09:58
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 gbaman/c16e953eced6821d66504dcef46b15c0 to your computer and use it in GitHub Desktop.
Save gbaman/c16e953eced6821d66504dcef46b15c0 to your computer and use it in GitHub Desktop.
Repl.it publish all activities
function publisher(){
var arr = [], l = document.links;
for(var i=0; i<l.length; i++) {
arr.push(l[i].href);
}
var publish_count = 0;
//for (var url_checking in arr){
arr.forEach(function (url_checking, index) {
if (url_checking.includes("teacher/assignments")){
var split_url = url_checking.split("teacher/assignments/")[1].split("/edi")[0];
var url_to_post = "https://repl.it/data/teacher/assignments/" + split_url + "/publish";
$.post(url_to_post) ;
publish_count = publish_count + 1;
}
});
alert("Published a total of " + publish_count + " activities")
location.reload();
}
publisher()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment