User:SBisson (WMF)/facts.js

/**
 * Fact Cards - The sun never sets on facts
 * Inukathon March 13-17 2023
 * Eduardo Medina
 * Huei Tan
 * Stephane Bisson
 * Load it on your favorite Wikipedia by adding
 * mw.loader.load( 'https://www.mediawiki.org/w/index.php?title=User:SBisson_(WMF)/fact_cards.js&action=raw&ctype=text/javascript' );
 * to /Special:MyPage/common.js
 * to /Special:MyPage/common.js

// --- Variables ---

const fallbackImage = 'Noun_Fact_3331495.svg';

// --- Functions ---

function isArticleView { return ( mw.config.get( 'wgAction' ) === 'view' ) && ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) && ( mw.config.get('wgArticleId') > 0 ); }

// --- Main program ---

if ( isArticleView ) { console.log( 'Fact Cards - init' ); }