Files
Testing/include/js/he_user_note-admin.js

152 lines
3.4 KiB
JavaScript
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
/**
* @author Ermek
* @copyright Hire-Experts LLC
* @version UserNote 1.01
*/
var he_user_note =
{
show_note_form: 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();
window.setTimeout(function(){
//$note_cont.setStyle('display', 'none');
//$note_form.set('tween', {duration: 400});
$note_form.fadeIn();
//$note_form.setStyle('display', 'block');
}, 400);
},
cancel_note_form: function()
{
var $note_cont = jQuery('#he_user_note_cont');
var $note_form = jQuery('#he_user_note_form');
$note_form.fadeOut();
window.setTimeout(function(){
$note_cont.fadeIn();
}, 400);
},
save_user_note: function()
{
var $add_note_btn = jQuery('#user_note_add_btn');
var $note_form = jQuery('#he_user_note_form');
$note_form.fadeOut();
window.setTimeout(function(){
//$note_form.setStyle('display', 'none');
//$add_note_btn.set('tween', {duration: 400});
$add_note_btn.fadeIn();
$add_note_btn.css('height', 26);
$add_note_btn.css('display', 'block');
}, 400);
},
save_note: function(button)
{
var self = this;
var $note_node = jQuery('.he_user_note_block .user_note');
var $add_note_btn = jQuery('.he_user_note_block .add_note_btn');
var $loading = jQuery('.he_user_note_loading');
var note = jQuery('#user_note_textarea').val();
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.css('display', 'none');
$note_node.css('display', 'none');
$loading.css('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.html(result);
}
$loading.css('display', 'none');
$note_node.css('display', 'block');
$$('.he_user_note_block .block_acts').css('display', 'block');
}
}).send();
},
delete_note: function()
{
var self = this;
var result = window.confirm( SELanguage.Translate(690699006));
if ( !result ) { return false; }
var $note_node = jQuery('.he_user_note_block .user_note');
var $add_note_btn = jQuery('.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 = jQuery('.he_user_note_loading');
$note_node.css('display', 'none');
$loading.css('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.text('');
jQuery('#user_note_textarea').val('');
jQuery('.he_user_note_block .block_acts').css('display', 'none');
$loading.css('display', 'none');
$add_note_btn.css('display', 'block');
self.cancel_note_form();
}
}
}).send();
}
};