forked from betagouv/beta.gouv.fr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trampoline.html
24 lines (24 loc) · 967 Bytes
/
trampoline.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
---
layout: null
---
<!DOCTYPE html>
<html lang="fr">
<head><title>Trampoline</title></head>
<body>
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=default,fetch"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.19.0/URI.js"></script>
<script>
let params = new URI(window.location.href).query(true)
let what = params.what
let where = params.where
let templateUrl = "https://raw.githubusercontent.com/betagouv/beta.gouv.fr/master/content/templates/"+what+".md"
fetch(templateUrl)
.then(function(response) { return response.text()})
.then(function(body) {
let encoded = encodeURIComponent(body);
let destination = "https://github.com/betagouv/beta.gouv.fr/new/master/?filename="+where+"&value="+encoded
window.location = destination
})
</script>
</body>
</html>