Jump to content

MediaWiki:Common.js: Difference between revisions

From Transight Wiki
No edit summary
No edit summary
Line 18: Line 18:
});
});


/* === Transightee footer injection === */
/* === Transight custom footer injection (works across skins & SPA nav) === */
mw.loader.using( ['mediawiki.util'] ).then(function () {
(function () {
  var $where = $('#mw-footer').length ? $('#mw-footer') : $('#footer'); // Vector 2022 / legacy
  function buildHTML() {
    var html = ''
      + '<div id="tg-footer" class="tg-footer">'
      + ' <div class="tg-inner">'
      + '   <div class="tg-grid">'


  var html = `
      + '      <div class="tg-col">'
  <div class="tg-footer" id="tg-footer">
      + '        <h3>Use Cases</h3>'
    <div class="tg-footer__inner">
      + '        <ul>'
       <div class="tg-footer__grid">
      + '          <li><a href="/wiki/All_Use_Cases">All use cases</a></li>'
      + '          <li><a href="/wiki/Fleet_Telematics">Fleet telematics</a></li>'
      + '          <li><a href="/wiki/Logistics_and_Delivery_Services">Logistics &amp; delivery services</a></li>'
      + '          <li><a href="/wiki/Car_Sharing_Rental_Leasing">Car sharing, rental &amp; leasing</a></li>'
      + '          <li><a href="/wiki/E-Mobility_Management">E-mobility management</a></li>'
      + '          <li><a href="/wiki/Utility_and_Emergency_Transport">Utility &amp; emergency transport</a></li>'
      + '          <li><a href="/wiki/Agriculture_Construction_Mining">Agriculture, construction &amp; mining</a></li>'
      + '          <li><a href="/wiki/Assets_and_Workforce">Assets &amp; workforce</a></li>'
       + '          <li><a href="/wiki/Driver_Safety">Driver safety</a></li>'
      + '        </ul>'
      + '      </div>'


        <div class="tg-footer__col">
      + '      <div class="tg-col">'
          <h3>Use Cases</h3>
      + '        <h3>Products</h3>'
          <ul>
      + '        <ul>'
            <li><a href="/wiki/All_Use_Cases">All use cases</a></li>
      + '          <li><a href="/wiki/Trackers">Trackers</a></li>'
            <li><a href="/wiki/Fleet_Telematics">Fleet telematics</a></li>
      + '          <li><a href="/wiki/Accessories">Accessories</a></li>'
            <li><a href="/wiki/Logistics_and_Delivery_Services">Logistics & delivery services</a></li>
      + '          <li><a href="/wiki/Solutions">Solutions</a></li>'
            <li><a href="/wiki/Car_Sharing_Rental_Leasing">Car sharing, rental & leasing</a></li>
      + '        </ul>'
            <li><a href="/wiki/E-Mobility_Management">E-mobility management</a></li>
      + '      </div>'
            <li><a href="/wiki/Utility_and_Emergency_Transport">Utility & emergency transport</a></li>
            <li><a href="/wiki/Agriculture_Construction_Mining">Agriculture, construction & mining</a></li>
            <li><a href="/wiki/Assets_and_Workforce">Assets & workforce</a></li>
            <li><a href="/wiki/Driver_Safety">Driver safety</a></li>
          </ul>
        </div>


        <div class="tg-footer__col">
      + '      <div class="tg-col">'
          <h3>Products</h3>
      + '        <h3>Support</h3>'
          <ul>
      + '        <ul>'
            <li><a href="/wiki/Trackers">Trackers</a></li>
      + '          <li><a href="/wiki/Product_Support">Product support</a></li>'
            <li><a href="/wiki/Accessories">Accessories</a></li>
      + '          <li><a href="/wiki/Wiki_Knowledge_Base">Wiki knowledge base</a></li>'
            <li><a href="/wiki/Solutions">Solutions</a></li>
      + '          <li><a href="/wiki/Community_Forum">Community forum</a></li>'
          </ul>
      + '          <li><a href="/wiki/Warranty_and_Repair">Warranty &amp; repair</a></li>'
        </div>
      + '          <li><a href="/wiki/EOL_Products">EOL products</a></li>'
      + '        </ul>'
      + '      </div>'


        <div class="tg-footer__col">
      + '      <div class="tg-col">'
          <h3>Support</h3>
      + '        <h3>About Us</h3>'
          <ul>
      + '        <ul>'
            <li><a href="/wiki/Product_Support">Product support</a></li>
      + '          <li><a href="/wiki/Mission_Vision_Values">Mission, vision &amp; values</a></li>'
            <li><a href="/wiki/Wiki_Knowledge_Base">Wiki knowledge base</a></li>
      + '          <li><a href="/wiki/Brand_Guidelines">Brand guidelines</a></li>'
            <li><a href="/wiki/Community_Forum">Community forum</a></li>
      + '          <li><a href="/wiki/Career">Career</a></li>'
            <li><a href="/wiki/Warranty_and_Repair">Warranty & repair</a></li>
      + '          <li><a href="/wiki/Contacts">Contacts</a></li>'
            <li><a href="/wiki/EOL_Products">EOL products</a></li>
      + '        </ul>'
          </ul>
      + '      </div>'
        </div>


        <div class="tg-footer__col">
      + '    </div>'
          <h3>About Us</h3>
          <ul>
            <li><a href="/wiki/Mission_Vision_Values">Mission, vision & values</a></li>
            <li><a href="/wiki/Brand_Guidelines">Brand guidelines</a></li>
            <li><a href="/wiki/Career">Career</a></li>
            <li><a href="/wiki/Contacts">Contacts</a></li>
          </ul>
        </div>


       </div>
       + '    <div class="tg-bottom">'
      + '      <div>Copyright &copy; 2024, Transightee</div>'
      + '      <div class="tg-social" aria-label="Social links">'
      + '        <a href="https://facebook.com/" aria-label="Facebook">f</a>'
      + '        <a href="https://linkedin.com/" aria-label="LinkedIn">in</a>'
      + '        <a href="https://twitter.com/" aria-label="X/Twitter">x</a>'
      + '        <a href="https://youtube.com/" aria-label="YouTube">&#9654;</a>'
      + '        <a href="https://instagram.com/" aria-label="Instagram">&#9673;</a>'
      + '      </div>'
      + '    </div>'


       <div class="tg-footer__bottom">
       + '  </div>'
        <div>Copyright © 2024, Transightee</div>
      + '</div>';
        <div class="tg-social">
    return html;
          <a href="https://facebook.com/" aria-label="Facebook">f</a>
  }
          <a href="https://linkedin.com/" aria-label="LinkedIn">in</a>
 
          <a href="https://twitter.com/" aria-label="X/Twitter">x</a>
  function containerEl() {
          <a href="https://youtube.com/" aria-label="YouTube">▶</a>
    return document.querySelector('footer.mw-footer, #footer, #mw-footer, #page-footer, #minerva-footer') || document.body;
          <a href="https://instagram.com/" aria-label="Instagram">◎</a>
  }
        </div>
 
      </div>
  function insertFooter() {
     </div>
    if (document.getElementById('tg-footer')) { return; }  // avoid duplicates on SPA nav
   </div>`;
    var el = document.createElement('div');
    el.innerHTML = buildHTML();
    var parent = containerEl();
     parent.appendChild(el.firstChild);
   }


   // Insert our footer at the very end of the page
   // Run on initial load + every PJAX navigation
   if ($where.length) {
  mw.hook('wikipage.content').add(function () { insertFooter(); });
     $where.append(html);
   if (document.readyState === 'loading') {
     document.addEventListener('DOMContentLoaded', insertFooter);
   } else {
   } else {
     // Fallback if a skin doesn't have #mw-footer/#footer
     insertFooter();
    $('body').append(html);
   }
   }
});
})();

