User:Espyo/Pikan: Difference between revisions

updated page and added Gadget instructions
(updated page and added Gadget instructions)
Line 7: Line 7:


==Source==
==Source==
{{see|MediaWiki:Pikan-core.js}}
{{see|MediaWiki:Gadget-Pikan-core.js}}
{{see|MediaWiki:Pikan-pikipedia.js}}
{{see|MediaWiki:Gadget-Pikan-pikipedia.js}}


==Analyzing==
==Analyzing==
Line 141: Line 141:
I also made Pikan with flexibility in mind. If you want to add the script to your wiki, follow these steps:
I also made Pikan with flexibility in mind. If you want to add the script to your wiki, follow these steps:


* Create your own copy of [[MediaWiki:Pikan-pikipedia.js|Pikan-pikipedia.js]] (naming it whatever you want).
* Create your own copy of [[MediaWiki:Gadget-Pikan-pikipedia.js|Gadget-Pikan-pikipedia.js]] (naming it whatever you want).
* Change the first few parameters to match your wiki (e.g. wiki_url, module_name, etc.).
* Change the first few parameters to match your wiki (e.g. wiki_url, module_name, etc.).
* Edit pikan.find_problems to your suiting.
* Edit pikan.find_problems to your suiting.
Line 150: Line 150:
:* To create your own code to find a problem, you can add the problem to the list with pikan.save_problem. Check the function in the code for a documentation comment explaining it.
:* To create your own code to find a problem, you can add the problem to the list with pikan.save_problem. Check the function in the code for a documentation comment explaining it.
:* There are more helper functions in the code. I documented all of them. Use those as well, if needed.
:* There are more helper functions in the code. I documented all of them. Use those as well, if needed.
* On your wiki's MediaWiki:Common.js, import Pikan like so:
* If your wiki has the [[mw:Extension:Gadgets|Gadgets extension]] installed, then add an entry for Pikan to your MediaWiki:Gadgets-definition page:
<pre>* Pikan[ResourceLoader|default|actions=edit]|Pikan-core.js|Pikan-website.js</pre>
* If your wiki doesn't have the Gadgets extension, then on your wiki's MediaWiki:Common.js, import Pikan like so:
<pre>if (mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit') {
<pre>if (mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit') {
   mw.loader.getScript('https://www.pikminwiki.com/MediaWiki:Pikan-core.js?action=raw&ctype=text/javascript').then(
   mw.loader.getScript('https://www.pikminwiki.com/MediaWiki:Gadget-Pikan-core.js?action=raw&ctype=text/javascript').then(
     function () {
     function () {
       mw.loader.load('//your.wiki/url/MediaWiki:Pikan-website.js?action=raw&ctype=text/javascript');
       mw.loader.load('//your.wiki/url/MediaWiki:Gadget-Pikan-website.js?action=raw&ctype=text/javascript');
     }
     }
   );
   );
}</pre>
}</pre>
* Update the second URL to point to the raw source of your own version of Pikan-pikipedia.js (again, named whatever it is you wanted).
* Update the second URL to point to the raw source of your own version of Gadget-Pikan-pikipedia.js (again, named whatever it is you wanted).


==FAQ==
==FAQ==