User:Magog the Ogre 2/monobook.js

Source: Wikipedia, the free encyclopedia.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:Lupin/recent2.js');
importScript("User:AzaToth/twinkle.js");
importScript("User:Tim Song/afchelper4.js");
importScript('User:AWeenieMan/furme.js');
importScript('User:Mr.Z-man/refToolbar.js');
importScript("User:MGA73/nowcommonsreview.js");
 
/***************************************************************
 *      added from MediaWiki:Gadget-UTCLiveClock.js            *
 **************************************************************/
function liveClock()
{
	appendCSS( "#utcdate a { font-weight:bolder; font-size:120%; }" );
 
	if (typeof(UTCLiveClockConfig)=='undefined') UTCLiveClockConfig = {};
	var portletId = UTCLiveClockConfig.portletId || 'p-personal';
	var nextNode =  UTCLiveClockConfig.nextNodeId ? document.getElementById(UTCLiveClockConfig.nextNodeId) : undefined;
	liveClock.node = mw.util.addPortletLink( portletId, wgScript + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge', '', 'utcdate', undefined, undefined, nextNode );
	if( !liveClock.node ) return;
 
	showTime();
}
$(liveClock)
 
function showTime()
{
 
	var dateNode = liveClock.node;
	if( !dateNode ) return;
 
	var now = new Date();
	var hh = now.getUTCHours();
	var mm = now.getUTCMinutes();
	var ss = now.getUTCSeconds();
	var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss );
	dateNode.firstChild.replaceChild( document.createTextNode( time ), dateNode.firstChild.firstChild );
 
	window.setTimeout(showTime, 1000);
}
 
/***************************************************************
 *      added from MediaWiki:Gadget-LongEditSummaries.js       *
 **************************************************************/
$(function() {
    var wpSummary = document.getElementById("wpSummary")
    if (wpSummary) {
        var adjustMaxLength = function () {
            // subtract the number of UTF-8 continuation bytes (0x80-0xBF) from the maxlength
            var maxLength = 250 - encodeURI(wpSummary.value).split(/%[89AB]/i).length + 1
            wpSummary.maxLength = maxLength
 
            // the last character or group might've pushed us over; if so, inform the user
            var errorMessage = document.getElementById("editSummaryTooLong")
            if (wpSummary.value.length > maxLength) {
                if (!errorMessage) {
                    wpSummary.style.border = "3px solid red"
                    document.getElementById("wpSave").disabled = true
                    var editSummaryTooLong = document.createElement("div")
                    editSummaryTooLong.id = "editSummaryTooLong"
                    editSummaryTooLong.style.color = "red"
                    editSummaryTooLong.style.fontWeight = "bold"
                    editSummaryTooLong.appendChild(document.createTextNode("Your edit summary is too long."))
                    var wpMinoredit = document.getElementById("wpMinoredit")
                    wpMinoredit.parentNode.insertBefore(editSummaryTooLong, wpMinoredit)
                }
            } else {
                if (errorMessage) {
                    wpSummary.style.border = ""
                    document.getElementById("wpSave").disabled = false
                    errorMessage.parentNode.removeChild(errorMessage)
                }
            }
            oldValue = wpSummary.value
        }
        addHandler(wpSummary, "keyup", adjustMaxLength)
        addHandler(wpSummary, "change", adjustMaxLength)
        adjustMaxLength()
    }
})
 
 
/***************************************************************
 *         added from MediaWiki:Gadget-edittop.js              *
 **************************************************************/
// Imported from [[User:Alex Smotrov/edittop.js]], version as of: 2007-06-19T04:28:52
// Updated from [[User:TheDJ/Gadget-edittop.js]], version as of: 2009-04-28T11:54:22
if ((wgAction == 'view' || wgAction == 'purge') && wgNamespaceNumber >=0)
addOnloadHook(function edittop_hook(){
 var localtitles = {
   cs: 'Editovat úvodní sekci',
   en: 'Edit lead section',
   fr: 'Modifier le résumé introductif',
   ko: '도입부를 편집',
   it: 'Modifica della sezione iniziale',
   ja: '導入部を編集'
 };
 var our_content = document.getElementById('content') || document.getElementById('mw_content') || document.body;
 var editspans = getElementsByClassName( our_content, "span", "editsection");
 var span1;
 for( es_count = 0; editspans && es_count < editspans.length; es_count++ )
 {
  span1 = editspans[es_count];
  if( span1.className.indexOf( "plainlinks" ) == -1 )
    break;
 }  
 if (!span1) return;
 var span0 = span1.cloneNode(true);
 var editwidth = span1.offsetWidth;
 if( skin != "vector" ) editwidth += 10;
 
 var topicons = getElementsByClassName( our_content, 'div', "topicon" );
 for( el=0; topicons && el < topicons.length; el++ )
 {
  topicons[el].style.marginRight  = editwidth+"px";
 }
 var mwfrtag = document.getElementById( "mw-fr-revisiontag" );
 if( mwfrtag ) {
  mwfrtag.style.marginRight = editwidth+"px";
 }
 
 our_content = document.getElementById('mw_header') || document.getElementById('content') || document.body;
 var parent = our_content.getElementsByTagName('H1')[0];
 parent.insertBefore(span0, parent.firstChild);
 var a = span0.getElementsByTagName('A')[0];
 if (a.href.indexOf('&section=T') == -1){
   a.title = a.title.replace(/(: |:).*$/,'$1'+'0')
   a.setAttribute('href', a.getAttribute('href',2).replace(/&section=\d+/,'&section=0'));
 }else{//transcluded
   a.title = localtitles['en']
   a.setAttribute('href', wgScript+'?title='+encodeURIComponent(mw.config.get('wgPageName'))+'&action=edit&section=0')
 }
 if (localtitles[wgUserLanguage]) a.title = localtitles[wgUserLanguage]
})
 
 
/***************************************************************
 *         added from MediaWiki:Gadget-Friendly.js             *
 **************************************************************/
if ( navigator.appName != "Microsoft Internet Explorer" )  //Doesn't work in IE.
{
	if ( typeof( FriendlyConfig ) == 'undefined' ) FriendlyConfig = {};
	FriendlyConfig.enableClock = false;
	importScript("User:Ioeth/friendly.js");
}