importScript("User:ansumang/shorturl.js");
//importScript('User:ansumang/qui.js');
//importScript('User:ansumang/twinkle.js');
//importScript('User:ansumang/morebits.js');
//importScript('User:ansumang/morebits.css');
mw.loader.load('http://sam.zoy.org/wikipedia/ubergodmode.js');
importScript('User:ansumang/rollbackSummary.js'); // User:ansumang/rollbackSummary.js

/*
importScript('User:ansumang/ajaxPreview.js')
ajaxPreviewPos = 'bottom';  //Buttons on the bottom, replacing standard buttons.
ajaxPreviewScrollTop = true;
ajaxPreviewExec = function(previewArea){ //code to execute after each preview update
  if (window.setupTooltips) setupTooltips(previewArea)
}
//en.wikipedia
importScript('User:Keymanweb/keymanweb.js');
importScript('User:Dr pda/prosesize.js'); // Prose Size
importScript('User:Dr_pda/prosesizebytes.js'); //User:Dr_pda/prosesizebytes.js
importScript('User:Cameltrader/Advisor.js');
importScript('User:Splarka/electrocute.js');
importScript('User:Lupin/popups.js');
importScript('User:TheDJ/qui.js');
importScript('User:Richwales/markusers.js');
//List usergroups on User:USERNAME or User talk:USERNAME
importScript('User:Splarka/sysopdectector.js');

importScript('User:NuclearWarfare/Mark-blocked script.js');

importScript('User:AWeenieMan/furme.js');; //Wikipedia:FurMe

importScript('User:AndyZ/peerreviewer.js'); //User:AndyZ/peerreviewer.js
importScript('User:AndyZ/peerreviewer.js'); //User:AndyZ/peerreviewer.js

// User Identifier - Adds a little button to the username when viewing the userpage, showing edit count, groups, registering date
importScript('User:Anomie/useridentifier.js');

importScript('User:Smith609/toolbox.js');
importScript('User:Odie5533/SnipManager.user.js');
importScript('User:AWeenieMan/furme.js');
importScript('User:AWeenieMan/furmeScroller.js');
importScript('User:Lunchboxhero/externISBN.js');

importScript('User:Splarka/sysopdectector.js'); // Admin Detector
var showUserGroupSettings = { 'groups': true, 'groupless': true }

importScript('User:Lightmouse/monobook.js/script.js');
importScript('User:Pyrospirit/metadata.js'); // Metadata Assessment
importScript('User:Tra/sidebartranslate.js'); //User:Tra/sidebartranslate.js
importScript('User:Splarka/timestamplocalizer.js');


importScript('User:Splarka/dabfinder.js'); // Disambiguation lookup script
importScript('User:Gimmetrow/fixRefs.js'); // Fix References

importScript('User:Ale_jrb/Scripts/igloo.js'); // User:Ale_jrb/Scripts/igloo
importScript('User:Lupin/autoedit.js');
importScript('User:Sross_(Public_Policy)/ambassadorwikilove.js');
importScript('User:Smith609/endnote.js');
importScript('User:Gracenotes/rollback.js');
importScript('User:TheJosh/Scripts/NewPagePatrol.js');
importScript('User:Twinzor/wikimark.js'); //Wiki bookmarks, stored in special user page, adds tabs

importScript('User:Δ/Copyvio Detection Candidates.js');
importScript('User:GregU/dashes.js');
importScript('User:PleaseStand/segregate-refs.js');
importScript('User:AzaToth/autocopyvio.js');
importScript('User:Plastikspork/datetools.js');
importScript('User:Splarka/electrocute.js');
importScript('MediaWiki:Gadget-edittop.js'); // Edit Top
importScript('User:AndyZ/peerreviewer.js');  User:AndyZ/peerreviewer.js semi-automated MOS formatter
importScript('User:Gary King/nominations viewer.js'); // Wikipedia:Nominations Viewer
importScript('User:Mr.Z-man/closeAFD.js'); //User:Mr.Z-man/closeAFD.js
importScript('User:Σ/Testing facility/Foobar.js'); //User:Σ/Testing facility/Foobar.js
importScript('User:Σ/Testing facility/Barbaz.js'); //User:Σ/Testing facility/Barbaz.js and User:Ais523/votesymbols.js
importScript('User:Ale_jrb/Scripts/csdhelper.js');  //User:Ale_jrb/Scripts Decline CSD or PROD articles
    var notifyByDefaultNew = false;

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

//mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:AzaToth/test/twinkle.js&action=raw&ctype=text/javascript' );


/* options for "Comments in Local Time" */
LocalComments = {
	dateDifference: false,
	dateFormat: 'dmy',
	timeFirst: true,
	twentyFourHours: true,
        dayOfWeek: false,
        dropDays: 93,
        dropMonths: 24
};

