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

375 lines
12 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 );
}
}
});
//Groups
amplify.request.define( "groups", "ajax", {
url: ajaxURL+"/groups.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 );
}
}
});
//photos private message
amplify.request.define( "photos", "ajax", {
url: ajaxURL+"/photos.php",
type: "POST",
dataType: "json",
decoder: function( data, status, xhr, success, error ) {
if ( status === "success" ) {
success( data );
} else {
error( data );
}
}
});
//feeds amplify
amplify.request.define( "feeds", "ajax", {
url: ajaxURL+"/feed.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(){
$('.popover-class').popover();
//Adding Comment Hover effect
$('.comments').on('mouseenter','.comment',function(){
$(this).find('.comment-options').show();
});
//Adding Comment Mouse-leave effect
$('.comments').on('mouseleave','.comment',function(){
$(this).find('.comment-options').hide();
});
//Adding Spam comment function
$('.comments').on('click','.spam-comment',function(){
var cid = $(this).attr('data-id');
var type = $(this).attr('data-type');
var typepid = $(this).attr('data-type-id');
spam_comment(cid,type,typepid);
})
//Unspam
$('.comments').on('click','.unspam-comment',function(){
var cid = $(this).attr('data-id');
var type = $(this).attr('data-type');
var typepid = $(this).attr('data-type-id');
unspam_comment(cid,type,typepid);
})
//view hide comment...
$('body').on('click','.view-toggle',function(){
var $toggleobj = $('#'+$(this).attr('data-toggle-id'));
var $toggletext = $(this).attr('data-toggle-text');
$toggleobj.toggle();
//Changing text...
if($toggletext)
{
$(this).attr('data-toggle-text',$(this).text());
$(this).text($toggletext);
}
})
//Init Login Modal box
$('#login-modal').modal({
show : false
});
//Initializing Select/Deselect All function
$('.select_all').click(function(){
$target = $(this).attr('data-target');
$controller = this;
if($(this).is(':checked'))
{
$('.'+$target).attr('checked',true);
}else
{
$('.'+$target).attr('checked',false);
}
//Bind function to the target..
$('.'+$target).click(function(){
$($controller).attr('checked',false);
})
});
//Init Drop Downs
$('.cb-dropdown').dropdown();
$('.cb-tabs-content a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
//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();
// Center image the vertical and horizontal
$('.cbv3-center-image').each( function(index,image){
$( image ).load( function(){
$(this).css({
'position' : 'relative',
'top' : '50%',
'left' : '50%',
'margin-left' : "-"+( $(this).outerWidth()/2 )+"px",
'margin-top' : "-"+( $(this).outerHeight()/2 )+"px"
});
});
});
2012-05-30 14:56:38 +00:00
//Adding sortablities
$('#playlist-manage').sortable({
handle : '.move',
placeholder: "ui-state-highlight",
axis: 'y',
stop : function(event,ui){
var formdata =
$('#playlist-manage-form')
2012-05-30 14:56:38 +00:00
.serialize();
update_manage_playlist_order();
formdata += '&mode=update_playlist_order';
amplify.request('main',formdata,function(data){
if(data.err)
{
displayError(data.err);
}else
{
"...";
2012-05-30 14:56:38 +00:00
}
})
}
});
$('.save-plst-text').click(function(){
$(this).button('loading');
var item_id = $(this).attr('data-id');
var text = $('#'+item_id+'-text').val();
save_playlist_item_note(item_id,text);
})
2012-05-30 14:56:38 +00:00
$('.remove_playlist_item').click(function(){
var title = $(this).attr('data-confirm-title');
var text = $(this).attr('data-confirm-text');
var id = $(this).attr('data-id');
cb_confirm(title,text,function(){
remove_playlist_item(id);
});
})
/**
* Setting up upload buttons
*/
$('.upload_options').on('click','li',function(){
toggle_upload(this);
})
toggle_upload($('.upload_options li:first'));
$('.upload_list_container').on('click','.upload_list',function(){
toggle_upload_list(this);
});
$('.cbv3-scroller').lionbars({
autohide: true
});
2012-09-12 10:00:57 +00:00
$('.playlist-dropdown.open .dropdown-toggle').dropdown('toggle');
$('.selectable-radio').on('click','input[type=radio]',function(){
$('.selectable-radio.active').removeClass('active');
$(this).parent('.selectable-radio').addClass('active');
});
$( '.photo-actions-bar' ).scrollToFixed({
preFixed: function() { $(this).addClass('photo-actions-bar-fixed'); },
postFixed: function() { $(this).removeClass('photo-actions-bar-fixed'); }
});
/*$('.cb-widget-photo-tags').scrollToFixed({
marginTop : 60
});*/
2012-11-27 10:15:44 +00:00
$('.comment-field,.share_feed_modal_text').autosize().shiftenter();
$('.comment-field').bind('textchange', function (event, previousText)
{
var feedID = $(this).attr('data-feed-id');
var text = $(this).val();
//text = nl2br(text);
$('#comment-backend-'+feedID).html(text);
})
2012-11-21 11:54:43 +00:00
$('.post_message_container').on('click','.post_message',function(){
$('.post_options').show();
});
$('.post_message').autosize();
$('#post_options').on('click','#add_new_post',function(){
var type_id = $(this).attr('data-type-id');
var type = $(this).attr('data-type');
var content_id = $('#content_id').val();
var content_type = $('#content_type').val();
add_new_post(type,type_id,content_type,content_id);
});
2012-11-27 10:15:44 +00:00
function updateTime() {
$('.cb_time').each(function(){
var time = $(this).attr('data-time');
$(this).text(prettyDate(time));
})
}
updateTime();
setInterval(updateTime, 5000); // 5 * 1000 miliseconds
$('.feed_target_type').on('click','.feed_target_type a',function()
{
var type = $(this).attr('data-target-type');
genFeedSuggestObj(type);
var parent = $(this).parents('.share_feed_body');
parent.children('.feed_target_selecter').children('.feed_target_text').text($(this).text());
parent.children('.share_feed_modal_form').children('input[name=object_type]').val(type);
})
$('.share_feed_button').click(function(){
console.log('sharing feed..');
var parent = $(this).parents('.share_feed_modal').children('.share_feed_body');
var theForm = parent.children('.share_feed_modal_form');
var obj_type = theForm.children('input[name=object_type]').val();
var obj_id = parent.find('input[name=as_values_feed_suggestion]').val();
var cont_type = theForm.children('input[name=content_type]').val();
var cont_id = theForm.children('input[name=content_id]').val();
var post = theForm.children('textarea[name=share_message]').val();
var action = theForm.children('input[name=action]').val();
add_new_post(obj_type,obj_id,cont_type,cont_id,post,action)
return false;
})
});
2012-05-30 14:56:38 +00:00
2012-11-27 10:15:44 +00:00
</script>