clipbucket/upload/styles/cbv3/layout/javascript.html

127 lines
4.1 KiB
HTML
Raw Normal View History

<!-- Defining Amplify Requests -->
<script>
var ajaxURL = baseurl+'/ajax';
//Update sidebar
amplify.request.define( "videos", "ajax", {
url: ajaxURL+"/videos.php",
type: "POST",
dataType: "json",
decoder: function( data, status, xhr, success, error ) {
if ( status === "success" ) {
success( data );
} else {
error( data );
}
}
});
//defining up clipbucjet ajax request
amplify.request.define( "main", "ajax", {
url: ajaxURL+"/main.php",
type: "POST",
dataType: "json",
decoder: function( data, status, xhr, success, error ) {
if ( status === "success" ) {
success( data );
} else {
error( data );
}
}
});
</script>
<!-- Working With the Javascript -->
<script type="text/javascript">
$(document).ready(function(){
//Adding Comment Hover effect
$('.comment').bind('mouseover',function(e){
$(this).find('.comment-options').show();
});
//Adding Comment Mouse-leave effect
$('.comment').bind('mouseout',function(e){
$(this).find('.comment-options').hide();
});
//Init Login Modal box
$('#login-modal').modal({
show : false
});
//Init Drop Downs
$('.cb-dropdown').dropdown();
{if $smarty.const.THIS_PAGE == 'view_item'}
$('#cb_send_photo_pm').on('click',function(){
var obj = $(this), form = this.form, fields = $('#'+form.id ).serializeArray(), forward = {};
$.each( fields, function(index, val) {
forward[ val.name ] = val.value
});
forward['mode'] = 'send_photo_pm';
var callAJAX = $.ajax({
url : baseurl+'/ajax.php',
type : 'POST',
dataType : 'json',
data : forward,
beforeSend : function() {
obj.parent().children('button').attr('disabled','disabled');
$('#private_message_response').hide().removeClass('alert-error alert-success');
},
success : function( data ){
if ( data.error ) {
$('#private_message_response').addClass('alert-error').html( data.error ).show();
}
if ( data.success ) {
$('#private_message_response').addClass('alert-success').html( data.success ).show();
obj.next().html('Close');
var autoClose = setTimeout(function() {
obj.next().trigger('click');
},2000)
}
obj.parent().children('button').removeAttr( 'disabled' );
}
})
})
{/if}
//Hiding Children Categories
$('.categories-nav > ul > li > ol').hide();
//Adding Toggle
$('.categories-nav > ul > li .icon-toggle').click(function(){
$('.categories-nav > ul > li > ol').toggle();
if($('.categories-nav > ul > li > ol').css('display')=='none')
{
$(this).removeClass('toggle-invert');
$(this).parent().removeClass('active');
}else
{
$(this).addClass('toggle-invert');
$(this).parent().addClass('active');
}
})
//Update Playlist Page
updatePlaylistPage();
//reset form on showing modal
$('#create-playlist-modal').on('show', function () {
$('#create-playlist-modal form')[0].reset();
$('#create-playlist-error').hide().html('');
});
//Executing Tootltip
$('.cb-tooltip').tooltip();
});
</script>