Browse Source

Merge pull request #225 from visuddhinanda/master

课程表多语言
Bhikkhu-Kosalla 5 years ago
parent
commit
f81de8fa6e
2 changed files with 14 additions and 1 deletions
  1. 13 0
      app/lib/fullcalendar/examples/time-zones.html
  2. 1 1
      app/uhome/course.php

+ 13 - 0
app/lib/fullcalendar/examples/time-zones.html

@@ -5,6 +5,18 @@
 		<link href="../lib/main.css" rel="stylesheet" />
 		<script src="../lib/main.js"></script>
 		<script>
+			function getCookie(name) {
+				var start = document.cookie.indexOf(name + "=");
+				var len = start + name.length + 1;
+				if (!start && name != document.cookie.substring(0, name.length)) {
+					return null;
+				}
+				if (start == -1) return null;
+				var end = document.cookie.indexOf(";", len);
+				if (end == -1) end = document.cookie.length;
+				return decodeURI(document.cookie.substring(len, end));
+			}
+
 			document.addEventListener("DOMContentLoaded", function () {
 				var initialTimeZone = "local";
 				var timeZoneSelectorEl = document.getElementById("time-zone-selector");
@@ -13,6 +25,7 @@
 
 				var calendar = new FullCalendar.Calendar(calendarEl, {
 					timeZone: initialTimeZone,
+					locale: getCookie("language"),
 					headerToolbar: {
 						left: "prev,next today",
 						center: "title",

+ 1 - 1
app/uhome/course.php

@@ -24,7 +24,7 @@ include "../pcdl/html_head.php";
     },
     function(data,status){
         let arrData = JSON.parse(data);
-        let html='<iframe style="width: 100%;height: 60vh;" src="../lib/fullcalendar/examples/time-zones.html"></iframe>';
+        let html='<iframe style="width: 100%;height: 67em;" src="../lib/fullcalendar/examples/time-zones.html"></iframe>';
         for (const iterator of arrData) {
             html += '<div class="card" style="display:flex;margin:1em;padding:10px;">';