@@ -163,9 +180,9 @@
document.body.appendChild(script);
- window.onbeforeunload = function () { // Ctrl+W
- return "Really want to quit the game?";
- };
+ //window.onbeforeunload = function () { // Ctrl+W
+ // return "Really want to quit the game?";
+ //};
var isMobile = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
@@ -175,7 +192,30 @@
document.getElementById('info').style.display = 'none';
}
- function readLevel(event, home) {
+ function getLatestChanges() {
+ var xhr = new XMLHttpRequest();
+
+ xhr.onreadystatechange = function() {
+ if (this.readyState === 4 && this.status === 200) {
+ e = document.getElementById('latest_changes');
+ str = '
';
+ for (var i = 0; i < this.response.length; i++) {
+ var item = this.response[i];
+ var d = new Date(item.commit.author.date);
+ var date = d.getDate() + '.' + (d.getMonth() + 1) + '.' + d.getFullYear();
+ str += '
' + date + '
' + item.commit.message + '
';
+ }
+ str += '
';
+ e.innerHTML = str;
+ }
+ };
+
+ xhr.open('GET', "https://api.github.com/repos/XProger/OpenLara/commits", true);
+ xhr.responseType = 'json';
+ xhr.send(null);
+ }
+
+ function readLevel(event) {
var reader = new FileReader();
reader.onload = function(){
var size = reader.result.byteLength;
@@ -185,6 +225,46 @@
};
reader.readAsArrayBuffer(event.target.files[0]);
}
+ /*
+ var db;
+ var request = indexedDB.open("db");
+request.onupgradeneeded = function() {
+console.log("!!!!!!!! NO DB!");
+};
+request.onsuccess = function() {
+ db = request.result;
+ // Enable our buttons once the IndexedDB instance is available.
+
+};
+
+ function logTimestamps(timestamps) {
+ console.log('There are ' + timestamps.length +
+ ' timestamp(s) saved in IndexedDB: ' + timestamps.join(', '));
+}
+
+ function backupSaves() {
+
+ var transaction = db.transaction("FILE_DATA", 'readonly');
+ var store = transaction.objectStore("FILE_DATA");
+ store.get("level/1/GYMLOAD.PNG").onsuccess = function(e) {
+ var value = e.target.result;
+ // value will be: { zip: {}, foo: { bar: { baz: 1 } } }
+ console.log(value);
+ var data = value;
+ var a = document.createElement("a");
+
+ a.href = URL.createObjectURL(new Blob([data]));
+ a.download = "savegame.dat";
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ };
+
+ }
+*/
+ function restoreSaves() {
+ alert('restore');
+ }