MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| 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'); | ||
} | } | ||
}); | |||
}); | |||
$(function () { | |||
if (typeof window.adsbygoogle === 'undefined') { | |||
return; | |||
} | |||
$('.marupedia-bio-ad ins.adsbygoogle').each(function () { | |||
var ad = this; | |||
if (ad.getAttribute('data-adsbygoogle-status')) { | |||
return; | |||
} | |||
try { | |||
(window.adsbygoogle = window.adsbygoogle || []).push({}); | |||
} catch (error) { | |||
console.warn('MaruPedia AdSense error:', error); | |||
} | |||
}); | }); | ||
}); | }); | ||