Esempio n. 1
0
func main() {

	// // Ask user for verification code
	// fmt.Print("Enter code: ")
	// var code string
	// // NOTE: This does not work with gopherjs
	// fmt.Scanln(&code)
	//
	// framework.SetSchool("amstelveencollege")
	//
	// token := framework.GetToken(code)
	// framework.GetError()
	//
	// fmt.Println(token)

	framework.SetSchool("amstelveencollege")
	framework.SetToken("rdnn2ng1c8t2ok3jd4ss3977v9")
	framework.SetTimeDiff(1)

	framework.RequestUserData()
	framework.GetError()
	fmt.Println(framework.GetName())
	fmt.Println(framework.GetId())

	framework.RequestScheduleData(1448918611)
	framework.GetError()
	classCount := framework.GetClassCount()
	fmt.Println(classCount)
	for i := 0; i < classCount; i++ {
		fmt.Println(framework.GetClassName(i) + " " + framework.GetClassStartTime(i) + " - " + framework.GetClassEndTime(i) + " " + framework.GetClassTeacher(i) + " " + framework.GetClassRoom(i) + " " + strconv.Itoa(framework.GetClassStatus(i)))

	}
}
Esempio n. 2
0
func main() {

	framework.SetSchool(school)
	framework.SetTimeDiff(1)

	d := dom.GetWindow().Document()
	// auth := d.GetElementByID("auth_form").(*dom.HTMLFormElement)
	// auth.SetClass("")

	authButton := d.GetElementByID("auth_button")
	authButton.AddEventListener("click", false, func(event dom.Event) {

		go func() {

			token = framework.GetToken(d.GetElementByID("auth").(*dom.HTMLInputElement).Value)
			fmt.Println("Received token: " + token)
			expires := time.Now().Add(time.Minute * 60 * 24 * 365)
			cookie.Set("token", token, &expires, "/")
			js.Global.Get("location").Call("reload", false)
		}()
	})

	token2, ok := cookie.Get("token")
	token = token2

	if ok {

		// fmt.Println("Token: " + token)
		framework.SetToken(token)
		//
		// code := d.GetElementByID("code_form").(*dom.HTMLFormElement)
		// code.SetClass("")
		//
		// codeButton := d.GetElementByID("code_button")
		// codeButton.AddEventListener("click", false, func(event dom.Event) {
		//
		//     go func() {
		//
		// 	user = d.GetElementByID("code").(*dom.HTMLInputElement).Value
		// 	fmt.Println(user)
		//
		// 	showSchedule()
		// 	fmt.Println(token)
		//     }()
		// })
		showSchedule()
	}

}