Greasy Fork is available in English.

ATP TestScriptFunction

Test skriptu

אין להתקין סקריפט זה ישירות. זוהי ספריה עבור סקריפטים אחרים // @require https://update.greatest.deepsurf.us/scripts/483757/1305569/ATP%20TestScriptFunction.js

  1. function atpTourChecker() {
  2. 'use strict';
  3. var a = document.querySelectorAll('.stats-cta > a:nth-child(1)');
  4. var year = document.querySelector('.date-location > span:last-child').textContent.trim().match(/[0-9]{4}$/);
  5. var tourID = window.location.href.match(/\/([0-9]+)\//)[1];
  6. var tourTypeMatch = document.querySelector('.atp_draw > div > ul > li.active > a').textContent.trim();
  7. var tourType;
  8. if (tourTypeMatch == "Singles") {
  9. tourType = "ms";}
  10. if (tourTypeMatch == "Doubles") {
  11. tourType = "md";}
  12. if (tourTypeMatch == "Qual Singles") {
  13. tourType = "qs";}
  14. if (tourTypeMatch == "Qual Doubles") {
  15. tourType = "qd";}
  16.  
  17. var matchCount = a.length;
  18. var there_are_12 = ["008", "009", "010", "011", "012", "013", "014", "015", "004", "005", "006", "007"];
  19. var there_are_31 = ["016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026", "027", "028", "029", "030", "031", "008", "009", "010", "011", "012", "013", "014", "015", "004", "005", "006", "007", "002", "003", "001"];
  20. var there_are_63 = ["032", "033", "034", "035", "036", "037", "038", "039", "040", "041", "042", "043", "044", "045", "046", "047", "048", "049", "050", "051", "052", "053", "054", "055", "056", "057", "058", "059", "060", "061", "062", "063", "016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026", "027", "028", "029", "030", "031", "008", "009", "010", "011", "012", "013", "014", "015", "004", "005", "006", "007", "002", "003", "001"];
  21. var there_are_15 = ["008", "009", "010", "011", "012", "013", "014", "015", "004", "005", "006", "007", "002", "003", "001"];
  22. var there_are_3 = ["002", "003", "001"];
  23. var there_are_18 = ["016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026", "027", "008", "009", "010", "011", "012", "013"];
  24. var there_are_21 = ["016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026", "027", "028", "029", "009", "010", "011", "012", "013", "014", "015"];
  25. var there_are_36 = ["032", "033", "034", "035", "036", "037", "038", "039", "040", "041", "042", "043", "044", "045", "046", "047", "048", "049", "050", "051", "052", "053", "054", "055", "016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026", "027"];
  26. var there_are_127 = ["064", "065", "066", "067", "068", "069", "070", "071", "072", "073", "074", "075", "076", "077", "078", "079", "080", "081", "082", "083", "084", "085", "086", "087", "088", "089", "090", "091", "092", "093", "094", "095", "096", "097", "098", "099", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "032", "033", "034", "035", "036", "037", "038", "039", "040", "041", "042", "043", "044", "045", "046", "047", "048", "049", "050", "051", "052", "053", "054", "055", "056", "057", "058", "059", "060", "061", "062", "063", "016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026", "027", "028", "029", "030", "031", "008", "009", "010", "011", "012", "013", "014", "015", "004", "005", "006", "007", "002", "003", "001"];
  27.  
  28. var m12 = there_are_12.length
  29. var m31 = there_are_31.length
  30. var m63 = there_are_63.length
  31. var m15 = there_are_15.length
  32. var m3 = there_are_3.length
  33. var m18 = there_are_18.length
  34. var m21 = there_are_21.length
  35. var m36 = there_are_36.length
  36. var m127 = there_are_127.length
  37. var list;
  38. if (matchCount == m12) {
  39. list = there_are_12;}
  40. if (matchCount == m31) {
  41. list = there_are_31;}
  42. if (matchCount == m63) {
  43. list = there_are_63;}
  44. if (matchCount == m15) {
  45. list = there_are_15;}
  46. if (matchCount == m3) {
  47. list = there_are_3;}
  48. if (matchCount == m18) {
  49. list = there_are_18;}
  50. if (matchCount == m21) {
  51. list = there_are_21;}
  52. if (matchCount == m36) {
  53. list = there_are_36;}
  54. if (matchCount == m127) {
  55. list = there_are_127;}
  56.  
  57. for (var i = 0; i < matchCount; i++) {
  58. var value = "/en/scores/stats-centre/live/" + year + "/" + tourID + "/" + tourType + list[i];
  59. a[i].setAttribute("href", value);
  60. }
  61. }