scriptJquery('#sesusercoverphoto_main_photo_reposition').click(function(){
scriptJquery('.sesusercoverphoto_cover_reposition_btn').show();
scriptJquery('.sesusercoverphoto_cover_fade').hide();
scriptJquery('#sesusercoverphoto_cover_change').hide();
scriptJquery('.sesusercoverphoto_cover_buttons').hide();
scriptJqueryUIMin('#sesusercoverphoto_cover_id').dragncrop({instruction: true,instructionText:'Drag to Reposition'});
});
scriptJquery('#cancelreposition').click(function(){
scriptJquery('.sesusercoverphoto_cover_reposition_btn').hide();
scriptJquery('#sesusercoverphoto_cover_id').css('top',previousPositionOfCover);
scriptJquery('.sesusercoverphoto_cover_fade').show();
scriptJquery('#sesusercoverphoto_cover_change').show();
scriptJquery('.sesusercoverphoto_cover_buttons').show();
scriptJqueryUIMin("#sesusercoverphoto_cover_id").dragncrop('destroy');
});
scriptJquery('#savereposition').click(function(){
var sendposition = scriptJquery('#sesusercoverphoto_cover_id').css('top');
scriptJquery('#sesusercoverphoto_cover_photo_loading').show();
var uploadURL = en4.core.baseUrl+'sesusercoverphoto/index/reposition-cover/user_id/44954';
var formData = new FormData();
formData.append('position', sendposition);
var jqXHR=scriptJquery.ajax({
url: uploadURL,
type: "POST",
contentType:false,
processData: false,
data: formData,
cache: false,
success: function(response){
response = scriptJquery.parseJSON(response);
if(response.status == 1){
previousPositionOfCover = sendposition;
scriptJquery('.sesusercoverphoto_cover_reposition_btn').hide();
scriptJqueryUIMin("#sesusercoverphoto_cover_id").dragncrop('destroy');
scriptJquery('.sesusercoverphoto_cover_fade').show();
scriptJquery('#sesusercoverphoto_cover_change').show();
scriptJquery('.sesusercoverphoto_cover_buttons').show();
}else{
alert('Something went wrong, please try again later.');
}
scriptJquery('#sesusercoverphoto_cover_photo_loading').hide();
//silence
}
});
});
function uploadFileToServerMain(files){
scriptJquery('.sesusercoverphoto_cover_main_photo').append('
');
var formData = new FormData();
formData.append('webcam', files);
uploadURL = en4.core.baseUrl+'sesusercoverphoto/index/upload-main/user_id/44954';
var jqXHR=scriptJquery.ajax({
url: uploadURL,
type: "POST",
contentType:false,
processData: false,
cache: false,
data: formData,
success: function(response){
response = scriptJquery.parseJSON(response);
scriptJquery('#uploadFileMainsesusercoverphoto').val('');
scriptJquery('#sesusercoverphoto_cover_loading_main').remove();
scriptJquery('.sesusercoverphoto_cover_image_main').attr('src', response.src);
scriptJquery('#change_main_cvr_pht').html('
'+en4.core.language.translate('Change Cover Photo'));
scriptJquery('#sesusercoverphoto_main_photo_i').css('display','block !important');
}
});
}
scriptJquery('#sesusercoverphoto_main_photo_i').click(function(){
scriptJquery('.sesusercoverphoto_cover_main_photo').append('
');
var user_id = '44954';
uploadURL = en4.core.baseUrl+'sesusercoverphoto/index/remove-main/user_id/'+user_id;
var jqXHR=scriptJquery.ajax({
url: uploadURL,
type: "POST",
contentType:false,
processData: false,
cache: false,
success: function(response){
scriptJquery('#change_main_cvr_pht').html('
'+en4.core.language.translate('Add User Photo'));
response = scriptJquery.parseJSON(response);
scriptJquery('.sesusercoverphoto_cover_image_main').attr('src', response.src);
scriptJquery('#sesusercoverphoto_cover_loading_main').remove();
scriptJquery('#sesusercoverphoto_main_photo_i').hide();
//silence
}
});
});
function uploadFileMainsesusercoverphoto(input){
var url = input.value;
var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
if (input.files && input.files[0] && (ext == "png" || ext == "jpeg" || ext == "jpg" || ext == 'PNG' || ext == 'JPEG' || ext == 'JPG' || ext == 'gif' || ext == 'GIF' || ext == "webp" || ext == 'webp')){
uploadFileToServerMain(input.files[0]);
}else{
//Silence
}
}
scriptJquery(document).on('click','#change_main_cvr_pht',function(){
document.getElementById('uploadFileMainsesusercoverphoto').click();
});
scriptJquery('').appendTo('body');
scriptJquery(document).on('click','#uploadCoverPhoto',function(){
document.getElementById('uploadFilesesUserCoverPhoto').click();
});
function readCoverPhotoImageUrl(input){
var url = input.files[0].name;
var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
if((ext == "png" || ext == "jpeg" || ext == "jpg" || ext == 'PNG' || ext == 'JPEG' || ext == 'JPG' || ext == 'gif' || ext == 'GIF' || ext == "webp")){
var formData = new FormData();
formData.append('webcam', input.files[0]);
formData.append('user_id', '44954');
scriptJquery('#sesusercoverphoto_cover_photo_loading').show();
scriptJquery.ajax({
xhr: function() {
var xhrobj = scriptJquery.ajaxSettings.xhr();
if (xhrobj.upload) {
xhrobj.upload.addEventListener('progress', function(event) {
var percent = 0;
var position = event.loaded || event.position;
var total = event.total;
if (event.lengthComputable) {
percent = Math.ceil(position / total * 100);
}
//Set progress
}, false);
}
return xhrobj;
},
url: en4.core.baseUrl+'sesusercoverphoto/index/edit-coverphoto/',
type: "POST",
contentType:false,
processData: false,
cache: false,
data: formData,
success: function(response){
text = JSON.parse(response);
if(text.status == 'true'){
if(text.src != ''){
if(scriptJquery('#sesusercoverphoto_cover_video_id').length)
scriptJquery('#sesusercoverphoto_cover_video_id').hide();
scriptJquery('#sesusercoverphoto_cover_id').show();
scriptJquery('#sesusercoverphoto_cover_id').attr('src', text.src );
}
scriptJquery('#sesusercoverphoto_cover_default').hide();
scriptJquery('#uploadCoverPhoto').html('
'+en4.core.language.translate('Change Cover Photo'));
scriptJquery('#removeCover').css('display','block');
scriptJquery('#sesusercoverphoto_main_photo_reposition').css('display','block');
}
scriptJquery('#sesusercoverphoto_cover_photo_loading').hide();
scriptJquery('#uploadFilesesUserCoverPhoto').val('');
}
});
}
}
scriptJquery(document).on('click','#uploadCoverPhotoWebCamPhoto',function(){
scriptJquery('#coverphoto_popup_cam_upload').show();
Webcam.set({
width: 320,
height: 240,
image_format:'jpeg',
jpeg_quality: 90
});
Webcam.attach('#coverphoto_camera');
});
function take_coverphotosnapshot() {
// take snapshot and get image data
Webcam.snap(function(data_uri) {
Webcam.reset();
scriptJquery('#coverphoto_popup_cam_upload').hide();
scriptJquery('#sesusercoverphoto_cover_photo_loading').show();
// upload results
Webcam.upload( data_uri, en4.core.baseUrl+'sesusercoverphoto/index/edit-coverphoto/user_id/44954' , function(code, text) {
text = JSON.parse(text);
if(text.status == 'true'){
if(text.src != ''){
if(scriptJquery('#sesusercoverphoto_cover_video_id').length)
scriptJquery('#sesusercoverphoto_cover_video_id').hide();
scriptJquery('#sesusercoverphoto_cover_id').show();
scriptJquery('#sesusercoverphoto_cover_id').attr('src', text.src );
scriptJquery('#sesusercoverphoto_cover_default').hide();
scriptJquery('#uploadCoverPhoto').html('
'+en4.core.language.translate('Change Cover Photo'));
scriptJquery('#removeCover').css('display','block');
scriptJquery('#sesusercoverphoto_main_photo_reposition').css('display','block');
}
}
scriptJquery('#sesusercoverphoto_cover_photo_loading').hide();
} );
});
}
function removeCoverPhoto(){
scriptJquery('#removeCover').css('display','none');
//scriptJquery('#sesusercoverphoto_cover_id').attr('src', '' );
scriptJquery('#sesusercoverphoto_cover_photo_loading').show();
scriptJquery('#sesusercoverphoto_cover_default').show();
var user_id = '44954';
uploadURL = en4.core.baseUrl+'sesusercoverphoto/index/remove-cover/user_id/'+user_id;
var jqXHR=scriptJquery.ajax({
url: uploadURL,
type: "POST",
contentType:false,
processData: false,
cache: false,
success: function(response){
var response = scriptJquery.parseJSON(response);
scriptJquery('#sesusercoverphoto_cover_photo_loading').hide();
scriptJquery('#uploadCoverPhoto').html('
'+en4.core.language.translate('Add Cover Photo'));
scriptJquery('#sesusercoverphoto_main_photo_reposition').css('display','none');
scriptJquery('#sesusercoverphoto_cover_id').css('top','0');
//update defaultphoto if available from admin.
if(response.src) {
scriptJquery('#sesusercovevideo_cover_video_id').hide();
scriptJquery('#sesusercoverphoto_cover_id').show();
scriptJquery('#sesusercoverphoto_cover_id').attr('src',response.src);
}
}
});
}
function hideCoverPhotoUpload(){
if(typeof Webcam != 'undefined')
Webcam.reset();
canPaginatePageNumber = 1;
scriptJquery('#coverphoto_popup_cam_upload').hide();
scriptJquery('#coverphoto_popup_existing_upload').hide();
if(typeof Webcam != 'undefined'){
scriptJquery('.slimScrollDiv').remove();
scriptJquery('.sesusercoverphoto_photo_update_popup_content').html('
');
}
}
scriptJquery(document).click(function(event){
if(event.target.id == 'change_coverphoto_profile_txt' || event.target.id == 'cover_change_btn_i' || event.target.id == 'cover_change_btn'){
scriptJquery('#sesusercoverphoto_cover_option_main_id').removeClass('active')
if(scriptJquery('#sesusercoverphoto_cover_change').hasClass('active'))
scriptJquery('#sesusercoverphoto_cover_change').removeClass('active');
else
scriptJquery('#sesusercoverphoto_cover_change').addClass('active');
}else if(event.target.id == 'change_main_txt' || event.target.id == 'change_main_btn' || event.target.id == 'change_main_i'){console.log('tyes');
scriptJquery('#sesusercoverphoto_cover_change').removeClass('active');
if(scriptJquery('#sesusercoverphoto_cover_option_main_id').hasClass('active'))
scriptJquery('#sesusercoverphoto_cover_option_main_id').removeClass('active');
else
scriptJquery('#sesusercoverphoto_cover_option_main_id').addClass('active');
}else{
scriptJquery('#sesusercoverphoto_cover_change').removeClass('active')
scriptJquery('#sesusercoverphoto_cover_option_main_id').removeClass('active')
}
});
scriptJquery(document).on('click','#fromCoverPhotoExistingAlbum',function(){
scriptJquery('#coverphoto_popup_existing_upload').show();
existingCoverPhotosGet();
});
var canPaginatePageNumber = 1;
function existingCoverPhotosGet(){
scriptJquery('#coverphoto_profile_existing_img').show();
var URL = en4.core.baseUrl+'sesusercoverphoto/index/existing-photos/';
(scriptJquery.ajax({
method: 'post',
'url': URL ,
'data': {
format: 'html',
cover: 'cover',
page: canPaginatePageNumber,
is_ajax: 1
},
success: function(responseHTML) {
scriptJquery('#coverphoto_existing_data').append(responseHTML);
scriptJquery('#coverphoto_existing_data').slimscroll({
height: 'auto',
alwaysVisible :true,
color :'#000',
railOpacity :'0.5',
disableFadeOut :true,
});
scriptJquery('#coverphoto_existing_data').slimScroll().bind('slimscroll', function(event, pos){
if(canPaginateExistingPhotos == '1' && pos == 'bottom' && scriptJquery('#coverphoto_profile_existing_img').css('display') != 'block'){
scriptJquery('#coverphoto_profile_existing_img').css('position','absolute').css('width','100%').css('bottom','5px');
existingCoverPhotosGet();
}
});
scriptJquery('#coverphoto_profile_existing_img').hide();
}
}));
}
scriptJquery(document).on('click','a[id^="sesusercoverphoto_cover_existing_album_see_more_"]',function(event){
event.preventDefault();
var thatObject = this;
scriptJquery(thatObject).parent().hide();
var id = scriptJquery(this).attr('id').match(/\d+/)[0];
var pageNum = parseInt(scriptJquery(this).attr('data-src'),10);
scriptJquery('#sesusercoverphoto_existing_album_see_more_loading_'+id).show();
if(pageNum == 0){
scriptJquery('#sesusercoverphoto_existing_album_see_more_page_'+id).remove();
return;
}
var URL = en4.core.baseUrl+'sesusercoverphoto/index/existing-albumphotos/';
(scriptJquery.ajax({
method: 'post',
'url': URL ,
'data': {
format: 'html',
page: pageNum+1,
id: id,
cover: 'cover',
},
success: function(responseHTML) {
scriptJquery('#sesusercoverphoto_photo_content_'+id).append(responseHTML);
var dataSrc = scriptJquery('#sesusercoverphoto_existing_album_see_more_page_'+id).html();
scriptJquery('#sesusercoverphoto_existing_album_see_more_'+id).attr('data-src',dataSrc);
scriptJquery('#sesusercoverphoto_existing_album_see_more_page_'+id).remove();
if(dataSrc == 0)
scriptJquery('#sesusercoverphoto_existing_album_see_more_'+id).parent().remove();
else
scriptJquery(thatObject).parent().show();
scriptJquery('#sesusercoverphoto_existing_album_see_more_loading_'+id).hide();
}
}));
});
scriptJquery(document).on('click','a[id^="sesusercoverphoto_cover_upload_existing_photos_"]',function(event){
event.preventDefault();
var id = scriptJquery(this).attr('id').match(/\d+/)[0];
if(!id)
return;
scriptJquery('#sesusercoverphoto_cover_photo_loading').show();
hideCoverPhotoUpload();
var URL = en4.core.baseUrl+'sesusercoverphoto/index/uploadexistingcoverphoto/';
(scriptJquery.ajax({
method: 'post',
'url': URL ,
'data': {
format: 'html',
id: id,
cover: 'cover',
user_id:'44954'
},
success: function(responseHTML) {
text = JSON.parse(responseHTML);
if(text.status == 'true'){
if(text.src != ''){
if(scriptJquery('#sesusercoverphoto_cover_video_id').length)
scriptJquery('#sesusercoverphoto_cover_video_id').hide();
scriptJquery('#sesusercoverphoto_cover_id').show();
scriptJquery('#sesusercoverphoto_cover_id').attr('src', text.src );
}
scriptJquery('#sesusercoverphoto_cover_default').hide();
scriptJquery('#uploadCoverPhoto').html('
'+en4.core.language.translate('Change Cover Photo'));
scriptJquery('#removeCover').css('display','block');
scriptJquery('#sesusercoverphoto_main_photo_reposition').css('display','block');
}
scriptJquery('#sesusercoverphoto_cover_photo_loading').hide();
scriptJquery('#uploadFilesesUserCoverPhoto').val('');
}
}));
});
-->