var teamid; var first_load = 0; var currentPage = ""; function initHeaderOverlay(currentPage) { /*var width = $(".cvEmbed").css('width'); width = width.substr(0,width.length-2); width = Math.ceil(width * .875); $(".cvEmbed iframe").css("height",width);*/ var descs = []; descs[0] = "The ShamSports Blog"; descs[1] = "The Player Database - Featuring information, stats, and observations about over 2,300 professional and collegiate players around the world"; descs[2] = "ShamSports 2017 NBA Manifesto"; descs[3] = "The Capulator - Salary Information and Manipulation For All 30 NBA Teams"; descs[4] = "About ShamSports - The Mission Statement"; descs[5] = "Follow ShamSports on Facebook"; descs[6] = "Follow ShamSports on Twitter"; descs[7] = "E-mail ShamSports"; var ul = document.getElementsByClassName("menu-item"); for(var i=0; i transactionsHeight) { $('#transactions').css('height',movesHeight); } else if(transactionsHeight > movesHeight) { $('#careerMoves').css('height',transactionsHeight); } } $(window).resize(function () { if(currentPage == " Player Profile") elemResize(); else if(currentPage == " Capulator") capulatorGUI.setMoveListMargin(); }); //var root = "127.0.0.1/~Jon/wordpress/"; var root = ""; var sort = []; sort[0] = {column:"last_name",status:""}; sort[1] = {column:"position",status:""}; sort[2] = {column:"height",status:""}; sort[3] = {column:"weight",status:""}; sort[4] = {column:"dob",status:""}; sort[5] = {column:"out_of",status:""}; sort[6] = {column:"country",status:""}; sort[7] = {column:"years",status:""}; sort[8] = {column:"obtained",status:""}; sort[9] = {column:"players.teamid",status:""}; function getList(type,parameter) { if(!type) type = 0; $.ajax({url:"http://"+root+"wp-content/themes/testTheme/getTeamList.php",type:"post",data:{func:1,type:type,parameter:parameter},dataType:"json",success:function(players) { document.getElementById("playerList").innerHTML = ""; for(var i=0; i 1) { var teamLink = row.appendChild(document.createElement("td")).appendChild(document.createElement("a")); teamLink.appendChild(document.createTextNode(players[i]["teamName"])); teamLink.href = "http://"+root+"rosterView?tid="+players[i]["teamid"]; } } }}); } function getQuote(init) { $.ajax({url:"http://"+root+"wp-content/themes/testTheme/getQuote.php",type:"post",data:{},dataType:"json",success:function(quote) { if(init == 1) document.getElementById("quoteInner").innerHTML = quote; else { $("#quoteInner").animate({'top':'-20px'},function() { document.getElementById("quoteInner").innerHTML = quote; $("#quoteInner").css('top','20px'); $("#quoteInner").animate({'top':'0px'}); }); } }}); } function quoteTimer() { getQuote(1); setInterval(getQuote,10000); } function addListeners(tid) { teamid = tid; if(teamid == -1) { document.getElementById("playerSearchBox").addEventListener("input",function() { if(document.getElementById("playerSearchBox").value != "") updateList(3); else document.getElementById("playerList").innerHTML = ""; }); loadSearch(); } /*document.getElementById("playersTypeBox").addEventListener("change",function(){ if(document.getElementById("playersTypeBox").value == 0) $('#playersLeagueBox').css('display','inline-block');}); document.getElementById("playersLeagueBox").addEventListener("change",function(){ if(document.getElementById("playersLeagueBox").value == 0) $('#playersTeamBox').css('display','inline-block'); getTeamList(); });*/ document.getElementById("last_name").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(0)); document.getElementById("position").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(1)); document.getElementById("height").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(2)); document.getElementById("weight").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(3)); document.getElementById("dob").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(4)); document.getElementById("out_of").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(5)); document.getElementById("country").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(6)); document.getElementById("years").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(7)); if(teamid > 0) { document.getElementById("obtained").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(8)); loadSort(1); } else if(teamid <= 0) { document.getElementById("players.teamid").addEventListener("click",function(x) { return function() { setSort(x,teamid); }; }(9)); } if(teamid == 0) { document.getElementById("countrySelect").addEventListener("change",function() { updateList(2); }); } } function setSort(column,teamid) { if(teamid > -2) { if(sort[column]["status"] == "") sort[column]["status"] = "asc"; else if(sort[column]["status"] == "asc") sort[column]["status"] = "desc"; else if(sort[column]["status"] == "desc") sort[column]["status"] = ""; var type; if(teamid > 0) type = 1; else if(teamid == 0) type = 2; else if(teamid == -1) type = 3; updateList(type); } var symbol = "" if(sort[column]["status"] == "asc") symbol = "+"; else if(sort[column]["status"] == "desc") symbol = "-"; document.getElementById(sort[column]["column"]).childNodes[1].childNodes[0].nodeValue = " "+symbol; } function getTeamList(type) { $.ajax({url:"http://"+root+"wp-content/themes/testTheme/getTeamList.php",type:"post",dataType:"json",data:{func:2,type:type},success:function(teams) { //var box = document.getElementById("playersTeamBox"); var panel = document.getElementById("teamOptions"); var heading; if(type == 1) heading = "NBA"; else if(type == 2) heading = "G-League"; else if(type == 3) heading = "International"; else if(type == 4) heading = "College/etc" panel.appendChild(document.createElement("div")).appendChild(document.createTextNode(heading)); for(var i=0; i 1) setSort(9,-2); } function updateListx(mode) { /*if(!sort) sort = "";*/ var type; if(mode == 1) type = 1; else if(mode == 2) { document.getElementById("playerSearchBox").value = ""; type = 2; } else if(mode == 3) { if(document.getElementById("playerSearchBox").value == "") type = 2; else type = 1; } var finalParams; var sortString = ""; if(type == 2) { var teamString = getTeamChecks(); var positionString = getPositionChecks(); if(positionString != "") finalParams = "("+teamString+") and ("+positionString+")"; else finalParams = teamString; } else finalParams = "first_name like '%"+document.getElementById("playerSearchBox").value+"%' or last_name like '%"+document.getElementById("playerSearchBox").value+"%'"; for(var i=2; i>=0; i--) { if(sort[i]["status"] != "") { if(sortString == "") sortString = "ORDER BY "; else sortString = sortString + ", "; sortString = sortString + sort[i]["column"] + " " + sort[i]["status"]; } } if(sortString != "") finalParams = finalParams + " " + sortString; if(teamString != "") getList(type,finalParams); else document.getElementById("playerList").innerHTML = ""; } function updateList(mode) { var finalParams = ""; var sortString = ""; for(var i=9; i>=0; i--) { if(sort[i]["status"] != "") { if(sortString == "") sortString = "ORDER BY "; else sortString = sortString + ", "; if(sort[i]["column"] == "height") { sortString = sortString + "feet " + sort[i]["status"] + ", inch " + sort[i]["status"]; } else if(sort[i]["column"] == "dob") { sortString = sortString + "year " + sort[i]["status"] + ", month " + sort[i]["status"] + ", date " + sort[i]["status"]; } else sortString = sortString + sort[i]["column"] + " " + sort[i]["status"]; } } if(sortString == "" && first_load == 0) { setSort(0,teamid); sortString = "last_name asc"; first_load = 1; } setSessionVars(sort,3); if(mode == 1) { finalParams = "teamid = " + teamid + " or secondaryteamid = "+teamid; if(sortString != "") finalParams = finalParams +" "+sortString; } else if(mode == 2) { var teamString = getTeamChecks(); var positionString = getPositionChecks(); getTeamChecks(1); getPositionChecks(1); setSessionVars(document.getElementById("countrySelect").value,6); /*if(teamString == "") teamString = "players.teamid = -1"; if(positionString != "") finalParams = "("+teamString+") and ("+positionString+") "+sortString; else finalParams = teamString + " " + sortString; finalParams = "("+teamString+")"; if(positionString != "") finalParams = finalParams + " and ("+positionString+")"; if(document.getElementById("countrySelect").value != -1) { finalParams = finalParams + " and country like '%" + document.getElementById("countrySelect").value + "%' "; } finalParams = finalParams + " " + sortString;*/ if(teamString != "") finalParams = "("+teamString+")"; if(positionString != "") { if(finalParams != "") finalParams = finalParams + " and "; finalParams = finalParams + "("+positionString+")"; } if(finalParams != "") { finalParams = finalParams + " and country like '%" + document.getElementById("countrySelect").value + "%'"; } else { if(document.getElementById("countrySelect").value != "") finalParams = "country like '%" + document.getElementById("countrySelect").value + "%'"; } if(finalParams == "") finalParams = "players.teamid = -1"; finalParams = finalParams + " " + sortString; } else if(mode == 3) { setSessionVars(document.getElementById("playerSearchBox").value,4); finalParams = "first_name like '%"+document.getElementById("playerSearchBox").value+"%' or last_name like '%"+document.getElementById("playerSearchBox").value+"%' or concat_ws(' ',first_name,last_name) like '%"+document.getElementById("playerSearchBox").value+"%'"; finalParams = finalParams + " "+sortString; } getList(mode,finalParams); } function getStats() { var x = document.getElementById("statFrame").contentDocument.body.scrollHeight; $("#statFrame").css("height",x); $("#statFrame").css("visibility","visible"); }