diff --git a/include/views/default/crunchbutton/bundle/js.phtml b/include/views/default/crunchbutton/bundle/js.phtml
index d1a7bedf4..b43c2553f 100644
--- a/include/views/default/crunchbutton/bundle/js.phtml
+++ b/include/views/default/crunchbutton/bundle/js.phtml
@@ -41,8 +41,8 @@ if ($this->community) {
-
+
@@ -137,19 +137,7 @@ $(function() {
-
+
\ No newline at end of file
diff --git a/include/views/default/crunchbutton/layout/html.bottom.phtml b/include/views/default/crunchbutton/layout/html.bottom.phtml
index dc8d034f4..48c42d52e 100644
--- a/include/views/default/crunchbutton/layout/html.bottom.phtml
+++ b/include/views/default/crunchbutton/layout/html.bottom.phtml
@@ -122,6 +122,20 @@ if (App){
endif ; ?>
+
+
Dialog example
This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.
diff --git a/www/assets/js/TimeMachine.js b/www/assets/js/TimeMachine.js
index dea894ac0..745086483 100644
--- a/www/assets/js/TimeMachine.js
+++ b/www/assets/js/TimeMachine.js
@@ -23,8 +23,8 @@ function TimeMachine() {
*/
this.__construct = function()
{
- if ($.cookie('TimeMachine')) {
- _fixedTime = $.cookie('TimeMachine');
+ if ($.totalStorage('TimeMachine')) {
+ _fixedTime = $.totalStorage('TimeMachine');
}
}
@@ -52,7 +52,7 @@ function TimeMachine() {
this.toBeContinued = function()
{
- $.cookie('TimeMachine', _fixedTime);
+ $.totalStorage('TimeMachine', _fixedTime);
}
/**
diff --git a/www/assets/js/app.js b/www/assets/js/app.js
index c9239d763..26235d5f9 100644
--- a/www/assets/js/app.js
+++ b/www/assets/js/app.js
@@ -44,9 +44,11 @@ var App = {
crunchSoundAlreadyPlayed : false,
useCompleteAddress : false, /* if true it means the address field will be fill with the address found by google api */
completeAddressWithZipCode : true,
- boundingBoxMeters : 8000
+ boundingBoxMeters : 8000,
+ localStorage: false
};
+
App.alert = function(txt) {
setTimeout(function() {
alert(txt);
@@ -386,9 +388,9 @@ App.test = {
App.alert(JSON.stringify(App.cart.items));
},
clearloc: function() {
- $.cookie('community', '', { expires: new Date(3000,01,01), path: '/'});
- $.cookie('location_lat', '', { expires: new Date(3000,01,01), path: '/'});
- $.cookie('location_lon', '', { expires: new Date(3000,01,01), path: '/'});
+ $.totalstorage('community',null);
+ $.totalstorage('location_lat',null);
+ $.totalstorage('location_lon',null);
location.href = '/';
},
init: function() {
@@ -481,6 +483,8 @@ App.trigger = {
*/
$(function() {
+ $.totalStorage.ls(App.localStorage);
+
App.processConfig(App.config);
App._init = true;
App.NGinit();
@@ -807,7 +811,6 @@ App.getCommunityById = function( id ){
*/
App.dialog = {
show: function() {
-console.log('arguments',arguments);
if (arguments[1]) {
// its a title and message
var src = '
' +
diff --git a/www/assets/js/cart.js b/www/assets/js/cart.js
index e2f555e50..c50ea7c7f 100644
--- a/www/assets/js/cart.js
+++ b/www/assets/js/cart.js
@@ -697,7 +697,7 @@ App.isDeliveryAddressOk = true;
} else {
if (json.token) {
- $.cookie('token', json.token, { expires: new Date(3000,01,01), path: '/'});
+ $.totalStorage('token', json.token);
}
$('.link-orders').show();
diff --git a/www/assets/js/facebook.js b/www/assets/js/facebook.js
index f0742ab27..fc1e06e68 100644
--- a/www/assets/js/facebook.js
+++ b/www/assets/js/facebook.js
@@ -129,7 +129,7 @@ App.facebook.registerToken = function( token ){
if( !App.facebook.token ){
App.facebook.token = token;
var url = App.service + App.facebook.api.token;
- $.cookie( 'fbtoken', token, { expires: new Date(3000,01,01), path: '/'});
+ $.totalStorage( 'fbtoken', token);
}
}
diff --git a/www/assets/js/jquery.totalstorage.js b/www/assets/js/jquery.totalstorage.js
new file mode 100644
index 000000000..dee39b86f
--- /dev/null
+++ b/www/assets/js/jquery.totalstorage.js
@@ -0,0 +1,182 @@
+/**
+ * TotalStorage
+ *
+ * Copyright (c) 2012 Jared Novack & Upstatement (upstatement.com)
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Total Storage is the conceptual the love child of jStorage by Andris Reinman,
+ * and Cookie by Klaus Hartl -- though this is not connected to either project.
+ */
+
+/**
+ * Create a local storage parameter
+ *
+ == What makes it TOTAL Storage? ==
+
+ * The browser doesn't support local storage it will fall-back to cookies! (Using the
+ wonderful $.cookie plugin).
+ * Send it strings, numbers even complex object arrays! TotalStorage does not care.
+ Your efforts to defeat it will prove futile.
+ * Simple as shit. jStorage and some other very well-written plugins provide a bevy of
+ options for expiration, security and so forth. Frequently this is more power than you
+ need and vulnerable to confusion if you're just want it to work (JWITW)
+
+ * @desc Set the value of a key to a string
+ * @example $.totalStorage('the_key', 'the_value');
+ * @desc Set the value of a key to a number
+ * @example $.totalStorage('the_key', 800.2);
+ * @desc Set the value of a key to a complex Array
+ * @example var myArray = new Array();
+ * myArray.push({name:'Jared', company:'Upstatement', zip:63124});
+ myArray.push({name:'McGruff', company:'Police', zip:60652};
+ $.totalStorage('people', myArray);
+ //to return:
+ $.totalStorage('people');
+ *
+ * @name $.totalStorage
+ * @cat Plugins/Cookie
+ * @author Jared Novack/jared@upstatement.com
+ * @version 1.1.2
+ * @url http://upstatement.com/blog/2012/01/jquery-local-storage-done-right-and-easy/
+ */
+
+;(function($, undefined){
+
+ /* Variables I'll need throghout */
+
+ var supported, ls;
+ if ('localStorage' in window){
+ try {
+ ls = (typeof window.localStorage === 'undefined') ? undefined : window.localStorage;
+ if (typeof ls == 'undefined' || typeof window.JSON == 'undefined'){
+ supported = false;
+ } else {
+ supported = true;
+ }
+ }
+ catch (err){
+ supported = false;
+ }
+ }
+
+ /* Make the methods public */
+
+ $.totalStorage = function(key, value, options){
+ return $.totalStorage.impl.init(key, value);
+ };
+
+ $.totalStorage.setItem = function(key, value){
+ return $.totalStorage.impl.setItem(key, value);
+ };
+
+ $.totalStorage.getItem = function(key){
+ return $.totalStorage.impl.getItem(key);
+ };
+
+ $.totalStorage.getAll = function(){
+ return $.totalStorage.impl.getAll();
+ };
+
+ $.totalStorage.deleteItem = function(key){
+ return $.totalStorage.impl.deleteItem(key);
+ };
+
+ $.totalStorage.ls = function(value){
+ supported = value ? true : false;
+ };
+
+ /* Object to hold all methods: public and private */
+
+ $.totalStorage.impl = {
+
+ init: function(key, value){
+ if (typeof value != 'undefined') {
+ return this.setItem(key, value);
+ } else {
+ return this.getItem(key);
+ }
+ },
+
+ setItem: function(key, value){
+ if (!supported){
+ try {
+ $.cookie(key, JSON.stringify(value));
+ return value;
+ } catch(e){
+ console.log('Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie');
+ }
+ }
+ var saver = JSON.stringify(value);
+ ls.setItem(key, saver);
+ return this.parseResult(saver);
+ },
+ getItem: function(key){
+ if (!supported){
+ try {
+ return this.parseResult($.cookie(key));
+ } catch(e){
+ return null;
+ }
+ }
+ var item = ls.getItem(key);
+ return this.parseResult(item);
+ },
+ deleteItem: function(key){
+ if (!supported){
+ try {
+ $.cookie(key, null);
+ return true;
+ } catch(e){
+ return false;
+ }
+ }
+ ls.removeItem(key);
+ return true;
+ },
+ getAll: function(){
+ var items = [];
+ if (!supported){
+ try {
+ var pairs = document.cookie.split(";");
+ for (var i = 0; i