Example #1
0
func RouterInit() {
	// beforechange -- Just check auth
	beforeChange := jqeventrouter.NullHandler()
	jqeventrouter.Listen("pagecontainerbeforechange", general.JQMRouteOnce(general.CleanFacebookURI(auth.CheckAuth(beforeChange))))

	// beforetransition
	beforeTransition := jqeventrouter.NewEventMux()
	beforeTransition.SetUriFunc(func(_ *jquery.Event, ui *js.Object) string {
		return util.JqmTargetUri(ui)
	})
	beforeTransition.HandleFunc("/login.html", login.BeforeTransition)
	beforeTransition.HandleFunc("/logout.html", logout.BeforeTransition)
	beforeTransition.HandleFunc("/sync.html", sync_handler.BeforeTransition)
	jqeventrouter.Listen("pagecontainerbeforetransition", beforeTransition)
}
Example #2
0
func RouterInit() {
	// mobileinit
	jQuery(document).On("mobileinit", func() {
		MobileInit()
		l10n_handler.MobileInit()
	})

	// beforechange -- Just check auth
	beforeChange := jqeventrouter.NullHandler()
	jqeventrouter.Listen("pagecontainerbeforechange", general.JQMRouteOnce(general.CleanFacebookURI(auth.CheckAuth(beforeChange))))

	// beforetransition
	beforeTransition := jqeventrouter.NewEventMux()
	beforeTransition.SetUriFunc(getJqmUri)
	beforeTransition.HandleFunc("/login.html", loginhandler.BeforeTransition)
	beforeTransition.HandleFunc("/logout.html", logouthandler.BeforeTransition)
	beforeTransition.HandleFunc("/import.html", importhandler.BeforeTransition)
	beforeTransition.HandleFunc("/study.html", studyhandler.BeforeTransition)
	jqeventrouter.Listen("pagecontainerbeforetransition", beforeTransition)

	// beforeshow
	beforeShow := jqeventrouter.NullHandler()
	jqeventrouter.Listen("pagecontainerbeforeshow", l10n_handler.LocalizePage(synchandler.SetupSyncButton(beforeShow)))
}