!7 p { independentSmartBot(); } html { S token = params.get("token"); S q = params.get("q"); Payload payload = null; if (nempty(token)) // TODO: cache payload = googleVerifyUserToken2(botCompanyGoogleSignInID(), token); S email = payload == null ? null : payload.getEmail(); if (nempty(q) && nempty(email)) post(email, "said", quote(q)); if (eq(uri, "/content-script")) { S text = null; bool again = false; if (payload == null) text = "You are not logged in."; if (text == null) { pnlStruct(payload); again = post(email, "logged in", ".") == null; if (!payload.getEmailVerified()) text = "Unverified email (huh?)"; } if (text == null) { bool de = cic((S) payload.get("locale"), "de"); S firstName = (S) payload.get("given_name"); text = p(htmlencode((de ? "Hallo " : "Hello ") + (again ? (de ? "mal wieder, " : "again ") : "") + firstName + "!")); S pic = (S) payload.get("picture"); if (de && isURL(pic)) text += p(htmlencode("Was für ein hübsches Bild:")) + p(himg(pic, title := firstName + ", ein toller Mensch")); } S script = [[$(".BUTTON_OUT").css('display', 'inline-block'); document.getElementById("content").innerHTML = ]] + jsQuote(text) + ";" + [[ $("input[name=token]").val($TOKEN); ]].replace("$TOKEN", jsQuote(token)); print(script); ret script; } ret hhtml(hhead(htitle("BotCompany.de") + loadJQuery() + googleSignIn_header() + hcss(andrzejButtonStyle()) + hSilentComputator() + hcookieconsent()) + hbody(hfullcenter( googleSignIn_signInButton(relativeRawBotLink(programID(), "content-script"), [[ eval(data); ]], [[ $(".BUTTON_OUT").css('display', 'none'); document.getElementById("content").innerHTML = ""; ]]) //+ hsmall(ahref(googleSignIn_signOutURL(), "Sign out")) + ahref(googleSignIn_signOutURL(), div("Sign out", class := "BUTTON_OUT", style := "display: none")) + "

" + div("", id := "content", style := "font-size: 30px") + form(hhidden('token, "") + htextinput('q, style := "text-align: center", placeholder := "Tell me something", autofocus := 'autofocus) + " " + hsubmit("OK")) + p(ahref("https://botcompany.de/chat", "more"))))); }