CodingBat FULL cheat - codingbat.com

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        CodingBat FULL cheat - codingbat.com
// @namespace   SaigyoujiYuyuko233
// @match       https://codingbat.com/python/*
// @match       https://codingbat.com/python
// @match       https://codingbat.com/prob/*
// @grant       none
// @version     1.0
// @author      SaigyoujiYuyuko233
// @description Fake stars and check mark, auto fetch answer in github raw
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==

let answer = new Map()

// python - logic - 1
answer.set('p191645', "https://raw.githubusercontent.com/diezguerra/codingbat-python-solutions/master/list-1.py")
answer.set('p195669', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/cigar_party.py");
answer.set('p129125', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/date_fashion.py");
answer.set('p135815', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/squirrel_play.py")
answer.set('p137202', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/caught_speeding.py")
answer.set('p119867', "https://raw.githubusercontent.com/snowpolar/codingbat-solutions/master/Python/Logic-1/alarm_clock.py")
answer.set('', "")
answer.set('', "")
answer.set('', "")
answer.set('', "")
answer.set('', "")
answer.set('', "")


$("img[src='/c1.jpg']").each(function (n, el){
  $(el).attr("src", "/c2.jpg");
});

$("img[src='/s1.jpg']").each(function (n, el){
  $(el).attr("src", "/s2.jpg");
});

let url = window.location.href;
if (url.includes("prob") == true) {
  let problemID = url.split("/")[4];
  let problemAnswerUrl = answer.get(problemID);
  
  if (problemAnswerUrl == undefined) {
    console.log("No answer for question: " + problemID);
    return;
  }
  
  console.log("answer: " + problemAnswerUrl);
  
  let ret = $.ajax({
    url: problemAnswerUrl,
    method: "GET",
    async: false
  });
  
  let responseAnswer = ret.responseText;
  editor.setValue(responseAnswer);
}