-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
66 lines (48 loc) · 1.7 KB
/
Copy pathscript.js
File metadata and controls
66 lines (48 loc) · 1.7 KB
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
/*var petitionData = {};
var ukSignatures = 0, totalSignatures;
var totalUkElectors = 45775758;
var countrydata = {}, countydata = {};
var parties = {};
var constituencyNo = {};
var constituancyData;
var onsData;*/
//Brexit: https://petition.parliament.uk/petitions/229963.json
//Revoke A50: https://petition.parliament.uk/petitions/241584.json
//BBC: https://petition.parliament.uk/petitions/235653.json
//CoronaVirus: https://petition.parliament.uk/petitions/300403.json
//$("#jsonForm").submit(e => {
// let url = document.getElementById("petitionJSON").value;
/*
let urlRegex = new RegExp("https:\/\/petition\.parliament\.uk\/petitions\/[0-9]{6,}\.json", "gi");
if (urlRegex.test(url)) {
window.localStorage.setItem("json", url);
e.preventDefault();
window.location.reload();
} else {
alert("That was not a vaild petitions json URL");
e.preventDefault();
}
});*/
//$("#searchForm").submit(e => {
// searchSubmit();
//e.preventDefault();
//})
/*$(document).ready(() => {
let url = window.localStorage.getItem("json") || "https://petition.parliament.uk/petitions/241584.json";
$.getJSON(url +"?t=" + (new Date).getTime(), (data) => {
$.getJSON("https://petition.parliament.uk/constituencies.json", (constituancyData) => {
$.getJSON("https://petitionmap.unboxedconsulting.com/json/mps/population_ons.json", (populationData) => {
petitionData = data;
onsData = populationData;
window.constituencyData = constituancyData;
let a = new Petition(url);
}, (error) => {
console.log(error);
});
}, (err) => {
console.log(err);
});
}, (err) => {
console.log(err);
});
});*/