මාධ්‍යවිකි:Friendlywelcome.js

විකිපීඩියා වෙතින්

සටහන: සුරැකීමෙන් පසුව, වෙනස් කම් දැකගැනුමට ඔබගේ බ්‍රවුසරයෙහි කෑෂය මගහැරයෑමට ඔබට සිදුවිය හැක. ගූගල් ක්‍රෝම්, ෆයර්ෆොක්ස්, මයික්‍රොසොෆ්ට් එජ් සහ සෆාරි: Reload ඔබන අතරතුර ⇧ Shift ඔබන්න. සවිස්තරාත්ම උපදෙස් සහ වෙනත් බ්‍රව්සර වලට අදාළ තොරතුරු සඳහා, විකිපීඩියා:කෑෂය මගහැරයෑම වෙතට යොමු වන්න.

// <nowiki>
// If FriendlyConfig aint exist.
if( typeof( FriendlyConfig ) == 'undefined' ) {
	FriendlyConfig = {};
}

/**
 FriendlyConfig.summaryAd ( string )
 If ad should be added or not to summary, default [[WP:TW|TW]]
 */
if( typeof( FriendlyConfig.summaryAd ) == 'undefined' ) {
	FriendlyConfig.summaryAd = " [[WP:TW|TW]] භාවිතයෙන්";
}

/**
 FriendlyConfig.topWelcomes ( boolean )
 */
if( typeof( FriendlyConfig.topWelcomes ) == 'undefined' ) {
	FriendlyConfig.topWelcomes = false;
}

/**
 FriendlyConfig.watchWelcomes ( boolean )
 */
if( typeof( FriendlyConfig.watchWelcomes ) == 'undefined' ) {
	FriendlyConfig.watchWelcomes = true;
}

/**
 FriendlyConfig.insertHeadings ( boolean )
 */
if( typeof( FriendlyConfig.insertHeadings ) == 'undefined' ) {
	FriendlyConfig.insertHeadings = true;
}

/**
 FriendlyConfig.welcomeHeading ( string )
 */
if( typeof( FriendlyConfig.welcomeHeading ) == 'undefined' ) {
	FriendlyConfig.welcomeHeading = "== ආයුබෝවන් ==";
}

/**
 FriendlyConfig.insertUsername ( boolean )
 */
if( typeof( FriendlyConfig.insertUsername ) == 'undefined' ) {
	FriendlyConfig.insertUsername = true;
}

/**
 FriendlyConfig.insertSignature ( boolean )
 */
if( typeof( FriendlyConfig.insertSignature ) == 'undefined' ) {
	FriendlyConfig.insertSignature = true;
}

/**
 FriendlyConfig.markWelcomesAsMinor ( boolean )
 */
if( typeof( FriendlyConfig.markWelcomesAsMinor ) == 'undefined' ) {
	FriendlyConfig.markWelcomesAsMinor = true;
}

/**
 FriendlyConfig.quickWelcomeMode ( String )
 */
if( typeof( FriendlyConfig.quickWelcomeMode ) == 'undefined' ) {
	FriendlyConfig.quickWelcomeMode = "semiauto";
}

/**
 FriendlyConfig.quickWelcomeTemplate ( String )
 */
if( typeof( FriendlyConfig.quickWelcomeTemplate ) == 'undefined' ) {
	FriendlyConfig.quickWelcomeTemplate = "Welcome";
}

/**
 FriendlyConfig.maskTemplateInSummary ( boolean )
 */
if( typeof( FriendlyConfig.maskTemplateInSummary ) == 'undefined' ) {
	FriendlyConfig.maskTemplateInSummary = true;
}

