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 echo set_value('comment', '') ?></textarea>
6 <div><input type="button" id="button-post" value="<?php echo $this->lang->line('video_submit_post_comment') ?>" />
7 <span id="comment-chars-left">512</span> <?php echo $this->lang->line('ui_chars_left') ?>
9 <div><?php echo form_error('comment') ?></div>
12 <?php if ($comments_count == 0): ?>
14 <h4><?php echo $this->lang->line('video_title_no_comments') ?></h4>
18 <?php if ($hottest_comments): ?>
19 <h4><?php echo $this->lang->line('video_title_hottest_comments'). ": " ?></h4>
21 <?php foreach ($hottest_comments as $hottest_comment): ?>
22 <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>
23 (<span class="comment-time"><?php echo $hottest_comment['local_time'] ?></span>)
26 <div class="comment-content"><?php echo $hottest_comment['content'] ?></div>
28 <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>
29 <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>
30 <span id="<?php echo "video-comment-{$hottest_comment['id']}-likes" ?>"><?php echo $hottest_comment['likes'] ?></span> <?php
31 echo $this->lang->line('ui_likes') ?>,
32 <span id="<?php echo "video-comment-{$hottest_comment['id']}-dislikes" ?>"><?php echo $hottest_comment['dislikes'] ?></span> <?php
33 echo $this->lang->line('ui_dislikes'); ?>
38 <h4><?php echo $this->lang->line('video_title_all_comments'). " ($comments_count): " ?></h4>
40 <?php foreach ($comments as $comment): ?>
41 <div class="comment-info"><strong class="comment-user"><a href="<?php echo site_url("user/profile/{$comment['username']}") ?>"><?php echo $comment['username'] ?></a></strong>
42 (<span class="comment-time"><?php echo $comment['local_time'] ?></span>)
45 <div class="comment-content"><?php echo $comment['content'] ?></div>
47 <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>
48 <a class="link-vote-video-comment" data-action="dislike" data-commentid="<?php echo $comment['id'] ?>" href="#"><?php echo $this->lang->line('video_dislike') ?></a>
49 <span id="<?php echo "video-comment-{$comment['id']}-likes" ?>"><?php echo $comment['likes'] ?></span> <?php
50 echo $this->lang->line('ui_likes') ?>,
51 <span id="<?php echo "video-comment-{$comment['id']}-dislikes" ?>"><?php echo $comment['dislikes'] ?></span> <?php
52 echo $this->lang->line('ui_dislikes'); ?>
56 <?php echo $comments_pagination ?>
59 <script type="text/javascript">
61 function updateCommentCharsLeft($textarea)
63 $('#comment-chars-left').html('' + (512 - $textarea.val().length));
69 $.post('<?php echo site_url("video/ajax_comment/$video_id") ?>',
70 {comment: $('#comment').val()},
72 $('#video-comments').html(data);
85 target: '#video-comments'
88 $('.link-vote-video-comment')
89 .click(function(event) {
90 var user_id = "<?php echo $user_id ?>";
91 var action, idOutput, commentId;
92 commentId = $(this).data('commentid');
93 if ($(this).data('action') == 'like')
96 var idOutput = '#video-comment-' + commentId + '-likes';
100 var action = 'dislike';
101 var idOutput = '#video-comment-' + commentId + '-dislikes';
103 //alert(action + " " + user_id);
105 event.preventDefault();
107 if (user_id.length != 0)
111 url: "<?php echo site_url("video/ajax_vote_comment") ?>/"
114 data: {t: ""+Math.random()},
116 success: function(text) {
118 $(idOutput).html(text);
120 alert('<?php echo $this->lang->line('ui_msg_repeated_action_restriction') ?>');
125 alert('<?php echo $this->lang->line('ui_msg_login_restriction') ?>');
129 .keydown(function(event) {
130 updateCommentCharsLeft($(this));
132 if ($(this).val().length == 513)
133 $(this).val($(this).val().substring(0, 512));
136 updateCommentCharsLeft($(this));