// ==UserScript== // @name GLB HomePageRewrite Season 12+ - pabst fix // @namespace GLB // @author DDCUnderground // @description ReWrite Homepage to try to better utilize space script includes player links, next game spread, cash to homepage, contract expiration, training value and some other features. // @include http://glb.warriorgeneral.com/game/home.pl // @include http://glb.warriorgeneral.com/game/boost_player.pl // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js // @version 14.03.01 // @downloadURL https://update.greasyfork.icu/scripts/1339/GLB%20HomePageRewrite%20Season%2012%2B%20-%20pabst%20fix.user.js // @updateURL https://update.greasyfork.icu/scripts/1339/GLB%20HomePageRewrite%20Season%2012%2B%20-%20pabst%20fix.meta.js // ==/UserScript== // $(document).ready(function(){ //functions function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function buildsettingsdiv(){ var tablist = document.createElement('div'); tablist.setAttribute('class', 'tabs'); var tabhomeset = document.createElement('div'); tabhomeset.setAttribute('class', 'subtab_on'); tabhomeset.setAttribute('id', 'tabhomeset'); var tabhomesetlink = document.createElement('a'); tabhomesetlink.setAttribute('id','ddctablink'); tabhomesetlink.addEventListener('click', showsettings, false); tabhomesettextnode = document.createTextNode('Show Settings'); tabhomesetlink.appendChild(tabhomesettextnode); tabhomeset.appendChild(tabhomesetlink); var tabhomeset2 = document.createElement('div'); tabhomeset2.setAttribute('class', 'subtab_on'); tabhomeset2.setAttribute('id', 'tabhomeset2'); var tabhomeset2link = document.createElement('a'); tabhomeset2link.setAttribute('id','ddctablink'); tabhomeset2link.addEventListener('click', showsettings, false); tabhomeset2textnode = document.createTextNode('Hide Settings'); tabhomeset2link.appendChild(tabhomeset2textnode); tabhomeset2.appendChild(tabhomeset2link); tablist.appendChild(tabhomeset); tablist.appendChild(tabhomeset2); var homesetdiv = document.createElement('div'); homesetdiv.setAttribute('class', 'content_container'); homesetdiv.setAttribute('id', 'DDChomesetdiv'); //$("div[class*='medium_head']:eq(0)").prepend(homesetdiv); //$("div[class*='medium_head']:eq(0)").prepend(tablist); $('ul[id="modules"]').prepend(homesetdiv); $('ul[id="modules"]').prepend(tablist); var settable = document.createElement('table'); var rowhead0 = document.createElement('tr'); var cellhead01 = document.createElement('td'); settable.appendChild(rowhead0); rowhead0.appendChild(cellhead01); cellhead01.setAttribute('colspan', '2'); cellhead01.setAttribute('align','center'); cellhead01.innerHTML='Team Items
'; var row1 = document.createElement('tr'); var cell11 = document.createElement('td'); var cell12 = document.createElement('td'); var row2 = document.createElement('tr'); var cell21 = document.createElement('td'); var cell22 = document.createElement('td'); settable.appendChild(row1); row1.appendChild(cell11); row1.appendChild(cell12); var rowhead1 = document.createElement('tr'); var cellhead11 = document.createElement('td'); settable.appendChild(rowhead1); rowhead1.appendChild(cellhead11); cellhead11.setAttribute('colspan', '2'); cellhead11.setAttribute('align','center'); cellhead11.innerHTML='Boost Items
'; settable.appendChild(row2); row2.appendChild(cell21); row2.appendChild(cell22); cell11.setAttribute('width', '50%'); cell12.setAttribute('width', '50%'); cell21.setAttribute('width', '50%'); cell22.setAttribute('width', '50%'); var rowhead2 = document.createElement('tr'); var cellhead21 = document.createElement('td'); settable.appendChild(rowhead2); rowhead2.appendChild(cellhead21); cellhead21.setAttribute('colspan', '2'); cellhead21.setAttribute('align','center'); cellhead21.innerHTML='Player Items
'; var row3 = document.createElement('tr'); var cell31 = document.createElement('td'); var cell32 = document.createElement('td'); var row4 = document.createElement('tr'); var cell41 = document.createElement('td'); var cell42 = document.createElement('td'); settable.appendChild(row3); row3.appendChild(cell31); row3.appendChild(cell32); settable.appendChild(row4); row4.appendChild(cell41); row4.appendChild(cell42); cell31.setAttribute('width', '50%'); cell32.setAttribute('width', '50%'); cell41.setAttribute('width', '50%'); cell42.setAttribute('width', '50%'); var row5 = document.createElement('tr'); var cell51 = document.createElement('td'); var cell52 = document.createElement('td'); var row6 = document.createElement('tr'); var cell61 = document.createElement('td'); var cell62 = document.createElement('td'); settable.appendChild(row5); row5.appendChild(cell51); row5.appendChild(cell52); settable.appendChild(row6); row6.appendChild(cell61); row6.appendChild(cell62); cell51.setAttribute('width', '50%'); cell52.setAttribute('width', '50%'); cell61.setAttribute('width', '50%'); cell62.setAttribute('width', '50%'); var row7 = document.createElement('tr'); var cell71 = document.createElement('td'); var cell72 = document.createElement('td'); var row8 = document.createElement('tr'); var cell81 = document.createElement('td'); var cell82 = document.createElement('td'); settable.appendChild(row7); row7.appendChild(cell71); row7.appendChild(cell72); settable.appendChild(row8); row8.appendChild(cell81); row8.appendChild(cell82); var rowhead3 = document.createElement('tr'); var cellhead31 = document.createElement('td'); settable.appendChild(rowhead3); rowhead3.appendChild(cellhead31); cellhead31.setAttribute('colspan', '2'); cellhead31.setAttribute('align','center'); cellhead31.innerHTML='Homepage Items
'; cell71.setAttribute('width', '50%'); cell72.setAttribute('width', '50%'); cell81.setAttribute('width', '50%'); cell82.setAttribute('width', '50%'); var row9 = document.createElement('tr'); var cell91 = document.createElement('td'); var cell92 = document.createElement('td'); settable.appendChild(row9); row9.appendChild(cell91); row9.appendChild(cell92); cell91.setAttribute('width', '50%'); cell92.setAttribute('width', '50%'); cell91.setAttribute('align', 'left'); var rowhead4 = document.createElement('tr'); var cellhead41 = document.createElement('td'); settable.appendChild(rowhead4); rowhead4.appendChild(cellhead41); cellhead41.setAttribute('colspan', '2'); cellhead41.setAttribute('align','center'); cellhead41.innerHTML='Firefox Options
'; var row10 = document.createElement('tr'); var cell101 = document.createElement('td'); var cell102 = document.createElement('td'); var row11 = document.createElement('tr'); var cell111 = document.createElement('td'); var cell112 = document.createElement('td'); settable.appendChild(row10); row10.appendChild(cell101); row10.appendChild(cell102); settable.appendChild(row11); row11.appendChild(cell111); row11.appendChild(cell112); cell101.setAttribute('width', '50%'); cell102.setAttribute('width', '50%'); cell111.setAttribute('width', '50%'); cell112.setAttribute('width', '50%'); var row12 = document.createElement('tr'); var cell121 = document.createElement('td'); var cell122 = document.createElement('td'); var row13 = document.createElement('tr'); var cell131 = document.createElement('td'); settable.appendChild(row12); row12.appendChild(cell121); row12.appendChild(cell122); settable.appendChild(row13); row13.appendChild(cell131); cell121.setAttribute('width', '50%'); cell122.setAttribute('width', '50%'); cell131.setAttribute('colspan', '2'); cell131.setAttribute('align', 'center'); settable.setAttribute('cellpadding','3'); settable.setAttribute('cellspacing','3'); settable.setAttribute('width','90%'); var playerstatschk = document.createElement('input'); playerstatschk.setAttribute('type', 'checkbox'); playerstatschk.setAttribute('id', 'chk_playerstats'); var playerstatstext = document.createTextNode('Players Stats'); cell42.appendChild(playerstatschk); cell42.appendChild(playerstatstext); var teamlinkschk = document.createElement('input'); teamlinkschk.setAttribute('type', 'checkbox'); teamlinkschk.setAttribute('id', 'chk_teamlinks'); var teamlinkstext = document.createTextNode('Quick Links'); cell91.appendChild(teamlinkschk); cell91.appendChild(teamlinkstext); var showcontractschk = document.createElement('input'); showcontractschk.setAttribute('type', 'checkbox'); showcontractschk.setAttribute('id', 'chk_showcontracts'); var showcontractschktext = document.createTextNode('Contract Info'); cell41.appendChild(showcontractschk); cell41.appendChild(showcontractschktext); var boostschk = document.createElement('input'); boostschk.setAttribute('type', 'checkbox'); boostschk.setAttribute('id', 'chk_boosts'); var boostschktext = document.createTextNode('Available Boosts'); cell21.appendChild(boostschk); cell21.appendChild(boostschktext); var blueboxeschk = document.createElement('input'); blueboxeschk.setAttribute('type', 'checkbox'); blueboxeschk.setAttribute('id', 'chk_blueboxes'); var blueboxeschktext = document.createTextNode('Blue Box Display'); cell31.appendChild(blueboxeschk); cell31.appendChild(blueboxeschktext); var cashchk = document.createElement('input'); cashchk.setAttribute('type', 'checkbox'); cashchk.setAttribute('id', 'chk_cash'); var cashchktext = document.createTextNode('Player Cash'); cell32.appendChild(cashchk); cell32.appendChild(cashchktext); var sortchk = document.createElement('input'); sortchk.setAttribute('type', 'checkbox'); sortchk.setAttribute('id', 'chk_sort'); var sortchktext = document.createTextNode('Sort Players'); cell92.appendChild(sortchk); cell92.appendChild(sortchktext); var agechk = document.createElement('input'); agechk.setAttribute('type', 'checkbox'); agechk.setAttribute('id', 'chk_age'); var agechktext = document.createTextNode('Player Age'); cell81.appendChild(agechk); cell81.appendChild(agechktext); var teamspreadchk = document.createElement('input'); teamspreadchk.setAttribute('type', 'checkbox'); teamspreadchk.setAttribute('id', 'chk_teamspread'); var teamspreadchktext = document.createTextNode('Team Spread'); cell11.appendChild(teamspreadchk); cell11.appendChild(teamspreadchktext); var teamscolorschk = document.createElement('input'); teamscolorschk.setAttribute('type', 'checkbox'); teamscolorschk.setAttribute('id', 'chk_teamscolors'); var teamscolorschktext = document.createTextNode('Team Colors'); cell12.appendChild(teamscolorschk); cell12.appendChild(teamscolorschktext); var countdownchk = document.createElement('input'); countdownchk.setAttribute('type', 'checkbox'); countdownchk.setAttribute('id', 'chk_countdown'); var countdownchktext = document.createTextNode('Gametime Countdown'); cell101.appendChild(countdownchk); cell101.appendChild(countdownchktext); var famechk = document.createElement('input'); famechk.setAttribute('type', 'checkbox'); famechk.setAttribute('id', 'chk_fame'); var famechktext = document.createTextNode('Player Fame'); cell52.appendChild(famechk); cell52.appendChild(famechktext); var bonuschk = document.createElement('input'); bonuschk.setAttribute('type', 'checkbox'); bonuschk.setAttribute('id', 'chk_bonus'); var bonuschktext = document.createTextNode('Bonus Tokens'); cell61.appendChild(bonuschk); cell61.appendChild(bonuschktext); var vetpointschk = document.createElement('input'); vetpointschk.setAttribute('type', 'checkbox'); vetpointschk.setAttribute('id', 'chk_vetpoints'); var vetpointschktext = document.createTextNode('Veteran Points'); cell62.appendChild(vetpointschk); cell62.appendChild(vetpointschktext); var ratingsbarschk = document.createElement('input'); ratingsbarschk.setAttribute('type', 'checkbox'); ratingsbarschk.setAttribute('id', 'chk_ratingsbars'); var ratingsbarschktext = document.createTextNode('Rating Bars'); cell51.appendChild(ratingsbarschk); cell51.appendChild(ratingsbarschktext); var linksnewchk = document.createElement('input'); linksnewchk.setAttribute('type', 'checkbox'); linksnewchk.setAttribute('id', 'chk_linksnew'); var linksnewtext = document.createTextNode('Open Links in new Tab/Window'); cell111.appendChild(linksnewchk); cell111.appendChild(linksnewtext); cell121.innerHTML='

