-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (65 loc) · 2.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="en-GB">
<head>
<title>GPT2 Petitions</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width" />
<meta name="theme-color" content="#080">
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.0.min.js"></script>
<script type="text/javascript">
var petitions = [];
var id;
function load() {
id = window.location.hash.substr(1);
$.getJSON("pregenerated.json", function(data) {
petitions = data;
if (id == "") {
id = Math.floor(Math.random() * petitions.length);
}
populate();
});
}
function random() {
id = Math.floor(Math.random() * petitions.length);
populate();
}
function populate() {
let petition = petitions[id];
$("#title").html(petition.title);
$("#text").html(petition.body);
window.location.hash = id;
}
</script>
</head>
<body onload="load();">
<header role="banner" id="global-header">
<div class="wrapper">
<div id='icon'><img src='icon.svg' /></div>
<a href='#' class="proposition" onclick='random(); event.preventDefault();'><span class="graphic graphic-portcullis-white"></span>GPT2 Petitions</a>
<p class="strapline">The policies you deserve</p>
</div>
</header>
<div id="main">
<div id="content">
<h1 id="title"></h1>
<div id="text"></div>
<br /><br />
<div id='reload'>
<a href='#' onclick='random(); event.preventDefault();'>Generate another</a>
</div>
<br />
</div>
</div>
<div id="footer">
<div class="wrapper">
A silly thing by <a href='https://twitter.com/mikesheldon'>@mikesheldon</a><br />
<br />
<a href='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/Elleo/petition_generator'>Source code</a><br />
<br />
All content is available under the <a href='https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'>Open Government Licence v3.0</a>, except where otherwise stated.<br />
</div>
</div>
</body>
</html>