NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Willi-5 // @namespace http://tampermonkey.net/ // @version 0.5 // @description Maha Will // @author You // @license MIT // @match *://*.sports.williamhill.com/betting/* // @grant GM_notification // @run-at document-end // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js // ==/UserScript== (function() { 'use strict'; var $ = window.jQuery; var strLink; // alert('hi'); // $(document).on('click touchstart', '.btn.betbutton.oddsbutton', function() { // alert('ok'); // event.stopPropagation(); // event.preventDefault(); // }); var test = $('<button width: 100%; height: 100%;>Run Me</button>').click(function () { Main(); }); $(".account-tab").append('<table><tr><td></td><td></td><td></td></tr><tr><td></td></tr></table>').find("td:first").append(test); var test1 = $('<button>odd</button>').click(function () { try { $('#burger-toggle').trigger('click'); $('.sidebar-navigation__name').each(function(i){ var statsValue = $(this).text(); if (statsValue.indexOf('Odds Format') >= 0) { // console.log('indise'); $(this).trigger('click'); } }); } catch(ex) { } }); $(".account-tab").find("td:first").append(test1); var test2 = $('<button width: 100%; height: 100%;>choose few</button>').click(function () { mainChoose(); }); $(".account-tab").find("td:first").append(test2); var tableTest; tableTest = "<table ID = 'tblParam' bgcolor='#00FF00' border='3'><TR>" + "<TD>Max?<input type='text' ID = 'txtMax' value='6' size='2'>cnt ? <input type='checkbox' ID = 'chkContinue' size='4'></TD>" + "<TD>. W?<select id='sltWhat'><option value='Over 0.5'>Over 0.5</option><option value='Over 1.5'>Over 1.5</option><option value='Over 2.5'>Over 2.5</option><option value='BTT'>Yes</option><option value='Under 1.5'>Under 1.5</option><option value='Under 2.5'>Under 2.5</option><option value='BTTNO'>No</option></select></TD>" + "<TD>frm<input type='text' ID = 'txtFromVal' value='1.10' size='3'>. To<input type='text' ID = 'txttoVal' value='1.25' size='3'></TD>" + "<TD>stke?<input type='text' ID = 'txtHowmuch' value='1.00' size='2'>low<input type='checkbox' ID = 'chkLow' size='4'></TD></TR></table>" $(".account-tab").find("td:last").append(tableTest); //"<TD>. S?<select id='sltSelect'><option value='blank'></option><option value='Over 0.5'>Over 0.5</option><option value='Over 1.5'>Over 1.5</option><option value='Over 2.5'>Over 2.5</option><option value='BTT'>Yes</option></select></TD></TR></table>" var strid; strid="a"; function mainChoose() { var strWhat; var strMinOdds; var strMaxOdds; var strHowmuch; var dataodds; strWhat = ""; var intCont; var intMax; intMax = 0; intCont = 1; intMax = parseInt(document.getElementById('txtMax').value); strWhat = $("#sltWhat option:selected").text(); strMinOdds = parseFloat(document.getElementById('txtFromVal').value).toFixed(2); strMaxOdds = parseFloat(document.getElementById('txttoVal').value).toFixed(2); strHowmuch = parseFloat(document.getElementById('txtHowmuch').value).toFixed(2); // alert(intMax); // alert(strWhat); // alert(strMinOdds); // alert(strMaxOdds); //alert($('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').val()); // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').focus(); // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').val("1.50"); // $('.o-btn.o-btn--primary.js-place-bet-button').trigger('click'); //alert('ih'); var storeelement; var eventID = ""; storeelement = ""; var buttonQuery = ""; var buttonQueryID = ""; var substr = ""; var odds = 0.00; var blnYes; var EventQuery = document.querySelectorAll(".event"); intCont = 0; if ($('#chkContinue').is(":checked")) { } else { strid = ""; } for (const buttons of EventQuery) { buttonQuery = ""; buttonQueryID = ""; substr = ""; odds = "0.00"; blnYes= "False"; eventID = $(buttons).attr('id'); buttons.querySelectorAll(".btn.betbutton.oddsbutton").forEach(function (elementButton, index) { // alert($(elementButton).attr('data-player')); // alert($(elementButton).attr('data-odds')); if ($('#chkLow').is(":checked")) { //,Un,Ye,No if (("OV , UN, YE ,NO ").toUpperCase().indexOf($(elementButton).attr('data-player').substr(0,2).toUpperCase()) > -1) { // alert($(elementButton).attr('data-player')); // alert(strid); if ((parseFloat($(elementButton).attr('data-odds')).toFixed(2) >= strMinOdds) && (parseFloat($(elementButton).attr('data-odds')).toFixed(2) <= strMaxOdds)) { if (strid.indexOf(eventID) < 0) { //alert('inside ;oop'); if (intCont <= intMax) { // alert($(elementButton).attr('data-player')); //alert($(elementButton).attr('data-player')); if (odds == 0.00) { odds = parseFloat($(elementButton).attr('data-odds')).toFixed(2); buttonQuery = $(elementButton); buttonQueryID = eventID; substr = $(elementButton).attr('data-player').substr(0,2).toUpperCase(); blnYes = "True"; } else { //alert('Odds: ' + odds + ' curr odds: ' + parseFloat($(elementButton).attr('data-odds'))); if ( parseFloat($(elementButton).attr('data-odds')) < odds) { odds = parseFloat($(elementButton).attr('data-odds')).toFixed(2); buttonQueryID = eventID; buttonQuery = $(elementButton); blnYes = "True"; } } } } } } } else { if ($(elementButton).attr('data-player') == strWhat) { if (strid.indexOf(eventID) < 0) { if ((parseFloat($(elementButton).attr('data-odds')).toFixed(2) >= strMinOdds) && (parseFloat($(elementButton).attr('data-odds')).toFixed(2) <= strMaxOdds)) { //$('#' + $(element).attr('id')).trigger('click'); //$(element).trigger('click'); if (intCont <= intMax) { $('span:first', $(elementButton)).trigger('click'); strid += "," +eventID; intCont = intCont + 1 } } } } } }); if ($('#chkLow').is(":checked")) { if (blnYes == "True") { blnYes= "False"; // // alert(strid); // alert('before click button query id: ' + buttonQueryID); // alert(intCont); // alert(intMax); if (intCont <= intMax) { // alert('inside trigger'); $('span:first', $(buttonQuery)).trigger('click'); strid += "," + eventID; intCont = intCont + 1 } } } } // document.querySelectorAll('.btn.betbutton.oddsbutton').forEach(function (element, index) // { // // $('span:first', $('#OB_OU2814100924')).trigger('click'); // // $('span:first', $('#OB_OU2814100924')).trigger('vclick'); // // $('span:first', $('#OB_OU2814100924')).trigger('tap'); // // $('span:first', $('#OB_OU2814100924')).trigger('touchstart'); // // $('span:first', $('#OB_OU2814100924')).click(); // // //alert('jiiiii'); // // $('#OB_OU2814100924').trigger('click'); // if ($(element).attr('data-player') == strWhat) // { // if ((parseFloat($(element).attr('data-odds')) >= strMinOdds) && (parseFloat($(element).attr('data-odds')) <= strMaxOdds)) // { // if (strid.indexOf($(element).closest("div").attr('id')) < 0) // { // //$('#' + $(element).attr('id')).trigger('click'); // //$(element).trigger('click'); // if (intCont <= intMax) // { // $('span:first', $(element)).trigger('click'); // strid += "," + $(element).closest("div").attr('id'); // intCont = intCont + 1 // } // } // } // //alert($(element).attr('data-player') + '---' + $(element).attr('data-odds')); // } // }); // // Place bet after selection // if (strHowmuch > 0) // { // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').focus(); // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').val(strHowmuch); // // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').val(strHowmuch).change(); // // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').trigger("change"); // // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').change(); // //alert('trigg'); // // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').keyup(); // // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').blur(); // //alert('mddet'); // var num; // num = 1000; // var check = function() // { // if(num == 5000) // { // // run when condition is met // //alert('met'); // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').removeAttr( "disabled" ); // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').attr('data-ng-init',strHowmuch); // // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').focus(); // // var e = $.Event("keydown", { keyCode: 20 }); // // $('#bets-container-multiples').find('.betslip-selection__stake-container').find('input:first').trigger( e ); // } // else // { // num = num + 1000; // //alert(num); // setTimeout(check, 1000); // check again in a second // } // } // check(); // $('.o-btn.o-btn--primary.js-place-bet-button').trigger('click'); // } } function Main() { // return false; document.querySelectorAll('.event').forEach(function (element, index) { // element.innerHTML = 'event ' + (index + 1); var strLink = "https://sports.williamhill.com/betting/en-gb/football/" + $(element).attr('id'); var availOptions; var vntMatchLink = element.getElementsByTagName('a')[1]; availOptions = $(vntMatchLink).text(); availOptions = availOptions.replace("+", ""); availOptions = availOptions.replace(" ", ""); // alert(availOptions); // if (availOptions > 10 ) // { GetValue(element,strLink, ".btmarket__selection"); // } // .querySelectorAll('[data-name='Yes']' }); // set odds to decimal function GetValue(strWheretoWrite, strReadLink, strReadAttribute) { var $ = window.jQuery; var temp; var strConcat; // alert('inside getvalue'); strConcat = strReadLink + " " + strReadAttribute; var div = $('<Div/>'); try { div.load(strReadLink + ' ' + strReadAttribute, function(){handle(div);}); return false; } catch(ex) { } // alert(strWheretoWrite.find('table').length); function handle(element) { var html; var a,b,c,d,e,f,g,h = "false"; var divT = $('<Table width="70%" border="3" cellspacing="0" cellpadding="4" data-name="myself"/>'); // alert($(element).html()); html = $.parseHTML($(element).html()); a = b = c = d = e = f = g = h = "false"; divT.append($('<tr>')); $.each( html, function( i, el ) { if ((el.innerHTML.indexOf('data-name="Over 1.5"') >= 0) && (a=="false")) { divT.append($('<td border="3">')); divT.append(el.innerHTML); divT.appendTo(strWheretoWrite); a="true"; divT.append($('</td>')); } if ((el.innerHTML.indexOf('data-name="Under 1.5"') >= 0) && (b=="false")) { divT.append($('<td border="3">')); divT.append(el.innerHTML); divT.appendTo(strWheretoWrite); b="true"; divT.append($('</td>')); } if ((el.innerHTML.indexOf('data-name="Over 2.5"') >= 0) && (c=="false")) { divT.append($('<td border="3">')); divT.append(el.innerHTML); divT.appendTo(strWheretoWrite); c="true"; divT.append($('</td>')); } if ((el.innerHTML.indexOf('data-name="Under 2.5"') >= 0) && (d=="false")) { divT.append($('<td border="3">')); divT.append(el.innerHTML); divT.appendTo(strWheretoWrite); d="true"; divT.append($('</td>')); } if ((el.innerHTML.indexOf('data-name="Yes"') >= 0) && (e=="false")) { divT.append($('<td border="3">')); divT.append(el.innerHTML); divT.appendTo(strWheretoWrite); e="true"; divT.append($('</td>')); } if ((el.innerHTML.indexOf('data-name="No"') >= 0) && (f=="false")) { divT.append($('<td border="3">')); divT.append(el.innerHTML); divT.appendTo(strWheretoWrite); f="true"; divT.append($('</td>')); } if ((el.innerHTML.indexOf('data-name="Over 0.5"') >= 0) && (g=="false")) { divT.append($('<td border="3">')); divT.append(el.innerHTML); divT.appendTo(strWheretoWrite); g="true"; divT.append($('</td>')); } // if ((el.innerHTML.indexOf('data-name="Over"') >= 0) && (g=="false")) // { // divT.append(el.innerHTML); // divT.appendTo(strWheretoWrite); // g="false"; // } // if ((el.innerHTML.indexOf('data-name="Under"') >= 0) && (g=="false")) // { // divT.append(el.innerHTML); // divT.appendTo(strWheretoWrite); // g="false"; // } }); divT.append($('</tr>')); // element.appendTo(strWheretoWrite); } } function HideDIVByID(strName) { var adSidebar = document.getElementById(strName); if (adSidebar) { adSidebar.parentNode.removeChild(adSidebar); } } } })();