MediaWiki:Common.js: Difference between revisions

enhance the test for MainPage so that AB test code is only loaded in Production environment
(Extract A/B testing code to it's own file, and conditionally load for Main_Pages only)
Tag: Replaced
(enhance the test for MainPage so that AB test code is only loaded in Production environment)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */


// Only load the A/B testing code for pages with 'Main_Page' in the title
// Only load the A/B testing code for pages with 'Main_Page' in the title in Production
if (/Main_Page/.test(document.location.href)) {
if ( (/Main_Page/.test(document.location.href)) && (document.location.origin == 'https://www.familysearch.org') ) {
mw.loader.load( '/wiki/en/index.php?title=MediaWiki:ABTest.js&action=raw&ctype=text/javascript' );
mw.loader.load( '/wiki/en/index.php?title=MediaWiki:ABTest.js&action=raw&ctype=text/javascript' );
}
}
53,890

edits