- $('#video-widget').nsvideo({
- type: "<?php echo $plugin_type ?>",
- definition:
- "<?php echo $video['assets'][ $asset_index ]['def'] ?>",
- src: {
- <?php
- for ($i=0; $i < count($video['assets']); $i++)
- {
- $asset = $video['assets'][$i];
- echo '"'. $asset['def'] . '": ';
- echo '"'. $asset['src'] . '"';
- echo ($i == count($video['assets']) - 1) ? '' : ', ';
- }
- ?>
- }
- });
+ $('#video-widget')
+ .nsvideo({
+ type: "<?php echo $plugin_type ?>",
+ src: <?php echo json_encode($video['assets']) ?>,
+
+ showState: false,
+
+ minWidth: 640,
+ maxWidth: 1024,
+ initialDuration: "<?php echo $video['duration'] ?>",
+
+ resize: function() {
+ $('#video-widget-tabs')
+ .css('width', $('#video-widget').css('width'));
+ }
+ });
+
+ $('.link-vote')
+ .click(function(event) {
+ var user_id = "<?php echo $user_id ?>";
+ var action, idOutput;
+ if ($(this).data('action') == 'like')
+ {
+ var action = 'like';
+ var idOutput = '#video-likes';
+ }
+ else
+ {
+ var action = 'dislike';
+ var idOutput = '#video-dislikes';
+ }
+ //alert(action + " " + user_id);
+
+ event.preventDefault();
+
+ if (user_id.length != 0)
+ {
+ $.ajax({
+ type: "GET",
+ url: "<?php echo site_url("video/ajax_vote") ?>/"
+ + action
+ + "<?php echo "/{$video['id']}" ?>",
+ data: {t: ""+Math.random()},
+ dataType: "text",
+ success: function(text) {
+ if (text)
+ $(idOutput).html(text);
+ else
+ alert('<?php echo $this->lang->line('ui_msg_repeated_action_restriction') ?>');
+ }
+ });
+ }
+ else
+ alert('<?php echo $this->lang->line('ui_msg_login_restriction') ?>');
+ })
+ .button();
+
+ $('#link-like')
+ .click(function() {
+ user_id = "<?php echo $user_id ?>";
+
+ if (user_id)
+ {
+ $.ajax({
+ type: "GET",
+ url: "<?php echo site_url("video/ajax_vote/like/{$video['id']}") ?>",
+ dataType: "text",
+ success: function(text) {
+ if (text)
+ $('#video-likes').html(text);
+ else
+ alert('<?php echo $this->lang->line('ui_msg_repeated_action_restriction') ?>');
+ }
+ });
+ }
+ else
+ alert('<?php echo $this->lang->line('ui_msg_login_restriction') ?>');
+ })
+ .button();
+ $('#link-dislike')
+ .click(function() {
+ user_id = "<?php echo $user_id ?>";
+
+ if (user_id)
+ {
+ $.ajax({
+ type: "GET",
+ url: "<?php echo site_url("video/ajax_vote/dislike/{$video['id']}/$user_id") ?>",
+ data: {t: ""+Math.random()},
+ dataType: "text",
+ success: function(text) {
+ $('#video-dislikes').html(text);
+ }
+ });
+ }
+ else
+ alert('<?php echo $this->lang->line('ui_msg_login_restriction') ?>');
+ })
+ .button();
+
+ $('#video-info-details').hide();
+
+ $('#a-show-info-details')
+// .button({
+// icons: {
+// primary: 'ui-icon-triangle-1-s'
+// },
+// text: false
+// })
+ .click(function(event) {
+ event.preventDefault(true);
+ $('#video-shorted-description').toggle();
+ $('#video-info-details').fadeToggle();
+
+ //console.log($(this).button('option', 'icons'));
+ if ($(this).data('val') == 'more')
+ {
+ $(this).data('val', 'less');
+ $(this).html('<?php echo $this->lang->line('video_show_less') ?>');
+ }
+ else
+ {
+ $(this).data('val', 'more');
+ $(this).html('<?php echo $this->lang->line('video_show_more') ?>');
+ }
+ });