| Server IP : 54.36.91.62 / Your IP : 216.73.217.94 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/aix/components/com_djclassifieds/assets/js/ |
Upload File : |
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email: contact@dj-extensions.com
*/
jQuery(function($){
jQuery('body').on('click', '.djsvoc_link', function(){
var wrapper = jQuery(this).parent();
var f_rel = wrapper.attr('rel');
var value = atob(wrapper.attr('data-v'));
if(f_rel){
wrapper.html('<a href=\"'+f_rel+'\">'+value+'</a>');
}else{
wrapper.html(jQuery('<textarea>').html(value).text());
}
});
jQuery('body').on('click', '.fav_box, .mfav_box', function(){
var $fav_box = jQuery(this);
jQuery.ajax({
url: typeof window.djRootUrl !== 'undefined' ? window.djRootUrl : 'index.php',
type: 'post',
data: {
'option': 'com_djclassifieds',
'view': 'item',
'task': 'changeItemFavourite',
'item_id': $fav_box.attr('data-id')
}
}).done(function(response, textStatus, jqXHR){
if(textStatus == 'success'){
$fav_box.html(jQuery(response).html());
}
});
});
jQuery('body').on('click', '.fav_box_profile', function(){
var $fav_box = jQuery(this);
jQuery.ajax({
url: typeof window.djRootUrl !== 'undefined' ? window.djRootUrl : 'index.php',
type: 'post',
data: {
'option': 'com_djclassifieds',
'view': 'profile',
'task': 'changeProfileFavourite',
'id': $fav_box.attr('data-id')
}
}).done(function(response, textStatus, jqXHR){
if(textStatus == 'success'){
$fav_box.html(jQuery(response).html());
}
});
});
if(typeof document.formvalidator !== 'undefined'){
document.formvalidator.setHandler('djcat', function(value){
regex=/^p/;
return !regex.test(value);
});
document.formvalidator.setHandler('djreg', function(value){
return parseInt(value) !== 0;
});
if(jQuery('#dj-classifieds button.validate').length){
jQuery('#dj-classifieds button.validate').on('click', function(e, opts){
if(jQuery(this).closest('form').length && !document.formvalidator.isValid(jQuery(this).closest('form')[0])){
var scrolltop = typeof jQuery(this).attr('data-scrolltop') !== 'undefined' ? jQuery(this).attr('data-scrolltop') : '#system-message-container';
if(scrolltop){
jQuery('html, body').animate({
scrollTop: jQuery(scrolltop).offset().top
});
}
return false;
}
});
jQuery('#dj-classifieds form').on('submit', function(e){
jQuery(this).find('.classifieds_buttons button').prop('disabled', true);
});
}
}
jQuery('#dj-classifieds form, .dj_cf_search form').on('change', '.djshow_in_modal :input[type="checkbox"]', function(){
djMoveModalChxVals(jQuery(this).closest('.djshow_in_modal'));
});
jQuery('#dj-classifieds form, .dj_cf_search form').on('click', '.djmodal_trigger_wrapper .djclose', function(){
jQuery(this).closest('.djshow_in_modal').find(':input[type="checkbox"]').prop('checked', false).first().trigger('change');
});
jQuery('#dj-classifieds form').on('keyup', '[data-charlimit]', function(){
var limit = jQuery(this).attr('data-charlimit');
if(parseInt(limit) > 0){
var $count_el = jQuery('[data-charcount="' + jQuery(this).attr('id') + '"]');
if(jQuery(this).val().length > limit){
jQuery(this).val(jQuery(this).val().substring(0, limit));
}
$count_el.text(limit - jQuery(this).val().length);
}
});
jQuery('#dj-classifieds form [data-charlimit]').trigger('keyup');
});
jQuery(document).on('djclassifieds.loaded', function(e,p){
if(['getFields', 'getContactFields', 'getProfileFields', 'getAskFields', 'getSearchFields'].indexOf(p.ajax_data.task) != -1 && typeof p.ajax_data.wrapper_id !== 'undefined'){
jQuery('#'+p.ajax_data.wrapper_id).find('.Tips1').each(function(){
if(typeof jQuery(this).tooltip === 'function'){
jQuery(this).tooltip({container: '#dj-classifieds'});
}
});
if(typeof Calendar !== 'undefined'){
jQuery('#'+p.ajax_data.wrapper_id).find('.djcalendar').each(function(){
Calendar.setup({inputField: jQuery(this).attr('id'), button: jQuery(this).attr('id') + '_btn'});
});
}
if(document.getElementById('djForm') && typeof document.formvalidator !== 'undefined'){
document.formvalidator.attachToForm(document.getElementById('djForm'));
}
jQuery('#'+p.ajax_data.wrapper_id).find('.djshow_in_modal').each(function(){
djMoveModalChxVals(jQuery(this));
});
jQuery('#'+p.ajax_data.wrapper_id).find('[data-charlimit]').trigger('keyup');
if(p.ajax_data.task == 'getSearchFields'){
jQuery('#'+p.ajax_data.wrapper_id).find('.djfields_accordion_o .label').off('click').click(function(){
jQuery(this).toggleClass('active').closest('.djfields_accordion_o').find('.se_checkbox').stop(true, false).toggleClass('in').slideToggle('fast');
});
jQuery('#'+p.ajax_data.wrapper_id).find('.djfields_accordion_c .se_checkbox').hide();
jQuery('#'+p.ajax_data.wrapper_id).find('.djfields_accordion_c .label').addClass('active').off('click').click(function(){
jQuery(this).toggleClass('active').closest('.djfields_accordion_c').find('.se_checkbox').stop(true, false).toggleClass('in').slideToggle('fast');
});
}
}
});
function djMoveModalChxVals($chx_wrapper)
{
var chx_vals = [];
$chx_wrapper.find(':input[type="checkbox"]:checked').each(function(){
chx_vals.push(jQuery(this).parent().find('label').text());
});
$vals_holder = $chx_wrapper.find('.djmodal_trigger');
if(chx_vals.length){
$vals_holder.text(chx_vals.join(', ')).addClass('active');
$vals_holder.closest('.djmodal_trigger_wrapper').find('.djclose').show();
}else{
$vals_holder.text($vals_holder.attr('data-label')).removeClass('active');
$vals_holder.closest('.djmodal_trigger_wrapper').find('.djclose').hide();
}
}
function DJCatMatchModules(selector, row_limit)
{
var $divs = jQuery(selector + ':not([style^="height"])');
if($divs.length <= 1){
return;
}
var maxHeight = 0;
if(typeof row_limit !== 'undefined' && parseInt(row_limit) > 1){
var limit = parseInt(row_limit);
var i = 1;
var row_divs = [];
$divs.each(function(){
var divHeight = jQuery(this).outerHeight();
if(divHeight > maxHeight){
maxHeight = divHeight;
}
row_divs.push(this);
i++;
if(i > limit || i-1 == $divs.length){
jQuery.each(row_divs, function(){
jQuery(this).css('height', maxHeight);
});
i = 1;
maxHeight = 0;
row_divs = [];
}
});
}else{
$divs.each(function(){
var divHeight = jQuery(this).outerHeight();
if(divHeight > maxHeight){
maxHeight = divHeight;
}
});
$divs.css('height', maxHeight);
}
}
function djcfAddressPlaces(country_iso)
{
if(typeof google === 'undefined' || typeof google.maps === 'undefined' || typeof google.maps.places === 'undefined'){
return;
}
var input = document.getElementById('address');
var aut_options = '';
if(country_iso){
aut_options = {componentRestrictions: {country: country_iso}};
}
if(typeof window['djaddress_places'] !== 'undefined'){
window['djaddress_places'].unbindAll();
}
window['djaddress_places'] = new google.maps.places.Autocomplete(input, aut_options);
window['djaddress_places'].addListener('place_changed', function(){
var place = window['djaddress_places'].getPlace();
var coord = new google.maps.LatLng(place.geometry.location.lat(), place.geometry.location.lng());
jQuery('#latitude').val(place.geometry.location.lat());
jQuery('#longitude').val(place.geometry.location.lng());
if(typeof my_lat !== 'undefined') my_lat = place.geometry.location.lat();
if(typeof my_lng !== 'undefined') my_lng = place.geometry.location.lng();
if(typeof djmap !== 'undefined') djmap.setCenter(coord);
if(typeof djmarker !== 'undefined') djmarker.setPosition(coord);
place.address_components.forEach(function(item, index){
if(item.types.indexOf('postal_code') != -1){
if(jQuery('#post_code').length && !jQuery('#post_code').val()){
jQuery('#post_code').val(item.short_name);
}
}
});
});
jQuery(input).off('keydown').on('keydown', function(e){
if(e.key === 'Enter'){
e.preventDefault();
}
});
}
function djcfmodSearchCountryIso(mod_id, reg_id)
{
if(typeof google === 'undefined' || typeof google.maps === 'undefined' || typeof google.maps.places === 'undefined'){
return;
}
var ajax_data = {
'option': 'com_djclassifieds',
'view': 'item',
'task': 'getCountryISO',
'reg_id': reg_id
};
jQuery.ajax({
url: typeof window.djRootUrl !== 'undefined' ? window.djRootUrl : 'index.php',
type: 'post',
data: ajax_data
}).done(function (response, textStatus, jqXHR){
if(textStatus == 'success' && response){
djcfmodSearchPlaces(mod_id, response);
jQuery(document).trigger('djclassifieds.loaded', {context: 'module.search', client: 'site', ajax_data: ajax_data});
}
});
}
function djcfmodSearchPlaces(mod_id, country_iso)
{
if(typeof google === 'undefined' || typeof google.maps === 'undefined' || typeof google.maps.places === 'undefined' || !jQuery('#se_address'+mod_id).length){
return;
}
var input = document.getElementById('se_address'+mod_id);
var aut_options = '';
if(country_iso){
aut_options = {componentRestrictions: {country: country_iso}};
}
if(typeof window['se_address'+mod_id+'_places'] !== 'undefined'){
window['se_address'+mod_id+'_places'].unbindAll();
}
window['se_address'+mod_id+'_places'] = new google.maps.places.Autocomplete(input, aut_options);
jQuery(input).off('keydown').on('keydown', function(e){
if(e.key === 'Enter'){
e.preventDefault();
}
});
}
function djcfmodSearchAutocomplete(mod_id, hints_source)
{
jQuery('#input_search'+mod_id).autocomplete({
source: function(request, response) {
var ajax_data = {
'option': 'com_djclassifieds',
'view': 'item',
'task': 'getSearchAutocomplete',
'source': hints_source,
'term': request.term
};
jQuery.ajax({
url: typeof window.djRootUrl !== 'undefined' ? window.djRootUrl : 'index.php',
type: 'post',
data: ajax_data,
dataType: "json",
success: function(data){
response(data);
}
});
},
minLength: 2,
appendTo: '#mod_djcf_search'+mod_id+' .search_word',
select: function( event, ui ) {
var $that = jQuery(this);
setTimeout(function(){
$that.closest('.dj_cf_search').find('.search_buttons button[type="submit"]').trigger('click');
}, 0);
},
open: function() {
jQuery( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
jQuery( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
}
function djImgReqHelper()
{
jQuery('#img_req_helper').val(jQuery('#itemImages .itemImage').length ? jQuery('#itemImages .itemImage').length : '');
}
function djLimitPromotionsDurations()
{
var c_days = jQuery('#exp_days').val();
jQuery('.prom_rows.additem_djform .djform_prom_v select').each(function(){
if(parseInt(c_days) < parseInt(jQuery(this).val())){
jQuery(this).val(0);
}
jQuery(this).find('option').each(function(){
jQuery(this).prop('disabled', (parseInt(c_days) < parseInt(jQuery(this).val()) && parseInt(c_days) > 0));
});
});
}
function djCheckUserField(field_name, task_name, var_name, value, user_id)
{
jQuery('#'+field_name+'_loader').show();
var ajax_data = {
'option': 'com_djclassifieds',
'view': 'registration',
'task': task_name
}
ajax_data[var_name] = value;
if(typeof user_id !== 'undefined'){
ajax_data['user_id'] = user_id;
}
jQuery.ajax({
url: typeof window.djRootUrl !== 'undefined' ? window.djRootUrl : 'index.php',
type: 'post',
data: ajax_data
}).done(function(response, textStatus, jqXHR){
if(textStatus == 'success'){
if(response && !(field_name == 'u_password1' && value == '')){
djMarkUserField(field_name, false, response);
}else{
djMarkUserField(field_name, true);
}
jQuery('#'+field_name+'_loader').hide();
}
});
}
function djCheckPasswordEqual(field_name, pass1_val, pass2_val, fail_msg)
{
if(pass1_val != pass2_val){
djMarkUserField(field_name, false, fail_msg);
}else{
djMarkUserField(field_name, true);
}
}
function djMarkUserField(field_name, valid, info)
{
if(valid){
jQuery('#'+field_name+'_info').html('').hide();
jQuery('#'+field_name+'').removeClass('invalid').removeClass('djinvalid').attr('aria-invalid','false');
jQuery('#'+field_name+'-lbl').removeClass('invalid');
}else{
jQuery('#'+field_name+'_info').html(info).show();
jQuery('#'+field_name+'').addClass('invalid').addClass('djinvalid').attr('aria-invalid','true');
jQuery('#'+field_name+'-lbl').addClass('invalid');
}
}
function getDJLocation()
{
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(setDJLocationCookieAndReload);
}else{
console.error('Geolocation is not supported by this browser');
}
}
function setDJLocationCookie(position)
{
var exdate = new Date();
exdate.setDate(exdate.getDate() + 1);
var ll = position.coords.latitude+'_'+position.coords.longitude;
document.cookie = "djcf_latlon=" + ll + ";expires=" + exdate.toUTCString() + ";path=/";
}
function setDJLocationCookieAndReload(position)
{
setDJLocationCookie(position);
location.reload();
}
function djcfAccept18()
{
var exdate = new Date();
exdate.setDate(exdate.getDate() + 1);
document.cookie = "djcf_warning18=1;expires=" + exdate.toUTCString() + ";path=/";
location.reload();
}
if(typeof MooTools !== 'undefined'){ // backward compatibility
window.addEvent('load', function(){
document.id(document.body).getElements('#dj-classifieds .fav_box, .mod_djclassifieds_items .mfav_box').removeEvents('click');
});
}