<commit_before>
$(function(){
   /* Get the topics to show in the global page. the success function
   parses the topics into the vis.js format, when the relevant topics are successfully
   retrieved from the server.
   */
    $.ajax({
        url: 'getHotTopics/-1',
        type: 'GET',
        dataType: 'json',
        success: function (data) {
            var json_array = data;
            console.log(data)
            // create an array with nodes


            var maxHot = json_array[0].hotness;// the first element is the topic with maximum hotness
            var minHot = json_array[json_array.length-1].hotness;//the last element is the least hot topic
            var range = maxHot- minHot;
            var dict1 = [];

            /*
            The for loop to parse the topic nodes in vis.js
            */
            for(var i = 0; i < json_array.length; i++){
              var topicHot = json_array[i].hotness;//scale the hotness
              var seed = (topicHot-minHot)/range;//find a seed using the hotness
              console.log("seed: "+seed);

              //generate colors using the seed
              var red = Math.round(seed*255);
              var green = Math.max(Math.round((1-seed)*50),0);
              var blue = Math.round((1-seed)*255);

              //generate vis.js dictionary
              dict1.push({id: json_array[i]['id'] ,value:seed, font:{face:'Luckiest Guy',color:'rgb(255,255,255)'},
              label: json_array[i]['name'].split(" ").join("\n"),color:'rgb('+red+','+green+','+blue+')'});
            }

            var nodes = new vis.DataSet(dict1);

            // create an array with edges
            var dict2 = [];
            for(var i = 0; i < json_array.length; i++){
              // this code will be replaced ..............
              console.log("topicc "+json_array[i].name);
              for(var j = 0; j < json_array[i]['relates_to'].length; j++){

                var topicHot = json_array[i].hotness;



                relatedTopicId = json_array[i]['relates_to'][j]['topic_to'];

                  //related topic in hotness ını alıyor(json_arrayinin içinden bu topic için search)
                  for(var k = 0; k < json_array.length; k++){
                    if(relatedTopicId == json_array[k].id){
                      //console.log("related topic   "+json_array[k].name);
                      if(json_array[k].hotness > topicHot){
                        topicHot = json_array[k].hotness;
                      }
                      break;
                    }
                  }

                  var seed = (topicHot-minHot)/range;
                  //length of arrow
                  console.log(seed);
                  var arrow_length = Math.round((1-seed)*300+200);

                  console.log(arrow_length);

                  //add edges to the dictionary
                  dict2.push({ from: json_array[i]['relates_to'][j]['topic_from'], to: json_array[i]['relates_to'][j]['topic_to'], arrows:'to',label:json_array[i]['relates_to'][j]['label'],length: arrow_length ,value:seed});<commit_msg>ui improve<commit_after>
$(function(){
   /* Get the topics to show in the global page. the success function
   parses the topics into the vis.js format, when the relevant topics are successfully
   retrieved from the server.
   */
    $.ajax({
        url: 'getHotTopics/-1',
        type: 'GET',
        dataType: 'json',
        success: function (data) {
            var json_array = data;
            console.log(data)
            // create an array with nodes


            var maxHot = json_array[0].hotness;// the first element is the topic with maximum hotness
            var minHot = json_array[json_array.length-1].hotness;//the last element is the least hot topic
            var range = maxHot- minHot;
            var dict1 = [];

            /*
            The for loop to parse the topic nodes in vis.js
            */
            for(var i = 0; i < json_array.length; i++){
              var topicHot = json_array[i].hotness;//scale the hotness
              var seed = (topicHot-minHot)/range;//find a seed using the hotness


              //generate colors using the seed
              var red = Math.round(seed*255);
              var green = Math.max(Math.round((1-seed)*50),0);
              var blue = Math.round((1-seed)*255);

              //generate vis.js dictionary
              dict1.push({id: json_array[i]['id'] ,value:seed, font:{face:'Luckiest Guy',color:'rgb(255,255,255)'},
              label: json_array[i]['name'].split(" ").join("\n"),color:'rgb('+red+','+green+','+blue+')'});
            }

            var nodes = new vis.DataSet(dict1);

            // create an array with edges
            var dict2 = [];
            for(var i = 0; i < json_array.length; i++){
              // this code will be replaced ..............

              for(var j = 0; j < json_array[i]['relates_to'].length; j++){

                var topicHot = json_array[i].hotness;

                var relatedTopicId = json_array[i]['relates_to'][j];

                  //related topic in hotness ını alıyor(json_arrayinin içinden bu topic için search)
                  for(var k = 0; k < json_array.length; k++){
                    if(relatedTopicId == json_array[k].id){
                      //console.log("related topic   "+json_array[k].name);
                      if(json_array[k].hotness > topicHot){
                        topicHot = json_array[k].hotness;
                      }
                      break;
                    }
                  }

                  var seed = (topicHot-minHot)/range;
                  //length of arrow
                  var arrow_length = Math.round((1-seed)*300+200);
                  console.log(seed);
                  //add edges to the dictionary
                  dict2.push({ from: json_array[i].id, to: json_array[i]['relates_to'][j], arrows:'to',label:json_array[i]['relates_to'][j]['label'],length: arrow_length ,value:seed});
{'fraction_non_alphanumeric': 0.1344077089217478, 'fraction_numerical': 0.012958963282937365, 'mean_word_length': 1.66489597166888, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '488526', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1638, 'n_words': 436}