| 1 |
<!doctype html> |
| 2 |
<html lang="en-us"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>GEOCOD - Apprend a` coder</title> |
| 7 |
<link rel="stylesheet" type="text/css" media="all" href="https://members.loria.fr/Bruno.Levy/css/reset.css" /> |
| 8 |
<link rel="stylesheet" type="text/css" media="all" href="https://members.loria.fr/Bruno.Levy/css/style.css" /> |
| 9 |
<style> |
| 10 |
body { |
| 11 |
font-family: arial; |
| 12 |
margin: 0; |
| 13 |
padding: none; |
| 14 |
color: #ccc; |
| 15 |
} |
| 16 |
|
| 17 |
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; } |
| 18 |
div.emscripten { text-align: center; } |
| 19 |
div.emscripten_border { border: 1px solid black; } |
| 20 |
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */ |
| 21 |
canvas.emscripten { border: 0px none; } |
| 22 |
|
| 23 |
#emscripten_logo { |
| 24 |
display: inline-block; |
| 25 |
margin: 0; |
| 26 |
} |
| 27 |
|
| 28 |
.spinner { |
| 29 |
height: 30px; |
| 30 |
width: 30px; |
| 31 |
margin: 0; |
| 32 |
margin-top: 20px; |
| 33 |
margin-left: 20px; |
| 34 |
display: inline-block; |
| 35 |
vertical-align: top; |
| 36 |
|
| 37 |
-webkit-animation: rotation .8s linear infinite; |
| 38 |
-moz-animation: rotation .8s linear infinite; |
| 39 |
-o-animation: rotation .8s linear infinite; |
| 40 |
animation: rotation 0.8s linear infinite; |
| 41 |
|
| 42 |
border-left: 5px solid rgb(235, 235, 235); |
| 43 |
border-right: 5px solid rgb(235, 235, 235); |
| 44 |
border-bottom: 5px solid rgb(235, 235, 235); |
| 45 |
border-top: 5px solid rgb(120, 120, 120); |
| 46 |
|
| 47 |
border-radius: 100%; |
| 48 |
background-color: rgb(189, 215, 46); |
| 49 |
} |
| 50 |
|
| 51 |
@-webkit-keyframes rotation { |
| 52 |
from {-webkit-transform: rotate(0deg);} |
| 53 |
to {-webkit-transform: rotate(360deg);} |
| 54 |
} |
| 55 |
@-moz-keyframes rotation { |
| 56 |
from {-moz-transform: rotate(0deg);} |
| 57 |
to {-moz-transform: rotate(360deg);} |
| 58 |
} |
| 59 |
@-o-keyframes rotation { |
| 60 |
from {-o-transform: rotate(0deg);} |
| 61 |
to {-o-transform: rotate(360deg);} |
| 62 |
} |
| 63 |
@keyframes rotation { |
| 64 |
from {transform: rotate(0deg);} |
| 65 |
to {transform: rotate(360deg);} |
| 66 |
} |
| 67 |
|
| 68 |
#status { |
| 69 |
display: inline-block; |
| 70 |
vertical-align: top; |
| 71 |
margin-top: 30px; |
| 72 |
margin-left: 20px; |
| 73 |
font-weight: bold; |
| 74 |
color: rgb(120, 120, 120); |
| 75 |
} |
| 76 |
|
| 77 |
#progress { |
| 78 |
height: 20px; |
| 79 |
width: 30px; |
| 80 |
} |
| 81 |
|
| 82 |
#controls { |
| 83 |
display: inline-block; |
| 84 |
margin-top: 30px; |
| 85 |
margin-right: 20px; |
| 86 |
} |
| 87 |
|
| 88 |
#output { |
| 89 |
height: 150px; |
| 90 |
margin: 0 auto; |
| 91 |
margin-top: 10px; |
| 92 |
border-left: 0px; |
| 93 |
border-right: 0px; |
| 94 |
padding-left: 0px; |
| 95 |
padding-right: 0px; |
| 96 |
display: block; |
| 97 |
background-color: black; |
| 98 |
color: white; |
| 99 |
font-family: 'Lucida Console', Monaco, monospace; |
| 100 |
outline: none; |
| 101 |
display: none; |
| 102 |
} |
| 103 |
</style> |
| 104 |
</head> |
| 105 |
<body> |
| 106 |
<H1>GEOCOD - Apprend à coder</H1> |
| 107 |
<p> Cette page web te permet de créer tes propres programmes !! |
| 108 |
<i> Rem: Sous Edge, les menus sont tout noirs (illisibles), utilise de préférence Firefox ou Chrome. </i> </p> |
| 109 |
<li> |
| 110 |
<ul> - Essaye les programmes intégrés (menu File) </ul> |
| 111 |
<ul> - Ouvre l'éditeur de textes (menu Windows/Text Editor) </ul> |
| 112 |
<ul> - Change le programme, bidouille comme tu veux (vas-y, tu peux rien casser ici) </ul> |
| 113 |
<ul> - Sauve tes programmes sur ton ordi (menu File/Save as) </ul> |
| 114 |
<ul> - Retrouve la B.D. "les aventures de Shift et Tab", bientot sur vos écrans ! </ul> |
| 115 |
</li> |
| 116 |
|
| 117 |
<div class="spinner" id='spinner'></div> |
| 118 |
<div class="emscripten" id="status">Downloading...</div> |
| 119 |
|
| 120 |
<span id='controls'> |
| 121 |
<span> |
| 122 |
<ul> |
| 123 |
<li> |
| 124 |
<span>Clique ici pour charger tes programmes précédents depuis ton ordi-> <input type="file" id="wps_id" onchange="fileSelectionCallback();"/></span> |
| 125 |
</li> |
| 126 |
<li> |
| 127 |
Clique ici pour passer en mode plein écran -> |
| 128 |
<input type="button" value="FullScreen" onclick="Module.requestFullScreen(false, true)"/> |
| 129 |
</li> |
| 130 |
</ul> |
| 131 |
</span> |
| 132 |
|
| 133 |
</span> |
| 134 |
|
| 135 |
<div class="emscripten"> |
| 136 |
<progress value="0" max="100" id="progress" hidden=1></progress> |
| 137 |
</div> |
| 138 |
|
| 139 |
|
| 140 |
<div class="emscripten_border"> |
| 141 |
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas> |
| 142 |
</div> |
| 143 |
|
| 144 |
<textarea id="output" rows="8" cols="80"></textarea> |
| 145 |
|
| 146 |
<script type='text/javascript'> |
| 147 |
var statusElement = document.getElementById('status'); |
| 148 |
var progressElement = document.getElementById('progress'); |
| 149 |
var spinnerElement = document.getElementById('spinner'); |
| 150 |
|
| 151 |
|
| 152 |
var Module = { |
| 153 |
preRun: [], |
| 154 |
postRun: [], |
| 155 |
print: (function() { |
| 156 |
var element = document.getElementById('output'); |
| 157 |
if (element) element.value = ''; // clear browser cache |
| 158 |
return function(text) { |
| 159 |
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); |
| 160 |
console.log(text); |
| 161 |
if (element) { |
| 162 |
element.value += text + "\n"; |
| 163 |
element.scrollTop = element.scrollHeight; // focus on bottom |
| 164 |
} |
| 165 |
}; |
| 166 |
})(), |
| 167 |
printErr: function(text) { |
| 168 |
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); |
| 169 |
if (0) { // XXX disabled for safety typeof dump == 'function') { |
| 170 |
dump(text + '\n'); // fast, straight to the real console |
| 171 |
} else { |
| 172 |
console.error(text); |
| 173 |
} |
| 174 |
}, |
| 175 |
canvas: (function() { |
| 176 |
var canvas = document.getElementById('canvas'); |
| 177 |
|
| 178 |
// As a default initial behavior, pop up an alert when webgl context is lost. To make your |
| 179 |
// application robust, you may want to override this behavior before shipping! |
| 180 |
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2 |
| 181 |
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false); |
| 182 |
|
| 183 |
return canvas; |
| 184 |
})(), |
| 185 |
setStatus: function(text) { |
| 186 |
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; |
| 187 |
if (text === Module.setStatus.text) return; |
| 188 |
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/); |
| 189 |
var now = Date.now(); |
| 190 |
if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon |
| 191 |
if (m) { |
| 192 |
text = m[1]; |
| 193 |
progressElement.value = parseInt(m[2])*100; |
| 194 |
progressElement.max = parseInt(m[4])*100; |
| 195 |
progressElement.hidden = false; |
| 196 |
spinnerElement.hidden = false; |
| 197 |
} else { |
| 198 |
progressElement.value = null; |
| 199 |
progressElement.max = null; |
| 200 |
progressElement.hidden = true; |
| 201 |
if (!text) spinnerElement.style.display = 'none'; |
| 202 |
} |
| 203 |
statusElement.innerHTML = text; |
| 204 |
}, |
| 205 |
totalDependencies: 0, |
| 206 |
monitorRunDependencies: function(left) { |
| 207 |
this.totalDependencies = Math.max(this.totalDependencies, left); |
| 208 |
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'); |
| 209 |
} |
| 210 |
}; |
| 211 |
Module.setStatus('Downloading...'); |
| 212 |
window.onerror = function(event) { |
| 213 |
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus |
| 214 |
Module.setStatus('Exception thrown, see JavaScript console'); |
| 215 |
spinnerElement.style.display = 'none'; |
| 216 |
Module.setStatus = function(text) { |
| 217 |
if (text) Module.printErr('[post-exception status] ' + text); |
| 218 |
}; |
| 219 |
}; |
| 220 |
</script> |
| 221 |
<script> |
| 222 |
|
| 223 |
(function() { |
| 224 |
var memoryInitializer = 'geocod.js.mem'; |
| 225 |
if (typeof Module['locateFile'] === 'function') { |
| 226 |
memoryInitializer = Module['locateFile'](memoryInitializer); |
| 227 |
} else if (Module['memoryInitializerPrefixURL']) { |
| 228 |
memoryInitializer = Module['memoryInitializerPrefixURL'] + memoryInitializer; |
| 229 |
} |
| 230 |
var xhr = Module['memoryInitializerRequest'] = new XMLHttpRequest(); |
| 231 |
xhr.open('GET', memoryInitializer, true); |
| 232 |
xhr.responseType = 'arraybuffer'; |
| 233 |
xhr.send(null); |
| 234 |
})(); |
| 235 |
|
| 236 |
var script = document.createElement('script'); |
| 237 |
script.src = "geocod.js"; |
| 238 |
document.body.appendChild(script); |
| 239 |
|
| 240 |
</script> |
| 241 |
|
| 242 |
<script> |
| 243 |
function saveFileToMemoryFS(e) { |
| 244 |
var data=e.target.result; |
| 245 |
try { |
| 246 |
FS.unlink(e.target.current_file_name); |
| 247 |
} catch(e) { |
| 248 |
} |
| 249 |
FS.createDataFile( |
| 250 |
'/', e.target.current_file_name, data, true, true, true |
| 251 |
); |
| 252 |
Module.ccall('file_system_changed_callback'); |
| 253 |
} |
| 254 |
|
| 255 |
function fileSelectionCallback() { |
| 256 |
var files = document.getElementById("wps_id").files, |
| 257 |
nFiles = files.length; |
| 258 |
for (var nFileId = 0; nFileId < nFiles; nFileId++) { |
| 259 |
var file=files[nFileId]; |
| 260 |
var reader = new FileReader(); |
| 261 |
reader.current_file_name = file.name; |
| 262 |
reader.onload = saveFileToMemoryFS; |
| 263 |
reader.readAsBinaryString(file); |
| 264 |
} |
| 265 |
} |
| 266 |
</script> |
| 267 |
|
| 268 |
<script src="FileSaver.js"> </script> |
| 269 |
|
| 270 |
<script> |
| 271 |
function saveFileFromMemoryFSToDisk(name) { |
| 272 |
var data=FS.readFile(name); |
| 273 |
var blob; |
| 274 |
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); |
| 275 |
if(isSafari) { |
| 276 |
blob = new Blob([data.buffer], {type: "application/octet-stream"}); |
| 277 |
} else { |
| 278 |
blob = new Blob([data.buffer], {type: "application/octet-binary"}); |
| 279 |
} |
| 280 |
saveAs(blob, name); |
| 281 |
} |
| 282 |
</script> |
| 283 |
|
| 284 |
<!-- DATAFILE --> |
| 285 |
|
| 286 |
|
| 287 |
<script> |
| 288 |
document.onkeydown = function (e) { |
| 289 |
if (e.keyCode === 116) { |
| 290 |
return false; |
| 291 |
} |
| 292 |
}; |
| 293 |
</script> |
| 294 |
|
| 295 |
</body> |
| 296 |
</html> |