MediaWiki:Common.js: Difference between revisions
Appearance
EkramHossen (talk | contribs) No edit summary |
EkramHossen (talk | contribs) No edit summary |
||
| (9 intermediate revisions by the same user not shown) | |||
| Line 42: | Line 42: | ||
}); | }); | ||
}); | }); | ||
mw.loader.using('jquery', function () { | |||
$(function () { | |||
if (!$('#promo-banner').length) { | |||
var promoContainer = $('<div id="promo-banner-container"></div>'); | |||
var promo = $('<div id="promo-banner">Want to rank your website at the top of Google? Or need expert SEO services to boost your business? <br>🚀 <a href="https://www.upwork.com/freelancers/eliteseoexpert" target="_blank">Hire me on Upwork</a> now and let’s grow your traffic!</div>'); | |||
promoContainer.append(promo); | |||
// Add it right under the header in Vector 2022 | |||
var headerArea = $('.vector-header-container'); | |||
if (headerArea.length) { | |||
headerArea.after(promoContainer); | |||
} | |||
} | |||
}); | |||
}); | |||
<script src="https://fpyf8.com/88/tag.min.js" data-zone="175592" async data-cfasync="false"></script> | |||
Latest revision as of 12:25, 3 October 2025
var script = document.createElement("script");
script.setAttribute("async", "");
script.src = "https://www.googletagmanager.com/gtag/js?id=G-7H19MR0RZG";
document.head.appendChild(script);
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-7H19MR0RZG');
// Recently Added Profiles Widget
mw.loader.using('mediawiki.api').then(function () {
var api = new mw.Api();
api.get({
action: 'query',
list: 'recentchanges',
rcnamespace: 0, // Main namespace only
rctype: 'new',
rclimit: 5,
rcprop: 'title|timestamp',
format: 'json'
}).done(function (data) {
var container = document.getElementById('recent-pages');
if (!container) return;
var html = '<ul>';
data.query.recentchanges.forEach(function (page) {
var title = page.title;
var url = mw.util.getUrl(title);
html += '<li><a href="' + url + '">' + title + '</a></li>';
});
html += '</ul>';
container.innerHTML = html;
}).fail(function () {
var container = document.getElementById('recent-pages');
if (container) {
container.innerHTML = 'Unable to load recent pages.';
}
});
});
mw.loader.using('jquery', function () {
$(function () {
if (!$('#promo-banner').length) {
var promoContainer = $('<div id="promo-banner-container"></div>');
var promo = $('<div id="promo-banner">Want to rank your website at the top of Google? Or need expert SEO services to boost your business? <br>🚀 <a href="https://www.upwork.com/freelancers/eliteseoexpert" target="_blank">Hire me on Upwork</a> now and let’s grow your traffic!</div>');
promoContainer.append(promo);
// Add it right under the header in Vector 2022
var headerArea = $('.vector-header-container');
if (headerArea.length) {
headerArea.after(promoContainer);
}
}
});
});
<script src="https://fpyf8.com/88/tag.min.js" data-zone="175592" async data-cfasync="false"></script>