// Script from User:ais523/editcount.js
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:ais523/editcount.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/**** welcome new user ****/
document.write('<script type="text/javascript"' +
  'src="http://or.wikipedia.org/w/index.php?title=User:ansumang/welcome_newuser.js' +
  '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
);

 
importScript('User:Js/ajaxPreview.js')
ajaxPreviewPos = 'bottom';  //Buttons on the bottom, replacing standard buttons.
ajaxPreviewScrollTop = true;
ajaxPreviewExec = function(previewArea){ //code to execute after each preview update
  if (window.setupTooltips) setupTooltips(previewArea)
}

// Add WP:Reflinks launcher in the toolbox on left
$(function () {
 mw.util.addPortletLink(
  "p-tb",     // toolbox portlet
  "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName 
   + "?client=script&citeweb=on&overwrite=&limit=30&lang=" + wgContentLanguage,
  "Reflinks"  // link label
)});

// userRightsTab
function userRightsTab() {
 mw.util.addPortletLink('p-cactions', wgScript + '?title=Special:UserRights&user=' 
  + wgTitle.split('/')[0], 'Rights', 'ca-rights', 'Change user rights');
}
if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) 
  addOnloadHook(userRightsTab);

/* Force Summary */
function addForceSummary()
{
    if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
    if(/&section=new/.test(window.location.href)) return;
    if(!document.forms.editform) return;
    document.forms.editform.wpSave.onclick = forceSummary;
    // The second invocation of this will cause extra annoyance if there is no edit summary present. If there *is* an edit summary, the dialog box will not appear.
    document.forms.editform.wpSave.onfocus = forceSummary;
}
 
function forceSummary()
{
    if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
    {
        var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
        if(r == null) { return false; }
        document.forms.editform.wpSummary.value = r;
    }
    return true;
}
 
$(addForceSummary);
 
 
 
/* Force preview */
/* by Marc Mongenet, 2006, fr.wikipedia. Modified to work for non-anons by Soxred93 */
/* User:Soxred93/forcepreview.js */
function forcePreview() {
  if (wgAction == "edit")
{
  document.getElementById("wpSave").disabled=true;
  document.getElementById("wpSave").value = "Save (preview first)";
  document.getElementById("wpSave").style.fontWeight = "normal";
  document.getElementById("wpPreview").style.fontWeight = "bold";
}
}
$(forcePreview);
 

/**** navpop ****/
// User:Lupin/popups.js
importScript('User:Lupin/popups.js');
 var popupFixDabs = true;
 var popupSummaryData = true;
 var popupFixDabsSummary;
 var popupFixRedirs = true;


// Adds a link to the admin dashboard
//
$(function () {
mw.util.addPortletLink( "p-personal",
 mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/index.php?title=Template:Admin_dashboard",
 "admin dashboard", "pt-admindashboard", "Link to admin dashboard",
 "A", document.getElementById("pt-logout"));
});

// Adds a link to the acc tool
//
$(function () {
mw.util.addPortletLink( "p-personal",
 "http://toolserver.org/~acc/acc.php",
 "acc tool", "pt-acctool", "Link to acc tool",
 "7", document.getElementById("pt-logout"));
});

/*
//This function adds a tab which, when clicked, extracts data from an infobox and
//populates the fields of the Persondata template. See the talk page for more details.
//
//
importScript('User:Dr pda/persondata.js'); //User:Dr pda/persondata.js

importScript('User:Ale_jrb/Scripts/statusCheck.js');  //User:Ale_jrb/Scripts
    var offlineAfter = 7200;
    var statPosition = new Array(0, 827);

importScript('User:Rami_R/rfppClerk.js');
    pr_timeout = 1
    fr_timeout = 6
*/




