$('[lang="fr-fr"] body').append('

Vous allez être redirigé vers une page NVIDIA hébergée en dehors de la France

Continuer
'); // Function to execute your logic function executeLogic() { $('[lang="fr-fr"] a').each(function (key, val) { var hrefValue = $(this).attr('href'); if (hrefValue && (hrefValue.charAt(0) !== '#' && hrefValue.indexOf('/fr-fr/') === -1 && hrefValue.indexOf('.exe') === -1 && hrefValue.indexOf('.pkg') === -1 && hrefValue.indexOf('.run') === -1 && hrefValue.indexOf('.zip') === -1 && hrefValue.indexOf('.tar.xz') === -1 && hrefValue.indexOf('.tar.gz') === -1 && hrefValue.indexOf('.deb') === -1 && hrefValue.indexOf('.rpm') === -1 && hrefValue.indexOf('.dmg') === -1 && hrefValue.indexOf('.dll') === -1 && hrefValue.indexOf('javascript:void(0)') === -1 && hrefValue.indexOf('../') === -1 && hrefValue.indexOf('.nvidia.fr/') === -1)) { $(this).removeAttr("onclick"); $(this).addClass("nonfrlinks"); $(".nav-header-item.search-item a, #frBtn-continue").removeClass("nonfrlinks"); } }); // Function to get a cookie function getCookie(name) { let cookieArr = document.cookie.split(";"); for (let i = 0; i < cookieArr.length; i++) { let cookiePair = cookieArr[i].split("="); if (name == cookiePair[0].trim()) { return decodeURIComponent(cookiePair[1]); } } return null; } // Function to set a cookie function setCookie(name, value, days) { let date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + date.toUTCString() + ";path=/"; } // Function to check if the popup should be shown function shouldShowPopup() { let currentPage = window.location.pathname; let popupCookie = getCookie("frDontShowPopup"); return popupCookie !== currentPage; } // Click handler for non-fr links $('.nonfrlinks, #unibrow-container .nonfrlinks').click(function (event) { if (shouldShowPopup()) { event.preventDefault(); $('#frPopup').show(); $('#frOverlay').show(); var sourceHref = $(this).attr('href'); $('#frBtn-continue').attr('href', sourceHref); } }); // Click handler for closing the popup $('#frClosePopup').click(function () { if ($('#frDontShowAgain').is(':checked')) { setCookie("frDontShowPopup", window.location.pathname, 30); // Set cookie for 30 days } $('#frPopup').hide(); $('#frOverlay').hide(); }); // Click handler for continuing from the popup $('#frBtn-continue').click(function () { if ($('#frDontShowAgain').is(':checked')) { setCookie("frDontShowPopup", window.location.pathname, 30); // Set cookie for 30 days $(this).removeClass("nonfrlinks"); } $('#frPopup').hide(); $('#frOverlay').hide(); }); // Click handler for clicking outside the popup $(document).mouseup(function (e) { var frPopup = $("#frPopup"); if (!frPopup.is(e.target) && frPopup.has(e.target).length === 0) { if ($('#frDontShowAgain').is(':checked')) { setCookie("frDontShowPopup", window.location.pathname, 30); // Set cookie for 30 days } frPopup.hide(); $('#frOverlay').hide(); } }); } // Function to set up MutationObserver function setupMutationObserver() { // Select the target node to observe // var targetNode = document.getElementById('unibrow-container'); var targetNode = document.getElementById('unibrow-container'); if (targetNode) { // Options for the observer (which mutations to observe) var config = { childList: true, // Observe direct children subtree: true // Also observe all descendants }; // Callback function to execute when mutations are observed var callback = function(mutationsList, observer) { for (var i = 0; i < mutationsList.length; i++) { var mutation = mutationsList[i]; if (mutation.type === 'childList') { if (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0) { executeLogic(); } } } }; // Create an observer instance linked to the callback function var observer = new MutationObserver(callback); // Start observing the target node for configured mutations observer.observe(targetNode, config); // Execute logic once initially executeLogic(); } else { // Execute logic if the target node does not exist executeLogic(); } } setTimeout(function () { executeLogic(); }, 2100); // Initial setup setupMutationObserver();