rhymix/widgets/sms/skins/default/js/sms_widget.js
bnu f875e5f33f widget - dev version
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6737 201d5d3c-b55e-5fd7-737f-ddc643e51545
2009-08-07 07:42:58 +00:00

83 lines
2.1 KiB
JavaScript

function completeSendSms(rec_obj) {
console.log(rec_obj);
}
(function($) {
/* DOM READY */
jQuery(function($) {
var $widgetContainer = $('div.smsxe');
var $widgetForm = $('form#fo_sms_widget', $widgetContainer);
var $widgetSerchForm = $('form#fo_sms_widget_search', $widgetContainer);
var $searchArea = $('.search_area', $widgetContainer);
var $sendPcsList = $('.send_pcs_list', $widgetContainer);
var $searchInputbox = $('.input_box', $searchArea);
var $statusArea = $('.status', $widgetContainer);
$widgetForm.submit(function() {
console.log('전송');
});
$widgetSerchForm.submit(function() {
console.log('검색');
return false;
});
$('textarea', $widgetForm).keyup(function() {
var get_length = PerbizSMS.getByteLength(this);
if(!get_length) return;
$('.status_byte', $statusArea).text(get_length.length);
$('.limit_byte', $statusArea).text(get_length.limit_byte);
$('.status_count', $statusArea).text(get_length.sms_count);
});
$('textarea', $widgetForm).triggerHandler('keyup');
$('input', $sendPcsList).keypress(function(e) {
if(e.which == 13) {
var $nextInput = $(this).parent().next().children('input');
if($nextInput.length) {
$nextInput.focus().select();
} else {
$('.return_pcs input', $widgetContainer).focus().select();
}
return false;
}
});
$('.bth_addressbook a', $widgetContainer).click(function() {
//PerbizSMS.showAddressbook('window');
return false;
});
$searchInputbox.watermark($searchInputbox.attr('title'));
/**
* @berif 목록에서 번호 삭제
**/
$('.btn_delete', $sendPcsList).click(function() {
var $inputAll = $('input', $sendPcsList);
$(this).prev('input').val('');
var $nextInput = $(this).parent().nextAll().children('input');
var values = [];
$inputAll.each(function(idx) {
if(this.value && this.value != 'undefined') values.push(this.value);
});
$inputAll.val('');
$inputAll.each(function(idx) {
if(values[idx]) {
this.value = values[idx];
} else {
this.value = '';
}
});
});
});
}) (jQuery);