MineGeekYT / Fancy ReshuEGE

// ==UserScript==
// @name         Fancy ReshuEGE
// @namespace    https://github.com/MineGeekYT
// @version      0.2
// @description  Tired of doing ur homework? Check this!
// @author       MineGeekYT
// @match 		 *ege.sdamgia.ru/test*
// @grant        none
// ==/UserScript==

var a = document.getElementsByClassName("prob_maindiv nobreak");
url = document.URL;
n = url.indexOf(".ege.sdamgia.ru");
url = url.slice(7,n);
site1 = "<a target='_blank' href='http://"+url+".ege.sdamgia.ru/problem?id=";
site2 = "'>Click for answer</a>";
for (i = 0; i < a.length; ++i) {
  //alert(site1+a[i].id+site2);
  k = a[i].id.length;
  a[i].innerHTML = a[i].innerHTML + site1 + a[i].id.slice(7, k) + site2;
}