friendlywelcome = {
	auto: function() {
		if( QueryString.get( 'action' ) != 'edit' ) {
			// userpage not empty, aborting auto-welcome
			return;
		}
		
		return friendlywelcome.welcome();
	},
	semiauto: function()  {
		friendlywelcome.callback( mw.config.get('wgTitle').split( '/' )[0].replace( /\"/, "\\\"") );
	},
	normal: function() {
		if( QueryString.exists( 'diff' ) ) {
			var oXPath = '//div[@id="mw-diff-otitle2"]/span[@class="mw-usertoollinks"]/a[1][@class="new"]';
			var nXPath = '//div[@id="mw-diff-ntitle2"]/span[@class="mw-usertoollinks"]/a[1][@class="new"]';
			var oList = document.evaluate( oXPath, document, null,  XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );
			var nList = document.evaluate( nXPath, document, null,  XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );
			
			if( oList.snapshotLength > 0 || nList.snapshotLength > 0 ) {
				var spanTag = function( color, content ) {
					var span = document.createElement( 'span' );
					span.style.color = color;
					span.appendChild( document.createTextNode( content ) );
					return span;
				}

				var welcomeNode = document.createElement('strong');
				var welcomeLink = document.createElement('a');
				welcomeLink.appendChild( spanTag( 'Black', '[' ) );
				welcomeLink.appendChild( spanTag( 'Goldenrod', 'welcome' ) );
				welcomeLink.appendChild( spanTag( 'Black', ']' ) );
				welcomeNode.appendChild(welcomeLink);

				if( oList.snapshotLength > 0 ) {
					var oTalkNode = oList.snapshotItem(0);
					
					var oHref = document.evaluate( '@href', oTalkNode, null, XPathResult.STRING_TYPE, null ).stringValue;
					
					var oWelcomeNode = welcomeNode.cloneNode( true );
					oWelcomeNode.firstChild.setAttribute( 'href', oHref + '&' + QueryString.create( { 'friendlywelcome': FriendlyConfig.quickWelcomeMode=='auto'?'auto':'norm' } ) + '&' + QueryString.create( { 'vanarticle': mw.config.get('wgPageName').replace(/_/g, ' ') } ) );
					oTalkNode.parentNode.parentNode.appendChild( document.createTextNode( ' ' ) );
					oTalkNode.parentNode.parentNode.appendChild( oWelcomeNode );
				}
				
				if( nList.snapshotLength > 0 ) {
					var nTalkNode = nList.snapshotItem(0);
					
					var nHref = document.evaluate( '@href', nTalkNode, null, XPathResult.STRING_TYPE, null ).stringValue;
					
					var nWelcomeNode = welcomeNode.cloneNode( true );
					nWelcomeNode.firstChild.setAttribute( 'href', nHref + '&' + QueryString.create( { 'friendlywelcome': FriendlyConfig.quickWelcomeMode=='auto'?'auto':'norm' } ) + '&' + QueryString.create( { 'vanarticle': mw.config.get('wgPageName').replace(/_/g, ' ') } ) );
					nTalkNode.parentNode.parentNode.appendChild( document.createTextNode( ' ' ) );
					nTalkNode.parentNode.parentNode.appendChild( nWelcomeNode );
				}
			}
		}
		if( mw.config.get('wgNamespaceNumber') == 3 ) {
			var username = mw.config.get('wgTitle').split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes

			twAddPortletLink("javascript:friendlywelcome.callback(\"" + username + "\")", "ආයුබෝවන්", "friendly-welcome", "පරිශීලකයින් පිළිගැනීම", "");
		}
	}
}

friendlywelcome.welcome = function welcomeUser() {
	Status.init( document.getElementById('bodyContent') );

	var params = {
		value: FriendlyConfig.quickWelcomeTemplate,
		article: QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '',
		mode: 'auto'
	};

	var query = { 
		'title': mw.config.get('wgPageName'), 
		'action': 'submit'
	};
	Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');
	Wikipedia.actionCompleted.notice = "පිළිගැනීම සාර්ථකයි. මොහොතකින් පිටුව නැවත ප්‍රවේශණය වේ.";
	var wikipedia_wiki = new Wikipedia.wiki( 'User talk page modification', query, friendlywelcome.callbacks.main );
	wikipedia_wiki.followRedirect = true;
	wikipedia_wiki.params = params;
	wikipedia_wiki.get();
}

