ATP TestScriptFunction

Test skriptu

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

function atpTourChecker() {
'use strict';
var a = document.querySelectorAll('.stats-cta > a:nth-child(1)');
var year = document.querySelector('.date-location > span:last-child').textContent.trim().match(/[0-9]{4}$/);
var tourID = window.location.href.match(/\/([0-9]+)\//)[1];
var tourTypeMatch = document.querySelector('.atp_draw > div > ul > li.active > a').textContent.trim();
var tourType;
if (tourTypeMatch == "Singles") {
tourType = "ms";}
if (tourTypeMatch == "Doubles") {
tourType = "md";}
if (tourTypeMatch == "Qual Singles") {
tourType = "qs";}
if (tourTypeMatch == "Qual Doubles") {
tourType = "qd";}

var matchCount = a.length;
var there_are_12 = ["008", "009", "010", "011", "012", "013", "014", "015", "004", "005", "006", "007"];
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"];
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"];
var there_are_15 = ["008", "009", "010", "011", "012", "013", "014", "015", "004", "005", "006", "007", "002", "003", "001"];
var there_are_3 = ["002", "003", "001"];
var there_are_18 = ["016", "017", "018", "019", "020", "021", "022", "023", "024", "025", "026", "027", "008", "009", "010", "011", "012", "013"];
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"];
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"];
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"];

var m12 = there_are_12.length
var m31 = there_are_31.length
var m63 = there_are_63.length
var m15 = there_are_15.length
var m3 = there_are_3.length
var m18 = there_are_18.length
var m21 = there_are_21.length
var m36 = there_are_36.length
var m127 = there_are_127.length
var list;
if (matchCount == m12) {
list = there_are_12;}
if (matchCount == m31) {
list = there_are_31;}
if (matchCount == m63) {
list = there_are_63;}
if (matchCount == m15) {
list = there_are_15;}
if (matchCount == m3) {
list = there_are_3;}
if (matchCount == m18) {
list = there_are_18;}
if (matchCount == m21) {
list = there_are_21;}
if (matchCount == m36) {
list = there_are_36;}
if (matchCount == m127) {
list = there_are_127;}

for (var i = 0; i < matchCount; i++) {
        var value = "/en/scores/stats-centre/live/" + year + "/" + tourID + "/" + tourType + list[i];
        a[i].setAttribute("href", value);
    }
}