MediaWiki/js: Difference between revisions

No edit summary
m Add image
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:Screenshot qunit.png|thumb|479x479px]]
The first thing to know about [[MediaWiki]] and [[JavaScript]] is that the site administrator can customize the wiki installation by simply modifying the article [[MediaWiki:Common.js]]
The first thing to know about [[MediaWiki]] and [[JavaScript]] is that the site administrator can customize the wiki installation by simply modifying the article [[MediaWiki:Common.js]]


Line 5: Line 6:


== Debugging JavaScript ==
== Debugging JavaScript ==
# Access the developer tools of your browser  
<ol>
** Chrome  <code>CTRL + SHIFT + J</code>  
<li> Access the developer tools of your browser  
** Firefox <code>CTRL + SHIFT + I</code>
<ul>
# Go to the console tab (look for errors)
<li>Chrome  <code>CTRL + SHIFT + J</code>  
# append <code>?debug=true</code> to the URL and reload the page.  This will give you non-minified JavaScript.
<li>Firefox <code>CTRL + SHIFT + I</code>
</ul>
<li>Go to the console tab (look for errors)
<li>append <code>?debug=true</code> to the URL and reload the page.  This will give you non-minified JavaScript.
</ol>
 
== JavaScript Unit Testing ==
MediaWiki uses the QUnit test framework for [https://www.mediawiki.org/wiki/Manual:JavaScript_unit_testing JavaScript Unit testing].
 
Set <code>$wgEnableJavaScriptTest</code> to <code>'''true'''</code>  and visit [[Special:JavaScriptTest]] to see the test output.
[[Category:JavaScript]]