FANDOM


(Undo revision 60580 by Agent Zuri (talk) It isn't vandalism because somebody documented your script properly smh.)
Line 2: Line 2:
 
{{Infobox JavaScript
 
{{Infobox JavaScript
 
|Image file =
 
|Image file =
|Status = Stable
+
|Status = beta
 
|Author = [[User:Agent Zuri|Agent Zuri]] <small>(creator)</small><br />
 
|Author = [[User:Agent Zuri|Agent Zuri]] <small>(creator)</small><br />
 
[[User:Dorumin|Dorumin]] <small>(inspired by)</small>
 
[[User:Dorumin|Dorumin]] <small>(inspired by)</small>
Line 18: Line 18:
   
 
== Use ==
 
== Use ==
  +
Add to common.js or wikia.js configuration:<pre>
  +
window.JSSpecialPagePages = window.JSSpecialPagePages || [];
  +
</pre>
  +
Then add pages as shown below:<pre>
  +
window.JSSpecialPagePages.push({t: 'title', c: 'content'});
  +
</pre>
  +
Change '''title''' to desired title and '''content''' to desired content. You may add as much titles as you want.
  +
;Example
  +
<pre>
  +
window.JSSpecialPagePages = window.JSSpecialPagePages || [];
  +
window.JSSpecialPagePages.push({t: 'Newpage', c: 'Hello, i am a new special page!'});
  +
window.JSSpecialPagePages.push({t: 'Hello', c: 'world'});
  +
</pre>
  +
Code above adds two fake special pages named "Newpage" and "Hello" with content "Hello, i am a new special page!" and "world" respectively.
  +
<!--
 
<pre>
 
<pre>
 
JSSpecialPage(pageName,content);
 
JSSpecialPage(pageName,content);
 
</pre>
 
</pre>
+
-->
 
== Result ==
 
== Result ==
 
* Navigate to "Special:<code><pageName></code>" and you will see your special page instead of an error message!
 
* Navigate to "Special:<code><pageName></code>" and you will see your special page instead of an error message!
 
* Navigate to [[Special:SpecialPages##mw-specialpagesgroup-other|Special:SpecialPages]] and also there, your page will appear
 
* Navigate to [[Special:SpecialPages##mw-specialpagesgroup-other|Special:SpecialPages]] and also there, your page will appear
  +
  +
  +
==TODO==
  +
*Use own configuration file, with regexped titles and content.

Revision as of 20:39, August 16, 2017

Adds a fake special page to wiki.

Import

Add the following line to your ImportJS:

dev:JSSpecialPage/code.js

Use

Add to common.js or wikia.js configuration:
window.JSSpecialPagePages = window.JSSpecialPagePages || [];
Then add pages as shown below:
window.JSSpecialPagePages.push({t: 'title', c: 'content'});

Change title to desired title and content to desired content. You may add as much titles as you want.

Example
window.JSSpecialPagePages = window.JSSpecialPagePages || [];
window.JSSpecialPagePages.push({t: 'Newpage', c: 'Hello, i am a new special page!'});
window.JSSpecialPagePages.push({t: 'Hello', c: 'world'});

Code above adds two fake special pages named "Newpage" and "Hello" with content "Hello, i am a new special page!" and "world" respectively.

Result

  • Navigate to "Special:<pageName>" and you will see your special page instead of an error message!
  • Navigate to Special:SpecialPages and also there, your page will appear


TODO

  • Use own configuration file, with regexped titles and content.
Community content is available under CC-BY-SA unless otherwise noted.