base.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. {% block font %}
  7. <link rel="preconnect" href="https://fonts.googleapis.com">
  8. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  9. <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@100;400&display=swap" rel="stylesheet">
  10. {% endblock %}
  11. {% block style %}
  12. <link href="https://cdn.staticfile.org/bootstrap/4.6.1/css/bootstrap.min.css" rel="stylesheet">
  13. <link href="{{ url_for('static', filename='styles/base.css') }}" rel="stylesheet">
  14. <style>
  15. html {
  16. font-family: 'Noto Sans SC', sans-serif;
  17. }
  18. body{
  19. background-color: #f0fcff;
  20. }
  21. </style>
  22. {% endblock %}
  23. <title>{% block title %} {% endblock %} - {{ blog_name }} </title>
  24. </head>
  25. <body>
  26. {% block nav %}
  27. <h1 class="text-center mt-2"> 《{{ blog_name }}》—— <small>{{ blog_describe }}</small> </h1>
  28. <header>
  29. <nav>
  30. <ul class="nav nav-tabs justify-content-center mt-3" id="top-nav">
  31. <li class="nav-item">
  32. <a href="{{ url_for('base.index_page') }}" class="nav-link {{ top_nav[0] }}">
  33. 首页
  34. </a>
  35. </li>
  36. {% if current_user.check_role("ReadBlog") %}
  37. <li class="nav-item">
  38. <a href="{{ url_for('archive.archive_page') }}" class="nav-link {{ top_nav[1] }}">
  39. 归档
  40. </a>
  41. </li>
  42. <li class="nav-item">
  43. <a href="{{ url_for('docx.docx_page', page=1) }}" class="nav-link {{ top_nav[2] }}">
  44. 文章
  45. </a>
  46. </li>
  47. {% endif %}
  48. <li class="nav-item">
  49. <a href="{{ url_for('msg.msg_page', page=1) }}" class="nav-link {{ top_nav[3] }}">
  50. 留言
  51. </a>
  52. </li>
  53. <li class="nav-item">
  54. <a href="{{ url_for('about_me.about_me_page') }}" class="nav-link {{ top_nav[4] }}">
  55. 关于我
  56. </a>
  57. </li>
  58. <li class="nav-item">
  59. {% if current_user.is_authenticated %}
  60. <a href="{{ url_for('auth.yours_page') }}" class="nav-link {{ top_nav[5] }}">
  61. 你的
  62. </a>
  63. {% else %}
  64. <a href="{{ url_for('auth.login_page') }}" class="nav-link {{ top_nav[5] }}">
  65. 登录
  66. </a>
  67. {% endif %}
  68. </li>
  69. </ul>
  70. </nav>
  71. <section class="container mt-2 mb-2">
  72. {% for message in get_flashed_messages() %}
  73. <div class="alert alert-info">
  74. <button type="button" class="close" data-dismiss="alert">&times;</button>
  75. {{ message }}
  76. </div>
  77. {% endfor %}
  78. </section>
  79. </header>
  80. {% endblock %}
  81. <div id="context" class="mb-2">
  82. {% block context %} {% endblock %}
  83. </div>
  84. {% block footer %}
  85. <footer id="foot">
  86. <hr>
  87. {{ conf['foot-info'] }}
  88. </footer>
  89. <script>
  90. let context = document.getElementById('context')
  91. let foot = document.getElementById('foot')
  92. let context_height = context.getBoundingClientRect().bottom
  93. let win_height = 0
  94. if (window.innerHeight)
  95. win_height = window.innerHeight;
  96. else if ((document.body) && (document.body.clientHeight))
  97. win_height = document.body.clientHeight;
  98. console.log(context_height, win_height, foot.clientHeight, (win_height - context_height - foot.clientHeight).toString())
  99. if (win_height - context_height - foot.clientHeight <= 0)
  100. foot.style.marginTop = "0"
  101. else {
  102. foot.style.marginTop = (win_height - context_height - foot.clientHeight).toString() + "px"
  103. console.log(foot.style.marginTop)
  104. console.log("HAHAH")
  105. }
  106. </script>
  107. {% endblock %}
  108. {% block javascript %}
  109. <script src="https://cdn.staticfile.org/popper.js/0.2.0/popper.min.js"></script>
  110. <script src="https://cdn.staticfile.org/jquery/1.10.0/jquery.min.js"></script>
  111. <script src="https://cdn.staticfile.org/bootstrap/4.6.1/js/bootstrap.min.js"></script>
  112. {% endblock %}
  113. </body>
  114. </html>