|  | @@ -32,8 +32,67 @@
 | 
	
		
			
				|  |  |    ></script>    
 | 
	
		
			
				|  |  |    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
 | 
	
		
			
				|  |  |    <script src="echarts.min.js"></script>
 | 
	
		
			
				|  |  | +  <style>
 | 
	
		
			
				|  |  | +    body {
 | 
	
		
			
				|  |  | +      font-family: 'Lato', sans-serif;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    .overlay {
 | 
	
		
			
				|  |  | +      height: 100%;
 | 
	
		
			
				|  |  | +      width: 100%;
 | 
	
		
			
				|  |  | +      display: none;
 | 
	
		
			
				|  |  | +      position: fixed;
 | 
	
		
			
				|  |  | +      z-index: 1;
 | 
	
		
			
				|  |  | +      top: 0;
 | 
	
		
			
				|  |  | +      left: 0;
 | 
	
		
			
				|  |  | +      background-color: rgb(0,0,0);
 | 
	
		
			
				|  |  | +      background-color: rgba(0,0,0, 0.6);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    .overlay-content {
 | 
	
		
			
				|  |  | +      position: relative;
 | 
	
		
			
				|  |  | +      top: 25%;
 | 
	
		
			
				|  |  | +      width: 100%;
 | 
	
		
			
				|  |  | +      text-align: center;
 | 
	
		
			
				|  |  | +      margin-top: 30px;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    .overlay a {
 | 
	
		
			
				|  |  | +      padding: 8px;
 | 
	
		
			
				|  |  | +      text-decoration: none;
 | 
	
		
			
				|  |  | +      font-size: 36px;
 | 
	
		
			
				|  |  | +      color: #818181;
 | 
	
		
			
				|  |  | +      display: block;
 | 
	
		
			
				|  |  | +      transition: 0.3s;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    .overlay a:hover, .overlay a:focus {
 | 
	
		
			
				|  |  | +      color: #f1f1f1;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    .overlay .closebtn {
 | 
	
		
			
				|  |  | +      position: absolute;
 | 
	
		
			
				|  |  | +      top: 20px;
 | 
	
		
			
				|  |  | +      right: 45px;
 | 
	
		
			
				|  |  | +      font-size: 60px;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    @media screen and (max-height: 450px) {
 | 
	
		
			
				|  |  | +      .overlay a {font-size: 20px}
 | 
	
		
			
				|  |  | +      .overlay .closebtn {
 | 
	
		
			
				|  |  | +      font-size: 40px;
 | 
	
		
			
				|  |  | +      top: 15px;
 | 
	
		
			
				|  |  | +      right: 35px;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    </style>
 | 
	
		
			
				|  |  |  </head>
 | 
	
		
			
				|  |  |  <body class="color__grey">
 | 
	
		
			
				|  |  | +  <div id="myNav" class="overlay">
 | 
	
		
			
				|  |  | +    <div class="overlay-content">
 | 
	
		
			
				|  |  | +      <a href="#">載入資料中,請稍候</a>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  |  <!-- Navbar -->
 | 
	
		
			
				|  |  |    <nav class="navbar navbar-expand-lg navbar-light bg-white">
 | 
	
		
			
				|  |  |      <!-- Container wrapper -->
 | 
	
	
		
			
				|  | @@ -93,8 +152,8 @@
 | 
	
		
			
				|  |  |        <div class="col-12 col-12">
 | 
	
		
			
				|  |  |            <!-- Search form  -->
 | 
	
		
			
				|  |  |          <form id="searchform" class="d-flex input-group search__form">
 | 
	
		
			
				|  |  | -          <input type="search" class="form-control search__bar" placeholder="Search" aria-label="Domain Name" id="search_query"/>
 | 
	
		
			
				|  |  | -          <button class="btn btn-primary search__btn" type="button" data-mdb-ripple-color="dark" id="search__btn">
 | 
	
		
			
				|  |  | +          <input type="search" class="form-control search__bar" placeholder="Search" aria-label="Domain Name" id="search_query"  />
 | 
	
		
			
				|  |  | +          <button class="btn btn-primary search__btn" type="button" data-mdb-ripple-color="dark" id="search__btn" >
 | 
	
		
			
				|  |  |                Search
 | 
	
		
			
				|  |  |            </button>
 | 
	
		
			
				|  |  |          </form>
 | 
	
	
		
			
				|  | @@ -172,7 +231,7 @@
 | 
	
		
			
				|  |  |                      <h5 class="card-title card__rank__title mb-2">搜尋流量</h5>
 | 
	
		
			
				|  |  |                      <p class="card-text" >
 | 
	
		
			
				|  |  |                      </p>
 | 
	
		
			
				|  |  | -                    <span href="#" class="rank__mark"><strong id="globalrank" class="rank_num">1000</strong></span>
 | 
	
		
			
				|  |  | +                    <span href="#" class="rank__mark"><strong id="maxflow" class="rank_num">1000</strong></span>
 | 
	
		
			
				|  |  |                    </div>
 | 
	
		
			
				|  |  |                  </div>
 | 
	
		
			
				|  |  |                </div>
 | 
	
	
		
			
				|  | @@ -229,94 +288,120 @@
 | 
	
		
			
				|  |  |    <script src="https://unpkg.com/js-datepicker"></script>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | +  function openNav() {
 | 
	
		
			
				|  |  | +  document.getElementById("myNav").style.display = "block";
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function closeNav() {
 | 
	
		
			
				|  |  | +  document.getElementById("myNav").style.display = "none";
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |    const input = document.getElementById("search_query");
 | 
	
		
			
				|  |  |    const search__btn = document.getElementById("search__btn");
 | 
	
		
			
				|  |  |    const btn__benefit = document.querySelectorAll(".btn__benefit");
 | 
	
		
			
				|  |  | -  const picker_str = datepicker('#daterng1', {
 | 
	
		
			
				|  |  | -    id: 1
 | 
	
		
			
				|  |  | -  });
 | 
	
		
			
				|  |  | -  const picker_end = datepicker('#daterng2', {
 | 
	
		
			
				|  |  | -    id: 1
 | 
	
		
			
				|  |  | -  });
 | 
	
		
			
				|  |  | +  const picker_str = datepicker('#daterng1', {id: 1});
 | 
	
		
			
				|  |  | +  const picker_end = datepicker('#daterng2', {id: 1});
 | 
	
		
			
				|  |  |    $('.sub__date').click(function(e){
 | 
	
		
			
				|  |  |      e.preventDefault();
 | 
	
		
			
				|  |  |      console.log(picker_end.getRange());
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |    search__btn.addEventListener("click", function(e) {
 | 
	
		
			
				|  |  | +    openNav()
 | 
	
		
			
				|  |  |      e.preventDefault();
 | 
	
		
			
				|  |  |      check_form();
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  | -  input.addEventListener("keyup", function(event) {
 | 
	
		
			
				|  |  | -    // Number 13 is the "Enter" key on the keyboard
 | 
	
		
			
				|  |  | -    if (event.keyCode === 13) {
 | 
	
		
			
				|  |  | -      check_form();
 | 
	
		
			
				|  |  | -      event.preventDefault();
 | 
	
		
			
				|  |  | -  //    document.getElementById("myBtn").click();
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    btn__benefit.forEach((item, i) => {
 | 
	
		
			
				|  |  |      item.addEventListener("click", function(){
 | 
	
		
			
				|  |  |        item.toggleClass('active');
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  | +  $('#search_query').keydown(function(e){
 | 
	
		
			
				|  |  | +    //
 | 
	
		
			
				|  |  | +    if (event.keyCode == 13){
 | 
	
		
			
				|  |  | +      document.getElementById('search__btn').click()
 | 
	
		
			
				|  |  | +      e.preventDefault();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const myChart = echarts.init(document.getElementById('main'));
 | 
	
		
			
				|  |  |    let option;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    function check_form(){
 | 
	
		
			
				|  |  | -      const qry = document.getElementById('search_query').value;
 | 
	
		
			
				|  |  | -      axios.get('http://www.googo.org:8080/dm/' + qry)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -      //      axios.get('http://www.googo.org:8080/domain/' + qry)
 | 
	
		
			
				|  |  | -      .then((response) => {
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  |          const sitename = document.getElementById('sitename');
 | 
	
		
			
				|  |  |          const sitetitle = document.getElementById('sitetitle');
 | 
	
		
			
				|  |  |          const descriptions = document.getElementById('descriptions');
 | 
	
		
			
				|  |  |          const globalrank = document.getElementById('globalrank');
 | 
	
		
			
				|  |  |          const countryrank = document.getElementById('countryrank');    
 | 
	
		
			
				|  |  |          const category = document.getElementById('category');    
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        console.log(response.data); 
 | 
	
		
			
				|  |  | -        //    alert(response.data.SiteName);
 | 
	
		
			
				|  |  | -        //    var obj = JSON.parse(response.data);
 | 
	
		
			
				|  |  | -        //    alert(obj);
 | 
	
		
			
				|  |  | -        sitename.textContent =response.data.SiteName;
 | 
	
		
			
				|  |  | -        descriptions.textContent=response.data.Description;
 | 
	
		
			
				|  |  | -        globalrank.textContent=response.data.GlobalRank;
 | 
	
		
			
				|  |  | -        sitetitle.textContent=response.data.Title;
 | 
	
		
			
				|  |  | -        countryrank.textContent=response.data.CountryRank;
 | 
	
		
			
				|  |  | -        category.textContent=response.data.Category;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -        const key_ary=[];
 | 
	
		
			
				|  |  | -        const val_ary=[];
 | 
	
		
			
				|  |  | -        for (const [key, value] of Object.entries(response.data.EstimatedMonthlyVisits)) {
 | 
	
		
			
				|  |  | -          key_ary.push(key);
 | 
	
		
			
				|  |  | -          val_ary.push(value);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        option = {
 | 
	
		
			
				|  |  | -            xAxis: {
 | 
	
		
			
				|  |  | -                type: 'category',
 | 
	
		
			
				|  |  | -                boundaryGap: false,
 | 
	
		
			
				|  |  | -                data: key_ary
 | 
	
		
			
				|  |  | -            },
 | 
	
		
			
				|  |  | -            yAxis: {
 | 
	
		
			
				|  |  | -                type: 'value'
 | 
	
		
			
				|  |  | -            },
 | 
	
		
			
				|  |  | -            series: [{
 | 
	
		
			
				|  |  | -                data: val_ary,
 | 
	
		
			
				|  |  | -                type: 'line',
 | 
	
		
			
				|  |  | -                areaStyle: {}
 | 
	
		
			
				|  |  | -            }]
 | 
	
		
			
				|  |  | -        };
 | 
	
		
			
				|  |  | -            myChart.setOption(option);
 | 
	
		
			
				|  |  | +        response = ''
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        dataOBJ = {'domain_name':$('#search_query').val()}
 | 
	
		
			
				|  |  | +        objstr = JSON.stringify(dataOBJ);
 | 
	
		
			
				|  |  | +        console.log(objstr)
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        $.ajax({
 | 
	
		
			
				|  |  | +            url: 'http://172.105.205.52:8000/dm',
 | 
	
		
			
				|  |  | +            //url: 'http://www.choozmo.com:8888/qqreq',
 | 
	
		
			
				|  |  | +            dataType : 'json', // 預期從server接收的資料型態
 | 
	
		
			
				|  |  | +            contentType : 'application/json; charset=utf-8', // 要送到server的資料型態
 | 
	
		
			
				|  |  | +            type: 'post',
 | 
	
		
			
				|  |  | +            data: objstr,
 | 
	
		
			
				|  |  | +            success: function(suc_data) {
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +                response = suc_data
 | 
	
		
			
				|  |  | +                sitename.textContent =response.SiteName;
 | 
	
		
			
				|  |  | +                descriptions.textContent=response.Description;
 | 
	
		
			
				|  |  | +                globalrank.textContent=response.GlobalRank;
 | 
	
		
			
				|  |  | +                sitetitle.textContent=response.Title;
 | 
	
		
			
				|  |  | +                countryrank.textContent=response.CountryRank;
 | 
	
		
			
				|  |  | +                category.textContent=response.Category;
 | 
	
		
			
				|  |  | +                $('#maxflow').html(response.totalVisits)
 | 
	
		
			
				|  |  | +                key_ary=[];
 | 
	
		
			
				|  |  | +                val_ary=[];
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +                for (const [key, value] of Object.entries(response.EstimatedMonthlyVisits)) {
 | 
	
		
			
				|  |  | +                  key_ary.push(key);
 | 
	
		
			
				|  |  | +                  val_ary.push(value);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +                option = {
 | 
	
		
			
				|  |  | +                    xAxis: {
 | 
	
		
			
				|  |  | +                        type: 'category',
 | 
	
		
			
				|  |  | +                        boundaryGap: false,
 | 
	
		
			
				|  |  | +                        data: key_ary
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    yAxis: {
 | 
	
		
			
				|  |  | +                        type: 'value'
 | 
	
		
			
				|  |  | +                    },
 | 
	
		
			
				|  |  | +                    series: [{
 | 
	
		
			
				|  |  | +                        data: val_ary,
 | 
	
		
			
				|  |  | +                        type: 'line',
 | 
	
		
			
				|  |  | +                        areaStyle: {}
 | 
	
		
			
				|  |  | +                    }]
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                    myChart.setOption(option);
 | 
	
		
			
				|  |  | +                    closeNav()
 | 
	
		
			
				|  |  | +              },
 | 
	
		
			
				|  |  | +            //data:JSON.stringify({n1:"12",n2:"22"}),
 | 
	
		
			
				|  |  | +            error: function (error) {
 | 
	
		
			
				|  |  | +              alert('此網頁無法查詢!')
 | 
	
		
			
				|  |  | +              closeNav()
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +       
 | 
	
		
			
				|  |  |        //   sitename.innerHTML =response.data
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        // var bar = document.getElementById('bar');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        // var barChart = echarts.init(bar);
 | 
	
		
			
				|  |  | -    });
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  </body>
 |