Speiseplan der Mensen der Georg-August-Universität Göttingen https://mensa.schneider-hosting.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.7 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <template>
  2. <div id="app">
  3. <h1>Essen in Göttingen</h1>
  4. Wo? <select v-model="where">
  5. <option v-for="mensa in mensen" :value="mensa.url">{{mensa.name}}</option>
  6. </select>
  7. Wann? <select v-model="when">
  8. <option v-for="day in days" :value="day" :key="day">{{dayOfWeek[day]}}</option>
  9. </select>
  10. <router-view></router-view>
  11. <footer>
  12. <hr>
  13. <div>
  14. <span>
  15. Developed by <a href="https://webschneider.org">webschneider.org</a>
  16. &copy; {{ new Date().getFullYear() }}
  17. </span>
  18. <span><a href="https://webschneider.org/impress">Impressum</a></span>
  19. </div>
  20. <div>
  21. <span>
  22. <a href="https://www.netcup.de" target="_blank"><img src="/static/netcup-setA-234x60.png" width="234" height="60" alt="netcup.de" /></a>
  23. </span>
  24. </div>
  25. </footer>
  26. </div>
  27. </template>
  28. <script>
  29. import Mensen from '@/lib/Mensen.js'
  30. export default {
  31. name: 'app',
  32. data () {
  33. return {
  34. menu: {},
  35. mensen: Mensen,
  36. days: [1, 2, 3, 4, 5, 6],
  37. dayOfWeek: {
  38. 1: 'Montag',
  39. 2: 'Dienstag',
  40. 3: 'Mittwoch',
  41. 4: 'Donnerstag',
  42. 5: 'Freitag',
  43. 6: 'Samstag'
  44. },
  45. where: 'zentralmensa',
  46. when: '' + (new Date().getDay() || 1)
  47. }
  48. },
  49. watch: {
  50. 'where': 'updateRoute',
  51. 'when': 'updateRoute'
  52. },
  53. methods: {
  54. updateRoute () {
  55. this.$router.push(`/${this.where}/${this.when}`)
  56. window.localStorage.setItem('where', this.where)
  57. },
  58. previousDay () {
  59. this.when === 1 ? this.when = 6 : this.when--
  60. },
  61. nextDay () {
  62. this.when === 6 ? this.when = 1 : this.when++
  63. }
  64. },
  65. filters: {
  66. noBreak (value) {
  67. return value.replace(/\s/g, '\u00a0')
  68. }
  69. },
  70. computed: {
  71. today () {
  72. return '' + new Date().getDay()
  73. }
  74. },
  75. created () {
  76. this.where = window.localStorage.getItem('where') || 'zentralmensa'
  77. let vm = this
  78. document.onkeydown = (evt) => {
  79. evt = evt || window.event
  80. switch (evt.keyCode) {
  81. case 37:
  82. vm.previousDay()
  83. break
  84. case 39:
  85. vm.nextDay()
  86. break
  87. }
  88. }
  89. }
  90. }
  91. </script>
  92. <style src="./assets/base.css"></style>
  93. <style src="./assets/links.css"></style>
  94. <style>
  95. #app {
  96. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  97. -webkit-font-smoothing: antialiased;
  98. -moz-osx-font-smoothing: grayscale;
  99. text-align: center;
  100. color: #2c3e50;
  101. font-size: 16px;
  102. max-width: 30em;
  103. margin: 0 auto;
  104. }
  105. footer{
  106. margin: 1em 0;
  107. }
  108. footer > div {
  109. margin: 0.5em;
  110. }
  111. nav>a{
  112. margin: 0.3em;
  113. wrap: no-wrap;
  114. }
  115. .router-link-active:before{
  116. content: '>';
  117. }
  118. .router-link-active:after{
  119. content: '<';
  120. }
  121. </style>