friendlywelcome.callback = function friendlywelcomeCallback( uid ) {
	var Window = new SimpleWindow( 600, 400 );
	Window.setTitle( "පිළිගැනීමේ සැකිල්ල තෝරන්න" ); 
	var form = new QuickForm( friendlywelcome.callback.evaluate, 'change' );

	form.append( {
			type: 'input',
			name: 'article',
			label: 'සබැඳි ලිපිය (සැකිල්ල සහාය දක්වයි නම් පමණක්)',
			value:( QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '' ),
			tooltip: 'An article might be linked to the welcome if the template supports it. Leave empty for no artice to be linked.  Templates that support a linked article are marked with an asterisk.  Ignored for templates that do not support a linked article.',
			event: function( event ) {
				event.stopPropagation();
			}
		}
	);

	form.append( { type:'header', label:'සරල සැකිලි' } );
	form.append( { type: 'radio', name: 'simple', list: friendlywelcome.standardList } );

	if( typeof( FriendlyConfig.customWelcomeList ) == 'object' ) {
		form.append( { type:'header', label:'Custom templates' } );
		form.append( { type: 'radio', name: 'custom', list: FriendlyConfig.customWelcomeList } );
	}

	form.append( { type:'header', label:'පිළිගැනීමේ කමිටුවේ සැකිලි' } );
	form.append( { type: 'radio', name: 'welcomingCommittee', list: friendlywelcome.welcomingCommitteeList } );

	form.append( { type:'header', label:'ගැටඵ සහිත භාවිත හා බැඳි සැකිලි' } );
	form.append( { type: 'radio', name: 'problem', list: friendlywelcome.problemList } );

	form.append( { type:'header', label:'නිර්නාමික පරිශීලක සැකිලි' } );
	form.append( { type: 'radio', name: 'anonymous', list: friendlywelcome.anonymousList } );

	var result = form.render();
	Window.setContent( result );
	Window.display();
}

friendlywelcome.standardList = [
	{
		label: '{{ආයුබෝවන්}}: සම්මත උණුසුම් පිළිගැනීම*',
		value: 'Welcome' },
	{ 
		label: '{{ආයුබෝවන්කෙටියෙන්}}: කෙටි උණුසුම් පිළිගැනීම',
		value: 'Welcomeshort',
		tooltip: 'ඡේද මාතෘකාව අන්තගතය.' },
	{ 
		label: '{{ආයුබෝවන්සරල}}: සරල පිළිගැනීම',
		value: 'WelcomeSimple',
		tooltip: 'නවකයින් සම්පූර්ණයෙන් යටකර නොදමයි. ඡේද මාතෘකාව අන්තගතය.' },
	{
		label: '{{Welcome-personal}}: කුඩා විස්කෝතුවකුත් එක් කිරීම සමඟින් පිළිගැනීම',
		value: 'Welcome-personal',
		tooltip: 'කුඩා විස්කෝතුවකුත් සමඟින් පුද්ගලික පණිවුඩයකුත් සමඟින් පිළිගැනීම.  ඡේද මාතෘකාව සහ අත්සන අන්තගතය.' },
	{ 
		label: '{{WelcomeMenu}}: welcome with menu of links',
		value: 'WelcomeMenu',
		tooltip: 'Contains a welcome message and many useful links broken up into different sections.  Includes signature.' },
	{ 
		label: '{{Welcomeg}}: {{WelcomeMenu}} ට සමාන පිළිගැනීමක්',
		value: 'Welcomeg',
		tooltip: 'Contains a welcome message and many useful links broken up into different sections.  Includes signature.' },
	{ 
		label: '{{Welcomeh}}: same as {{Welcomeg}} but with a section heading',
		value: 'Welcomeh',
		tooltip: 'Contains a section heading, a welcome message and many useful links broken up into different sections.  ඡේද මාතෘකාව සහ අත්සන අන්තගතය..' }
]

friendlywelcome.welcomingCommitteeList = [
	{ 
		label: '{{Wel}}: similar to {{Welcome}}, but automatically identifies anonymous and registered users*',
		value: 'Wel',
		tooltip: 'This template checks whether the username contains any letters. If there are any, {{Welcome-reg}} will be shown. If there are none, {{Welcome-anon}} will be shown.' },
	{ 
		label: '{{W-basic}}: standard template, similar to {{Welcome}} with additional options',
		value: 'W-basic',
		tooltip: 'This template is similar to {{Welcome}} but supports many different options.  Includes a signature.' },
	{ 
		label: '{{W-shout}}: extroverted message with bold advice',
		value: 'W-shout',
		tooltip: 'This template is similar to {{WelcomeShout}} but supports many different options.  Includes a signature.' },
	{ 
		label: '{{W-short}}: concise; won\'t overwhelm',
		value: 'W-short||',
		tooltip: 'This template is similar to {{ආයුබෝවන්කෙටියෙන්}} but supports many different options.  Includes a signature.' },
	{ 
		label: '{{W-link}}: shortest greeting, links to Welcoming committee\'s greetings page',
		value: 'W-link',
		tooltip: 'This template is similar to {{Welcom}} but supports many different options.  Includes a signature.' },
	{ 
		label: '{{W-graphical}}: graphical menu format to ease transition from the graphic-heavy web',
		value: 'W-graphical',
		tooltip: 'This template is similar to {{Welcomeg}} but has fewer links.  Supports many different options.  Includes a signature.' },
	{ 
		label: '{{W-screen}}: graphical; designed to fit the size of the user\'s screen',
		value: 'W-screen',
		tooltip: 'This template is a nice graphical welcome with many different options.  Includes a signature.' }
]

