arie_cristianD

auto show login popup on few minutes

Jul 29th, 2025
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.     function triggerPopupClick() {
  3.         const body = document.body;
  4.  
  5.         // Check if it's a single post page and the user is not logged in
  6.         const isSinglePost = body.classList.contains('single') && body.classList.contains('single-post');
  7.         const isLoggedIn = body.classList.contains('logged-in');
  8.  
  9.         if (isSinglePost && !isLoggedIn) {
  10.             const popupLink = document.querySelectorAll('.jeg_popuplink')[0]; // Get the first matching element
  11.  
  12.             if (popupLink) {
  13.                 // Wait 3 minutes before triggering the click event
  14.                 setTimeout(() => {
  15.                     popupLink.click();
  16.                 }, 180000); // 180,000 ms = 3 minutes
  17.             }
  18.         }
  19.     }
  20.  
  21.     // Run the function when DOM is ready
  22.     if (document.readyState === 'loading') {
  23.         document.addEventListener('DOMContentLoaded', triggerPopupClick);
  24.     } else {
  25.         triggerPopupClick();
  26.     }
  27. })();
  28.  
Advertisement
Add Comment
Please, Sign In to add comment