User:Penubag/vector.js

/*██████Imported Scripts██████*/

importScript('User:Alex Smotrov/histcomb.js');

// importScript('User:TheFearow/qstring.js');

importScript('Wikipedia:WikiProject User scripts/Scripts/Time');

importScript('User:Ais523 non-admin/adminrights.js');

//importScript('User:Misza13/watchlistSorter.js');

//If you add this script to your monobook, it will mark all linked blocked users with a strikethrough, and mark all linked indefinitely blocked users with italics and a strikethrough.

mw.loader.load('https://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript');

/*██████Edit Count██████*/

importScript('User:ais523/editcount.js'); //User:ais523/editcount.js

/*██████Hide top contrib██████*/

importScript('User:Ais523/hidetopcontrib.js');

// User:Ais523/hidetopcontrib.js

// By a suggestion by User:Discospinster

// This script color-codes lines according to who has the top contribution for a page.

//

function hidetopcontrib()

{

var i,li,a;

li=document.getElementById("bodyContent");

li=li.getElementsByTagName("li");

i=-1;

a=new Array();

while(++i

{

var s,t;

t=li[i].innerHTML.match(/"\/wiki\/([^"]*)"/)[1];

if(li[i].getElementsByTagName("strong").length>0)

s="none";

else

s="";

if(a[t]!=undefined) s=a[t]; else a[t]=s;

if(s!="") li[i].style.display=(li[i].style.display=="none"?"list-item":"none");

}

}

$(function () {

if((location.href.indexOf("Special:Contributions")!=-1||

location.href.indexOf("Special%3AContributions")!=-1)

&&location.href.indexOf("&ais523")==-1&&location.href.indexOf("?ais523")==-1)

mw.util.addPortletLink('p-cactions', 'javascript:hidetopcontrib()', 'show/hide top', 'ca-hidetop',

"Show/hide pages for which you're the top contributor", '');

});

//

//Category:Wikipedia scripts

/*█████Twinkle██████*/

importScript('User:AzaToth/morebits.js');

/*██████Friendly██████*/

//

// If FriendlyConfig aint exist.

if( typeof( FriendlyConfig ) == 'undefined' ) {

FriendlyConfig = {};

}

/**

FriendlyConfig.summaryAd ( string )

If ad should be added or not to summary, default Friendly

*/

if( typeof( FriendlyConfig.summaryAd ) == 'undefined' ) {

FriendlyConfig.summaryAd = " using Friendly";

}

/**

FriendlyConfig.markSharedIPAsMinor ( boolean )

*/

if( typeof( FriendlyConfig.markSharedIPAsMinor ) == 'undefined' ) {

FriendlyConfig.markSharedIPAsMinor = true;

}

$(friendlyshared);

function friendlyshared() {

if( wgNamespaceNumber == 3 && isIPAddress( wgTitle ) ) {

var username = wgTitle.split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes

mw.util.addPortletLink( 'p-cactions', "javascript:friendlyshared.callback(\"" + username + "\")", "shared ip", "friendly-shared", "Shared IP tagging", "");

}

}

friendlyshared.callback = function friendlysharedCallback( uid ) {

var Window = new SimpleWindow( 600, 400 );

Window.setTitle( "Choose a shared IP address template" );

var form = new QuickForm( friendlyshared.callback.evaluate );

form.append( { type:'header', label:'Shared IP address templates' } );

form.append( { type: 'radio', name: 'shared', list: friendlyshared.standardList,

event: function( e ) {

friendlyshared.callback.change_shared( e );

e.stopPropagation();

} } );

var org = form.append( { type:'field', label:'Fill in IP address owner/operator (if applicable) and hit \"Submit\"' } );

org.append( {

type: 'input',

name: 'organization',

label: 'Organization name',

disabled: true,

tooltip: 'Some of these templates support an optional parameter for the organization name that owns/operates the IP address. The organization name can be entered here for those templates, including wikimarkup (if applicable).'

}

);

form.append( { type:'submit' } );

var result = form.render();

Window.setContent( result );

Window.display();

}