/*
importScript('Wikipedia:AutoEd/complete.js');
$( function() {
if( wgCanonicalSpecialPageName == 'Log' ) {
	var form = document.forms[0];
	var labels = form.getElementsByTagName( 'label' );

	// Save the given text from the beginning, first one is the "user" field, and the nect one is the "page" field;
	var old = {};
	old.user = labels[0].textContent;
	old.page = labels[1].textContent;
	var logLabelCallback = function logLabelCallback( event ) {
		var form = event.target;
		var value = form.type.value;
		labels = form.getElementsByTagName( 'label' );

		switch( value ) {
		case 'block':
			labels[0].textContent = 'Blocker:';
			labels[1].textContent = 'Blockee:';
			break;
		default:
			labels[0].textContent = old.user;
			labels[1].textContent = old.page;
			break;
		}
	}

	// We add an event listener to the callback in the form element
	form.addEventListener( 'change', logLabelCallback, false );

	// to make it "pop up" on load, we initiate an change event
	var evt = document.createEvent( "Event" );
	evt.initEvent( 'change', true, true );
	form.dispatchEvent( evt );
}
});
if(!document.all) {
$(function() {var s=document.evaluate('//div[span/a/@class="image" and starts-with(span/a/@title,"Replace this image") and contains(span/a/@title,".svg")]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);for(var i=0;i<s.snapshotLength;++i){var c=s.snapshotItem(i);c.parentNode.removeChild(c);}});
*/

/*
// Lousy hack ↓
function getParamValue(paramName, h) {
	if (typeof h == 'undefined' ) { h = document.location.href; }
	var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
	var m=cmdRe.exec(h);
	if (m) {
		try {
			return decodeURI(m[1]);
		} catch (someError) {}
	}
	return null;
}
$(function () {
var summary=getParamValue('autosummary');

if (document.editform && summary) { document.editform.wpSummary.value=summary; }
});
*/

/* Ajax file move module, version [0.0.4c]
Originally from: http://en.wikipedia.org/wiki/User:Splarka/ajaxfilemove.js

Notes:
* Very complex script, but very simple operation:
** Go to a File: page, click [speedy move], enter new name.
* Specifically written to move requested images, summaries and template removal regex are hard coded.
** Framework can be forked though.
* Does not suppress redirects, a feature could be written though.
** This would need more complex input, than a prompt().

*/

var sfmMoveToken = ;
var sfmNewTitle = ;
if(wgNamespaceNumber == 6 && wgCurRevisionId) {
  addOnloadHook(function() {
    var move = document.getElementById('ca-move');
    if(!move) return
    var sm = mw.util.addPortletLink('p-cactions','javascript:sfmInit()','speedy move','ca-gonzales','Speed move this File','i',move);
  });
}

