-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstep-3.php
83 lines (76 loc) · 2.7 KB
/
step-3.php
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!--
***************************************************************************************************
*** Storytelling Author Mapillary BAsed (SAMBA).
*** Description: Step 3 to create a storytelling based on Mapillary: download the code
*** Author: Cesare Gerbino
*** Code: https://github.com/cesaregerbino/StorytellingAuthorMapillaryBAsed
*** License: MIT (https://opensource.org/licenses/MIT)
***************************************************************************************************
-->
<!doctype html>
<html>
<head>
<title>Step 3</title>
</head>
<body>
<?php
//*** Get the page code to prepare its download...
$thePage = unserialize(base64_decode($_POST["thePage_serialized"])); //prendo i dati dal form
?>
<center>
<table>
<tr>
<td colspan="3">
Now you can download the virtual route preview code to use and adapt it in your web pages<br>
<br>
</td>
</tr>
<tr>
<td colspan="3">
<?php
echo '<textarea id="inputTextToSave" cols="80" rows="25" >'.$thePage.'</textarea>';
?>
</td>
</tr>
<tr>
<td>Filename to Save As:</td>
<td><input id="inputFileNameToSaveAs" value="thePage.html"></input></td>
<td><button onclick="saveTextAsFile()">Save Text to File</button></td>
</tr>
<tr>
<!-- *** Add a help page ... -->
<td colspan="3">
<center>
<br>
<br>
<a href="#" onclick="window.open('help-step-3.html', 'Help Step 3', 'width=800, height=600, resizable, status, scrollbars=1, location')">
Take a look to use this page ...;
</a>
</center>
</td>
</tr>
</table>
</center>
<script type="text/javascript">
function saveTextAsFile()
{
var textToSave = document.getElementById("inputTextToSave").value;
var textToSaveAsBlob = new Blob([textToSave], {type:"text/plain"});
var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
var fileNameToSaveAs = document.getElementById("inputFileNameToSaveAs").value;
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
downloadLink.href = textToSaveAsURL;
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
downloadLink.click();
}
function destroyClickedElement(event)
{
document.body.removeChild(event.target);
}
</script>
</body>
</html>