Spaces:
Running
Running
Upload 3 files
Browse files- client.js +25 -0
- index.html +48 -0
- style.css +82 -0
client.js
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// client-side js
|
2 |
+
// run by the browser each time your view template is loaded
|
3 |
+
|
4 |
+
// by default, you've got jQuery,
|
5 |
+
// add other scripts at the bottom of index.html
|
6 |
+
|
7 |
+
$(function () {
|
8 |
+
console.log("hello world :o");
|
9 |
+
|
10 |
+
$.get("/dreams", function (dreams) {
|
11 |
+
dreams.forEach(function (dream) {
|
12 |
+
$("<li></li>").text(dream).appendTo("ul#dreams");
|
13 |
+
});
|
14 |
+
});
|
15 |
+
|
16 |
+
$("form").submit(function (event) {
|
17 |
+
event.preventDefault();
|
18 |
+
var dream = $("input").val();
|
19 |
+
$.post("/dreams?" + $.param({ dream: dream }), function () {
|
20 |
+
$("<li></li>").text(dream).appendTo("ul#dreams");
|
21 |
+
$("input").val("");
|
22 |
+
$("input").focus();
|
23 |
+
});
|
24 |
+
});
|
25 |
+
});
|
index.html
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- This is a jinja2 -->
|
2 |
+
<!-- served from your routes in server.py -->
|
3 |
+
|
4 |
+
<!DOCTYPE html>
|
5 |
+
<html>
|
6 |
+
<head>
|
7 |
+
<title>Welcome to Glitch!</title>
|
8 |
+
<meta name="description" content="A cool thing made with Glitch">
|
9 |
+
<link id="favicon" rel="icon" href="https://glitch.com/edit/favicon-app.ico" type="image/x-icon">
|
10 |
+
<meta charset="utf-8">
|
11 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
12 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
13 |
+
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}">
|
14 |
+
</head>
|
15 |
+
<body>
|
16 |
+
<header>
|
17 |
+
<h1>
|
18 |
+
A 🐍🐍🐍 Dream of the Future
|
19 |
+
</h1>
|
20 |
+
</header>
|
21 |
+
|
22 |
+
<main>
|
23 |
+
<p class="bold">Oh hi,</p>
|
24 |
+
<p>Tell me your hopes and dreams:</p>
|
25 |
+
<form>
|
26 |
+
<input type="text" maxlength="100" placeholder="Dreams!">
|
27 |
+
<button type="submit">Submit</button>
|
28 |
+
</form>
|
29 |
+
<section class="dreams">
|
30 |
+
<ul id="dreams">
|
31 |
+
</ul>
|
32 |
+
</section>
|
33 |
+
</main>
|
34 |
+
|
35 |
+
<footer>
|
36 |
+
<a href="https://glitch.com/edit/#!/remix/python3">
|
37 |
+
Remix this in Glitch
|
38 |
+
</a>
|
39 |
+
</footer>
|
40 |
+
|
41 |
+
<!-- Your web-app is https, so your scripts need to be too -->
|
42 |
+
<script src="https://code.jquery.com/jquery-2.2.1.min.js"
|
43 |
+
integrity="sha256-gvQgAFzTH6trSrAWoH1iPo9Xc96QxSZ3feW6kem+O00="
|
44 |
+
crossorigin="anonymous"></script>
|
45 |
+
<script src="{{url_for('static', filename='/client.js')}}"></script>
|
46 |
+
|
47 |
+
</body>
|
48 |
+
</html>
|
style.css
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* styles */
|
2 |
+
/* called by your view template */
|
3 |
+
|
4 |
+
/* You might want to try something fancier: */
|
5 |
+
/* less: http://lesscss.org/ */
|
6 |
+
|
7 |
+
* {
|
8 |
+
box-sizing: border-box;
|
9 |
+
}
|
10 |
+
|
11 |
+
body {
|
12 |
+
font-family: helvetica, arial, sans-serif;
|
13 |
+
margin: 25px;
|
14 |
+
}
|
15 |
+
|
16 |
+
h1 {
|
17 |
+
font-weight: bold;
|
18 |
+
color: pink;
|
19 |
+
}
|
20 |
+
|
21 |
+
.bold {
|
22 |
+
font-weight: bold;
|
23 |
+
}
|
24 |
+
|
25 |
+
p {
|
26 |
+
max-width: 600px;
|
27 |
+
}
|
28 |
+
|
29 |
+
form {
|
30 |
+
margin-bottom: 25px;
|
31 |
+
padding: 15px;
|
32 |
+
background-color: cyan;
|
33 |
+
display: inline-block;
|
34 |
+
width: 100%;
|
35 |
+
max-width: 340px;
|
36 |
+
border-radius: 3px;
|
37 |
+
}
|
38 |
+
|
39 |
+
input {
|
40 |
+
display: block;
|
41 |
+
margin-bottom: 10px;
|
42 |
+
padding: 5px;
|
43 |
+
width: 100%;
|
44 |
+
border: 1px solid lightgrey;
|
45 |
+
border-radius: 3px;
|
46 |
+
font-size: 16px;
|
47 |
+
}
|
48 |
+
|
49 |
+
button {
|
50 |
+
font-size: 16px;
|
51 |
+
border-radius: 3px;
|
52 |
+
background-color: lightgrey;
|
53 |
+
border: 1px solid grey;
|
54 |
+
box-shadow: 2px 2px teal;
|
55 |
+
cursor: pointer;
|
56 |
+
}
|
57 |
+
|
58 |
+
button:hover {
|
59 |
+
background-color: yellow;
|
60 |
+
}
|
61 |
+
|
62 |
+
button:active {
|
63 |
+
box-shadow: none;
|
64 |
+
}
|
65 |
+
|
66 |
+
li {
|
67 |
+
margin-bottom: 5px;
|
68 |
+
}
|
69 |
+
|
70 |
+
footer {
|
71 |
+
margin-top: 50px;
|
72 |
+
padding-top: 25px;
|
73 |
+
border-top: 1px solid lightgrey;
|
74 |
+
}
|
75 |
+
|
76 |
+
footer > a {
|
77 |
+
color: #BBBBBB;
|
78 |
+
}
|
79 |
+
|
80 |
+
.nicejob {
|
81 |
+
text-decoration: line-through;
|
82 |
+
}
|