try again
This commit is contained in:
@ -1,153 +0,0 @@
|
||||
/**
|
||||
* Open Source Social Network
|
||||
*
|
||||
* @packageOpen Source Social Network
|
||||
* @author Open Social Website Core Team <info@informatikon.com>
|
||||
* @copyright 2014 iNFORMATIKON TECHNOLOGIES
|
||||
* @license General Public Licence http://www.opensource-socialnetwork.org/licence
|
||||
* @link http://www.opensource-socialnetwork.org/licence
|
||||
*/
|
||||
Ossn.ViewLikes = function($post, $type) {
|
||||
if (!$type) {
|
||||
$type = 'post';
|
||||
}
|
||||
Ossn.MessageBox('likes/view?guid=' + $post + '&type=' + $type);
|
||||
};
|
||||
|
||||
Ossn.PostUnlike = function(post) {
|
||||
Ossn.PostRequest({
|
||||
url: Ossn.site_url + 'action/post/unlike',
|
||||
beforeSend: function() {
|
||||
$('#ossn-like-' + post).html('<img src="' + Ossn.site_url + 'components/OssnComments/images/loading.gif" />');
|
||||
},
|
||||
params: '&post=' + post,
|
||||
callback: function(callback) {
|
||||
if (callback['done'] !== 0) {
|
||||
$('#ossn-like-' + post).html(callback['button']);
|
||||
$('#ossn-like-' + post).attr('onclick', 'Ossn.PostLike(' + post + ');');
|
||||
} else {
|
||||
$('#ossn-like-' + post).html(Ossn.Print('unlike'));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
};
|
||||
Ossn.PostLike = function(post) {
|
||||
Ossn.PostRequest({
|
||||
url: Ossn.site_url + 'action/post/like',
|
||||
beforeSend: function() {
|
||||
$('#ossn-like-' + post).html('<img src="' + Ossn.site_url + 'components/OssnComments/images/loading.gif" />');
|
||||
},
|
||||
params: '&post=' + post,
|
||||
callback: function(callback) {
|
||||
if (callback['done'] !== 0) {
|
||||
$('#ossn-like-' + post).html(callback['button']);
|
||||
$('#ossn-like-' + post).attr('onClick', 'Ossn.PostUnlike(' + post + ');');
|
||||
} else {
|
||||
$('#ossn-like-' + post).html(Ossn.Print('like'));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Ossn.EntityUnlike = function(entity) {
|
||||
Ossn.PostRequest({
|
||||
url: Ossn.site_url + 'action/post/unlike',
|
||||
beforeSend: function() {
|
||||
$('#ossn-like-' + entity).html('<img src="' + Ossn.site_url + 'components/OssnComments/images/loading.gif" />');
|
||||
},
|
||||
params: '&entity=' + entity,
|
||||
callback: function(callback) {
|
||||
if (callback['done'] !== 0) {
|
||||
$('#ossn-like-' + entity).html(callback['button']);
|
||||
$('#ossn-like-' + entity).attr('onclick', 'Ossn.EntityLike(' + entity + ');');
|
||||
} else {
|
||||
$('#ossn-like-' + entity).html(Ossn.Print('unlike'));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
};
|
||||
Ossn.EntityLike = function(entity) {
|
||||
Ossn.PostRequest({
|
||||
url: Ossn.site_url + 'action/post/like',
|
||||
beforeSend: function() {
|
||||
$('#ossn-like-' + entity).html('<img src="' + Ossn.site_url + 'components/OssnComments/images/loading.gif" />');
|
||||
},
|
||||
params: '&entity=' + entity,
|
||||
callback: function(callback) {
|
||||
if (callback['done'] !== 0) {
|
||||
$('#ossn-like-' + entity).html(callback['button']);
|
||||
$('#ossn-like-' + entity).attr('onClick', 'Ossn.EntityUnlike(' + entity + ');');
|
||||
} else {
|
||||
$('#ossn-like-' + post).html(Ossn.Print('like'));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
};
|
||||
Ossn.RegisterStartupFunction(function() {
|
||||
$(document).ready(function() {
|
||||
$(document).delegate('.ossn-like-comment', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
var $item = $(this);
|
||||
var $type = $.trim($item.attr('data-type'));
|
||||
var $url = $item.attr('href');
|
||||
Ossn.PostRequest({
|
||||
url: $url,
|
||||
action: false,
|
||||
beforeSend: function() {
|
||||
$item.html('<img src="' + Ossn.site_url + 'components/OssnComments/images/loading.gif" />');
|
||||
},
|
||||
callback: function(callback) {
|
||||
if (callback['done'] == 1) {
|
||||
$total_guid = Ossn.UrlParams('annotation', $url);
|
||||
$total = $('.ossn-total-likes-' + $total_guid).attr('data-likes');
|
||||
if ($type == 'Like') {
|
||||
$item.html(Ossn.Print('unlike'));
|
||||
$item.attr('data-type', 'Unlike');
|
||||
var unlike = $url.replace("like", "unlike");
|
||||
$item.attr('href', unlike);
|
||||
$total_likes = $total;
|
||||
$total_likes++;
|
||||
$('.ossn-total-likes-' + $total_guid).attr('data-likes', $total_likes);
|
||||
$('.ossn-total-likes-' + $total_guid).html('<i class="fa fa-thumbs-up"></i>' + $total_likes);
|
||||
}
|
||||
if ($type == 'Unlike') {
|
||||
$item.html(Ossn.Print('like'));
|
||||
$item.attr('data-type', 'Like');
|
||||
var like = $url.replace("unlike", "like");
|
||||
$item.attr('href', like);
|
||||
if ($total > 1) {
|
||||
$like_remove = $total;
|
||||
0
|
||||
$like_remove--;
|
||||
$('.ossn-total-likes-' + $total_guid).attr('data-likes', $like_remove);
|
||||
$('.ossn-total-likes-' + $total_guid).html('<i class="fa fa-thumbs-up"></i>' + $like_remove);
|
||||
}
|
||||
if ($total == 1) {
|
||||
$('.ossn-total-likes-' + $total_guid).attr('data-likes', 0);
|
||||
$('.ossn-total-likes-' + $total_guid).html('');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (callback['done'] == 0) {
|
||||
if ($type == 'Like') {
|
||||
$item.html(Ossn.Print('like'));
|
||||
$item.attr('data-type', 'Like');
|
||||
Ossn.MessageBox('syserror/unknown');
|
||||
}
|
||||
if ($type == 'Unlike') {
|
||||
$item.html(Ossn.Print('unlike'));
|
||||
$item.attr('data-type', 'Unlike');
|
||||
Ossn.MessageBox('syserror/unknown');
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@ -1,19 +1,49 @@
|
||||
//<script>
|
||||
$(document).ready(function() {
|
||||
$(document).on('click', '#sidebar-toggle', function() {
|
||||
var $toggle = $(this).attr('data-toggle');
|
||||
if ($toggle == 0) {
|
||||
$(this).attr('data-toggle', 1);
|
||||
$('.sidebar').addClass('sidebar-open');
|
||||
$('.ossn-page-container').addClass('sidebar-open-page-container');
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
placement:'left',
|
||||
});
|
||||
//duplicate tooltips in opened left menu #5
|
||||
$('.sidebar [data-toggle="collapse"]').each(function(){
|
||||
$text = $(this).text();
|
||||
$(this).attr('title', $text);
|
||||
$(this).tooltip();
|
||||
});
|
||||
$('.sidebar .sub-menu a').each(function(){
|
||||
$href = $(this).attr('href');
|
||||
$text = $(this).text();
|
||||
$(this).parent().attr('title', $text);
|
||||
//Sidebar links isn't working as its not actually type of 'a' #4
|
||||
$(this).parent().attr('data-href-flexi', $href);
|
||||
$(this).parent().tooltip();
|
||||
});
|
||||
//same as $FlexiSidebarToggle only revert toogle == 0, toogel = 1 (if)
|
||||
$FlexiSidebarToggleRotate = function(){
|
||||
var $toggle = $('#sidebar-toggle').attr('data-toggle');
|
||||
if ($toggle == 1) {
|
||||
$('#sidebar-toggle').attr('data-toggle', 1);
|
||||
$('[data-toggle="tooltip"]').tooltip('enable');
|
||||
if($(document).innerWidth() >= 1300 && $('.ossn-page-loading-annimation').is(':visible')){
|
||||
$('.sidebar').addClass('sidebar-open-no-annimation');
|
||||
$('.ossn-page-container').addClass('sidebar-open-page-container-no-annimation');
|
||||
} else {
|
||||
$('.sidebar').addClass('sidebar-open');
|
||||
$('.sidebar').removeClass('sidebar-close');
|
||||
$('.ossn-page-container').addClass('sidebar-open-page-container');
|
||||
}
|
||||
$('.topbar .right-side').addClass('right-side-space');
|
||||
$('.topbar .right-side').addClass('sidebar-hide-contents-xs');
|
||||
$('.ossn-inner-page').addClass('sidebar-hide-contents-xs');
|
||||
}
|
||||
if ($toggle == 1) {
|
||||
$(this).attr('data-toggle', 0);
|
||||
if ($toggle == 0) {
|
||||
$('#sidebar-toggle').attr('data-toggle', 0);
|
||||
$('[data-toggle="tooltip"]').tooltip('disable');
|
||||
|
||||
$('.sidebar').removeClass('sidebar-open');
|
||||
$('.sidebar').removeClass('sidebar-open-no-annimation');
|
||||
|
||||
$('.ossn-page-container').removeClass('sidebar-open-page-container');
|
||||
$('.ossn-page-container').removeClass('sidebar-open-page-container-no-annimation');
|
||||
$('.topbar .right-side').removeClass('right-side-space');
|
||||
$('.topbar .right-side').removeClass('sidebar-hide-contents-xs');
|
||||
$('.ossn-inner-page').removeClass('sidebar-hide-contents-xs');
|
||||
@ -21,16 +51,64 @@ $(document).ready(function() {
|
||||
$('.topbar .right-side').addClass('right-side-nospace');
|
||||
$('.sidebar').addClass('sidebar-close');
|
||||
$('.ossn-page-container').addClass('sidebar-close-page-container');
|
||||
|
||||
}
|
||||
var document_height = $(document).height();
|
||||
$(".sidebar").height(document_height);
|
||||
};
|
||||
$FlexiSidebarToggleRotate();
|
||||
|
||||
$FlexiSidebarToggle = function(){
|
||||
var $toggle = $('#sidebar-toggle').attr('data-toggle');
|
||||
if ($toggle == 0) {
|
||||
$('#sidebar-toggle').attr('data-toggle', 1);
|
||||
$('[data-toggle="tooltip"]').tooltip('enable');
|
||||
|
||||
if($(document).innerWidth() >= 1300 && $('.ossn-page-loading-annimation').is(':visible')){
|
||||
$('.sidebar').addClass('sidebar-open-no-annimation');
|
||||
$('.ossn-page-container').addClass('sidebar-open-page-container-no-annimation');
|
||||
} else {
|
||||
$('.sidebar').addClass('sidebar-open');
|
||||
$('.sidebar').removeClass('sidebar-close');
|
||||
$('.ossn-page-container').addClass('sidebar-open-page-container');
|
||||
}
|
||||
$('.topbar .right-side').addClass('right-side-space');
|
||||
$('.topbar .right-side').addClass('sidebar-hide-contents-xs');
|
||||
$('.ossn-inner-page').addClass('sidebar-hide-contents-xs');
|
||||
}
|
||||
if ($toggle == 1) {
|
||||
$('[data-toggle="tooltip"]').tooltip('disable');
|
||||
$('#sidebar-toggle').attr('data-toggle', 0);
|
||||
|
||||
$('.sidebar').removeClass('sidebar-open');
|
||||
$('.sidebar').removeClass('sidebar-open-no-annimation');
|
||||
|
||||
$('.ossn-page-container').removeClass('sidebar-open-page-container');
|
||||
$('.ossn-page-container').removeClass('sidebar-open-page-container-no-annimation');
|
||||
$('.topbar .right-side').removeClass('right-side-space');
|
||||
$('.topbar .right-side').removeClass('sidebar-hide-contents-xs');
|
||||
$('.ossn-inner-page').removeClass('sidebar-hide-contents-xs');
|
||||
|
||||
$('.topbar .right-side').addClass('right-side-nospace');
|
||||
$('.sidebar').addClass('sidebar-close');
|
||||
$('.ossn-page-container').addClass('sidebar-close-page-container');
|
||||
}
|
||||
var document_height = $(document).height();
|
||||
$(".sidebar").height(document_height);
|
||||
};
|
||||
$(window).on('orientationchange', function(){
|
||||
$FlexiSidebarToggleRotate();
|
||||
});
|
||||
$(document).on('click', '#sidebar-toggle', function(){
|
||||
$FlexiSidebarToggle();
|
||||
});
|
||||
var $chatsidebar = $('.ossn-chat-windows-long .inner');
|
||||
if($chatsidebar.length){
|
||||
$chatsidebar.css('height', $(window).height() - 45);
|
||||
}
|
||||
$(document).scroll(function() {
|
||||
$document_height = $(document).height();
|
||||
$(".sidebar").height($document_height);
|
||||
|
||||
if($chatsidebar.length){
|
||||
if ($(document).scrollTop() >= 50) {
|
||||
$chatsidebar.addClass('ossnchat-scroll-top');
|
||||
@ -41,4 +119,22 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
if($(document).innerWidth() >= 1300){
|
||||
$('#sidebar-toggle').click();
|
||||
$('#sidebar-toggle').click();
|
||||
}
|
||||
//Sidebar links isn't working as its not actually type of 'a' #4
|
||||
$("body").on('click', '.sidebar-menu .menu-content .sub-menu li', function(e){
|
||||
e.stopPropagation();
|
||||
$data = $(this).attr('data-href-flexi');
|
||||
if(e.target !== e.currentTarget) return;
|
||||
if($data == 'javascript:void(0);'){
|
||||
$(this).find('a').click();
|
||||
} else {
|
||||
window.location = $data;
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$(".ossn-page-loading-annimation").fadeOut("slow");
|
||||
});
|
||||
|
Reference in New Issue
Block a user