CodingBat FULL cheat - codingbat.com

Fake stars and check mark, auto fetch answer in github raw

当前为 2020-05-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name CodingBat FULL cheat - codingbat.com
  3. // @namespace SaigyoujiYuyuko233
  4. // @match https://codingbat.com/python/*
  5. // @match https://codingbat.com/python
  6. // @match https://codingbat.com/prob/*
  7. // @grant none
  8. // @version 1.0
  9. // @author SaigyoujiYuyuko233
  10. // @description Fake stars and check mark, auto fetch answer in github raw
  11. // @require http://code.jquery.com/jquery-3.4.1.min.js
  12. // ==/UserScript==
  13.  
  14. let answer = new Map()
  15.  
  16. // python - logic - 1
  17. answer.set('p191645', "https://raw.githubusercontent.com/diezguerra/codingbat-python-solutions/master/list-1.py")
  18. answer.set('p195669', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/cigar_party.py");
  19. answer.set('p129125', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/date_fashion.py");
  20. answer.set('p135815', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/squirrel_play.py")
  21. answer.set('p137202', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/caught_speeding.py")
  22. answer.set('p119867', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/alarm_clock.py")
  23. answer.set('', "")
  24. answer.set('', "")
  25. answer.set('', "")
  26. answer.set('', "")
  27. answer.set('', "")
  28. answer.set('', "")
  29.  
  30.  
  31. $("img[src='/c1.jpg']").each(function (n, el){
  32. $(el).attr("src", "/c2.jpg");
  33. });
  34.  
  35. $("img[src='/s1.jpg']").each(function (n, el){
  36. $(el).attr("src", "/s2.jpg");
  37. });
  38.  
  39. let url = window.location.href;
  40. if (url.includes("prob") == true) {
  41. let problemID = url.split("/")[4];
  42. let problemAnswerUrl = answer.get(problemID);
  43. if (problemAnswerUrl == undefined) {
  44. console.log("No answer for question: " + problemID);
  45. return;
  46. }
  47. console.log("answer: " + problemAnswerUrl);
  48. let ret = $.ajax({
  49. url: problemAnswerUrl,
  50. method: "GET",
  51. async: false
  52. });
  53. let responseAnswer = ret.responseText;
  54. editor.setValue(responseAnswer);
  55. }