Файл: adultscript-2.0.3-pro/files/mobile/templates/default/js/jquery.video-1.0.js
Строк: 184
<?php
$(document).ready(function() {
var vwidth = 854;
var vheight = 480;
var playerc = $("#player-container");
var width = playerc.width();
if (width > 768) {
width = 768;
}
var height = Math.round(width / (vwidth / vheight));
playerc.css('height', height);
$(window).resize(function() {
var width = playerc.width();
if (width > 768) {
width = 768;
}
var height = Math.round(width / (vwidth / vheight));
playerc.css('height', height);
});
$("a#play").click(function(e) {
e.preventDefault();
videojs('player').ready(function() {
this.play();
});
});
$("button#inter-play").click(function(e) {
e.preventDefault();
$("#inter").hide();
videojs('player').ready(function() {
this.play();
});
});
$("button[id^='rate-']").click(function(e) {
e.preventDefault();
var rating = 5;
if ($(this).attr('id') == 'rate-down') {
rating = 0;
}
var video_id = $("input[name='video_id']").val();
$.ajax({
url: mobile_url + '/ajax.php?s=rate&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: {rating: rating, video_id: video_id},
success: function(response) {
if (response.status == '1') {
$("span#rating-result").html(response.code);
}
$("#response").html(response.msg);
$("#response").show();
}
});
});
$("button[id='post-comment']").click(function(e) {
e.preventDefault();
var video_id = $("input[name='video_id']").val();
var comment = $("textarea[name='comment']").val();
var nickname = $("input[name='nickname']").val();
$(this).val('Please wait...');
$.ajax({
url: mobile_url + '/ajax.php?s=comment&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { video_id: video_id, comment: comment, nickname: nickname },
success: function(response) {
if (response.status == '1') {
$("textarea[name='comment']").val('');
$("#comments").prepend(response.code).listview('refresh');
$("#response-comment").removeClass('error').addClass('success');
} else {
$("#response-comment").removeClass('success').addClass('error');
}
$("#response-comment").html(response.msg);
$("#response-comment").show();
}
});
});
$("button[id='favorite']").click(function(e) {
e.preventDefault();
var video_id = $("input[name='video_id']").val();
$.ajax({
url: mobile_url + '/ajax.php?s=favorite&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { video_id: video_id },
success: function(response) {
if (response.status == '1') {
$("#favorite-result").html(response.code);
$("#response").removeClass('error').addClass('success');
} else {
$("#response").removeClass('success').addClass('error');
}
$("#response").html(response.msg);
$("#response").show();
}
});
});
$("button[id='playlist']").click(function(e) {
e.preventDefault();
var video_id = $("input[name='video_id']").val();
$("#playlist-container").slideToggle();
});
$("button[id='playlist-select']").click(function(e) {
var video_id = $("input[name='video_id']").val();
var playlist_id = $("select[name='playlist_id']").val();
$.ajax({
url: mobile_url + '/ajax.php?s=playlist_select&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { video_id: video_id, playlist_id: playlist_id},
success: function(response) {
$("#playlist-container").slideUp();
if (response.status == '1') {
$("#response").removeClass('error').addClass('success');
} else {
$("#response").removeClass('success').addClass('error');
}
$("#response").html(response.msg);
$("#response").show();
}
});
});
$("button[id='playlist-create']").click(function(e) {
var video_id = $("input[name='video_id']").val();
var name = $("input[name='name']").val();
var type = $("input[name='type']").val();
$.ajax({
url: mobile_url + '/ajax.php?s=playlist_create&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { video_id: video_id, name: name, type: type},
success: function(response) {
if (response.status == '1') {
$("#playlist-container").slideUp();
$("#response").removeClass('error').addClass('success');
} else {
$("#response").removeClass('success').addClass('error');
}
alert(response.msg);
$("#response").html(response.msg);
$("#response").show();
}
});
});
$("button[id='more-comments']").click(function(e) {
e.preventDefault();
var video_id = $("input[name='video_id']").val();
var page = $("input[name='page']").val();
$.ajax({
url: mobile_url + '/ajax.php?s=comment_pagination&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { video_id: video_id, page: page },
success: function(response) {
if (response.status == '1') {
$("#comments").append(response.code).listview('refresh');
$("input[name='page']").val(response.page);
if (response.end == '1') {
$("button[id='more-comments']").hide();
}
}
}
});
});
});
?>