"மீடியாவிக்கி:Gadget-friendlyshared.js" பக்கத்தின் திருத்தங்களுக்கிடையேயான வேறுபாடு

1,074 பைட்டுகள் சேர்க்கப்பட்டது ,  2 மாதங்களுக்கு முன்
update from enwiki
("//<nowiki> (function($){ /* *********************************..."-இப்பெயரில் புதிய பக்கம் உருவாக்கப்பட்டுள்ளது)
 
(update from enwiki)
 
// <nowiki>
 
 
(function($) {
 
 
* Mode of invocation: Tab ("Shared")
* Active on: Existing IP user talk pages
* Config directives in: FriendlyConfig
*/
 
Twinkle.shared = function friendlyshared() {
if( (mw.config.get('wgNamespaceNumber') === 3 && Morebitsmw.util.isIPAddress(mw.config.get('wgTitle')) ) {
var username = mw.config.get('wgTitlewgRelevantUserName').split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes
Twinkle.addPortletLink( function() { Twinkle.shared.callback(username); }, "Shared IP", "friendly-shared", "Shared IP tagging" );
Twinkle.shared.callback(username);
}, 'Shared IP', 'friendly-shared', 'Shared IP tagging');
}
};
 
Twinkle.shared.callback = function friendlysharedCallback() {
var Window = new Morebits.simpleWindow( 600, 420 450);
Window.setTitle( "'Shared IP address tagging" ');
Window.setScriptName( "'Twinkle" ');
Window.addFooterLink('Shared "Twinkle help"prefs', "'WP:TW/DOCPREF#shared" ');
Window.addFooterLink('Twinkle help', 'WP:TW/DOC#shared');
Window.addFooterLink('Give feedback', 'WT:TW');
 
var form = new Morebits.quickForm( Twinkle.shared.callback.evaluate );
 
var div = form.append( {
type: 'div',
id: 'sharedip-templatelist',
className: 'morebits-scrollbox'
}
);
div.append( { type: 'header', label: 'Shared IP address templates' } );
div.append( { type: 'radio', name: 'sharedtemplate', list: Twinkle.shared.standardList,
event: function( e ) {
Twinkle.shared.callback.change_shared( e );
e.stopPropagation();
}
} );
 
var org = form.append( { type: 'field', label: 'Fill in other details (optional) and click \"Submit\"' } );
org.append( {
type: 'input',
name: 'organization',
label: 'IP address owner/operator',
disabled: true,
tooltip: 'You can optionally enter the name of the organization that owns/operates the IP address. You can use wikimarkup if necessary.'
}
);
org.append( {
type: 'input',
name: 'host',
label: 'Host name (optional)',
disabled: true,
tooltip: 'The host name (for example, proxy.example.com) can be optionally entered here and will be linked by the template.'
}
);
org.append( {
type: 'input',
name: 'contact',
label: 'Contact information (only if requested)',
disabled: true,
tooltip: 'You can optionally enter some contact details for the organization. Use this parameter only if the organization has specifically requested that it be added. You can use wikimarkup if necessary.'
}
);
 
var previewlink = document.createElement('a');
form.append( { type:'submit' } );
$(previewlink).click(function() {
Twinkle.shared.preview(result);
});
previewlink.style.cursor = 'pointer';
previewlink.textContent = 'Preview';
form.append({ type: 'div', id: 'sharedpreview', label: [ previewlink ] });
form.append( { type: 'submit' } );
 
var result = form.render();
Window.setContent( result );
Window.display();
};
 
Twinkle.shared.callback.change_shared = function friendlysharedCallbackChangeShared(e) {
e.target.form.contact.disabled = (e.target.value !== 'Shared IP edu'); // only supported by {{Shared IP edu}}
e.target.form.organization.disabled = false;
e.target.form.host.disabled = (e.target.value === 'Whois'); // host= not supported by {{Whois}}
};
 
Twinkle.shared.callbacks = {
main: function( pageobj ) {
var params = pageobj.getCallbackParameters();
var pageText = pageobj.getPageText();
var found = false;
var text = '{{';
 
for( (var i = 0; i < Twinkle.shared.standardList.length; i++ ) {
var tagRe = new RegExp( '(\\{\\{' + Twinkle.shared.standardList[i].value + '(\\||\\}\\}))', 'im' );
if ( tagRe.exec( pageText ) ) {
Morebits.status.warn( 'Info', 'Found {{' + Twinkle.shared.standardList[i].value + '}} on the user\'s talk page already...aborting' );
found = true;
}
}
 
if ( found ) {
return;
}
 
Morebits.status.info( 'Info', 'Will add the shared IP address template to the top of the user\'s talk page.' );
var text += paramsTwinkle.value + '|' + shared.getTemplateWikitext(params.organization);
if( params.value === 'Shared IP edu' && params.contact !== '') {
text += '|' + params.contact;
}
if( params.value !== 'Whois' && params.host !== '' ) {
text += '|host=' + params.host;
}
text += '}}\n\n';
 
var summaryText = 'Added {{[[Template:' + params.valuetemplate + '|' + params.valuetemplate + ']]}} template.';
pageobj.setPageText(text + pageText);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setMinorEditsetChangeTags(Twinkle.getFriendlyPref('markSharedIPAsMinor')changeTags);
pageobj.setMinorEdit(Twinkle.getPref('markSharedIPAsMinor'));
pageobj.setCreateOption('recreate');
pageobj.save();
};
 
Twinkle.shared.callback.evaluatepreview = function friendlysharedCallbackEvaluate(eform) {
var sharedinput = eMorebits.targetquickForm.getCheckedgetInputData( 'shared' form);
if ( !shared || sharedinput.length <= 0 template) {
var previewDialog = new Morebits.simpleWindow(700, 500);
alert( 'You must select a shared IP address template to use!' );
previewDialog.setTitle('Shared IP template preview');
return;
previewDialog.setScriptName('Add Shared IP template');
previewDialog.setModality(true);
 
var previewdiv = document.createElement('div');
previewdiv.style.marginLeft = previewdiv.style.marginRight = '0.5em';
previewdiv.style.fontSize = 'small';
previewDialog.setContent(previewdiv);
 
var previewer = new Morebits.wiki.preview(previewdiv);
previewer.beginRender(Twinkle.shared.getTemplateWikitext(input), mw.config.get('wgPageName'));
 
var submit = document.createElement('input');
submit.setAttribute('type', 'submit');
submit.setAttribute('value', 'Close');
previewDialog.addContent(submit);
 
previewDialog.display();
 
$(submit).click(function() {
previewDialog.close();
});
}
};
 
Twinkle.shared.getTemplateWikitext = function(input) {
var value = shared[0];
var text = '{{' + input.template + '|' + input.organization;
if (input.contact) {
text += '|' + paramsinput.contact;
}
if (input.host) {
text += '|host=' + paramsinput.host;
}
var text += '{{}}\n\n';
return text;
};
 
Twinkle.shared.callback.evaluate = function friendlysharedCallbackEvaluate(e) {
if( e.target.organization.value === '') {
var params = Morebits.quickForm.getInputData(e.target);
alert( 'You must input an organization for the {{' + value + '}} template!' );
if (!params.template) {
alert( 'You must select a shared IP address template to use!' );
return;
}
if ( e.target!params.organization.value === '') {
alert( 'You must input an organization for the {{' + valueparams.template + '}} template!' );
return;
}
 
Morebits.simpleWindow.setButtonsEnabled( false );
var params = {
Morebits.status.init( e.target );
value: value,
organization: e.target.organization.value,
host: e.target.host.value,
contact: e.target.contact.value
};
 
Morebits.simpleWindow.setButtonsEnabled( false );
Morebits.status.init( e.target );
 
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.notice = "'Tagging complete, reloading talk page in a few seconds"';
 
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "'User talk page modification"');
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.shared.callbacks.main);
};
 
Twinkle.addInitCallback(Twinkle.shared, 'shared');
})(jQuery);
 
 
// </nowiki>
10,498

தொகுப்புகள்

"https://ta.wikipedia.org/wiki/சிறப்பு:MobileDiff/3108513" இருந்து மீள்விக்கப்பட்டது