User:Rurin/timeless.js: Difference between revisions
From Tardis Wiki, the free Doctor Who reference
(Created page with "→############################################: →### ProfileTags ###: →### User:RurinGas ###: →############################################: $(function ($) { 'use strict'; var conf = mw.config.get([ 'wgTitle' ]); var params = { action: 'raw', title: 'MediaWiki:ProfileTags' }; $.get(mw.util.wikiScript(), params, function (data) { if (!data.length) {...") |
(No difference)
|
Revision as of 11:20, 26 February 2024
/* ############################################ */
/* ### ProfileTags ### */
/* ### User:RurinGas ### */
/* ############################################ */
$(function ($) {
'use strict';
var conf = mw.config.get([
'wgTitle'
]);
var params = {
action: 'raw',
title: 'MediaWiki:ProfileTags'
};
$.get(mw.util.wikiScript(), params, function (data) {
if (!data.length) {
return;
}
var escapeRegExp = mw.util.escapeRegExp || (mw.RegExp || {}).escape,
user = escapeRegExp(conf.wgTitle),
re = new RegExp('(?:^|\\n)\\s*' + user + '\\s*\\|\\s*(.*?)\\s*(?:\\n|$)'),
match = re.exec(data);
if (match !== null) {
var profileTags = match[1].split(/\s*,\s*/);
insertTextString(profileTags);
}
});
function insertTextString(profileTags) {
var tardisProfileTag = document.createElement("p");
tardisProfileTag.id = 'tardisProfileTag';
var textToInsert = 'TARDIS';
tardisProfileTag.innerHTML = textToInsert;
$('.mw-page-title-main').append(tardisProfileTag);
}
});