$(document).ready(function () {
$("body").addClass("js");
$("#header").append('
');
$(".show-menu").click(function () {
$(".carou-top").fadeToggle(0);
$("#cols").toggleClass("viss");
$(this).find(".fa").toggleClass("fa-bars fa-times");
});
$("img.lazy").lazyload({ effect: "fadeIn" });
$(".ps-link").click(function () {
window.location.href = $(this).data("link");
});
if ($(window).width() > 1220) {
$(".sorter").hover(function () {
$(this).find("form").stop(true, true).fadeToggle(100);
});
} else {
$(".sorter").click(function () {
$(this).find("form").fadeToggle(100);
});
}
$(".tabs-b:first").addClass("visible");
setTimeout(() => {
$(".filmlinks .tabs-sel a:first span").trigger("click");
}, 100);
$(".filmlinks .tabs-sel a").on("click", function () {
$(".filmlinks .tabs-sel a span").removeClass("current");
$(this).children().addClass("current");
});
$(".mov-desc-text").each(function () {
const t = $(this);
const maxHeight = parseInt(t.attr("data-slice"));
if (t.height() > maxHeight) {
t.addClass("slice")
.height(maxHeight)
.append('Voir plus
');
}
});
$(".slice-btn").click(function () {
const parent = $(this).parent();
parent.css("height", "auto").removeClass("slice");
$(this).fadeOut(200);
});
$("#login-box").dialog({
autoOpen: false,
modal: true,
show: "fade",
hide: "fade",
width: 320
});
$("#loginbtn, #ac-av").html($("#avatar-box").html());
$("#loginbtn").click(function () {
$("#login-box").dialog("open");
});
$(".login-social a").on("click", function () {
const t = $(this).attr("href");
const e = (screen.width - 820) / 2;
const i = (screen.height - 420) / 2 - 100;
window.open(t, "auth_window", `width=820,height=420,top=${i},left=${e},menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no`);
return false;
});
$("#add-commbtn").click(function () {
$("#add-comm-form").fadeToggle(200);
});
$(".comm-q").click(function () {
$("#add-comm-form").fadeIn(200);
});
$("#dle-content > #dle-ajax-comments").appendTo($("#full-comms"));
if ($(window).width() > 750) {
$("body").append('
');
const t = $("#gotop");
$(window).scroll(function () {
$(this).scrollTop() > 300 ? t.fadeIn(200) : t.fadeOut(200);
});
t.click(function () {
$("html, body").animate({ scrollTop: 0 }, "slow");
});
}
// Gérer le mode d'affichage (liste ou grille)
if ($.cookie("loop_view") === "grid-list") {
$("#grid").removeClass("grid-thumb").addClass("grid-list").attr("data-view", "grid-list");
$("#grid-select > span:nth-child(1)").addClass("current").siblings("span").removeClass("current");
} else {
$("#grid").removeClass("grid-list").addClass("grid-thumb").attr("data-view", "grid-thumb");
$("#grid-select > span:nth-child(2)").addClass("current").siblings("span").removeClass("current");
}
$("#grid-select > span").on("click", function (e) {
e.preventDefault();
const view = $(this).data("type");
const grid = $("#grid");
const currentView = grid.data("view");
if (view !== currentView) {
$(this).addClass("current").siblings("span").removeClass("current");
grid.fadeOut(100, function () {
$(this).removeClass(currentView).fadeIn().attr("data-view", view).addClass(view);
});
$.cookie("loop_view", view, { path: "/", expires: 7 });
}
});
// Initialiser les carrousels
$.fn.tcarusel = function () {
return this.each(function () {
const t = $(this);
const e = t.find(".tcarusel-scroll");
const itemWidth = t.find(".tcarusel-item:first").outerWidth(true);
t.find(".tcarusel-next").click(function () {
e.animate({ left: -itemWidth }, 200, function () {
t.find(".tcarusel-item:first").appendTo(e);
e.css("left", 0);
});
});
t.find(".tcarusel-prev").click(function () {
t.find(".tcarusel-item:last").prependTo(e);
e.css("left", -itemWidth).animate({ left: 0 }, 200);
});
});
};
$(".tcarusel").tcarusel();
// ✅ Plus de redirection inutile basée sur "wiflix" ou "flemmix"
});