friendlyshared.standardList = [

{

label: '{{sharedip}}: standard shared IP address template',

value: 'sharedip',

tooltip: 'IP user talk page template that shows helpful information to IP users and those wishing to warn or ban them' },

{

label: '{{sharedipedu}}: shared IP address template modified for educational institutions',

value: 'sharedipedu' },

{

label: '{{sharedippublic}}: shared IP address template modified for public terminals',

value: 'sharedippublic' },

{

label: '{{dynamicip}}: shared IP address template modified for organizations with dynamic addressing',

value: 'dynamicip' },

{

label: '{{isp}}: shared IP address template modified for ISP organizations',

value: 'isp' },

{

label: '{{singnet}}: shared IP address template for SingNet addresses',

value: 'singnet' },

{

label: '{{aberwebcacheipaddress}}: shared IP address template for Aberystwyth University addresses',

value: 'aberwebcacheipaddress' }

]

friendlyshared.callback.change_shared = function friendlytagCallbackChangeShared(e) {

if( e.target.value != 'singnet' && e.target.value != 'aberwebcacheipaddress' ) {

e.target.form.organization.disabled = false;

} else {

e.target.form.organization.disabled = true;

}

}

friendlyshared.callbacks = {

main: function( self ) {

var form = self.responseXML.getElementById( 'editform' );

var found = false;

var text = '{{';

for( var i=0; i < friendlyshared.standardList.length; i++ ) {

tagRe = new RegExp( '(\{\{' + friendlyshared.standardList[i].value + '(\||\}\}))', 'im' );

if( tagRe.exec( form.wpTextbox1.value ) ) {

Status.info( 'Info', 'Found {{' + friendlyshared.standardList[i].value + '}} on the user\'s talk page already...aborting' );

found = true;

text = form.wpTextbox1.value;

}

}

if( !found ) {

Status.info( 'Info', 'Will add the shared IP address template to the top of the user\'s talk page.' );

text += self.params.value;

if( self.params.value != 'singnet' && self.params.value != 'aberwebcacheipaddress' ) {

text += '|' + self.params.organization;

}

text += '}}\n\n' + form.wpTextbox1.value;

}

var postData = {

'wpMinoredit': FriendlyConfig.markSharedIPAsMinor ? 1 : undefined,

'wpWatchthis': form.wpWatchthis.checked ? 1 : undefined,

'wpStarttime': form.wpStarttime.value,

'wpEdittime': form.wpEdittime.value,

'wpAutoSummary': form.wpAutoSummary.value,

'wpEditToken': form.wpEditToken.value,

'wpSummary': 'Added \{\{' + self.params.value + '\}\} template to user talk page.' + FriendlyConfig.summaryAd,

'wpTextbox1': text

};

self.post( postData );

}

}

friendlyshared.callback.evaluate = function friendlysharedCallbackEvaluate(e) {

if( getChecked( e.target.shared ).length != 1 ) {

alert( 'You must select a shared IP address template to use!' );

return;

}

var value = getChecked( e.target.shared )[0];

if( value != 'singnet' && value != 'aberwebcacheipaddress' && e.target.organization.value == '') {

alert( 'You must input an organization for the {{' + value + '}} template!' );

return;

}

var params = {

value: value,

organization: e.target.organization.value

};

Status.init( e.target );

var query = {

'title': wgPageName,

'action': 'submit'

};

Wikipedia.actionCompleted.redirect = wgPageName;

Wikipedia.actionCompleted.notice = "Shared IP tagging complete, reloading talk page in some seconds";

var wikipedia_wiki = new Wikipedia.wiki( 'User talk page modification', query, friendlyshared.callbacks.main );

wikipedia_wiki.params = params;

wikipedia_wiki.get();

}

//

/*█████████████Friendly-tag████████████████*/

importScript('User:Ioeth/friendlytag.js');

/*████████Hide pages in watchlist████████████*/

WatchlistConfig = { ignorePages: [

'Talk:Example',

'User:Example',

'MediaWiki talk:Common.css',

], };

importScript('User:Gary King/hide pages in watchlist.js');