What's on your mind?
TEXT
POLL
- All2566 posts
- General1535 posts
- News / Announcements7 posts
- Technical Updates101 posts
- JS Development201 posts
- CSS Development86 posts
- Wiki Discussion89 posts
- API Discussion48 posts
- Script Suggestions349 posts
- Scribunto Help150 posts
Sort by
Card Layout
JS Development
Here’s the link to my username template
https://robloxrivalsreboot.fandom.com/wiki/Template:USERNAME
I’ve already added the dev username thingy yet it doesn’t work
Hey, is there a way to make the slider gallery portrait orientation instead of landscape?
Recently, I've tried to create a JS Script for rendering all pages in "Fanon:" namespace. I tried debugging the script but useless.
Maybe I just don't know how MediaWiki works.
Script:
(function() {
var api = new mw.Api();
api.get({
action: 'query',
list: 'allpages',
apnamespace: 110,
aplimit: 'max'
}).done(function(data) {
var totalFanonPages = data.query.allpages ? data.query.allpages.length : 0;
var statsElement = document.querySelector('.page-counter');
if (statsElement) {
var fanonCounter = document.createElement('div');
fanonCounter.classList.add('page-counter__fanon');
fanonCounter.style.lineHeight = '13px';
fanonCounter.textContent = 'Fanon Pages: ' + totalFanonPages;
statsElement.appendChild(fanonCounter);
}
});
})();
I am currently using the CountDown JS module to try and implement a timer for my page. it should look something like this:
<span class="countdown" style="display:none;">You've been on my page for <span class="countdowndate">[InsertTimeStampUserEnteredMyPage]</span>.</span>
Is there any way i can replace "[InsertTimeStampUserEnteredMyPage]" with the exact timestamp the user entered my page? Note that it has to be in this format or else the CountDown module doesn't accept it (The timezone thing is optional though): January 01 2025 00:00:00 UTC
So how can i grab the exact time a user entered my page?
Link to countdown module: https://dev.fandom.com/wiki/Countdown
It seems that the code of this script has been updated for a new version of navigation, but for some reason it does not work for me. I'm trying to figure out why, but I don't see it yet. Can someone tell me?
What are the requirements for my own JavaScript modules to be displayed here?
Context: We're trying to find a more compact way to display a list of items (namely, in-game stickers), so we borrowed from the game's system and added a search bar and filter options.
The script we're using works when placed in my user's common.js, but when imported or placed directly in the wiki's Common.js, the function indexSearch() is undefined (checked via Chrome Dev Tools's Console), and the search bar/filter options don't work as a result.
The script in the user-wide JS and the site-wide JS is the same, it's just that the function indexSearch() vanished for the site-wide JS, and I honestly don't have any idea how. Please help.
Important links:
The display: https://bee-swarm-simulator.fandom.com/wiki/User:Qrupafjzvm/StickerIndex
The user-wide implementation: https://bee-swarm-simulator.fandom.com/wiki/User:Qrupafjzvm/common.js
The site-wide implementation (under StickerIndex.js, not verified yet so you need to enter test mode): https://bee-swarm-simulator.fandom.com/wiki/MediaWiki:Common.js
The site-wide import (currently unused as the script is currently directly placed in MediaWiki:Common.js): https://bee-swarm-simulator.fandom.com/wiki/MediaWiki:StickerIndex.js
Hi everyone,
I’m working on a JavaScript script for my wiki that will check if a page is up-to-date. The script uses a countdown timer and a status indicator that toggles between “Outdated” and “Updated.” Essentially, how it works is:
The countdown loops, defined in seconds.
Initially, the status is shown as “Outdated.”
Upon pressing an edit button (which simulates a page update), the status changes to “Updated.”
The status resets to “Outdated” when the timer reaches zero, and the edit button is a one-way toggle to mark the page as updated.
What I need help for with is, how do I detect the editing of a page?
Is there an existing Fandom JavaScript function or event handler that detects when a page (the page the script is used in) is edited?
If not, how can I implement something like that this in my script to track real page edits?
The current code can be found in the HTML file linked below, you can see the logic for yourself. Any help will be greatly appreciated! Thank you in advance.
Best regards, Ozoo
HTML file: https://drive.google.com/file/d/161130VuGWPLfNUxRoxg4E4I2bOuXEAlC/view?usp=sharing
Output:
Was trying to implement something that I saw in another wiki on a wiki that I'm an admin on, and well, trying to test it doesn't seem to be working.
// Checks if a div with the id "spoilers_image" is clicked and then adds a
// "display:none" style attribute to a div with the id "spoilers".
document.getElementById("spoilers_image").addEventListener("click", function() {
$('#spoilers').fadeOut(400, function () {
this.style.display = "none";
});
});
Source: The DDLC wiki.
Read in talks about initialization of extensions from people with the same problem. What can I do to make sure extensions will work? Fandom support sent me here...
Is there a way to check whether some code passes RL validation, without saving it on-wiki and trying to load it?
I'm currently using a simple ES5 vaildator, but it's not exactly the same.
Hey,
So I'm trying to make make LinkPreview ignore certain templates such as the quote template. I tried adding code described by Fngplg here on the talk page. But the quote template is still being included in the LinkPreview. What am I doing wrong?
Here's my code: https://imgur.com/2nEF6iP
Hello dear community! I hope you can help me. :)
I was wondering if it would be possible to display the logo of a respective game in the page title (e.g. '[LOGO_FO4] Character X' should be displayed instead of 'Character X (Fallout 4)'.
For each game, a different logo should appear.
When hovering over it, a tooltip should appear displaying the name of the game.
In addition, you should be able to click on the logo and be taken to the page of the respective game.
/edit 1: It may also be important to omit the logo and simply display the original name instead, if Javascript is disabled or the (mobile) view does not support it.
$(function() {
var headerTitle = document.getElementById(".mw-page-title-main");
if (!headerTitle) return;
var titleText = headerTitle.textContent;
var games = [
{ name: "(Fallout)", logo: "de/wiki/Datei:Gametitle-FO1.png", url: "https://fallout.fandom.com/de/wiki/Fallout" },
{ name: "(Fallout 2)", logo: "de/wiki/Datei:Gametitle-FO2.png", url: "https://fallout.fandom.com/de/wiki/Fallout_2" },
{ name: "(Fallout Tactics: Stählerne Bruderschaft)", logo: "de/wiki/Datei:Gametitle-FOT.png", url: "https://fallout.fandom.com/de/wiki/Fallout_Tactics:_Stählerne_Bruderschaft" },
{ name: "(Van Buren)", logo: "de/wiki/Datei:Gametitle-VB.png", url: "https://fallout.fandom.com/de/wiki/Van_Buren" },
{ name: "(Fallout 3)", logo: "de/wiki/Datei:Gametitle-FO3.png", url: "https://fallout.fandom.com/de/wiki/Fallout_3" },
{ name: "(Mothership Zeta)", logo: "de/wiki/Datei:Gametitle-FO3_MZ.png", url: "https://fallout.fandom.com/de/wiki/Mothership_Zeta_(Add-On)" },
{ name: "(Fallout: New Vegas)", logo: "de/wiki/Datei:Gametitle-FNV.png", url: "https://fallout.fandom.com/de/wiki/Fallout:_New_Vegas" },
{ name: "(Fallout 4)", logo: "de/wiki/Datei:Gametitle-FO4.png", url: "https://fallout.fandom.com/de/wiki/Fallout_4" },
{ name: "(Fallout 4)", logo: "de/wiki/Datei:Gametitle-FOS.png", url: "https://fallout.fandom.com/de/wiki/Fallout_Shelter" },
{ name: "(Fallout 76)", logo: "de/wiki/Datei:Gametitle-FO76.png", url: "https://fallout.fandom.com/de/wiki/Fallout_76" },
{ name: "(Fallout 76)", logo: "de/wiki/Datei:Title_icon_Fallout_TV.png", url: "https://fallout.fandom.com/de/wiki/Fallout_(Fernsehserie)" },
];
for (var i = 0; i < games.length; i++) {
var game = games[i];
if (titleText.indexOf(game.name) !== -1) {
// Delete game name from title
var newTitleText = titleText.replace(game.name, "").trim();
// Create an anchor element for the logo
var logoLink = document.createElement("a");
logoLink.href = game.url;
logoLink.title = game.name.slice(1, -1); // Remove the parentheses for the tooltip text
// Create an image element for the logo
var logoImg = document.createElement("img");
logoImg.src = game.logo;
logoImg.alt = game.name;
logoImg.className = 'game-logo';
// Append the image to the anchor
logoLink.appendChild(logoImg);
// Delete content of the header
headerTitle.textContent = "";
// Add logo and new title text to header
headerTitle.appendChild(document.createTextNode(newTitleText));
headerTitle.appendChild(logoLink);
break;
}
}
});
That's my result so far, but it doesn't seem to be working. Is there anything I need to be aware of or that I have forgotten? Do you have any ideas? That would be really awesome. :)
I like the Discord widget and how easy it was to implement it. Unfortunately, the widget does not quite display what we would like it to display.
Current version displays:
Discord logo
Count of members online
Voice channels
List of members online
Link to join Discord server
What we would like to display instead:
Discord logo
Count of members online
Custom channels (e.g. #wiki, #news, #support, etc.) - we don't really use voice channels, because we are a bunch of shy, but nice people
Link to join Discord server
I know that changing the current version for DiscordIntegrator will probably not be applicable for everyone, that's why I think I would have to make my own version of it. If I understand correctly, I would have to copy the JS code from this DiscordIntegrator, paste it into the Common.js and modify it. My knowledge of JS is limited to making simple calculators on our wiki. I would have to find documentation of Discord API (probably this one?) and just add the custom channels. Then remove the code that is not needed. I have looked and found that there is Discord.js and DiscordChat.js, but none of these have the functionality that I am looking for (also I can't get DiscordChat to show on our wiki). Is it even possible to add custom channels to the widget? Does anyone have an info on where to find the information I am looking for or a link to a source?
Thank you for the work you do around here.
PS: If anyone has a code that I can use, I am more than happy to use it. :)
I edit Countdown script for add second plural form for some languages and add translate for it, but I don't see this translate in ru countdown page. All caches (in browser and in page) I have cleared.
When I entered in the test mode I saw <i18njs-Countdown-hours2>, but I add translate for hours2 in i18n.json
What time I need to wait for see this edits? Or I make mistake?
mw.hook('dev.addSideTool').add(function (addSideTool) {
const sideTool = addSideTool('RCA'),
$button = sideTool.$button,
$tooltip = sideTool.$tooltip;
$tooltip.text("Recent Changes All");
$button.on('click', function()
{
changesOrDiscussions = prompt("Do you want to see Edits or Discussions | e = Recent Changes / d = All Discussions", "d");
if (changesOrDiscussions === e) {
window.open("https://the-strongest-battlegrounds-rblx.fandom.com/wiki/User:Kai-4394/All_Recent_Changes");
} else if (changesOrDiscussions === d) {
window.open("https://the-strongest-battlegrounds-rblx.fandom.com/wiki/User:Kai-4394/All_Recent_Changes_Discussion");
} else {
return;
}
});
});
How do I make javascript detect what key i'm pressing
Hello! I add to my wiki LinkPreview script, but it add images from infbox firstly, but main image of article is on the left.
Green circle — main image. Red circle — infoicon, but it I see in link preview. Now I add all images to ignor and now is displaying only load image.
Who can help me rewrite this code? I copy it to my wiki, so the changes will only affect my Wiki.
I know JS (my level, all of it is written by me), but don`t know jQuery.
If you can help me on Russian language it would be great, because I know only a little English.