Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. function grabData(targetUrl, storage_object, done_function) {
  2.  
  3. return Promise.resolve($.ajax(
  4. {
  5. type: "get",
  6. url: targetUrl,
  7. dataType: "html",
  8.  
  9. complete: function(data){done_function(data, object);}
  10. }));
  11. }
  12.  
  13. function makeBlurbs(data, subscription){
  14. console.log(data);
  15. var thisblurb = {};
  16.  
  17. thisblurb.worksblurbs = $(data.responseText).find("ol.work.index.group");
  18. thisblurb.seriesblurbs = $(data.responseText).find("ul.series.index.group");
  19.  
  20. if(!subscription.workspages){
  21. workspages = fetchAllPages($(data.responseText));
  22. workspages.shift();
  23. subscription.workspages = workspages;
  24. }
  25.  
  26. checkForDate(thisblurb, subscription);
  27. }
  28.  
  29.  
  30.  
  31. function getLastUpdate(subscription, nextPage = false)
  32. {
  33. baseUrl = "//archiveofourown.org/users/"+subscription.author+"/"+subscription.type[0];
  34. targetUrl = baseUrl;
  35. if(subscription.type[0] == ""){targetUrl += "works";}
  36. if(nextPage){targetUrl += "?page="+nextPage;}
  37.  
  38. data = grabData(targetUrl, subscription, makeBlurbs);
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement