168 lines
4.1 KiB
JavaScript
168 lines
4.1 KiB
JavaScript
|
|
/**
|
|
* @author Ermek
|
|
* @copyright Hire-Experts LLC
|
|
* @version UserNote 1.01
|
|
*/
|
|
|
|
|
|
var he_user_note =
|
|
{
|
|
show_note_form1: function()
|
|
{
|
|
var $note_cont = jQuery('#he_user_note_cont');
|
|
var $note_form = jQuery('#he_user_note_form');
|
|
|
|
//$note_cont.set('tween', {duration: 400});
|
|
|
|
$note_cont.fadeOut();
|
|
alert("A");
|
|
window.setTimeout(function(){
|
|
//$note_cont.setStyle('display', 'none');
|
|
//$note_form.set('tween', {duration: 400});
|
|
$note_form.fadeIn();
|
|
//$note_form.setStyle('display', 'block');
|
|
}, 400);
|
|
},
|
|
|
|
show_note_form: function()
|
|
{
|
|
var $note_cont = $('he_user_note_cont');
|
|
var $note_form = $('he_user_note_form');
|
|
|
|
$note_cont.set('tween', {duration: 400});
|
|
$note_cont.fade('out');
|
|
|
|
window.setTimeout(function(){
|
|
$note_cont.setStyle('display', 'none');
|
|
$note_form.set('tween', {duration: 400});
|
|
$note_form.fade('in');
|
|
$note_form.setStyle('display', 'block');
|
|
}, 400);
|
|
},
|
|
|
|
cancel_note_form: function()
|
|
{
|
|
var $note_cont = $('he_user_note_cont');
|
|
var $note_form = $('he_user_note_form');
|
|
|
|
$note_form.set('tween', {duration: 400});
|
|
$note_form.fade('out');
|
|
|
|
window.setTimeout(function(){
|
|
$note_form.setStyle('display', 'none');
|
|
$note_cont.set('tween', {duration: 400});
|
|
$note_cont.fade('in');
|
|
$note_cont.setStyle('display', 'block');
|
|
}, 400);
|
|
},
|
|
|
|
save_user_note: function()
|
|
{
|
|
var $add_note_btn = $('user_note_add_btn');
|
|
var $note_form = $('he_user_note_form');
|
|
|
|
$note_form.set('tween', {duration: 400});
|
|
$note_form.fade('out');
|
|
|
|
window.setTimeout(function(){
|
|
$note_form.setStyle('display', 'none');
|
|
$add_note_btn.set('tween', {duration: 400});
|
|
$add_note_btn.fade('in');
|
|
$add_note_btn.setStyle('height', 26);
|
|
$add_note_btn.setStyle('display', 'block');
|
|
}, 400);
|
|
},
|
|
|
|
save_note: function(button)
|
|
{
|
|
var self = this;
|
|
var $note_node = $$('.he_user_note_block .user_note');
|
|
var $add_note_btn = $$('.he_user_note_block .add_note_btn');
|
|
var $loading = $$('.he_user_note_loading');
|
|
|
|
var note = $('user_note_textarea').get('value');
|
|
note = note.trim();
|
|
|
|
if ( note.length==0 ) {
|
|
return false;
|
|
}
|
|
else if ( note.length > 1500 ) {
|
|
return false;
|
|
}
|
|
|
|
$(button).disabled = true;
|
|
$(button).addClass('disabled');
|
|
|
|
$add_note_btn.setStyle('display', 'none');
|
|
$note_node.setStyle('display', 'none');
|
|
$loading.setStyle('display', 'block');
|
|
|
|
this.cancel_note_form();
|
|
|
|
var request_url = ( SocialEngine.Owner == undefined )
|
|
? window.location.href
|
|
: 'profile.php?user=' + SocialEngine.Owner.user_info.user_username
|
|
|
|
new Request.JSON({
|
|
method: 'get',
|
|
url: request_url + '&task=save_user_note' + '&no_cache=' + Math.random(),
|
|
data: {note: note},
|
|
onSuccess: function(result) {
|
|
$(button).disabled = false;
|
|
$(button).removeClass('disabled');
|
|
|
|
if ( result )
|
|
{
|
|
$note_node.set('html', result);
|
|
}
|
|
|
|
$loading.setStyle('display', 'none');
|
|
$note_node.setStyle('display', 'block');
|
|
|
|
$$('.he_user_note_block .block_acts').setStyle('display', 'block');
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
delete_note: function()
|
|
{
|
|
var self = this;
|
|
var result = window.confirm( SELanguage.Translate(690699006));
|
|
|
|
if ( !result ) { return false; }
|
|
|
|
var $note_node = $$('.he_user_note_block .user_note');
|
|
var $add_note_btn = $$('.he_user_note_block .add_note_btn');
|
|
|
|
var request_url = ( SocialEngine.Owner == undefined )
|
|
? window.location.href
|
|
: 'profile.php?user=' + SocialEngine.Owner.user_info.user_username
|
|
|
|
var $loading = $$('.he_user_note_loading');
|
|
var $note_node = $$('.he_user_note_block .user_note');
|
|
|
|
$note_node.setStyle('display', 'none');
|
|
$loading.setStyle('display', 'block');
|
|
|
|
new Request.JSON({
|
|
method: 'get',
|
|
url: request_url + '&task=delete_user_note' + '&no_cache=' + Math.random(),
|
|
onSuccess: function(result) {
|
|
if ( result )
|
|
{
|
|
$note_node.set('text', '');
|
|
$('user_note_textarea').set('value', '');
|
|
|
|
$$('.he_user_note_block .block_acts').setStyle('display', 'none');
|
|
|
|
$loading.setStyle('display', 'none');
|
|
$add_note_btn.setStyle('display', 'block');
|
|
|
|
self.cancel_note_form();
|
|
}
|
|
}
|
|
}).send();
|
|
}
|
|
};
|