friendlywelcome.problemList = [
	{ 
		label: '{{Welcomelaws}}: welcome with information about copyrights, npov, the sandbox, and vandalism',
		value: 'Welcomelaws' },
	{ 
		label: '{{Firstarticle}}: නව පිටු තැනීමේ මාර්ගසූචක පිළිනොපැද පිටු තැනූ අයෙක් පිළිගැනීම*',
		value: 'Firstarticle' },
	{ 
		label: '{{Welcomevandal}}: නාශකවාදය කිරීමට තැන් කල අයෙක් පිළිගැනීම*',
		value: 'Welcomevandal',
		tooltip: 'ඡේද මාතෘකාව අන්තගතය.' },
	{ 
		label: '{{Welcomenpov}}: for someone whose initial efforts do not adhere to the neutral point of view policy*',
		value: 'Welcomenpov' },
	{ 
		label: '{{Welcomespam}}: welcome with additional discussion of anti-spamming polices*',
		value: 'Welcomespam' },
	{ 
		label: '{{Welcomeunsourced}}: for someone whose initial efforts are uncited*',
		value: 'Welcomeunsourced' },
	{ 
		label: '{{Welcomeauto}}: for someone who created an autobiographical article*',
		value: 'Welcomeauto' },
	{ 
		label: '{{Welcome-COI}}: for someone who created an article about a subject with which they have a conflict of interest*',
		value: 'Welcome-COI' }
]

friendlywelcome.anonymousList = [
	{
		label: '{{Welcome-anon}}: නිර්නාමික පරිශීලකයෙක් ගිණුමක් තනන්නයිඇයි දිරි ගන්වමින් පිළිගැනීම*',
		value: 'Welcome-anon' },
	{
		label: '{{Welcomeanon2}}: {{Welcome-anon}}ට සමානය. නමුත් උපදෙස් අඩංගුය*',
		value: 'Welcomeanon2',
		tooltip: 'ඡේද මාතෘකාව අන්තගතය.' },
	{
		label: '{{Welc-anon}}: similar to {{Welcome-anon}} but with a border and section heading',
		value: 'Welc-anon||',
		tooltip: 'ඡේද මාතෘකාව අන්තගතය.' },
	{
		label: '{{Welcome-anon-vandal}}: for anonymous users who have vandalized a page*',
		value: 'Welcome-anon-vandal',
		tooltip: 'ඡේද මාතෘකාව සහ අත්සන අන්තගතය.' },
	{
		label: '{{Welcome-anon-vandalism-fighter}}: for anonymous users who fight vandalism, urging them to create an account*',
		value: 'Welcome-anon-vandalism-fighter', 
		tooltip: 'ඡේද මාතෘකාව අන්තගතය.',
	},
]

// Set to true if template does not already have heading
friendlywelcome.headingHash = {
	'Welcome': false,
	'Welcomeshort': false,
	'WelcomeSimple': false,
	'Welcom': false,
	'Welcome-personal': false,
	'WelcomeMenu': true,
	'Welcomeg': true,
	'Welcomeh': false,
	'Wel': false,
	'W-basic': true,
	'W-shout': true,
	'W-short||': true,
	'W-link': true,
	'W-graphical': true,
	'W-screen': true,
	'Welcomelaws': true,
	'Firstarticle': true,
	'Welcomevandal': false,
	'Welcomenpov': true,
	'Welcomespam': true,
	'Welcomeunsourced': true,
	'Welcomeauto': false,
	'Welcome-COI': true,
	'Welcome-anon': true,
	'Welcomeanon2': false,
	'Welc-anon||': false,
	'Welcome-anon-vandalism-fighter': false,
	'Welcome-anon-vandal': false
}

