ಮೀಡಿಯವಿಕಿ:Gadget-Twinkle.js: ಪರಿಷ್ಕರಣೆಗಳ ನಡುವಿನ ವ್ಯತ್ಯಾಸ

Content deleted Content added
ಚುNo edit summary
imported>Amalthea
v2.0-270-g1b7f180: welcome: the long-awaited overhaul; warn: use Wikipedia.preview; morebits: new Wikipedia.preview + more; tag: re-add {{expert-subject}}; morebits: destroy SimpleWindow objects when closed; morebits: fix QuickForm subgroup bug
೪೧ ನೇ ಸಾಲು:
Twinkle.defaultConfig.twinkle = {
// General
summaryAd: " ([[:en:WP:TW|ಟ್ವಿಂTW]])",
deletionSummaryAd: " ([[:en:WP:TW|ಟ್ವಿಂTW]])",
protectionSummaryAd: " ([[:en:WP:TW|ಟ್ವಿಂTW]])",
userTalkPageMode: "window",
dialogLargeFont: false,
೧೦೯ ನೇ ಸಾಲು:
Twinkle.defaultConfig.twinkle.portletArea = 'right-navigation';
Twinkle.defaultConfig.twinkle.portletId = 'p-twinkle';
Twinkle.defaultConfig.twinkle.portletName = 'ಟ್ವಿಂTW';
Twinkle.defaultConfig.twinkle.portletType = 'menu';
Twinkle.defaultConfig.twinkle.portletNext = 'p-search';
೧೩೧ ನೇ ಸಾಲು:
topWelcomes: false,
watchWelcomes: true,
welcomeHeading: "ಸುಸ್ವಾಗತ",
insertHeadings: true,
insertUsername: true,
insertSignature: true, // sign welcome templates, where appropriate
quickWelcomeMode: "norm",
quickWelcomeTemplate: "welcome",
Line ೧೪೨ ⟶ ೧೩೯:
markTalkbackAsMinor: true,
insertTalkbackSignature: true, // always sign talkback templates
talkbackHeading: "ಮರುಮಾತುTalkback",
adminNoticeHeading: "Notice",
// Shared
Line ೭೮೯ ⟶ ೭೮೬:
"disputed": "article has questionable factual accuracy",
"essay-like": "article is written like an essay and needs cleanup",
"expert-subject": "article needs attention from an expert on the subject",
"external links": "article's external links may not follow content policies or guidelines",
"fansite": "article resembles a fansite",
Line ೮೯೯ ⟶ ೮೯೭:
"Information and detail": [
"context",
"expert-subject",
"metricate",
"overly detailed",
Line ೨,೦೪೯ ⟶ ೨,೦೪೮:
 
Twinkle.welcome.callback = function friendlywelcomeCallback( uid ) {
if( uid === mw.config.get('wgUserName') && !confirm( 'Are you really sure you want to welcome yourself?...' ) ){
alert( 'You\'re very welcome! Very welcome indeed!' );
return;
}
 
var Window = new SimpleWindow( 600, 400420 );
Window.setTitle( "Welcome user" );
Window.setScriptName( "ಟ್ವಿಂಕಲ್Twinkle" );
Window.addFooterLink( "Welcoming Committee", "WP:WC" );
Window.addFooterLink( "Twinkle help", "WP:TW/DOC#welcome" );
 
var form = new QuickForm( Twinkle.welcome.callback.evaluate, 'change' );
 
form.append({
type: 'select',
name: 'type',
label: 'Type of welcome: ',
event: Twinkle.welcome.populateWelcomeList,
list: [
{ type: 'option', value: 'standard', label: 'Standard welcomes', selected: !isIPAddress(mw.config.get('wgTitle')) },
{ type: 'option', value: 'anonymous', label: 'IP user welcomes', selected: isIPAddress(mw.config.get('wgTitle')) },
{ type: 'option', value: 'wikiProject', label: 'WikiProject welcomes' },
{ type: 'option', value: 'nonEnglish', label: 'Non-English welcomes' }
]
});
 
form.append( { type: 'div', id: 'welcomeWorkArea' } );
 
form.append( {
type: 'input',
name: 'article',
label: '* Linked article (if supported by template):',
value:( QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '' ),
tooltip: 'An article might be linked tofrom within the welcome if the template supports it. Leave empty for no article 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();
}
} );
 
var previewlink = document.createElement( 'a' );
form.append( { type:'header', label:'Simple templates' } );
$(previewlink).click(function(){
form.append( { type: 'radio', name: 'simple', list: Twinkle.welcome.standardList } );
Twinkle.welcome.callbacks.preview(result); // |result| is defined below
});
previewlink.style.cursor = "pointer";
previewlink.textContent = 'Preview';
form.append( { type: 'div', name: 'welcomepreview', label: [ previewlink ] } );
 
form.append( { type: 'submit' } );
if( Twinkle.getFriendlyPref('customWelcomeList').length ) {
 
form.append( { type:'header', label:'Custom templates' } );
var result = form.render();
form.append( { type: 'radio', name: 'custom', list: Twinkle.getFriendlyPref('customWelcomeList') } );
Window.setContent( result );
Window.display();
 
// initialize the welcome list
var evt = document.createEvent( "Event" );
evt.initEvent( 'change', true, true );
result.type.dispatchEvent( evt );
};
 
Twinkle.welcome.populateWelcomeList = function(e) {
var type = e.target.value;
var $workarea = $(e.target.form).find("div#welcomeWorkArea");
 
var div = new QuickForm.element({
type: "div",
id: "welcomeWorkArea"
});
 
if ((type === "standard" || type === "anonymous") && Twinkle.getFriendlyPref("customWelcomeList").length) {
div.append({ type: 'header', label: 'Custom welcome templates' });
div.append({
type: 'radio',
name: 'template',
list: Twinkle.getFriendlyPref("customWelcomeList"),
event: Twinkle.welcome.selectTemplate
});
}
// the first radio button under each type should be automatically checked
var checkedFirst = false;
var appendTemplates = function(list) {
div.append({
type: 'radio',
name: 'template',
list: list.map(function(obj) {
var properties = Twinkle.welcome.templates[obj];
var result = (properties ? {
value: obj,
label: "{{" + obj + "}}: " + properties.description + (properties.linkedArticle ? "\u00A0*" : ""), // U+00A0 NO-BREAK SPACE
tooltip: properties.tooltip, // may be undefined
checked: !checkedFirst
} : {
value: obj,
label: "{{" + obj + "}}",
checked: !checkedFirst
});
if (!checkedFirst) {
checkedFirst = true;
}
return result;
}),
event: Twinkle.welcome.selectTemplate
});
};
 
switch (type) {
form.append( { type:'header', label:'Welcoming committee templates' } );
case "standard":
form.append( { type: 'radio', name: 'welcomingCommittee', list: Twinkle.welcome.welcomingCommitteeList } );
div.append({ type: 'header', label: 'General welcome templates' });
appendTemplates([
"welcome",
"welcome-short",
"welcome-personal",
"welcome-graphical",
"welcome-menu",
"welcome-screen",
"welcome-belated",
"welcome student",
"welcome teacher"
]);
div.append({ type: 'header', label: 'Problem user welcome templates' });
appendTemplates([
"welcomelaws",
"first article",
"welcomevandal",
"welcomenpov",
"welcomespam",
"welcomeunsourced",
"welcomeauto",
"welcome-COI"
]);
break;
case "anonymous":
div.append({ type: 'header', label: 'Anonymous user welcome templates' });
appendTemplates([
"welcome-anon",
"welcome-anon-test",
"welcome-anon-vandal",
"welcome-anon-constructive"
]);
break;
case "wikiProject":
div.append({ type: 'header', label: 'WikiProject-specific welcome templates' });
appendTemplates([
"welcome-au",
"welcome-bio",
"welcome-cal",
"welcome-conserv",
"welcome-cycling",
"welcome-dbz",
"welcome-et",
"welcome-in",
"welcome-de",
"welcome-math",
"welcome-med",
"welcome-no",
"welcome-phys",
"welcome-pl",
"welcome-rugbyunion",
"welcome-ru",
"welcome-starwars",
"welcome-ch",
"welcome-uk",
"welcome-usroads",
"welcome-videogames"
]);
break;
case "nonEnglish":
div.append({ type: 'header', label: 'Non-English welcome templates' });
appendTemplates([
"welcomeen-sq",
"welcomeen-zh",
"welcomeen-nl",
"welcomeen-fi",
"welcomeen-fr",
"welcomeen-de",
"welcomeen-he",
"welcomeen-ja",
"welcomeen-ko",
"welcomeen-mr",
"welcomeen-ml",
"welcomeen-pt",
"welcomeen-ru",
"welcomeen-es",
"welcomeen-sv",
"welcomeen-uk"
]);
break;
}
 
var rendered = div.render();
form.append( { type:'header', label:'Potential problem user templates' } );
rendered.className = "quickform-scrollbox";
form.append( { type: 'radio', name: 'problem', list: Twinkle.welcome.problemList } );
$workarea.replaceWith(rendered);
 
Twinkle.welcome.selectTemplate({ target: e.target.form.template[0] });
form.append( { type:'header', label:'Anonymous user templates' } );
};
form.append( { type: 'radio', name: 'anonymous', list: Twinkle.welcome.anonymousList } );
 
Twinkle.welcome.selectTemplate = function(e) {
var result = form.render();
var properties = Twinkle.welcome.templates[e.target.values];
Window.setContent( result );
e.target.form.article.disabled = (properties ? !properties.linkedArticle : false);
Window.display();
};
 
 
Twinkle.welcome.standardList = [
// A list of welcome templates and their properties and syntax
{
 
label: '{{Welcome}}: standard welcome*',
// The four fields that are available are "description", "linkedArticle", "syntax", and "tooltip".
value: 'Welcome'
// The three magic words that can be used in the "syntax" field are:
// - $USERNAME$ - replaced by the welcomer's username, depending on user's preferences
// - $ARTICLE$ - replaced by an article name, if "linkedArticle" is true
// - $HEADER$ - adds a level 2 header (most templates already include this)
 
Twinkle.welcome.templates = {
"welcome": {
description: "standard welcome",
linkedArticle: true,
syntax: "{{subst:welcome|$USERNAME$|art=$ARTICLE$}} ~~~~"
},
"welcome-short": {
{
labeldescription: '{{Welcomeshort}}:"a shortshorter welcome' message",
linkedArticle: false,
value: 'Welcomeshort',
syntax: "{{subst:welcome-short|$USERNAME$}} $EXTRA$ ~~~~"
tooltip: 'Includes section heading.'
},
"welcome-personal": {
{
description: "more personal welcome, including a plate of cookies",
label: '{{WelcomeSimple}}: simple welcome',
linkedArticle: false,
value: 'WelcomeSimple',
syntax: "{{subst:welcome-personal|$USERNAME$}} ~~~~"
tooltip: 'Won\'t overwhelm new users. Includes section heading.'
},
"welcome-graphical": {
{
description: "colorful welcome message with table of about 20 links",
label: '{{Welcome-personal}}: includes a plate of cookies',
linkedArticle: false,
value: 'Welcome-personal',
syntax: "$HEADER$ {{subst:welcome-graphical|$EXTRA$}}"
tooltip: 'A personal welcome with an introduction from you and a plate of cookies. Includes section heading and signature.'
},
"welcome-menu": {
{
label: '{{WelcomeMenu}}description: "welcome message with menularge table of about 60 links'",
linkedArticle: false,
value: 'WelcomeMenu',
syntax: "$HEADER$ {{subst:welcome-menu}}"
tooltip: 'Contains a welcome message and many useful links broken up into different sections. Includes signature.'
},
"welcome-screen": {
{
description: "welcome message with clear, annotated table of 10 links",
label: '{{Welcomeg}}: similar to {{WelcomeMenu}}',
linkedArticle: false,
value: 'Welcomeg',
syntax: "$HEADER$ {{subst:welcome-screen}}"
tooltip: 'Contains a welcome message and many useful links broken up into different sections. Includes signature.'
},
"welcome-belated": {
{
description: "welcome for users with more substantial contributions",
label: '{{Welcomeh}}: same as {{Welcomeg}} but with a section heading',
linkedArticle: false,
value: 'Welcomeh',
syntax: "{{subst:welcome-belated|$USERNAME$}}"
tooltip: 'Contains a section heading, a welcome message and many useful links broken up into different sections. Includes section heading and signature.'
},
"welcome student": {
{
description: "welcome for students editing as part of an educational class project",
label: '{{Welcome-belated}}: welcome for users with more substantial contributions',
linkedArticle: false,
value: 'Welcome-belated'
syntax: "$HEADER$ {{subst:welcome student|$USERNAME$}} ~~~~"
},
"welcome teacher": {
{
label: '{{Welcome student}}description: "welcome for students editingcourse asinstructors partinvolved ofin an educational class project'",
linkedArticle: false,
value: 'Welcome student'
syntax: "$HEADER$ {{subst:welcome teacher|$USERNAME$}} ~~~~"
},
"welcomelaws": {
{
description: "welcome with information about copyrights, NPOV, the sandbox, and vandalism",
label: '{{Welcome teacher}}: welcome for course instructors involved in an educational class project',
linkedArticle: false,
value: 'Welcome teacher'
syntax: "{{subst:welcomelaws|$USERNAME$}}"
}
];
/*
Twinkle.welcome.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.'
},
"first article": {
{
description: "for someone whose first article did not meet page creation guidelines",
label: '{{W-basic}}: standard template, similar to {{Welcome}} with additional options',
linkedArticle: true,
value: 'W-basic',
syntax: "{{subst:first article|$ARTICLE$|$USERNAME$}}"
tooltip: 'This template is similar to {{Welcome}} but supports many different options. Includes a signature.'
},
"welcomevandal": {
{
description: "for someone whose initial efforts appear to be vandalism",
label: '{{W-shout}}: extroverted message with bold advice',
linkedArticle: true,
value: 'W-shout',
syntax: "{{subst:welcomevandal|$ARTICLE$|$USERNAME$}}"
tooltip: 'This template is similar to {{WelcomeShout}} but supports many different options. Includes a signature.'
},
"welcomenpov": {
{
description: "for someone whose initial efforts do not adhere to the neutral point of view policy",
label: '{{W-short}}: concise; won\'t overwhelm',
linkedArticle: true,
value: 'W-short||',
syntax: "{{subst:welcomenpov|$ARTICLE$|$USERNAME$}} ~~~~"
tooltip: 'This template is similar to {{Welcomeshort}} but supports many different options. Includes a signature.'
},
"welcomespam": {
{
description: "welcome with additional discussion of anti-spamming policies",
label: '{{W-link}}: shortest greeting, links to Welcoming committee\'s greetings page',
linkedArticle: true,
value: 'W-link',
syntax: "{{subst:welcomespam|$ARTICLE$|$USERNAME$}} ~~~~"
tooltip: 'This template is similar to {{Welcom}} but supports many different options. Includes a signature.'
},
"welcomeunsourced": {
{
description: "for someone whose initial efforts are unsourced",
label: '{{W-graphical}}: graphical menu format to ease transition from the graphic-heavy web',
linkedArticle: true,
value: 'W-graphical',
syntax: "{{subst:welcomeunsourced|$ARTICLE$|$USERNAME$}} ~~~~"
tooltip: 'This template is similar to {{Welcomeg}} but has fewer links. Supports many different options. Includes a signature.'
},
"welcomeauto": {
{
description: "for someone who created an autobiographical article",
label: '{{W-graphic}}: another version of {{W-graphical}}',
linkedArticle: true,
value: 'W-graphic',
syntax: "{{subst:welcomeauto|$USERNAME$|art=$ARTICLE$}} ~~~~"
tooltip: 'This template is similar to {{W-graphic}} but with more powerful colours and changes in text. Supports many different options. Includes a signature.'
},
"welcome-COI": {
description: "for someone who has edited in areas where they may have a conflict of interest",
linkedArticle: true,
syntax: "{{subst:welcome-COI|$USERNAME$|art=$ARTICLE$}} ~~~~"
},
// ANONYMOUS USER WELCOMES
"welcome-anon": {
description: "for anonymous users; encourages creating an account",
linkedArticle: true,
syntax: "{{subst:welcome-anon|art=$ARTICLE$}} ~~~~"
},
"welcome-anon-test": {
description: "for anonymous users who have performed test edits",
linkedArticle: true,
syntax: "{{subst:welcome-anon-test|$ARTICLE$|$USERNAME$}} ~~~~"
},
"welcome-anon-vandal": {
description: "for anonymous users who have vandalized a page",
linkedArticle: true,
syntax: "{{subst:welcome-anon-vandal|$ARTICLE$|$USERNAME$}}"
},
"welcome-anon-constructive": {
description: "for anonymous users who fight vandalism and edit constructively",
linkedArticle: true,
syntax: "{{subst:welcome-anon-constructive|art=$ARTICLE$}} ~~~~"
},
{
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.'
}
];
 
// WIKIPROJECT-SPECIFIC WELCOMES
Twinkle.welcome.problemList = [
 
{
"welcome-au": {
label: '{{Welcomelaws}}: welcome with information about copyrights, npov, the sandbox, and vandalism',
description: "welcome for users with an apparent interest in Australia topics",
value: 'Welcomelaws'
linkedArticle: false,
syntax: "{{subst:welcome-au}} ~~~~"
},
"welcome-bio": {
{
description: "welcome for users with an apparent interest in biographical topics",
label: '{{Firstarticle}}: for someone whose first article did not meet page creation guidelines*',
linkedArticle: false,
value: 'Firstarticle'
syntax: "{{subst:welcome-bio}} ~~~~"
},
"welcome-cal": {
{
description: "welcome for users with an apparent interest in California topics",
label: '{{Welcomevandal}}: for someone whose initial efforts appear to be vandalism*',
linkedArticle: false,
value: 'Welcomevandal',
syntax: "{{subst:welcome-cal}} ~~~~"
tooltip: 'Includes a section heading.'
},
"welcome-conserv": {
{
description: "welcome for users with an apparent interest in conservatism topics",
label: '{{Welcomenpov}}: for someone whose initial efforts do not adhere to the neutral point of view policy*',
linkedArticle: false,
value: 'Welcomenpov'
syntax: "{{subst:welcome-conserv}}"
},
"welcome-cycling": {
{
label: '{{Welcomespam}}description: "welcome for users with additionalan apparent discussioninterest ofin anti-spammingcycling policies*'topics",
linkedArticle: false,
value: 'Welcomespam'
syntax: "{{subst:welcome-cycling}} ~~~~"
},
"welcome-dbz": {
{
description: "welcome for users with an apparent interest in Dragon Ball topics",
label: '{{Welcomeunsourced}}: for someone whose initial efforts are uncited*',
linkedArticle: false,
value: 'Welcomeunsourced'
syntax: "{{subst:welcome-dbz}}"
},
"welcome-et": {
{
description: "welcome for users with an apparent interest in Estonia topics",
label: '{{Welcomeauto}}: for someone who created an autobiographical article*',
linkedArticle: false,
value: 'Welcomeauto'
syntax: "{{subst:welcome-et}}"
},
"welcome-in": {
description: "welcome for users with an apparent interest in India topics",
linkedArticle: false,
syntax: "{{subst:welcome-in}} ~~~~"
},
"welcome-de": {
description: "welcome for users with an apparent interest in Germany topics",
linkedArticle: false,
syntax: "{{subst:welcome-de}} ~~~~"
},
"welcome-math": {
description: "welcome for users with an apparent interest in mathematical topics",
linkedArticle: false,
syntax: "{{subst:welcome-math}} ~~~~"
},
"welcome-med": {
description: "welcome for users with an apparent interest in medicine topics",
linkedArticle: false,
syntax: "{{subst:welcome-med}} ~~~~"
},
"welcome-no": {
description: "welcome for users with an apparent interest in Norway topics",
linkedArticle: false,
syntax: "{{subst:welcome-no}} ~~~~"
},
"welcome-phys": {
description: "welcome for users with an apparent interest in physics topics",
linkedArticle: false,
syntax: "{{subst:welcome-phys}} ~~~~"
},
"welcome-pl": {
description: "welcome for users with an apparent interest in Poland topics",
linkedArticle: false,
syntax: "{{subst:welcome-pl}} ~~~~"
},
"welcome-rugbyunion": {
description: "welcome for users with an apparent interest in rugby union topics",
linkedArticle: false,
syntax: "{{subst:welcome-rugbyunion}} ~~~~"
},
"welcome-ru": {
description: "welcome for users with an apparent interest in Russia topics",
linkedArticle: false,
syntax: "{{subst:welcome-ru}} ~~~~"
},
"welcome-starwars": {
description: "welcome for users with an apparent interest in Star Wars topics",
linkedArticle: false,
syntax: "{{subst:welcome-starwars}} ~~~~"
},
"welcome-ch": {
description: "welcome for users with an apparent interest in Switzerland topics",
linkedArticle: false,
syntax: "{{subst:welcome-ch}} ~~~~"
},
"welcome-uk": {
description: "welcome for users with an apparent interest in Ukraine topics",
linkedArticle: false,
syntax: "{{subst:welcome-uk}} ~~~~"
},
"welcome-usroads": {
description: "welcome for users with an apparent interest in US roads topics",
linkedArticle: false,
syntax: "{{subst:welcome-usroads}}"
},
"welcome-videogames": {
description: "welcome for users with an apparent interest in video game topics",
linkedArticle: false,
syntax: "{{subst:welcome-videogames}}"
},
{
label: '{{Welcome-COI}}: for someone who created or edited an article about a subject with which they have a conflict of interest*',
value: 'Welcome-COI'
}
];
 
// NON-ENGLISH WELCOMES
Twinkle.welcome.anonymousList = [
 
{
"welcomeen-sq": {
label: '{{Welcome-anon}}: for anonymous users; encourages getting a username*',
description: "welcome for users whose first language appears to be Albanian",
value: 'Welcome-anon'
linkedArticle: false,
syntax: "{{subst:welcomeen-sq}}"
},
"welcomeen-zh": {
{
description: "welcome for users whose first language appears to be Chinese",
label: '{{Welcomeanon2}}: similar to {{Welcome-anon}} but with hints and tips*',
linkedArticle: false,
value: 'Welcomeanon2',
syntax: "{{subst:welcomeen-zh}}"
tooltip: 'Includes section heading.'
},
"welcomeen-nl": {
{
description: "welcome for users whose first language appears to be Dutch",
label: '{{Welc-anon}}: similar to {{Welcome-anon}} but with a border and section heading',
linkedArticle: false,
value: 'Welc-anon||',
syntax: "{{subst:welcomeen-nl}}"
tooltip: 'Includes section heading.'
},
"welcomeen-fi": {
{
description: "welcome for users whose first language appears to be Finnish",
label: '{{Welcome-anon-test}}: for anonymous users who have performed test edits*',
linkedArticle: false,
value: 'Welcome-anon-test',
syntax: "{{subst:welcomeen-fi}}"
tooltip: 'Includes a section heading.'
},
"welcomeen-fr": {
{
description: "welcome for users whose first language appears to be French",
label: '{{Welcome-anon-vandal}}: for anonymous users who have vandalized a page*',
linkedArticle: false,
value: 'Welcome-anon-vandal',
syntax: "{{subst:welcomeen-fr}}"
tooltip: 'Includes a section heading and signature.'
},
"welcomeen-de": {
{
description: "welcome for users whose first language appears to be German",
label: '{{Welcome-anon-vandalism-fighter}}: for anonymous users who fight vandalism, urging them to create an account*',
linkedArticle: false,
value: 'Welcome-anon-vandalism-fighter',
syntax: "{{subst:welcomeen-de}}"
tooltip: 'Includes section heading.'
},
"welcomeen-he": {
{
description: "welcome for users whose first language appears to be Hebrew",
label: '{{Wel-constructive-anon}}: for anonymous users who have helped in vandal fighting and have made constructive edits. Also urges them to create an account*' ,
linkedArticle: false,
value: 'Wel-constructive-anon',
syntax: "{{subst:welcomeen-he}}"
tooltip: 'Includes section heading.'
},
"welcomeen-ja": {
description: "welcome for users whose first language appears to be Japanese",
linkedArticle: false,
syntax: "{{subst:welcomeen-ja}}"
},
"welcomeen-ko": {
description: "welcome for users whose first language appears to be Korean",
linkedArticle: false,
syntax: "{{subst:welcomeen-ko}}"
},
"welcomeen-mr": {
description: "welcome for users whose first language appears to be Marathi",
linkedArticle: false,
syntax: "{{subst:welcomeen-mr}}"
},
"welcomeen-ml": {
description: "welcome for users whose first language appears to be Malayalam",
linkedArticle: false,
syntax: "{{subst:welcomeen-ml}}"
},
"welcomeen-pt": {
description: "welcome for users whose first language appears to be Portuguese",
linkedArticle: false,
syntax: "{{subst:welcomeen-pt}}"
},
"welcomeen-ru": {
description: "welcome for users whose first language appears to be Russian",
linkedArticle: false,
syntax: "{{subst:welcomeen-ru}}"
},
"welcomeen-es": {
description: "welcome for users whose first language appears to be Spanish",
linkedArticle: false,
syntax: "{{subst:welcomeen-es}}"
},
"welcomeen-sv": {
description: "welcome for users whose first language appears to be Swedish",
linkedArticle: false,
syntax: "{{subst:welcomeen-sv}}"
},
"welcomeen-uk": {
description: "welcome for users whose first language appears to be Ukrainian",
linkedArticle: false,
syntax: "{{subst:welcomeen-uk}}"
}
];
*/
// Set to true if template does not already have heading
Twinkle.welcome.headingHash = {
'Welcome': false,
'Welcomeshort': false,
'WelcomeSimple': false,
'Welcom': false,
'Welcome-personal': false,
'WelcomeMenu': true,
'Welcomeg': true,
'Welcomeh': false,
'Welcome-belated': false,
'Welcome student': true,
'Welcome teacher': true,
'Wel': false,
'W-basic': true,
'W-shout': true,
'W-short||': true,
'W-link': true,
'W-graphical': true,
'W-graphic': 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-test': false,
'Welcome-anon-vandalism-fighter': false,
'Welcome-anon-vandal': false,
'Wel-constructive-anon' : false
};
 
Twinkle.welcome.getTemplateWikitext = function(template, article) {
// Set to true if template already has signature
var properties = Twinkle.welcome.signatureHash = {templates[template];
if (properties) {
'Welcome': false,
return properties.syntax.
'Welcomeshort': false,
replace("$USERNAME$", Twinkle.getFriendlyPref("insertUsername") ? mw.config.get("wgUserName") : "").
'WelcomeSimple': false,
replace("$ARTICLE$", article ? article : "").
'Welcom': true,
replace(/\$HEADER\$\s*/, "== Welcome ==\n\n").
'Welcome-personal': false,
replace("$EXTRA$", ""); // EXTRA is not implemented yet
'WelcomeMenu': true,
} else {
'Welcomeg': true,
return "{{subst:" + template + (article ? ("|art=" + article) : "") + "}} ~~~~";
'Welcomeh': true,
}
'Welcome-belated': true,
'Welcome student': false,
'Welcome teacher': false,
'Wel': false,
'W-basic': true,
'W-shout': true,
'W-short||': true,
'W-link': true,
'W-graphical': true,
'W-graphic': true,
'W-screen': true,
'Welcomelaws': false,
'Firstarticle': true,
'Welcomevandal': true,
'Welcomenpov': false,
'Welcomespam': false,
'Welcomeunsourced': false,
'Welcome-COI': false,
'Welcome-anon': false,
'Welcomeanon2': false,
'Welc-anon||': false,
'Welcome-anon-test': false,
'Welcome-anon-vandalism-fighter': false,
'Welcome-anon-vandal': true,
'Wel-constructive-anon' : false
};
 
Twinkle.welcome.callbacks = {
/* Set to true if template supports article
preview: function(form) {
* name from art template parameter
var previewDialog = new SimpleWindow(750, 400);
*/
previewDialog.setTitle("Welcome template preview");
Twinkle.welcome.artHash = {
previewDialog.setScriptName("Welcome user");
'Welcome': true,
previewDialog.setModality(true);
'Welcomeshort': false,
'WelcomeSimple': false,
'Welcom': false,
'Welcome-personal': false,
'WelcomeMenu': false,
'Welcomeg': false,
'Welcomeh': false,
'Welcome-belated': false,
'Welcome student': false,
'Welcome teacher': false,
'Wel': true,
'W-basic': false,
'W-shout': false,
'W-short||': false,
'W-link': false,
'W-graphical': false,
'W-graphic': 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-test': false,
'Welcome-anon-vandalism-fighter': true,
'Welcome-anon-vandal': false,
'Wel-constructive-anon' : true
};
 
var previewdiv = document.createElement("div");
/* Set to true if template supports article
previewdiv.style.marginLeft = previewdiv.style.marginRight = "0.5em";
* name from vanarticle template parameter
previewdiv.style.fontSize = "small";
*/
previewDialog.setContent(previewdiv);
Twinkle.welcome.vandalHash = {
'Welcome': false,
'Welcomeshort': false,
'WelcomeSimple': false,
'Welcom': false,
'Welcome-personal': false,
'WelcomeMenu': false,
'Welcomeg': false,
'Welcomeh': false,
'Welcome-belated': false,
'Welcome student': false,
'Welcome teacher': false,
'Wel': false,
'W-basic': false,
'W-shout': false,
'W-short||': false,
'W-link': false,
'W-graphical': false,
'W-graphic': 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-test': true, // even though not a vandalism warning
'Welcome-anon-vandalism-fighter': false,
'Welcome-anon-vandal': true,
'Wel-constructive-anon': false
};
 
var previewer = new Wikipedia.preview(previewdiv);
Twinkle.welcome.callbacks = {
previewer.beginRender(Twinkle.welcome.getTemplateWikitext(form.getChecked("template"), form.article.value));
 
var submit = document.createElement("input");
submit.setAttribute("type", "submit");
submit.setAttribute("value", "Close");
previewDialog.addContent(submit);
 
previewDialog.display();
 
$(submit).click(function(e) {
previewDialog.close();
});
},
main: function( pageobj ) {
var params = pageobj.getCallbackParameters();
var oldTexttext = pageobj.getPageText();
 
// abort if mode is auto and form is not empty
if( pageobj.exists() && params.mode === 'auto' ) {
Line ೨,೪೨೬ ⟶ ೨,೬೦೬:
return;
}
 
var welcomeText = Twinkle.welcome.getTemplateWikitext(params.value, params.article);
var text = '';
 
Status.info( 'Info', 'Will add the welcome template to the ' +
( Twinkle.getFriendlyPref('topWelcomes') ? 'top' : 'bottom' ) +
' of the user\'s talk page.' );
if( !Twinkle.getFriendlyPref('topWelcomes') ) {
text += oldText + '\n';
}
if( Twinkle.welcome.headingHash[ params.value ] && Twinkle.getFriendlyPref('insertHeadings') ) {
Status.info( 'Info', 'Will create a new heading for the welcome' );
// strip section header markers from pref, to preserve backwards compatibility
text += "== " + Twinkle.getFriendlyPref('welcomeHeading').replace(/^\s*=+\s*(.*?)\s*=+$\s*/, "$1") + " ==\n";
}
Status.info( 'Info', 'Will substitute the {{' + params.value + '}} welcome template' );
text += '{{subst:' + params.value;
if( Twinkle.welcome.artHash[ params.value ] ) {
if( Twinkle.getFriendlyPref('insertUsername') && params.value.substring(2,0) !== 'W-' ) {
Status.info( 'Info', 'Will add your username to the template' );
text += '|' + mw.config.get('wgUserName');
}
if( params.article ) {
Status.info( 'Info', 'Will add article link to the template' );
text += '|art=' + params.article;
}
} else if( Twinkle.welcome.vandalHash[ params.value ] ) {
if( params.article ) {
Status.info( 'Info', 'Will add article link to the template' );
}
text += '|' + params.article;
if( Twinkle.getFriendlyPref('insertUsername') && params.value.substring(2,0) !== 'W-' ) {
Status.info( 'Info', 'Will add your username to the template' );
text += '|' + mw.config.get('wgUserName');
}
} else if( Twinkle.getFriendlyPref('insertUsername') && params.value.substring(2,0) !== 'W-' ) {
Status.info( 'Info', 'Will add your username to the template' );
text += '|' + mw.config.get('wgUserName');
}
text += '}}';
if( !Twinkle.welcome.signatureHash[ params.value ] && Twinkle.getFriendlyPref('insertSignature') ) {
Status.info( 'Info', 'Will add your signature after the welcome' );
text += ' \n~~~~';
}
if( Twinkle.getFriendlyPref('topWelcomes') ) {
text += welcomeText + '\n\n' + oldTexttext;
} else {
text += "\n" + welcomeText;
}
 
var summaryText = "Added Adding" + ( Twinkle.getFriendlyPref('maskTemplateInSummary') ? 'welcome' : ( ' {{[[Template:' + params.value + '|' + params.value + ']]}}' ) ) +
" welcome template to user talk page.";
pageobj.setPageText(text);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setMinorEdit(false);
pageobj.setWatchlist(Twinkle.getFriendlyPref('watchWelcomes'));
pageobj.setCreateOption('recreate');
Line ೨,೪೯೨ ⟶ ೨,೬೨೬:
 
Twinkle.welcome.callback.evaluate = function friendlywelcomeCallbackEvaluate(e) {
var form = e.target;
// Ignore if a change to the text field triggered this event
 
if( e.target.name === 'article' ) {
return;
}
var params = {
value: eform.target.valuesgetChecked("template"),
article: e.target.form.article.value,
mode: 'manual'
};
 
SimpleWindow.setButtonsEnabled( false );
Status.init( e.target.form );
 
Wikipedia.actionCompleted.redirect = mw.config.get('wgPageName');
Line ೫,೦೯೪ ⟶ ೫,೨೨೫:
helptip: "Doing so adds to the personal element of welcoming a user - you will be able to see how they are coping as a newbie, and possibly help them.",
type: "boolean"
},
{
name: "insertHeadings",
label: "Insert a section heading before welcomes",
type: "boolean"
},
{
name: "welcomeHeading",
label: "Section heading to use for welcomes",
helptip: "Only has an effect if headings are enabled, and the heading is not part of the template.",
type: "string"
},
{
Line ೫,೧೧೦ ⟶ ೫,೨೩೦:
label: "Add your username to the template (where applicable)",
helptip: "Some welcome templates have an opening sentence like \"Hi, I'm <username>. Welcome\" etc. If you turn off this option, these templates will not display your username in that way.",
type: "boolean"
},
{
name: "insertSignature",
label: "Add your signature after the welcome",
helptip: "Strongly recommended.",
type: "boolean"
},
Line ೧೧,೨೨೨ ⟶ ೧೧,೩೩೬:
previewlink.style.cursor = "pointer";
previewlink.textContent = 'Preview';
more.append( { type: 'div', nameid: 'warningpreview', label: [ previewlink ] } );
more.append( { type: 'div', id: 'twinklewarn-previewbox', style: 'display: none' } );
 
more.append( { type:'submit', label:'Submit' } );
Line ೧೧,೨೩೦ ⟶ ೧೧,೩೪೫:
Window.display();
result.main_group.root = result;
result.previewer = new Wikipedia.preview($(result).find('div#twinklewarn-previewbox').last()[0]);
 
// We must init the first choice (General Note);
Line ೧೨,೩೮೦ ⟶ ೧೨,೪೯೬:
 
$(e.target.root.reason).parent().hide();
e.target.root.previewer.closePreview();
$("div#twinklewarn-previewbox:visible").last().remove();
} else if( e.target.root.block_timer ) {
// hide the block-related fields
Line ೧೨,೩೯೮ ⟶ ೧೨,೫೧೪:
 
$(e.target.root.reason).parent().show();
e.target.root.previewer.closePreview();
$("div#twinklewarn-previewbox:visible").last().remove();
}
};
Line ೧೨,೪೭೭ ⟶ ೧೨,೫೯೩:
preview: function(form) {
var templatename = form.sub_group.value;
 
var previewdiv = $(form).find('div[name="warningpreview"]').last();
if (!previewdiv.length) {
return; // just give up
}
previewdiv = previewdiv[0];
 
var previewbox = $(form).find('div#twinklewarn-previewbox').last();
if (!previewbox.length) {
previewbox = document.createElement('div');
previewbox.style.background = "white";
previewbox.style.border = "2px inset";
previewbox.style.marginTop = "0.4em";
previewbox.style.padding = "0.2em 0.4em";
previewbox.setAttribute('id', 'twinklewarn-previewbox');
previewdiv.parentNode.appendChild(previewbox);
} else {
previewbox.show();
previewbox = previewbox[0];
}
 
var statusspan = document.createElement('span');
previewbox.appendChild(statusspan);
Status.init(statusspan);
var templatetext = '{{subst:' + templatename;
Line ೧೨,೫೩೮ ⟶ ೧೨,೬೩೦:
}
 
form.previewer.beginRender(templatetext);
var query = {
action: 'parse',
prop: 'text',
pst: 'true', // PST = pre-save transform; this makes substitution work properly
text: templatetext,
title: mw.config.get('wgPageName')
};
var wikipedia_api = new Wikipedia.api("loading...", query, Twinkle.warn.callbacks.previewRender, new Status("Preview"));
wikipedia_api.params = { previewbox: previewbox };
wikipedia_api.post();
},
previewRender: function( apiobj ) {
var params = apiobj.params;
var xml = apiobj.getXML();
var html = $(xml).find('text').text();
if (!html) {
apiobj.statelem.error("failed to retrieve preview, or warning template was blanked");
return;
}
params.previewbox.innerHTML = html;
// fix vertical alignment
$(params.previewbox).find(':not(img)').css('vertical-align', 'baseline');
},
main: function( pageobj ) {
Line ೧೪,೩೬೯ ⟶ ೧೪,೪೪೦:
// Load the modules in the order that the tabs should appears
// User/user talk-related
// Twinkle.arv();
// Twinkle.warn();
Twinkle.welcome();
// Twinkle.shared();
// Twinkle.talkback();
// Deletion
// Twinkle.speedy();
// Twinkle.prod();
// Twinkle.xfd();
// Twinkle.image();
// Maintenance
// Twinkle.protect();
// Twinkle.tag();
// Misc. ones last
Twinkle.diff();
Line ೧೪,೩೯೦ ⟶ ೧೪,೪೬೧:
//Twinkle.closer(); -- disabled for the moment, as it is disliked among Twinkle users -- TTO 2011-05-30
Twinkle.delimages();
// Twinkle.deprod();
Twinkle.batchdelete();
Twinkle.batchprotect();
"https://kn.wikipedia.org/wiki/ಮೀಡಿಯವಿಕಿ:Gadget-Twinkle.js" ಇಂದ ಪಡೆಯಲ್ಪಟ್ಟಿದೆ