MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 57: | Line 57: | ||
}); | }); | ||
| Line 64: | Line 71: | ||
$(document).ready(function () { | $(document).ready(function () { | ||
// | var namespace = mw.config.get('wgNamespaceNumber'); | ||
var pageName = mw.config.get('wgPageName'); | |||
// ✅ Condition: | |||
// 1. Main namespace (Articles) | |||
// 2. OR Main Page | |||
if (namespace !== 0 && pageName !== 'Home') { | |||
return; // बाकी pages पर नहीं दिखेगा | |||
} | |||
var banner = '<div id="promo-banner-bottom" style="margin-top:30px;"></div>'; | var banner = '<div id="promo-banner-bottom" style="margin-top:30px;"></div>'; | ||
var content = document.querySelector('#mw-content-text'); | var content = document.querySelector('#mw-content-text'); | ||
if (content) { | if (content) { | ||
content.insertAdjacentHTML('beforeend', banner); | content.insertAdjacentHTML('beforeend', banner); | ||
$('#promo-banner-bottom').load('/index.php?title=Template:PromotionBanner&action=render'); | $('#promo-banner-bottom').load('/index.php?title=Template:PromotionBanner&action=render'); | ||
} | } | ||