User:Erutuon/scripts/editTop.js

Hello, you have come here looking for the meaning of the word User:Erutuon/scripts/editTop.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:Erutuon/scripts/editTop.js, but we will also tell you about its etymology, its characteristics and you will know how to say User:Erutuon/scripts/editTop.js in singular and plural. Everything you need to know about the word User:Erutuon/scripts/editTop.js you have here. The definition of the word User:Erutuon/scripts/editTop.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:Erutuon/scripts/editTop.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
// From ], with some modifications

var namespaceNumber = mw.config.get( "wgNamespaceNumber" );
var pageName = mw.config.get( "wgPageName" );

if ( .indexOf( mw.config.get( "wgAction" ) ) !== -1
	&& .indexOf( mw.config.get( "wgNamespaceNumber" ) ) !== -1 ) {
	$(function edittop_hook () {
		var localtitles = {
			en: "Edit lead section",
		};
	
		var our_content = $("#content, #mw_content").first();
		var span1 = our_content
			.find("span.mw-editsection:not(.plainlinks):not(.anchor-gadget-link)")
			.first();
		if (!span1.length) {
			return;
		}
		var span0 = span1.clone().prop("contenteditable", "false");
	
		$("#mw_header h1, #content h1").first().append(span0);
		
		span0.find("a").each(function (idx) {
			var a = $(this);
			a.attr("title", localtitles.en);
			
			var href = a.attr( "href" );
			if (!href)
				return;
			
			a.attr("href",
				// not transcluded
				!/&(ve|)section=T/.test( href ) ? href.replace( /&(ve|)section=\d+/, "&$1section=0&summary=/*%20top%20*/%20" )
				// transcluded, VE
				: /&vesection=/.test( href ) ? mw.util.getUrl( pageName, { veaction: "edit", vesection: 0, summary: "/* top */ " } )
				: mw.util.getUrl( pageName, { action: "edit", section: "0", summary: "/* top */ " } ) );
		});
	});
}