MediaWiki:Common.js

Revision as of 13:29, 5 December 2024 by Tegnosis (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.
window.addEventListener('load', function() {
    // Remove the content of elements with the class 'goog-logo-link'
    document.querySelectorAll('.goog-logo-link').forEach(function(element) {
        element.innerHTML = '';
    });

    // Replace the innerHTML of elements with the class 'goog-te-gadget' with their children
    document.querySelectorAll('.goog-te-gadget').forEach(function(element) {
        let children = Array.from(element.children);
        element.innerHTML = '';
        children.forEach(function(child) {
            element.appendChild(child);
        });
    });
});


/* Add Adobe Analytics Tracking Details 2022-11-17 */
// First listen to an event that is fired when the FS object is available
window.addEventListener('ExReady', function(){
  
  // Call setTimeout to avoid a flaw in FS that triggers infinite recursion
  setTimeout(function(){

    // Now configure the page data and manually trigger the page view
    FS.Analytics.updatePageViewData({
	  page_channel: 'Wiki',
	  page_detail: 'Wiki Test'
    });
    FS.Analytics.trackPageView();
  });
});
/* End Adobe Analytics Tracking Details */

/* Fix for <imagemap>s to prevent them from resizing  */
$( document ).ready(function() {
    $('[usemap]').each(function() {
        $(this).css('min-width', parseInt($(this).attr('width')));
    });
});

/* Add obvious background color to Beta  */
if (document.location.origin.indexOf("beta") > -1) {
    document.getElementById("mw-head").style.backgroundColor = "#ffb3b3";
}