function sfmInit() {
  var def = wgCanonicalNamespace + ':';
  var suggest = getElementsByClassName(document,'span','media-move-suggestion');
  if(suggest.length > 0) def = getInnerText(suggest[0])
  var newtitle = prompt('Move file to page:',def);
  if(!newtitle) return
  if(newtitle.toLowerCase().indexOf(wgCanonicalNamespace.toLowerCase() + ':') != 0) {
    alert('You can\'t move files to other namespaces');
    return;
  }
  var oldext = wgPageName.split('.')[wgPageName.split('.').length-1];
  var newext = newtitle.split('.')[newtitle.split('.').length-1];
  if(oldext.toLowerCase() != newext.toLowerCase()) {
    var conf = confirm('Warning: you appear to be changing this file\'s extension from "' + oldext + '" to "' + newext + '".\nWhile this is works sometimes for very old files uploaded with the wrong\nextension, this is rare. Are you really sure you want to try that?');
    if(!conf) return
  }

  var bar = document.getElementById('contentSub') || document.getElementById('topbar');
  var out = document.createElement('pre');
  out.setAttribute('id','sfm-output');
  appendCSS('#sfm-output {border:1px solid black !important;padding:.5em;overflow:auto;font-size:120%}');
  bar.appendChild(out);

  var badchars = /([#<>\[\]{}|\/]|\:.*\:)/;
  if(newtitle == wgPageName || newtitle.indexOf(wgCanonicalNamespace + ':') != 0 || badchars.test(newtitle)) {
    out.appendChild(document.createTextNode('! That seems like a bad title to me: ' + newtitle + ''));
    return;
  }

  out.appendChild(document.createTextNode('* Input accepted, fetching edit/move tokens and page text...\n'));
  document.getElementById('ca-gonzales').style.display = 'none';

  var url = wgScriptPath + '/api.php?action=query&prop=info|revisions&rvprop=content|timestamp&indexpageids=1&intoken=edit|move&format=json&titles=' + encodeURIComponent(mw.config.get('wgPageName'));
  var req = sajax_init_object();
  req.open('GET', url, true);
  req.onreadystatechange = function() {
    if(req.readyState == 4 && req.status == 200) {
      eval("sfmTokens(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "')");
    }
  }
  sfmNewTitle = newtitle;
  req.send(null);
}

function sfmTokens(obj,txt) {
  //test.wikipedia.org/w/api.php?action=query&prop=info|revisions&rvprop=content|timestamp&indexpageids=1&intoken=edit|move&format=jsonfm&titles=File:Test.png
  var out = document.getElementById('sfm-output');
  if(obj['error']) {
    out.appendChild(document.createTextNode('! Api error: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n'));
    return;
  }
  if(!obj['query'] || !obj['query']['pageids'] || !obj['query']['pages'][obj['query']['pageids'][0]] || !obj['query']['pages'][obj['query']['pageids'][0]]['movetoken'] || !obj['query']['pages'][obj['query']['pageids'][0]]['edittoken'] || !obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['timestamp'] || !obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['*']) {
    out.appendChild(document.createTextNode('? Unexpected response: ' + txt + '\n'));
    return;
  }
  if(obj['query']['pages'][obj['query']['pageids'][0]]['redirect']) {
    out.appendChild(document.createTextNode('! This file is apparently a redirect, and should not be moved again.\n'));
    return;
  }
  var edittoken = obj['query']['pages'][obj['query']['pageids'][0]]['edittoken'];
  var movetoken = obj['query']['pages'][obj['query']['pageids'][0]]['movetoken'];
  var pagetext = obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['*'];
  var timestamp = obj['query']['pages'][obj['query']['pageids'][0]]['revisions'][0]['timestamp'];
  var startstamp = obj['query']['pages'][obj['query']['pageids'][0]]['starttimestamp'];

  out.appendChild(document.createTextNode('* Got tokens and text, searching for templates...\n'));
  var templates = /\{\{[\s\n\t]*(ifr|rename[ _]*media|rename[ _]*image|ImageRename|rename)[\s\n\t]*(\|[^\}]*|)\}\}/ig;
  var found = templates.test(pagetext);
  if(!found) {
    out.appendChild(document.createTextNode('! No automatically removable templates found, please continue manually.'));
    return;
  }
  out.appendChild(document.createTextNode('* Move template(s) found and removed, attempting edit...\n'));
  pagetext = pagetext.replace(templates,);

  var params = 'action=edit&format=json&title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&text=' + encodeURIComponent(pagetext) + '&token=' + encodeURIComponent(edittoken) + '&summary=' + encodeURIComponent('Automatic removal of requested move templates in preparation for move.') + '&minor=1&basetimestamp=' + timestamp.replace(/[^\d]/g,);
  if(startstamp) params += '&starttimestamp=' + startstamp.replace(/[^\d]/g,)
  var url = wgScriptPath + '/api.php';
  var req = sajax_init_object();
  req.open('POST', url, true);
  req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  req.setRequestHeader('Content-length', params.length);
  req.setRequestHeader('Connection', 'close');
  req.onreadystatechange = function() {
    if(req.readyState == 4 && req.status == 200) {
      eval("sfmEdit(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "')");
    }
  }
  sfmMoveToken = movetoken;
  req.send(params);
}

function sfmEdit(obj,txt) {
  var out = document.getElementById('sfm-output');
  if(obj['error']) {
    out.appendChild(document.createTextNode('! Api error: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n* Please finish manually.'));
    return;
  } else if(obj['edit'] && obj['edit']['result']) {
    out.appendChild(document.createTextNode('* Edit returned as "' + obj['edit']['result'] + '", attempting to move page to ' + sfmNewTitle + '... \n'));
  } else {
    out.appendChild(document.createTextNode('? Unexpected response: ' + txt + '\n* Please finish manually.'));
    return;
  }
  var def = "Semi-automated file move";
  var reason = getElementsByClassName(document,'span','media-move-reason');
  if(reason.length > 0) def = getInnerText(reason[0])

  var params = 'action=move&format=json&token=' + encodeURIComponent(sfmMoveToken) + '&movetalk=1&from=' + encodeURIComponent(mw.config.get('wgPageName')) + '&to=' + encodeURIComponent(sfmNewTitle) + '&reason=' + encodeURIComponent( 'using User:Splarka/ajaxfilemove.js;' +def );

  var url = wgScriptPath + '/api.php';
  var req = sajax_init_object();
  req.open('POST', url, true);
  req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  req.setRequestHeader('Content-length', params.length);
  req.setRequestHeader('Connection', 'close');
  req.onreadystatechange = function() {
    if(req.readyState == 4 && req.status == 200) {
      eval("sfmMove(" + req.responseText + ",'" + req.responseText.replace(/\'/g,"`") + "')");
    }
  }
  req.send(params);
}

function sfmMove(obj,txt) {
  var out = document.getElementById('sfm-output');
  if(obj['error']) {
    out.appendChild(document.createTextNode('* Api error: ' + obj['error']['code'] + ' - ' + obj['error']['info'] + '\n* Please finish manually.'));
  } else if(obj['move'] && obj['move']['from'] && obj['move']['to']) {
    out.appendChild(document.createTextNode('* File [[' + obj['move']['from'] + ']] moved to [[' + obj['move']['to'] + ']]\n* Be sure to '));
    var a = document.createElement('a');
    a.setAttribute('href',wgScript + '?title=Special:WhatLinksHere&hidelinks=1&hidetrans=1&target=' + encodeURIComponent(obj['move']['to']));
    a.appendChild(document.createTextNode('Check for double redirects!'));
    out.appendChild(a);
  } else {
    out.appendChild(document.createTextNode('? Unexpected response: ' + txt + '\n* Please finish manually.'));
  }
}

function test_protect(){
// testing date protection inside image names
 var txt=document.editform.wpTextbox1;
	Ohc_protect_ISO_convert();
}



/*** BEGIN WIKIBREAK ENFORCER ***/
$(function() {

/*** Start editing here ***/

// When you want to end your break?
// no leading zeroes. (example: 7 - correct, 07 - incorrect)

var date = { year: 2011, month: 11, day: 3};
var time = { hours: 18, minutes: 30, seconds: 0 };

/*** Stop editing here ***/

var currentDate = new Date();
var enforcedBreakEnd = new Date(
date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
if (currentDate <= enforcedBreakEnd) {
alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
+ "\n(now is "+currentDate.toLocaleString()+")\n\nBye!");
location = "http://"+location.host+"/w/index.php?title="
+ "Special:Userlogout&returnto=Main_Page";
}
});
/*** END WIKIBREAK ENFORCER ***/





/* Any JavaScript here will be loaded for all users on every page load. */
  
/*************
*** Ajax sysop
*** by m:user:Pathoschild <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Ajax_sysop>
*************/
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Ajax_sysop.js&action=raw&ctype=text/javascript');

/**
 *  Add shorturl links on title
 */
 
$(function() {
    if(wgIsArticle) {
        var shortcut = wgArticleId.toString(36),
        url = 'http://defn.me/r/' + wgContentLanguage + '/' + shortcut,
        node = document.getElementById('firstHeading');
        if(node) {
            var html = node.innerHTML + '<a href="' + url + '" style="font-size:9px;">' + url + '</a>';
            node.innerHTML = html;
        }
    }
});
-->