非自有公共站点鼠标悬停提示框固定显示方法咨询
Hey there! Since you're new to JavaScript and working with a public chat site you don't own, let's walk through a straightforward, temporary fix to keep those like popups visible and extract the usernames you need. No fancy permanent changes—just one-page tweaks using your browser's dev tools.
Step 1: Force Load All Like Popup Content
The site only loads the list of users who liked a comment when you hover over the like count. We can bypass that by manually triggering the load function for every like button on the page:
// Loop through every like button container document.querySelectorAll('.like-popup-box').forEach(box => { // Grab the hover-init function from the element's attributes const hoverTrigger = box.getAttribute('onmouseover'); if (hoverTrigger) { // Extract the function call (e.g., initLikeBox(this,'#wall_44715839',8,44715839)) const functionCall = hoverTrigger.match(/initLikeBox\(.*?\)/)[0]; // Run the function, making sure it uses the correct button as context const runLoad = new Function(`return ${functionCall.replace('this', 'box')}`); runLoad(); } });
To use this: Open your browser's dev tools (press F12), go to the Console tab, paste this code, and hit Enter. All like popups will load their user data automatically, no hovering required.
Step 2: Make All Popups Stay Visible
Now that the data is loaded, we need to stop the popups from hiding when you move your mouse away:
// Show every loaded like popup document.querySelectorAll('.like-boxes').forEach(popup => { popup.style.display = 'block'; // Remove any mouse-out events that would hide the popup popup.onmouseout = null; popup.parentElement.onmouseout = null; });
If the site uses jQuery (you can check by typing $ in the console—no error means yes), you can use this shorter version:
$('.like-boxes').show().off('mouseout'); $('.like-popup-box').off('mouseout');
Step 3: Extract or Display Usernames
Option A: Extract Usernames to Copy Easily
Once popups are visible, you can either select all page text (Ctrl+A) and copy, or use this code to pull all usernames into a neat list at the bottom of the page:
// Collect all usernames const allLikers = []; document.querySelectorAll('.like-people-block').forEach(block => { const username = block.textContent.trim(); if (username) allLikers.push(username); }); // Add a list of usernames to the page for easy copying const likerList = document.createElement('ul'); likerList.style.cssText = 'position: fixed; bottom: 20px; left: 20px; background: white; padding: 10px; border: 1px solid #ccc; z-index: 9999'; allLikers.forEach(name => { const listItem = document.createElement('li'); listItem.textContent = name; likerList.appendChild(listItem); }); document.body.appendChild(likerList);
Option B: Save as a Bookmark for Quick Use
If you need to do this often, turn the code into a bookmarklet (a bookmark that runs JavaScript):
- Create a new bookmark in your browser
- Paste this as the URL:
javascript:(function(){document.querySelectorAll('.like-popup-box').forEach(box=>{const hoverTrigger=box.getAttribute('onmouseover');if(hoverTrigger){const functionCall=hoverTrigger.match(/initLikeBox\(.*?\)/)[0];const runLoad=new Function(`return ${functionCall.replace('this','box')}`);runLoad();}});document.querySelectorAll('.like-boxes').forEach(popup=>{popup.style.display='block';popup.onmouseout=null;popup.parentElement.onmouseout=null;});})();
Now just click the bookmark whenever you're on the site, and all like popups will load and stay visible.
Quick Notes for Newbies
- All these changes are temporary—refresh the page, and everything goes back to normal (no harm done to the site).
- If the site loads more comments as you scroll, run the Step 1 code again after scrolling to load popups for new comments.
内容的提问来源于stack exchange,提问作者Noobtac

