User:Fetchcomms/vector.js: Difference between revisions
Appearance
Content deleted Content added
Fetchcomms (talk | contribs) hm |
Fetchcomms (talk | contribs) fubar |
||
Line 2: | Line 2: | ||
if( typeof( TwinkleConfig ) == 'undefined' ) TwinkleConfig = {}; |
if( typeof( TwinkleConfig ) == 'undefined' ) TwinkleConfig = {}; |
||
TwinkleConfig.portletId = 'p-cactions'; |
TwinkleConfig.portletId = 'p-cactions'; |
||
Twinkle.welcome.callbacks = { |
|||
main: function( pageobj ) { |
|||
var params = pageobj.getCallbackParameters(); |
|||
var oldText = pageobj.getPageText(); |
|||
// abort if mode is auto and form is not empty |
|||
if( pageobj.exists() && params.mode === 'auto' ) { |
|||
Status.info( 'Warning', 'User talk page not empty; aborting automatic welcome' ); |
|||
Wikipedia.actionCompleted.event(); |
|||
return; |
|||
} |
|||
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') ) { |
|||
Status.info( 'Info', 'Will add your username to the template' ); |
|||
text += '|' + mw.config.get('wgUserName'); |
|||
} |
|||
} else if( Twinkle.getFriendlyPref('insertUsername') ) { |
|||
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<span style="font-family:Georgia;font-size:80%;">'''/[[User:Fetchcomms|<span style="color:#000;">ƒETCH</span>]][[User talk:Fetchcomms|<span style="color:#000;">COMMS</span>]][[Special:Contributions/Fetchcomms|<span style="color:#000;">/</span>]]'''</span> 17:43, 30 May 2011 (UTC)'; |
|||
} |
|||
if( Twinkle.getFriendlyPref('topWelcomes') ) { |
|||
text += '\n\n' + oldText; |
|||
} |
|||
var summaryText = "Added " + ( Twinkle.getFriendlyPref('maskTemplateInSummary') + " template to user talk page"; |
|||
pageobj.setPageText(text); |
|||
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd')); |
|||
pageobj.setMinorEdit(Twinkle.getFriendlyPref('markWelcomesAsMinor')); |
|||
pageobj.setWatchlist(Twinkle.getFriendlyPref('watchWelcomes')); |
|||
pageobj.setCreateOption('recreate'); |
|||
pageobj.save(); |
|||
} |
|||
}; |
|||
importScript('User:Eraserhead1/hangon.js'); |
importScript('User:Eraserhead1/hangon.js'); |
Revision as of 17:43, 30 May 2011
importScript('MediaWiki:Gadget-Twinkle.js');
if( typeof( TwinkleConfig ) == 'undefined' ) TwinkleConfig = {};
TwinkleConfig.portletId = 'p-cactions';
Twinkle.welcome.callbacks = {
main: function( pageobj ) {
var params = pageobj.getCallbackParameters();
var oldText = pageobj.getPageText();
// abort if mode is auto and form is not empty
if( pageobj.exists() && params.mode === 'auto' ) {
Status.info( 'Warning', 'User talk page not empty; aborting automatic welcome' );
Wikipedia.actionCompleted.event();
return;
}
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') ) {
Status.info( 'Info', 'Will add your username to the template' );
text += '|' + mw.config.get('wgUserName');
}
} else if( Twinkle.getFriendlyPref('insertUsername') ) {
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<span style="font-family:Georgia;font-size:80%;">'''/[[User:Fetchcomms|<span style="color:#000;">ƒETCH</span>]][[User talk:Fetchcomms|<span style="color:#000;">COMMS</span>]][[Special:Contributions/Fetchcomms|<span style="color:#000;">/</span>]]'''</span> 17:43, 30 May 2011 (UTC)';
}
if( Twinkle.getFriendlyPref('topWelcomes') ) {
text += '\n\n' + oldText;
}
var summaryText = "Added " + ( Twinkle.getFriendlyPref('maskTemplateInSummary') + " template to user talk page";
pageobj.setPageText(text);
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
pageobj.setMinorEdit(Twinkle.getFriendlyPref('markWelcomesAsMinor'));
pageobj.setWatchlist(Twinkle.getFriendlyPref('watchWelcomes'));
pageobj.setCreateOption('recreate');
pageobj.save();
}
};
importScript('User:Eraserhead1/hangon.js');
addOnloadHook(finishedLoading);
// Tasks to perform after everything else has finished loading
function finishedLoading()
{
// Reload anchors
var url = location.href.split('/');
if (url[url.length - 1].indexOf('#') != -1) location.href = location.href;
}
// importScript('User:7/userhighlighter.js'); for ACE2010
importScript('User:GregU/dashes.js');
importScript('User:Gary King/show upload deletion logs.js');
importScript('User:Animum/massdelete.js');
importScript('User:Drilnoth/delresized.js');
importScript('User:Ale_jrb/Scripts/csdhelper.js'); //[[User:Ale_jrb/Scripts]]
importScript('User:SoWhy/csdreasons.js');
importScript('User:Tim Song/closeAFD.js');
importScript('User:Splarka/ajaxfilemove.js');
importScript('User:King of Hearts/closexfd.js');
importScript('User:AzaToth/twinkle.js');
importScript('User:Dr_pda/prosesize.js'); //[[User:Dr_pda/prosesize.js]]
importScript('User:Mr.Z-man/refToolbar 2.0.js');
importScript('User:Intelligentsium/reftools.js');
importScript('User:AWeenieMan/furme.js');
importScript('User:Dapete/ImageMapEdit.js');
// importScript('User:TheJosh/Scripts/NewPagePatrol.js');
importScript('User:Tim Song/afchelper4.js');
// importScript('User:Ale_jrb/Scripts/igloo.js'); // [[User:Ale_jrb/Scripts/igloo]]
importScript('User:Fetchcomms/friendly.js');
if( typeof( FriendlyConfig ) == 'undefined' ) FriendlyConfig = {}; // DO NOT REMOVE THIS LINE - ALL FRIENDLY SETTINGS AFTER THIS
FriendlyConfig.clockStyle = "dynamic";
FriendlyConfig.enableClock = true;
FriendlyConfig.groupByDefault = true;
FriendlyConfig.idsToRename = [
{ id: 'ca-nstab-main', name: 'Main', mainPageOnly: true },
{ id: 'ca-nstab-help', name: 'Help' },
{ id: 'ca-nstab-special', name: 'Special' },
{ id: 'ca-nstab-project', name: 'Project' },
{ id: 'ca-nstab-user', name: 'User' },
{ id: 'ca-edit', name: 'Edit' },
{ id: 'ca-viewsource', name: 'Source' },
{ id: 'ca-talk', name: 'Talk' },
{ id: 'ca-undelete', name: 'Undelete' },
{ id: 'ca-addsection', name: '+' }
];
FriendlyConfig.insertHeadings = false;
FriendlyConfig.insertSignature = false;
FriendlyConfig.insertUsername = true;
FriendlyConfig.markSharedIPAsMinor = true;
FriendlyConfig.markTaggedPagesAsMinor = true;
FriendlyConfig.markTaggedPagesAsPatrolled = true;
FriendlyConfig.markTalkbackAsMinor = true;
FriendlyConfig.markWelcomesAsMinor = true;
FriendlyConfig.maskTemplateInSummary = true;
FriendlyConfig.quickWelcomeMode = "auto";
FriendlyConfig.quickWelcomeTemplate = "Welcome";
FriendlyConfig.summaryAd = " using [[WP:FRIENDLY|Friendly]]";
FriendlyConfig.talkbackHeading = "== Talkback ==";
FriendlyConfig.topWelcomes = false;
FriendlyConfig.watchTaggedPages = false;
FriendlyConfig.watchWelcomes = false;
FriendlyConfig.welcomeHeading = "==Just a note==";
FriendlyConfig.customWelcomeList = [
/* {
label: '{{User:Fetchcomms/m/1}}: Christmas 1',
value: 'User:Fetchcomms/m/1' },
{
label: '{{User:Fetchcomms/m/2}}: Christmas 2',
value: 'User:Fetchcomms/m/2' },
{
label: '{{User:Fetchcomms/m/3}}: Christmas 3',
value: 'User:Fetchcomms/m/3' },
{
label: '{{User talk:Fetchcomms/m}}: Christmas 4',
value: 'User talk:Fetchcomms/m' },
*/ {
label: '{{User:Fetchcomms/tb3}}: Talkback 3',
value: 'User:Fetchcomms/tb3|User talk:Fetchcomms' },
{
label: '{{User:Fetchcomms/tb2}}: Talkback 2',
value: 'User:Fetchcomms/tb2|Fetchcomms|20:41, 19 April 2010 (UTC)' },
{
label: '{{User:Fetchcomms/w}}: Welcome 2',
value: 'User:Fetchcomms/w' },
{
label: '{{User:Fetchcomms/MO}}: MO default',
value: 'User:Fetchcomms/MO' },
{
label: '{{User:Fetchcomms/MO}}: MO listed',
value: 'User:Fetchcomms/MO|list' },
{
label: '{{User:Fetchcomms/MO}}: MO living',
value: 'User:Fetchcomms/MO|live' },
{
label: '{{User:Fetchcomms/Christmas}}: Christmas',
value: 'User:Fetchcomms/Christmas' },
{
label: '{{User:Fetchcomms/Thanks}}: Thanks',
value: 'User:Fetchcomms/Thanks' },
{
label: '{{User:Fetchcomms/Thankyou}}: Thank you',
value: 'User:Fetchcomms/Thankyou' },
{
label: '{{User:Fetchcomms/Goodwork}}: Good work',
value: 'User:Fetchcomms/Goodwork' },
{
label: '{{User:Fetchcomms/Welcome}}: Welcome',
value: 'User:Fetchcomms/Welcome' },
{
label: '{{User:Fetchcomms/Welcome}}: Welcome IP',
value: 'User:Fetchcomms/Welcome|a' },
{
label: '{{User:Fetchcomms/tb}}: tb',
value: 'User:Fetchcomms/tb' },
{
label: '{{User:Fetchcomms/Message}}: Message',
value: 'User:Fetchcomms/Message' },
{
label: '{{User:Fetchcomms/t}}: Various',
value: 'User:Fetchcomms/t' }
];