Файл: adultscript-2.0.3-pro/files/templates/defboot/user_playlists.tpl.php
Строк: 104
<?php defined('_VALID') or die('Restricted Access!'); ?>
<script type="text/javascript">
$(document).ready(function() {
$("button[id^='playlist-delete-']").click(function(e) {
e.preventDefault();
var playlist_id = $(this).attr('id').match(/playlist-delete-(.*)/)[1];
$.ajax({
url: base_url + '/ajax.php?s=playlist_delete',
cache: false,
type: "POST",
dataType: "json",
data: {playlist_id: playlist_id},
success: function(response) {
$("#response").append(response.msg);
if (response.status == '1') {
$("li[id='playlist-" + playlist_id + "']").fadeOut();
$("#response").removeClass('alert-danger').addClass('alert-success');
} else {
$("#response").removeClass('alert-success').addClass('alert-danger');
}
$("#response").show();
if (!$("li[id^='playlist-']").length) {
window.location = "<?php echo BASE_URL; ?>/user/dashboard/";
}
}
});
});
$("button[id^='playlist-edit-']").click(function(e) {
e.preventDefault();
var playlist_id = $(this).attr('id').match(/playlist-edit-(.*)/)[1];
$.ajax({
url: base_url + '/ajax.php?s=playlist_edit',
cache: false,
type: "POST",
dataType: "json",
data: {playlist_id: playlist_id},
success: function(response) {
if (response.status == '1') {
$("#playlist-modal-container").html(response.code);
$("#edit-modal-" + response.id).modal();
} else {
$("#response").append(response.msg);
$("#response").removeClass('alert-success').addClass('alert-danger');
$("#response").show();
}
}
});
});
$("#playlist-modal-container").on('click', '.playlist-thumb', function() {
var video_id = $(this).attr('id').match(/thumb-(.*)/)[1];
$("input[name='thumb']").val(video_id);
$(".playlist-thumb").removeClass('img-active');
$(this).addClass('img-active');
});
$("#playlist-modal-container").on('click', "button[id^='edit-submit-']", function() {
var playlist_id = $(this).attr('id').match(/edit-submit-(.*)/)[1];
var name = $("input[name='name']").val();
var type = $("select[name='type']").val();
var thumb = $("input[name='thumb']").val();
$.ajax({
url: base_url + '/ajax.php?s=playlist_edit',
cache: false,
type: "POST",
dataType: "json",
data: {playlist_id: playlist_id, name: name, type: type, thumb: thumb},
success: function(response) {
$("#playlist-response").html(close + response.msg);
if (response.status == '1') {
$("#playlist-response").removeClass('alert-danger').addClass('alert-success');
} else {
$("#playlist-response").removeClass('alert-success').addClass('alert-danger');
}
$("#playlist-response").show();
}
});
});
});
</script>
<div id="playlist-modal-container"></div>
<div id="response" class="alert alert-dismissible" style="display: none;">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<?php echo $this->fetch('_user_header'); ?>
<?php if ($this->playlists): echo $this->fetch('_playlist_list'); ?>
<nav class="text-center"><ul class="pagination pagination-lg"><?php echo p('pagination', $this->pagination, CUR_URL); ?></ul></nav>
<?php else: ?>
<div class="none"><?php echo __('no-playlists'); ?></div>
<?php endif; ?>
<?php echo $this->fetch('_user_footer'); ?>