Merge pull request #48 from iharosi/master
Merge pull request #48 from iharosi/master

minimal-ui added to allow fullscreen on iOS 7.1

file:a/README.md -> file:b/README.md
--- a/README.md
+++ b/README.md
@@ -2,6 +2,15 @@
 A small clone of [1024](https://play.google.com/store/apps/details?id=com.veewo.a1024), based on [Saming's 2048](http://saming.fr/p/2048/) (also a clone).
 
 Made just for fun. [Play it here!](http://gabrielecirulli.github.io/2048/)
+
+### Contributions
+
+ - [TimPetricola](https://github.com/TimPetricola) added best score storage
+ - [chrisprice](https://github.com/chrisprice) added custom code for swipe handling on mobile
+
+Many thanks to [rayhaanj](https://github.com/rayhaanj), [Mechazawa](https://github.com/Mechazawa), [grant](https://github.com/grant), [remram44](https://github.com/remram44) and [ghoullier](https://github.com/ghoullier) for the many other good contributions.
+
+### Screenshot
 
 [![Screenshot](http://pictures.gabrielecirulli.com/2048-20140309-234100.png)](http://pictures.gabrielecirulli.com/2048-20140309-234100.png)
 

file:a/index.html -> file:b/index.html
--- a/index.html
+++ b/index.html
@@ -6,10 +6,12 @@
 
   <link href="style/main.css" rel="stylesheet" type="text/css">
   <link rel="shortcut icon" href="favicon.ico">
+  <link rel="apple-touch-icon" href="meta/apple-touch-icon.png">
+  <meta name="apple-mobile-web-app-capable" content="yes">
 
   <meta name="HandheldFriendly" content="True">
   <meta name="MobileOptimized" content="320">
-  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0, maximum-scale=1, user-scalable=no">
+  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0, maximum-scale=1, user-scalable=no, minimal-ui">
 </head>
 <body>
   <div class="container">
@@ -67,6 +69,10 @@
     </p>
     <hr>
     <p>
+    <strong class="important">Note:</strong> This site is the official version of 2048. You can play it on your phone via <a href="http://git.io/2048">http://git.io/2048.</a> All other apps or sites are derivatives or fakes, and should be used with caution.
+    </p>
+    <hr>
+    <p>
     Created by <a href="http://gabrielecirulli.com" target="_blank">Gabriele Cirulli.</a> Based on <a href="https://itunes.apple.com/us/app/1024!/id823499224" target="_blank">1024 by Veewo Studio</a> and conceptually similar to <a href="http://asherv.com/threes/" target="_blank">Threes by Asher Vollmer.</a>
     </p>
   </div>

--- a/js/keyboard_input_manager.js
+++ b/js/keyboard_input_manager.js
@@ -55,6 +55,7 @@
 
   var retry = document.getElementsByClassName("retry-button")[0];
   retry.addEventListener("click", this.restart.bind(this));
+  retry.addEventListener("touchend", this.restart.bind(this));
 
   // Listen to swipe events
   var touchStartClientX, touchStartClientY;

--- a/js/local_score_manager.js
+++ b/js/local_score_manager.js
@@ -1,14 +1,21 @@
 window.fakeStorage = {
-  _data       : {},
-  setItem     : function (id, val) {
-    console.log("set");
+  _data: {},
+
+  setItem: function (id, val) {
     return this._data[id] = String(val);
   },
-  getItem     : function (id) {
+
+  getItem: function (id) {
     return this._data.hasOwnProperty(id) ? this._data[id] : undefined;
   },
-  removeItem  : function (id) { return delete this._data[id]; },
-  clear       : function () { return this._data = {}; }
+
+  removeItem: function (id) {
+    return delete this._data[id];
+  },
+
+  clear: function () {
+    return this._data = {};
+  }
 };
 
 function LocalScoreManager() {
@@ -19,11 +26,7 @@
 }
 
 LocalScoreManager.prototype.get = function () {
-  var score = this.storage.getItem(this.key);
-  if (typeof score === "undefined" || score === null) {
-    score = 0;
-  }
-  return score;
+  return this.storage.getItem(this.key) || 0;
 };
 
 LocalScoreManager.prototype.set = function (score) {

 Binary files /dev/null and b/meta/apple-touch-icon.png differ
comments