Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"redis": "docker run -d --name mbcc-redis -p 6379:6379 redis",
"neo": "docker run --name mbcc-neo -p 7474:7474 --env=NEO4J_AUTH=none neo4j"
},
"author": "",
"license": "ISC",
Expand Down
31 changes: 29 additions & 2 deletions public/js/cbc.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,25 @@ var renderers = {
localStorage.setItem('msg', noteCount + ' notes, ' + ratingCount + ' ratings, ' + newSavedBeers.length + " saved, " + newTastedBeers.length + " tasted beers loaded");
window.location = '/#index';
return '';
},
loadc: function(opts) {
var tempLoad = JSON.parse(localStorage.getItem('tempLoad') || '{}');
for (var i = 0; i < 10; i++) {
if(opts['l'+i]) tempLoad[i] = opts['l'+i]
}
localStorage.setItem('tempLoad', JSON.stringify(tempLoad));
for (var i = 0; i < 10; i++) {
if(!tempLoad[i]) break;
if(tempLoad[i][tempLoad[i].length - 1] === '=') {
var data = Object.values(tempLoad).join('');
window.location = '/#loadb[{"d":"' + data + '"}]';
localStorage.removeItem('tempLoad');
return '';
}
}
localStorage.setItem('msg', 'Need more urls to load. Have part '+Object.keys(tempLoad));
window.location = '/#index';
return '';
}
};

Expand Down Expand Up @@ -468,8 +487,16 @@ function readUntappdCheckins(user, cb, start, count) {
}

function updateExportLink() {
$('#export').val('http://' + window.location.hostname + window.location.pathname + '#loadb[{"d":"' +
btoa(JSON.stringify({savedBeers:savedBeers,tastedBeers:tastedBeers,beerData:beerData})) + '"}]');
for (var i = 9; i >= 0; i--) {
$('#export'+i).hide();
}
var url = 'http://' + window.location.hostname + (window.location.port?':'+window.location.port:'') + window.location.pathname;
var dataArray = btoa(JSON.stringify({savedBeers:savedBeers,tastedBeers:tastedBeers,beerData:beerData})).match(/.{1,9000}/g);
var urls = "";
dataArray.forEach(function(data, index) {
$('#export'+index).show();
$('#export'+index).val(url + '#loadc[{"l' + index + '":"' + data + '"}]');
});
}

if (location.hash) route(location.hash);
Expand Down
15 changes: 12 additions & 3 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,18 @@ html(manifest="app.cache")
img.loader(src="/img/puff.svg")
.status-text
#exportfield
label(for="export") Copy this link to another device to transfer your saved/tasted beers.
input#export

label(for="export") Copy these links to another device to transfer your saved/tasted beers.
input#export0
input#export1
input#export2
input#export3
input#export4
input#export5
input#export6
input#export7
input#export8
input#export9

script(type="text/html", class="template", data-template-id="loading")
img.loader(src="/img/puff.svg")
.status-text
Expand Down