Files
iD/js/id/ui/intro/start_editing.js
T
Ansis Brammanis e8e6d67589 switch out of intro when showing "start editing"
so that the user is not stuck in the walkthrough
if he clicks on the shaded area to close the modal
2013-04-25 18:55:33 -04:00

60 lines
1.5 KiB
JavaScript

iD.ui.intro.startEditing = function(context, reveal) {
var event = d3.dispatch('done', 'startEditing'),
modal,
timeouts = [];
var step = {
name: 'Start Editing'
};
function timeout(f, t) {
timeouts.push(window.setTimeout(f, t));
}
step.enter = function() {
reveal('.map-control.help-control', 'intro.startediting.help');
timeout(function() {
reveal('#bar button.save', 'intro.startediting.save');
}, 3500);
timeout(function() {
reveal('#surface');
}, 7000);
timeout(function() {
modal = iD.ui.modal(context.container());
modal.select('.modal')
.attr('class', 'modal-splash modal col6');
modal.selectAll('.close').remove();
var startbutton = modal.select('.content')
.attr('class', 'fillL')
.append('button')
.attr('class', 'modal-section huge-modal-button')
.on('click', function() {
modal.remove();
});
startbutton.append('div')
.attr('class','illustration');
startbutton.append('h2')
.text(t('intro.startediting.start'));
event.startEditing();
}, 7500);
};
step.exit = function() {
if (modal) modal.remove();
timeouts.forEach(window.clearTimeout);
};
return d3.rebind(step, event, 'on');
};