Jump to content

Template:Snippets with JavaScript header/ja

From mediawiki.org
This page is a translated version of the page Template:Snippets with JavaScript header and the translation is 11% complete.

使用法

You can use these snippets in any resource loader module. This includes those generated by core (such as the site and user module generated from wiki pages) and those in extensions.

See Manual:インターフェイス/JavaScript for places where you can add those snippets to your site.

Most snippets assume that they are executed after the document is ready: for those cases, make sure that you have a document-ready wrapper in your code. If you don't have one already, use the below:

$( function ()  {
	// Paste snippet here.
	// Paste as many as you like, only one "$( function () { ... } );" wrapper is needed!
} );
If the snippet processes the content part of wiki pages (the #mw-content-text element), you should use the 'wikipage.content' hook instead to make the snippet work after the page is updated asynchronously. See Gadget kitchen#Running code on page load for details.