Ajouter toute la liste(‘+tagifylist_location.settings.whitelist.reduce(function(remainingSuggestions, item){
return tagifylist_location.isTagDuplicate(item.value) ? remainingSuggestions : remainingSuggestions + 1
}, 0)+’ ‘+(zone_location_target == ‘location1’ ? ‘pays’ : (zone_location_target == ‘location2’ ? ‘régions’ : (zone_location_target == ‘location3’ ? ‘départements’ : ‘villes’)))+’)’
}])
}
function onSelectSuggestion(e) {
if(e.detail.elm == addAllSuggestionsElm) {
tagifylist_location.dropdown.selectAll.call(tagifylist_location);
}
}
document.querySelector(‘#jform_zone_location_target’).addEventListener(‘change’, tagifylist_location.removeAllTags.bind(tagifylist_location));
jQuery(‘#jform_zone_location_target’).focus(function() {
jQuery(‘#list_favorites_location_selected_’+jQuery(‘#jform_zone_location_target’).val()).val(jQuery(‘#jform_list_location’).val());
})
jQuery(‘#jform_zone_location_target’).change(function() {
getListSuggestionsFavorites();
tagifylist_location.whitelist = []; // update whitelist Array in-place
jQuery(‘#list_favorites_location’).html(”);
var listsTagReplace = jQuery(‘#list_favorites_location_selected_’+jQuery(‘#jform_zone_location_target’).val()).val();
if(listsTagReplace != ”) {
jQuery(‘#jform_list_location’).val(listsTagReplace);
tagifylist_location.whitelist = JSON.parse(listsTagReplace);
tagifylist_location.addTags(JSON.parse(listsTagReplace));
}
});
function getListSuggestionsFavorites()
{}
getListSuggestionsFavorites();
var controller; // for aborting the call
function onInputlist_location(e)
{
var value = (e.detail.value ? e.detail.value : ”);
tagifylist_location.whitelist = null // reset the whitelist
tagifylist_location.loading(true).dropdown.hide()
jQuery.ajax({
method: ‘POST’,
timeout: 3000, // sets timeout to 3 seconds
url: ‘index.php?option=com_infoflash&task=location.getListLocationAnnonceAjax’,
data: { ‘panel’ : ‘autriche’,’location’ : jQuery(‘#jform_zone_location_target’).val(), ‘q’ : value}
})
.done(function(newWhitelist) {
if(newWhitelist != ”)
{
tagifylist_location.whitelist = JSON.parse(newWhitelist) // update inwhitelist Array in-place
tagifylist_location.loading(false).dropdown.show(value) // render the suggestions dropdown
} else {
tagifylist_location.loading(false).dropdown.show(value);
}
})
}
function addFavoriteTag(id, name) {
tagifylist_location.addTags([{id: id, value: name}]);
}