// Set to true if template already has signature
friendlywelcome.signatureHash = {
	'Welcome': true,
	'Welcomeshort': false,
	'WelcomeSimple': false,
	'Welcom': true,
	'Welcome-personal': false,
	'WelcomeMenu': true,
	'Welcomeg': true,
	'Welcomeh': true,
	'Wel': false,
	'W-basic': true,
	'W-shout': true,
	'W-short||': true,
	'W-link': true,
	'W-graphical': true,
	'W-screen': true,
	'Welcomelaws': false,
	'Firstarticle': true,
	'Welcomevandal': true,
	'Welcomenpov': false,
	'Welcomespam': false,
	'Welcomeunsourced': false,
	'Welcomeunsourced': false,
	'Welcome-COI': false,
	'Welcome-anon': false,
	'Welcomeanon2': false,
	'Welc-anon||': false,
	'Welcome-anon-vandalism-fighter': false,
	'Welcome-anon-vandal': true
}

/* Set to true if template supports article
 * name from art template parameter 
 */
friendlywelcome.artHash = {
	'Welcome': true,
	'Welcomeshort': false,
	'WelcomeSimple': false,
	'Welcom': false,
	'Welcome-personal': false,
	'WelcomeMenu': false,
	'Welcomeg': false,
	'Welcomeh': false,
	'Wel': true,
	'W-basic': false,
	'W-shout': false,
	'W-short||': false,
	'W-link': false,
	'W-graphical': false,
	'W-screen': false,
	'Welcomelaws': false,
	'Firstarticle': false,
	'Welcomevandal': false,
	'Welcomenpov': false,
	'Welcomespam': false,
	'Welcomeunsourced': false,
	'Welcomeauto': true,
	'Welcome-COI': false,
	'Welcome-anon': true,
	'Welcomeanon2': true,
	'Welc-anon||': false,
	'Welcome-anon-vandalism-fighter': true,
	'Welcome-anon-vandal': false
}

/* Set to true if template supports article
 * name from vanarticle template parameter 
 */
friendlywelcome.vandalHash = {
	'Welcome': false,
	'Welcomeshort': false,
	'WelcomeSimple': false,
	'Welcom': false,
	'Welcome-personal': false,
	'WelcomeMenu': false,
	'Welcomeg': false,
	'Welcomeh': false,
	'Wel': false,
	'W-basic': false,
	'W-shout': false,
	'W-short||': false,
	'W-link': false,
	'W-graphical': false,
	'W-screen': false,
	'Welcomelaws': false,
	'Firstarticle': true,
	'Welcomevandal': true,
	'Welcomenpov': true,
	'Welcomespam': true,
	'Welcomeunsourced': true,
	'Welcomeauto': false,
	'Welcome-COI': false,
	'Welcome-anon': false,
	'Welcomeanon2': false,
	'Welc-anon||': false,
	'Welcome-anon-vandalism-fighter': false,
	'Welcome-anon-vandal': true
}