Revision as of 06:14, 1 September 2025

$(document).ready(function() {
  $('input#searchInput').attr('placeholder', 'Search for Transight Wiki');
});

// Open all external links in a new tab
$(document).ready(function () {
    $("a.external").attr("target", "_blank");
});

mw.loader.using('mediawiki.util', function () {
    // Force small text
    document.documentElement.classList.remove('vector-feature-custom-font-size-standard', 'vector-feature-custom-font-size-large');
    document.documentElement.classList.add('vector-feature-custom-font-size-small');

    // Force wide layout
    document.documentElement.classList.remove('vector-feature-limited-width');
    document.documentElement.classList.add('vector-feature-wide-width');
});

/* === Transight custom footer injection (works across skins & SPA nav) === */
(function () {
  function buildHTML() {
    var html = ''
      + '<div id="tg-footer" class="tg-footer">'
      + '  <div class="tg-inner">'
      + '    <div class="tg-grid">'

      + '      <div class="tg-col">'
      + '        <h3>Use Cases</h3>'
      + '        <ul>'
      + '          <li><a href="/wiki/All_Use_Cases">All use cases</a></li>'
      + '          <li><a href="/wiki/Fleet_Telematics">Fleet telematics</a></li>'
      + '          <li><a href="/wiki/Logistics_and_Delivery_Services">Logistics &amp; delivery services</a></li>'
      + '          <li><a href="/wiki/Car_Sharing_Rental_Leasing">Car sharing, rental &amp; leasing</a></li>'
      + '          <li><a href="/wiki/E-Mobility_Management">E-mobility management</a></li>'
      + '          <li><a href="/wiki/Utility_and_Emergency_Transport">Utility &amp; emergency transport</a></li>'
      + '          <li><a href="/wiki/Agriculture_Construction_Mining">Agriculture, construction &amp; mining</a></li>'
      + '          <li><a href="/wiki/Assets_and_Workforce">Assets &amp; workforce</a></li>'
      + '          <li><a href="/wiki/Driver_Safety">Driver safety</a></li>'
      + '        </ul>'
      + '      </div>'

      + '      <div class="tg-col">'
      + '        <h3>Products</h3>'
      + '        <ul>'
      + '          <li><a href="/wiki/Trackers">Trackers</a></li>'
      + '          <li><a href="/wiki/Accessories">Accessories</a></li>'
      + '          <li><a href="/wiki/Solutions">Solutions</a></li>'
      + '        </ul>'
      + '      </div>'

      + '      <div class="tg-col">'
      + '        <h3>Support</h3>'
      + '        <ul>'
      + '          <li><a href="/wiki/Product_Support">Product support</a></li>'
      + '          <li><a href="/wiki/Wiki_Knowledge_Base">Wiki knowledge base</a></li>'
      + '          <li><a href="/wiki/Community_Forum">Community forum</a></li>'
      + '          <li><a href="/wiki/Warranty_and_Repair">Warranty &amp; repair</a></li>'
      + '          <li><a href="/wiki/EOL_Products">EOL products</a></li>'
      + '        </ul>'
      + '      </div>'

      + '      <div class="tg-col">'
      + '        <h3>About Us</h3>'
      + '        <ul>'
      + '          <li><a href="/wiki/Mission_Vision_Values">Mission, vision &amp; values</a></li>'
      + '          <li><a href="/wiki/Brand_Guidelines">Brand guidelines</a></li>'
      + '          <li><a href="/wiki/Career">Career</a></li>'
      + '          <li><a href="/wiki/Contacts">Contacts</a></li>'
      + '        </ul>'
      + '      </div>'

      + '    </div>'

      + '    <div class="tg-bottom">'
      + '      <div>Copyright &copy; 2024, Transightee</div>'
      + '      <div class="tg-social" aria-label="Social links">'
      + '        <a href="https://facebook.com/" aria-label="Facebook">f</a>'
      + '        <a href="https://linkedin.com/" aria-label="LinkedIn">in</a>'
      + '        <a href="https://twitter.com/" aria-label="X/Twitter">x</a>'
      + '        <a href="https://youtube.com/" aria-label="YouTube">&#9654;</a>'
      + '        <a href="https://instagram.com/" aria-label="Instagram">&#9673;</a>'
      + '      </div>'
      + '    </div>'

      + '  </div>'
      + '</div>';
    return html;
  }

  function containerEl() {
    return document.querySelector('footer.mw-footer, #footer, #mw-footer, #page-footer, #minerva-footer') || document.body;
  }

  function insertFooter() {
    if (document.getElementById('tg-footer')) { return; }   // avoid duplicates on SPA nav
    var el = document.createElement('div');
    el.innerHTML = buildHTML();
    var parent = containerEl();
    parent.appendChild(el.firstChild);
  }

  // Run on initial load + every PJAX navigation
  mw.hook('wikipage.content').add(function () { insertFooter(); });
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', insertFooter);
  } else {
    insertFooter();
  }
})();