MediaWiki:Common.js

From stencil.wiki
Revision as of 01:50, 14 January 2025 by IssuePress (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

document.addEventListener("DOMContentLoaded",function(){const e=document.querySelector("h2 > #Steps");console.log("Steps header:",e);if(e){const t=e.parentElement.nextElementSibling;console.log("Adjacent ordered list:",t);if(t&&t.tagName==="OL"){t.querySelectorAll("li").forEach((e,n)=>{console.log(`Processing <li> ${n+1}:`,e.textContent.trim());const t=e.textContent.trim(),o=t.indexOf(".")+1;if(o>0){const c=t.slice(0,o),l=t.slice(o).trim();e.innerHTML=`<strong>${c}</strong> ${l}`,console.log(`Updated <li> ${n+1}:`,e.innerHTML)}else console.log(`No sentence found in <li> ${n+1}`)})}else console.log("No <ol> found as the adjacent sibling of #Steps")}else console.log("No h2 > #Steps element found")});