friendlywelcome.callbacks = {
	main: function( self ) {
		var form = self.responseXML.getElementById( 'editform' );
		
		// abort if mode is auto and form is not empty
		if( form.wpTextbox1.value != '' && self.params.mode == 'auto' ) {
			Status.info( 'Warning', 'පරිශීලක පිටුව හිස් නැත; ස්වයංක්‍රීය පිළිගැනීම අත හරින ලදී' );
			Wikipedia.actionCompleted.event();
			return;
		}
		
		var text = '';
		Status.info( 'Info', 'පරිශීලකයාගේ සංවාද පිටුවේ '
				+ ( FriendlyConfig.topWelcomes ? 'මුදුනට' : 'අන්තිමට' )
				+ ' පිළිගැනීමේ සැකිල්ල එක් කෙරේ.' );
		if( !FriendlyConfig.topWelcomes ) {
			text += form.wpTextbox1.value + '\n';
		}
		
		if( friendlywelcome.headingHash[ self.params.value ] && FriendlyConfig.insertHeadings ) {
			Status.info( 'Info', 'පිළිගැනීම සඳහා නව මාතෘකාවක් එක් කෙරේ' );
			text += FriendlyConfig.welcomeHeading + "\n";
		}
		
		Status.info( 'Info', 'පිළිගැනීමේ සැකිල්ල වෙනුවට {{' + self.params.value + '}} යන්න ආදේශ කෙරේ' );
		text += '\{\{subst:' + self.params.value;
		
		if( friendlywelcome.artHash[ self.params.value ] ) {
			if( FriendlyConfig.insertUsername && self.params.value.substring(2,0) != 'W-' ) {
				Status.info( 'Info', 'ඔබේ පරිශීලක නාමය සැකිල්ල එක් කෙරේ' );
				text += '|' + mw.config.get('wgUserName');
			}
			
			if( self.params.article != '' ) {
				Status.info( 'Info', 'ලිපි සබැඳුම සැකිල්ල එක් කෙරේ' );
				text += '|art=' + self.params.article;
			}
		} else if( friendlywelcome.vandalHash[ self.params.value ] ) {
			if( self.params.article != '' ) {
				Status.info( 'Info', 'ලිපි සබැඳුම සැකිල්ල එක් කෙරේ' );
			}
			text += '|' + self.params.article;
			
			if( FriendlyConfig.insertUsername ) {
				Status.info( 'Info', 'ඔබේ පරිශීලක නාමය සැකිල්ල එක් කෙරේ' );
				text += '|' + mw.config.get('wgUserName');
			}
		} else if( FriendlyConfig.insertUsername ) {
			Status.info( 'Info', 'ඔබේ පරිශීලක නාමය සැකිල්ල එක් කෙරේ' );
			text += '|' + mw.config.get('wgUserName');
		} 
		
		text += '\}\}';
		
		if( !friendlywelcome.signatureHash[ self.params.value ] && FriendlyConfig.insertSignature ) {
			Status.info( 'Info', 'පිළිගැනීමෙන් පසුව ඔබේ අත්සන එක් කෙරේ.' );
			text += ' \n\~\~\~\~';
		}
		
		if( FriendlyConfig.topWelcomes ) {
			text += '\n\n' + form.wpTextbox1.value;
		}
		
		var postData = {
			'wpMinoredit': FriendlyConfig.markWelcomesAsMinor ? 1 : undefined,
			'wpWatchthis': form.wpWatchthis.checked ? 1 : (FriendlyConfig.watchWelcomes ? 1 : undefined),
			'wpStarttime': form.wpStarttime.value,
			'wpEdittime': form.wpEdittime.value,
			'wpAutoSummary': form.wpAutoSummary.value,
			'wpEditToken': form.wpEditToken.value,
			'wpSummary': ( FriendlyConfig.maskTemplateInSummary ? 'පිළිගැනීමේ' : ( '\{\{[[Template:' + self.params.value + '|' + self.params.value + ']]\}\}' ) )
					+ ' සැකිල්ල, පරිශීලක සංවාද පිටුවට ' + FriendlyConfig.summaryAd + ' එක් කරන ලදී.',
			'wpTextbox1': text
		};
 
		self.post( postData );
	}
}

friendlywelcome.callback.evaluate = function friendlywelcomeCallbackEvaluate(e) {
	// Ignore if a change to the text field triggered this event
	if( e.target.name == 'article' ) {
		return;
	}
	
	var params = {
		value: e.target.value,
		article: e.target.form.article.value,
		mode: 'manual'
	};

	Status.init( e.target.form );
	
	var query = { 
		'title': mw.config.get('wgPageName'), 
		'action': 'submit'
	};
	Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');
	Wikipedia.actionCompleted.notice = "පිළිගැනීම සාර්ථකයි. මොහොතකින් පිටුව නැවත ප්‍රවේශණය වේ.";
	var wikipedia_wiki = new Wikipedia.wiki( 'User talk page modification', query, friendlywelcome.callbacks.main );
	wikipedia_wiki.followRedirect = true;
	wikipedia_wiki.params = params;
	wikipedia_wiki.get();
}

window.TwinkleInit = (window.TwinkleInit || []).concat( function() {
	if( QueryString.exists( 'friendlywelcome' ) ) {
		if( QueryString.get( 'friendlywelcome' ) == 'auto' ) {
			friendlywelcome.auto();
		} else {
			friendlywelcome.semiauto();
		}
	} else {
		friendlywelcome.normal();
	}
}); //schedule initializer

// </nowiki>
"https://si.wikipedia.org/w/index.php?title=මාධ්‍යවිකි:Friendlywelcome.js&oldid=475645" වෙතින් සම්ප්‍රවේශනය කෙරිණි