index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Googo Website Traffic</title>
  8. <!-- Font Awesome -->
  9. <link
  10. href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
  11. rel="stylesheet"
  12. />
  13. <!-- Google Fonts -->
  14. <link
  15. href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
  16. rel="stylesheet"
  17. />
  18. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
  19. integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  20. <!-- MDB -->
  21. <link
  22. href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.3.0/mdb.min.css"
  23. rel="stylesheet"
  24. />
  25. <link rel="stylesheet" href="https://unpkg.com/js-datepicker/dist/datepicker.min.css">
  26. <link rel="stylesheet" type="text/css" href="reset.css">
  27. <link rel="stylesheet" type="text/css" href="main.css">
  28. <!-- MDB -->
  29. <script
  30. type="text/javascript"
  31. src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.3.0/mdb.min.js"
  32. ></script>
  33. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  34. <script src="echarts.min.js"></script>
  35. </head>
  36. <body class="color__grey">
  37. <!-- Navbar -->
  38. <nav class="navbar navbar-expand-lg navbar-light bg-white">
  39. <!-- Container wrapper -->
  40. <div class="container-fluid">
  41. <!-- Navbar brand -->
  42. <a class="navbar-brand" href="#">Googo Website Traffic</a>
  43. <!-- Toggle button -->
  44. <button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
  45. data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
  46. aria-label="Toggle navigation">
  47. <i class="fas fa-bars text-light"></i>
  48. </button>
  49. <!-- Collapsible wrapper -->
  50. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  51. <!-- Left links -->
  52. <ul class="navbar-nav me-auto d-flex flex-row mt-3 mt-lg-0">
  53. <li class="nav-item text-center mx-2 mx-lg-1">
  54. <a class="nav-link active" aria-current="page" href="index.html">
  55. <div>
  56. <i class="fas fa-home fa-lg mb-1"></i>
  57. </div>
  58. Home
  59. </a>
  60. </li>
  61. <li class="nav-item text-center mx-2 mx-lg-1">
  62. <a class="nav-link" href="http://news.google.com">
  63. <div>
  64. <i class="fas fa-globe-americas fa-lg mb-1"></i>
  65. <!-- <span class="badge rounded-pill badge-notification bg-success">11</span> -->
  66. </div>
  67. News
  68. </a>
  69. </li>
  70. <li class="nav-item text-center mx-2 mx-lg-1">
  71. <a class="nav-link" href="keywords.html">
  72. <div>
  73. <i class="fab fa-korvue fa-lg mb-1"></i>
  74. <!-- <span class="badge rounded-pill badge-notification bg-success">11</span> -->
  75. </div>
  76. Keywords
  77. </a>
  78. </li>
  79. </ul>
  80. <!-- Right links -->
  81. </div>
  82. <!-- Collapsible wrapper -->
  83. </div>
  84. <!-- Container wrapper -->
  85. </nav>
  86. <!-- Navbar -->
  87. <div class="container">
  88. <div class="row">
  89. <!-- <div class="col-1 col-lg-1"></div> -->
  90. <div class="col-12 col-12">
  91. <!-- Search form -->
  92. <form id="searchform" class="d-flex input-group search__form">
  93. <input type="search" class="form-control search__bar" placeholder="Search" aria-label="Domain Name" id="search_query"/>
  94. <button class="btn btn-primary search__btn" type="button" data-mdb-ripple-color="dark" id="search__btn">
  95. Search
  96. </button>
  97. </form>
  98. <h3 class="h3 text-center" id="sitename">Website Traffic</h3>
  99. <div class="card card__grback mb-4">
  100. <div class="card-body card__left">
  101. <!-- 根據搜尋內容顯示網站標題及網站內容簡介 -->
  102. <h5 class="card-title card__url" id="sitetitle"><i class="fas fa-chart-bar card__url__icon"></i>Example.com</h5>
  103. <p class="card-text card__intro" id="descriptions">
  104. Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut ipsa totam maxime pariatur iure
  105. suscipit nihil possimus deserunt esse blanditiis. Quidem aliquid, voluptas quae tenetur quaerat
  106. iure explicabo repellat ad.
  107. </p>
  108. <!-- <a href="#" class="btn btn-primary" id="globalrank2"></a> -->
  109. </div>
  110. </div>
  111. <div class="date__input mb-3">
  112. <label for="daterng">開始日期:</label><input type="text" name="daterng" id="daterng1">
  113. <label for="daterng">結束日期:</label><input type="text" name="daterng" id="daterng2">
  114. <button class='sub__date btn'>套用</button>
  115. </div>
  116. <div class="text-muted mb-2 border-bottom">RANKING</div>
  117. <div class="row g-5 mb-3">
  118. <div class="col-sm-4">
  119. <div class="card p-3">
  120. <div class="card-body text-center">
  121. <h5 class="card-title card__rank__title mb-2">Global Ranks</h5>
  122. <p class="card-text" >
  123. </p>
  124. <span href="#" class="rank__mark"># <strong id="globalrank" class="rank_num">1000</strong></span>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="col-sm-4">
  129. <div class="card p-3">
  130. <div class="card-body text-center">
  131. <h5 class="card-title card__rank__title mb-2">Country Ranks</h5>
  132. <p class="card-text">
  133. </p>
  134. <span href="#" class="rank__mark"># <strong id="countryrank" class="rank_num">100</strong></span>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="col-sm-4">
  139. <div class="card p-3">
  140. <div class="card-body text-center">
  141. <h5 class="card-title card__rank__title mb-2"><i class="fas fa-tags"></i>Category</h5>
  142. <p class="card-text card__rank__cat" id="category">
  143. Lorem
  144. </p>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="text-muted mt-5 mb-2">Global Website Traffic Rankings</div>
  150. <div class="row mb-4">
  151. <div class="col-12 col-12">
  152. <!--
  153. <button type="button" class="btn btn-primary btn-block mb-4 ripple-surface">Place order</button>
  154. -->
  155. <div class="card card__notHover">
  156. <div id="main" class="chart"></div>
  157. </div>
  158. </div>
  159. </div>
  160. <div class="text-muted mb-2 border-bottom">BENEFIT</div>
  161. <div class="btn-group group__btn" role="group" aria-label="date-buttons">
  162. <button class="btn__benefit active">搜尋流量</button>
  163. <button class="btn__benefit">有搜尋流量的網頁數</button>
  164. </div>
  165. <div class="row g-5 mb-3">
  166. <div class="col-sm-4">
  167. <div class="card p-3">
  168. <div class="card-body text-center">
  169. <h5 class="card-title card__rank__title mb-2">搜尋流量</h5>
  170. <p class="card-text" >
  171. </p>
  172. <span href="#" class="rank__mark"><strong id="globalrank" class="rank_num">1000</strong></span>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="col-sm-4">
  177. <div class="card p-3">
  178. <div class="card-body text-center">
  179. <h5 class="card-title card__rank__title mb-2">有搜尋流量的網頁數</h5>
  180. <p class="card-text">
  181. </p>
  182. <span href="#" class="rank__mark"><strong id="countryrank" class="rank_num">100</strong></span>
  183. </div>
  184. </div>
  185. </div>
  186. <div class="col-sm-4">
  187. <div class="card p-3">
  188. <div class="card-body text-center">
  189. <h5 class="card-title card__rank__title mb-2"><i class="fas fa-tags"></i>轉換訂單數</h5>
  190. <span href="#" class="rank__mark"><strong id="countryrank" class="rank_num">100</strong></span>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. <div class="row mb-4">
  196. <div class="col-12 col-12">
  197. <!--
  198. <button type="button" class="btn btn-primary btn-block mb-4 ripple-surface">Place order</button>
  199. -->
  200. <div class="card card__notHover">
  201. <div id="main" class="chart"></div>
  202. </div>
  203. </div>
  204. </div>
  205. <div class="text-muted mb-2 border-bottom">SEO</div>
  206. <div class="row mb-4">
  207. <div class="col-12 col-12">
  208. <!--
  209. <button type="button" class="btn btn-primary btn-block mb-4 ripple-surface">Place order</button>
  210. -->
  211. <div class="card card__notHover">
  212. <div id="bar" class="chart"></div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. <footer class="footer text-center p-4 bg-white">
  220. <div class="text-muted"> © 2021 Copyright: Googo Website Traffic</div>
  221. </footer>
  222. <script
  223. src="https://code.jquery.com/jquery-3.6.0.min.js"
  224. integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
  225. crossorigin="anonymous"></script>
  226. <script src="https://unpkg.com/js-datepicker"></script>
  227. <script>
  228. const input = document.getElementById("search_query");
  229. const search__btn = document.getElementById("search__btn");
  230. const btn__benefit = document.querySelectorAll(".btn__benefit");
  231. const picker_str = datepicker('#daterng1', {
  232. id: 1
  233. });
  234. const picker_end = datepicker('#daterng2', {
  235. id: 1
  236. });
  237. $('.sub__date').click(function(e){
  238. e.preventDefault();
  239. console.log(picker_end.getRange());
  240. });
  241. search__btn.addEventListener("click", function(e) {
  242. e.preventDefault();
  243. check_form();
  244. })
  245. input.addEventListener("keyup", function(event) {
  246. // Number 13 is the "Enter" key on the keyboard
  247. if (event.keyCode === 13) {
  248. check_form();
  249. event.preventDefault();
  250. // document.getElementById("myBtn").click();
  251. }
  252. });
  253. btn__benefit.forEach((item, i) => {
  254. item.addEventListener("click", function(){
  255. item.toggleClass('active');
  256. })
  257. });
  258. const myChart = echarts.init(document.getElementById('main'));
  259. let option;
  260. function check_form(){
  261. const qry = document.getElementById('search_query').value;
  262. axios.get('http://www.googo.org:8080/dm/' + qry)
  263. // axios.get('http://www.googo.org:8080/domain/' + qry)
  264. .then((response) => {
  265. const sitename = document.getElementById('sitename');
  266. const sitetitle = document.getElementById('sitetitle');
  267. const descriptions = document.getElementById('descriptions');
  268. const globalrank = document.getElementById('globalrank');
  269. const countryrank = document.getElementById('countryrank');
  270. const category = document.getElementById('category');
  271. console.log(response.data);
  272. // alert(response.data.SiteName);
  273. // var obj = JSON.parse(response.data);
  274. // alert(obj);
  275. sitename.textContent =response.data.SiteName;
  276. descriptions.textContent=response.data.Description;
  277. globalrank.textContent=response.data.GlobalRank;
  278. sitetitle.textContent=response.data.Title;
  279. countryrank.textContent=response.data.CountryRank;
  280. category.textContent=response.data.Category;
  281. const key_ary=[];
  282. const val_ary=[];
  283. for (const [key, value] of Object.entries(response.data.EstimatedMonthlyVisits)) {
  284. key_ary.push(key);
  285. val_ary.push(value);
  286. }
  287. option = {
  288. xAxis: {
  289. type: 'category',
  290. boundaryGap: false,
  291. data: key_ary
  292. },
  293. yAxis: {
  294. type: 'value'
  295. },
  296. series: [{
  297. data: val_ary,
  298. type: 'line',
  299. areaStyle: {}
  300. }]
  301. };
  302. myChart.setOption(option);
  303. // sitename.innerHTML =response.data
  304. // var bar = document.getElementById('bar');
  305. // var barChart = echarts.init(bar);
  306. });
  307. }
  308. </script>
  309. </body>
  310. </html>