brouter-web/js/control/Profile.js
2015-03-06 17:21:53 +01:00

35 lines
863 B
JavaScript

BR.Profile = BR.Control.extend({
options: {
divId: 'profile_div'
},
onAdd: function (map) {
L.DomUtil.get('profile_upload').onsubmit = L.bind(this._submit, this);
L.DomUtil.get('clear').onclick = L.bind(this.clear, this);
$('#tab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
return BR.Control.prototype.onAdd.call(this, map);
},
clear: function(evt) {
evt.preventDefault();
document.profile_upload.profile.value = null;
this.fire('clear');
},
_submit: function(evt) {
var form = evt.target || evt.srcElement,
profile = document.profile_upload.profile.value;
evt.preventDefault();
this.fire('update', { profileText: profile });
}
});
BR.Profile.include(L.Mixin.Events);