updated index to remove ui stuff with no_ui option

This commit is contained in:
javi 2013-10-28 18:41:19 +01:00
parent a481d8bc65
commit 4c45fc2ff8

View File

@ -133,8 +133,10 @@
var torqueLayer; var torqueLayer;
var ui; var ui;
var editor; var editor;
var ui_enabled = false;
var state = location.hash ? JSON.parse(atob(location.hash.substring(1))): {}; var state = location.hash ? JSON.parse(atob(location.hash.substring(1))): {};
var DEFAULT_CARTOCSS = state.cartocss || $('#default-style').html(); var DEFAULT_CARTOCSS = state.cartocss || $('#default-style').html();
ui_enabled = location.search.indexOf('no_ui') === -1;
function saveState() { function saveState() {
location.hash = btoa(JSON.stringify({ location.hash = btoa(JSON.stringify({
@ -170,7 +172,12 @@
torqueLayer.setCartoCSS(DEFAULT_CARTOCSS); torqueLayer.setCartoCSS(DEFAULT_CARTOCSS);
init_slider(torqueLayer); init_slider(torqueLayer);
init_ui(map, torqueLayer); if(ui_enabled) {
init_ui(map, torqueLayer);
} else {
var textarea = document.getElementById('code')
textarea.parentNode.removeChild(textarea);
}
torqueLayer.on('change:bounds', function(changes) { torqueLayer.on('change:bounds', function(changes) {
var bounds = changes.bounds; var bounds = changes.bounds;
var b = new google.maps.LatLngBounds( var b = new google.maps.LatLngBounds(