Fandom Developers Wiki
m (Typo)
m (admin rename to User:MACH-59330)
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{Infobox JavaScript
 
{{Infobox JavaScript
| Description = Provides a simple method of getting whether or not wikis have message walls enabled
+
| Description = Provides a promise variable for detection of the Message Wall feature on a wiki.
  +
| Author =
| Scope = Site-wide<br />Personal
 
| Author = [[User:Colouratura|Colouratura]]<br />[[User:KockaAdmiralac|KockaAdmiralac]]<br />[[User:Speedit|Speedit]]
+
* [[User:Colouratura|Colouratura]]
  +
* [[User:KockaAdmiralac|KockaAdmiralac]]
| Updated = July 09, 2017
 
  +
* [[User:MACH-59330|MACH-59330]]
| Code = [[MediaWiki:wgMessageWallsExist.js]]
 
| Skins = Oasis
+
| Scope = ps
  +
| Updated = {{Updated|MediaWiki:wgMessageWallsExist.js}}
 
| Code = [[MediaWiki:wgMessageWallsExist.js|wgMessageWallsExist.js]]
  +
| Type = libraries
 
}}
 
}}
 
 
'''wgMessageWallsExist''' extends the <code>mw.config</code> variable to add a new wgVariable called <code>wgMessageWallsExist</code>. This method, unlike the others, does not return a usable value but instead returns a promise which you can use to separate logic for message walls and talk pages.
 
'''wgMessageWallsExist''' extends the <code>mw.config</code> variable to add a new wgVariable called <code>wgMessageWallsExist</code>. This method, unlike the others, does not return a usable value but instead returns a promise which you can use to separate logic for message walls and talk pages.
   
 
== Usage ==
 
== Usage ==
 
To '''use''' do as follows:
To '''import''' and use this script please make sure it is included '''before''' the script that uses it so that it is loaded in time to be used.
 
   
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
  +
mw.hook('dev.enablewallext').add(function(wgMessageWallsExist) {
importArticles({
 
 
wgMessageWallsExist.then(
 
function () {
 
// Message walls do exist on this wiki
 
},
 
function () {
 
// Message walls do not exist on this wiki
 
}
 
);
 
});
  +
importArticle({
 
type: 'script',
 
type: 'script',
  +
article: 'u:dev:MediaWiki:WgMessageWallsExist.js'
articles: [
 
'u:dev:wgMessageWallsExist.js',
 
// Scripts that depend on it
 
]
 
 
});
 
});
</syntaxhighlight>
 
 
To '''use''' do as follows
 
 
<syntaxhighlight lang="javascript">
 
mw.config.get('wgMessageWallsExist').then(
 
function () {
 
// Message walls do exist on this wiki
 
},
 
function () {
 
// Message walls do not exist on this wiki
 
}
 
);
 
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 11:50, 14 March 2019

wgMessageWallsExist extends the mw.config variable to add a new wgVariable called wgMessageWallsExist. This method, unlike the others, does not return a usable value but instead returns a promise which you can use to separate logic for message walls and talk pages.

Usage

To use do as follows:

mw.hook('dev.enablewallext').add(function(wgMessageWallsExist) {
    wgMessageWallsExist.then(
        function () {
            // Message walls do exist on this wiki
        },
        function () {
            // Message walls do not exist on this wiki
        }
    );
});
importArticle({
    type: 'script',
    article: 'u:dev:MediaWiki:WgMessageWallsExist.js'
});