2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.spoiler', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
$(this).toggle();
|
|
|
|
$(this).next('div').toggle();
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.blur', function (e) {
|
2020-04-01 00:46:27 +00:00
|
|
|
e.stopPropagation();
|
|
|
|
$(this).prev().toggle();
|
|
|
|
$(this).toggle();
|
|
|
|
$(this).next('a').toggle();
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.toggleblur', function (e) {
|
2020-04-01 00:46:27 +00:00
|
|
|
e.stopPropagation();
|
|
|
|
$(this).toggle();
|
|
|
|
$(this).next('a').next('a').toggle();
|
|
|
|
$(this).next('a').toggle();
|
|
|
|
});
|
2020-04-10 01:16:32 +00:00
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '#emoji', function (e) {
|
2020-06-02 22:37:50 +00:00
|
|
|
$(this).closest(".element").find('.picker').toggle();
|
2020-05-14 01:06:55 +00:00
|
|
|
$('#emojisearch').focus();
|
2020-04-10 01:16:32 +00:00
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '#contact', function (e) {
|
2020-06-02 22:37:50 +00:00
|
|
|
$(this).closest(".element").find('.contactpicker').toggle();
|
2020-05-14 01:06:55 +00:00
|
|
|
$('#contactsearch').focus();
|
2020-05-13 20:26:38 +00:00
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.emoji', function (e) {
|
2020-04-10 01:16:32 +00:00
|
|
|
var code = $(this).attr("title");
|
|
|
|
console.log(code);
|
|
|
|
boxtxt = $(this).closest(".element").find("#status").val();
|
2022-01-13 05:09:24 +00:00
|
|
|
$(this).closest(".element").find("#status").val(boxtxt + ":" + code + ":");
|
2020-04-10 01:16:32 +00:00
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.contact', function (e) {
|
2020-05-13 20:26:38 +00:00
|
|
|
var code = $(this).attr("title");
|
|
|
|
console.log(code);
|
|
|
|
boxtxt = $(this).closest(".element").find("#status").val();
|
2022-01-13 05:09:24 +00:00
|
|
|
$(this).closest(".element").find("#status").val(boxtxt + code + " ");
|
2020-05-13 20:26:38 +00:00
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$(document).on("change paste keyup", "#emojisearch", function () {
|
|
|
|
var val = $(this).val();
|
|
|
|
var list = $(this).closest('.element').find('.emojilist');
|
|
|
|
console.log(val);
|
|
|
|
$.get("action.php?a=true&emoji=" + val, function (data) {
|
2020-04-10 01:16:32 +00:00
|
|
|
list.html(data);
|
|
|
|
});
|
|
|
|
});
|
2020-04-01 00:46:27 +00:00
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$(document).on("change paste keyup", "#contactsearch", function () {
|
|
|
|
var val = $(this).val();
|
|
|
|
var list = $(this).closest('.element').find('.contactlist');
|
|
|
|
console.log(val);
|
|
|
|
$.get("action.php?a=true&contact=" + val, function (data) {
|
2020-05-13 20:26:38 +00:00
|
|
|
list.html(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
// Open Lightbox
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.open-lightbox', function (e) {
|
2020-04-01 00:46:27 +00:00
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
var image = $(this).attr('href');
|
|
|
|
$('html').addClass('no-scroll');
|
|
|
|
$('body').append('<div class="lightbox-opened"><img style="max-height:100%; max-width:100%;" src="' + image + '"></div>');
|
|
|
|
});
|
|
|
|
|
|
|
|
// Close Lightbox
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.lightbox-opened', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('html').removeClass('no-scroll');
|
|
|
|
$('.lightbox-opened').remove();
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
window.addEventListener("scroll", function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
onScrollDiv()
|
|
|
|
});
|
2022-01-13 05:09:24 +00:00
|
|
|
window.addEventListener("DOMContentLoaded", function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
onScrollDiv()
|
|
|
|
});
|
|
|
|
|
|
|
|
function onScrollDiv() {
|
|
|
|
var images = document.querySelectorAll('.lazyload');
|
|
|
|
for (var i = 0, nb = images.length; i < nb; i++) {
|
|
|
|
var img = images[i]
|
|
|
|
var rect = img.getBoundingClientRect();
|
|
|
|
var isVisible = ((rect.top - window.innerHeight) < 500 && (rect.bottom) > -50) ? true : false;
|
|
|
|
|
|
|
|
if (isVisible) {
|
|
|
|
if (!img.src) {
|
|
|
|
img.src = img.dataset.src;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.replies', function (e) {
|
2020-04-01 00:46:27 +00:00
|
|
|
e.preventDefault;
|
|
|
|
$(".reply").remove();
|
|
|
|
$(".element").removeClass("element_pad");
|
|
|
|
$(this).closest(".element").addClass("element_pad");
|
|
|
|
/*$('.replies_container').html('');*/
|
|
|
|
var id = $(this).parent().parent().attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
if ($('#' + id + '.replies_container').find('.reply').length < 1) {
|
|
|
|
$('#' + id + '.replies_container').html("<p><img src='img/loading.gif'></p>");
|
2020-04-01 00:46:27 +00:00
|
|
|
}
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&replies=" + id, function (data) {
|
|
|
|
$('#' + id + '.replies_container').html(data);
|
|
|
|
$('#' + id + '.replies_container').delay(800).fadeIn(400);
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#a' + id).html('');
|
2022-01-13 05:09:24 +00:00
|
|
|
$('#' + id + ".replies_container .ancestor").appendTo('#a' + id);
|
2020-04-01 00:46:27 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$.fn.isOnScreen = function () {
|
2020-05-20 19:53:33 +00:00
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
var win = $(window);
|
2020-05-20 19:53:33 +00:00
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
var viewport = {
|
|
|
|
top: win.scrollTop(),
|
|
|
|
left: win.scrollLeft()
|
|
|
|
};
|
|
|
|
viewport.right = viewport.left + win.width();
|
|
|
|
viewport.bottom = viewport.top + win.height();
|
2020-05-20 19:53:33 +00:00
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
var bounds = this.offset();
|
|
|
|
bounds.right = bounds.left + this.outerWidth();
|
|
|
|
bounds.bottom = bounds.top + this.outerHeight();
|
2020-05-20 19:53:33 +00:00
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
|
2020-05-20 19:53:33 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
$('body').on('click', '.postbody:not(a)', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
$(".reply").remove();
|
|
|
|
$(".element").removeClass("element_pad");
|
|
|
|
$(this).closest(".element").addClass("element_pad");
|
|
|
|
//$('.replies_container').html('');
|
|
|
|
var id = $(this).closest(".post").attr('id');
|
|
|
|
if($('#' + id+'.replies_container').find('.reply').length < 1){
|
|
|
|
$('#' + id+'.replies_container').html("<p><img src='img/loading.gif'></p>");
|
|
|
|
}
|
|
|
|
$.get("action.php?a=true&replies=" + id, function(data) {
|
|
|
|
$('#' + id+'.replies_container').html(data);
|
|
|
|
$('#' + id+'.replies_container').delay(800).fadeIn(400);
|
|
|
|
$('#a' + id).html('');
|
|
|
|
$('#' + id+".replies_container .ancestor").appendTo('#a' + id);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
$('body').on('click', '.postbody:not(a)', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
$(".reply").remove();
|
|
|
|
$(".element").removeClass("element_pad");
|
|
|
|
$(this).closest(".element").addClass("element_pad");
|
|
|
|
var id = $(this).closest(".post").attr('id');
|
|
|
|
var offset = $('#'+id+' .postHeader').offset().top + 200;
|
|
|
|
if($('#' + id+'.replies_container').find('.reply').length < 1){
|
|
|
|
$('#' + id+'.replies_container').html("<p><img src='img/loading.gif'></p>");
|
|
|
|
}
|
|
|
|
$.get("action.php?a=true&replies=" + id, function(data) {
|
|
|
|
$('#' + id+'.replies_container').html(data);
|
|
|
|
$('#' + id+'.replies_container').delay(800).fadeIn(400);
|
|
|
|
$('#a' + id).html('');
|
|
|
|
$.when($('#' + id+".replies_container .ancestor").appendTo('#a' + id)).then(function() {
|
|
|
|
if ($('#'+id+'.post_buttons').isOnScreen() == false) {
|
|
|
|
$('html, body').animate({
|
|
|
|
scrollTop: offset
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.ldr:not(.tlicon)', function (e) {
|
|
|
|
$('.tlicon').each(function (a) {
|
|
|
|
$(this).removeClass('tiselected')
|
|
|
|
});
|
2020-04-01 00:46:27 +00:00
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.ldr', function (e) {
|
2020-04-01 00:46:27 +00:00
|
|
|
e.preventDefault();
|
2020-04-13 16:30:51 +00:00
|
|
|
location.hash = "#top";
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#loader').html('');
|
|
|
|
$('#loaded').remove();
|
|
|
|
var url = $(this).attr('href');
|
2020-04-13 16:30:51 +00:00
|
|
|
var id = $(this).attr('id');
|
2020-04-01 00:46:27 +00:00
|
|
|
localStorage.setItem("content", $('#content .element').detach());
|
2020-04-29 17:29:25 +00:00
|
|
|
$('#content').html('<center><div class="loadingImage"></div></center>');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get(url + "&ajax=1", function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#content').html(data);
|
|
|
|
history.pushState({}, "Dashboard FE", url);
|
|
|
|
var thread = getUrlParameter('thread');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-04-29 17:29:25 +00:00
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.gotop a', function (e) {
|
2020-04-01 00:46:27 +00:00
|
|
|
e.preventDefault();
|
|
|
|
$('html, body').animate({
|
|
|
|
scrollTop: 0
|
|
|
|
}, 800);
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.topbar:not(a)', function (e) {
|
|
|
|
if (e.target !== e.currentTarget) return;
|
2020-05-06 16:48:21 +00:00
|
|
|
e.preventDefault();
|
|
|
|
$('html, body').animate({
|
|
|
|
scrollTop: 0
|
|
|
|
}, 800);
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '#loader', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var cnt = $("#loaded").contents();
|
|
|
|
// $("#content").prepend(cnt);
|
|
|
|
$('#content').find('.element').first().after(cnt);
|
|
|
|
$("#loaded").remove();
|
|
|
|
$("#loader").html('');
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.nsfw', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&nsfw=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
if (data == '1') {
|
|
|
|
$('#' + id + '.nsfw').toggleClass('nsfw unnsfw');
|
|
|
|
$('#' + id + '.unnsfw').html('NSFW <span class="fontello"></span>');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.unnsfw', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&nsfw=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
if (data == '1') {
|
|
|
|
$('#' + id + '.unnsfw').toggleClass('unnsfw nsfw');
|
|
|
|
$('#' + id + '.nsfw').html('NSFW <span class="fontello"></span>');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.block', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=true&block=" + id, function (data) {
|
|
|
|
|
|
|
|
$('#' + id + '.block').removeClass('block').addClass('unblock');
|
|
|
|
$('#' + id + '.unblock').html('Unblock');
|
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.unblock', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=off&block=" + id, function (data) {
|
|
|
|
|
|
|
|
$('#' + id + '.unblock').removeClass('unblock').addClass('block');
|
|
|
|
$('#' + id + '.block').html('Block');
|
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.autl', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
|
|
|
var list = $(this).attr('list');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=true&user=" + id + "&list=" + list, function (data) {
|
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.autl').removeClass('autl').addClass('rutl');
|
|
|
|
/* $('#' + id + '.rutl li').html('Added'); */
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.rutl', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var elem = $(this);
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
var list = $(this).attr('list');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=off&user=" + id + "&list=" + list, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.rutl').removeClass('rutl').addClass('autl');
|
|
|
|
/* $(elem).find('li').html('Removed');*/
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.hide', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=true&hide=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.hide').removeClass('hide').addClass('unhide');
|
|
|
|
$('#' + id + '.unhide').html('Unhide Thread');
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.unhide', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=off&hide=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.unhide').removeClass('unhide').addClass('hide');
|
|
|
|
$('#' + id + '.hide').html('Hide Thread');
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.bookmark', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=true&bookmark=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.bookmark').removeClass('bookmark').addClass('unbookmark');
|
|
|
|
$('#' + id + '.unbookmark').html('Unbookmark');
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.unbookmark', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&mode=off&bookmark=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.unbookmark').removeClass('unbookmark').addClass('bookmark');
|
|
|
|
$('#' + id + '.bookmark').html('Bookmark');
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.follow', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&follow=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
console.log(data);
|
|
|
|
if (data == '1') {
|
|
|
|
$('#' + id + '.follow').removeClass('follow').addClass('unfollow');
|
|
|
|
$('#' + id + '.unfollow').html('<span class=\'fontello\'></span> Following');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.unfollow', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("action.php?a=true&unfollow=" + id, function (data) {
|
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
if (data == '1') {
|
|
|
|
$('#' + id + '.unfollow').removeClass('unfollow').addClass('follow');
|
|
|
|
$('#' + id + '.follow').html('Follow');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('.container').on('mouseenter', '.user', function (event) {
|
2020-04-01 00:46:27 +00:00
|
|
|
event.stopPropagation();
|
2022-01-13 05:09:24 +00:00
|
|
|
event.stopImmediatePropagation();
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
|
|
|
console.log(id);
|
|
|
|
$(this).append("<div class='userinfo' id='" + id + "'><img src='loading.gif'></div>");
|
2022-01-13 05:09:24 +00:00
|
|
|
$.when($.get("action.php?a=true&userinfo=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.userinfo').html(data);
|
2022-01-13 05:09:24 +00:00
|
|
|
})).then(function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.userinfo').fadeIn();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('.container').on('mouseleave', '.user', function (event) {
|
2020-04-01 00:46:27 +00:00
|
|
|
event.stopPropagation();
|
2022-01-13 05:09:24 +00:00
|
|
|
event.stopImmediatePropagation();
|
|
|
|
$(this).find('.userinfo').fadeOut(300, function () { $(this).remove(); });
|
2020-04-01 00:46:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('.container').on('mouseenter', '.preview', function (event) {
|
2020-04-01 00:46:27 +00:00
|
|
|
event.stopPropagation();
|
2022-01-13 05:09:24 +00:00
|
|
|
event.stopImmediatePropagation();
|
2020-04-01 00:46:27 +00:00
|
|
|
var id = $(this).attr('id');
|
|
|
|
console.log(id);
|
|
|
|
$(this).before("<div class='notif previewpost' id='" + id + "'></div>");
|
2022-01-13 05:09:24 +00:00
|
|
|
$.when($.get("action.php?a=true&previewpost=" + id, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.previewpost').html(data);
|
2022-01-13 05:09:24 +00:00
|
|
|
})).then(function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#' + id + '.previewpost').fadeIn();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('.container').on('mouseleave', '.preview', function (event) {
|
2020-04-01 00:46:27 +00:00
|
|
|
event.stopPropagation();
|
2022-01-13 05:09:24 +00:00
|
|
|
event.stopImmediatePropagation();
|
|
|
|
$('.container').find('.previewpost').fadeOut(300, function () { $(this).remove(); });
|
2020-04-01 00:46:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
var getUrlParameter = function getUrlParameter(sParam) {
|
|
|
|
var sPageURL = window.location.search.substring(1),
|
|
|
|
sURLVariables = sPageURL.split('&'),
|
|
|
|
sParameterName,
|
|
|
|
i;
|
|
|
|
|
|
|
|
for (i = 0; i < sURLVariables.length; i++) {
|
|
|
|
sParameterName = sURLVariables[i].split('=');
|
|
|
|
|
|
|
|
if (sParameterName[0] === sParam) {
|
|
|
|
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
function getMode() {
|
|
|
|
if (typeof getUrlParameter('user') !== 'undefined') {
|
|
|
|
console.log('list');
|
|
|
|
return "&user=" + getUrlParameter('user');
|
|
|
|
}
|
|
|
|
if (typeof getUrlParameter('list') !== 'undefined') {
|
|
|
|
console.log('list');
|
|
|
|
return "&list=" + getUrlParameter('list');
|
|
|
|
}
|
|
|
|
if (typeof getUrlParameter('mode') !== 'undefined') {
|
|
|
|
console.log('mode');
|
|
|
|
return "&mode=" + getUrlParameter('mode');
|
|
|
|
}
|
|
|
|
if (typeof getUrlParameter('tag') !== 'undefined') {
|
|
|
|
console.log('tag');
|
|
|
|
return "&tag=" + getUrlParameter('tag');
|
|
|
|
}
|
2020-04-13 16:30:51 +00:00
|
|
|
if (typeof getUrlParameter('search') !== 'undefined') {
|
|
|
|
console.log('tag');
|
|
|
|
return "&search=" + getUrlParameter('search');
|
|
|
|
}
|
2020-04-01 00:46:27 +00:00
|
|
|
return "&mode=federated";
|
|
|
|
};
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
function loadmore() {
|
2020-04-01 00:46:27 +00:00
|
|
|
var thread = getUrlParameter('thread');
|
|
|
|
if (typeof thread !== 'undefined') {
|
|
|
|
return false;
|
|
|
|
}
|
2020-04-13 16:30:51 +00:00
|
|
|
if (typeof getUrlParameter('search') !== 'undefined') {
|
|
|
|
return false;
|
|
|
|
}
|
2020-04-01 00:46:27 +00:00
|
|
|
var thread = getUrlParameter('thread');
|
|
|
|
if (typeof thread === 'undefined') {
|
|
|
|
var error = $(".error").length;
|
|
|
|
if (error < 1) {
|
|
|
|
pageMode = getMode();
|
|
|
|
var id = $('.post').last().attr('pid');
|
|
|
|
$('.loadmore').html("<img src='img/loading.gif'>")
|
2022-01-13 05:09:24 +00:00
|
|
|
$.get("index.php?ajax=1&next=" + id + "" + pageMode, function (data) {
|
2020-04-01 00:46:27 +00:00
|
|
|
$('.loadmore').parent().before(data);
|
|
|
|
$('.loadmore').html("Load More Posts")
|
|
|
|
/*$('.loadmore').parent().detach();
|
|
|
|
$('#content').append(data);
|
|
|
|
$('.loadmore').parent().appendTo('#content');
|
|
|
|
*/
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$(window).scroll(function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
|
|
|
|
loadmore();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
$('body').on('click', '.loadmore', function () {
|
2020-04-01 00:46:27 +00:00
|
|
|
loadmore();
|
|
|
|
});
|
|
|
|
|
|
|
|
function newPosts() {
|
2022-01-13 05:09:24 +00:00
|
|
|
|
2021-03-27 18:04:26 +00:00
|
|
|
var url = window.location.href;
|
2022-01-13 05:09:24 +00:00
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
var thread = getUrlParameter('thread');
|
|
|
|
if (typeof thread !== 'undefined') {
|
|
|
|
return false;
|
|
|
|
}
|
2020-04-13 16:30:51 +00:00
|
|
|
var search = getUrlParameter('search');
|
|
|
|
if (typeof search !== 'undefined') {
|
|
|
|
return false;
|
|
|
|
}
|
2020-04-01 00:46:27 +00:00
|
|
|
var error = $(".error").length;
|
|
|
|
if (error >= 1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
var id = $(".post").first().attr('pid');
|
|
|
|
pageMode = getMode();
|
|
|
|
if (getUrlParameter('mode') == 'bookmarks') {
|
|
|
|
return false;
|
|
|
|
}
|
2021-03-27 18:01:13 +00:00
|
|
|
var page = getUrlParameter('page');
|
|
|
|
if (typeof page !== 'undefined') {
|
|
|
|
return false;
|
|
|
|
}
|
2022-01-13 05:09:24 +00:00
|
|
|
|
|
|
|
$.get("index.php?ajax=1&since=" + id + "" + pageMode, function (data) {
|
|
|
|
|
|
|
|
if (window.location.href !== url) {
|
2021-03-27 18:04:26 +00:00
|
|
|
return false;
|
|
|
|
}
|
2022-01-13 05:09:24 +00:00
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
if (data) {
|
|
|
|
var scroll = $(window).scrollTop();
|
|
|
|
if (scroll > 1000) {
|
2022-01-13 05:09:24 +00:00
|
|
|
$('#loader').html("<div class='avatar' style='height:0px;'></div><div class='loader' style='display:table-cell; height:50px; line-height:50px;'><a class='link' style='margin:5px;' href='#'>Load Newer Posts</a></div>");
|
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
if ($('#loaded').length) {
|
|
|
|
$('#loaded').prepend(data);
|
|
|
|
} else {
|
|
|
|
$('#loader').after("<div id='loaded' style='display:none'></div>");
|
|
|
|
$('#loaded').prepend(data);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($('#loaded').length) {
|
|
|
|
$('#loaded').prepend(data);
|
|
|
|
} else {
|
|
|
|
$('#content').find('.element').first().after(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
window.setInterval(function () {
|
2020-04-22 01:53:40 +00:00
|
|
|
var timestamp;
|
2022-01-13 05:09:24 +00:00
|
|
|
$('.postAge').each(function (a) {
|
|
|
|
timestamp = $(this).attr('id');
|
|
|
|
$(this).html(timeSince(timestamp) + ' ago');
|
|
|
|
});
|
2021-03-27 18:01:13 +00:00
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
newPosts();
|
2021-03-27 18:01:13 +00:00
|
|
|
|
2020-04-01 00:46:27 +00:00
|
|
|
}, 25000);
|
|
|
|
|
2022-01-13 05:09:24 +00:00
|
|
|
function themecheck(name) {
|
|
|
|
if (name.value == "custom") {
|
|
|
|
$('#customtheme').css("display", "block");
|
|
|
|
} else {
|
|
|
|
$('#customtheme').css("display", "none");
|
|
|
|
}
|
2020-04-13 16:30:51 +00:00
|
|
|
};
|
2020-04-22 01:53:40 +00:00
|
|
|
|
|
|
|
function timeSince(date) {
|
2022-01-13 05:09:24 +00:00
|
|
|
/* https://stackoverflow.com/questions/3177836/how-to-format-time-since-xxx-e-g-4-minutes-ago-similar-to-stack-exchange-site */
|
|
|
|
|
|
|
|
var seconds = Math.floor((new Date() - (date * 1000)) / 1000);
|
|
|
|
|
|
|
|
var interval = Math.floor(seconds / 31536000);
|
|
|
|
|
|
|
|
if (interval >= 1) {
|
|
|
|
return interval + " year" + (interval > 1 ? "s" : "");
|
|
|
|
}
|
|
|
|
interval = Math.floor(seconds / 2592000);
|
|
|
|
if (interval >= 1) {
|
|
|
|
return interval + " month" + (interval > 1 ? "s" : "");
|
|
|
|
}
|
|
|
|
interval = Math.floor(seconds / 604800);
|
|
|
|
if (interval >= 1) {
|
|
|
|
return interval + " week" + (interval > 1 ? "s" : "");
|
|
|
|
}
|
|
|
|
interval = Math.floor(seconds / 86400);
|
|
|
|
if (interval >= 1) {
|
|
|
|
return interval + " day" + (interval > 1 ? "s" : "");
|
|
|
|
}
|
|
|
|
interval = Math.floor(seconds / 3600);
|
|
|
|
if (interval >= 1) {
|
|
|
|
return interval + " hour" + (interval > 1 ? "s" : "");
|
|
|
|
}
|
|
|
|
interval = Math.floor(seconds / 60);
|
|
|
|
if (interval >= 1) {
|
|
|
|
return interval + " minute" + (interval > 1 ? "s" : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (interval < 0) {
|
|
|
|
return " just now";
|
|
|
|
}
|
|
|
|
return Math.floor(seconds) + " seconds";
|
2020-05-20 19:53:33 +00:00
|
|
|
}
|