Suggestion: use the template for these high-frequency pages that shows timestamp of last edit, and how long it has been since the last edit. keep in mind, changes have to be made to the page in order for it to register the new timestamp. otherwise that's just a null edit.
local text = "Foo"
local namespace = "Bar"
-- "Bar:Foo"
local exists = mw.title.new( text, namespace ).exists
mw.log( exists )
On the template page, the invoke is not wrapped in <includeonly></includeonly>. and the module has required parameters which are not provided. that's why it says invalid.
Fandom doesn't have Echo extension, so that would not work on normal talk pages. Just use message wall or discussions, which has that functionality: @Ellis99
Also see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Cheatsheet
and https://regexr.com/ (check the "Explain" tab at the bottom)
\ means match the next character literally, in this case [, | and ] because they have special meaning in patterns.
() represents capture groups. We want to match the pagename "Armors" and any display text. And in the replacement text, these captured groups are used as $1 and $2.
[Aa] matches A or a, because MediaWiki pagenames are case-insensitive for the first character.
? means an optional preceding item, in this case the literal pipe. Without the question mark, links without the pipe would never match.
[^\]] means match characters that are not a ], because we're interested in capturing the display text, and brackets are not part of the display link.
* means match the preceding item (in this case, non-brackets) zero or more times, which allows it to match until the closing brackets of a link.
Also, I do hope your links don't do anything "fancy" like [[Armors|<nowiki>[[Foo]]</nowiki>]]... because that's gonna break the above pattern
:^)
Set Type to: Loose pages
Set Select Matching to: Regular expressions
Set Target Content to: \[\[([Aa]rmors)\|?([^\]]*)\]\]
Set Specific Instances to: nothing, unless you actually intended only the 2nd instance to be replaced (that means the first link does not get changed).
Set New Content to: [[:Category:$1|$2]]
Check your Page Entries to make sure they contain only the pagename and no forbidden characters.
Get the page ID via https://kingdomthegame.fandom.com/api.php?action=query&format=json&list=exturlusage&euquery=&eulimit=max
You will also need to "continue" the query when there are more pages than the max.
Anyway, here are the invalid namespace page IDs:
394: Special:Badtitle/NS2001:Questions and Answers/@comment-109.64.172.169-20160909144928
1972: Special:Badtitle/NS2001:Questions and Answers/@comment-68.105.65.63-20170726010116/@comment-32704847-20180430001237
2996: Special:Badtitle/NS2001:News and Announcements/@comment-2A02:560:4282:CC00:7412:CD40:BADF:4DD6-20181218102112
5779: Special:Badtitle/NS2001:Game Discussion/@comment-90.38.46.135-20200323154750/@comment-32704847-20200324175435
5779: Special:Badtitle/NS2001:Game Discussion/@comment-90.38.46.135-20200323154750/@comment-32704847-20200324175435
1972: Special:Badtitle/NS2001:Questions and Answers/@comment-68.105.65.63-20170726010116/@comment-32704847-20180430001237
1829: Special:Badtitle/NS2001:Questions and Answers/@comment-28434450-20180326173810/@comment-28434450-20180328202029
1189: Special:Badtitle/NS2001:Questions and Answers/@comment-68.105.65.63-20170726010116
5779: Special:Badtitle/NS2001:Game Discussion/@comment-90.38.46.135-20200323154750/@comment-32704847-20200324175435
As for checking the raw content, use the API. Or move the pages to a valid namespace using API and then edit in the API or in browser. (I'd also suggest removing all the talk subpages that have @comment in the name)
Yes, "sitewide" means for everyone visiting your wiki (site). "global" would be personal for every single wiki.
If you import all dev scripts sitewide, you violate ToU. If you import all scripts personally... then you might experience time dilation or something. Not sure, never tried. Feel free to report back on your findings if you manage to import all. :^)
For setting maxAge, you'd add to the config like this:
window.AddRailModule = [{prepend: true, maxAge: 0}];
You will also need to submit the sitewide JS for approval after you make changes to it.
As for the disappearing module, can you check the console for any errors when that happens? (On Firefox and Chrome, F12 to bring up the devtools and then switch to the console tab.)
Yeah, go ahead, I don't mind,
I'd recommend making your template accept a filename and wrap this filename in a div.
Example (Template:Music_player):
{{#if:{{{1|}}}|<div id="bruh">[[File:{{{1}}}]]</div>}}
Usage:
{{Music player|Music FireDojo.ogg}}
Generated HTML:
<div id="bruh"><audio src="https://static.wikia.nocookie.net/cp3d/images/e/ed/Music_FireDojo.ogg/revision/latest?cb=20210727135419" width="120" style="max-width: 100%; width: 120px;" controls="" preload="none"><a href="https://cp3d.fandom.com/wiki/File:Music_FireDojo.ogg">https://cp3d.fandom.com/wiki/File:Music_FireDojo.ogg</a></audio></div>
This allows the wiki to generate a sanitized file URL. Next, you'd use JS to manipulate the generated element, and aborting early anytime something isn't right (e.g. there is no audio element found in the wrapper):
$(function() {
var isPlayerPaused = true;
function playAudio() {
$('#player')[0].play();
$('#play-audio').css('display', 'none');
$('#pause-audio').css('display', 'inline-block');
isPlayerPaused = false;
}
function pauseAudio() {
$('#player')[0].pause();
$('#play-audio').css('display', 'inline-block');
$('#pause-audio').css('display', 'none');
isPlayerPaused = true;
}
function init() {
var bruh = $('#bruh');
if (!bruh.length) return; // abort
var oldAudio = $('#bruh > audio');
if (!oldAudio.length) return; // abort
var src = $(oldAudio[0]).attr('src');
var musicPlayerElement = $('<div>', { id: 'music-player' });
var newAudio = $('<audio>', {
id: 'player',
loop: true,
src: src,
});
var playAudioButton = $('<div>', {
id: 'play-audio',
style: 'display:inline-block;',
on: {click: playAudio}
}).append($('<img>', {
src: 'https://static.wikia.nocookie.net/cp3d/images/d/df/Record-whenpaused.png/',
height: '100px'
}));
var pauseAudioButton = $('<div>', {
id: 'pause-audio',
style: 'display:none;',
on: {click: pauseAudio}
}).append($('<img>', {
src: 'https://static.wikia.nocookie.net/cp3d/images/1/1a/Record-whenplaying.gif/revision/latest?cb=20221209221613',
height: '100px'
}));
var controlWrapper = $('<div>').append([
playAudioButton,
pauseAudioButton,
]);
var section = $('<section>').append([
newAudio,
controlWrapper,
]);
musicPlayerElement.append(section);
bruh.empty();
bruh.append(musicPlayerElement);
}
init();
});
Do note that sometimes the module does not get "misinterpreted" as wikitext, so relying on this quirk to add backlinks or categories is not recommended. I'd instead recommend placing all categories for the module itself on the /doc subpage wrapped in <includeonly> (so that the /doc subpage does not get added to the same category as the module itself -- same practice as templates with /doc subpages). For auto-categories that get added by the module (to categorize the page it gets invoked on), add that to the string returned by the invoked function.
"docstyle" (via Dev:Docbunto) means that you can update the module and the documentation in one single edit.
Re: ScribuntoUnit/config
Maybe we can have it default to importing the copy from dev if a local copy does not exist?
Re: <nowiki>
Wrapping code in <nowiki> or <pre> tags:
-- <nowiki>
-- </nowiki>
Required when the module contains text that may be interpreted as wikitext, for example:
-- this is interpreted as wikitext [['..foo..']]
-- and if it doesn't exist on your wiki then
-- it becomes a wanted page
local foo = "???"
mw.log('[['..foo..']]')
Yes, site-wide JS can only be modified by admins. You'll have to contact your active admins, if any.
JS will run on the entire page, but you may target specific elements within the page (e.g. <div id="some_placeholder">) and update its contents:
$('div#some_placeholder').text('hello world');
As for the JS/bot that Kocka mentioned:
The JS runs site-wide, fetches data from Steam API, and updates specific elements within the page. Advantage is it puts less stress on the wiki servers since you can have it update asynchronously; disadvantage is if Steam API requires an API token that you are not permitted to share, then no one else may run the script as well as if the JS is disabled then you won't have access to these numbers.
The external application (bot) fetches data from Steam API, and updates some page (e.g. a Lua module or the game page itself) via the wiki API. The advantage of this is, you're not sharing API token with other users and there's less network requests hitting the Steam API; disadvantage is if anything ever happens to the person updating the data ("thrown under the bus"), as well as it's not asynchronous (so you'll be purging the page which could be strain on the wiki servers).
Why not move all card data inside Module:Cards/data?
Module:Cards/data:
local data = {
{
no = "1",
name = "Secret Special Training", -- Shouldn't this be "Secret Training" ...?
character = "Sakuya Sakuma",
rarity = "SSR",
pagename = "Sakuya Sakuma SSR 【Secret Training】",
icon = "Sakuya Sakuma SSR Secret Training",
},
}
return data
Module:Cards:
local p = {}
function p.get(frame)
local info = frame.args[1]
local id = tonumber(frame.args[2])
local cards = mw.loadData("Module:Cards/data")
local card = cards[id]
if not card then
return 'No Card'
end
return '[[File:'..card.icon.. ' unbloomed icon.png|35px|link='..card.pagename..']]'
end
return p
Sitewide JS runs for all users viewing the wiki in desktop mode, but is limited to what it's allowed to do. You're probably thinking of personal JS, which has more freedom of what it is allowed to do.
As for grabbing data from SteamDB, that's not permitted. Grab the data directly from Steam instead:
> Can I use auto-refreshing plugins or automatically scrape/crawl SteamDB?
> No, there's a chance you'll get automatically banned for doing so.
> We also do not allow scraping/crawling on SteamDB. Please get the information from Steam itself, take a look at "How are we getting this information?" question above for more information.
Your module is trying to use DPL, which isn't enabled on your wiki: https://roblox.fandom.com/pt-br/wiki/Especial:Vers%C3%A3o
Send in a request ticket: https://support.fandom.com/hc/en-us/requests/new?ticket_form_id=360000931354
Edit: I had a better look at your module, and because DPL isn't enabled, your Module:DPL is doing an infinite loop, because
{{#dpl: | count = 500 | format = ,,%PAGE%#, | noresultsheader = <no-results> | category = Páginas de jogadores }}
doesn't equal
<no-results>
and that's probably straining the servers.
What's the reason for Global_Lua_Modules/Hlist by the way?
Module:Hlist doesn't exist but Module:List does, and the styles inside MediaWiki:Global_Lua_Modules/Hlist.css are mostly in MediaWiki:Global_Lua_Modules/List.css.