var msg_edit_route = "Cliquez sur la carte pour tracer le trajet. Chaque nouveau clic rajoute un nœud. Double-cliquez pour terminer le trajet.
Pour modifier le trajet sélectionnez un nœud puis glissez-déposez pour le déplacer."; var msg_edit = "Cliquez sur la carte pour placer le lieu. Pour modifier ce lieu sélectionnez-le puis glissez-déposez pour le déplacer."; var storageAvailable = function (type) { try { var storage = window[type], x = '__storage_test__'; storage.setItem(x, x); storage.removeItem(x); return true; } catch(e) { return e instanceof DOMException && ( // everything except Firefox e.code === 22 || // Firefox e.code === 1014 || // test name field too, because code might not be present // everything except Firefox e.name === 'QuotaExceededError' || // Firefox e.name === 'NS_ERROR_DOM_QUOTA_REACHED') && // acknowledge QuotaExceededError only if there's something already stored storage.length !== 0; } } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for(var i = 0; i "+ default_error_message+"

"); } }); }); }; var update_edit = function(url){ $.ajax({url: url, dataType: "html", success: function (data) { $("#modal-edit .modal-body").html(data); }, error: function (data) { alert("

" + default_error_message + "

"); } }); }; var update_editmarker = function(item_id){ var url = edit_url; if(item_id){ url += item_id + "/"; } update_edit(url); }; var update_editroute = function(item_id){ var url = edit_route_url; if(item_id){ url += item_id + "/"; } update_edit(url); }; var update_editpolygon = function(item_id){ var url = edit_polygon_url; if(item_id){ url += item_id + "/"; } update_edit(url); }; var update_editevent = function(){ $("#main-map").chimere('cleanRoute'); $('.map_button').hide(); if($('#multimedia_form').length) $('#multimedia_form').remove(); $('#action-edit-marker').removeClass('state-active'); $('#action-edit-route').removeClass('state-active'); $('#action-edit-event').addClass('state-active'); $('#frm-edit-marker').hide(); $('#frm-edit-route').hide(); $('#frm-edit-event').show(); $('#message').removeClass(); $('#message').addClass('alert'); $('#message').addClass('alert-info'); $('#message .content').html(msg_edit); $('#message').show(); $.ajax({url: edit_event_url, dataType: "html", success: function (data) { $('#frm-edit-marker').html(''); $('#frm-edit-route').html(''); $('#frm-edit-event').html(data); $("#main-map").chimere('activateMarkerEdit'); }, error: function (data) { $('#frm-edit-event').html("

"+ default_error_message+"

