MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 18: | Line 18: | ||
}); | }); | ||
/* === | /* === 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 & delivery services</a></li>' | |||
+ ' <li><a href="/wiki/Car_Sharing_Rental_Leasing">Car sharing, rental & leasing</a></li>' | |||
+ ' <li><a href="/wiki/E-Mobility_Management">E-mobility management</a></li>' | |||
+ ' <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-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 & 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 & 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> | + ' <div class="tg-bottom">' | ||
+ ' <div>Copyright © 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">▶</a>' | |||
+ ' <a href="https://instagram.com/" aria-label="Instagram">◉</a>' | |||
+ ' </div>' | |||
+ ' </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 | ||
if ( | mw.hook('wikipage.content').add(function () { insertFooter(); }); | ||
if (document.readyState === 'loading') { | |||
document.addEventListener('DOMContentLoaded', insertFooter); | |||
} else { | } else { | ||
insertFooter(); | |||
} | } | ||
}); | })(); | ||
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 & delivery services</a></li>'
+ ' <li><a href="/wiki/Car_Sharing_Rental_Leasing">Car sharing, rental & leasing</a></li>'
+ ' <li><a href="/wiki/E-Mobility_Management">E-mobility management</a></li>'
+ ' <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-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 & 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 & 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 © 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">▶</a>'
+ ' <a href="https://instagram.com/" aria-label="Instagram">◉</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();
}
})();