Jump to content

User:Music1201/introNotice.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* Defines the function "addEditNotice" */
function addEditNotice( name ) {
    $( '.mw-editsection, #ca-addsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
        el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
    } );
}

/* Defines the function "addEditNoticeSection" */
function addEditNoticeSection( name ) {
    $( '.mw-editsection, #ca-addsection' ).find( 'a' ).each( function ( i, el ) {
        el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
    } );
}

/* Defines the function "addEditNoticeEdit" */
function addEditNoticeEdit( name ) {
    $( '.mw-editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
        el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
    } );
}

/* Defines the variable "page" */
    $( function () {
    	var page = mw.config.get('wgPageName');
    	if (!page) {
    		return;
    	}
/* Adds editnotice for Village pump/Proposals */
    	if (mw.config.get( 'wgPageName' ) === 'Wikipedia:Village_pump_(proposals)') {
    		addEditNotice('User:Music1201/introNoticeTemplates/VPP');
  }
/* Adds editnotice for Village pump/Technical */
		if (mw.config.get( 'wgPageName' ) === 'Wikipedia:Village_pump_(technical)') {
			addEditNoticeSection('Wikipedia:Village pump (technical)/FAQ');
		}
   });