<commit_before><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Cuddly Assassin</title>
    <link rel="stylesheet" href="./css/main.css">
    <link rel="stylesheet" href="./css/leagueoflegendsmain.css">
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script>
</head>

<body>
    
    <div id="sideBarNav" class="sideBarNav">
        <div id="wrapper">
            <div id="header">LOL Stat Tools</div>
        </div>
        <ul style="list-style-type:none">
            <a id="recentGameStatsLink" href="#">
                <li class="listItem">Home</li>
            </a>
            <a id="currentGameLink" href="../CurrentGame/currentgamestats.php">
                <li class="listItem">Current Game</li>
            </a>
        </ul>
    </div>
    <div id="statsContainer">
        <!-- Filter champs with this container! -->
        <div id="champSelectContainer" class="container">
            <table id="championFilters" style="text-align:left">
                <tr>
                    <td style="font-size:20px"><div id="LOLStatsFormDiv" style="height: 50px;">
                <legend id="recentGamesLegend">Summoner ID:</legend>
                <input type=text id="summonerName" type="submit"  onKeyDown="if(event.keyCode==13) getStats();">
            </div></td>
                </tr> 
                <tr>
                    
                    <th style="font-size:20px">Group Selection</th>
                    <th style="font-size:20px">Champions</th>
                </tr> 
                <tr> 
                    <td>
                        <select onclick="setChampions()" onKeyDown="if(event.keyCode==13) setChampions();" style="position:relative" size="10" id="groupSelectList" multiple="multiple">
                            <option value="">Choose And Select More</option>
                            <option value="22,51,42,119,81,104,222,429,96,236,133,15,18,29,110,67">Marksman</option>
                            <option value="">Tank</option>
                            <option value="">Support</option>
                            <option value="">Mage</option>
                            
                        </select>
                    </td>
                    <td><select onclick="getStats()" onKeyDown="if(event.keyCode==13) getStats();" style="position:relative" size="10" id="championSelectList" multiple="multiple"></select></td>
                </tr> 
            </table>
        </div>

        <div id="summonerStats" style="display:none" class="container">
            <div id="displayStats" style="display:none">
                <div id="summonerGameAveragesTitle"></div>
                    
                    <table id="summonerGameAveragesTable" class="statstable">
                        <tr>
                            <th id="sumGameAvgTableGameType" class="sumGameAvgTableHeader"></th>
                            <th id="sumGameAvgTableWins"     class="sumGameAvgTableHeader"></th>
                            <th id="sumGameAvgTableLosses"   class="sumGameAvgTableHeader"></th>
                            <th id="sumGameAvgTableWinLoss"  class="sumGameAvgTableHeader"></th>
                        </tr> 
                        <tr>
                            <td id="AVGKills"></td>
                            <td id="AVGDeaths"></td>
                            <td id="AVGAssists"></td>
                            <td id="AVGKDA"></td>
                        </tr> 
                        <tr>
                            <td id="AVGDoubles"></td>
                            <td id="AVGTriples"></td>
                            <td id="AVGQuadras"></td>
                            <td id="AVGPentas"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGDamageToChamps" class="statstable">
                        <tr>
                            <th colspan="3">Damages Given (DTC - Damage To Champions)</th>
                        </tr>
                        <tr>
                            <td id="AVGTotalDTC"></td>
                            <td id="AVGPhysicalDTC"></td>
                            <td id="AVGMagicDTC"></td>
                            <td id="AVGTrueDTC"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGDamageTFCChamps" class="statstable">
                        <tr>
                            <th colspan="3">Damages Taken (TFC - Taken From Champs)</th>
                        </tr>
                        <tr>
                            <td id="AVGPhysicalTFC"></td>
                            <td id="AVGMagicTFC"></td>
                            <td id="AVGTrueTFC"></td>
                            <td id="AVGTotalTFC"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGDamageCS" class="statstable">
                        <tr>
                            <th colspan="5">Creep SCORES!!</th>
                        </tr>
                        <tr>
                            <td id="AVGTotalMinions"></td>
                            <td id="AVGGoldEarned"></td>
                            
                        </tr>
                        <tr>
                            <td id="AVGTotalMonsters"></td>
                            <td id="AVGTeamMonsters"></td>
                            <td id="AVGEnemyMonsters"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGWards" class="statstable">
                        <tr>
                            <th colspan="4">WARDS!!</th>
                        </tr>
                        <tr>
                            <td id="AVGVWards"></td>
                            <td id="AVGSWards"></td>
                            <td id="AVGWardsPlaced"></td>
                            <td id="AVGWardsKilled"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGMisc" class="statstable">
                        <tr>
                            <th colspan="2">MISC!!</th>
                        </tr>
                        <tr>
                            <td id="AVGtowersDestroyed"></td>
                            <td id="AVGCCTime"></td>
                        </tr>    
                    </table>
            </div>
        </div>
        <div id="matchesContainer" class="container"></div>
    </div>


    <script>
        $(document).ready(function(){
            $.ajax({
                type: 'GET',
                url: 'https://global.api.pvp.net/api/lol/static-data/na/v1.2/champion?api_key=<KEY>',
                success: function(json){
                    var championArray = [];
                    for(var champion in json.data){
                        $('#championSelectList').append( $("<option></option>").attr("value", json.data[champion].id + " " ).text(champion) );
                        $( '<div style="display:hidden" id="' + json.data[champion].id + '">'+ champion +'</div>' ).appendTo( "#championSelectList" );
                    }
                    sortSelect(document.getElementById('championSelectList'));
                }
            });
        });
        function sortSelect(selElem) {
            var tmpAry = new Array();
            for (var i=0;i<selElem.options.length;i++) {
                tmpAry[i] = new Array();
                tmpAry[i][0] = selElem.options[i].text;
                tmpAry[i][1] = selElem.options[i].value;
            }
            tmpAry.sort();
            while (selElem.options.length > 0) {
                selElem.options[0] = null;
            }
            for (var i=0;i<tmpAry.length;i++) {
                var op = new Option(tmpAry[i][0], tmpAry[i][1]);
                selElem.options[i] = op;
            }
            return;
        }
        //Method to set champions selected based on group selection box.
        function setChampions(){
            
            console.log("working");
            var championsSelected = $('select#groupSelectList').val();
            console.log(championsSelected);
            var splitListOfChampions = championsSelected.toString().split(",");
            console.log(splitListOfChampions);
            for(i = 0; i < splitListOfChampions.length; i++){
                $('#championSelectList option[value="' + splitListOfChampions[i] + ' "').prop("selected", true);
            }
            getStats();
        }
        function getStats(){
            $(document).ready(function(){
                $('#matchesContainer').empty();
                var summonerName = document.getElementById('summonerName').value;
                var sumIdNum;
                var CSVListOfChamps = $('select#championSelectList').val();
                var CSVChampsNoSpace = "";
                
                if(CSVListOfChamps != null){
                    CSVChampsNoSpace = CSVListOfChamps.toString().replace(/\s/g,"");
                }
                $.ajax({
                    type: 'GET',
                    url: 'https://na.api.pvp.net/api/lol/na/v1.4/summoner/by-name/' + summonerName + '?api_key=<KEY>',
                    success: function(data){
                        for(var key in data){
                            sumIdNum = key;
                        }<commit_msg>All of the group selection works so far.<commit_after><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Cuddly Assassin</title>
    <link rel="stylesheet" href="./css/main.css">
    <link rel="stylesheet" href="./css/leagueoflegendsmain.css">
    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script>
</head>

<body>
    
    <div id="sideBarNav" class="sideBarNav">
        <div id="wrapper">
            <div id="header">LOL Stat Tools</div>
        </div>
        <ul style="list-style-type:none">
            <a id="recentGameStatsLink" href="#">
                <li class="listItem">Home</li>
            </a>
            <a id="currentGameLink" href="../CurrentGame/currentgamestats.php">
                <li class="listItem">Current Game</li>
            </a>
        </ul>
    </div>
    <div id="statsContainer">
        <!-- Filter champs with this container! -->
        <div id="champSelectContainer" class="container">
            <table id="championFilters" style="text-align:left">
                <tr>
                    <td style="font-size:20px"><div id="LOLStatsFormDiv" style="height: 50px;">
                <legend id="recentGamesLegend">Summoner ID:</legend>
                <input type=text id="summonerName" type="submit"  onKeyDown="if(event.keyCode==13) getStats();">
            </div></td>
                </tr> 
                <tr>
                    
                    <th style="font-size:20px">Group Selection</th>
                    <th style="font-size:20px">Champions</th>
                </tr> 
                <tr> 
                    <td>
                        <select onclick="setChampions()" onKeyDown="if(event.keyCode==13) setChampions();" style="position:relative" size="10" id="groupSelectList" multiple="multiple">
                            <option value="">Choose And Select More</option>
                            <option value="22,51,42,119,81,104,222,429,96,236,133,15,18,29,110,67">Marksman</option>
                            <option value="412,78,14,111,2,86,27,57,12,122,77,89,150,254,39,106,20,102,36,113,8,154,421,120,19,72,54,75,58,31,33,83,98,201,5,44,32,48,59">Tank</option>
                            <option value="12,432,53,201,40,43,89,267,111,20,37,16,44,412,26,143">Support</option>
                            <option value="103, 84,34,1,268,63,69,131,3,79,74,30,38,55,10,85,7,127,99,90,25,76,61,68,13,50,134,4,45,161,112,8,101,115,26,143">Mage</option>
                            
                        </select>
                    </td>
                    <td><select onclick="getStats()" onKeyDown="if(event.keyCode==13) getStats();" style="position:relative" size="10" id="championSelectList" multiple="multiple"></select></td>
                </tr> 
            </table>
        </div>

        <div id="summonerStats" style="display:none" class="container">
            <div id="displayStats" style="display:none">
                <div id="summonerGameAveragesTitle"></div>
                    
                    <table id="summonerGameAveragesTable" class="statstable">
                        <tr>
                            <th id="sumGameAvgTableGameType" class="sumGameAvgTableHeader"></th>
                            <th id="sumGameAvgTableWins"     class="sumGameAvgTableHeader"></th>
                            <th id="sumGameAvgTableLosses"   class="sumGameAvgTableHeader"></th>
                            <th id="sumGameAvgTableWinLoss"  class="sumGameAvgTableHeader"></th>
                        </tr> 
                        <tr>
                            <td id="AVGKills"></td>
                            <td id="AVGDeaths"></td>
                            <td id="AVGAssists"></td>
                            <td id="AVGKDA"></td>
                        </tr> 
                        <tr>
                            <td id="AVGDoubles"></td>
                            <td id="AVGTriples"></td>
                            <td id="AVGQuadras"></td>
                            <td id="AVGPentas"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGDamageToChamps" class="statstable">
                        <tr>
                            <th colspan="3">Damages Given (DTC - Damage To Champions)</th>
                        </tr>
                        <tr>
                            <td id="AVGTotalDTC"></td>
                            <td id="AVGPhysicalDTC"></td>
                            <td id="AVGMagicDTC"></td>
                            <td id="AVGTrueDTC"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGDamageTFCChamps" class="statstable">
                        <tr>
                            <th colspan="3">Damages Taken (TFC - Taken From Champs)</th>
                        </tr>
                        <tr>
                            <td id="AVGPhysicalTFC"></td>
                            <td id="AVGMagicTFC"></td>
                            <td id="AVGTrueTFC"></td>
                            <td id="AVGTotalTFC"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGDamageCS" class="statstable">
                        <tr>
                            <th colspan="5">Creep SCORES!!</th>
                        </tr>
                        <tr>
                            <td id="AVGTotalMinions"></td>
                            <td id="AVGGoldEarned"></td>
                            
                        </tr>
                        <tr>
                            <td id="AVGTotalMonsters"></td>
                            <td id="AVGTeamMonsters"></td>
                            <td id="AVGEnemyMonsters"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGWards" class="statstable">
                        <tr>
                            <th colspan="4">WARDS!!</th>
                        </tr>
                        <tr>
                            <td id="AVGVWards"></td>
                            <td id="AVGSWards"></td>
                            <td id="AVGWardsPlaced"></td>
                            <td id="AVGWardsKilled"></td>
                        </tr>
                    </table>
                    <hr style="color:white">
                    <table id="summonerAVGMisc" class="statstable">
                        <tr>
                            <th colspan="2">MISC!!</th>
                        </tr>
                        <tr>
                            <td id="AVGtowersDestroyed"></td>
                            <td id="AVGCCTime"></td>
                        </tr>    
                    </table>
            </div>
        </div>
        <div id="matchesContainer" class="container"></div>
    </div>


    <script>
        $(document).ready(function(){
            $.ajax({
                type: 'GET',
                url: 'https://global.api.pvp.net/api/lol/static-data/na/v1.2/champion?api_key=<KEY>',
                success: function(json){
                    var championArray = [];
                    for(var champion in json.data){
                        $('#championSelectList').append( $("<option></option>").attr("value", json.data[champion].id + " " ).text(champion) );
                        $( '<div style="display:hidden" id="' + json.data[champion].id + '">'+ champion +'</div>' ).appendTo( "#championSelectList" );
                    }
                    sortSelect(document.getElementById('championSelectList'));
                }
            });
        });
        function sortSelect(selElem) {
            var tmpAry = new Array();
            for (var i=0;i<selElem.options.length;i++) {
                tmpAry[i] = new Array();
                tmpAry[i][0] = selElem.options[i].text;
                tmpAry[i][1] = selElem.options[i].value;
            }
            tmpAry.sort();
            while (selElem.options.length > 0) {
                selElem.options[0] = null;
            }
            for (var i=0;i<tmpAry.length;i++) {
                var op = new Option(tmpAry[i][0], tmpAry[i][1]);
                selElem.options[i] = op;
            }
            return;
        }
        //Method to set champions selected based on group selection box.
        function setChampions(){
        	$("#championSelectList option:selected").prop("selected", false)
            console.log("working");
            var championsSelected = $('select#groupSelectList').val();
            console.log(championsSelected);
            var splitListOfChampions = championsSelected.toString().split(",");
            console.log(splitListOfChampions);
            for(i = 0; i < splitListOfChampions.length; i++){
                $('#championSelectList option[value="' + splitListOfChampions[i] + ' "').prop("selected", true);
            }
            getStats();
        }
        function getStats(){
            $(document).ready(function(){
                $('#matchesContainer').empty();
                var summonerName = document.getElementById('summonerName').value;
                var sumIdNum;
                var CSVListOfChamps = $('select#championSelectList').val();
                var CSVChampsNoSpace = "";
                
                if(CSVListOfChamps != null){
                    CSVChampsNoSpace = CSVListOfChamps.toString().replace(/\s/g,"");
                }
                $.ajax({
                    type: 'GET',
                    url: 'https://na.api.pvp.net/api/lol/na/v1.4/summoner/by-name/' + summonerName + '?api_key=<KEY>',
                    success: function(data){
                        for(var key in data){
                            sumIdNum = key;
                        }
{'fraction_non_alphanumeric': 0.1431835491241432, 'fraction_numerical': 0.01838029956841838, 'mean_word_length': 1.2046115961495412, 'pattern_counts': {'":': 0, '<': 413, '<?xml version=': 0, '>': 409, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4753329', 'n_tokens_mistral': 5673, 'n_tokens_neox': 5218, 'n_words': 827}