'; var savebutton = document.createElement('input'); savebutton.setAttribute('type', 'button'); savebutton.setAttribute('value','Save Settings'); savebutton.setAttribute('id','savebutton'); cell131.appendChild(savebutton); $('#DDChomesetdiv').append(settable); $('#DDChomesetdiv').hide(); $('#tabhomeset2').hide(); $('#savebutton').click(savesettings); $('input[id*="chk_"]','#DDChomesetdiv').change(checkchange); $('input[id*="chk_"]','#DDChomesetdiv').each(function(j){ if (settingsarray[j] == '1'){ $(this).attr('checked',true); }; }); checkchange(); } function checkchange(){ var teamcolors = $('input[id*="chk_"]:eq(1)','#DDChomesetdiv').attr('checked'); if (teamcolors==true) { $('input[id*="chk_"]:eq(3)','#DDChomesetdiv').attr('checked', ''); $('input[id*="chk_"]:eq(3)','#DDChomesetdiv').attr('disabled', 'disabled'); }else{ $('input[id*="chk_"]:eq(3)','#DDChomesetdiv').attr('disabled', ''); } var bluebox = $('input[id*="chk_"]:eq(3)','#DDChomesetdiv').attr('checked'); if (bluebox==true) { $('input[id*="chk_"]:eq(1)','#DDChomesetdiv').attr('checked', ''); $('input[id*="chk_"]:eq(1)','#DDChomesetdiv').attr('disabled', 'disabled'); }else{ $('input[id*="chk_"]:eq(1)','#DDChomesetdiv').attr('disabled', ''); } } function showsettings(){ var vision = $('#DDChomesetdiv').is(':hidden'); if (vision == true) { $('#tabhomeset').hide(); $('#tabhomeset2').show(); }else{ $('#tabhomeset2').hide(); $('#tabhomeset').show(); } $('#DDChomesetdiv').toggle(); } function savesettings(){ var cookstring =''; $('input[id*="chk_"]','#DDChomesetdiv').each(function(j){ if($(this).attr('checked')){ cookstring+='1,'; }else{ cookstring+='0,'; } }); cookstring = cookstring.substring(0,cookstring.length-1); createCookie('DDChome',cookstring,90); window.location.reload(); } function intvalue(a,b){ var x = parseInt(a[1]); var y = parseInt(b[1]); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); } function getBoosts(){ var script = document.createElement('script'); script.type = 'text/javascript'; script.text = "function GotoBoosts(playerid){document.cookie='boostid=' + playerid + '; expires=15/02/2010 00:00:00';window.location.href='http://glb.warriorgeneral.com/game/boost_player.pl';}"; document.body.appendChild(script); $.get("/game/multi_boost_player.pl",function(returned_data){ var boosttotal = 0; $('tr[class="alternating_color1"]', returned_data).each(function(t){ var playerlink = $('a[href*="/game/player.pl?player_id="]',$(this)).attr('href'); if ($('select',$(this)).size()>0) { var boostsavail = $('select',$(this)).attr('value'); var boosttext = $('select',$(this)).val(); boosttext = boosttext.substring(boosttext.indexOf(' - ')+3); var boostcost = parseInt(boosttext.substring(0,boosttext.indexOf(' '))); boosttotal+=boostcost; for (var z=0;z',playersinfo[z][7].indexOf('
')+23); var insertpoint = playersinfo[z][7].indexOf('
', (inspoint1))+6; var pre = playersinfo[z][7].substring(0, insertpoint); var post = playersinfo[z][7].substring(insertpoint); strholding = 'Boost(' + boostsavail + ') Cost:' + boostcost + ''; playersinfo[z][7] = pre + '
' + strholding + '
' + post; }; }; } }); /*var total = $('td[class="account_value"]:last').text(); total = total.substring(0,total.indexOf(' (')); */ var total = 0; $('td[class="account_value"]').each(function(j){ var selecttext = $(this).text(); if (selecttext.indexOf('spend') > 0) { total += parseInt(selecttext.substring(0,selecttext.indexOf(' ('))); } }) var newrow = document.createElement('tr'); var newcell1 = document.createElement('td'); var newcell2 = document.createElement('td'); newcell1.setAttribute('class','account_head'); newcell2.setAttribute('class','account_value'); newcell1.innerHTML = 'Boost Cost:'; newcell2.innerHTML = boosttotal; var newrow2 = document.createElement('tr'); var newcell21 = document.createElement('td'); var newcell22 = document.createElement('td'); newcell21.setAttribute('class','account_head'); newcell22.setAttribute('class','account_value'); newcell21.innerHTML = 'Remaining Flex:'; newcell22.innerHTML = parseInt(total) - parseInt(boosttotal); newrow.appendChild(newcell1); newrow.appendChild(newcell2); newrow2.appendChild(newcell21); newrow2.appendChild(newcell22); var insertpos = $('tr',$('#my_account_content')).size(); insertpos = insertpos - 2; $('tr:eq(' + insertpos + ')',$('#my_account_content')).before(newrow2); $('tr:eq(' + insertpos + ')',$('#my_account_content')).before(newrow); //$('tr:last',$('#my_account_content')).before(newrow); applyChanges(); }); } function getTeamSpreads(){ $('a[href*="/game/compare_teams.pl?team1="]').each(function(i){ teamslist[i] = new Array; teamslist[i][0] = $(this).attr('href'); teamslist[i][1] = teamslist[i][0].substr(teamslist[i][0].indexOf('team2=')+6,(teamslist[i][0].length - (teamslist[i][0].indexOf('team2=')+6))); teamslist[i][2] = ''; }) teamslist.sort(value); var pulllinks = new Array; pullhold = ''; for (var t=0;t 0) { spread = '+' + spread; } var overallstring = '(' + overall2 + ')' + '(' + spread + ')'; // add overallstring to all rows in teamslist array that match for (var z=0;z-1){ var part1 = playersinfo[wi][7].substring(0,playersinfo[wi][7].indexOf('(',playersinfo[wi][7].indexOf(teamslist[zz][0].replace(/&/g,'&')))); var part2 = playersinfo[wi][7].substring(playersinfo[wi][7].indexOf('(',playersinfo[wi][7].indexOf(teamslist[zz][0].replace(/&/g,'&')))); playersinfo[wi][7] = part1+ '' + teamslist[zz][2]+ ''+part2; break; }; }; }; applyChanges(); $('a[href*="/game/compare_teams.pl?team1="]', 'div[class="team"]').each(function(qw){ var thislink =$(this).html(); var teamlink = $(this).attr('href'); teamlink = teamlink.substr(teamlink.indexOf('team2=')+6,(teamlink.length - (teamlink.indexOf('team2=')+6))); for (var teamloop =0;teamloopoption').each(function(z){ $(this).show(); if ($(this).attr('value')==selecteditems) { $(this).hide(); } }) }else{ $('#DDCsort1>option').each(function(z){ $(this).show(); if ($(this).attr('value')==selecteditems) { $(this).hide(); } }) } } }); var sortstringlength = sortstring.length; sortstring = sortstring.substring(0,(sortstringlength-1)); createCookie('DDCSort',sortstring + ',' + sortdirection,90); sortitems = sortstring; playersinfo.sort(value); applyChanges(); } function getPlayersInfo(){ // retrieve player info for (var c=0;c',returned_data.indexOf('')+1,playersplit1[1].indexOf('<')); var playerarc = $('img[src*="/images/game/archetypes"]:first',returned_data).parent().html(); if (settingsarray[6]=='1') { var playersplit2= returned_data.split('stat_value_tall'); var StatsArray = new Array(14); var StatsNames = new Array(14); StatsNames[0] = 'Str:'; StatsNames[1] = 'Blk:'; StatsNames[2] = 'Spe:'; StatsNames[3] = 'Tac:'; StatsNames[4] = 'Agi:'; StatsNames[5] = 'Thr:'; StatsNames[6] = 'Jmp:'; StatsNames[7] = 'Cat:'; StatsNames[8] = 'Sta:'; StatsNames[9] = 'Car:'; StatsNames[10] = 'Vis:'; StatsNames[11] = 'Kic:'; StatsNames[12] = 'Con:'; StatsNames[13] = 'Pun:'; var attributes = new Array(16); attributes[0] = new Array(2); attributes[0][0] = new Array(5); attributes[0][0][0] = 0; attributes[0][0][1] = 5; attributes[0][0][2] = 10; attributes[0][0][3] = 12; attributes[0][0][4] = 8; attributes[0][1] = new Array(5); attributes[0][1][0] = 4; attributes[0][1][1] = 6; attributes[0][1][2] = 9; attributes[0][1][3] = 2; attributes[0][1][4] = 7; attributes[1] = new Array(2); attributes[1][0] = new Array(6); attributes[1][0][0] = 4; attributes[1][0][1] = 2; attributes[1][0][2] = 0; attributes[1][0][3] = 10; attributes[1][0][4] = 9; attributes[1][0][5] = 12; attributes[1][1] = new Array(5); attributes[1][1][0] = 7; attributes[1][1][1] = 1; attributes[1][1][2] = 6; attributes[1][1][3] = 5; attributes[1][1][4] = 8; attributes[2] = new Array(2); attributes[2][0] = new Array(4); attributes[2][0][0] = 0; attributes[2][0][1] = 1; attributes[2][0][2] = 4; attributes[2][0][3] = 9; attributes[2][1] = new Array(5); attributes[2][1][0] = 12; attributes[2][1][1] = 10; attributes[2][1][2] = 7; attributes[2][1][3] = 3; attributes[2][1][4] = 8; attributes[3] = new Array(2); attributes[3][0] = new Array(2); attributes[3][0][0] = 0; attributes[3][0][1] = 1; attributes[3][1] = new Array(5); attributes[3][1][0] = 12; attributes[3][1][1] = 4; attributes[3][1][2] = 10; attributes[3][1][3] = 3; attributes[3][1][4] = 8; attributes[4] = new Array(2); attributes[4][0] = new Array(3); attributes[4][0][0] = 0; attributes[4][0][1] = 1; attributes[4][0][2] = 12; attributes[4][1] = new Array(4); attributes[4][1][0] = 4; attributes[4][1][1] = 10; attributes[4][1][2] = 3; attributes[4][1][3] = 8; attributes[5] = new Array(2); attributes[5][0] = new Array(5); attributes[5][0][0] = 0; attributes[5][0][1] = 1; attributes[5][0][2] = 12; attributes[5][0][3] = 4; attributes[5][0][4] = 10; attributes[5][1] = new Array(2); attributes[5][1][0] = 3; attributes[5][1][1] = 8; attributes[6] = new Array(2); attributes[6][0] = new Array(4); attributes[6][0][0] = 0; attributes[6][0][1] = 1; attributes[6][0][2] = 7; attributes[6][0][3] = 10; attributes[6][1] = new Array(6); attributes[6][1][0] = 4; attributes[6][1][1] = 2; attributes[6][1][2] = 12; attributes[6][1][3] = 9; attributes[6][1][4] = 8; attributes[6][1][5] = 3; attributes[7] = new Array(2); attributes[7][0] = new Array(6); attributes[7][0][0] = 2; attributes[7][0][1] = 4; attributes[7][0][2] = 7; attributes[7][0][3] = 6; attributes[7][0][4] = 10; attributes[7][0][5] = 8; attributes[7][1] = new Array(2); attributes[7][1][0] = 12; attributes[7][1][1] = 9; attributes[8] = new Array(2); attributes[8][0] = new Array(3); attributes[8][0][0] = 0; attributes[8][0][1] = 3; attributes[8][0][2] = 4; attributes[8][1] = new Array(5); attributes[8][1][0] = 1; attributes[8][1][1] = 12; attributes[8][1][2] = 10; attributes[8][1][3] = 2; attributes[8][1][4] = 8; attributes[9] = new Array(2); attributes[9][0] = new Array(4); attributes[9][0][0] = 0; attributes[9][0][1] = 3; attributes[9][0][2] = 4; attributes[9][0][3] = 2; attributes[9][1] = new Array(5); attributes[9][1][0] = 1; attributes[9][1][1] = 12; attributes[9][1][2] = 10; attributes[9][1][3] = 6; attributes[9][1][4] = 8; attributes[10] = new Array(2); attributes[10][0] = new Array(6); attributes[10][0][0] = 0; attributes[10][0][1] = 10; attributes[10][0][2] = 3; attributes[10][0][3] = 4; attributes[10][0][4] = 12; attributes[10][0][5] = 8; attributes[10][1] = new Array(4); attributes[10][1][0] = 2; attributes[10][1][1] = 6; attributes[10][1][2] = 1; attributes[10][1][3] = 7; attributes[11] = new Array(2); attributes[11][0] = new Array(6); attributes[11][0][0] = 2; attributes[11][0][1] = 4; attributes[11][0][2] = 6; attributes[11][0][3] = 10; attributes[11][0][4] = 7; attributes[11][0][5] = 8; attributes[11][1] = new Array(4); attributes[11][1][0] = 0; attributes[11][1][1] = 3; attributes[11][1][2] = 12; attributes[11][1][3] = 9; attributes[12] = new Array(2); attributes[12][0] = new Array(5); attributes[12][0][0] = 0; attributes[12][0][1] = 2; attributes[12][0][2] = 10; attributes[12][0][3] = 3; attributes[12][0][4] = 8; attributes[12][1] = new Array(6); attributes[12][1][0] = 4; attributes[12][1][1] = 6; attributes[12][1][2] = 12; attributes[12][1][3] = 1; attributes[12][1][4] = 7; attributes[12][1][5] = 9; attributes[13] = new Array(2); attributes[13][0] = new Array(5); attributes[13][0][0] = 2; attributes[13][0][1] = 10; attributes[13][0][2] = 3; attributes[13][0][3] = 7; attributes[13][0][4] = 8; attributes[13][1] = new Array(6); attributes[13][1][0] = 4; attributes[13][1][1] = 6; attributes[13][1][2] = 0; attributes[13][1][3] = 12; attributes[13][1][4] = 1; attributes[13][1][5] = 9; attributes[14] = new Array(2); attributes[14][0] = new Array(2); attributes[14][0][0] = 11; attributes[14][0][1] = 12; attributes[14][1] = new Array(6); attributes[14][1][0] = 0; attributes[14][1][1] = 10; attributes[14][1][2] = 4; attributes[14][1][3] = 2; attributes[14][1][4] = 6; attributes[14][1][5] = 5; attributes[15] = new Array(2); attributes[15][0] = new Array(2); attributes[15][0][0] = 13; attributes[15][0][1] = 12; attributes[15][1] = new Array(6); attributes[15][1][0] = 0; attributes[15][1][1] = 10; attributes[15][1][2] = 4; attributes[15][1][3] = 2; attributes[15][1][4] = 6; attributes[15][1][5] = 5; for (var q=1;q')+1,playersplit2[q].indexOf('<')); } var htmlstringadd = ''; switch(playerposition) { case 'QB': htmlstringadd = ''; for (var w=0;w') + 8,playercash.indexOf(' ')); var playercontract = $('td[class*="vital_data"]:eq(3)',returned_data).text() playercontract = playercontract.substring(playercontract.indexOf('Exp. ')+5); var playerage = $('td[class*="vital_data"]:eq(2)',returned_data).text(); playerage = playerage.substring(1,playerage.indexOf('d old')); playerage = parseInt(playerage); var playermorale = $('div[class="rating_bar"]:last',returned_data).html() var playerscouting = ''; var playerscoutingbars = new Array; var playerscoutingheads = new Array; $('div[class="rating_head"]',$('#player_scouting_report',returned_data)).each(function(we){ playerscoutingheads.push($(this).html()); }); $('div[class="rating_bar"]',$('#player_scouting_report',returned_data)).each(function(we){ playerscoutingbars.push($(this).html()); }); for (var me =0; me')); playerscouting += '
' + playerscoutingbars[me].replace(' ','' + baramount + '
' + playerscoutingheads[me]) + '
'; }; var playerfame = $('.current_stats_fame',returned_data).text(); playerfame = playerfame.replace('$',''); // modify the HTML in [7] to be updated for (var te = 0; te < playersinfo.length;te++) { if (parseInt(curplayerid) == parseInt(playersinfo[te][0])) { //update array items for sorting playersinfo[te][11] = parseInt(shoppingtokens); playersinfo[te][15] = parseInt(bonustokens); playersinfo[te][19] = parseInt(playervetpts); playersinfo[te][20] = playerage; if (isNaN(parseInt(playervetpts))==true) { playersinfo[te][19] = 0; } //restructure player table var rowsplit = playersinfo[te][7].split(''); for (var re=0;reTeam:')>-1) { var teamcells = rowsplit[re].substring(0,rowsplit[re].indexOf('')); teamcells = teamcells.replace('',''); teamcells = teamcells.replace('',''); }; if (rowsplit[re].indexOf('Last Game:')>-1) { var lastcells = rowsplit[re].substring(0,rowsplit[re].indexOf('')); lastcells = lastcells.replace('Last Game:','Last:'); lastcells = lastcells.replace('',''); lastcells = lastcells.replace('',''); } if (rowsplit[re].indexOf('Next Game: ')>-1) { var nextcells = rowsplit[re].substring(0,rowsplit[re].indexOf('')); nextcells = nextcells.replace('Next Game:','Next:'); var cellsplit = nextcells.split(''); nextcells = cellsplit[0] + '' + cellsplit[1].replace('', '') + ''; } } var endcap = playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); playersinfo[te][7] = rowsplit[0]; if (settingsarray[12]=='1') { playersinfo[te][7] += rowsplit[1]; } if (typeof(lastcells)!='undefined') { playersinfo[te][7] += '' + teamcells + lastcells + ''; }else{ playersinfo[te][7] += '' + teamcells + ''; } if (typeof(nextcells)!='undefined'){ playersinfo[te][7] += '' + nextcells + ''; } playersinfo[te][7] += 'Energy:' + playersinfo[te][18] + 'Morale:' + playermorale + '' + endcap; if (settingsarray[10]=='1') { if (isNaN(parseInt(playervetpts))==false) { playersinfo[te][7] = playersinfo[te][7].replace('
',''); playervetpts = parseInt(playervetpts); var pre1 = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')); var post1 = playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); if (settingsarray[11]=='1') { playersinfo[te][7] = pre1+ 'Vet Pts:'+playervetpts+'Age:'+playerage+' Days' + post1; }else{ playersinfo[te][7] = pre1+ 'Vet Pts:'+playervetpts+'' + post1; } }else{ var pre1 = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')); var post1 = playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); if (settingsarray[11]=='1') { playersinfo[te][7] = pre1 + 'Age:'+playerage+' Days' + post1; } } }else{ var pre1 = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')); var post1 = playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); if (settingsarray[11]=='1') { playersinfo[te][7] = pre1 + 'Age:'+playerage+' Days' + post1; } } if (settingsarray[5]=='1') { var fontsize = 2; var lastcap = playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); if (playercontract.indexOf('(No Trade)')>-1) { fontsize = 1; } playersinfo[te][7] = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')) + 'Contract:' + playercontract + ''; if (settingsarray[8]=='1'){ playersinfo[te][7] += 'Fame:' + playerfame + '' + lastcap; } playersinfo[te][7] += lastcap; } if (settingsarray[6]=='1') { var pre1 = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')); var post1 = playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); playersinfo[te][7] = pre1 + '' + htmlstringadd + '' + post1; } if (settingsarray[7]=='1') { playersinfo[te][7] = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')) + '
Ratings:
' + playerscouting + '' + playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); } if (settingsarray[5]=='0' && settingsarray[8]=='1') { playersinfo[te][7] = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')) + 'Fame:' + playerfame + '' + playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); } if (settingsarray[12]=='1'){ playersinfo[te][7] = playersinfo[te][7].replace('Shop','Shop('+shoppingtokens+')'); if (settingsarray[9]=='1') { playersinfo[te][7] = playersinfo[te][7].replace('Bonus','Bonus('+bonustokens+')'); } }else{ if (settingsarray[9]=='1') { playersinfo[te][7] = playersinfo[te][7].substring(0,playersinfo[te][7].indexOf('')) + 'Bonus:' + bonustokens + '' + playersinfo[te][7].substring(playersinfo[te][7].indexOf('')); } } playersinfo[te][11] = shoppingtokens; playersinfo[te][15] = bonustokens; playersinfo[te][16] = htmlstringadd; if (settingsarray[4]=='1') { var inspoint1 = playersinfo[te][7].indexOf('
',playersinfo[te][7].indexOf('
')+23); var insertpoint = playersinfo[te][7].indexOf('
', (inspoint1))+6; var pre = playersinfo[te][7].substring(0, insertpoint); var post = playersinfo[te][7].substring(insertpoint); playersinfo[te][7] = pre + '
Cash:' + playercash + '
' + post; } if (typeof(playerarc)!= 'undefined') { var prearc = playersinfo[te][7].substring(0, playersinfo[te][7].indexOf('
')); var postarc = playersinfo[te][7].substring(playersinfo[te][7].indexOf('
'), playersinfo[te][7].length); playersinfo[te][7] = prearc + playerarc + postarc; } }; }; playercount++; if (playercount == playersinfo.length) { // update each player's html applyChanges(); buildsettingsdiv(); if (settingsarray[14] == '1') { window.setInterval(updateClocks,1000); } if (settingsarray[13] == '1') { buildSortDiv(); } } }); } } function resize() { $('div[class*="team_data"]').each(function(Y){ var stylestring = 'padding-bottom: 1px;padding-top: 1px;'; $('div',$(this)).each(function(P){ var divstyle2 ='margin-bottom: 1px;padding-top: 1px;padding-bottom: 1px;'; var divstyle = $(this).attr('style'); if (divstyle != null) { divstyle2 = divstyle + divstyle2; } var innerhtml = $(this).html(); $(this).html('' + innerhtml + ''); $(this).attr('style',divstyle2); }) $(this).attr('style',stylestring); }) $('div[class*="player_box_vet"]').each(function(Z){ var height = $('div[class*="player_left_side"]',$(this)).attr('offsetHeight'); $(this).children().each(function(zw){ var s = 0; if ($(this).attr('offsetHeight') != null) { s += $(this).attr('offsetHeight'); } if (s > height) { height = s; } }) height += lead; if (height>minheight) { minheight = height; } }); $('div[class*="player_box_vet"]').each(function(Z){ var newStyle = "height: "+minheight+"px;"; var style = $(this).attr("style"); if (typeof(style) != 'undefined') { if (style.indexOf('height: ')>-1) { var styleexistingheight = style.substring(style.indexOf('height: '),style.indexOf('px;',style.indexOf('height: ')+8)+3); style = style.replace(styleexistingheight,''); } if (style != null) { newStyle += style; } } $(this).attr("style",newStyle); }); } function updateClocks(){ $('a[href*="/game/compare_teams.pl?team1"]').each(function(QW){ var oldhtml = $(this).parent().html(); var time = oldhtml.substring(oldhtml.indexOf('(in ')+4,oldhtml.length-1); var hours = parseInt(time.substring(0,time.indexOf(':'))); var minsend = time.indexOf(':',time.indexOf(':')+1); var mins = parseInt(time.substring(time.indexOf(':')+1,minsend)); var secs = parseInt(time.substring(minsend+1)); secs = secs-1; if (secs<0) { mins = mins-1; secs=59; if (mins<0) { hours = hours-1; mins=59; } } var newtime = hours+':'+mins+':'+secs; var newhtml = oldhtml.replace(time,newtime); $(this).parent().html(newhtml); }) } function value(a,b) { var sortsplit = sortitems.split(','); var ahold =''; var bhold =''; for (var loop =0;loop b ? -1 : 1) } } function getTeamColors(){ // get list of teams in players and teams $('div[class="team"]').each(function(fr){ // copy teams colors for teams displaying teamcolors[fr]=new Array; teamcolors[fr][0] = $('a[href*="/game/team.pl?team_id="]',$(this)).attr('href'); teamcolors[fr][0] = teamcolors[fr][0].substring(teamcolors[fr][0].indexOf('team_id=')+8); var tempstyle = $(this).attr('style'); tempstyle = tempstyle.substring(tempstyle.indexOf('background:'), tempstyle.indexOf(')')+1); teamcolors[fr][1] = tempstyle; teamcolors[fr][2] = $('img[class="team_secondary_color"]', $(this)).attr('src'); teamcolors[fr][2] = teamcolors[fr][2].replace('../','/') teamcolors[fr][2] = teamcolors[fr][2].substring(teamcolors[fr][2].indexOf('secondary_')+10,teamcolors[fr][2].indexOf('.png')); teamcolors[fr][2] = teamcolors[fr][2].toUpperCase(); }) var teamcount = teamcolors.length; // get team profile page for pulling primary and secondary colors $('a[href*="/game/team.pl?team_id="]', $('#players')).each(function(ut){ var foundteam = 0; var teamid = $(this).attr('href'); teamid = teamid.substring(teamid.indexOf('team_id=')+8) for (var w=0;w0) { for (var te=0;te-1) { $(this).removeClass('content_container_sp'); $(this).addClass('content_container'); } if (settingsarray[3] == '1') { if (parseInt(playersinfo[z][9])>0 ) { $(this).addClass('content_container_sp'); $(this).removeClass('content_container'); } } if (settingsarray[1]=='1') { for (var team=0;team-1) { if (curstyle.indexOf('-moz-border-image:')==0) { curstyle=''; }else{ curstyle = curstyle.substring(0,curstyle.indexOf('-moz-border-image:')); } } if (settingsarray[11]=='1' || settingsarray[4]=='1' || settingsarray[5] =='1' || settingsarray[6]=='1' || settingsarray[7]=='1' || settingsarray[8]=='1' || settingsarray[9]=='1' || settingsarray[10]=='1') { curstyle += "-moz-border-image: url("+primaryurl+") 0;"; }else{ curstyle += "-moz-border-image: url("+primaryurl+") 0;"; } $(this).attr('style',curstyle); $(this).addClass('team'); $('table[class="player_vitals"]',$(this)).attr('style', 'background-color: rgb(220, 220, 220); opacity: 0.85;'); } } if (parseInt(playersinfo[z][17])==0) { var curstyle =$(this).attr('style'); if (typeof(curstyle)=='undefined') { curstyle=''; } if (curstyle.indexOf('-moz-border-image:')>-1) { if (curstyle.indexOf('-moz-border-image:')==0) { curstyle=''; }else{ curstyle = curstyle.substring(0,curstyle.indexOf('-moz-border-image:')); } } curstyle+="-moz-border-image: url('/images/game/design/team_cards/primary_white.png');"; $(this).attr('style',curstyle); $(this).addClass('team'); } } }) if (settingsarray[15] =='1') { $('a[href!="javascript:;"]','#players').attr('target','_blank'); $('a[href!="javascript:;"]','#players_teams').attr('target','_blank'); } resize(); } var sortitems =''; var sortdirection = 0; // settings var lead = 30; var minheight = 160; //if boost link clicked if (window.location.href=="/game/boost_player.pl") { var boostPlayer = readCookie("boostid"); if (boostPlayer!= null) { $('select[name*="player_id"] option[value="' + boostPlayer + '"]').attr('selected', 'selected'); document.cookie='boostid=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; //retrieve elements (to box, subject box, message box) from send pm page $('input:last').click(); } //if homepage }else{ var settingscookie = readCookie('DDChome'); $('#editControl').html(' '); if (settingscookie == null) { // build default settings // ;0=show team spread // ;1=showboosts // ;2=blueboxeson // ;3=showcash // ;4=showcontract // ;5=show player stats // ;6=ratings bars // ;7=show fame // ;8=show bonus // ;9=show vet points // ;10=quick links // ;11=show sort // ;12=do countdown settingscookie = '0,0,0,1,0,0,0,0,0,0,0,0,1,1,0,0'; } var settingsarray = settingscookie.split(','); var teamcolors = new Array; // retrieve team spread info var teamslist = new Array; if (settingsarray[0] =='1') { getTeamSpreads(); } if (settingsarray[1] =='1') { getTeamColors(); } // build player array //playersinfo(x,0) = playerid //playersinfo(x,1) = player name //playersinfo(x,2) = next game link //playersinfo(x,3) = team //playersinfo(x,4) = position //playersinfo(x,5) = level //playersinfo(x,6) = xp //playersinfo(x,7) = playercontent //playersinfo(x,8) = gameclock //playersinfo(x,9) = skillpoints //playersinfo(x,10) = training points //playersinfo(x,11) = shopping tokens //playersinfo(x,12) = Boost //playersinfo(x,13) = next game team //playersinfo(x,14) = vet xp //playersinfo(x,15) = bonus tokens //playersinfo(x,16) = stats //playersinfo(x,17) = teamid //playersinfo(x,18) = energy //playersinfo(x,19) = vetPoints //playersinfo(x,20) = player age //playersinfo(x,21) = Boost Cost var idlength = 0; var playersinfo = new Array; $('div[class*="player_box_vet"]').each(function(e){ // parse existing player info playersinfo[e] = new Array; var playerlink = $('a[href*="/game/player.pl?player_id="]',$(this)); playersinfo[e][0] = playerlink.attr('href'); playersinfo[e][0] = playersinfo[e][0].substring(playersinfo[e][0].indexOf('player_id=')+10,playersinfo[e][0].length); playersinfo[e][0] = parseInt(playersinfo[e][0]); playersinfo[e][1] = playerlink.text(); playersinfo[e][1] = playersinfo[e][1].toUpperCase(); var nextgame = $('a[href*="/game/compare_teams.pl?team1="]', $(this)); if (typeof(nextgame.attr('href')) !='undefined') { playersinfo[e][2] = nextgame.attr('href'); var nextgameparent = nextgame.parent(); playersinfo[e][8] = nextgameparent.html(); playersinfo[e][8] = playersinfo[e][8].substr(playersinfo[e][8].indexOf('(in ') + 4,(playersinfo[e][8].indexOf(')', playersinfo[e][8].indexOf('(in ') + 4) - (playersinfo[e][8].indexOf('(in ')+4))); playersinfo[e][8] = parseInt(playersinfo[e][8].replace(/:/g,'')); playersinfo[e][13] = nextgame.text(); playersinfo[e][13] = playersinfo[e][13].toUpperCase(); }else{ playersinfo[e][2] = ''; playersinfo[e][8] = 0; playersinfo[e][13] = ''; } playersinfo[e][3] = $('a[href*="/game/team.pl?team_id="]',$(this)).text(); playersinfo[e][17] = $('a[href*="/game/team.pl?team_id="]',$(this)).attr('href'); if (typeof(playersinfo[e][17])=='undefined') { playersinfo[e][17]='0000'; playersinfo[e][3]='None'; }else{ playersinfo[e][17] = playersinfo[e][17].substring(playersinfo[e][17].indexOf('team_id=')+8); } playersinfo[e][4] = $('div[class*="position"]',$(this)).text(); playersinfo[e][5] = $('div[class="simple_player_level"]',$(this)).text(); playersinfo[e][5] = parseInt(playersinfo[e][5].substring(playersinfo[e][5].indexOf('. ')+2)); playersinfo[e][6] = $('div[class="player_xp"]:first', $(this)).text(); playersinfo[e][6] = parseInt(playersinfo[e][6].substring(0,playersinfo[e][6].indexOf('/'))); playersinfo[e][14] = $('div[class="player_xp"]:last', $(this)).text(); playersinfo[e][14] = parseInt(playersinfo[e][14].substring(0,playersinfo[e][14].indexOf('/'))); playersinfo[e][18] = $('div[class="rating_bar"]',$(this)).html(); playersinfo[e][7] = $(this).html(); playersinfo[e][9] = $('#level_button_container',$(this)).text(); if (playersinfo[e][9].length ==0) { playersinfo[e][9] = '0'; } playersinfo[e][9] = parseInt(playersinfo[e][9]); playersinfo[e][10] = $('a[href*="/game/training.pl?player_id="]', $(this)).parent().text(); if (playersinfo[e][10].indexOf('(')>-1) { playersinfo[e][10] = playersinfo[e][10].substring(0,playersinfo[e][10].indexOf('(')); } if (playersinfo[e][10].length==0) { playersinfo[e][10] = '0'; } playersinfo[e][10] = parseInt(playersinfo[e][10]); playersinfo[e][11] = 0; playersinfo[e][15] = 0; playersinfo[e][16] = 0; playersinfo[e][12] = 0; playersinfo[e][19] = 0; playersinfo[e][20] = 0; playersinfo[e][21] = 0; if (settingsarray[12]=='1') { var inspoint1 = playersinfo[e][7].indexOf('', inspoint1) + 1; var pre = playersinfo[e][7].substring(0,insertpoint); var post = playersinfo[e][7].substring(insertpoint); playersinfo[e][7] = pre + 'EQ | Tactics | Forum | DC | Leaders | Train('+playersinfo[e][10]+') | Bonus | Shop' + post; var rowsplit = playersinfo[e][7].split(''); playersinfo[e][7] = ''; for (var wq=0;wqTrain Pts:')>-1) { rowsplit[wq] =''; }else{ playersinfo[e][7]+=rowsplit[wq] + ''; } } playersinfo[e][7] = playersinfo[e][7].substring(0, playersinfo[e][7].length - 4); if (e==0){ $('div[class="team"]').each(function(y){ var teamid = $('a[href*="/game/team.pl?team_id="]',$(this)).attr('href'); teamid = teamid.substring(teamid.indexOf('=')+1); var linksstring = 'Forum | Roster | DC | Leaders | Stadium | EQ | GMs | Loan | Offers | Tactics'; $('div[class*="team_data"]', $(this)).prepend(linksstring); }) $('div[class*="team_simple"]').each(function(y){ var teamid = $('a[href*="/game/team.pl?team_id="]',$(this)).attr('href'); teamid = teamid.substring(teamid.indexOf('=')+1); var linksstring = 'Forum | Roster | DC | Leaders | Stadium | EQ | GMs | Loan | Offers | Tactics'; $('div[class*="team_data"]', $(this)).prepend(linksstring); }) } } }); var playercount = 0; // retrieve boost info var boostsavail = new Array; if (settingsarray[2]=='1') { getBoosts(); }; if (settingsarray[11]=='1' || settingsarray[4]=='1' || settingsarray[5] =='1' || settingsarray[6]=='1' || settingsarray[7]=='1' || settingsarray[8]=='1' || settingsarray[9]=='1' || settingsarray[10]=='1') { getPlayersInfo(); }else{ applyChanges(); buildsettingsdiv(); if (settingsarray[14] == '1') { window.setInterval(updateClocks,1000); } if (settingsarray[13] == '1') { buildSortDiv(); } } } });