Jump to content

User:Cacycle/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Cacycle (talk | contribs) at 03:17, 2 July 2009. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
//


window.leftEditLinkFontSize = 'large';
 alert('1: ' + leftEditLinkFontSize);
window.leftEditLinkSpacing = '10em';
// importScript("MediaWiki:Gadget-lefteditlinks.js");

addOnloadHook( function() {
 
// user customizable variables via monobook.js:
 alert(leftEditLinkFontSize);
// font-size css definition for edit link span
    if (typeof(leftEditLinkFontSize) == 'undefined') { var leftEditLinkFontSize = 'small'; }
 
// css definition for spacing after heading text span
    if (typeof(leftEditLinkSpacing) == 'undefined') { var leftEditLinkSpacing = '0.2em'; }
 
// recursively fix all spans inside headings
    var bodyContent = document.getElementById('bodyContent');
    var LeftEditLink = function(level) {
 
// get all heading of this level
        var headings = bodyContent.getElementsByTagName('h' + level);
        for (var i = 0; i < headings.length; i ++) {
            var heading = headings[i];
 
// get edit span
            var editSpan = heading.firstChild;
            if (editSpan == null) { continue }
            if (editSpan.className != 'editsection') { continue }
 
// get blank
            var blank = editSpan.nextSibling;
            if (blank == null) { continue }
            if (blank.nodeValue != ' ') { continue }
 
// get heading span
            var headingSpan = blank.nextSibling;
            if (headingSpan == null) { continue }
            if (headingSpan.nodeName != 'SPAN') { continue }
 
// move blank after heading text
            heading.appendChild(blank);
 
// move edit span after blank
            heading.appendChild(editSpan);
 
// get rid of evil edit span floating
            editSpan.style.styleFloat = 'none';
            editSpan.style.cssFloat = 'none';
 
// set edit span font size
            editSpan.style.fontSize = leftEditLinkFontSize;
 
// set heading span right margin
            headingSpan.style.marginRight = leftEditLinkSpacing;
        }
 
// recurse through heading levels
        if (level < 6) {
            LeftEditLink(level + 1);
        }
        return;
    };
 
// call recursive function
    LeftEditLink(1);
 
});

// importScript('User:Cacycle/recent2.js');
wikEdUseWikEdPreset = false;
// importScript("User:Lupin/recent2.js");

var wikEdShowSourceButton = true;
var wikEdRegExTypoFix = true;
var wikEdShowTableModeButton = true;
//var wikEdLoadDiffScript = false;
//var wikEdLoadDiff = false;
//
var wikEdSkipBrowserTest = true;
/*
// install [[User:Cacycle/wikEd international]] English example translation
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd_international_en.js'
+ '&action=raw&ctype=text/javascript"></script>');
*/

/*
// install [[User:Cacycle/wikEd]] editing page extension
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
*/

/*
// install [[User:Cacycle/wikEd]] editing page extension - DEV
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd_dev.js'
+ '&action=raw&ctype=text/javascript"></script>');
*/

/*
// install [[User:Cacycle/wikEdDiff]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js'
+ '&action=raw&ctype=text/javascript"></script>');
*/

/*
// install [[User:Cacycle/wikiWatch]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikiWatch.js'
+ '&action=raw&ctype=text/javascript"></script>');
*/

/*
// install [[user:js/watchlist.js]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=user:js/watchlist.js'
+ '&action=raw&ctype=text/javascript"></script>');
*/


addOnloadHook(
  function() {
    addPortletLink('p-personal', '/wiki/User:Cacycle/tricks', 'tricks', '', '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/monobook.js',  'monobook.js',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/wikEd',  'wikEd',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User_talk:Cacycle/wikEd',  'wikEd talk',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/wikEd_help',  'wikEd help',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/wikEd.js',  'wikEd.js',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/wikEd_development',  'wikEd dev',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User_talk:Cacycle/wikEd_development',  'wikEd dev talk',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/wikEd_dev.js',  'wikEd_dev.js',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/wikiWatch',  'wikiWatch',  '',  '', '', '');
    addPortletLink('p-personal', '/wiki/User:Cacycle/wikiWatch.js',  'wikiWatch.js',  '',  '', '', '');
    if (document.getElementById('ca-edit') != null) {
      document.getElementById('ca-edit').firstChild.innerHTML = 'edit';
    }
  }
);


/* </nowiki></pre> */