NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name TotCor
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Maha totcor
// @author Maha
// @license MIT
// @match https://www.totalcorner.com/match/*
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
var $ = window.jQuery;
// Delete divs
HideDIV('navbar');
HideDIV('carousel-banner-container');
HideDIV('carousel-banner');
HideDIV('navbar-right.btn-group.pull-right');
// if (confirm("Run!"))
// {
// }
// else {
// return false;
// }
$('.container').empty();
// // add button
// $('.container').after($('<input type="button" value="test" class="RefreshMe">'));
// $(document).on('click', '.RefreshMe', function(){
// Main();
// })
Main();
function Main()
{
var isDelete;
var deletedRows = 0;
var tbl = document.getElementById('inplay_match_table');
var i;
//('#container').append('<table width="320" border="3"><tr><td colspan="2" rowspan="1">' + " wdw" + '</td></tr><tr><td width="118">' + "sxs" + '</td><td width="186">' + "xs" + '</td></tr></table>');
//for (i = tbl.rows.length - 1; i >= 3; i--)
// $('.container').load('https://www.totalcorner.com/match/corner-stats/83037923/ #place_bet_div');
// //$('#inplay_match_table').load('https://www.totalcorner.com/match/corner-stats/83037923/ #home_history_table');
// var temps = $('.container').children('table').first().empty();
// alert($(".container").find('table').length);
// temps.empty();
// return false;
$('.col-xs-12.col-sm-9').empty();
//$('.col-xs-12').empty();
$('.col-xs-12.col-sm-9').append('<table border="3" width=100% ID="MyTable" align="left"/>' );
$('.col-xs-12.col-sm-9 table').append($('#inplay_match_table tr')[0]);
for( i = 3; i < tbl.rows.length; i++ )
{
var vntTime;
var vntAttack;
var vntShots;
var vntCornerLink;
var vntScore;
//alert(i);
vntTime = tbl.rows[ i ].cells[ 3 ].innerText.trim();
vntTime = vntTime.replace( /\D+$/, '');
//alert(vntTime);
if (vntTime.substring(0, 2) == "Ha")
{
//tbl.rows[ i ].cells[ 3 ].innerText = '45';
tbl.rows[ i ].cells[ 3 ].getElementsByClassName('match_status_minutes')[0].textContent = '45';
vntTime = 45;
}
vntTime = vntTime.replace( /\D+$/, '');
vntAttack = tbl.rows[ i ].cells[ 11 ].getElementsByClassName('match_dangerous_attacks_div')[0].textContent;
vntShots = tbl.rows[ i ].cells[ 12 ].getElementsByClassName('match_shoot_div')[0].textContent;
vntCornerLink = tbl.rows[ i ].cells[ 14 ]
vntScore = tbl.rows[ i ].cells[ 5 ].innerText.trim()
var vntMatchLink = vntCornerLink.getElementsByTagName('a')[0];
//alert('before call');
isDelete = "False";
// if (vntTime > 79)
// {
// isDelete = "True";
// }
if (isDelete == "False")
{
try
{
var fieldsAttack = vntAttack.split('-');
var fieldsShots= vntShots.split('-');
//alert(fields);
var HomeAttack = fieldsAttack[0].trim();
var AwayAttack = fieldsAttack[1].trim();
var HomeShots = fieldsShots[0].trim();
var AwayShots = fieldsShots[1].trim();
}
catch(ex)
{
//alert('error');
HomeAttack = 0;
AwayAttack = 0;
HomeShots = 0;
AwayShots = 0;
}
try
{
var fieldsScore = vntScore.split('-');
var HomeScore = fieldsScore[0].trim();
var AwayScore = fieldsScore[1].trim();
}
catch(ex)
{
HomeScore = 0;
AwayScore = 0;
}
var blnWrite = 'False';
if (HomeAttack>0 && AwayAttack>0)
{
//alert('yes');
var diff;
var diffShot;
var existScore;
diff = parseInt(HomeAttack) - parseInt(AwayAttack);
diffShot = parseInt(HomeShots) - parseInt(AwayShots);
existScore = tbl.rows[ i ].cells[ 5 ].innerText;
HomeScore = parseInt(HomeScore);
AwayScore = parseInt(AwayScore);
//alert(diffShot);
//alert(existScore);
tbl.rows[ i ].cells[ 2 ].innerText = existScore + ' ( ' + diff + ' ) ( ' + diffShot + ' )';
tbl.rows[ i ].cells[ 2 ].style.fontWeight = "900";
diff = parseInt(diff);
var vntColor;
if (diff > 7)
{
if (HomeScore > AwayScore)
{
vntColor = "Black"
tbl.rows[ i ].cells[ 2 ].innerText = "H Adv = " + tbl.rows[ i ].cells[ 2 ].innerText;
}
if (HomeScore == AwayScore)
{
vntColor = "MediumSeaGreen"
tbl.rows[ i ].cells[ 2 ].innerText = "H EQ = " + tbl.rows[ i ].cells[ 2 ].innerText;
blnWrite = 'True';
}
if (HomeScore < AwayScore)
{
vntColor = "Orange"
tbl.rows[ i ].cells[ 2 ].innerText = "H Beh = " + tbl.rows[ i ].cells[ 2 ].innerText;
blnWrite = 'True';
}
tbl.rows[ i ].cells[ 2 ].style.color = vntColor;
if (diff > 12)
{
tbl.rows[ i ].cells[ 2 ].innerText = "SS " + tbl.rows[ i ].cells[ 2 ].innerText;
}
}
else if (diff < -7)
{
if (HomeScore > AwayScore)
{
vntColor = "Orange"
tbl.rows[ i ].cells[ 2 ].innerText = "A Beh = " + tbl.rows[ i ].cells[ 2 ].innerText;
blnWrite = 'True';
}
if (HomeScore == AwayScore)
{
vntColor = "MediumSeaGreen"
tbl.rows[ i ].cells[ 2 ].innerText = "A EQ = " + tbl.rows[ i ].cells[ 2 ].innerText;
blnWrite = 'True';
}
if (HomeScore < AwayScore)
{
vntColor = "Black"
tbl.rows[ i ].cells[ 2 ].innerText = "A Adv = " + tbl.rows[ i ].cells[ 2 ].innerText;
}
tbl.rows[ i ].cells[ 2 ].style.color = vntColor;
if (diff < -12)
{
tbl.rows[ i ].cells[ 2 ].innerText = "SS " + tbl.rows[ i ].cells[ 2 ].innerText;
}
}
else {
// tbl.rows[ i ].cells[ 2 ].innerText = ""
}
// tbl.rows[ i ].cells[ 11 ].getElementsByClassName('match_dangerous_attacks_div')[0].textContent = diff;
// tbl.rows[ i ].cells[ 11 ].getElementsByClassName('match_dangerous_attacks_half_div')[0].textContent = "";
//alert(diff);
// isDelete = "True";
// if (parseInt(diff) > 7 || parseInt(diff) < -7)
// {
// isDelete = "False";
// }
}
}
var firstLink = document.getElementsByClassName('text-center th_start_time')[0];
firstLink.style.width = "300px";
firstLink.style.fontWeight = "900";
firstLink = document.getElementsByClassName('text-center td_league')[0];
firstLink.style.width = "300px";
// Read individual odds
if (HomeAttack>0 && AwayAttack>0)
{
var div = $('<div/>');
// div.load(vntMatchLink + ' #place_bet_div', function(){handle(div);});
var currentRow = $('#inplay_match_table tr')[i];
var cellu = $(currentRow).find('td')[1];
var $celll = $(cellu);
$($(currentRow).find('td')[4]).css("font-size", "20px");
$($(currentRow).find('td')[3]).css("font-size", "15px");
$($(currentRow).find('td')[2]).css("font-size", "15px");
$($(currentRow).find('td')[1]).css("font-size", "15px");
$($(currentRow).find('td')[2]).css("width", "200px");
// $celll.load(vntMatchLink +" .table-bordered table-condensed-2 table tr:nth-child(3) td").text();
//$('.container').load(vntMatchLink +' .table-bordered.table-condensed-2:first-child');
//var wrap = $('<div/>').attr('id', 'container').text('adsfas adsf safda asdf asfd');
GetValue($celll,vntMatchLink ,".table-bordered.table-condensed-2:first-child tr:nth-child(2)");
//GetValue($celll,vntMatchLink ,".table-bordered.table-condensed-2:nth-child(4)");
//GetValue($celll,vntMatchLink ,".match-facts-pred");
//GetValue($celll,vntMatchLink ,".panel-body:first-child");
// get live oods
// alert($(vntMatchLink).attr('href'));
var LiveScor = 'https://www.totalcorner.com' + $(vntMatchLink).attr('href').replace("corner-stats", "odds-handicap");
// alert(LiveScor);
GetValue($celll,LiveScor ,"#odds_full tr:nth-child(2)");
var trClone;
//$tr = $(this).closest("tr").next().clone();
// trClone = $(currentRow).clone();
// $('.col-xs-12.col-sm-9 table').append(trClone);
if (blnWrite == 'True' && vntTime < 80)
{
$('.col-xs-12.col-sm-9 table').append($('#inplay_match_table tr')[i]);
}
}
if (isDelete == "True")
{
//alert(tbl.rows[ i ].cells[ 4 ].innerText);
var current_Row = $('#inplay_match_table tr')[i];
deletedRows = deletedRows + 1;
// current_Row.closest('tr').remove();
// current_Row.remove();
//tbl.deleteRow(i);
}
//firstLink.setAttribute('class', 'match_dangerous_attacks_div');
//replaceClass();
// var testDel = document.getElementsByClassName('text-center th_live')[0];
// testDel.parentNode.removeChild(testDel);
}
// alert(deletedRows);
function GetValue(strWheretoWrite, strReadLink, strReadAttribute)
{
var $ = window.jQuery;
var temp;
var strConcat;
// alert('inside getvalue');
strConcat = strReadLink + " " + strReadAttribute;
var div = $('<Div/>');
div.load(strReadLink + ' ' + strReadAttribute, function(){handle(div);});
// alert(strWheretoWrite.find('table').length);
function handle(element)
{
$(element).css('border', '1px solid black');
element.appendTo(strWheretoWrite);
}
}
// remove unwanted cols
$('.col-xs-12.col-sm-9 table tr').each(function(){
//$(this).children('td').eq(14).remove();
$(this).children('td').eq(13).remove();
$(this).children('td').eq(10).remove();
$(this).children('td').eq(9).remove();
$(this).children('td').eq(7).remove();
$(this).children('td').eq(0).remove();
$(this).children('th').eq(13).remove();
$(this).children('th').eq(10).remove();
$(this).children('th').eq(9).remove();
$(this).children('th').eq(7).remove();
$(this).children('th').eq(0).remove();
});
$('#inplay_match_table tr').each(function(){
//$(this).children('td').eq(14).remove();
$(this).children('td').eq(13).remove();
$(this).children('td').eq(10).remove();
$(this).children('td').eq(9).remove();
$(this).children('td').eq(7).remove();
$(this).children('td').eq(0).remove();
//$(this).children('th').eq(14).remove();
$(this).children('th').eq(13).remove();
$(this).children('th').eq(10).remove();
$(this).children('th').eq(9).remove();
$(this).children('th').eq(7).remove();
$(this).children('th').eq(0).remove();
});
// $("th").click(function(){
// var theLink = $(this).text();
// // alert(theLink);
// // sortTable(1);
// });
}
function HideDIV(strName)
{
var adSidebar = document.getElementById(strName);
if (adSidebar) {
adSidebar.parentNode.removeChild(adSidebar);
}
}
})();