2012-05-19 13:42:45 +00:00
|
|
|
<!-- 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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2012-09-26 11:28:20 +00:00
|
|
|
|
2012-11-05 11:35:42 +00:00
|
|
|
//Groups
|
2012-09-26 11:28:20 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2012-05-22 11:34:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
//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 );
|
|
|
|
}
|
2012-05-19 13:42:45 +00:00
|
|
|
}
|
2012-05-22 11:34:45 +00:00
|
|
|
});
|
|
|
|
|
2012-05-28 07:10:27 +00:00
|
|
|
//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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2012-11-05 11:35:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
//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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2012-05-19 13:42:45 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Working With the Javascript -->
|
|
|
|
|
2012-04-28 20:11:43 +00:00
|
|
|
<script type="text/javascript">
|
2012-06-21 11:22:38 +00:00
|
|
|
|
2012-04-28 20:11:43 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
|
2012-09-01 19:08:08 +00:00
|
|
|
$('.popover-class').popover();
|
2012-08-16 20:10:07 +00:00
|
|
|
//Adding Comment Hover effect
|
2012-06-21 11:22:38 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
$('.comments').on('mouseenter','.comment',function(){
|
|
|
|
$(this).find('.comment-options').show();
|
|
|
|
});
|
2012-04-28 20:11:43 +00:00
|
|
|
|
|
|
|
//Adding Comment Mouse-leave effect
|
2012-08-16 20:10:07 +00:00
|
|
|
$('.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(){
|
2012-06-21 11:22:38 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
var $toggleobj = $('#'+$(this).attr('data-toggle-id'));
|
|
|
|
var $toggletext = $(this).attr('data-toggle-text');
|
2012-06-21 11:22:38 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
$toggleobj.toggle();
|
2012-06-21 11:22:38 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//Changing text...
|
|
|
|
if($toggletext)
|
|
|
|
{
|
|
|
|
$(this).attr('data-toggle-text',$(this).text());
|
|
|
|
$(this).text($toggletext);
|
|
|
|
}
|
2012-06-21 11:22:38 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
})
|
2012-06-21 11:22:38 +00:00
|
|
|
|
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//Init Login Modal box
|
|
|
|
$('#login-modal').modal({
|
|
|
|
show : false
|
|
|
|
});
|
2012-04-28 20:11:43 +00:00
|
|
|
|
2012-05-28 12:51:27 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//Initializing Select/Deselect All function
|
|
|
|
$('.select_all').click(function(){
|
2012-05-28 12:51:27 +00:00
|
|
|
$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);
|
|
|
|
})
|
2012-08-16 20:10:07 +00:00
|
|
|
});
|
2012-05-28 12:51:27 +00:00
|
|
|
|
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//Init Drop Downs
|
|
|
|
$('.cb-dropdown').dropdown();
|
2012-11-05 11:35:42 +00:00
|
|
|
$('.cb-tabs-content a').click(function (e) {
|
2012-09-01 19:08:08 +00:00
|
|
|
e.preventDefault();
|
|
|
|
$(this).tab('show');
|
|
|
|
});
|
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//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();
|
2012-05-19 13:42:45 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
if($('.categories-nav > ul > li > ol').css('display')=='none')
|
|
|
|
{
|
|
|
|
$(this).removeClass('toggle-invert');
|
|
|
|
$(this).parent().removeClass('active');
|
|
|
|
}else
|
2012-05-19 13:42:45 +00:00
|
|
|
{
|
|
|
|
$(this).addClass('toggle-invert');
|
|
|
|
$(this).parent().addClass('active');
|
|
|
|
}
|
2012-08-16 20:10:07 +00:00
|
|
|
})
|
2012-05-23 18:32:45 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//Update Playlist Page
|
|
|
|
updatePlaylistPage();
|
2012-05-23 18:32:45 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//reset form on showing modal
|
|
|
|
$('#create-playlist-modal').on('show', function () {
|
|
|
|
$('#create-playlist-modal form')[0].reset();
|
|
|
|
$('#create-playlist-error').hide().html('');
|
|
|
|
});
|
2012-05-23 18:32:45 +00:00
|
|
|
|
2012-08-16 20:10:07 +00:00
|
|
|
//Executing Tootltip
|
2012-05-25 11:15:58 +00:00
|
|
|
$('.cb-tooltip').tooltip();
|
2012-11-27 11:56:45 +00:00
|
|
|
|
|
|
|
|
2012-11-30 13:17:16 +00:00
|
|
|
// 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-28 12:51:27 +00:00
|
|
|
|
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 =
|
2012-08-16 20:10:07 +00:00
|
|
|
$('#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-08-16 20:10:07 +00:00
|
|
|
"...";
|
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-28 12:51:27 +00:00
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
})
|
2012-08-16 20:10:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
2012-09-01 19:08:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('.cbv3-scroller').lionbars({
|
2012-11-05 11:35:42 +00:00
|
|
|
autohide: true
|
2012-09-01 19:08:08 +00:00
|
|
|
});
|
2012-09-12 10:00:57 +00:00
|
|
|
|
|
|
|
$('.playlist-dropdown.open .dropdown-toggle').dropdown('toggle');
|
|
|
|
|
2012-09-26 11:28:20 +00:00
|
|
|
|
|
|
|
$('.selectable-radio').on('click','input[type=radio]',function(){
|
|
|
|
$('.selectable-radio.active').removeClass('active');
|
|
|
|
$(this).parent('.selectable-radio').addClass('active');
|
2012-11-27 11:56:45 +00:00
|
|
|
});
|
2012-11-05 11:35:42 +00:00
|
|
|
|
2012-11-27 11:56:45 +00:00
|
|
|
$( '.photo-actions-bar' ).scrollToFixed({
|
|
|
|
preFixed: function() { $(this).addClass('photo-actions-bar-fixed'); },
|
|
|
|
postFixed: function() { $(this).removeClass('photo-actions-bar-fixed'); }
|
|
|
|
});
|
2012-11-05 11:35:42 +00:00
|
|
|
|
2012-11-27 11:56:45 +00:00
|
|
|
/*$('.cb-widget-photo-tags').scrollToFixed({
|
|
|
|
marginTop : 60
|
|
|
|
});*/
|
2012-11-05 11:35:42 +00:00
|
|
|
|
2012-11-27 11:56:45 +00:00
|
|
|
|
2012-11-30 13:17:16 +00:00
|
|
|
// $('.comment-field,.share_feed_modal_text').shiftenter();
|
2012-11-05 11:35:42 +00:00
|
|
|
|
2012-11-30 13:17:16 +00:00
|
|
|
/*$('.comment-field').bind('textchange', function (event, previousText)
|
2012-11-05 11:35:42 +00:00
|
|
|
{
|
|
|
|
var feedID = $(this).attr('data-feed-id');
|
|
|
|
var text = $(this).val();
|
|
|
|
//text = nl2br(text);
|
|
|
|
$('#comment-backend-'+feedID).html(text);
|
2012-11-30 13:17:16 +00:00
|
|
|
})*/
|
2012-11-05 11:35:42 +00:00
|
|
|
|
2012-11-21 11:54:43 +00:00
|
|
|
|
|
|
|
$('.post_message_container').on('click','.post_message',function(){
|
|
|
|
$('.post_options').show();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.post_message').autosize();
|
2012-11-30 13:17:16 +00:00
|
|
|
$('.comment-field').autosize().shiftenter();
|
2012-11-21 11:54:43 +00:00
|
|
|
|
|
|
|
$('#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();
|
|
|
|
|
2012-11-30 13:17:16 +00:00
|
|
|
var post_message = $('#post_message');
|
|
|
|
var post_val = '';
|
|
|
|
if(post_message.hasClass('mention'))
|
|
|
|
{
|
|
|
|
post_message.mentionsInput('val', function(text) {
|
|
|
|
post_val = text;
|
|
|
|
});
|
|
|
|
}else
|
|
|
|
post_val = post_message.val();
|
|
|
|
|
|
|
|
add_new_post(post_val,type,type_id,content_type,content_id);
|
2012-11-21 11:54:43 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
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();
|
2012-11-30 13:17:16 +00:00
|
|
|
var post = theForm.find('textarea[name=share_message]');
|
|
|
|
|
|
|
|
var post_val = '';
|
|
|
|
|
|
|
|
if(post.hasClass('mention'))
|
|
|
|
{
|
|
|
|
post.mentionsInput('val', function(text) {
|
|
|
|
post_val = text;
|
|
|
|
});
|
|
|
|
}else
|
|
|
|
post_val = post.val();
|
|
|
|
|
2012-11-27 10:15:44 +00:00
|
|
|
var action = theForm.children('input[name=action]').val();
|
2012-11-30 13:17:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
add_new_post(post_val,obj_type,obj_id,cont_type,cont_id,action)
|
2012-11-27 10:15:44 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
})
|
2012-11-30 13:17:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('textarea.mention').mentionsInput({
|
|
|
|
onDataRequest:function (mode, query, callback) {
|
|
|
|
$.getJSON(baseurl+'/ajax/items.php?mode=mentions', function(responseData) {
|
|
|
|
responseData = _.filter(responseData, function(item) { return item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
|
|
|
|
callback.call(this, responseData);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
elastic : false
|
|
|
|
});
|
2012-12-10 10:51:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb_khabri();
|
|
|
|
setInterval(function(){
|
|
|
|
cb_khabri();
|
|
|
|
}, 60000);
|
2012-11-30 13:17:16 +00:00
|
|
|
|
2012-04-28 20:11:43 +00:00
|
|
|
});
|
2012-05-30 14:56:38 +00:00
|
|
|
|
2012-11-05 11:35:42 +00:00
|
|
|
|
2012-11-27 10:15:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-05 11:35:42 +00:00
|
|
|
|
|
|
|
|
2012-04-28 20:11:43 +00:00
|
|
|
</script>
|