"); } }); }; var action_map = function(){ $('#main-map').chimere('deactivateEdition'); $('#message').hide(); $('.map_button').hide(); $("#main-map").chimere('cleanRoute'); $("#main-map").chimere('cleanMarker'); $("#main-map").chimere('activateContextMenu'); if($("#itinerary_field").html()){ $("#chimere_itinerary_form").appendTo("#chimere_itinerary_panel"); if($("#chimere_itinerary").css('display') != 'none'){ $("#chimere_itinerary_form").hide(); } } $('#action-participate').removeClass('state-active'); $('#action-carte').addClass('state-active'); $('#edit-actions').hide(); $('#map-actions').show(); $('#edit-panel').hide(); $('#map-panel').show(); }; var action_participate = function(){ /* $('.map_button').hide(); $('#message').hide(); $('#action-carte').removeClass('state-active'); $('#action-participate').addClass('state-active'); $('#map-actions').hide(); $('#edit-actions').show(); $('#map-panel').hide(); $('#edit-panel').show(); */ update_editmarker(); }; var routing_panel_open = function(){ action_map(); $('#frm_categories').hide(); $('#search-box').hide(); $('#frm-edit-marker').hide(); $('#chimere_itinerary_panel').show(); $('#back-categories').show(); }; var category_panel_open = function(){ action_map(); $("#main-map").chimere('razMap'); if($("#switch-menu").is(':visible')){ $("#switch-menu > div").removeClass('selected'); if (!$("#switch-search-result.disabled").length){ $("#switch-search-result").addClass('disabled'); } if ($("#switch-categories.disabled").length){ $("#switch-categories").removeClass('disabled'); } if (!$("#switch-categories.selected").length){ $("#switch-categories").addClass('selected'); } } $("#id_q").val(''); $('#chimere_itinerary_panel').hide(); $('#search-result').hide(); $('#frm-edit-marker').hide(); $('#back-categories').hide(); $('#search-box').show(); $('#frm_categories').show(); }; var search_panel_open = function(){ action_map(); $('#chimere_itinerary_panel').hide(); $('#frm_categories').hide(); $('#frm-edit-marker').hide(); $('#search-box').show(); $('#search-result').show(); $('#back-categories').show(); }; var edit_panel_open = function(){ action_participate(); /* $('#search-box').hide(); $('#search-result').hide(); $('#frm_categories').hide(); $('#edit-actions').show(); $('#back-categories').show(); */ }; var switch_map = function(){ if(!$("#switch-menu").is(':visible')){ return; } $("#switch-menu > div > div").removeClass('selected'); $("#switch-map").addClass('selected'); $("#panel").fadeOut(); }; var switch_search_result = function(){ if(!$("#switch-menu").is(':visible')){ return; } if ($("#switch-search-result.disabled").length){ return false; } $('#frm_categories').hide(); $('#search-listing').show(); $('#search-nav').show(); $("#switch-menu > div > div").removeClass('selected'); $("#switch-search-result").addClass('selected'); $("#panel").fadeIn(); }; var switch_categories = function(){ if(!$("#switch-menu").is(':visible')){ return; } $('#search-listing').hide(); $('#search-nav').hide(); $('#frm_categories').show(); $("#switch-menu > div > div").removeClass('selected'); $("#switch-categories").addClass('selected'); $("#panel").fadeIn(); $('#frm_categories').show(); }; var init_map_edit; var map_edit_init = function(){ // ol3 must be initialized after modal opening if (init_map_edit){ setTimeout( function(){ init_map_edit(); $('#map_edit').chimere('refresh'); $("#modal-edit").modal('handleUpdate'); }, 500); } else { setTimeout(map_edit_init, 500); } }; $(function(){ $('#action-routing').click(routing_panel_open); $('#routing-button').click(routing_panel_open); $('#action-categories').click(category_panel_open); $('#action-search').click(search_panel_open); $('#edit-button').click(edit_panel_open); $('#back-categories').click(category_panel_open); $('#sidebar-handler-hide').click(function(){$('#sidebar').hide();}); $('#sidebar-handler-show').click(function(){$('#sidebar').show();}); $('#message').hide(); $("[data-hide]").on("click", function(){ $("." + $(this).attr("data-hide")).hide(); }); $("#categories").fadeIn(); $(".buttonset label").click(function(){ $(".buttonset label").removeAttr("aria-pressed"); $(this).attr("aria-pressed", 'true'); }); $("#action-news").click(function(){ $('#modal-news').modal("show"); }); $("#modal-edit").on('shown.bs.modal', function () { map_edit_init(); }); $("#action-carte").click(action_map); $("#action-participate").click(action_participate); $("#action-edit-event").click(update_editevent); $("#action-edit-marker").click(update_editmarker); $("#action-edit-route").click(update_editroute); $('.dyn-page').click(function(){ var url = $(this).filter('a').attr('href'); if (!url){ url = $(this).children('a').attr('href'); } if (!url){ return false; } $.ajax({url: url, dataType: "html", success: function (content) { html = "
" + content + "
" $('#modal-default-message .modal-body').html(html); $('#modal-default-message').modal("show"); } }); return false; }); $('.print-page').click(function(){ window.print(); return false; }); $('.extra-criteria .extra-label').click(function(){ var par = $(this).parent(); var form = par.children('.extra-form'); form.toggle(); if(form.is(':visible')){ par.addClass('opened'); } else { par.removeClass('opened'); } }); $('input[name="transport"]').change(change_routing_transport); $('input[name="speed"]').change(change_routing_speed); $('#id_speed').change(change_routing_speed); $("#switch-map").click(switch_map); $("#switch-search-result").click(switch_search_result); $("#switch-categories").click(switch_categories); $("#mobile-footer .close-img").click(function(event){ $("body").addClass('mobile-footer-hidden'); }); $("#mobile-footer-open-img").click(function(event){ $("body").removeClass('mobile-footer-hidden'); }); $(document).on('focusin', function(e) { if ($(e.target).closest(".mce-window").length) { e.stopImmediatePropagation(); } }); }); function change_routing_speed(){ var speed = $('#id_speed option:selected').val(); if(!speed){ speed = $('input[name=speed]:checked').val(); } if (!speed) return; speed = speed.split('_')[1] $('#main-map').chimere('routingChangeSpeed', speed); } function change_routing_transport(){ $('#main-map').chimere('routingChangeTransport', $('input[name="transport"]:checked').val()); } function display_feature_detail_callback(settings){ $('.popover-title').hide(); $('.detail_zoomin').bind("click", function(event){ $('#main-map').chimere('hidePopup', event); $('#main-map').chimere('zoomIn'); }); $('.detail_zoomout').bind("click", function(event){ $('#main-map').chimere('hidePopup', event); $('#main-map').chimere('zoomOut'); }); $('.detail_from').bind("click", function(event){ $('#main-map').chimere('routingFrom'); $('#main-map').chimere('hidePopup', event); }); $('.detail_step').bind("click", function(event){ $('#main-map').chimere('routingAddStep'); $('#main-map').chimere('hidePopup', event); }); $('.detail_to').bind("click", function(event){ $('#main-map').chimere('routingTo'); $('#main-map').chimere('hidePopup', event); }); jQuery(".close_img").click(function(event){ $("#main-map").chimere('hidePopup', event); }); jQuery(".close-img").click(function(event){ $("#main-map").chimere('hidePopup', event); }); /* jQuery("#read_more_"+settings.current_feature.pk).click(function(){ $('#detail_content').css('height', $('#detail_content').height()); $("#description_short_"+settings.current_feature.pk).hide(); $("#description_long_"+settings.current_feature.pk).show(); $("#read_more_"+settings.current_feature.pk).hide(); $("#read_less_"+settings.current_feature.pk).show(); }); jQuery("#read_less_"+settings.current_feature.pk).click(function(){ $("#description_long_"+settings.current_feature.pk).hide(); $("#description_short_"+settings.current_feature.pk).show(); $("#read_less_"+settings.current_feature.pk).hide(); $("#read_more_"+settings.current_feature.pk).show(); }); */ $(document).ready(function(){ share_link_update(); /*$("a[rel^='prettyPhoto']").prettyPhoto({ show_title: false, social_tools: '' });*/ }); $('html').addClass('js-on'); $(function(){ // $('div.media-player').jmeEmbedControls(); }); } function toggleDrawOn() { $('#button-move-map').removeClass('toggle-button-active' ).addClass('toggle-button-inactive'); $('#button-draw-map').removeClass('toggle-button-inactive' ).addClass('toggle-button-active'); $("#main-map").chimere("activateCurrentControl"); } function toggleDrawOff() { $('#button-draw-map').removeClass('toggle-button-active' ).addClass('toggle-button-inactive'); $('#button-move-map').removeClass('toggle-button-inactive' ).addClass('toggle-button-active'); $("#main-map").chimere("deactivateCurrentControl"); } var edition_type = 'marker'; var edition_event = false; var edition_error = "There are missing/erroneous fields."; var filter_categories = function() {}; var displayProgress = function() { $('#upload_in_progress .modal-body').html(upload); $('#upload_in_progress').modal("show"); }; var init_widget_list = []; var init_modal_window = function(){ filter_categories(); register_subactions(); /* {% if route %} var edition_type = 'route'; {% if itinerary_form %} $("#chimere_itinerary_form").appendTo($("#itinerary_field")); $('#main_map').chimere('updateRoutingInput');{% endif%} {% else %} var edition_type = 'marker'; $('#main_map').chimere('updateMarkerInput'); {% endif %} */ $('#modal-edit button.btn-primary').unbind("click"); $('#modal-edit button.btn-primary').click(function(){ // JS tests because if a file is submited there is no way // to refill the form with (browser security issue) if (typeof tinyMCE !== 'undefined') tinyMCE.triggerSave(); var geom_name = edition_type; if (geom_name == 'marker'){ geom_name = 'point'; } validation = [ geom_name, 'categories' ]; if (edition_event) validation.push('start_date'); $("input[required]").each(function(){ validation.push($(this).attr('name')); }); var validated = true; for (var idx=0; idx'; html = html.replace(//g, ">"); html = "
" + html + "
"; html = "

Pour insérer la carte sur un site web, veuillez recopier le code suivant :

" + html; } else { html = "

Erreur lors de l'initialisation de l'iframe.

" } $("#modal-default-message .modal-body").html(html); $('#modal-default-message').modal("show"); }