basic html/css/js

This commit is contained in:
Lynne Megido 2018-11-02 17:46:49 +10:00
parent 54fdba7207
commit c1eb47c64e
Signed by: lynnesbian
GPG key ID: FB7B970303ACE499
4 changed files with 119 additions and 2 deletions

View file

@ -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
}
}

View file

@ -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;
}

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>Curious Greg</title>
<link rel='stylesheet' type='text/css' href="{{ url_for('static', filename='style.css') }}" />
<script type="text/javascript" src="{{ url_for('static', filename='script.js') }}"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
</head>
<body>
<h1>Curious Greg</h1>
<h2>Connect your Curious Cat and Mastodon accounts for automated crossposting.</h2>
<!-- <div id='logo-main'></div> -->
<form onsubmit='cont(); return false'>
<label for='instance'>Instance URL</label><br />
<input name='instance' placeholder='mastodon.social' id='instance-input' /><br />
<button class='loading'>Continue</button>
</form>
<div id='footer'>
Note that Curious Greg requires first-party cookies to be enabled. You may safely delete the cookie upon completing the connection process.
</div>
</body>
</html>

4
web.py
View file

@ -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():