} )();
// Table of contents toggle
- mw.hook( 'wikipage.content' ).add( function () {
+ mw.hook( 'wikipage.content' ).add( function ( $content ) {
var $tocTitle, $tocToggleLink, hideTocCookie;
- $tocTitle = $( '#toctitle' );
- $tocToggleLink = $( '#togglelink' );
+ $tocTitle = $content.find( '#toctitle' );
+ $tocToggleLink = $content.find( '#togglelink' );
// Only add it if there is a TOC and there is no toggle added already
- if ( $( '#toc' ).length && $tocTitle.length && !$tocToggleLink.length ) {
+ if ( $content.find( '#toc' ).length && $tocTitle.length && !$tocToggleLink.length ) {
hideTocCookie = $.cookie( 'mw_hidetoc' );
$tocToggleLink = $( '<a href="#" class="internal" id="togglelink"></a>' )
.text( mw.msg( 'hidetoc' ) )
.click( function ( e ) {
e.preventDefault();
- util.toggleToc( $(this) );
+ util.toggleToc( $( this ) );
} );
$tocTitle.append(
$tocToggleLink
* Get the link to a page name (relative to `wgServer`),
*
* @param {string} str Page name to get the link for.
- * @param {Object} params A mapping of query parameter names to values,
- * e.g. { action: 'edit' }. Optional.
+ * @param {Object} [params] A mapping of query parameter names to values,
+ * e.g. `{ action: 'edit' }`.
* @return {string} Location for a page with name of `str` or boolean false on error.
*/
getUrl: function ( str, params ) {
* This function returns the styleSheet object for convience (due to cross-browsers
* difference as to where it is located).
*
- * var sheet = mw.util.addCSS('.foobar { display: none; }');
- * $(foo).click(function () {
+ * var sheet = mw.util.addCSS( '.foobar { display: none; }' );
+ * $( foo ).click( function () {
* // Toggle the sheet on and off
* sheet.disabled = !sheet.disabled;
- * });
+ * } );
*
* @param {string} text CSS to be appended
* @return {CSSStyleSheet} Use .ownerNode to get to the `<style>` element.
// the ABNF:
// 1 * ( atext / "." ) "@" ldh-str 1*( "." ldh-str )
// With:
- // - atext : defined in RFC 5322 section 3.2.3
+ // - atext : defined in RFC 5322 section 3.2.3
// - ldh-str : defined in RFC 1034 section 3.5
//
// (see STD 68 / RFC 5234 http://tools.ietf.org/html/std68)
// RegExp is case insensitive
'i'
);
- return (null !== mailtxt.match( html5EmailRegexp ) );
+ return ( null !== mailtxt.match( html5EmailRegexp ) );
},
/**