From c1eb47c64ebc96e9babf58f24cbb81d81c28f2d8 Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 2 Nov 2018 17:46:49 +1000 Subject: [PATCH] basic html/css/js --- static/script.js | 42 +++++++++++++++++++++++++++++ static/style.css | 53 +++++++++++++++++++++++++++++++++++++ templates/landing_page.html | 22 +++++++++++++++ web.py | 4 +-- 4 files changed, 119 insertions(+), 2 deletions(-) diff --git a/static/script.js b/static/script.js index e69de29..7bf06f2 100644 --- a/static/script.js +++ b/static/script.js @@ -0,0 +1,42 @@ +Node.prototype.gel = function (id) { + return this.getElementById(id); +} + +Node.prototype.gcn = function (classname) { + return this.getElementsByClassName(classname); +} + +function dgel(id) { + return document.getElementById(id); +} + +function dgcn(classname) { + return document.getElementsByClassName(classname); +} + +/** + * Asynchronous function. Promises the text content of url. Automatically adds/removes from the loading counter. + * @param {string} url URL to request. Note that unless cross-domain is specifically permitted, this URL must come from the same domain as this file. + */ +async function ajax(url) { //must be called from an async function! use 'await', e.g. "var result = await ajax('https://google.com');" + return new Promise(resolve => { + var pageGetter = new XMLHttpRequest; + pageGetter.onreadystatechange = function () { + if (this.readyState == 4 && this.status == 200) { + resolve(this.responseText); + } else if (this.readyState == 4) { + resolve('Error: Expecting HTTP 200, got HTTP ' + this.status) + } + } + pageGetter.open('GET', url, true) + pageGetter.send(); + }); +} + +async function cont() { + url = dgel('instance-input').value; + if (url.substr(0,8) != "https://") { + url = "https://" + url + } + +} \ No newline at end of file diff --git a/static/style.css b/static/style.css index e69de29..38c1f25 100644 --- a/static/style.css +++ b/static/style.css @@ -0,0 +1,53 @@ +body { + font-family: sans-serif; + margin: 5%; + text-align: center; + background-color: #282c37; + color: white; +} +h1, h2 { + font-weight: 300; +} +h1 { + font-size: 4em; + margin:0; + font-family:"Open Sans", sans-serif; +} +h2 { + font-size: 2.5em; + font-family:"Open Sans", sans-serif; +} +#footer { + position:absolute; + bottom:5%; + width:90%; +} +#logo-main { + height:300px; + width:300px; +} +form { + background-color: #444b5d; + display:inline-block; + padding:50px; + border-radius:5px; + font-size:1.4em; +} +input { + margin:20px; + font-size:1.2em; +} +button { + font-size:1em; + text-transform: uppercase; + color:#2b90d9; + border: 2px #2b90d9 solid; + background-color:transparent; + border-radius:2px; + padding:10px 25px; + transition:0.2s all ease-in; +} +button:hover{ + background-color:#2b90d9; + color:white; +} diff --git a/templates/landing_page.html b/templates/landing_page.html index e69de29..0977208 100644 --- a/templates/landing_page.html +++ b/templates/landing_page.html @@ -0,0 +1,22 @@ + + + + Curious Greg + + + + + +

Curious Greg

+

Connect your Curious Cat and Mastodon accounts for automated crossposting.

+ +
+
+
+ +
+ + + \ No newline at end of file diff --git a/web.py b/web.py index 4c0f518..71e9e93 100755 --- a/web.py +++ b/web.py @@ -6,7 +6,7 @@ import requests, sqlite3, json from mastodon import Mastodon -from flask import Flask +from flask import Flask, render_template cfg = json.load(open("meta.json")) @@ -20,7 +20,7 @@ app.secret_key = cfg['flask_key'] @app.route('/') def main(): - return "test" + return render_template("landing_page.html") @app.route('/internal/auth_a') def internal_auth_a():