| Server IP : 54.36.91.62 / Your IP : 216.73.217.117 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/c/o/o/coopiak/amisdesseniors-fr/lyon/components/com_djclassifieds/assets/djimage/ |
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($)
{
if(typeof MooTools !== 'undefined'){ // backward compatibility
var orig = {
onSuccess: Request.prototype.onSuccess,
onFailure: Request.prototype.onFailure
};
var changes = {
onSuccess: function(){
orig.onSuccess.apply(this, arguments);
if(['getFields', 'getContactFields', 'getProfileFields', 'getAskFields', 'item.getFields', 'item.getContactFields', 'profile.getProfileFields'].indexOf(jQuery(this)[0].options.data.task) != -1){
$('.djtype_image').each(function(){ // custom fields
djImgInit($(this).attr('data-id'));
});
}
}
};
[Request].invoke('implement', changes);
}
setTimeout(function(){ // wait for page ready image scripts
$('.djimage').each(function(){ // tmpl img inputs
djImgInit('');
});
}, 0);
});
jQuery(document).on('djclassifieds.loaded', function(e,p){
if(['getFields', 'getContactFields', 'getProfileFields', 'getAskFields', 'item.getFields', 'item.getContactFields', 'profile.getProfileFields'].indexOf(p.ajax_data.task) != -1){
jQuery('.djtype_image').each(function(){ // custom fields
djImgInit(jQuery(this).attr('data-id'));
});
}
});
function djImgInit(sfx, readURL)
{
var del = document.getElementById('del_img'+sfx);
var inp = document.getElementById('imgInp'+sfx);
var img = document.getElementById('imgImg'+sfx);
var delBtn = document.getElementById('delBtn'+sfx);
if(!inp){
var inp_arr = document.getElementsByClassName('djImgInp'+sfx);
if(inp_arr){
inp = inp_arr[0];
}
}
if(img){
if(img.getAttribute('src') != 'data:,'){
img.style.display = 'inherit';
jQuery(img).closest('.djimage').addClass('loaded');
}
}
if(inp){
inp.onchange = function(){
var maxsize = this.getAttribute('data-maxsize');
if(parseInt(maxsize) && this.files[0].size > maxsize){
var newDiv = document.createElement('div');
newDiv.setAttribute('style', 'color:red');
var newContent = document.createTextNode(this.getAttribute('data-maxsize-msg'));
newDiv.appendChild(newContent);
setTimeout(function(){
newDiv.remove();
}, 2000);
this.parentNode.insertBefore(newDiv, this);
this.value = '';
return false;
};
if(this.files && this.files[0]){
readURL(this, sfx);
}
if(del){
del.checked = false;
}
};
}
if(delBtn){
delBtn.onclick = function(e){
e.preventDefault();
if(del){
del.checked = true;
}
if(inp){
inp.value = '';
if(inp.value){
inp.type = 'text';
inp.type = 'file';
}
if(img){
img.style.display = 'none';
img.setAttribute('src', 'data:,');
jQuery(img).closest('.djimage').removeClass('loaded');
}
}
};
}
if(typeof readURL === 'undefined'){
var readURL = function(input, sfx)
{
var reader = new FileReader();
reader.onload = function(e){
if(img){
img.setAttribute('src', e.target.result);
img.style.display = 'inherit';
jQuery(img).closest('.djimage').addClass('loaded');
}
}
reader.readAsDataURL(input.files[0]);
}
}
}