', { 'class': 'jvc-embed-container ratio-16-9' });
const tempDiv = document.createElement('div');
tempDiv.innerHTML = r.response.html;
const iframe = tempDiv.querySelector('iframe');
if (iframe) {
iframe.setAttribute('referrerpolicy', 'no-referrer');
$c.append(iframe);
$linkElement.after($c);
}
}
}
});
}
}
/**
* Classe principale TopicLive.
*/
class TopicLive {
constructor() {
this.isLoading = false;
this.instance = 0;
this.ongletActif = !document.hidden;
this.unreadMessageAnchors = [];
this.isChatModeActive = false;
this.lastScrollTop = 0;
this.isBlocked = false;
this.is410 = false;
this.$partialQuoteButton = null;
this.$tl_forum_button = null;
this.justPostedMessageId = null;
this.forumButtonState = false;
this.$tl_quick_reply_button = null;
this.$tl_settings_button = null;
this.$tl_settings_modal = null;
this.$tl_settings_overlay = null;
this.options = {};
this.tempOptions = {};
this.isForumPage = false;
this.$tl_connected_counter = null;
this.isStandby = false;
this.changelogContent = null;
this.mediaEmbed = null;
}
loadSettings() {
const load = (key, defaultValue) => {
const value = localStorage.getItem(key);
return value === null ? defaultValue : (value === 'true');
};
this.options.sound = load('topiclive_sound', false);
this.options.favicon = load('topiclive_favicon', true);
this.options.newMessagesButton = load('topiclive_newMessagesButton', true);
this.options.showCounterOnButton = load('topiclive_showCounterOnButton', true);
this.options.listButton = load('topiclive_listButton', true);
this.options.listButtonSwipe = load('topiclive_listButtonSwipe', true);
this.options.quickReplyButton = load('topiclive_quickReplyButton', true);
this.options.counterOnTopics = load('topiclive_counterOnTopics', true);
this.options.counterOnForums = load('topiclive_counterOnForums', true);
this.options.embedTiktok = load('topiclive_embedTiktok', true);
this.options.embedInstagram = load('topiclive_embedInstagram', true);
this.options.embedYoutube = load('topiclive_embedYoutube', true);
this.options.embedTwitter = load('topiclive_embedTwitter', true);
this.options.embedWebmshare = load('topiclive_embedWebmshare', true);
this.options.embedStreamable = load('topiclive_embedStreamable', true);
this.options.embedVocaroo = load('topiclive_embedVocaroo', true);
}
charger() {
if (this.oldInstance != this.instance) return;
TL.GET(data => { new Page(data).scan(); });
}
init() {
const estPageDeForum = document.URL.match(/\/forums\/(?:0|42|1)-/);
if (!estPageDeForum) {
if (this.$tl_button) this.$tl_button.hide();
if (this.$tl_forum_button) this.$tl_forum_button.hide();
if (this.$tl_quick_reply_button) this.$tl_quick_reply_button.hide();
if (this.$tl_connected_counter) this.$tl_connected_counter.hide();
return;
}
if (typeof $ === 'undefined') return;
this.loadSettings();
const forceLive = localStorage.getItem('tl_force_live_mode') === 'true';
if (forceLive) localStorage.removeItem('tl_force_live_mode');
const shouldGoLive = window.location.hash === '#tl-go-live' || window.location.hash.startsWith('#post_') || forceLive;
if (this.$tl_button) this.$tl_button.hide();
if (this.$tl_forum_button) this.$tl_forum_button.hide();
if (this.$tl_quick_reply_button) this.$tl_quick_reply_button.hide();
if (this.$tl_connected_counter) this.$tl_connected_counter.hide();
this.isChatModeActive = false;
this.nvxMessages = 0;
this.unreadMessageAnchors = [];
this.lastScrollTop = 0;
if (document.URL.match(/\/forums\/0-/)) {
this.isForumPage = true;
this.instance++;
this.url = document.URL;
if (this.options.counterOnForums) this.$tl_connected_counter.show();
this.updateDesktopButtonPosition();
this.scanForumPageAndUpdate($(document));
this.loopForum();
return;
}
const analysable = document.URL.match(/\/forums\/(?:42|1)-/);
if (!analysable) return;
this.isForumPage = false;
this.instance++;
this.ajaxTs = $('#ajax_timestamp_liste_messages').val();
this.ajaxHash = $('#ajax_hash_liste_messages').val();
this.estMP = false;
this.url = document.URL;
this.messagesActionsMap = {};
extractPayloadGzip().then(payload => {
if (payload && payload.listMessage) {
for (const msg of payload.listMessage) {
this.messagesActionsMap[msg.id] = msg.actions;
}
}
});
// ── NOUVEAU : sélecteurs adaptés à la nouvelle interface React JVC ──
this.class_msg = '.messageUser';
this.class_num_page = '.pagination__item--current';
this.class_page_fin = '.pagination__item--last:not(.pagination__item--disabled)';
this.class_date = '.messageUser__date';
this.class_contenu = '.messageUser__main';
this.class_pagination = '.container__pagination';
if ($(this.class_msg).length > 0) {
this.page = new Page($(document));
this.formu = new Formulaire();
this.messages = this.page.obtenirMessages();
this.applySettings();
this.updateDesktopButtonPosition();
this.updateCounters();
if (shouldGoLive) {
this.isChatModeActive = true;
if (window.location.hash.startsWith('#post_')) {
setTimeout(() => {
const targetId = window.location.hash.replace('#post_', '');
const $targetMessage = $(`#message-${targetId}`);
if ($targetMessage.length > 0) {
const targetScrollTop = $targetMessage.offset().top - 100;
$('html, body').stop().animate({ scrollTop: targetScrollTop }, 800);
}
}, 200);
} else if (window.location.hash === '#tl-go-live') {
setTimeout(() => {
const $lastMessage = $(`${TL.class_msg}:last`);
if ($lastMessage.length > 0) {
const targetScrollTop = $lastMessage.offset().top - 100;
$('html, body').animate({ scrollTop: targetScrollTop }, 800);
}
history.replaceState(null, document.title, window.location.pathname + window.location.search);
}, 100);
}
}
this.page.scan();
this.loop();
}
}
initOtherScriptObserver() {
const SELECTEUR_AUTRE_SCRIPT = '#jvchat-main';
const checkScriptStatus = () => {
if (document.querySelector(SELECTEUR_AUTRE_SCRIPT) !== null) {
this.standby();
} else {
this.resume();
}
};
const observer = new MutationObserver(checkScriptStatus);
observer.observe(document.body, { childList: true, subtree: true });
checkScriptStatus();
}
standby() {
if (this.isStandby) return;
this.isStandby = true;
window.clearTimeout(this.idanalyse);
window.clearTimeout(this.idForumAnalyse);
if (this.$tl_button) this.$tl_button.hide();
if (this.$tl_forum_button) this.$tl_forum_button.hide();
if (this.$tl_quick_reply_button) this.$tl_quick_reply_button.hide();
if (this.$tl_connected_counter) this.$tl_connected_counter.hide();
}
resume() {
if (!this.isStandby) return;
this.isStandby = false;
this.applySettings();
if (this.isForumPage) { this.loopForum(); } else { this.loop(); }
}
initScrollButton() {
const arrowIconSvg = `
`;
const buttonCss = `
.topiclive-floating-button { z-index: 1000; font-weight: bold; color: white; background-color: rgba(22, 22, 22, 0.3); border: 1px solid rgba(74, 74, 74, 1); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); cursor: pointer; display: flex; align-items: center; height: 35px; width: 35px; border-radius: 50%; padding: 0; justify-content: center; transform: translateZ(0); transition: width 0.3s ease, padding 0.3s ease, border-radius 0.3s ease, background-color 0.2s ease, transform 0.2s ease; }
.topiclive-floating-button:hover { background-color: rgba(40, 40, 40, 0.9); transform: translateY(-2px); }
.topiclive-floating-button:active { transform: translateY(1px); }
#topiclive-button.has-unread-messages { width: auto; padding: 0 10px 0 8px; border-radius: 50px; }
#topiclive-button .topiclive-counter { font-size: 13px; background-color: #007bff; border-radius: 50%; width: 24px; height: 24px; line-height: 24px; text-align: center; margin-right: 8px; transform: scale(0); transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease, width 0.3s ease; opacity: 0; width: 0; overflow: hidden; display: none; }
#topiclive-button.has-unread-messages .topiclive-counter { display: block; transform: scale(1); opacity: 1; width: 24px; }
#topiclive-button .topiclive-arrow { transition: transform 0.3s ease; display: flex; align-items: center; }
.button-transitioning { transform: scale(0.9); transition: transform 0.15s ease, background-color 0.15s ease; }
#topiclive-connected-counter { pointer-events: none; }
.tl-counter-button { width: 20px; height: 20px; line-height: 20px; font-size: 11px; font-weight: bold; }
`;
$('head').append(``);
this.$tl_button = $(`
`).hide();
this.$tl_button.get(0).TL = this;
$('body').append(this.$tl_button);
this.$tl_button.on('click', () => {
// ── NOUVEAU : détection dernière page ──
const isOnLastPage = $('.pagination__item--next.pagination__item--disabled').length > 0;
if (isOnLastPage) {
if (this.nvxMessages > 0) {
this.page.performScroll();
} else {
this.isChatModeActive = true;
const $lastMessage = $(`${TL.class_msg}:last`);
if ($lastMessage.length > 0) {
const targetScrollTop = $lastMessage.offset().top - 100;
$('html, body').animate({ scrollTop: targetScrollTop }, 800);
}
this.updateCounters();
}
} else {
const $bouton = $('.pagination__item--last:not(.pagination__item--disabled)');
let lastPageUrl = $bouton.attr('href') || '';
if (lastPageUrl) window.location.href = lastPageUrl + '#tl-go-live';
}
});
$(window).on('scroll', () => {
this.updateDesktopButtonPosition();
const st = $(window).scrollTop();
if (st < this.lastScrollTop && this.isChatModeActive) this.isChatModeActive = false;
this.lastScrollTop = st;
if (this.unreadMessageAnchors.length === 0) { this.updateCounters(); return; }
const viewportBottom = $(window).scrollTop() + $(window).height();
const messagesJustRead = [];
for (const $message of this.unreadMessageAnchors) {
const messageBottom = $message.offset().top + $message.outerHeight();
if (viewportBottom >= messageBottom) messagesJustRead.push($message);
}
if (messagesJustRead.length > 0) {
this.unreadMessageAnchors = this.unreadMessageAnchors.filter($anchor => !messagesJustRead.some($read => $read.is($anchor)));
this.nvxMessages -= messagesJustRead.length;
if (this.nvxMessages <= 0) { this.nvxMessages = 0; this.isChatModeActive = true; }
}
this.updateCounters();
});
$(window).on('resize', () => this.updateDesktopButtonPosition());
}
initForumListButton() {
const listIconSvg = `
`;
this.$tl_forum_button = $(`
`).hide();
$('body').append(this.$tl_forum_button);
let startX = 0, startY = 0, isDragging = false;
const swipeThreshold = 30;
this.$tl_forum_button.on('mousedown touchstart', (e) => {
if (!this.options.listButtonSwipe) return;
isDragging = false;
const touch = e.originalEvent.touches ? e.originalEvent.touches[0] : e;
startX = touch.clientX; startY = touch.clientY;
});
this.$tl_forum_button.on('mousemove touchmove', (e) => {
if (!this.options.listButtonSwipe || (startX === 0 && startY === 0)) return;
const touch = e.originalEvent.touches ? e.originalEvent.touches[0] : e;
const diffX = Math.abs(touch.clientX - startX), diffY = Math.abs(touch.clientY - startY);
if (diffX > swipeThreshold && diffX > diffY) isDragging = true;
});
this.$tl_forum_button.on('mouseup touchend', (e) => {
if (!this.options.listButtonSwipe) return;
if (isDragging) { e.preventDefault(); e.stopPropagation(); this.toggleForumButtonState(); }
startX = 0; startY = 0;
});
this.$tl_forum_button.on('click', (e) => {
if (isDragging) { isDragging = false; e.preventDefault(); e.stopPropagation(); return; }
if (this.forumButtonState && this.options.listButtonSwipe) { this.scrollToReplyForm(); } else { this.goToForumList(); }
});
}
initQuickReplyButton() {
const replyIconSvg = `
`;
this.$tl_quick_reply_button = $(`
`).hide();
$('body').append(this.$tl_quick_reply_button);
this.$tl_quick_reply_button.on('click', () => { this.scrollToReplyForm(); });
}
initSettingsMenu() {
if ($('#tl-settings-modal').length > 0) return;
const soundOnIcon = `
`;
const faviconIcon = `
`;
const replyIconSvg = `
`;
const listIconSvg = `
`;
const arrowIconSvg = `
`;
const githubIconSvg = `
`;
const videoIcon = `
`;
const menuHtml = `
Changelog TopicLive+
Chargement...
`;
const menuCss = `
:root { --tl-bg-light: #f5f5f5; --tl-text-light: #333; --tl-border-light: #e0e0e0; --tl-header-bg-light: #f5f5f5; --tl-header-text-light: #111; --tl-separator-bg-light: #e0e0e0; --tl-bg-dark: #2d2d2d; --tl-text-dark: #f0f0f0; --tl-border-dark: #444; --tl-header-bg-dark: #1e1e1e; --tl-header-text-dark: #f0f0f0; --tl-separator-bg-dark: #444; }
.topiclive-deleted .messageUser__card { background-color: rgba(128, 128, 128, 0.5) !important; border: 1px solid rgba(128, 128, 128, 0.5); border-radius: 8px; opacity: 0.7; }
.bloc-pre-right { flex-wrap: wrap; row-gap: 0.625rem; column-gap: 0.3125rem; display: flex; }
.tl-settings-button { color: white !important; background: linear-gradient(90deg, rgba(0, 82, 204, 0.5), rgba(244, 128, 34, 0.5)) !important; border: 1px solid #F48022 !important; transition: all 0.2s ease-in-out !important; font-weight: bold !important; padding: 4px 10px !important; font-size: 13px !important; line-height: 1.5 !important; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.tl-settings-button:hover { transform: scale(1.03); filter: brightness(115%); }
#tl-settings-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 9998; }
#tl-settings-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 10px; box-sizing: border-box; }
.tl-smartphone-frame { width: 100%; max-width: 340px; max-height: 70vh; background: #111; border: 2px solid #000; border-radius: 20px; padding: 5px; box-shadow: 0 5px 25px rgba(0,0,0,0.5); display: flex; flex-direction: column; }
.tl-smartphone-screen { background: var(--tl-bg-light); height: 100%; border-radius: 15px; display: flex; flex-direction: column; overflow: hidden; }
.tl-smartphone-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid var(--tl-border-light); background-color: var(--tl-header-bg-light); color: var(--tl-header-text-light); flex-shrink: 0; }
.tl-header-title { font-size: 21px; font-weight: 900; background: linear-gradient(90deg, rgba(0, 82, 204, 0.9), rgba(244, 128, 34, 0.9)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0px 0px 1px rgba(0,0,0,0.2)); }
.tl-dark-mode-container { display: flex; align-items: center; gap: 8px; }
.tl-dark-mode-label { font-size: 10px; font-weight: normal; }
.tl-settings-list { list-style: none; padding: 15px 5px; margin: 0; color: var(--tl-text-light); overflow-y: auto; flex-grow: 1; }
.tl-settings-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; border-bottom: 1px solid var(--tl-border-light); }
.tl-settings-list li:last-child { border-bottom: none; }
.tl-setting-label { display: flex; align-items: center; gap: 15px; font-size: 14px; }
.tl-setting-icon { color: #555; }
.tl-setting-separator { display: block; width: 100%; background: var(--tl-separator-bg-light); padding: 2px 15px; font-weight: bold; font-size: 12px; margin-top: 10px; }
#tl-li-list-swipe { background: #f0f0f0; }
.tl-swipe-visual { display: flex; align-items: center; gap: 5px; }
.tl-swipe-visual .topiclive-floating-button { width: 28px; height: 28px; transform: none !important; cursor: default; box-shadow: none; border-width: 1px; }
.tl-swipe-visual .topiclive-floating-button svg { width: 16px; height: 16px; }
.tl-swipe-arrow { font-size: 20px; font-weight: bold; color: #555; }
.tl-sim-disabled { opacity: 0.4; filter: grayscale(80%); }
.tl-settings-actions { padding: 15px; border-top: 1px solid var(--tl-border-light); display: flex; justify-content: space-between; gap: 10px; flex-shrink: 0; }
.tl-settings-actions .btn { flex-grow: 1; transition: transform 0.1s ease, filter 0.2s ease, background-color 0.2s ease; }
.tl-settings-actions .btn:hover { filter: brightness(90%); }
.tl-settings-actions .btn:active { transform: translateY(1px); filter: brightness(80%); }
#tl-settings-cancel { background-color: #6c757d; color: white !important; border: none; }
#tl-settings-cancel:hover { background-color: #5a6268; filter: brightness(100%); }
#tl-sim-new-messages-counter { width: auto; padding: 0 10px 0 8px; border-radius: 50px; }
#tl-sim-new-messages-counter .topiclive-counter { font-size: 13px; background-color: #007bff; border-radius: 50%; width: 24px; height: 24px; line-height: 24px; text-align: center; margin-right: 8px; display: inline-block; }
#tl-sim-new-messages-counter .topiclive-arrow { display: inline-flex; align-items: center; }
#tl-save-toast { position: fixed; top: 100px; left: 50%; transform: translate(-50%, -150%); background-color: rgba(40, 167, 69, 0.5); border: 1px solid #28a745; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); color: white; padding: 10px 20px; border-radius: 8px; z-index: 10000; font-size: 14px; font-weight: bold; box-shadow: 0 4px 15px rgba(0,0,0,0.2); opacity: 0; visibility: hidden; transition: transform 0.4s ease, opacity 0.4s ease, visibility 0.4s; text-align: center; }
#tl-save-toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
#tl-settings-modal.tl-dark-mode .tl-smartphone-screen { background: var(--tl-bg-dark); }
#tl-settings-modal.tl-dark-mode .tl-smartphone-header { background: var(--tl-header-bg-dark); color: var(--tl-header-text-dark); border-bottom-color: var(--tl-border-dark); }
#tl-settings-modal.tl-dark-mode .tl-settings-list { color: var(--tl-text-dark); }
#tl-settings-modal.tl-dark-mode .tl-settings-list li { border-bottom-color: var(--tl-border-dark); }
#tl-settings-modal.tl-dark-mode .tl-setting-separator { background: var(--tl-separator-bg-dark); color: #ccc; }
#tl-settings-modal.tl-dark-mode .tl-setting-icon { color: #ccc; }
#tl-settings-modal.tl-dark-mode .tl-settings-actions { border-top-color: var(--tl-border-dark); }
#tl-settings-modal.tl-dark-mode .tl-footer-link { color: #58a6ff; }
#tl-settings-modal.tl-dark-mode .tl-settings-footer { border-top-color: var(--tl-border-dark); }
#tl-settings-modal.tl-dark-mode #tl-li-list-swipe { background: #333; }
#tl-settings-modal.tl-dark-mode .tl-swipe-arrow { color: #ccc; }
.tl-settings-footer { padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--tl-border-light); flex-shrink: 0; }
.tl-footer-link { color: #007bff; cursor: pointer; font-size: 13px; text-decoration: none; display: flex; align-items: center; gap: 5px; }
.tl-footer-link:hover { text-decoration: underline; color: #ff7505 !important; }
#tl-changelog-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 10000; }
#tl-changelog-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 600px; max-height: 80vh; background: #2d2d2d; color: #f0f0f0; border: 1px solid #555; border-radius: 12px; box-shadow: 0 5px 25px rgba(0,0,0,0.5); z-index: 10001; display: flex; flex-direction: column; padding: 20px; }
#tl-changelog-modal h2 { margin-top: 0; color: #fff; border-bottom: 1px solid #555; padding-bottom: 10px; }
#tl-changelog-content { flex-grow: 1; overflow-y: auto; white-space: pre-wrap; font-family: monospace; background: #1e1e1e; padding: 15px; border-radius: 6px; }
#tl-changelog-close { margin-top: 20px; background-color: #6c757d; color: white; border: none; align-self: flex-end; }
.jvc-embed-container { margin: 10px 0; border-radius: 8px; overflow: hidden; background: #000; }
.jvc-embed-container.ratio-16-9 { position: relative; padding-bottom: 56.25%; height: 0; max-width: 640px; }
.jvc-embed-container.ratio-16-9 iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.jvc-embed-container.tiktok-iframe-embed { max-width: 340px; margin-left: auto; margin-right: auto; }
.jvc-embed-container.tiktok-iframe-embed iframe { width: 100%; height: 760px; border: none; display: block; }
.jvc-embed-container.instagram-native-embed { max-width: 420px; }
.jvc-embed-container.instagram-iframe-embed { max-width: 540px; }`;
$('head').append(``);
$('body').append(menuHtml);
$('body').append('
Paramètres sauvegardés
');
this.$tl_settings_modal = $('#tl-settings-modal');
this.$tl_settings_overlay = $('#tl-settings-overlay');
const closeModal = () => { this.$tl_settings_modal.hide(); this.$tl_settings_overlay.hide(); };
this.$tl_settings_modal.on('click', closeModal);
this.$tl_settings_modal.find('.tl-smartphone-frame').on('click', function(e) { e.stopPropagation(); });
$('#tl-settings-cancel').on('click', closeModal);
$('#tl-settings-save').on('click', () => {
this.saveSettings();
closeModal();
const $toast = $('#tl-save-toast');
$toast.addClass('show');
setTimeout(() => { $toast.removeClass('show'); }, 2500);
});
$('#tl-setting-dark-mode').on('change', (e) => {
const isDarkMode = $(e.target).is(':checked');
this.$tl_settings_modal.toggleClass('tl-dark-mode', isDarkMode);
localStorage.setItem('topiclive_dark_mode', isDarkMode);
});
this.attachSettingsListeners();
const $changelogModal = $('#tl-changelog-modal');
const $changelogOverlay = $('#tl-changelog-overlay');
const closeChangelog = () => { $changelogModal.hide(); $changelogOverlay.hide(); };
$('#tl-show-changelog').on('click', () => this.fetchAndShowChangelog());
$('#tl-changelog-close').on('click', closeChangelog);
$changelogOverlay.on('click', closeChangelog);
// ── NOUVEAU : bouton settings dans la nouvelle barre navbar JVC ──
const observer = new MutationObserver(() => {
const targetContainers = document.querySelectorAll('.buttonsNavbar__list, .buttonsNavbar');
targetContainers.forEach(container => {
if (container && container.querySelector('.tl-settings-button') === null) {
const button = document.createElement('button');
button.className = 'btn tl-settings-button';
button.title = 'Paramètres TopicLive+';
button.textContent = 'TopicLive+';
container.appendChild(button);
}
});
});
observer.observe(document.body, { childList: true, subtree: true });
$(document).on('click', '.tl-settings-button', () => {
this.populateSettings();
this.$tl_settings_modal.show();
this.$tl_settings_overlay.show();
});
}
populateSettings() {
this.loadSettings();
this.tempOptions = { ...this.options };
$('#tl-setting-sound').prop('checked', this.tempOptions.sound);
$('#tl-setting-favicon').prop('checked', this.tempOptions.favicon);
$('#tl-setting-new-messages').prop('checked', this.tempOptions.newMessagesButton);
$('#tl-setting-show-counter').prop('checked', this.tempOptions.showCounterOnButton);
$('#tl-setting-quick-reply').prop('checked', this.tempOptions.quickReplyButton);
$('#tl-setting-list').prop('checked', this.tempOptions.listButton);
$('#tl-setting-list-swipe').prop('checked', this.tempOptions.listButtonSwipe);
$('#tl-setting-counter-topics').prop('checked', this.tempOptions.counterOnTopics);
$('#tl-setting-counter-forums').prop('checked', this.tempOptions.counterOnForums);
$('#tl-setting-embed-tiktok').prop('checked', this.tempOptions.embedTiktok);
$('#tl-setting-embed-instagram').prop('checked', this.tempOptions.embedInstagram);
$('#tl-setting-embed-youtube').prop('checked', this.tempOptions.embedYoutube);
$('#tl-setting-embed-twitter').prop('checked', this.tempOptions.embedTwitter);
$('#tl-setting-embed-webmshare').prop('checked', this.tempOptions.embedWebmshare);
$('#tl-setting-embed-streamable').prop('checked', this.tempOptions.embedStreamable);
$('#tl-setting-embed-vocaroo').prop('checked', this.tempOptions.embedVocaroo);
const isDarkMode = localStorage.getItem('topiclive_dark_mode') === 'true';
$('#tl-setting-dark-mode').prop('checked', isDarkMode);
this.$tl_settings_modal.toggleClass('tl-dark-mode', isDarkMode);
this.updateSimulatedButtons();
}
updateSimulatedButtons() {
$('#tl-sim-new-messages').toggleClass('tl-sim-disabled', !this.tempOptions.newMessagesButton);
$('#tl-sim-new-messages-counter').toggleClass('tl-sim-disabled', !this.tempOptions.showCounterOnButton);
$('#tl-sim-quick-reply').toggleClass('tl-sim-disabled', !this.tempOptions.quickReplyButton);
$('#tl-sim-list').toggleClass('tl-sim-disabled', !this.tempOptions.listButton);
$('#tl-li-list-swipe').toggle(this.tempOptions.listButton);
$('#tl-sim-counter-topics').toggleClass('tl-sim-disabled', !this.tempOptions.counterOnTopics);
$('#tl-sim-counter-forums').toggleClass('tl-sim-disabled', !this.tempOptions.counterOnForums);
}
attachSettingsListeners() {
$('#tl-setting-sound').off('change').on('change', (e) => { this.tempOptions.sound = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-favicon').off('change').on('change', (e) => { this.tempOptions.favicon = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-new-messages').off('change').on('change', (e) => { this.tempOptions.newMessagesButton = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-show-counter').off('change').on('change', (e) => { this.tempOptions.showCounterOnButton = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-quick-reply').off('change').on('change', (e) => { this.tempOptions.quickReplyButton = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-list').off('change').on('change', (e) => { this.tempOptions.listButton = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-list-swipe').off('change').on('change', (e) => { this.tempOptions.listButtonSwipe = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-counter-topics').off('change').on('change', (e) => { this.tempOptions.counterOnTopics = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-counter-forums').off('change').on('change', (e) => { this.tempOptions.counterOnForums = $(e.target).is(':checked'); this.updateSimulatedButtons(); });
$('#tl-setting-embed-tiktok').off('change').on('change', (e) => { this.tempOptions.embedTiktok = $(e.target).is(':checked'); });
$('#tl-setting-embed-instagram').off('change').on('change', (e) => { this.tempOptions.embedInstagram = $(e.target).is(':checked'); });
$('#tl-setting-embed-youtube').off('change').on('change', (e) => { this.tempOptions.embedYoutube = $(e.target).is(':checked'); });
$('#tl-setting-embed-twitter').off('change').on('change', (e) => { this.tempOptions.embedTwitter = $(e.target).is(':checked'); });
$('#tl-setting-embed-webmshare').off('change').on('change', (e) => { this.tempOptions.embedWebmshare = $(e.target).is(':checked'); });
$('#tl-setting-embed-streamable').off('change').on('change', (e) => { this.tempOptions.embedStreamable = $(e.target).is(':checked'); });
$('#tl-setting-embed-vocaroo').off('change').on('change', (e) => { this.tempOptions.embedVocaroo = $(e.target).is(':checked'); });
}
saveSettings() {
this.options = { ...this.tempOptions };
Object.keys(this.options).forEach(key => {
localStorage.setItem(`topiclive_${key}`, this.options[key]);
});
this.applySettings();
}
applySettings() {
if (!this.options.favicon) this.favicon.maj('');
this.updateCounters();
this.$tl_quick_reply_button.toggle(this.options.quickReplyButton && !this.isForumPage);
this.$tl_forum_button.toggle(this.options.listButton && !this.isForumPage);
if (this.isForumPage) {
this.$tl_connected_counter.toggle(this.options.counterOnForums);
} else {
this.$tl_connected_counter.toggle(this.options.counterOnTopics);
}
}
fetchAndShowChangelog() {
const changelogUrl = 'https://raw.githubusercontent.com/moyaona/TopicLivePlus/main/Changelog.md';
const fallbackUrl = 'https://github.com/moyaona/TopicLivePlus/blob/main/Changelog.md';
const $modal = $('#tl-changelog-modal');
const $overlay = $('#tl-changelog-overlay');
const $content = $('#tl-changelog-content');
$overlay.show(); $modal.show();
if (this.changelogContent) { $content.text(this.changelogContent); return; }
$content.text('Chargement en cours...');
GM_xmlhttpRequest({
method: "GET", url: changelogUrl,
onload: (response) => { this.changelogContent = response.responseText; $content.text(this.changelogContent); },
onerror: () => { $content.html(`Le chargement a échoué.
${fallbackUrl}`); }
});
}
toggleForumButtonState() {
const listIconSvg = `
`;
const replyIconSvg = `
`;
this.forumButtonState = !this.forumButtonState;
this.$tl_forum_button.addClass('button-transitioning');
setTimeout(() => {
if (this.forumButtonState) {
this.$tl_forum_button.html(replyIconSvg);
this.$tl_forum_button.css('background-color', 'rgba(0, 123, 255, 0.3)');
} else {
this.$tl_forum_button.html(listIconSvg);
this.$tl_forum_button.css('background-color', 'rgba(22, 22, 22, 0.3)');
}
this.$tl_forum_button.removeClass('button-transitioning');
}, 150);
}
scrollToReplyForm() {
const $replyForm = $('#forums-post-message-editor');
if ($replyForm.length > 0) {
const targetScrollTop = $replyForm.offset().top - 100;
$('html, body').animate({ scrollTop: targetScrollTop }, 800, () => {
const $textarea = $('#message_topic');
if ($textarea.length > 0) $textarea.focus();
});
}
}
goToForumList() {
const forumIdMatch = window.location.href.match(/\/forums\/(?:42|1)-(\d+)-/);
if (forumIdMatch && forumIdMatch[1]) {
window.location.href = `https://www.jeuxvideo.com/forums/0-${forumIdMatch[1]}-0-1-0-1-0-0.htm`;
} else {
window.location.href = 'https://www.jeuxvideo.com/forums.htm';
}
}
initConnectedCounter() {
this.$tl_connected_counter = $(`
`).hide();
$('body').append(this.$tl_connected_counter);
}
initPartialQuoteSystem() {
const buttonCSS = `
#tl-partial-quote-button { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEVJREFUeNpiYBgFFANGbIL/gQCuAAhwiYEAE6UuoI0BSE78gE8MpwFA7yZAmRvwiTHg0NwAxOeBuACIFXCJjQIqAoAAAwDEvS2y79EjywAAAABJRU5ErkJggg==) no-repeat; background-color: rgb(3, 94, 191); background-position: -1px -1px; border: 0; border-bottom: solid 2px rgb(2, 63, 128); border-radius: 2px; box-sizing: content-box; cursor: pointer; height: 16px; width: 16px; padding: 0; position: absolute; display: none; z-index: 1001; transform: translateX(-50%); }
#tl-partial-quote-button.active { display: block; animation: tl-quote-pop 0.2s ease-out; }
#tl-partial-quote-button:after { content: ""; position: absolute; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 8px solid rgb(3, 94, 191); top: -8px; left: 50%; transform: translateX(-50%); }
@keyframes tl-quote-pop { 0% { transform: translateX(-50%) scale(0.8); opacity: 0; } 70% { transform: translateX(-50%) scale(1.1); opacity: 1; } 100% { transform: translateX(-50%) scale(1.0); } }`;
$('head').append(``);
this.$partialQuoteButton = $('
').appendTo('body');
$(document).on('pointerdown', (e) => {
if (!$(e.target).is('#tl-partial-quote-button')) this.$partialQuoteButton.removeClass('active');
});
}
updateDesktopButtonPosition() {
if (!this.$tl_button || !this.$tl_forum_button || !this.$tl_connected_counter || !this.$tl_quick_reply_button) return;
const isMobileView = $(window).width() < 985;
const scrollButtonBottom = isMobileView ? 20 : 25;
const listButtonBottom = scrollButtonBottom + 35 + 8;
const replyButtonBottom = listButtonBottom + 35 + 8;
const counterTop = isMobileView ? 60 : 100;
if (isMobileView) {
this.$tl_button.css({ position: 'fixed', bottom: `${scrollButtonBottom}px`, right: '20px', left: 'auto', top: 'auto' });
this.$tl_forum_button.css({ position: 'fixed', bottom: `${listButtonBottom}px`, right: '20px', left: 'auto', top: 'auto' });
this.$tl_quick_reply_button.css({ position: 'fixed', bottom: `${replyButtonBottom}px`, right: '20px', left: 'auto', top: 'auto' });
this.$tl_connected_counter.css({ position: 'fixed', top: `${counterTop}px`, right: '20px', left: 'auto', bottom: 'auto' });
} else {
let $container = $('.conteneur-messages-pagi, .conteneur-topic-pagi, .container__main');
if ($container.length > 0) {
const basePositionRight = $container.offset().left + $container.outerWidth() + 15;
const decalageGauche = 11;
this.$tl_connected_counter.css({ position: 'fixed', top: `${counterTop}px`, left: `${basePositionRight - decalageGauche}px`, right: 'auto', bottom: 'auto' });
this.$tl_button.css({ position: 'fixed', bottom: `${scrollButtonBottom}px`, left: `${basePositionRight}px`, right: 'auto', top: 'auto' });
this.$tl_forum_button.css({ position: 'fixed', bottom: `${listButtonBottom}px`, left: `${basePositionRight}px`, right: 'auto', top: 'auto' });
this.$tl_quick_reply_button.css({ position: 'fixed', bottom: `${replyButtonBottom}px`, left: `${basePositionRight}px`, right: 'auto', top: 'auto' });
}
}
}
updateCounters() {
if (this.isStandby || this.isForumPage) return;
if (this.isBlocked) {
const $counter = this.$tl_button.find('.topiclive-counter');
const cloudflareLogo = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTkuMzUgMTAuMDRDMTguNjcgNi45OSAxNS42NCA0IDEyIDRDOS4xMSA0IDYuNiA1LjY0IDUuMzUgOC4wNEMyLjM0IDguMzYgMCAxMC45MSAwIDE0QzAgMTcuMzEgMi42OSAyMCA2IDIwSDE5QzIxLjc2IDIwIDI0IDE3Ljc2IDI0IDE1QzI0IDEyLjM2IDIxLjk1IDEwLjIyIDE5LjM1IDEwLjA0WiIgZmlsbD0iI0Y0ODAyMiIvPjwvc3ZnPg==';
$counter.html('').css({ 'background-color': '#ffffff', 'background-image': `url("${cloudflareLogo}")`, 'background-size': '16px 16px', 'background-repeat': 'no-repeat', 'background-position': 'center' });
this.$tl_button.addClass('has-unread-messages').fadeIn();
return;
}
if (this.is410) {
const $counter = this.$tl_button.find('.topiclive-counter');
const errorIcon16 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAALEUExURUxpcf7ihv/0oeuVNfK1Xv7/wf//6uqPMPS3WvzRff/Vc/nOfv/sh//Pbf3WdEI9Rv7iiP7ce//2rv/Nb/zknv/bevutMv/gkv/wrPzgmfbFcvrXjPzkmv7xq//hf//skP3cgv/mhfGvVP/shF1KOXZNMP/Xff3poP/FYf/AXPmaDf/rhO2ePa+Viv/legAPPf62SvvQd/6NFS0rN/SkPfvZiNp0FoZFD7VUFf7ecf6UGP+fIur//xwYIvOIFuiKH+yIGY6Ki59rPi8rM/+dG1JPXXpwY56hqtyxZ+eQKfvTdURDUEZEUF5cZ/n39pZaHU1JUvnWgv7caIqHjXh5hTk4Q9t7F3dzd0FEVTw6RZViOpaUlpqYm/2QE+aGGEkyJI1pTE9MUtTT02daUyorOX99gPSMGBYVIv+REfCLGP+mDPmLFLFuJWRfYuqHFko3LuKEGEZCSf3ajf71s//4uP/riP/qhv/Zdf/lg//efP/1t//qn/3Sb//ll926b/vGbf/NavfWdP/0o/3iesiaXP/pgv/ddP/XcNSfV/q3VvK4VuvDav7uov/BUv/jeP/fdMSUV//aaLNpGv/rkP3GS/+ySN6QH+OvR//faP/ecP/HNP+yJ+aqMf2jIf66KfS3IvmZJKlnG7FiDfzigP/GKNqIGv6UFumNK2tna/+wJvC9Qv/AJuq0OCMiMP+nIvnOX/6kIpSGaC8wR//mdOyQGZ+WkkpLW4d/eO6dGy8sNsybN7qNPfilII2QnHhoXe3s7NbX24JqULO5x519UKCenyktQ66HSjk1Pv6TFG1rcLSwrj9EXS8qL83MzSEeJ8vKzmpmayMfKGRpfjo/TpWYpyomLY6OltDPzzQxOUFAU3x6fmxwfI6KjRscKZORlWpoctTT1Lu9wpqYm42Lj/+YHnJucp6eojc0PS8rMjU0PtiFJPONGDdGz4cAAABxdFJOUwCN+hdmAgIBAwL97P38aAIDY/392/4V/v7bdLu77P78cf2R/QIDAuX9+hj8agf9HP1ybK/nthuaGv7w/AHz4Ha9/uHY/aL9/LX+2kmW/vz9ytr+/fxveP7+bPz8+P7A/v3++/6I/r79AdwWdeb93X3+CABJWgAAAAlwSFlzAAALEwAACxMBAJqcGAAAARtJREFUGNMBEAHv/gAAABAAFiAcFBkbGgMACAcAAAAFABEdehh7fRdyCwQACQAABgABdBIfIR4VCg0TfyIAJgAADnMCDHV4eXd8gCgpiSwAACongiN2foGGh4iKjTCVNDYAMYwrhYOEi5GUkpabnTugPwA1ky6Oj5CXmp6ipamwRKZAAFGjOZmYnJ+kq7i8rrRJpz4ASrNSr6qsurvGw8G+tU22QgBIsUa30NnU0svCxb3AU61QAEWyVM/W3+Da2M3Hyb9XcUMATLlb197n4+LV3MzEyk6oPQBV0VxiZejm4d3b01hHQXEzAEvOYeXpZ21jX2BaT6E3Ly0APFlkb2zqcOvkXcg6MgAAJAAAAGgAamtmaW5eVjgAJQ8Ah7RsxA/wK1MAAABXelRYdFJhdyBwcm9maWxlIHR5cGUgaXB0YwAAeJzj8gwIcVYoKMpPy8xJ5VIAAyMLLmMLEyMTS5MUAxMgRIA0w2QDI7NUIMvY1MjEzMQcxAfLgEigSi4A6hcRdPJCNZUAAAAASUVORK5CYII=';
$counter.html('').css({ 'background-color': '#FFffff', 'background-image': `url("${errorIcon16}")`, 'background-size': '16px 16px', 'background-repeat': 'no-repeat', 'background-position': 'center' });
this.$tl_button.addClass('has-unread-messages').fadeIn();
return;
}
let countText = '';
if (this.nvxMessages > 0) countText = this.nvxMessages > 99 ? '99+' : `${this.nvxMessages}`;
if (this.options.favicon) this.favicon.maj(countText);
if (this.nvxMessages > 0) {
if (this.options.showCounterOnButton) {
this.$tl_button.find('.topiclive-counter').text(countText).css({ 'background-color': '#007bff', 'background-image': 'none' });
this.$tl_button.addClass('has-unread-messages').fadeIn();
} else {
this.$tl_button.fadeOut();
}
} else if (!this.isChatModeActive) {
if (this.options.newMessagesButton) { this.$tl_button.removeClass('has-unread-messages').fadeIn(); } else { this.$tl_button.fadeOut(); }
} else {
this.$tl_button.fadeOut();
}
}
markAllAsRead() {
this.nvxMessages = 0;
this.unreadMessageAnchors = [];
this.updateCounters();
}
addUnreadAnchor($message) {
this.unreadMessageAnchors.push($message);
}
initStatic() {
this.mediaEmbed = new MediaEmbed();
this.favicon = new Favicon();
this.son = new Audio('https://github.com/moyaona/TopicLivePlus/raw/refs/heads/main/notification_sound_tl.mp3');
this.suivreOnglets();
this.initScrollButton();
this.initForumListButton();
this.initQuickReplyButton();
this.initConnectedCounter();
this.initPartialQuoteSystem();
this.initSettingsMenu();
this.initOtherScriptObserver();
this.init();
addEventListener('instantclick:newpage', this.init.bind(this));
$("head").append(``);
console.log('[TopicLive+] : activé (v8.3 - compatible nouvelle interface JVC)');
}
jvCake(classe) {
const base16 = '0A12B34C56D78E9F';
let lien = '';
const s = classe.split(' ')[1];
for (let i = 0; i < s.length; i += 2) {
lien += String.fromCharCode(base16.indexOf(s.charAt(i)) * 16 + base16.indexOf(s.charAt(i + 1)));
}
return lien;
}
alert(message) {
try { modal('erreur', { message }); } catch (err) { alert(message); }
}
loop() {
if (this.isStandby || this.isBlocked || this.is410) return;
if (typeof this.idanalyse !== 'undefined') window.clearTimeout(this.idanalyse);
let duree = this.ongletActif ? 5000 : 10000;
this.oldInstance = this.instance;
this.idanalyse = setTimeout(this.charger.bind(this), duree);
}
majUrl(page) {
if (this.estMP) return;
// ── NOUVEAU : sélecteur pagination fin ──
const $bouton = page.trouver('.pagination__item--last:not(.pagination__item--disabled)');
const numPage = page.trouver(`${this.class_num_page}:first`).text();
const testUrl = this.url.split('-');
if ($bouton.length > 0) {
let nouvelleUrl = $bouton.attr('href') || '';
if (nouvelleUrl && nouvelleUrl !== this.url) {
this.messages = [];
this.url = nouvelleUrl;
}
} else if (testUrl[3] != numPage) {
this.messages = [];
testUrl[3] = numPage;
this.url = testUrl.join('-');
}
}
suivreOnglets() {
document.addEventListener('visibilitychange', () => { this.ongletActif = !document.hidden; });
}
handleCloudflareBlock() {
if (this.isBlocked) return;
this.isBlocked = true;
window.clearTimeout(this.idanalyse);
this.showCloudflareBanner();
this.favicon.setCloudflareIcon();
this.updateCounters();
}
showCloudflareBanner() {
const bannerId = 'tl-cloudflare-banner';
if (document.getElementById(bannerId)) return;
const bannerCSS = `#${bannerId} { display: flex; align-items: center; justify-content: center; position: fixed; top: 25%; width: auto; background-color: rgba(22, 22, 22, 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); color: #FFFFFF; text-align: center; padding: 15px 25px; font-size: 16px; font-weight: bold; z-index: 99999; border-radius: 8px; border: 1px solid #F48022; box-shadow: 0 5px 15px rgba(0,0,0,0.3); opacity: 0; visibility: hidden; transition: opacity 0.4s ease-out; } #${bannerId}.visible { opacity: 1; visibility: visible; } #${bannerId} svg { width: 24px; height: 24px; margin-right: 15px; flex-shrink: 0; }`;
$('head').append(``);
const cloudflareLogoSVG = `
`;
const $banner = $(`
${cloudflareLogoSVG}Cloudflare : Actualisez la page pour effectuer la vérification
`);
$('body').prepend($banner);
const positionBanner = () => {
if ($(window).width() < 567) {
$banner.css({ 'left': '50%', 'transform': 'translate(-50%, -50%)' });
} else {
const $container = $('.conteneur-messages-pagi, .container__main');
if ($container.length > 0) {
const bannerLeft = $container.offset().left + ($container.outerWidth() / 2) - ($banner.outerWidth() / 2);
$banner.css({ 'left': bannerLeft + 'px', 'transform': 'translateY(-50%)' });
}
}
};
positionBanner();
requestAnimationFrame(() => { $banner.addClass('visible'); });
$(window).off('resize.cfbanner').on('resize.cfbanner', positionBanner);
}
handle410Error() {
if (this.is410) return;
this.is410 = true;
window.clearTimeout(this.idanalyse);
this.show410Banner();
this.favicon.set410Icon();
this.updateCounters();
}
show410Banner() {
try {
const bannerId = 'tl-410-banner';
if (document.getElementById(bannerId)) return;
const bannerCSS = `#${bannerId} { display: flex; align-items: center; justify-content: center; position: fixed; top: 25%; width: auto; background-color: rgba(22, 22, 22, 0.5); backdrop-filter: blur(3px); color: #FFFFFF; text-align: center; padding: 15px 25px; font-size: 16px; font-weight: bold; z-index: 99999; border-radius: 8px; border: 1px solid #FFFFFF; opacity: 0; visibility: hidden; transition: opacity 0.4s ease-out; } #${bannerId}.visible { opacity: 1; visibility: visible; } #${bannerId} .tl-410-icon { width: 24px; height: 24px; margin-right: 15px; flex-shrink: 0; }`;
$('head').append(``);
const errorIcon24 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAACeVBMVEUAAAD8+/siHib7lxv+1mk6OEUmIiv+pyNHR1b+43r+uCksKTT8ixf+3HL+64v/6YT+wS00Mjz+44MYFBz+03P+23v+zGtVVmZCQkz+w1vqiBSsWgv++sv/8JHp6Oj/niD944rX1tf+7JH+3YIwLjf+yWP+xGPGllf+u1QdGSLtkxbleRb9vFr9s0uXlpmIhopVU1n++8T+9MO2tbdoaHPBiUrGxsdAPUnkdgv+1Xp3dXn+87z+87Wnpqn8oR1oZWr97Kv8zHFXWnD/0V1XSUXqpCf98pv65JPInmJLTWL+q0P/xzvoiCTx8O/96rT+/KL+7Jnys1LDjFD97br886L724z/yEXohzX+/qr866L93ZxeYHJxbnFPUmbqm1X9tlP9qjbomijHdhTogg3Pz9H+9smurbL984v0wHugg4SBiZX7zIX1034ZHCpkXF/jtV3Wplqaelr2t1b6r0r2qUJrU0HXlDXajDPlfijHeSPZihoRDRTU0c7++7PDubP85Kv625T904p5eoWKgnn1zHL/xWr2xWmSeGLzq1RSTlPLkE7ntEcvMkCUZDtDOzt4VDq8eznqpTjrlzXLgzS4dCnYfiTNiRrafxe4axPm4t7++r6zqqSlnJf3ypb1woz204jyuoLrsn713H2Ui3z9ynvwzXnprXf203O2oHL1yXGql2/dvGzyr2x6cmvTqmXlu2Lzq2G9l17LoFnXsFaqflHwnE3rlUfrq0WodzOrcC63bSW3ZQ6qoJ2RjI+lmHXatnDNsG2Zg2fywmTzqVuRb1Z0XVGieUvyp0jpikFkT0HaCA+lAAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEwAACxMBAJqcGAAABO5pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDkuMS1jMDAxIDc5LjE0NjI4OTksIDIwMjMvMDYvMjUtMjA6MDE6NTUgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyNS4zIChXaW5kb3dzKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjUtMDktMDJUMDE6NTY6NDUrMDI6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDI1LTA5LTAyVDAzOjMzOjQxKzAyOjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDI1LTA5LTAyVDAzOjMzOjQxKzAyOjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpiMjYyYmUwOC04OWExLTE1NGItOGZhYS1mOTVmNDcxNjE1ZmEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6YjI2MmJlMDgtODlhMS0xNTRiLThmYWEtZjk1ZjQ3MTYxNWZhIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6YjI2MmJlMDgtODlhMS0xNTRiLThmYWEtZjk1ZjQ3MTYxNWZhIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpiMjYyYmUwOC04OWExLTE1NGItOGZhYS1mOTVmNDcxNjE1ZmEiIHN0RXZ0OndoZW49IjIwMjUtMDktMDJUMDE6NTY6NDUrMDI6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4zIChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6AltmBAAAB9klEQVQokV1Sy2vTcBx9n883SX8k7cziZsBOLZQyWzA6x+bJoghDmBuIDBSdlyLozjuJA0X8A7yIJw+ioggDL8p2mAdRROpFq45NqtUdxmraNbi0abN4cCviuzweDx68xwO2Md2789jFhx1Jf2nqZ3mtFwmgPjQxCAAQAID00We5HSW3sva1S7zJv+gY4+W1jVIxUm/1/dr9diKIftmKGi9kliuQIBCgliTHuDUGCKB/w61UQewqQa2RJMdo1/uLYKRzPVgn6YKrNWrdY3DQlt+nAUb74+c6eQ/mH1VdXBvZZ9sl/dOPUQhkexbhQQvsAkYGZgY+AN8TrxyHp7HgeZBi0bimLZQBwJSA1Um6eseF5AKHlgAPetUH2kAkznUXLQCnr8Dz4Ff87UmkeAtwc+G5OQD+ubOzi8V1GVB1ZuDS85OroVBjc5OWn9x7nWg2I749JS6XWn335yMrzTOxcuC/pGAl2upytRRgDsukWnI4mSTdolRqF1mqopqALBPtyasKHVBUnRQ+ZdFTi1VCCvJvNbQEvwk5ZpNud8e/ye0IoChElGeDdGI+bHCO6PxtxQQUNoYOMrNJN5mt/YqqD58AAKhsWMzMiq7K4Zm7mpY5stUxbA4WbgghhBCapmUy1/89A0Yr7wDguLP3Mf7DbDabzU525B+VgKLP+4NhawAAAABJRU5ErkJggg==';
const $banner = $(`
410 : Topic censuré par la liberté d'expression`);
$('body').prepend($banner);
const positionBanner = () => {
if ($(window).width() < 567) {
$banner.css({ 'left': '50%', 'transform': 'translate(-50%, -50%)' });
} else {
const $container = $('.conteneur-messages-pagi, .conteneur-topic-pagi, .container__main');
if ($container.length > 0) {
const bannerLeft = $container.offset().left + ($container.outerWidth() / 2) - ($banner.outerWidth() / 2);
$banner.css({ 'left': bannerLeft + 'px', 'transform': 'translateY(-50%)' });
}
}
};
positionBanner();
requestAnimationFrame(() => { $banner.addClass('visible'); });
$(window).off('resize.410banner').on('resize.410banner', positionBanner);
} catch (err) {
console.error("[TopicLive+] ERREUR DANS show410Banner:", err);
}
}
GET(cb) {
if (this.isLoading) return;
this.isLoading = true;
const blocChargement = $('#bloc-formulaire-forum .titre-bloc');
blocChargement.addClass('topiclive-loading');
window.clearTimeout(this.idanalyse);
$.ajax({
type: 'GET', url: this.url, timeout: 5000,
success: (data, textStatus, jqXHR) => {
const responseText = jqXHR.responseText;
if (responseText.includes('id="cf-challenge-form"') || responseText.includes('
Just a moment...')) {
TL.handleCloudflareBlock(); return;
}
if (this.oldInstance != this.instance) return;
blocChargement.removeClass('topiclive-loading').addClass('topiclive-loaded');
cb($(responseText.substring(responseText.indexOf(''))));
setTimeout(() => { blocChargement.removeClass('topiclive-loaded'); }, 100);
TL.loop();
},
error: (jqXHR) => {
if (jqXHR.status === 403 && jqXHR.responseText.includes('Cloudflare')) { TL.handleCloudflareBlock(); return; }
if (jqXHR.status === 410) { TL.handle410Error(); return; }
TL.loop();
},
complete: () => { this.isLoading = false; }
});
}
loopForum() {
if (this.isStandby) return;
if (typeof this.idForumAnalyse !== 'undefined') window.clearTimeout(this.idForumAnalyse);
let duree = this.ongletActif ? 15000 : 30000;
this.oldInstance = this.instance;
this.idForumAnalyse = setTimeout(this.chargerForum.bind(this), duree);
}
chargerForum() {
if (this.isLoading) return;
if (this.oldInstance != this.instance) return;
this.isLoading = true;
$.ajax({
type: 'GET', url: this.url, timeout: 5000,
success: (data) => {
if (this.oldInstance != this.instance) return;
this.scanForumPageAndUpdate($(data));
this.loopForum();
},
error: () => { if (this.oldInstance == this.instance) this.loopForum(); },
complete: () => { this.isLoading = false; }
});
}
scanForumPageAndUpdate($page) {
const connectesText = $page.find('.nb-connect-fofo').text().trim();
if (connectesText && this.$tl_connected_counter) {
this.$tl_connected_counter.text(connectesText.split(' ')[0]);
}
}
}
var TL = new TopicLive();
TL.initStatic();