Участник:Samopalov/monobook.js: различия между версиями
Перейти к навигации
Перейти к поиску
Содержимое удалено Содержимое добавлено
Samopalov (обсуждение | вклад) Нет описания правки |
Samopalov (обсуждение | вклад) Нет описания правки |
||
Строка 3035: | Строка 3035: | ||
//}else |
//}else |
||
{ //flaggedRevs |
{ //flaggedRevs |
||
appendCSS('.fr-diff-to-stable {display:none !important}') |
// appendCSS('.fr-diff-to-stable {display:none !important}') |
||
if (wgAction == 'history') |
// if (wgAction == 'history') |
||
appendCSS('span.flaggedrevs-color-1 {background:transparent !important} small {display:none !important}') |
// appendCSS('span.flaggedrevs-color-1 {background:transparent !important} small {display:none !important}') |
||
} |
} |
||
//</source> |
//</source> |
Версия от 18:17, 15 августа 2008
// MediaWiki JavaScript support functions
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var is_gecko = /gecko/.test( clientPC ) &&
!/khtml|spoofer|netscape\/7\.0/.test(clientPC);
var webkit_match = clientPC.match(/applewebkit\/(\d+)/);
if (webkit_match) {
var is_safari = clientPC.indexOf('applewebkit') != -1 &&
clientPC.indexOf('spoofer') == -1;
var is_safari_win = is_safari && clientPC.indexOf('windows') != -1;
var webkit_version = parseInt(webkit_match[1]);
}
var is_khtml = navigator.vendor == 'KDE' ||
( document.childNodes && !document.all && !navigator.taintEnabled );
// For accesskeys; note that FF3+ is included here!
var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC );
// These aren't used here, but some custom scripts rely on them
var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1;
var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1;
if (clientPC.indexOf('opera') != -1) {
var is_opera = true;
var is_opera_preseven = window.opera && !document.childNodes;
var is_opera_seven = window.opera && document.childNodes;
var is_opera_95 = /opera\/(9.[5-9]|[1-9][0-9])/.test( clientPC );
}
// Global external objects used by this script.
/*extern ta, stylepath, skin */
// add any onload functions in this hook (please don't hard-code any events in the xhtml source)
var doneOnloadHook;
if (!window.onloadFuncts) {
var onloadFuncts = [];
}
function addOnloadHook(hookFunct) {
// Allows add-on scripts to add onload functions
if(!doneOnloadHook) {
onloadFuncts[onloadFuncts.length] = hookFunct;
} else {
hookFunct(); // bug in MSIE script loading
}
}
function hookEvent(hookName, hookFunct) {
if (window.addEventListener) {
window.addEventListener(hookName, hookFunct, false);
} else if (window.attachEvent) {
window.attachEvent("on" + hookName, hookFunct);
}
}
function importScript(page) {
return importScriptURI(wgScript + '?action=raw&ctype=text/javascript&title=' + encodeURIComponent(page.replace(/ /g,'_')));
}
var loadedScripts = {}; // included-scripts tracker
function importScriptURI(url) {
if (loadedScripts[url]) {
return null;
}
loadedScripts[url] = true;
var s = document.createElement('script');
s.setAttribute('src',url);
s.setAttribute('type','text/javascript');
document.getElementsByTagName('head')[0].appendChild(s);
return s;
}
function importStylesheet(page) {
return importStylesheetURI(wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent(page.replace(/ /g,'_')));
}
function importStylesheetURI(url) {
return document.createStyleSheet ? document.createStyleSheet(url) : appendCSS('@import "' + url + '";');
}
function appendCSS(text) {
var s = document.createElement('style');
s.type = 'text/css';
s.rel = 'stylesheet';
if (s.styleSheet) s.styleSheet.cssText = text //IE
else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null
document.getElementsByTagName('head')[0].appendChild(s);
return s;
}
// special stylesheet links
if (typeof stylepath != 'undefined' && typeof skin != 'undefined') {
if (is_opera_preseven) {
importStylesheetURI(stylepath+'/'+skin+'/Opera6Fixes.css');
} else if (is_opera_seven && !is_opera_95) {
importStylesheetURI(stylepath+'/'+skin+'/Opera7Fixes.css');
} else if (is_khtml) {
importStylesheetURI(stylepath+'/'+skin+'/KHTMLFixes.css');
}
}
if (wgBreakFrames) {
// Un-trap us from framesets
if (window.top != window) {
window.top.location = window.location;
}
}
// for enhanced RecentChanges
function toggleVisibility(_levelId, _otherId, _linkId) {
var thisLevel = document.getElementById(_levelId);
var otherLevel = document.getElementById(_otherId);
var linkLevel = document.getElementById(_linkId);
if (thisLevel.style.display == 'none') {
thisLevel.style.display = 'block';
otherLevel.style.display = 'none';
linkLevel.style.display = 'inline';
} else {
thisLevel.style.display = 'none';
otherLevel.style.display = 'inline';
linkLevel.style.display = 'none';
}
}
function showTocToggle() {
if (document.createTextNode) {
// Uses DOM calls to avoid document.write + XHTML issues
var linkHolder = document.getElementById('toctitle');
if (!linkHolder) {
return;
}
var outerSpan = document.createElement('span');
outerSpan.className = 'toctoggle';
var toggleLink = document.createElement('a');
toggleLink.id = 'togglelink';
toggleLink.className = 'internal';
toggleLink.href = 'javascript:toggleToc()';
toggleLink.appendChild(document.createTextNode(tocHideText));
outerSpan.appendChild(document.createTextNode('['));
outerSpan.appendChild(toggleLink);
outerSpan.appendChild(document.createTextNode(']'));
linkHolder.appendChild(document.createTextNode(' '));
linkHolder.appendChild(outerSpan);
var cookiePos = document.cookie.indexOf("hidetoc=");
if (cookiePos > -1 && document.cookie.charAt(cookiePos + 8) == 1) {
toggleToc();
}
}
}
function changeText(el, newText) {
// Safari work around
if (el.innerText) {
el.innerText = newText;
} else if (el.firstChild && el.firstChild.nodeValue) {
el.firstChild.nodeValue = newText;
}
}
function toggleToc() {
var toc = document.getElementById('toc').getElementsByTagName('ul')[0];
var toggleLink = document.getElementById('togglelink');
if (toc && toggleLink && toc.style.display == 'none') {
changeText(toggleLink, tocHideText);
toc.style.display = 'block';
document.cookie = "hidetoc=0";
} else {
changeText(toggleLink, tocShowText);
toc.style.display = 'none';
document.cookie = "hidetoc=1";
}
}
var mwEditButtons = [];
var mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js
function escapeQuotes(text) {
var re = new RegExp("'","g");
text = text.replace(re,"\\'");
re = new RegExp("\\n","g");
text = text.replace(re,"\\n");
return escapeQuotesHTML(text);
}
function escapeQuotesHTML(text) {
var re = new RegExp('&',"g");
text = text.replace(re,"&");
re = new RegExp('"',"g");
text = text.replace(re,""");
re = new RegExp('<',"g");
text = text.replace(re,"<");
re = new RegExp('>',"g");
text = text.replace(re,">");
return text;
}
/**
* Set the accesskey prefix based on browser detection.
*/
var tooltipAccessKeyPrefix = 'alt-';
if (is_opera) {
tooltipAccessKeyPrefix = 'shift-esc-';
} else if (!is_safari_win && is_safari && webkit_version > 526) {
tooltipAccessKeyPrefix = 'ctrl-alt-';
} else if (!is_safari_win && (is_safari
|| clientPC.indexOf('mac') != -1
|| clientPC.indexOf('konqueror') != -1 )) {
tooltipAccessKeyPrefix = 'ctrl-';
} else if (is_ff2) {
tooltipAccessKeyPrefix = 'alt-shift-';
}
var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/;
/**
* Add the appropriate prefix to the accesskey shown in the tooltip.
* If the nodeList parameter is given, only those nodes are updated;
* otherwise, all the nodes that will probably have accesskeys by
* default are updated.
*
* @param Array nodeList -- list of elements to update
*/
function updateTooltipAccessKeys( nodeList ) {
if ( !nodeList ) {
// skins without a "column-one" element don't seem to have links with accesskeys either
var columnOne = document.getElementById("column-one");
if ( columnOne )
updateTooltipAccessKeys( columnOne.getElementsByTagName("a") );
// these are rare enough that no such optimization is needed
updateTooltipAccessKeys( document.getElementsByTagName("input") );
updateTooltipAccessKeys( document.getElementsByTagName("label") );
return;
}
for ( var i = 0; i < nodeList.length; i++ ) {
var element = nodeList[i];
var tip = element.getAttribute("title");
if ( tip && tooltipAccessKeyRegexp.exec(tip) ) {
tip = tip.replace(tooltipAccessKeyRegexp,
"["+tooltipAccessKeyPrefix+"$5]");
element.setAttribute("title", tip );
}
}
}
/**
* Add a link to one of the portlet menus on the page, including:
*
* p-cactions: Content actions (shown as tabs above the main content in Monobook)
* p-personal: Personal tools (shown at the top right of the page in Monobook)
* p-navigation: Navigation
* p-tb: Toolbox
*
* This function exists for the convenience of custom JS authors. All
* but the first three parameters are optional, though providing at
* least an id and a tooltip is recommended.
*
* By default the new link will be added to the end of the list. To
* add the link before a given existing item, pass the DOM node of
* that item (easily obtained with document.getElementById()) as the
* nextnode parameter; to add the link _after_ an existing item, pass
* the node's nextSibling instead.
*
* @param String portlet -- id of the target portlet ("p-cactions", "p-personal", "p-navigation" or "p-tb")
* @param String href -- link URL
* @param String text -- link text (will be automatically lowercased by CSS for p-cactions in Monobook)
* @param String id -- id of the new item, should be unique and preferably have the appropriate prefix ("ca-", "pt-", "n-" or "t-")
* @param String tooltip -- text to show when hovering over the link, without accesskey suffix
* @param String accesskey -- accesskey to activate this link (one character, try to avoid conflicts)
* @param Node nextnode -- the DOM node before which the new item should be added, should be another item in the same list
*
* @return Node -- the DOM node of the new item (an LI element) or null
*/
function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) {
var node = document.getElementById(portlet);
if ( !node ) return null;
node = node.getElementsByTagName( "ul" )[0];
if ( !node ) return null;
var link = document.createElement( "a" );
link.appendChild( document.createTextNode( text ) );
link.href = href;
var item = document.createElement( "li" );
item.appendChild( link );
if ( id ) item.id = id;
if ( accesskey ) {
link.setAttribute( "accesskey", accesskey );
tooltip += " ["+accesskey+"]";
}
if ( tooltip ) {
link.setAttribute( "title", tooltip );
}
if ( accesskey && tooltip ) {
updateTooltipAccessKeys( new Array( link ) );
}
if ( nextnode && nextnode.parentNode == node )
node.insertBefore( item, nextnode );
else
node.appendChild( item ); // IE compatibility (?)
return item;
}
/**
* Set up accesskeys/tooltips from the deprecated ta array. If doId
* is specified, only set up for that id. Note that this function is
* deprecated and will not be supported indefinitely -- use
* updateTooltipAccessKey() instead.
*
* @param mixed doId string or null
*/
function akeytt( doId ) {
// A lot of user scripts (and some of the code below) break if
// ta isn't defined, so we make sure it is. Explictly using
// window.ta avoids a "ta is not defined" error.
if (!window.ta) window.ta = new Array;
// Make a local, possibly restricted, copy to avoid clobbering
// the original.
var ta;
if ( doId ) {
ta = [doId];
} else {
ta = window.ta;
}
// Now deal with evil deprecated ta
var watchCheckboxExists = document.getElementById( 'wpWatchthis' ) ? true : false;
for (var id in ta) {
var n = document.getElementById(id);
if (n) {
var a = null;
var ak = '';
// Are we putting accesskey in it
if (ta[id][0].length > 0) {
// Is this object a object? If not assume it's the next child.
if (n.nodeName.toLowerCase() == "a") {
a = n;
} else {
a = n.childNodes[0];
}
// Don't add an accesskey for the watch tab if the watch
// checkbox is also available.
if (a && ((id != 'ca-watch' && id != 'ca-unwatch') || !watchCheckboxExists)) {
a.accessKey = ta[id][0];
ak = ' ['+tooltipAccessKeyPrefix+ta[id][0]+']';
}
} else {
// We don't care what type the object is when assigning tooltip
a = n;
ak = '';
}
if (a) {
a.title = ta[id][1]+ak;
}
}
}
}
var checkboxes;
var lastCheckbox;
function setupCheckboxShiftClick() {
checkboxes = [];
lastCheckbox = null;
var inputs = document.getElementsByTagName('input');
addCheckboxClickHandlers(inputs);
}
function addCheckboxClickHandlers(inputs, start) {
if ( !start) start = 0;
var finish = start + 250;
if ( finish > inputs.length )
finish = inputs.length;
for ( var i = start; i < finish; i++ ) {
var cb = inputs[i];
if ( !cb.type || cb.type.toLowerCase() != 'checkbox' )
continue;
var end = checkboxes.length;
checkboxes[end] = cb;
cb.index = end;
cb.onclick = checkboxClickHandler;
}
if ( finish < inputs.length ) {
setTimeout( function () {
addCheckboxClickHandlers(inputs, finish);
}, 200 );
}
}
function checkboxClickHandler(e) {
if (typeof e == 'undefined') {
e = window.event;
}
if ( !e.shiftKey || lastCheckbox === null ) {
lastCheckbox = this.index;
return true;
}
var endState = this.checked;
var start, finish;
if ( this.index < lastCheckbox ) {
start = this.index + 1;
finish = lastCheckbox;
} else {
start = lastCheckbox;
finish = this.index - 1;
}
for (var i = start; i <= finish; ++i ) {
checkboxes[i].checked = endState;
}
lastCheckbox = this.index;
return true;
}
function toggle_element_activation(ida,idb) {
if (!document.getElementById) {
return;
}
document.getElementById(ida).disabled=true;
document.getElementById(idb).disabled=false;
}
function toggle_element_check(ida,idb) {
if (!document.getElementById) {
return;
}
document.getElementById(ida).checked=true;
document.getElementById(idb).checked=false;
}
/*
Written by Jonathan Snook, http://www.snook.ca/jonathan
Add-ons by Robert Nyman, http://www.robertnyman.com
Author says "The credit comment is all it takes, no license. Go crazy with it!:-)"
From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/
*/
function getElementsByClassName(oElm, strTagName, oClassNames){
var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
var arrRegExpClassNames = new Array();
if(typeof oClassNames == "object"){
for(var i=0; i<oClassNames.length; i++){
arrRegExpClassNames[arrRegExpClassNames.length] =
new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)");
}
}
else{
arrRegExpClassNames[arrRegExpClassNames.length] =
new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)");
}
var oElement;
var bMatchesAll;
for(var j=0; j<arrElements.length; j++){
oElement = arrElements[j];
bMatchesAll = true;
for(var k=0; k<arrRegExpClassNames.length; k++){
if(!arrRegExpClassNames[k].test(oElement.className)){
bMatchesAll = false;
break;
}
}
if(bMatchesAll){
arrReturnElements[arrReturnElements.length] = oElement;
}
}
return (arrReturnElements)
}
function redirectToFragment(fragment) {
var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/);
if (match) {
var webKitVersion = parseInt(match[1]);
if (webKitVersion < 420) {
// Released Safari w/ WebKit 418.9.1 messes up horribly
// Nightlies of 420+ are ok
return;
}
}
if (is_gecko) {
// Mozilla needs to wait until after load, otherwise the window doesn't scroll
addOnloadHook(function () {
if (window.location.hash == "")
window.location.hash = fragment;
});
} else {
if (window.location.hash == "")
window.location.hash = fragment;
}
}
/*
* Table sorting script based on one (c) 1997-2006 Stuart Langridge and Joost
* de Valk:
* http://www.joostdevalk.nl/code/sortable-table/
* http://www.kryogenix.org/code/browser/sorttable/
*
* @todo don't break on colspans/rowspans (bug 8028)
* @todo language-specific digit grouping/decimals (bug 8063)
* @todo support all accepted date formats (bug 8226)
*/
var ts_image_path = stylepath+"/common/images/";
var ts_image_up = "sort_up.gif";
var ts_image_down = "sort_down.gif";
var ts_image_none = "sort_none.gif";
var ts_europeandate = wgContentLanguage != "en"; // The non-American-inclined can change to "true"
var ts_alternate_row_colors = true;
var SORT_COLUMN_INDEX;
function sortables_init() {
var idnum = 0;
// Find all tables with class sortable and make them sortable
var tables = getElementsByClassName(document, "table", "sortable");
for (var ti = 0; ti < tables.length ; ti++) {
if (!tables[ti].id) {
tables[ti].setAttribute('id','sortable_table_id_'+idnum);
++idnum;
}
ts_makeSortable(tables[ti]);
}
}
function ts_makeSortable(table) {
var firstRow;
if (table.rows && table.rows.length > 0) {
if (table.tHead && table.tHead.rows.length > 0) {
firstRow = table.tHead.rows[table.tHead.rows.length-1];
} else {
firstRow = table.rows[0];
}
}
if (!firstRow) return;
// We have a first row: assume it's the header, and make its contents clickable links
for (var i = 0; i < firstRow.cells.length; i++) {
var cell = firstRow.cells[i];
if ((" "+cell.className+" ").indexOf(" unsortable ") == -1) {
cell.innerHTML += ' <a href="#" class="sortheader" onclick="ts_resortTable(this);return false;"><span class="sortarrow"><img src="'+ ts_image_path + ts_image_none + '" alt="↓"/></span></a>';
}
}
if (ts_alternate_row_colors) {
ts_alternate(table);
}
}
function ts_getInnerText(el) {
if (typeof el == "string") return el;
if (typeof el == "undefined") { return el };
if (el.textContent) return el.textContent; // not needed but it is faster
if (el.innerText) return el.innerText; // IE doesn't have textContent
var str = "";
var cs = el.childNodes;
var l = cs.length;
for (var i = 0; i < l; i++) {
switch (cs[i].nodeType) {
case 1: //ELEMENT_NODE
str += ts_getInnerText(cs[i]);
break;
case 3: //TEXT_NODE
str += cs[i].nodeValue;
break;
}
}
return str;
}
function ts_resortTable(lnk) {
// get the span
var span = lnk.getElementsByTagName('span')[0];
var td = lnk.parentNode;
var tr = td.parentNode;
var column = td.cellIndex;
var table = tr.parentNode;
while (table && !(table.tagName && table.tagName.toLowerCase() == 'table'))
table = table.parentNode;
if (!table) return;
// Work out a type for the column
if (table.rows.length <= 1) return;
// Skip the first row if that's where the headings are
var rowStart = (table.tHead && table.tHead.rows.length > 0 ? 0 : 1);
var itm = "";
for (var i = rowStart; i < table.rows.length; i++) {
if (table.rows[i].cells.length > column) {
itm = ts_getInnerText(table.rows[i].cells[column]);
itm = itm.replace(/^[\s\xa0]+/, "").replace(/[\s\xa0]+$/, "");
if (itm != "") break;
}
}
sortfn = ts_sort_caseinsensitive;
if (itm.match(/^\d\d[\/. -][a-zA-Z]{3}[\/. -]\d\d\d\d$/))
sortfn = ts_sort_date;
if (itm.match(/^\d\d[\/.-]\d\d[\/.-]\d\d\d\d$/))
sortfn = ts_sort_date;
if (itm.match(/^\d\d[\/.-]\d\d[\/.-]\d\d$/))
sortfn = ts_sort_date;
if (itm.match(/^[\u00a3$\u20ac]/)) // pound dollar euro
sortfn = ts_sort_currency;
if (itm.match(/^[\d.,]+\%?$/))
sortfn = ts_sort_numeric;
var reverse = (span.getAttribute("sortdir") == 'down');
var newRows = new Array();
for (var j = rowStart; j < table.rows.length; j++) {
var row = table.rows[j];
var keyText = ts_getInnerText(row.cells[column]);
var oldIndex = (reverse ? -j : j);
newRows[newRows.length] = new Array(row, keyText, oldIndex);
}
newRows.sort(sortfn);
var arrowHTML;
if (reverse) {
arrowHTML = '<img src="'+ ts_image_path + ts_image_down + '" alt="↓"/>';
newRows.reverse();
span.setAttribute('sortdir','up');
} else {
arrowHTML = '<img src="'+ ts_image_path + ts_image_up + '" alt="↑"/>';
span.setAttribute('sortdir','down');
}
// We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
// don't do sortbottom rows
for (var i = 0; i < newRows.length; i++) {
if ((" "+newRows[i][0].className+" ").indexOf(" sortbottom ") == -1)
table.tBodies[0].appendChild(newRows[i][0]);
}
// do sortbottom rows only
for (var i = 0; i < newRows.length; i++) {
if ((" "+newRows[i][0].className+" ").indexOf(" sortbottom ") != -1)
table.tBodies[0].appendChild(newRows[i][0]);
}
// Delete any other arrows there may be showing
var spans = getElementsByClassName(tr, "span", "sortarrow");
for (var i = 0; i < spans.length; i++) {
spans[i].innerHTML = '<img src="'+ ts_image_path + ts_image_none + '" alt="↓"/>';
}
span.innerHTML = arrowHTML;
ts_alternate(table);
}
function ts_dateToSortKey(date) {
// y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
if (date.length == 11) {
switch (date.substr(3,3).toLowerCase()) {
case "jan": var month = "01"; break;
case "feb": var month = "02"; break;
case "mar": var month = "03"; break;
case "apr": var month = "04"; break;
case "may": var month = "05"; break;
case "jun": var month = "06"; break;
case "jul": var month = "07"; break;
case "aug": var month = "08"; break;
case "sep": var month = "09"; break;
case "oct": var month = "10"; break;
case "nov": var month = "11"; break;
case "dec": var month = "12"; break;
// default: var month = "00";
}
return date.substr(7,4)+month+date.substr(0,2);
} else if (date.length == 10) {
if (ts_europeandate == false) {
return date.substr(6,4)+date.substr(0,2)+date.substr(3,2);
} else {
return date.substr(6,4)+date.substr(3,2)+date.substr(0,2);
}
} else if (date.length == 8) {
yr = date.substr(6,2);
if (parseInt(yr) < 50) {
yr = '20'+yr;
} else {
yr = '19'+yr;
}
if (ts_europeandate == true) {
return yr+date.substr(3,2)+date.substr(0,2);
} else {
return yr+date.substr(0,2)+date.substr(3,2);
}
}
return "00000000";
}
function ts_parseFloat(num) {
if (!num) return 0;
num = parseFloat(num.replace(/,/g, ""));
return (isNaN(num) ? 0 : num);
}
function ts_sort_date(a,b) {
var aa = ts_dateToSortKey(a[1]);
var bb = ts_dateToSortKey(b[1]);
return (aa < bb ? -1 : aa > bb ? 1 : a[2] - b[2]);
}
function ts_sort_currency(a,b) {
var aa = ts_parseFloat(a[1].replace(/[^0-9.]/g,''));
var bb = ts_parseFloat(b[1].replace(/[^0-9.]/g,''));
return (aa != bb ? aa - bb : a[2] - b[2]);
}
function ts_sort_numeric(a,b) {
var aa = ts_parseFloat(a[1]);
var bb = ts_parseFloat(b[1]);
return (aa != bb ? aa - bb : a[2] - b[2]);
}
function ts_sort_caseinsensitive(a,b) {
var aa = a[1].toLowerCase();
var bb = b[1].toLowerCase();
return (aa < bb ? -1 : aa > bb ? 1 : a[2] - b[2]);
}
function ts_sort_default(a,b) {
return (a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : a[2] - b[2]);
}
function ts_alternate(table) {
// Take object table and get all it's tbodies.
var tableBodies = table.getElementsByTagName("tbody");
// Loop through these tbodies
for (var i = 0; i < tableBodies.length; i++) {
// Take the tbody, and get all it's rows
var tableRows = tableBodies[i].getElementsByTagName("tr");
// Loop through these rows
// Start at 1 because we want to leave the heading row untouched
for (var j = 0; j < tableRows.length; j++) {
// Check if j is even, and apply classes for both possible results
var oldClasses = tableRows[j].className.split(" ");
var newClassName = "";
for (var k = 0; k < oldClasses.length; k++) {
if (oldClasses[k] != "" && oldClasses[k] != "even" && oldClasses[k] != "odd")
newClassName += oldClasses[k] + " ";
}
tableRows[j].className = newClassName + (j % 2 == 0 ? "even" : "odd");
}
}
}
/*
* End of table sorting code
*/
/**
* Add a cute little box at the top of the screen to inform the user of
* something, replacing any preexisting message.
*
* @param String -or- Dom Object message HTML to be put inside the right div
* @param String className Used in adding a class; should be different for each
* call to allow CSS/JS to hide different boxes. null = no class used.
* @return Boolean True on success, false on failure
*/
function jsMsg( message, className ) {
if ( !document.getElementById ) {
return false;
}
// We special-case skin structures provided by the software. Skins that
// choose to abandon or significantly modify our formatting can just define
// an mw-js-message div to start with.
var messageDiv = document.getElementById( 'mw-js-message' );
if ( !messageDiv ) {
messageDiv = document.createElement( 'div' );
if ( document.getElementById( 'column-content' )
&& document.getElementById( 'content' ) ) {
// MonoBook, presumably
document.getElementById( 'content' ).insertBefore(
messageDiv,
document.getElementById( 'content' ).firstChild
);
} else if ( document.getElementById('content')
&& document.getElementById( 'article' ) ) {
// Non-Monobook but still recognizable (old-style)
document.getElementById( 'article').insertBefore(
messageDiv,
document.getElementById( 'article' ).firstChild
);
} else {
return false;
}
}
messageDiv.setAttribute( 'id', 'mw-js-message' );
if( className ) {
messageDiv.setAttribute( 'class', 'mw-js-message-'+className );
}
if (typeof message === 'object') {
while (messageDiv.hasChildNodes()) // Remove old content
messageDiv.removeChild(messageDiv.firstChild);
messageDiv.appendChild (message); // Append new content
}
else {
messageDiv.innerHTML = message;
}
return true;
}
/**
* Inject a cute little progress spinner after the specified element
*
* @param element Element to inject after
* @param id Identifier string (for use with removeSpinner(), below)
*/
function injectSpinner( element, id ) {
var spinner = document.createElement( "img" );
spinner.id = "mw-spinner-" + id;
spinner.src = stylepath + "/common/images/spinner.gif";
spinner.alt = spinner.title = "...";
if( element.nextSibling ) {
element.parentNode.insertBefore( spinner, element.nextSibling );
} else {
element.parentNode.appendChild( spinner );
}
}
/**
* Remove a progress spinner added with injectSpinner()
*
* @param id Identifier string
*/
function removeSpinner( id ) {
var spinner = document.getElementById( "mw-spinner-" + id );
if( spinner ) {
spinner.parentNode.removeChild( spinner );
}
}
function runOnloadHook() {
// don't run anything below this for non-dom browsers
if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) {
return;
}
// set this before running any hooks, since any errors below
// might cause the function to terminate prematurely
doneOnloadHook = true;
updateTooltipAccessKeys( null );
akeytt( null );
setupCheckboxShiftClick();
sortables_init();
// Run any added-on functions
for (var i = 0; i < onloadFuncts.length; i++) {
onloadFuncts[i]();
}
}
/**
* Add an event handler to an element
*
* @param Element element Element to add handler to
* @param String attach Event to attach to
* @param callable handler Event handler callback
*/
function addHandler( element, attach, handler ) {
if( window.addEventListener ) {
element.addEventListener( attach, handler, false );
} else if( window.attachEvent ) {
element.attachEvent( 'on' + attach, handler );
}
}
/**
* Add a click event handler to an element
*
* @param Element element Element to add handler to
* @param callable handler Event handler callback
*/
function addClickHandler( element, handler ) {
addHandler( element, 'click', handler );
}
//note: all skins should call runOnloadHook() at the end of html output,
// so the below should be redundant. It's there just in case.
hookEvent("load", runOnloadHook);
// this function generates the actual toolbar buttons with localized text
// we use it to avoid creating the toolbar where javascript is not enabled
function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) {
// Don't generate buttons for browsers which don't fully
// support it.
mwEditButtons[mwEditButtons.length] =
{"imageId": imageId,
"imageFile": imageFile,
"speedTip": speedTip,
"tagOpen": tagOpen,
"tagClose": tagClose,
"sampleText": sampleText};
}
// this function generates the actual toolbar buttons with localized text
// we use it to avoid creating the toolbar where javascript is not enabled
function mwInsertEditButton(parent, item) {
var image = document.createElement("img");
image.width = 23;
image.height = 22;
image.className = "mw-toolbar-editbutton";
if (item.imageId) image.id = item.imageId;
image.src = item.imageFile;
image.border = 0;
image.alt = item.speedTip;
image.title = item.speedTip;
image.style.cursor = "pointer";
image.onclick = function() {
insertTags(item.tagOpen, item.tagClose, item.sampleText);
return false;
};
parent.appendChild(image);
return true;
}
function mwSetupToolbar() {
var toolbar = document.getElementById('toolbar');
if (!toolbar) { return false; }
var textbox = document.getElementById('wpTextbox1');
if (!textbox) { return false; }
// Don't generate buttons for browsers which don't fully
// support it.
if (!(document.selection && document.selection.createRange)
&& textbox.selectionStart === null) {
return false;
}
for (var i = 0; i < mwEditButtons.length; i++) {
mwInsertEditButton(toolbar, mwEditButtons[i]);
}
for (var i = 0; i < mwCustomEditButtons.length; i++) {
mwInsertEditButton(toolbar, mwCustomEditButtons[i]);
}
return true;
}
// apply tagOpen/tagClose to selection in textarea,
// use sampleText instead of selection if there is none
function insertTags(tagOpen, tagClose, sampleText) {
var txtarea;
if (document.editform) {
txtarea = document.editform.wpTextbox1;
} else {
// some alternate form? take the first one we can find
var areas = document.getElementsByTagName('textarea');
txtarea = areas[0];
}
var selText, isSample = false;
if (document.selection && document.selection.createRange) { // IE/Opera
//save window scroll position
if (document.documentElement && document.documentElement.scrollTop)
var winScroll = document.documentElement.scrollTop
else if (document.body)
var winScroll = document.body.scrollTop;
//get current selection
txtarea.focus();
var range = document.selection.createRange();
selText = range.text;
//insert tags
checkSelectedText();
range.text = tagOpen + selText + tagClose;
//mark sample text as selected
if (isSample && range.moveStart) {
if (window.opera)
tagClose = tagClose.replace(/\n/g,'');
range.moveStart('character', - tagClose.length - selText.length);
range.moveEnd('character', - tagClose.length);
}
range.select();
//restore window scroll position
if (document.documentElement && document.documentElement.scrollTop)
document.documentElement.scrollTop = winScroll
else if (document.body)
document.body.scrollTop = winScroll;
} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla
//save textarea scroll position
var textScroll = txtarea.scrollTop;
//get current selection
txtarea.focus();
var startPos = txtarea.selectionStart;
var endPos = txtarea.selectionEnd;
selText = txtarea.value.substring(startPos, endPos);
//insert tags
checkSelectedText();
txtarea.value = txtarea.value.substring(0, startPos)
+ tagOpen + selText + tagClose
+ txtarea.value.substring(endPos, txtarea.value.length);
//set new selection
if (isSample) {
txtarea.selectionStart = startPos + tagOpen.length;
txtarea.selectionEnd = startPos + tagOpen.length + selText.length;
} else {
txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length;
txtarea.selectionEnd = txtarea.selectionStart;
}
//restore textarea scroll position
txtarea.scrollTop = textScroll;
}
function checkSelectedText(){
if (!selText) {
selText = sampleText;
isSample = true;
} else if (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char
selText = selText.substring(0, selText.length - 1);
tagClose += ' '
}
}
}
/**
* Restore the edit box scroll state following a preview operation,
* and set up a form submission handler to remember this state
*/
function scrollEditBox() {
var editBox = document.getElementById( 'wpTextbox1' );
var scrollTop = document.getElementById( 'wpScrolltop' );
var editForm = document.getElementById( 'editform' );
if( editBox && scrollTop ) {
if( scrollTop.value )
editBox.scrollTop = scrollTop.value;
addHandler( editForm, 'submit', function() {
document.getElementById( 'wpScrolltop' ).value = document.getElementById( 'wpTextbox1' ).scrollTop;
} );
}
}
hookEvent( 'load', scrollEditBox );
hookEvent( 'load', mwSetupToolbar );
// remote scripting library
// (c) copyright 2005 modernmethod, inc
var sajax_debug_mode = false;
var sajax_request_type = "GET";
/**
* if sajax_debug_mode is true, this function outputs given the message into
* the element with id = sajax_debug; if no such element exists in the document,
* it is injected.
*/
function sajax_debug(text) {
if (!sajax_debug_mode) return false;
var e= document.getElementById('sajax_debug');
if (!e) {
e= document.createElement("p");
e.className= 'sajax_debug';
e.id= 'sajax_debug';
var b= document.getElementsByTagName("body")[0];
if (b.firstChild) b.insertBefore(e, b.firstChild);
else b.appendChild(e);
}
var m= document.createElement("div");
m.appendChild( document.createTextNode( text ) );
e.appendChild( m );
return true;
}
/**
* compatibility wrapper for creating a new XMLHttpRequest object.
*/
function sajax_init_object() {
sajax_debug("sajax_init_object() called..")
var A;
try {
// Try the new style before ActiveX so we don't
// unnecessarily trigger warnings in IE 7 when
// set to prompt about ActiveX usage
A = new XMLHttpRequest();
} catch (e) {
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
}
if (!A)
sajax_debug("Could not create connection object.");
return A;
}
/**
* Perform an ajax call to mediawiki. Calls are handeled by AjaxDispatcher.php
* func_name - the name of the function to call. Must be registered in $wgAjaxExportList
* args - an array of arguments to that function
* target - the target that will handle the result of the call. If this is a function,
* if will be called with the XMLHttpRequest as a parameter; if it's an input
* element, its value will be set to the resultText; if it's another type of
* element, its innerHTML will be set to the resultText.
*
* Example:
* sajax_do_call('doFoo', [1, 2, 3], document.getElementById("showFoo"));
*
* This will call the doFoo function via MediaWiki's AjaxDispatcher, with
* (1, 2, 3) as the parameter list, and will show the result in the element
* with id = showFoo
*/
function sajax_do_call(func_name, args, target) {
var i, x, n;
var uri;
var post_data;
uri = wgServer +
((wgScript == null) ? (wgScriptPath + "/index.php") : wgScript) +
"?action=ajax";
if (sajax_request_type == "GET") {
if (uri.indexOf("?") == -1)
uri = uri + "?rs=" + encodeURIComponent(func_name);
else
uri = uri + "&rs=" + encodeURIComponent(func_name);
for (i = 0; i < args.length; i++)
uri = uri + "&rsargs[]=" + encodeURIComponent(args[i]);
//uri = uri + "&rsrnd=" + new Date().getTime();
post_data = null;
} else {
post_data = "rs=" + encodeURIComponent(func_name);
for (i = 0; i < args.length; i++)
post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]);
}
x = sajax_init_object();
if (!x) {
alert("AJAX not supported");
return false;
}
try {
x.open(sajax_request_type, uri, true);
} catch (e) {
if (window.location.hostname == "localhost") {
alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing.");
}
throw e;
}
if (sajax_request_type == "POST") {
x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}
x.setRequestHeader("Pragma", "cache=yes");
x.setRequestHeader("Cache-Control", "no-transform");
x.onreadystatechange = function() {
if (x.readyState != 4)
return;
sajax_debug("received (" + x.status + " " + x.statusText + ") " + x.responseText);
//if (x.status != 200)
// alert("Error: " + x.status + " " + x.statusText + ": " + x.responseText);
//else
if ( typeof( target ) == 'function' ) {
target( x );
}
else if ( typeof( target ) == 'object' ) {
if ( target.tagName == 'INPUT' ) {
if (x.status == 200) target.value= x.responseText;
//else alert("Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")");
}
else {
if (x.status == 200) target.innerHTML = x.responseText;
else target.innerHTML= "<div class='error'>Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")</div>";
}
}
else {
alert("bad target for sajax_do_call: not a function or object: " + target);
}
return;
}
sajax_debug(func_name + " uri = " + uri + " / post = " + post_data);
x.send(post_data);
sajax_debug(func_name + " waiting..");
delete x;
return true;
}
/**
* @return boolean whether the browser supports XMLHttpRequest
*/
function wfSupportsAjax() {
var request = sajax_init_object();
var supportsAjax = request ? true : false;
delete request;
return supportsAjax;
}
// dependencies:
// * ajax.js:
/*extern sajax_init_object, sajax_do_call */
// * wikibits.js:
/*extern changeText, akeytt, hookEvent, jsMsg */
// These should have been initialized in the generated js
/*extern wgAjaxWatch, wgPageName */
if(typeof wgAjaxWatch === "undefined" || !wgAjaxWatch) {
var wgAjaxWatch = {
watchMsg: "Watch",
unwatchMsg: "Unwatch",
watchingMsg: "Watching...",
unwatchingMsg: "Unwatching..."
};
}
wgAjaxWatch.supported = true; // supported on current page and by browser
wgAjaxWatch.watching = false; // currently watching page
wgAjaxWatch.inprogress = false; // ajax request in progress
wgAjaxWatch.timeoutID = null; // see wgAjaxWatch.ajaxCall
wgAjaxWatch.watchLinks = []; // "watch"/"unwatch" links
wgAjaxWatch.setLinkText = function(newText) {
for (i = 0; i < wgAjaxWatch.watchLinks.length; i++) {
changeText(wgAjaxWatch.watchLinks[i], newText);
}
};
wgAjaxWatch.setLinkID = function(newId) {
// We can only set the first one
wgAjaxWatch.watchLinks[0].setAttribute( 'id', newId );
akeytt(newId); // update tooltips for Monobook
};
wgAjaxWatch.setHref = function( string ) {
for( i = 0; i < wgAjaxWatch.watchLinks.length; i++ ) {
if( string == 'watch' ) {
wgAjaxWatch.watchLinks[i].href = wgAjaxWatch.watchLinks[i].href
.replace( /&action=unwatch/, '&action=watch' );
} else if( string == 'unwatch' ) {
wgAjaxWatch.watchLinks[i].href = wgAjaxWatch.watchLinks[i].href
.replace( /&action=watch/, '&action=unwatch' );
}
}
}
wgAjaxWatch.ajaxCall = function() {
if(!wgAjaxWatch.supported) {
return true;
} else if (wgAjaxWatch.inprogress) {
return false;
}
if(!wfSupportsAjax()) {
// Lazy initialization so we don't toss up
// ActiveX warnings on initial page load
// for IE 6 users with security settings.
wgAjaxWatch.supported = false;
return true;
}
wgAjaxWatch.inprogress = true;
wgAjaxWatch.setLinkText( wgAjaxWatch.watching
? wgAjaxWatch.unwatchingMsg : wgAjaxWatch.watchingMsg);
sajax_do_call(
"wfAjaxWatch",
[wgPageName, (wgAjaxWatch.watching ? "u" : "w")],
wgAjaxWatch.processResult
);
// if the request isn't done in 10 seconds, allow user to try again
wgAjaxWatch.timeoutID = window.setTimeout(
function() { wgAjaxWatch.inprogress = false; },
10000
);
return false;
};
wgAjaxWatch.processResult = function(request) {
if(!wgAjaxWatch.supported) {
return;
}
var response = request.responseText;
if( response.match(/^<w#>/) ) {
wgAjaxWatch.watching = true;
wgAjaxWatch.setLinkText(wgAjaxWatch.unwatchMsg);
wgAjaxWatch.setLinkID("ca-unwatch");
wgAjaxWatch.setHref( 'unwatch' );
} else if( response.match(/^<u#>/) ) {
wgAjaxWatch.watching = false;
wgAjaxWatch.setLinkText(wgAjaxWatch.watchMsg);
wgAjaxWatch.setLinkID("ca-watch");
wgAjaxWatch.setHref( 'watch' );
} else {
// Either we got a <err#> error code or it just plain broke.
window.location.href = wgAjaxWatch.watchLinks[0].href;
return;
}
jsMsg( response.substr(4), 'watch' );
wgAjaxWatch.inprogress = false;
if(wgAjaxWatch.timeoutID) {
window.clearTimeout(wgAjaxWatch.timeoutID);
}
// Bug 12395 - avoid some watch link confusion on edit
var watchthis = document.getElementById("wpWatchthis");
if( watchthis && response.match(/^<[uw]#>/) ) {
watchthis.checked = response.match(/^<w#>/) ? "checked" : "";
}
return;
};
wgAjaxWatch.onLoad = function() {
// This document structure hardcoding sucks. We should make a class and
// toss all this out the window.
var el1 = document.getElementById("ca-unwatch");
var el2 = null;
if (!el1) {
el1 = document.getElementById("mw-unwatch-link1");
el2 = document.getElementById("mw-unwatch-link2");
}
if(el1) {
wgAjaxWatch.watching = true;
} else {
wgAjaxWatch.watching = false;
el1 = document.getElementById("ca-watch");
if (!el1) {
el1 = document.getElementById("mw-watch-link1");
el2 = document.getElementById("mw-watch-link2");
}
if(!el1) {
wgAjaxWatch.supported = false;
return;
}
}
// The id can be either for the parent (Monobook-based) or the element
// itself (non-Monobook)
wgAjaxWatch.watchLinks.push( el1.tagName.toLowerCase() == "a"
? el1 : el1.firstChild );
if( el2 ) {
wgAjaxWatch.watchLinks.push( el2 );
}
// I couldn't get for (watchLink in wgAjaxWatch.watchLinks) to work, if
// you can be my guest.
for( i = 0; i < wgAjaxWatch.watchLinks.length; i++ ) {
wgAjaxWatch.watchLinks[i].onclick = wgAjaxWatch.ajaxCall;
}
return;
};
hookEvent("load", wgAjaxWatch.onLoad);
/*
* OpenSearch ajax suggestion engine for MediaWiki
*
* uses core MediaWiki open search support to fetch suggestions
* and show them below search boxes and other inputs
*
* by Robert Stojnic (April 2008)
*/
// search_box_id -> Results object
var os_map = {};
// cached data, url -> json_text
var os_cache = {};
// global variables for suggest_keypress
var os_cur_keypressed = 0;
var os_last_keypress = 0;
var os_keypressed_count = 0;
// type: Timer
var os_timer = null;
// tie mousedown/up events
var os_mouse_pressed = false;
var os_mouse_num = -1;
// if true, the last change was made by mouse (and not keyboard)
var os_mouse_moved = false;
// delay between keypress and suggestion (in ms)
var os_search_timeout = 250;
// these pairs of inputs/forms will be autoloaded at startup
var os_autoload_inputs = new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText');
var os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' );
// if we stopped the service
var os_is_stopped = false;
// max lines to show in suggest table
var os_max_lines_per_suggest = 7;
/** Timeout timer class that will fetch the results */
function os_Timer(id,r,query){
this.id = id;
this.r = r;
this.query = query;
}
/** Property class for single search box */
function os_Results(name, formname){
this.searchform = formname; // id of the searchform
this.searchbox = name; // id of the searchbox
this.container = name+"Suggest"; // div that holds results
this.resultTable = name+"Result"; // id base for the result table (+num = table row)
this.resultText = name+"ResultText"; // id base for the spans within result tables (+num)
this.toggle = name+"Toggle"; // div that has the toggle (enable/disable) link
this.query = null; // last processed query
this.results = null; // parsed titles
this.resultCount = 0; // number of results
this.original = null; // query that user entered
this.selected = -1; // which result is selected
this.containerCount = 0; // number of results visible in container
this.containerRow = 0; // height of result field in the container
this.containerTotal = 0; // total height of the container will all results
this.visible = false; // if container is visible
}
/** Hide results div */
function os_hideResults(r){
var c = document.getElementById(r.container);
if(c != null)
c.style.visibility = "hidden";
r.visible = false;
r.selected = -1;
}
/** Show results div */
function os_showResults(r){
if(os_is_stopped)
return;
os_fitContainer(r);
var c = document.getElementById(r.container);
r.selected = -1;
if(c != null){
c.scrollTop = 0;
c.style.visibility = "visible";
r.visible = true;
}
}
function os_operaWidthFix(x){
// TODO: better css2 incompatibility detection here
if(is_opera || is_khtml || navigator.userAgent.toLowerCase().indexOf('firefox/1')!=-1){
return x - 30; // opera&konqueror & old firefox don't understand overflow-x, estimate scrollbar width
}
return x;
}
function os_encodeQuery(value){
if (encodeURIComponent) {
return encodeURIComponent(value);
}
if(escape) {
return escape(value);
}
return null;
}
function os_decodeValue(value){
if (decodeURIComponent) {
return decodeURIComponent(value);
}
if(unescape){
return unescape(value);
}
return null;
}
/** Brower-dependent functions to find window inner size, and scroll status */
function f_clientWidth() {
return f_filterResults (
window.innerWidth ? window.innerWidth : 0,
document.documentElement ? document.documentElement.clientWidth : 0,
document.body ? document.body.clientWidth : 0
);
}
function f_clientHeight() {
return f_filterResults (
window.innerHeight ? window.innerHeight : 0,
document.documentElement ? document.documentElement.clientHeight : 0,
document.body ? document.body.clientHeight : 0
);
}
function f_scrollLeft() {
return f_filterResults (
window.pageXOffset ? window.pageXOffset : 0,
document.documentElement ? document.documentElement.scrollLeft : 0,
document.body ? document.body.scrollLeft : 0
);
}
function f_scrollTop() {
return f_filterResults (
window.pageYOffset ? window.pageYOffset : 0,
document.documentElement ? document.documentElement.scrollTop : 0,
document.body ? document.body.scrollTop : 0
);
}
function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
if (n_docel && (!n_result || (n_result > n_docel)))
n_result = n_docel;
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
/** Get the height available for the results container */
function os_availableHeight(r){
var absTop = document.getElementById(r.container).style.top;
var px = absTop.lastIndexOf("px");
if(px > 0)
absTop = absTop.substring(0,px);
return f_clientHeight() - (absTop - f_scrollTop());
}
/** Get element absolute position {left,top} */
function os_getElementPosition(elemID){
var offsetTrail = document.getElementById(elemID);
var offsetLeft = 0;
var offsetTop = 0;
while (offsetTrail){
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
offsetTrail = offsetTrail.offsetParent;
}
if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined'){
offsetLeft += document.body.leftMargin;
offsetTop += document.body.topMargin;
}
return {left:offsetLeft,top:offsetTop};
}
/** Create the container div that will hold the suggested titles */
function os_createContainer(r){
var c = document.createElement("div");
var s = document.getElementById(r.searchbox);
var pos = os_getElementPosition(r.searchbox);
var left = pos.left;
var top = pos.top + s.offsetHeight;
c.className = "os-suggest";
c.setAttribute("id", r.container);
document.body.appendChild(c);
// dynamically generated style params
// IE workaround, cannot explicitely set "style" attribute
c = document.getElementById(r.container);
c.style.top = top+"px";
c.style.left = left+"px";
c.style.width = s.offsetWidth+"px";
// mouse event handlers
c.onmouseover = function(event) { os_eventMouseover(r.searchbox, event); };
c.onmousemove = function(event) { os_eventMousemove(r.searchbox, event); };
c.onmousedown = function(event) { return os_eventMousedown(r.searchbox, event); };
c.onmouseup = function(event) { os_eventMouseup(r.searchbox, event); };
return c;
}
/** change container height to fit to screen */
function os_fitContainer(r){
var c = document.getElementById(r.container);
var h = os_availableHeight(r) - 20;
var inc = r.containerRow;
h = parseInt(h/inc) * inc;
if(h < (2 * inc) && r.resultCount > 1) // min: two results
h = 2 * inc;
if((h/inc) > os_max_lines_per_suggest )
h = inc * os_max_lines_per_suggest;
if(h < r.containerTotal){
c.style.height = h +"px";
r.containerCount = parseInt(Math.round(h/inc));
} else{
c.style.height = r.containerTotal+"px";
r.containerCount = r.resultCount;
}
}
/** If some entries are longer than the box, replace text with "..." */
function os_trimResultText(r){
var w = document.getElementById(r.container).offsetWidth;
if(r.containerCount < r.resultCount){
w -= 20; // give 20px for scrollbar
} else
w = os_operaWidthFix(w);
if(w < 10)
return;
for(var i=0;i<r.resultCount;i++){
var e = document.getElementById(r.resultText+i);
var replace = 1;
var lastW = e.offsetWidth+1;
var iteration = 0;
var changedText = false;
while(e.offsetWidth > w && (e.offsetWidth < lastW || iteration<2)){
changedText = true;
lastW = e.offsetWidth;
var l = e.innerHTML;
e.innerHTML = l.substring(0,l.length-replace)+"...";
iteration++;
replace = 4; // how many chars to replace
}
if(changedText){
// show hint for trimmed titles
document.getElementById(r.resultTable+i).setAttribute("title",r.results[i]);
}
}
}
/** Handles data from XMLHttpRequest, and updates the suggest results */
function os_updateResults(r, query, text, cacheKey){
os_cache[cacheKey] = text;
r.query = query;
r.original = query;
if(text == ""){
r.results = null;
r.resultCount = 0;
os_hideResults(r);
} else{
try {
var p = eval('('+text+')'); // simple json parse, could do a safer one
if(p.length<2 || p[1].length == 0){
r.results = null;
r.resultCount = 0;
os_hideResults(r);
return;
}
var c = document.getElementById(r.container);
if(c == null)
c = os_createContainer(r);
c.innerHTML = os_createResultTable(r,p[1]);
// init container table sizes
var t = document.getElementById(r.resultTable);
r.containerTotal = t.offsetHeight;
r.containerRow = t.offsetHeight / r.resultCount;
os_trimResultText(r);
os_showResults(r);
} catch(e){
// bad response from server or such
os_hideResults(r);
os_cache[cacheKey] = null;
}
}
}
/** Create the result table to be placed in the container div */
function os_createResultTable(r, results){
var c = document.getElementById(r.container);
var width = os_operaWidthFix(c.offsetWidth);
var html = "<table class=\"os-suggest-results\" id=\""+r.resultTable+"\" style=\"width: "+width+"px;\">";
r.results = new Array();
r.resultCount = results.length;
for(i=0;i<results.length;i++){
var title = os_decodeValue(results[i]);
r.results[i] = title;
html += "<tr><td class=\"os-suggest-result\" id=\""+r.resultTable+i+"\"><span id=\""+r.resultText+i+"\">"+title+"</span></td></tr>";
}
html+="</table>"
return html;
}
/** Fetch namespaces from checkboxes or hidden fields in the search form,
if none defined use wgSearchNamespaces global */
function os_getNamespaces(r){
var namespaces = "";
var elements = document.forms[r.searchform].elements;
for(i=0; i < elements.length; i++){
var name = elements[i].name;
if(typeof name != 'undefined' && name.length > 2
&& name[0]=='n' && name[1]=='s'
&& ((elements[i].type=='checkbox' && elements[i].checked)
|| (elements[i].type=='hidden' && elements[i].value=="1")) ){
if(namespaces!="")
namespaces+="|";
namespaces+=name.substring(2);
}
}
if(namespaces == "")
namespaces = wgSearchNamespaces.join("|");
return namespaces;
}
/** Update results if user hasn't already typed something else */
function os_updateIfRelevant(r, query, text, cacheKey){
var t = document.getElementById(r.searchbox);
if(t != null && t.value == query){ // check if response is still relevant
os_updateResults(r, query, text, cacheKey);
}
r.query = query;
}
/** Fetch results after some timeout */
function os_delayedFetch(){
if(os_timer == null)
return;
var r = os_timer.r;
var query = os_timer.query;
os_timer = null;
var path = wgMWSuggestTemplate.replace("{namespaces}",os_getNamespaces(r))
.replace("{dbname}",wgDBname)
.replace("{searchTerms}",os_encodeQuery(query));
// try to get from cache, if not fetch using ajax
var cached = os_cache[path];
if(cached != null){
os_updateIfRelevant(r, query, cached, path);
} else{
var xmlhttp = sajax_init_object();
if(xmlhttp){
try {
xmlhttp.open("GET", path, true);
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && typeof os_updateIfRelevant == 'function') {
os_updateIfRelevant(r, query, xmlhttp.responseText, path);
}
};
xmlhttp.send(null);
} catch (e) {
if (window.location.hostname == "localhost") {
alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing.");
}
throw e;
}
}
}
}
/** Init timed update via os_delayedUpdate() */
function os_fetchResults(r, query, timeout){
if(query == ""){
os_hideResults(r);
return;
} else if(query == r.query)
return; // no change
os_is_stopped = false; // make sure we're running
/* var cacheKey = wgDBname+":"+query;
var cached = os_cache[cacheKey];
if(cached != null){
os_updateResults(r,wgDBname,query,cached);
return;
} */
// cancel any pending fetches
if(os_timer != null && os_timer.id != null)
clearTimeout(os_timer.id);
// schedule delayed fetching of results
if(timeout != 0){
os_timer = new os_Timer(setTimeout("os_delayedFetch()",timeout),r,query);
} else{
os_timer = new os_Timer(null,r,query);
os_delayedFetch(); // do it now!
}
}
/** Change the highlighted row (i.e. suggestion), from position cur to next */
function os_changeHighlight(r, cur, next, updateSearchBox){
if (next >= r.resultCount)
next = r.resultCount-1;
if (next < -1)
next = -1;
r.selected = next;
if (cur == next)
return; // nothing to do.
if(cur >= 0){
var curRow = document.getElementById(r.resultTable + cur);
if(curRow != null)
curRow.className = "os-suggest-result";
}
var newText;
if(next >= 0){
var nextRow = document.getElementById(r.resultTable + next);
if(nextRow != null)
nextRow.className = os_HighlightClass();
newText = r.results[next];
} else
newText = r.original;
// adjust the scrollbar if any
if(r.containerCount < r.resultCount){
var c = document.getElementById(r.container);
var vStart = c.scrollTop / r.containerRow;
var vEnd = vStart + r.containerCount;
if(next < vStart)
c.scrollTop = next * r.containerRow;
else if(next >= vEnd)
c.scrollTop = (next - r.containerCount + 1) * r.containerRow;
}
// update the contents of the search box
if(updateSearchBox){
os_updateSearchQuery(r,newText);
}
}
function os_HighlightClass() {
var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/);
if (match) {
var webKitVersion = parseInt(match[1]);
if (webKitVersion < 523) {
// CSS system highlight colors broken on old Safari
// https://bugs.webkit.org/show_bug.cgi?id=6129
// Safari 3.0.4, 3.1 known ok
return "os-suggest-result-hl-webkit";
}
}
return "os-suggest-result-hl";
}
function os_updateSearchQuery(r,newText){
document.getElementById(r.searchbox).value = newText;
r.query = newText;
}
/** Find event target */
function os_getTarget(e){
if (!e) e = window.event;
if (e.target) return e.target;
else if (e.srcElement) return e.srcElement;
else return null;
}
/********************
* Keyboard events
********************/
/** Event handler that will fetch results on keyup */
function os_eventKeyup(e){
var targ = os_getTarget(e);
var r = os_map[targ.id];
if(r == null)
return; // not our event
// some browsers won't generate keypressed for arrow keys, catch it
if(os_keypressed_count == 0){
os_processKey(r,os_cur_keypressed,targ);
}
var query = targ.value;
os_fetchResults(r,query,os_search_timeout);
}
/** catch arrows up/down and escape to hide the suggestions */
function os_processKey(r,keypressed,targ){
if (keypressed == 40){ // Arrow Down
if (r.visible) {
os_changeHighlight(r, r.selected, r.selected+1, true);
} else if(os_timer == null){
// user wants to get suggestions now
r.query = "";
os_fetchResults(r,targ.value,0);
}
} else if (keypressed == 38){ // Arrow Up
if (r.visible){
os_changeHighlight(r, r.selected, r.selected-1, true);
}
} else if(keypressed == 27){ // Escape
document.getElementById(r.searchbox).value = r.original;
r.query = r.original;
os_hideResults(r);
} else if(r.query != document.getElementById(r.searchbox).value){
// os_hideResults(r); // don't show old suggestions
}
}
/** When keys is held down use a timer to output regular events */
function os_eventKeypress(e){
var targ = os_getTarget(e);
var r = os_map[targ.id];
if(r == null)
return; // not our event
var keypressed = os_cur_keypressed;
if(keypressed == 38 || keypressed == 40){
var d = new Date()
var now = d.getTime();
if(now - os_last_keypress < 120){
os_last_keypress = now;
return;
}
}
os_keypressed_count++;
os_processKey(r,keypressed,targ);
}
/** Catch the key code (Firefox bug) */
function os_eventKeydown(e){
if (!e) e = window.event;
var targ = os_getTarget(e);
var r = os_map[targ.id];
if(r == null)
return; // not our event
os_mouse_moved = false;
os_cur_keypressed = (window.Event) ? e.which : e.keyCode;
os_last_keypress = 0;
os_keypressed_count = 0;
}
/** Event: loss of focus of input box */
function os_eventBlur(e){
var targ = os_getTarget(e);
var r = os_map[targ.id];
if(r == null)
return; // not our event
if(!os_mouse_pressed)
os_hideResults(r);
}
/** Event: focus (catch only when stopped) */
function os_eventFocus(e){
// nothing happens here?
}
/********************
* Mouse events
********************/
/** Mouse over the container */
function os_eventMouseover(srcId, e){
var targ = os_getTarget(e);
var r = os_map[srcId];
if(r == null || !os_mouse_moved)
return; // not our event
var num = os_getNumberSuffix(targ.id);
if(num >= 0)
os_changeHighlight(r,r.selected,num,false);
}
/* Get row where the event occured (from its id) */
function os_getNumberSuffix(id){
var num = id.substring(id.length-2);
if( ! (num.charAt(0) >= '0' && num.charAt(0) <= '9') )
num = num.substring(1);
if(os_isNumber(num))
return parseInt(num);
else
return -1;
}
/** Save mouse move as last action */
function os_eventMousemove(srcId, e){
os_mouse_moved = true;
}
/** Mouse button held down, register possible click */
function os_eventMousedown(srcId, e){
var targ = os_getTarget(e);
var r = os_map[srcId];
if(r == null)
return; // not our event
var num = os_getNumberSuffix(targ.id);
os_mouse_pressed = true;
if(num >= 0){
os_mouse_num = num;
// os_updateSearchQuery(r,r.results[num]);
}
// keep the focus on the search field
document.getElementById(r.searchbox).focus();
return false; // prevents selection
}
/** Mouse button released, check for click on some row */
function os_eventMouseup(srcId, e){
var targ = os_getTarget(e);
var r = os_map[srcId];
if(r == null)
return; // not our event
var num = os_getNumberSuffix(targ.id);
if(num >= 0 && os_mouse_num == num){
os_updateSearchQuery(r,r.results[num]);
os_hideResults(r);
document.getElementById(r.searchform).submit();
}
os_mouse_pressed = false;
// keep the focus on the search field
document.getElementById(r.searchbox).focus();
}
/** Check if x is a valid integer */
function os_isNumber(x){
if(x == "" || isNaN(x))
return false;
for(var i=0;i<x.length;i++){
var c = x.charAt(i);
if( ! (c >= '0' && c <= '9') )
return false;
}
return true;
}
/** When the form is submitted hide everything, cancel updates... */
function os_eventOnsubmit(e){
var targ = os_getTarget(e);
os_is_stopped = true;
// kill timed requests
if(os_timer != null && os_timer.id != null){
clearTimeout(os_timer.id);
os_timer = null;
}
// Hide all suggestions
for(i=0;i<os_autoload_inputs.length;i++){
var r = os_map[os_autoload_inputs[i]];
if(r != null){
var b = document.getElementById(r.searchform);
if(b != null && b == targ){
// set query value so the handler won't try to fetch additional results
r.query = document.getElementById(r.searchbox).value;
}
os_hideResults(r);
}
}
return true;
}
function os_hookEvent(element, hookName, hookFunct) {
if (element.addEventListener) {
element.addEventListener(hookName, hookFunct, false);
} else if (window.attachEvent) {
element.attachEvent("on" + hookName, hookFunct);
}
}
/** Init Result objects and event handlers */
function os_initHandlers(name, formname, element){
var r = new os_Results(name, formname);
// event handler
os_hookEvent(element, "keyup", function(event) { os_eventKeyup(event); });
os_hookEvent(element, "keydown", function(event) { os_eventKeydown(event); });
os_hookEvent(element, "keypress", function(event) { os_eventKeypress(event); });
os_hookEvent(element, "blur", function(event) { os_eventBlur(event); });
os_hookEvent(element, "focus", function(event) { os_eventFocus(event); });
element.setAttribute("autocomplete","off");
// stopping handler
os_hookEvent(document.getElementById(formname), "submit", function(event){ return os_eventOnsubmit(event); });
os_map[name] = r;
// toggle link
if(document.getElementById(r.toggle) == null){
// TODO: disable this while we figure out a way for this to work in all browsers
/* if(name=='searchInput'){
// special case: place above the main search box
var t = os_createToggle(r,"os-suggest-toggle");
var searchBody = document.getElementById('searchBody');
var first = searchBody.parentNode.firstChild.nextSibling.appendChild(t);
} else{
// default: place below search box to the right
var t = os_createToggle(r,"os-suggest-toggle-def");
var top = element.offsetTop + element.offsetHeight;
var left = element.offsetLeft + element.offsetWidth;
t.style.position = "absolute";
t.style.top = top + "px";
t.style.left = left + "px";
element.parentNode.appendChild(t);
// only now width gets calculated, shift right
left -= t.offsetWidth;
t.style.left = left + "px";
t.style.visibility = "visible";
} */
}
}
/** Return the span element that contains the toggle link */
function os_createToggle(r,className){
var t = document.createElement("span");
t.className = className;
t.setAttribute("id", r.toggle);
var link = document.createElement("a");
link.setAttribute("href","javascript:void(0);");
link.onclick = function(){ os_toggle(r.searchbox,r.searchform) };
var msg = document.createTextNode(wgMWSuggestMessages[0]);
link.appendChild(msg);
t.appendChild(link);
return t;
}
/** Call when user clicks on some of the toggle links */
function os_toggle(inputId,formName){
r = os_map[inputId];
var msg = '';
if(r == null){
os_enableSuggestionsOn(inputId,formName);
r = os_map[inputId];
msg = wgMWSuggestMessages[0];
} else{
os_disableSuggestionsOn(inputId,formName);
msg = wgMWSuggestMessages[1];
}
// change message
var link = document.getElementById(r.toggle).firstChild;
link.replaceChild(document.createTextNode(msg),link.firstChild);
}
/** Call this to enable suggestions on input (id=inputId), on a form (name=formName) */
function os_enableSuggestionsOn(inputId, formName){
os_initHandlers( inputId, formName, document.getElementById(inputId) );
}
/** Call this to disable suggestios on input box (id=inputId) */
function os_disableSuggestionsOn(inputId){
r = os_map[inputId];
if(r != null){
// cancel/hide results
os_timer = null;
os_hideResults(r);
// turn autocomplete on !
document.getElementById(inputId).setAttribute("autocomplete","on");
// remove descriptor
os_map[inputId] = null;
}
}
/** Initialization, call upon page onload */
function os_MWSuggestInit() {
for(i=0;i<os_autoload_inputs.length;i++){
var id = os_autoload_inputs[i];
var form = os_autoload_forms[i];
element = document.getElementById( id );
if(element != null)
os_initHandlers(id,form,element);
}
}
hookEvent("load", os_MWSuggestInit);
/* generated javascript */
var skin = 'monobook';
var stylepath = '/skins-1.5';
/* MediaWiki:Common.js */
//See http://ru.wikipedia.org/wiki/project:code //<source lang=javascript>
importScript_ = importScript
importScript = function (page, proj){
if (!proj) importScript_(page)
else {
if (proj.indexOf('.')==-1) proj += '.wikipedia.org'
importScriptURI('http://'+proj+'/ruwiki/w/index.php?action=raw&ctype=text/javascript&title='+encodeURIComponent(page.replace(/ /g,'_')))
}
}
addLoadEvent = addOnloadHook
function ts_parseFloat(n){
if (!n) return 0
n = parseFloat(n.replace(/\./g, '').replace(/,/, '.'))
return (isNaN(n) ? 0 : n)
}
function LinkFA(){
var pLang = document.getElementById('p-lang')
if (!pLang) return
var iw = pLang.getElementsByTagName('li')
for (var i=0; i < iw.length; i++)
if (document.getElementById(iw[i].className+'-fa')){
iw[i].className += ' FA'
iw[i].title = 'Эта статья является избранной в другом языковом разделе'
}else if (document.getElementById(iw[i].className+'-ga')){
iw[i].className += ' GA'
iw[i].title = 'Эта статья является хорошей в другом языковом разделе'
}
}
function icqIcons(){
var a, spans = document.getElementById('content').getElementsByTagName('span')
for (var i=0; a=spans[i]; i++)
if (a.className == 'ICQ')
a.style.backgroundImage = "url('http://status.icq.com/online.gif?icq="+a.id+"&img=5&randseed="+Math.floor(Math.random()*10000000)+"')"
}
function newSectionLink(){
var plus = document.getElementById('ca-addsection')
if (!plus) return
var custom = document.getElementById('add-custom-section')
if (!custom) return
plus.firstChild.setAttribute('href', custom.getElementsByTagName('a')[0].href)
}
function editZeroSection(){
var body = document.getElementById('bodyContent')
if (!body) return
var h2s = body.getElementsByTagName('H2')
var h2 = h2s[0]
if (!h2) return
if (h2.parentNode.id == 'toctitle') h2 = h2s[1]
if (!h2) return
var span = h2.firstChild
if (!span || span.className != 'editsection') return
var zero = span.cloneNode(true)
body.insertBefore(zero, body.firstChild)
var a = zero.getElementsByTagName('a')[0]
if (a.href.indexOf('§ion=T') == -1 ) a.title = a.title.replace(/:.*$/,': 0')
else a.title = 'Править секцию: 0'
a.setAttribute('href', wgScript + '?title='+wgPageName + '&action=edit§ion=0')
}
function mainPage(){
if (wgArticleId == 23 || wgArticleId == 4401){ // main page || main page talk
var li = addPortletLink('p-lang', wgArticlePath.replace(/\$1/, 'Википедия:Список_Википедий'), 'Полный список', 'interwiki-completelist')
if (li) li.style.fontWeight = 'bold'
var nstab = document.getElementById('ca-nstab-main')
if (nstab && wgUserLanguage == 'ru') nstab.firstChild.firstChild.nodeValue = 'Заглавная'
}
}
//Collapsiblе: [[ВП:СБ]]
var NavigationBarShowDefault = 2
var NavigationBarHide = '[скрыть]'
var NavigationBarShow = '[показать]'
var hasClass = (function (){
var reCache = {}
return function (element, className){
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className)
}
})()
function collapsibleTables(){
var Table, HRow, HCell, btn, a, tblIdx = 0, colTables = []
var allTables = document.getElementsByTagName('table')
for (var i=0; Table = allTables[i]; i++){
if (!hasClass(Table, 'collapsible')) continue
if (!(HRow=Table.rows[0])) continue
if (!(HCell=HRow.getElementsByTagName('th')[0])) continue
Table.id = 'collapsibleTable' + tblIdx
btn = document.createElement('span')
btn.style.cssText = 'float:right; font-weight:normal; font-size:smaller'
a = document.createElement('a')
a.id = 'collapseButton' + tblIdx
a.href = 'javascript:collapseTable(' + tblIdx + ');'
a.style.color = HCell.style.color
a.appendChild(document.createTextNode(NavigationBarHide))
btn.appendChild(a)
HCell.insertBefore(btn, HCell.childNodes[0])
colTables[tblIdx++] = Table
}
for (var i=0; i < tblIdx; i++)
if ((tblIdx > NavigationBarShowDefault && hasClass(colTables[i], 'autocollapse')) || hasClass(colTables[i], 'collapsed'))
collapseTable(i)
}
function collapseTable (idx){
var Table = document.getElementById('collapsibleTable' + idx)
var btn = document.getElementById('collapseButton' + idx)
if (!Table || !btn) return false
var Rows = Table.rows
var isShown = (btn.firstChild.data == NavigationBarHide)
btn.firstChild.data = isShown ? NavigationBarShow : NavigationBarHide
var disp = isShown ? 'none' : Rows[0].style.display
for (var i=1; i < Rows.length; i++)
Rows[i].style.display = disp
}
function collapsibleDivs(){
var navIdx = 0, colNavs = [], i, NavFrame
var divs = document.getElementById('content').getElementsByTagName('div')
for (i=0; NavFrame = divs[i]; i++) {
if (!hasClass(NavFrame, 'NavFrame')) continue
NavFrame.id = 'NavFrame' + navIdx
var a = document.createElement('a')
a.className = 'NavToggle'
a.id = 'NavToggle' + navIdx
a.href = 'javascript:collapseDiv(' + navIdx + ');'
a.appendChild(document.createTextNode(NavigationBarHide))
//(must be this complicated because Moz's firstChild handling is borked)
for (var j=0; j < NavFrame.childNodes.length; j++)
if (hasClass(NavFrame.childNodes[j], 'NavHead'))
NavFrame.childNodes[j].appendChild(a)
colNavs[navIdx++] = NavFrame
}
for (i=0; i < navIdx; i++)
if ((navIdx > NavigationBarShowDefault && !hasClass(colNavs[i], 'expanded')) || hasClass(colNavs[i], 'collapsed'))
collapseDiv(i)
}
function collapseDiv(idx) {
var div = document.getElementById('NavFrame' + idx)
var btn = document.getElementById('NavToggle' + idx)
if (!div || !btn) return false
var isShown = (btn.firstChild.data == NavigationBarHide)
btn.firstChild.data = isShown ? NavigationBarShow : NavigationBarHide
var disp = isShown ? 'none' : 'block'
for (var child = div.firstChild; child != null; child = child.nextSibling)
if (hasClass(child, 'NavPic') || hasClass(child, 'NavContent'))
child.style.display = disp
}
function searchPage() {
var searchEngines = {
'Внутренний поиск': false,
'Wikiwix': 'http://ru.wikiwix.com/?action=%s&disp=article',
'Google': 'http://www.google.com/custom?q=%s&hl=ru&domains=ru.wikipedia.org&sitesearch=ru.wikipedia.org',
'Yahoo': 'http://search.yahoo.com/search?p=%s&vs=ru.wikipedia.org',
'Яndex': 'http://yandex.ru/yandsearch?text=%s&site=ru.wikipedia.org&ras=1&site_manually=true&server_name=%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F'
}
createOption = function(site, engine) {
var opt = document.createElement('option')
opt.appendChild(document.createTextNode(site))
opt.value = site
return opt
}
var searchForm = document.forms['search'] || document.forms['powersearch']
if (searchForm.fulltext) searchForm.fulltext.value = 'Найти'
submit = function() {
var optSelected = searchEngines[document.getElementById('searchEngine').value]
if (optSelected) {
searchInput = document.getElementById('searchText') || document.getElementById('powerSearchText')
window.location = optSelected.replace(/%s/g, encodeURIComponent(searchInput.value))
return false
}
}
if (navigator.appName == 'Microsoft Internet Explorer') addHandler(searchForm, 'submit', submit)
else searchForm.onsubmit = submit
var selectBox = document.createElement('select')
selectBox.id = 'searchEngine'
for (var se in searchEngines)
selectBox.appendChild(createOption(se, searchEngines[se]))
searchInput = document.getElementById('searchText') || document.getElementById('powerSearchText')
searchInput.parentNode.insertBefore(selectBox, searchInput.nextSibling)
}
function uploadPage(){
var desc = document.getElementById('wpUploadDescription')
var tmpl = document.getElementById('imageinfo')
if (tmpl && desc && !desc.value) desc.value = tmpl.innerHTML
var span = document.getElementById('insertlink')
if (!span) return
var a = document.createElement('a')
a.href = 'javascript:addRationaleTemplate()'
span.parentNode.insertBefore(a, span)
a.appendChild(span)
span.style.display = 'inline'
}
function addRationaleTemplate(){
var desc = document.getElementById('wpUploadDescription')
var tmpl = document.getElementById('rationale')
if (desc && tmpl && desc.value.indexOf(tmpl.innerHTML.substring(0,8)) == -1){
desc.value += '\n' + tmpl.innerHTML
desc.rows = 15
}
}
//Оn special pages
if (wgCanonicalNamespace == 'Special'){
if (wgCanonicalSpecialPageName == 'Upload')
addOnloadHook(uploadPage)
else if (wgCanonicalSpecialPageName == 'Search')
addOnloadHook(searchPage)
//Оn normal pages
}else if (wgAction != 'history'){
addOnloadHook(editZeroSection)
addOnloadHook(collapsibleDivs)
addOnloadHook(collapsibleTables)
addOnloadHook(mainPage)
// [[image:Erioll_world.svg|18px]] '''WikiMiniAtlas''' <br>
// Script to embed interactive maps into pages that have coordinate templates <br>
// also check my user page [[User:Dschwen]] for more tools<pre>
//
// Revision 11.1
var wikiminiatlas =
{
config:
{
width : 600,
height : 400,
zoom : -1,
quicklink : false,
quicklinkurl : 'http://maps.google.com/maps?ll={latdegdec},{londegdec}&spn={span},{span}&q={latdegdec},{londegdec}',
enabled : true,
onlytitle : false,
iframeurl : 'http://stable.toolserver.org/wma/iframe.html',
imgbase : 'http://stable.toolserver.org/wma/tiles/',
coordurls : new Array (
'http://stable.toolserver.org/geohack/geohack.php?',
'http://stable.ts.wikimedia.org/geohack/geohack.php?',
'http://toolserver.org/~magnus/geo/geohack.php?',
'http://tools.wikimedia.de/~magnus/geo/geohack.php?',
'http://www8.brinkster.com/erikbaas/wiki/maps.asp?',
'http://www.nsesoftware.nl/wiki/maps.asp?'
),
buttonImage:
'http:/upwiki/wikipedia/commons/thumb/9/9a/Erioll_world.svg/18px-Erioll_world.svg.png'
},
strings:
{
buttonTooltip : {
af:'Vertoon ligging op \'n interaktiwe kaart.',
als:'Ort uf dr interaktivä Chartä zeigä',
ar:'شاهد الموقع على الخريطة التفاعلية',
bg:'покажи местоположението на интерактивната карта',
ca:'mostra la localització en un mapa interactiu',
da:'vis beliggenhed på interaktivt kort',
de:'Ort auf interaktiver Karte anzeigen',
el:'εμφάνιση τοποθεσίας σε διαδραστικό χάρτη',
en:'show location on an interactive map',
eo:'Montru lokigon sur interaktiva karto',
eu:'erakutsi kokalekua mapa interaktibo batean',
es:'mostrar el lugar en un mapa interactivo',
fr:'Montrer la localisation sur une carte interactive',
fur:'mostre la localizazion suntune mape interative',
fy:'it plak op in oanpasbere kaart oanjaan',
gl:'Amosar o lugar nun mapa interactivo',
he:'הראה מיקום במפה האינטראקטיבית',
hr:'prikaži lokaciju na interaktivnom zemljovidu',
hu:'Mutasd a helyet egy interaktív térképen!',
it:'mostra la località su una carta interattiva',
is:'sýna staðsetningu á gagnvirku korti',
id:'Tunjukkan letak di peta interaktif',
ja:'インタラクティブ地図上に位置を表示',
lt:'Rodyti vietą interaktyviame žemėlapyje',
mk:'Prikazi go mestoto na interaktivnata mapa',
nl:'de locatie op een interactieve kaart tonen',
no:'vis beliggenhet på interaktivt kart',
pl:'Pokaż lokalizację na mapie interaktywnej',
pt:'mostrar a localidade num mapa interactivo',
ro:'arată locaţia pe o hartă interactivă',
ru:'показать положение на интерактивной карте',
sk:'zobraz miesto na interaktívnej mape',
sl:'prikaži lokacijo na interaktivnem zemljevidu',
sq:'trego vendndodhjen në hartë',
fi:'näytä paikka interaktiivisella kartalla',
sv:'visa platsen på en interaktiv karta',
uk:'показати положення на інтерактивній карті',
vi:'mở lên vị trí này trên bản đồ tương tác',
vo:'Jonön topi su kaed itjäfidik',
zh:'显示该地在地图上的位置',
'zh-cn':'显示该地在地图上的位置',
'zh-sg':'显示该地在地图上的位置',
'zh-tw':'顯示該地在地圖上的位置',
'zh-hk':'顯示該地在地圖上的位置'
},
close : {
af:'Sluit',
als:'Zuä machä',
bg:'затвори',
ca:'tanca',
da:'luk',
de:'schließen',
el:'έξοδος',
en:'close',
eo:'fermu',
eu:'itxi',
es:'cerrar',
fr:'Quitter',
fur:'siere',
fy:'ticht',
gl:'pechar',
he:'לסגור',
hr:'zatvori',
hu:'bezárás',
id:'tutup',
is:'loka',
it:'chiudi',
ja:'閉じる',
lt:'uždaryti',
mk:'zatvori',
nl:'sluiten',
no:'lukk',
pl:'zamknij',
pt:'fechar',
ro:'închide',
ru:'закрыть',
sk:'zatvoriť',
sl:'zapri',
sq:'mbylle',
fi:'sulje',
sv:'stäng',
uk:'закрити',
vi:'đóng',
vo:'färmükön',
zh:'关闭',
'zh-cn':'关闭',
'zh-sg':'关闭',
'zh-tw':'關閉',
'zh-hk':'關閉',
ar:'غلق'
}
},
link : null,
links : null,
bodyc : null,
language : '',
site: '',
iframe : { div: null, iframe: null, closebutton: null},
mapbutton: null,
marker : { lat:0, lon:0 },
coordinates : null,
coord_index: 0,
coord_params: '',
coord_filter: null,
quicklinkbox : null,
quicklinkdest : null,
region_index : 0,
coordinate_region : '',
WikiMiniAtlasHTML : '',
// cross-browser event attachment (John Resig)
// http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
addEvent : function ( obj, type, fn )
{
if (obj.addEventListener)
obj.addEventListener( type, fn, false );
else if (obj.attachEvent)
{
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
}
},
// vertikale position auf der Seite bestimmen
totalOffset : function( obj, offset )
{
if( obj.offsetParent == null ||
obj.offsetParent.id == 'content' )
return offset + obj.offsetTop;
else
return wikiminiatlas.totalOffset(obj.offsetParent, offset + obj.offsetTop );
},
// move iframe around and toggle visibility
toggleIFrame : function( e )
{
with(wikiminiatlas)
{
var newurl = config.iframeurl + '?' + this.mapparam;
if(iframe.div.style.visibility != "visible" ||
( ( iframe.iframe.src != newurl ) && ( this.mapparam != '' ) ) )
{
if( iframe.iframe.src != newurl )
{
iframe.iframe.src = newurl;
}
iframe.div.style.top = (totalOffset( this, 0 ) + 20 ) + 'px';
iframe.div.style.visibility="visible";
}
else
iframe.div.style.visibility="hidden";
}
return false;
},
// start the timer to fade in the quicklink tooltip
qlStart : function()
{
},
// abort the timer, hide the tooltip
qlStop : function()
{
},
// show the tooltip menu
qlShowMenu : function()
{
},
// fill in the map-service templates
qlURL : function( lat, lon, zoom )
{
var url = wikiminiatlas.config.quicklinkurl;
url = url.replace( /\{latdegdec\}/g, lat );
url = url.replace( /\{londegdec\}/g, lon );
var span = Math.pow( 2.0, zoom) / 150.0;
url = url.replace( /\{span\}/g, span.toFixed(4) );
return url;
},
// Check against coordinate urls
isMaplink : function( url_orig )
{
if( typeof(url_orig) != 'string' ) return false;
// needed for the russian WP
var url, err;
try { url = decodeURI( url_orig ) } catch( err ) { url = url_orig }
with(wikiminiatlas)
{
// for( var key = 0; key < config.coordurls.length; key++ ) {
for( var key in config.coordurls ) {
if( url.substr(0,config.coordurls[key].length) == config.coordurls[key] )
return true;
}
}
return false;
},
// Insert the IFrame into the page.
loader : function()
{
// apply settings
if( typeof(wma_settings) == 'object' )
for (var key in wma_settings)
{
if( typeof(wma_settings[key]) == typeof(wikiminiatlas.config[key]) )
wikiminiatlas.config[key] = wma_settings[key];
}
if( wikiminiatlas.config.enabled == false ) return;
with(wikiminiatlas)
{
site = window.location.host.substr(0,window.location.host.indexOf('.'));
language = wgUserLanguage;
var len; // cache array length for iterations
// remove stupid icons from title coordinates
var coord_title = document.getElementById('coordinates') || document.getElementById('coordinates-title');
if( coord_title ) {
var icons = coord_title.getElementsByTagName('a');
len = icons.length;
for( var key = 0; key < len; key++ ) {
if( typeof(icons[key]) == 'object' &&
icons[key] != null &&
icons[key].className == 'image' )
icons[key].parentNode.removeChild(icons[key]);
}
}
if( config.onlytitle )
{
bodyc = document.getElementById('coordinates') || document.getElementById('coordinates-title');
if( bodyc == null ) return;
}
else
{
// the french moved their title coordinates outside of bodyContent!
if( site == 'fr' )
bodyc = document.getElementById('content') || document;
else
bodyc = document.getElementById('bodyContent') || document;
}
links = bodyc.getElementsByTagName('a');
len = links.length;
for( var key = 0; key < len; key++ )
{
link = links[key];
if( link.className == 'external text' && isMaplink(link.href) )
{
coordinates = link.href;
coord_index = coordinates.indexOf('params=');
if(coord_index>-1)
{
coord_params = coordinates.substr(coord_index+7);
// degrees
coord_filter = /([\d+-.]+)_([NS])_([\d+-.]+)_([EOW])/;
if(coord_filter.test(coord_params))
{
coord_filter.exec(coord_params);
marker.lat=RegExp.$1;
if(RegExp.$2=='S') marker.lat*=-1;
marker.lon=RegExp.$3;
if(RegExp.$4=='W') marker.lon*=-1;
}
// degrees, minutes
coord_filter = /([\d+-.]+)_([\d+-.]+)_([NS])_([\d+-.]+)_([\d+-.]+)_([EOW])/;
if(coord_filter.test(coord_params))
{
coord_filter.exec(coord_params);
marker.lat=(1.0*RegExp.$1) + (RegExp.$2/60.0);
if(RegExp.$3=='S') marker.lat*=-1;
marker.lon=(1.0*RegExp.$4) + (RegExp.$5/60.0);
if(RegExp.$6=='W') marker.lon*=-1;
}
// degrees, minutes, seconds (+ fix for weird russian coords)
coord_filter = /([\d+-.]+)_([\d+-.]*)_([\d+-.]*)_([NS])_([\d+-.]+)_([\d+-.]*)_([\d+-.]*)_([EOW])/;
if(coord_filter.test(coord_params))
{
coord_filter.exec(coord_params);
marker.lat=(1.0*RegExp.$1) + (RegExp.$2/60.0) + (RegExp.$3/3600.0);
if(RegExp.$4=='S') marker.lat*=-1;
marker.lon=(1.0*RegExp.$5) + (RegExp.$6/60.0) + (RegExp.$7/3600.0);
if(RegExp.$8=='W') marker.lon*=-1;
}
/*
region_index = coordinates.indexOf('region:');
if(region_index>-1)
{
coordinate_region = coordinates.substr(region_index+7);
coordinate_region = coordinate_region.substr(0,coordinate_region.indexOf('"'));
}
*/
// check the globe parameter
var clc = coordinates.toLowerCase();
if( ( clc.indexOf('globe:') > -1 ) && ( clc.indexOf('globe:earth') == -1 ) )
{
break;
}
// If given use dim or scale for a zoomlevel
var zoomlevel = config.zoom;
if( zoomlevel < 0 )
{
var ds_filter = /(dim|scale):([\d+-.]+)/;
if( ds_filter.test( clc ) )
{
ds_filter.exec(coord_params);
var val = ( RegExp.$2 )
if( RegExp.$1 == 'dim' )
{
// wma shows approx 4e7m at zoom 0
zoomlevel = Math.log( 4e7/val ) / Math.log( 2 );
}
else // scale
{
// 1.5e8 is the scale of zoomlevel 0
zoomlevel = Math.log( 1.5e8/val ) / Math.log( 2 );
}
if( zoomlevel > 10 ) zoomlevel = 10;
}
}
// Find a sensible Zoom-level based on type
if( zoomlevel < 0 )
{
zoomlevel = 1;
if( coord_params.indexOf('type:landmark') >= 0 ) zoomlevel = 8;
if( coord_params.indexOf('type:city') >= 0 ) zoomlevel = 4;
}
// Test the unicode Symbol
if( site == 'de' && link.parentNode.id != 'coordinates' )
{
mapbutton = document.createElement('SPAN');
mapbutton.appendChild( document.createTextNode('♁') );
mapbutton.style.color = 'blue';
}
else
{
mapbutton = document.createElement('img');
mapbutton.src = config.buttonImage;
}
mapbutton.title = strings.buttonTooltip[language] || strings.buttonTooltip.en;
mapbutton.style.padding = '0px 3px 0px 0px';
mapbutton.style.cursor = 'pointer';
mapbutton.className = 'noprint';
mapbutton.mapparam =
marker.lat + '_' + marker.lon + '_' +
config.width + '_' + config.height + '_' +
site + '_' + zoomlevel + '_' + language;
addEvent( mapbutton, 'click', toggleIFrame );
// link.parentNode.insertBefore(mapbutton, link.nextSibling);
link.parentNode.insertBefore(mapbutton,link);
if ( config.quicklink ) {
link.href = qlURL( marker.lat, marker.lon, zoomlevel );
addEvent( link, 'mouseover', qlStart );
addEvent( link, 'mouseout', qlStop );
}
}
/* var def_zoom = '';
if( typeof(wikiminiatlas_defaultzoom) == 'number' )
def_zoom = '_' + wikiminiatlas_defaultzoom; */
}
} //for
// prepare quicklink menu box
if ( coordinates != null && config.quicklink ) {
quicklinkbox = document.createElement('div');
// more to come :-)
}
// prepare iframe to house the map
if ( coordinates != null ) {
iframe.div = document.createElement('div');
iframe.div.style.visibility = 'hidden';
iframe.div.style.width = (config.width+2)+'px';
iframe.div.style.height = (config.height+2)+'px';
iframe.div.style.margin = '0px';
iframe.div.style.padding = '0px';
iframe.div.style.backgroundColor = 'white';
iframe.div.style.position = 'absolute';
iframe.div.style.right = '2em';
iframe.div.style.top = '1em';
iframe.div.style.border = '1px solid gray';
iframe.div.style.zIndex = 13;
iframe.closebutton = document.createElement('img');
iframe.closebutton.title = strings.close[language] || strings.close.en;
// was: config.imgbase + 'button_hide.png'
iframe.closebutton.src = 'http:/upwiki/wikipedia/commons/d/d4/Button_hide.png'
iframe.closebutton.style.zIndex = 15;
iframe.closebutton.style.position = 'absolute';
iframe.closebutton.style.right = '11px';
iframe.closebutton.style.top = '9px';
iframe.closebutton.style.width = '18px';
iframe.closebutton.style.cursor = 'pointer';
iframe.closebutton.mapparam = '';
addEvent( iframe.closebutton, 'click', toggleIFrame );
iframe.iframe = document.createElement('iframe');
iframe.iframe.scrolling = 'no';
iframe.iframe.frameBorder = '0';
iframe.iframe.style.zIndex = 14;
iframe.iframe.style.position = 'absolute';
iframe.iframe.style.right = '1px';
iframe.iframe.style.top = '1px';
iframe.iframe.style.width = (config.width)+'px';
iframe.iframe.style.height = (config.height)+'px';
iframe.iframe.style.margin = '0px';
iframe.iframe.style.padding = '0px';
iframe.div.appendChild(iframe.iframe);
iframe.div.appendChild(iframe.closebutton);
var content = document.getElementById('content') || document.getElementById('mw_content');
if(content)
content.insertBefore(iframe.div,content.childNodes[0]);
}
} //with
}
}
//
// Hook up installation function
//
addOnloadHook(wikiminiatlas.loader);
//</pre>
if (wgNamespaceNumber == 0)
addOnloadHook(LinkFA)
else{
addOnloadHook(icqIcons)
addOnloadHook(newSectionLink)
}
if (wgAction == 'edit' || wgAction == 'submit')
importScript('MediaWiki:Wikificator.js')
//Toolbar buttons
function StandardButtons(){
if (mwEditButtons.length < 6) return
mwEditButtons[5].tagClose = '|thumb]]'
}
function CustomButtons(){
addCustomButton('http:/upwiki/wikipedia/ru/1/1d/Button_redirect_rus.png', 'Перенаправление','#REDIRECT [[',']]','название страницы')
addCustomButton('http:/upwiki/wikisource/ru/a/a6/Button-cat.png','Категория','[\[Категория:',']]\n','')
addCustomButton('http:/upwiki/wikipedia/en/3/34/Button_hide_comment.png', 'Комментарий', '<!-- ', ' -->', 'Комментарий')
addCustomButton('http:/upwiki/wikipedia/en/f/fd/Button_blockquote.png', 'Развёрнутая цитата', '<blockquote>\n', '\n</blockquote>', 'Развёрнутая цитата одним абзацем')
addCustomButton('http:/upwiki/wikipedia/en/6/60/Button_insert_table.png',
'Вставить таблицу', '{| class="wikitable"\n|', '\n|}', '-\n! заголовок 1\n! заголовок 2\n! заголовок 3\n|-\n| строка 1, ячейка 1\n| строка 1, ячейка 2\n| строка 1, ячейка 3\n|-\n| строка 2, ячейка 1\n| строка 2, ячейка 2\n| строка 2, ячейка 3')
addCustomButton('http:/upwiki/wikipedia/commons/7/79/Button_reflink.png','Сноска','<ref>','</ref>','')
}
function addCustomButton(img, tip, open, close, sample){
mwCustomEditButtons[mwCustomEditButtons.length] =
{'imageFile':img, 'speedTip':tip, 'tagOpen':open, 'tagClose':close, 'sampleText':sample}
}
function addFuncButton(img, tip, func){
var toolbar = document.getElementById('toolbar')
if (!toolbar) return
var i = document.createElement('img')
i.src = img
i.alt = tip; i.title = tip
i.onclick = func
i.style.cursor = 'pointer'
toolbar.appendChild(i)
}
function WikifButton(){
var t = document.getElementById('wpTextbox1')
if (!t || (!document.selection && t.selectionStart == null)) return
addFuncButton('http:/upwiki/wikisource/ru/d/d1/Button-wikifikator.png', 'Викификатор', Wikify)
}
//Edit Summary buttons
function SummaryButtons(){
var wpSummary = document.getElementById('wpSummary')
if (!wpSummary || (wpSummary.form.wpSection && wpSummary.form.wpSection.value == 'new')) return
wpSummaryBtn = document.createElement('span') //global var
wpSummaryBtn.id = 'userSummaryButtonsA'
wpSummary.parentNode.insertBefore(wpSummaryBtn, wpSummary.nextSibling)
wpSummary.parentNode.insertBefore(document.createElement('br'), wpSummary.nextSibling)
addSumButton('викиф.', 'викификация', 'Произведена викификация')
addSumButton('оформл.', 'оформление', 'Улучшено оформление')
addSumButton('стиль', 'стилевые правки', 'Поправлен стиль изложения')
addSumButton('орфогр.', 'орфография', 'Поправлена орфография')
addSumButton('пункт.', 'пунктуация', 'Изменена пунктуация')
addSumButton('интервики', 'интервики', 'Исправлены межъязыковые ссылки (интервики)')
addSumButton('кат.', 'категория', 'Исправлена категоризация')
addSumButton('шаб.', 'шаблон', 'Добавлен / изменён шаблон')
addSumButton('к удал.', 'к удалению', 'Страница предложена к удалению')
addSumButton('доп.', 'дополнение', 'Добавлены новые сведения')
addSumButton('иллюстрация', 'иллюстрация', 'Размещена иллюстрация')
addSumButton('обнов.', 'обновление данных', 'Обновлены устаревшие данные')
}
function addSumButton(name, text, title) {
var btn = document.createElement('a')
btn.appendChild(document.createTextNode(name))
btn.title = title
btn.onclick = function(){insertSummary(text)}
wpSummaryBtn.appendChild(btn)
}
function insertSummary(text) {
var wpSummary = document.getElementById('wpSummary')
if (wpSummary.value.indexOf(text) != -1) return
if (wpSummary.value.match(/[^,; \/]$/)) wpSummary.value += ','
if (wpSummary.value.match(/[^ ]$/)) wpSummary.value += ' '
wpSummary.value += text
}
//call functions
addOnloadHook(StandardButtons)
addOnloadHook(CustomButtons)
addOnloadHook(WikifButton)
addOnloadHook(SummaryButtons)
//sig reminder
if (wgNamespaceNumber % 2 || wgNamespaceNumber==4)
addOnloadHook(function (){
var cp = document.getElementById('editpage-copywarn')
var wpSave = document.getElementById('wpSave')
if (!cp || !wpSave) return
if (wgNamespaceNumber == 4 &&
(!wgTitle.match('^(Форум[/ ]|Голосования/|Опросы/|Обсуждение правил/|Заявки на .*/|Запросы.|Кандидаты в .*/|К (удалению|объединению|переименованию|разделению|улучшению)/|Проверка участников/)') || wgTitle.match ('/Архив'))) return
var ins = ' <a href=\'javascript:insertTags(" ~~\~~\","","")\'>~~\~~</a>'
cp.innerHTML = 'Не забудьте добавить к вашему сообщению подпись с помощью' + ins
cp.style.padding = '2px'
cp.style.background = '#F7F7F7'
cp.style.border = '1px solid gray'
if (wgUserGroups && wgUserGroups.join().indexOf('autoconfirmed') != -1 && !window.sigWarning) return
//unreg/new users only
var warningDone = false
wpSave.onclick = function(){
try{
if (warningDone || document.editform.wpTextbox1.value.indexOf('~~\~~') >= 0 ) return true
warningDone = true
cp.innerHTML = 'Пожалуйста, <b>подпишитесь</b>, добавив в конце своего сообщения' + ins
+ ' (<a href="' + wgArticlePath.replace(/\$1/, 'Википедия:Подписывайтесь')
+ '" title="(ссылка откроется в новом окне)" target=_blank>подробнее ↗</a>)'//→ ↗
cp.style.background = '#FFD080'
cp.style.border = '1px solid orange'
return false
}catch(e) {return true}
}
})
}
if (navigator.appName == 'Microsoft Internet Explorer'){
if (document.createStyleSheet) //IPA fix
document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";')
}
//if (wgUserGroups)
{
var wgUserGroupsStr = wgUserGroups.join('')
// if (wgUserGroupsStr.indexOf('sysop') != -1)
addOnloadHook(function(){importScript('MediaWiki:Sysop.js')})
// if (wgUserGroupsStr.indexOf('editor') != -1)
appendCSS('#mw-revisiontag{display:block}')
//}else
{ //flaggedRevs
// appendCSS('.fr-diff-to-stable {display:none !important}')
// if (wgAction == 'history')
// appendCSS('span.flaggedrevs-color-1 {background:transparent !important} small {display:none !important}')
}
//</source>
/* MediaWiki:Monobook.js */
/* Указанный здесь JavaScript будет загружен всем участникам, использующим тему оформления MonoBook */