Wikia Developers Wiki


909pages on
this wiki
Add New Page
Talk7 Share

This script checks that users have signed (~~~~) their talk page replies when they hit Publish. If there is no signature wikicode on the page then it will throw up a confirmation box warning them about it and asking if they are sure they want to proceed anyway. [Minor edits do not trigger the signing warning]

It also detects the creation of Forum pages without the {{Forumheader}} template being present on it, since some users inexplicably choose to delete the header before submitting their post.


Just add the appropriate line to your importArticles call in MediaWiki:Common.js:

	type: 'script',
	articles: [
		// ...
		// ...
importArticles — Best Practices for installing JavaScript on Fandom
The importArticles statement is designed to combine multiple HTTP requests into a single data transfer, allowing multiple scripts to load and execute faster. If you've been installing several different scripts, your JavaScript file has probably accumulated unnecessary import statements. Click "Expand" to learn how to efficiently batch import scripts to speed up performance and make your code look cleaner. One other approach is by using the MediaWiki:ImportJS.
If your JavaScript file has several lines of code that say importScript, importScriptPage, or importArticles, you may be able to combine them! By batch importing a collection of scripts with a single import, your JavaScript code will load faster and look cleaner. Consider the example below. On the left is an example of what your JavaScript file might currently look like. On the right is how you could improve that code.
Multiple imports — messy and slow One import — clean and efficient
  type: 'script',
  article: 'u:dev:FloatingToc/code.js'
importScriptPage('page1.js', 'wikiname');
importScriptPage('page2.js', 'wikiname');
    type: 'script',
    articles: [
Note: In this example, pay close attention to the placement of commas and other punctuation. For people who aren't familiar with programming (and even those who are!), a common mistake when writing code is to accidentally delete, forget, or misplace critical symbols like commas or quotation marks. This can cause a syntax error that breaks the code. Carefully follow the convention shown here when using importArticles.
But there's much more to importArticles than just this! For more examples and advanced usage, see the help page at Help:Including additional JavaScript and CSS.


The script can be optionally configured if you don't like the defaults:

window.SignatureCheckJS = {
	// Parts of the confirm prompt
	preamble: 'This will appear as the first line of the prompt box\n\n',
	epilogue: '\nThis will appear at the end of the prompt box.',
	noForumheader: 'This will appear in the middle of the preamble and epilogue if the forumheader template is missing on a forum page\n',
	noSignature: 'This will appear in the middle of the preamble and epilogue if the user hasn\'t used ~~~ to sign their post on a forum or talk page\n',
	// Other stuff
	forumheader: 'Forumheader', // The name of the Forumheader template, can be set to an empty string or false to disable
	checkSignature: true, // Enable the signature check function
        extraNamespaces: [    // Enable signature checking on other namespaces and subpages can be omitted
                        namespace: 2,          // namespace to check REQUIRED
                        patterns: [ '/talk' ]  // subpages to match in this namespace REQUIRED

The options are:

Property Description Type Default
preamble The text that will appear as the first line of the prompt if the user triggers one of the warnings. You should generally put a '\n' (a line-break) at the end unless you want the entire prompt to appear as one line. Text There are a few potential problems with your edit:\n\n
noForumheader The text that will appear in the prompt when the {{Forumheader}} template is missing from a page in the Forum namespace. Text !! There is no forum header on this forum page. You should not create forum pages without the header since they will not actually show up in the forum list.\n
noSignature The text that will appear in the prompt if there is no signature insertion wikitext (~~~) on the page [Only if the page is a talk page or the Forum]. Text ?? It looks like you forgot to sign your reply. Use ~~~~ to sign.\n
epilogue The text that will always appear as the last line of the prompt. Text \nAre you sure you want to post this anyway?\n[Violating policy may incur a warning from the administrators]
forumheader The name of the {{Forumheader}} template on your wiki. Generally you won't need to set this since all wikis use the same one unless you moved it. You can set this to an empty string to disable the feature if you'd prefer. Text Forumheader
checkSignature Whether to check for the wikitext signature or not. If this is false then only the Forumheader check will be performed. Boolean true
extraNamespaces An array of objects that contains a namespace and patterns parameter. Array< Object< Number< namespace >, Array< patterns > > > null
Using configuration options with Fandom Open Source Library scripts
The instructions on this page describe how to use configuration options with a script. Here on the Fandom Open Source Library, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.
Configuration options load too late, don't work
Proper placement of configuration options
// 1. AjaxRC import statement
// 2. AjaxRC configuration option
var ajaxRefresh = 30000;
// 1. AjaxRC configuration option
var ajaxRefresh = 30000;
// 2. AjaxRC import statement

Usage notes

  • The prompt will come up when editing Forum index pages which you obviously don't want to sign. Just ignore it and press Ok.
  • If you tick the "minor edit" box then the script will not prompt you to sign. This is because minor edits should not be replies, just fixing style problems, bad links, or correcting a reply you just made but published early by accident.
  • Users who don't want to encounter the prompt functionality can add the following code to their common.js page on the wiki using this script or their global.js:
if (window.WikiaEditor && window.GlobalTriggers) {
    window.GlobalTriggers.bind('WikiaEditorReady', function callback() {
        window.GlobalTriggers.unbind('WikiaEditorReady', callback);
        window.setTimeout(function() {
        }, 0);

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.