Script to generate nicely formatted schedule pages for my university (Hanze). Interprets the JSON generated by the digirooster.hanze.nl website (check devtools for the ajax request).
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.

page.tmpl 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>{{.ClassName}}</title>
  5. <link rel="stylesheet" href="style.css" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1" />
  7. <meta charset="utf-8" />
  8. </head>
  9. <body>
  10. <header>
  11. <div>
  12. <strong>{{.ClassName}}</strong> - <a href="index.html">home</a> <div class="spacer"> </div> <div style="display: inline-block;"><button id="left">&larr;</button><button id="currentweek">current week</button><button id="right">&rarr;</button></div>
  13. <small>updated: {{.GeneratedTimeStr}}</small>
  14. </div>
  15. </header>
  16. <main>
  17. {{range .Weeks}}
  18. <h2 id="week_{{.WeekNumber}}">Week {{.WeekNumber}} <small>({{.Hours}} hours)</small></h2>
  19. <section data-week="{{.WeekNumber}}" data-startat="{{.StartAt}}" data-endat="{{.EndAt}}">
  20. {{range $index, $d := .Days}}
  21. <div class="day" data-day="{{$index}}">
  22. <h3>{{if .DayString}}{{ .DayString}} <small>({{.Hours}} hours)</small>{{else}}&nbsp;{{end}}</h3>
  23. <div class="activities">
  24. {{range $d.Activities}}
  25. <div class="activity{{if .NonImportant}} nonimportant{{end}}{{if .Important}} important{{end}}" style="margin-top: {{.Padding}}px; min-height: {{.Height}}px; height: {{.Height}}px;box-shadow: 0px 0px 5px #{{.CourseColour}} inset;">
  26. <div style="float: right;">{{.StartStr}}</div>
  27. <h4><span title="{{.OrigDesc}}">{{.Desc}}</span></h4>
  28. <div style="float: right; color: #{{.CourseColour}};">{{.Course}}</div>
  29. {{.Loc}}<br />
  30. {{range $i, $s := .Staff}}
  31. {{if gt $i 0}}, {{end}}
  32. {{if $s.Name}}
  33. <span title="{{$s.ID}}">{{$s.Name}}</span>
  34. {{else}}
  35. {{$s.ID}}
  36. {{end}}
  37. {{end}}<br />
  38. <small><div style="float:right;"><span title="{{range $i, $c := .Classes}}{{if gt $i 0}}, {{end}}{{$c}}{{end}}">{{len .Classes}} class{{if gt (len .Classes) 1}}es{{end}}</span></div>Ends: {{.EndStr}}</small><br />
  39. </div>
  40. {{end}}
  41. </div>
  42. </div>
  43. {{end}}
  44. </section>
  45. {{end}}
  46. (generated on: {{.GeneratedTimeStr}})
  47. </main>
  48. <script type="text/javascript" src="script.js"></script>
  49. </body>
  50. </html>