page.tpl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE html>
  2. <html lang="ja">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>{{ page.Title }}</title>
  6. <link rel="stylesheet" href="/assets/css/style.css" media="all">
  7. <style type="text/css">
  8. body {
  9. background-color: black;
  10. color: white;
  11. }
  12. table {
  13. width: 100%;
  14. margin: auto;
  15. }
  16. table, th, td {
  17. border:none;
  18. }
  19. h1 {
  20. text-align: center;
  21. }
  22. hr {
  23. border-bottom: 5px solid white;
  24. }
  25. td {
  26. height: 50px;
  27. font-size: 20px;
  28. }
  29. #time {
  30. color: yellow;
  31. }
  32. tr.row1 {
  33. background-color: #20258b;
  34. }
  35. tr.row2 {
  36. background-color: #4168ff;
  37. }
  38. </style>
  39. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  40. </head>
  41. <body>
  42. <table border="0">
  43. <tr id="header">
  44. <th>定刻</th>
  45. <th>変更</th>
  46. <th>行先</th>
  47. <th>バス会社</th>
  48. <th>便名</th>
  49. <th>天気</th>
  50. <th>備考</th>
  51. <th id="time"></time>
  52. </tr>
  53. </table>
  54. <hr />
  55. <table border="0">
  56. <tbody>
  57. {% for ctime in times %}
  58. {% if forloop.Counter0|divisibleby:2 %}
  59. <tr class="row2">
  60. {% else %}
  61. <tr class="row1">
  62. {% endif %}
  63. <td>{{ ctime.Hour }}:{{ ctime.Minute }}</td>
  64. <td> </td>
  65. <td>{{ ctime.Start }} to {{ ctime.End }}</td>
  66. <td>{{ctime.Campany }}</td>
  67. <td> -- </td>
  68. <td> -- </td>
  69. <td></td>
  70. </tr>
  71. {% endfor %}
  72. </tbody>
  73. </table>
  74. <script>
  75. setInterval(function () {
  76. //時刻データを取得して変数jikanに格納する
  77. var jikan= new Date();
  78. //時・分・秒を取得する
  79. var hour = ( ("000") + jikan.getHours()).substr(-2);
  80. var minute = ( ("000") + jikan.getMinutes()).substr(-2);
  81. var second = ( ("000") + jikan.getSeconds()).substr(-2);
  82. var display_time = hour+ ":" + minute + ":" + second;
  83. var current_time = hour + '' + minute + second;
  84. var reload_time = ( ("000") + {{times.0.Hour}}).substr(-2) + '' + ( ("000") + {{times.0.Minute}}).substr(-2) + "00";
  85. var next_reload_count = (reload_time - current_time);
  86. $("#time").html(display_time + "/" + next_reload_count);
  87. if (0 > next_reload_count) {
  88. setTimeout(function () {
  89. window.location = "/";
  90. }, 10000);
  91. }
  92. }, 1000);
  93. </script>
  94. </body>
  95. </html>