Jump to content

MediaWiki:Common.js: Difference between revisions

From National War Memorial
Created page with " // Scroll to top on page load or refresh window.addEventListener('load', function() { window.scrollTo({ top: 0, behavior: 'smooth' }); }); →--- VERIFIED BADGE SCRIPT (Twitter-style, inline with title) ---: mw.loader.using('mediawiki.util').then(function () { $(function () { →Badge + Popup HTML (matches your CSS exactly): const badgeHTML = ` <span class="verified-badge" aria-label="Verified"> <img class="badge-icon" s..."
 
No edit summary
Line 29: Line 29:
              
              
             <div class="popup-text">
             <div class="popup-text">
Profiles or memorials marked with the Blue Tick have been officially verified by <a href="#">NationalWarMemorial.org.</a> Verification confirms the authenticity of the martyr’s identity, service details, and records, based on official documents, family validation, or authorized sources.
Profiles or memorials marked with the Blue Tick have been officially verified by <a href="https://nationalwarmemorial.org/">NationalWarMemorial.org.</a> Verification confirms the authenticity of the martyr’s identity, service details, and records, based on official documents, family validation, or authorized sources.
             </div>
             </div>
           </div>
           </div>

Revision as of 13:05, 21 December 2025


// Scroll to top on page load or refresh
window.addEventListener('load', function() {
    window.scrollTo({ top: 0, behavior: 'smooth' });
});



/* --- VERIFIED BADGE SCRIPT (Twitter-style, inline with title) --- */
mw.loader.using('mediawiki.util').then(function () {
  $(function () {

    /* Badge + Popup HTML (matches your CSS exactly) */
    const badgeHTML = `
      <span class="verified-badge" aria-label="Verified">
        <img class="badge-icon" 
             src="https://upload.wikimedia.org/wikipedia/commons/e/e4/Twitter_Verified_Badge.svg" 
             width="20" height="20" 
             alt="Verified">

        <div class="verified-popup" role="dialog" aria-hidden="true">
          <div class="popup-title">Verified</div>

          <div class="popup-description">
            <img class="inline-verified-icon"
                 src="https://upload.wikimedia.org/wikipedia/commons/e/e4/Twitter_Verified_Badge.svg"
                 width="16" height="16"
                 alt="Verified icon">
            
            <div class="popup-text">
Profiles or memorials marked with the Blue Tick have been officially verified by <a href="https://nationalwarmemorial.org/">NationalWarMemorial.org.</a> Verification confirms the authenticity of the martyr’s identity, service details, and records, based on official documents, family validation, or authorized sources.
            </div>
          </div>
        </div>
      </span>
    `;

    /* Add badge inline with page title */
    const heading = $(".firstHeading");
    heading.css({
      "display": "inline-flex",
      "align-items": "center",
      "gap": "6px"
    });

    heading.append(badgeHTML);

  });
});