| 1 | | <script type="text/javascript"> |
| 2 | | /* ページ表示後にテキストエリアにフォーカス */ |
| 3 | | $(document).ready(function(){ |
| 4 | | $('#message').val('').focus(); |
| 5 | | }); |
| 6 | | |
| 7 | | /* つぶやきの投稿 */ |
| 8 | | $(function(){ |
| 9 | | $('#twitter').click(function(){ |
| 10 | | comment = $('#message').val(); |
| 11 | | $.post('<?=site_url('status/update')?>', {msg: comment, |
| 12 | | ticket: $('#ticket').val(), p: $('#page_').val()}, addComment, 'html'); |
| 13 | | $('#message').val('').focus(); |
| 14 | | $('p#last_comment').text(comment); |
| 15 | | }); |
| 16 | | }); |
| 17 | | function addComment(data){ |
| 18 | | $('tbody:first').prepend(data); |
| 19 | | } |
| 20 | | |
| 21 | | /* 削除 */ |
| 22 | | function delComment(id){ |
| 23 | | if (confirm('削除してもよいですか?取り消しできません!')){ |
| 24 | | $.post('<?=site_url('status/delete')?>', {id: id, ticket: $('#ticket').val()}, removeComment, 'html'); |
| 25 | | }; |
| 26 | | } |
| 27 | | function removeComment(id){ |
| 28 | | $('tr').remove(id); |
| 29 | | } |
| 30 | | |
| 31 | | /* 返事をする */ |
| 32 | | function replyTo(username){ |
| 33 | | oldValue = $('#message').val().replace(/\s?@\w+\s?/, ''); |
| 34 | | $('#message').val("@" + username + " " + oldValue); |
| 35 | | } |
| 36 | | </script> |
| | 1 | <script type="text/javascript" src="<?=site_url('js')?>"></script> |