1 <h4><?php echo $this->lang->line('video_title_comment') ?>: </h4>
3 <?php echo form_open("video/comment/$video_id") ?>
4 <textarea name="comment" id="comment" rows="4" cols="56"><?php
5 if (validation_errors()):
6 echo set_value('comment', '');
10 <div><input type="button" id="button-post" value="<?php echo $this->lang->line('video_submit_post_comment') ?>" />
11 <span id="comment-chars-left">512</span> <?php echo $this->lang->line('ui_chars_left') ?>
13 <div><?php echo form_error('comment') ?></div>
16 <?php if ($comments_count == 0): ?>
18 <h4><?php echo $this->lang->line('video_title_no_comments') ?></h4>
22 <?php if ($hottest_comments): ?>
23 <h4><?php echo $this->lang->line('video_title_hottest_comments'). ": " ?></h4>
25 <?php foreach ($hottest_comments as $hottest_comment): ?>
26 <div class="comment-info"><strong class="comment-user"><a href="<?php echo site_url("user/profile/{$hottest_comment['username']}") ?>"><?php echo $hottest_comment['username'] ?></a></strong>
27 (<span class="comment-time"><?php echo $hottest_comment['local_time'] ?></span>)
30 <div class="comment-content"><?php echo $hottest_comment['content'] ?></div>
32 <div class="comment-popularity"><a class="link-vote-video-comment" data-action="like" data-commentid="<?php echo $hottest_comment['id'] ?>" href="#"><?php echo $this->lang->line('video_like') ?></a>
33 <a class="link-vote-video-comment" data-action="dislike" data-commentid="<?php echo $hottest_comment['id'] ?>" href="#"><?php echo $this->lang->line('video_dislike') ?></a>
34 <span id="<?php echo "video-comment-{$hottest_comment['id']}-likes" ?>"><?php echo $hottest_comment['likes'] ?></span> <?php
35 echo $this->lang->line('ui_likes') ?>,
36 <span id="<?php echo "video-comment-{$hottest_comment['id']}-dislikes" ?>"><?php echo $hottest_comment['dislikes'] ?></span> <?php
37 echo $this->lang->line('ui_dislikes'); ?>
42 <h4><?php echo $this->lang->line('video_title_all_comments'). " ($comments_count): " ?></h4>
44 <?php foreach ($comments as $comment): ?>
45 <div class="comment-info"><strong class="comment-user"><a href="<?php echo site_url("user/profile/{$comment['username']}") ?>"><?php echo $comment['username'] ?></a></strong>
46 (<span class="comment-time"><?php echo $comment['local_time'] ?></span>)
49 <div class="comment-content"><?php echo $comment['content'] ?></div>
51 <div class="comment-popularity"><a class="link-vote-video-comment" data-action="like" data-commentid="<?php echo $comment['id'] ?>" href="#"><?php echo $this->lang->line('video_like') ?></a>
52 <a class="link-vote-video-comment" data-action="dislike" data-commentid="<?php echo $comment['id'] ?>" href="#"><?php echo $this->lang->line('video_dislike') ?></a>
53 <span id="<?php echo "video-comment-{$comment['id']}-likes" ?>"><?php echo $comment['likes'] ?></span> <?php
54 echo $this->lang->line('ui_likes') ?>,
55 <span id="<?php echo "video-comment-{$comment['id']}-dislikes" ?>"><?php echo $comment['dislikes'] ?></span> <?php
56 echo $this->lang->line('ui_dislikes'); ?>
60 <?php echo $comments_pagination ?>
63 <script type="text/javascript">
67 $.post('<?php echo site_url("video/ajax_comment/$video_id") ?>',
68 {comment: $('#comment').val()},
70 $('#video-comments').html(data);
83 target: '#video-comments'
86 $('.link-vote-video-comment')
87 .click(function(event) {
88 var user_id = "<?php echo $user_id ?>";
89 var action, idOutput, commentId;
90 commentId = $(this).data('commentid');
91 if ($(this).data('action') == 'like')
94 var idOutput = '#video-comment-' + commentId + '-likes';
98 var action = 'dislike';
99 var idOutput = '#video-comment-' + commentId + '-dislikes';
101 //alert(action + " " + user_id);
103 event.preventDefault();
105 if (user_id.length != 0)
109 url: "<?php echo site_url("video/ajax_vote_comment") ?>/"
112 data: {t: ""+Math.random()},
114 success: function(text) {
116 $(idOutput).html(text);
118 alert('<?php echo $this->lang->line('ui_msg_repeated_action_restriction') ?>');
123 alert('<?php echo $this->lang->line('ui_msg_login_restriction') ?>');
127 .bind('keyup paste drop change', function(event) {
130 if ($textarea.val().length >= 513)
131 $textarea.val($textarea.val().substring(0, 512));
133 $('#comment-chars-left').html('' + (512 - $textarea.val().length));