index_bk.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  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. <style>
  36. body {
  37. font-family: 'Lato', sans-serif;
  38. }
  39. .overlay {
  40. height: 100%;
  41. width: 100%;
  42. display: none;
  43. position: fixed;
  44. z-index: 1;
  45. top: 0;
  46. left: 0;
  47. background-color: rgb(0,0,0);
  48. background-color: rgba(0,0,0, 0.6);
  49. }
  50. .overlay-content {
  51. position: relative;
  52. top: 25%;
  53. width: 100%;
  54. text-align: center;
  55. margin-top: 30px;
  56. }
  57. .overlay a {
  58. padding: 8px;
  59. text-decoration: none;
  60. font-size: 36px;
  61. color: #818181;
  62. display: block;
  63. transition: 0.3s;
  64. }
  65. .overlay a:hover, .overlay a:focus {
  66. color: #f1f1f1;
  67. }
  68. .overlay .closebtn {
  69. position: absolute;
  70. top: 20px;
  71. right: 45px;
  72. font-size: 60px;
  73. }
  74. @media screen and (max-height: 450px) {
  75. .overlay a {font-size: 20px}
  76. .overlay .closebtn {
  77. font-size: 40px;
  78. top: 15px;
  79. right: 35px;
  80. }
  81. }
  82. </style>
  83. </head>
  84. <body class="color__grey">
  85. <div id="myNav" class="overlay">
  86. <div class="overlay-content">
  87. <a href="#">載入資料中,請稍候</a>
  88. </div>
  89. </div>
  90. <!-- Navbar -->
  91. <nav class="navbar navbar-expand-lg navbar-light bg-white">
  92. <!-- Container wrapper -->
  93. <div class="container-fluid">
  94. <!-- Navbar brand -->
  95. <a class="navbar-brand" href="#">Googo Website Traffic</a>
  96. <!-- Toggle button -->
  97. <button class="navbar-toggler" type="button" data-mdb-toggle="collapse"
  98. data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
  99. aria-label="Toggle navigation">
  100. <i class="fas fa-bars text-light"></i>
  101. </button>
  102. <!-- Collapsible wrapper -->
  103. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  104. <!-- Left links -->
  105. <ul class="navbar-nav me-auto d-flex flex-row mt-3 mt-lg-0">
  106. <li class="nav-item text-center mx-2 mx-lg-1">
  107. <a class="nav-link active" aria-current="page" href="index.html">
  108. <div>
  109. <i class="fas fa-home fa-lg mb-1"></i>
  110. </div>
  111. 首頁
  112. </a>
  113. </li>
  114. <li class="nav-item text-center mx-2 mx-lg-1">
  115. <a class="nav-link" href="http://news.google.com">
  116. <div>
  117. <i class="fas fa-globe-americas fa-lg mb-1"></i>
  118. <!-- <span class="badge rounded-pill badge-notification bg-success">11</span> -->
  119. </div>
  120. 新聞
  121. </a>
  122. </li>
  123. <li class="nav-item text-center mx-2 mx-lg-1">
  124. <a class="nav-link" href="keywords.html">
  125. <div>
  126. <i class="fab fa-korvue fa-lg mb-1"></i>
  127. <!-- <span class="badge rounded-pill badge-notification bg-success">11</span> -->
  128. </div>
  129. 關鍵字
  130. </a>
  131. </li>
  132. </ul>
  133. <!-- Right links -->
  134. </div>
  135. <!-- Collapsible wrapper -->
  136. </div>
  137. <!-- Container wrapper -->
  138. </nav>
  139. <!-- Navbar -->
  140. <div class="container">
  141. <div class="row">
  142. <!-- <div class="col-1 col-lg-1"></div> -->
  143. <div class="col-12 col-12">
  144. <!-- Search form -->
  145. <form id="searchform" class="d-flex input-group search__form">
  146. <input type="search" class="form-control search__bar" placeholder="在此輸入網址" aria-label="Domain Name" id="search_query" />
  147. <button class="btn btn-primary search__btn" type="button" data-mdb-ripple-color="dark" id="search__btn" >
  148. 查詢
  149. </button>
  150. </form>
  151. <h3 class="h3 text-center" id="sitename">Website Traffic</h3>
  152. <div class="card card__grback mb-4">
  153. <div class="card-body card__left">
  154. <!-- 根據搜尋內容顯示網站標題及網站內容簡介 -->
  155. <h5 class="card-title card__url" id="sitetitle"><i class="fas fa-chart-bar card__url__icon"></i>Example.com</h5>
  156. <p class="card-text card__intro" id="descriptions">
  157. Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut ipsa totam maxime pariatur iure
  158. suscipit nihil possimus deserunt esse blanditiis. Quidem aliquid, voluptas quae tenetur quaerat
  159. iure explicabo repellat ad.
  160. </p>
  161. <!-- <a href="#" class="btn btn-primary" id="globalrank2"></a> -->
  162. </div>
  163. </div>
  164. <div class="date__input mb-3">
  165. <label for="daterng">開始日期:</label><input type="text" name="daterng" id="daterng1">
  166. <label for="daterng">結束日期:</label><input type="text" name="daterng" id="daterng2">
  167. <button class='sub__date btn'>套用</button>
  168. </div>
  169. <div class="text-muted mb-2 border-bottom">排行</div>
  170. <div class="row g-5 mb-3">
  171. <div class="col-sm-4">
  172. <div class="card p-3">
  173. <div class="card-body text-center">
  174. <h5 class="card-title card__rank__title mb-2">國際排行</h5>
  175. <p class="card-text" >
  176. </p>
  177. <span href="#" class="rank__mark"># <strong id="globalrank" class="rank_num">1000</strong></span>
  178. </div>
  179. </div>
  180. </div>
  181. <div class="col-sm-4">
  182. <div class="card p-3">
  183. <div class="card-body text-center">
  184. <h5 class="card-title card__rank__title mb-2">國內排行</h5>
  185. <p class="card-text">
  186. </p>
  187. <span href="#" class="rank__mark"># <strong id="countryrank" class="rank_num">100</strong></span>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="col-sm-4">
  192. <div class="card p-3">
  193. <div class="card-body text-center">
  194. <h5 class="card-title card__rank__title mb-2"><i class="fas fa-tags"></i>網站類別</h5>
  195. <p class="card-text card__rank__cat" id="category">
  196. Lorem
  197. </p>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="text-muted mt-5 mb-2">Global Website Traffic Rankings</div>
  203. <div class="row mb-4">
  204. <div class="col-12 col-12">
  205. <!--
  206. <button type="button" class="btn btn-primary btn-block mb-4 ripple-surface">Place order</button>
  207. -->
  208. <div class="card card__notHover">
  209. <div id="main" class="chart"></div>
  210. </div>
  211. </div>
  212. </div>
  213. <div class="text-muted mb-2 border-bottom">BENEFIT</div>
  214. <div class="btn-group group__btn" role="group" aria-label="date-buttons">
  215. <button class="btn__benefit active">搜尋流量</button>
  216. <button class="btn__benefit">有搜尋流量的網頁數</button>
  217. </div>
  218. <div class="row g-5 mb-3">
  219. <div class="col-sm-4">
  220. <div class="card p-3">
  221. <div class="card-body text-center">
  222. <h5 class="card-title card__rank__title mb-2">搜尋流量</h5>
  223. <p class="card-text" >
  224. </p>
  225. <span href="#" class="rank__mark"><strong id="maxflow" class="rank_num">1000</strong></span>
  226. </div>
  227. </div>
  228. </div>
  229. <div class="col-sm-4">
  230. <div class="card p-3">
  231. <div class="card-body text-center">
  232. <h5 class="card-title card__rank__title mb-2">有搜尋流量的網頁數</h5>
  233. <p class="card-text">
  234. </p>
  235. <span href="#" class="rank__mark"><strong id="countryrank" class="rank_num">100</strong></span>
  236. </div>
  237. </div>
  238. </div>
  239. <div class="col-sm-4">
  240. <div class="card p-3">
  241. <div class="card-body text-center">
  242. <h5 class="card-title card__rank__title mb-2"><i class="fas fa-tags"></i>轉換訂單數</h5>
  243. <span href="#" class="rank__mark"><strong id="countryrank" class="rank_num">100</strong></span>
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. <div class="row mb-4">
  249. <div class="col-12 col-12">
  250. <!--
  251. <button type="button" class="btn btn-primary btn-block mb-4 ripple-surface">Place order</button>
  252. -->
  253. <div class="card card__notHover">
  254. <div id="main" class="chart"></div>
  255. </div>
  256. </div>
  257. </div>
  258. <div class="text-muted mb-2 border-bottom">SEO</div>
  259. <div class="row mb-4">
  260. <div class="col-12 col-12">
  261. <!--
  262. <button type="button" class="btn btn-primary btn-block mb-4 ripple-surface">Place order</button>
  263. -->
  264. <div class="card card__notHover">
  265. <div id="bar" class="chart"></div>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. <footer class="footer text-center p-4 bg-white">
  273. <div class="text-muted"> © 2021 Copyright: Googo Website Traffic</div>
  274. </footer>
  275. <script
  276. src="https://code.jquery.com/jquery-3.6.0.min.js"
  277. integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
  278. crossorigin="anonymous"></script>
  279. <script src="https://unpkg.com/js-datepicker"></script>
  280. <script>
  281. function openNav() {
  282. document.getElementById("myNav").style.display = "block";
  283. }
  284. function closeNav() {
  285. document.getElementById("myNav").style.display = "none";
  286. }
  287. const input = document.getElementById("search_query");
  288. const search__btn = document.getElementById("search__btn");
  289. const btn__benefit = document.querySelectorAll(".btn__benefit");
  290. const picker_str = datepicker('#daterng1', {id: 1});
  291. const picker_end = datepicker('#daterng2', {id: 1});
  292. $('.sub__date').click(function(e){
  293. e.preventDefault();
  294. console.log(picker_end.getRange());
  295. });
  296. search__btn.addEventListener("click", function(e) {
  297. openNav()
  298. e.preventDefault();
  299. check_form();
  300. })
  301. btn__benefit.forEach((item, i) => {
  302. item.addEventListener("click", function(){
  303. item.toggleClass('active');
  304. })
  305. });
  306. $('#search_query').keydown(function(e){
  307. //
  308. if (event.keyCode == 13){
  309. document.getElementById('search__btn').click()
  310. e.preventDefault();
  311. }
  312. });
  313. const myChart = echarts.init(document.getElementById('main'));
  314. let option;
  315. function check_form(){
  316. const sitename = document.getElementById('sitename');
  317. const sitetitle = document.getElementById('sitetitle');
  318. const descriptions = document.getElementById('descriptions');
  319. const globalrank = document.getElementById('globalrank');
  320. const countryrank = document.getElementById('countryrank');
  321. const category = document.getElementById('category');
  322. response = ''
  323. dataOBJ = {'domain_name':$('#search_query').val()}
  324. objstr = JSON.stringify(dataOBJ);
  325. console.log(objstr)
  326. $.ajax({
  327. url: 'http://www.googo.org:8001/dm',
  328. //url: 'http://www.choozmo.com:8888/qqreq',
  329. dataType : 'json', // 預期從server接收的資料型態
  330. contentType : 'application/json; charset=utf-8', // 要送到server的資料型態
  331. type: 'post',
  332. data: objstr,
  333. success: function(suc_data) {
  334. response = suc_data
  335. sitename.textContent =response.SiteName;
  336. descriptions.textContent=response.Description;
  337. globalrank.textContent=response.GlobalRank;
  338. sitetitle.textContent=response.Title;
  339. countryrank.textContent=response.CountryRank;
  340. category.textContent=response.Category;
  341. $('#maxflow').html(response.totalVisits)
  342. key_ary=[];
  343. val_ary=[];
  344. for (const [key, value] of Object.entries(response.EstimatedMonthlyVisits)) {
  345. key_ary.push(key);
  346. val_ary.push(value);
  347. }
  348. option = {
  349. xAxis: {
  350. type: 'category',
  351. boundaryGap: false,
  352. data: key_ary
  353. },
  354. yAxis: {
  355. type: 'value'
  356. },
  357. series: [{
  358. data: val_ary,
  359. type: 'line',
  360. areaStyle: {}
  361. }]
  362. };
  363. myChart.setOption(option);
  364. closeNav()
  365. },
  366. //data:JSON.stringify({n1:"12",n2:"22"}),
  367. error: function (error) {
  368. alert('此網頁無法查詢!')
  369. closeNav()
  370. }
  371. });
  372. }
  373. </script>
  374. </body>
  375. </html>