Welcome to Wargaming.net Wiki!
Variants

Difference between revisions of "MediaWiki:Common.js"

Jump to: navigation, search
Revision as of 20:28, 6 June 2014Revision as of 20:30, 6 June 2014
Reverted edits by NyxOnXbox:na (talk) to last revision by Snib:eu
Line 1:Line 1:
?/* Размещённый здесь JavaScript код будет загружаться всем пользователям при обращении к каждой странице */+/* Any JavaScript here will be loaded for all users on every page load. */
? +
  
?/* Добавление кнопки и функционала Викификатора в режиме редактирования */+/* ----- BEGIN Jiri_Starrider's JS, please do not touch. Ask me first before editing.-----*/
?function addWikifButton() {+
? var toolbar = document.getElementById('toolbar')+
? if (!toolbar) return+
? var i = document.createElement('img')+
? i.src = 'https://upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png'+
? i.alt = i.title = 'викификатор'+
? i.onclick = Wikify+
? i.style.cursor = 'pointer'+
? toolbar.appendChild(i)+
?}+
  
?/* Сокрытие приглашения скачать игру в подвале для залогиненного пользователя (раньше фунция еще добавляла кнопку "Играть") */+function showModulesTree() {
?function addPlayButton() {+ $('.js-modules-tree').each(function(){
? try {+ var $this = $(this), contentWidth, contentHeight, iframe, contentPadding;
? var logout = document.getElementById('pt-logout');+ $this.html('<div class="b-modulestree"><iframe frameborder="0" style="border-width: 0; width: 1000px; min-width: 100%; height: 695px;" src="https://armor.kiev.ua/wot/tanks/modulestree.php?vehicle=' + $.trim($(this).text()) + '"></iframe></div>');
? if (logout != null) {+ iframe = $this.find('iframe');
? document.getElementById('footer-wot-link').style.display = 'none';+ contentWidth = iframe.width();
? } + contentHeight = iframe.height();
? } catch(e) {+ contentPadding = parseInt(iframe.parent().css('padding-bottom'));
? return;+ $this.height(contentHeight + contentPadding);
? }+
 + $this.data('jsp','').jScrollPane({showArrows:false, contentWidth: contentWidth, contentHeight: contentHeight});
 + $(window).resize(function(){
 + $this.data('jsp').reinitialise();
 + });
 + });
 } }
 +addOnloadHook(showModulesTree);
  
?/* Функционал тактических примеров. См. пример на [[Тактика. Т-54 — создание перевеса на фланге]] */+/* ----- END Jiri_Starrider's JS edits, feel free to edit below.-----*/
?var tacticCounter = 1;+
?var mapImages = new Array();+
  
?function tacticNext() { +/* BEGIN n1sK's js, please leave it alone, if you really must edit it ask me first.*/
? document.getElementById('step' + tacticCounter).style.display = 'none';+/* Collapsible tables js*/
  
? if (tacticCounter < mapImages.length - 1) { +var autoCollapse = 2;
? tacticCounter++ ;+var collapseCaption = "hide";
? if (tacticCounter == mapImages.length - 1) document.getElementById('nextsteplink').innerHTML = 'В начало';+var expandCaption = "show";
? } else { +
? tacticCounter = 1; +
? document.getElementById('nextsteplink').innerHTML = 'Продолжить »';+
? }+
  
? document.getElementById('step' + tacticCounter).style.display = 'block';+function collapseTable( tableIndex )
? document.getElementById('tacticimg').src = mapImages[tacticCounter];+{
? return false;+ var Button = document.getElementById( "collapseButton" + tableIndex );
?}+ var Table = document.getElementById( "collapsibleTable" + tableIndex );
  
?function tacticSlideShow() {+ if ( !Table || !Button ) {
? try {+ return false;
? var mapDiv = document.getElementById('tacticmap');+
? if (mapDiv == null) {+
? return;+
  }  }
? mapImages = mapDiv.innerHTML.split(','); 
? mapDiv.innerHTML = ''; 
? mapDiv.style.background = 'url(' + mapImages[0] + ') top no-repeat'; 
? var imgNode = document.createElement( 'img' ); 
? imgNode.id = 'tacticimg'; 
? imgNode.src = mapImages[1]; 
? mapDiv.appendChild( imgNode ); 
  
? var aNode = document.createElement( 'a' ); + var Rows = Table.rows;
? aNode.setAttribute( 'id', 'nextsteplink' );+
? aNode.setAttribute( 'href', '#' );+
? aNode.setAttribute( 'onClick', 'return tacticNext();' );+
? aNode.appendChild(document.createTextNode('Продолжить »'));+
? document.getElementById('nextstep').appendChild(aNode);+
? } catch(e) {+
? return;+
? }+
?}+
  
?/* переключение ТТХ топ/сток */+ if ( Button.firstChild.data == collapseCaption ) {
?function tthTopStock() {+ for ( var i = 1; i < Rows.length; i++ ) {
? $('#toStock').click(function(){+ Rows[i].style.display = "none";
? $('#stockTTH').show();+ }
? $('#topTTH').hide();+ Button.firstChild.data = expandCaption;
? });+ } else {
? $('#toTop').click(function(){+ for ( var i = 1; i < Rows.length; i++ ) {
? $('#stockTTH').hide();+ Rows[i].style.display = Rows[0].style.display;
? $('#topTTH').show();+ }
? });+ Button.firstChild.data = collapseCaption;
?}+
? +
?//Messages+
?var NavigationBarHide = '[скрыть]'+
?var NavigationBarShow = '[показать]'+
?var NavigationBarShowDefault = 2+
? +
?/* Функционал раскрывающихся блоков (спойлеры) */+
?//Collapsiblе+
? +
?var hasClass = (function (){+
? var reCache = {}+
? return function (element, className){+
? return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className)+
? }+
?})()+
? +
?/*+
?$(document).ready(function(){+
? $("table.collapsible").each(function(idx, table){+
? $(table).attr( "id", 'collapsibleTable' + idx );+
? });+
?});+
? +
?*/+
?$(document).ready(function(){+
? /*Chrome font bug hack*/+
? if ($.browser.chrome) {+
? var DALEY_FOR_CHROME_FONT_CORRECTION = 2000;+
? setTimeout(function () {+
? $('body')+
? .addClass('temp')+
? .removeClass('temp');+
? }, DALEY_FOR_CHROME_FONT_CORRECTION);+
  }  }
?}); 
? 
?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){+function createCollapseButtons()
? var Table = document.getElementById('collapsibleTable' + idx)+{
? var btn = document.getElementById('collapseButton' + idx)+ var tableIndex = 0;
? if (!Table || !btn) return false+ var NavigationBoxes = new Object();
? var Rows = Table.rows+ var Tables = document.getElementsByTagName( "table" );
? 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(){+ for ( var i = 0; i < Tables.length; i++ ) {
? var navIdx = 0, colNavs = [], i, NavFrame+ if ( hasClass( Tables[i], "collapsible" ) ) {
? 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))+
? 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 HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
? var div = document.getElementById('NavFrame' + idx)+ if (!HeaderRow) continue;
? var btn = document.getElementById('NavToggle' + idx)+ var Header = HeaderRow.getElementsByTagName( "th" )[0];
? if (!div || !btn) return false+ if (!Header) continue;
? 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+
?}+
  
?// Add Hooks+ NavigationBoxes[ tableIndex ] = Tables[i];
 + Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
  
?addOnloadHook(addPlayButton);+ var Button = document.createElement( "span" );
 + var ButtonLink = document.createElement( "a" );
 + var ButtonText = document.createTextNode( collapseCaption );
  
?if (wgAction == 'edit' || wgAction == 'submit') {+ Button.className = "collapseButton"; //Styles are declared in Common.css
? importScriptURI('https://ru.wikipedia.org/w/index.php?title=MediaWiki:Wikificator.js&action=raw&ctype=text/javascript')+
? addOnloadHook(addWikifButton)+
?} else {+
? addOnloadHook(tacticSlideShow)+
? addOnloadHook(tthTopStock)+
? addOnloadHook(collapsibleDivs)+
? addOnloadHook(collapsibleTables)+
?}+
  
 + ButtonLink.style.color = Header.style.color;
 + ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
 + ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
 + ButtonLink.appendChild( ButtonText );
  
?/* Функционал всплывающих подсказок с ТТХ модулей */+ Button.appendChild( document.createTextNode( "[" ) );
?var isDropDownBox = false;+ Button.appendChild( ButtonLink );
 + Button.appendChild( document.createTextNode( "]" ) );
  
?$('.commentDrop').hover(+ Header.insertBefore( Button, Header.childNodes[0] );
?function(){+ tableIndex++;
? if (!isDropDownBox) {+ }
? $('#bodyContent').append('<div id="dropDownBox" style="position:absolute;"></div>');+
? isDropDownBox = true;+
? }+
? var offset = $(this).position();+
? var top = offset.top + $(this).height();+
? +
? var obj = $.parseJSON($(this).find(".commentData").text());+
? +
? var str = '<div style="border:1px dotted;background:#efefef;padding:5px 1em;"><p style="text-align:center;"><b>' +
? + obj.type + ' ' + obj.mark + '</b></p> <dl>';+
? +
? var items = [];+
? $.each(obj.data, function(key, val){+
? items.push('<dt>' + key + ':</dt><dd>' + val + '</dd>');+
? });+
? +
? str += items.join('') + ' </dl></div><p>&nbsp;</p>';+
? +
? $("#dropDownBox").html(str);+
? $("#dropDownBox").css({"top": top + "px", "left":offset.left + "px"})+
? $("#dropDownBox").show();+
?},+
?function(){+
? $("#dropDownBox").hide();+
?});+
? +
? +
?/*+
? * Плагины+
?*/+
?/* simpleRotator - обеспечивает функционал врашения машины вокруг вертикальной оси */+
?(function(a){a.fn.simpleRotator=function(b){var d={mouseMoveThresholdX:20,RepeatImageX:true,startImage:0,isAnimate:true,animationSpeed:100,animationShowSpeed:200,width:"auto",height:"auto",linkType:"a",textLoad:"Просмотреть",textLoading:"Загрузка",textLoadError:"Произошла ошибка при загрузке, попробуйте обновить страницу."};var c=a.extend(d,b);return this.each(function(){function u(){a(z).html('<div class="loader loadButton" unselectable="on">'+c.textLoad+"</div>");a(z).children(".loader").click(function(){if(j){return 0}a(z).children(".loader").html(c.textLoading);a(z).children(".loader").removeClass("loadButton");m()})}function w(){for(i=0;i<s.length;i++){a(z).append('<div class="subRotator subRotatorId-'+i+'"></div>');a(z).children(".subRotatorId-"+i).css("background-image",'url("'+q[i].src+'")');a(z).children(".subRotatorId-"+i).hide()}}function x(){try{if(c.linkType=="img"){a(z).children("img").each(function(e){s.push(a(this).attr("src"))})}else{if(c.linkType=="a"){a(z).children("a").each(function(e){s.push(a(this).attr("href"))})}}}catch(A){}}function m(){try{for(i=0;i<s.length;i++){pic=new Image();pic.src=s[i];q.push(pic);pic.addEventListener("load",t,false);pic.addEventListener("error",r,false)}}catch(A){}}function t(e){o++;if(o===s.length){n()}}function n(A){try{h(q[0].width);k(q[0].height);w();v();f(c.startImage);a(z).children(".loader").hide()}catch(B){}}function r(e){a(z).children(".loader").html(c.textLoadError);j=true}function v(){try{a(z).mousedown(function(e){l=true;g=e.clientX});a(z).mouseup(function(e){l=false});a(z).mouseleave(function(e){l=false});a(z).mousemove(function(e){if(l){if(Math.max(g,e.clientX)-Math.min(g,e.clientX)>c.mouseMoveThresholdX){if(e.clientX-g<0){f("prev")}else{f("next")}g=e.clientX}}})}catch(A){}}function f(A){try{if(A=="next"){A=p+1}if(A=="prev"){A=p-1}if(A>s.length-1&&c.RepeatImageX==true){A=0}else{if(A>s.length-1){A=s.length-1}}if(A<0&&c.RepeatImageX==true){A=s.length-1}else{if(A<0){A=0}}if(p!=A){if(c.isAnimate){a(z).children(".subRotator").stop(true,true)}a(z).children(".subRotator").css("z-index","");a(z).children(".subRotator.subRotatorId-"+p).css("z-index","14");a(z).children(".subRotator.subRotatorId-"+p).css("opacity","1");if(c.isAnimate){a(z).children(".subRotator.subRotatorId-"+A).css("opacity",0)}a(z).children(".subRotator.subRotatorId-"+A).css("z-index","15");if(c.isAnimate){a(z).children(".subRotator.subRotatorId-"+A).animate({opacity:1},c.animationSpeed,function(){})}p=A}a(z).children(".subRotator.subRotatorId-"+p).show()}catch(B){}}function h(e){if(c.width!="auto"){e=c.width}else{if(e<=0){e=320}}z.css("width",e)}function k(e){if(c.height!="auto"){e=c.height}else{if(e<=0){e=240}}z.animate({height:e},c.animationShowSpeed)}var l=false;var g=0;var p=-1;var s=Array();var q=Array();var o=0;var j=false;var z=a(this);try{z.addClass("plugin_rotator");z.attr("ondrag","return false;");z.attr("ondragdrop","return false;");z.attr("ondragstart","return false;");z.show();x();u()}catch(y){}})}})(jQuery);+
? +
? +
?/* Добавление комплектации в Edittools */+
?function addAdditionalEdittools() {+
? try{+
? if (localStorage['o_additionalEditPanelButtons'] != 1) return 0;+
? if (!$('div.mw-editTools').length) return 0;+
? var helpIconAddress = 'https://wiki.worldoftanks.ru/uploads/0/05/Question-small.png';+
? var iconSize = '20px';+
? var resultText = "";+
? etElem = new Array();+
? /*+
? etElem.push({insertLeft:'Вставка слева', insert:'Вставка', insertRight:'Вставка справа', title:'Подсказка при наведении',img:'Ссылка на картинку', text:'Текст надписи', help:'Ссылка на страницу помощи'});+
? */+
? etElem.push({text: '<p>'});+
? etElem.push({text: 'Достоинства', insertLeft:'{{Достоинства| ', insertRight:'}}', help:'/Шаблон:Достоинства'});+
? etElem.push({text: 'Недостатки', insertLeft:'{{Недостатки| ', insertRight:'}}', help:'/Шаблон:Недостатки'});+
? etElem.push({text: 'Навыки', insertLeft:'{{Навыки|Строка1= ', insertRight:'|Подпись= }}', help:'/Шаблон:Навыки'});+
? etElem.push({text: 'Switcher', insertLeft:'{{switcher|height=|width=|Вкладка1# ', insert:'Содержимое', insertRight:' }}', help:'/Шаблон:Switcher'});+
? etElem.push({text: 'Дописать', insertLeft:'{{Дописать}}', help:'/Шаблон:Дописать'});+
? etElem.push({text: 'Доработать', insertLeft:'{{Доработать|', insertRight:' }}', help:'/Шаблон:Доработать'});+
? etElem.push({text: 'Rotator', insertLeft:'{{Rotator|filename=', insertRight:' }}', help:'/Шаблон:Rotator'});+
? etElem.push({text: 'НОС', insertLeft:'{{НОС|', insertRight:'}}', help:'/Шаблон:НОС'});+
? etElem.push({text: '</p><p>'});+
? etElem.push({text: 'Комплектация', insertLeft:'{{Комплектация|Модуль1 = |Модуль2 = |Модуль3 = |Снаряд1 = ББ |БК1 = 0 |Снаряд2 = БП |БК2 = 0 |Снаряд3 = ОФ |БК3 = 0 |Снаряжение1 = |Снаряжение2 = |Снаряжение3 = }}', help:'/Шаблон:Комплектация'});+
? etElem.push({text: ': '});+
? etElem.push({insertLeft:'Маскировочная сеть ', img:'https://wiki.worldoftanks.ru/uploads/thumb/f/f8/Маскировочная_сеть.png/'+iconSize+'-Маскировочная_сеть.png'});+
? etElem.push({insertLeft:'Стереотруба ', img:'https://wiki.worldoftanks.ru/uploads/thumb/3/33/Стереотруба.png/'+iconSize+'-Стереотруба.png'});+
? etElem.push({insertLeft:'Ящик с инструментами ', img:'https://wiki.worldoftanks.ru/uploads/thumb/0/06/Ящик_с_инструментами.png/'+iconSize+'-Ящик_с_инструментами.png'});+
? etElem.push({insertLeft:'Рессоры ', img:'https://wiki.worldoftanks.ru/uploads/thumb/a/a1/Рессоры.png/'+iconSize+'-Рессоры.png'});+
? etElem.push({insertLeft:'Противоосколочный подбой ', img:'https://wiki.worldoftanks.ru/uploads/thumb/c/c1/Противоосколочный_подбой.png/'+iconSize+'-Противоосколочный_подбой.png'});+
? etElem.push({insertLeft:'Улучшенная вентиляция ', img:'https://wiki.worldoftanks.ru/uploads/thumb/7/75/Улучшенная_вентиляция.png/'+iconSize+'-Улучшенная_вентиляция.png'});+
? etElem.push({insertLeft:'Мокрая боеукладка ', img:'https://wiki.worldoftanks.ru/uploads/thumb/0/07/Мокрая_боеукладка.png/'+iconSize+'-Мокрая_боеукладка.png'});+
? etElem.push({insertLeft:'Досылатель ', img:'https://wiki.worldoftanks.ru/uploads/thumb/7/72/Досылатель.png/'+iconSize+'-Досылатель.png'});+
? etElem.push({insertLeft:'Дополнительные грунтозацепы ', img:'https://wiki.worldoftanks.ru/uploads/thumb/4/43/Дополнительные_грунтозацепы.png/'+iconSize+'-Дополнительные_грунтозацепы.png'});+
? etElem.push({insertLeft:'Заполнение баков CO2 ', img:'https://wiki.worldoftanks.ru/uploads/thumb/3/3c/Заполнение_баков_CO2.png/'+iconSize+'-Заполнение_баков_CO2.png'});+
? etElem.push({insertLeft:'Просветленная оптика ', img:'https://wiki.worldoftanks.ru/uploads/thumb/5/59/Просветленная_оптика.png/'+iconSize+'-Просветленная_оптика.png'});+
? etElem.push({insertLeft:'Стабилизатор вертикальной наводки ', img:'https://wiki.worldoftanks.ru/uploads/thumb/7/78/Стабилизатор_вертикальной_наводки.png/'+iconSize+'-Стабилизатор_вертикальной_наводки.png'});+
? etElem.push({insertLeft:'Усиленные приводы наводки ', img:'https://wiki.worldoftanks.ru/uploads/thumb/5/59/Усиленные_приводы_наводки.png/'+iconSize+'-Усиленные_приводы_наводки.png'});+
? etElem.push({insertLeft:'Фильтр Циклон ', img:'https://wiki.worldoftanks.ru/uploads/thumb/f/fc/Фильтр_Циклон.png/'+iconSize+'-Фильтр_Циклон.png'});+
? etElem.push({text: '| '});+
? etElem.push({insertLeft:'Малый ремкомплект ', img:'https://wiki.worldoftanks.ru/uploads/thumb/f/fe/Малый_ремкомплект.png/'+iconSize+'-Малый_ремкомплект.png'});+
? etElem.push({insertLeft:'Малая аптечка ', img:'https://wiki.worldoftanks.ru/uploads/thumb/e/e6/Малая_аптечка.png/'+iconSize+'-Малая_аптечка.png'});+
? etElem.push({insertLeft:'Ручной огнетушитель ', img:'https://wiki.worldoftanks.ru/uploads/thumb/c/c8/Ручной_огнетушитель.png/'+iconSize+'-Ручной_огнетушитель.png'});+
? etElem.push({insertLeft:'Ленд-лизное масло ', title:'Ленд-лизное масло (советские танки)', img:'https://wiki.worldoftanks.ru/uploads/thumb/4/40/Ленд-лизное_масло.png/'+iconSize+'-Ленд-лизное_масло.png'});+
? etElem.push({insertLeft:'Качественное масло ', title:'Качественное масло (китайские танки)', img:'https://wiki.worldoftanks.ru/uploads/thumb/3/3b/Качественное_масло.png/'+iconSize+'-Качественное_масло.png'});+
? etElem.push({insertLeft:'100-октановый бензин ', title:'100-октановый бензин (немецкие, французские и американские танки с бензиновыми двигателями)', img:'https://wiki.worldoftanks.ru/uploads/thumb/c/c7/100-октановый_бензин.png/'+iconSize+'-100-октановый_бензин.png'});+
? etElem.push({insertLeft:'Подкрученный регулятор оборотов ', img:'https://wiki.worldoftanks.ru/uploads/thumb/2/28/Подкрученный_регулятор_оборотов.png/'+iconSize+'-Подкрученный_регулятор_оборотов.png'});+
? +
? etElem.push({text: '| '});+
? etElem.push({text: 'Модули:', help:'/WoT:Коды_модулей'});+
? etElem.push({insertLeft:'{{CommentGun|tank:', insertRight:'}}', img:'https://wiki.worldoftanks.ru/uploads/thumb/1/1a/Ico_gun_alpha.png/'+iconSize+'-Ico_gun_alpha.png'});+
? etElem.push({insertLeft:'{{CommentTurret|tank:', insertRight:'}}', img:'https://wiki.worldoftanks.ru/uploads/thumb/4/47/Ico_turret_alpha.png/'+iconSize+'-Ico_turret_alpha.png'});+
? etElem.push({insertLeft:'{{CommentEngine|tank:', insertRight:'}}', img:'https://wiki.worldoftanks.ru/uploads/thumb/7/73/Ico_engine_alpha.png/'+iconSize+'-Ico_engine_alpha.png'});+
? etElem.push({insertLeft:'{{CommentChassis|tank:', insertRight:'}}', img:'https://wiki.worldoftanks.ru/uploads/thumb/e/e7/Ico_suspension_alpha.png/'+iconSize+'-Ico_suspension_alpha.png'});+
? etElem.push({insertLeft:'{{CommentRadio|tank:', insertRight:'}}', img:'https://wiki.worldoftanks.ru/uploads/thumb/c/ca/Ico_radio_alpha.png/'+iconSize+'-Ico_radio_alpha.png'});+
? +
? etElem.push({text: '</p>'});+
? +
? for ( key in etElem ) {+
? insertLeft = etElem[key].insertLeft!==undefined?etElem[key].insertLeft:''; insertRight = etElem[key].insertRight!==undefined?etElem[key].insertRight:'';+
? insert = etElem[key].insert!==undefined?etElem[key].insert:''; title = etElem[key].title!==undefined?etElem[key].title:insertLeft+insert+insertRight;+
? +
? if ((insertLeft+insert+insertRight)!='') {resultText += '<a onclick="insertTags(\''+insertLeft+'\',\''+insertRight+'\',\''+insert+'\');return false;" title="'+title+'" href="#">';}+
? if (etElem[key].img !== undefined) {resultText += '<img src="'+etElem[key].img+'" />';}+
? if (etElem[key].text !== undefined) {resultText += etElem[key].text}+
? if ((insertLeft+insert+insertRight)!='') {resultText +='</a>';}+
? if (etElem[key].help !== undefined) {resultText += '<a href="'+etElem[key].help+'" target="_blank"><img src="'+helpIconAddress+'" /></a>';}+
? resultText +=' ';+
  }  }
? resultText += '</p>'; 
? $('#editpage-specialchars').append(resultText); 
? } catch (e) {console.error('Ошибка в addComplectationEdittools');} 
?} 
  
? + for ( var i = 0; i < tableIndex; i++ ) {
? + if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
?/* Проверка контента статьи на наличие разделов с подсказкой под левым главым меню */+ collapseTable( i );
?function checkContent() {+ }
? if ( $('div.TankPerformance').length ) {+ else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
? var problems = new Array(); var problemsText = '';+ var element = NavigationBoxes[i];
? if( $('div#stockTTH.TankPerformance h3').text().indexOf("Ошибка: Значение не задано")+1 ){ problems.push('<a href="/WoT:Коды_модулей">Код техники</a>') }+ while (element = element.parentNode) {
? if( !$('.commentDrop').length ){ problems.push('<a href="/WoT:Коды_модулей">Комментарии модулей</a>') }+ if ( hasClass( element, "outercollapse" ) ) {
? /* if( !$('.skillsPanel').length ){ problems.push('<a href="/Шаблон:Навыки">Панели навыков</a>') } */+ collapseTable ( i );
? if( !$('.complect').length ){ problems.push('<a href="/WoT:Содержание_статей_о_технике#.D0.9E.D0.B1.D0.BE.D1.80.D1.83.D0.B4.D0.BE.D0.B2.D0.B0.D0.BD.D0.B8.D0.B5.2C_.D1.81.D0.BD.D0.B0.D1.80.D1.8F.D0.B6.D0.B5.D0.BD.D0.B8.D0.B5_.D0.B8_.D0.B1.D0.BE.D0.B5.D0.BA.D0.BE.D0.BC.D0.BF.D0.BB.D0.B5.D0.BA.D1.82">Примеры комплектации</a>') }+ break;
? if( $('.mw-headline').text().indexOf("Исследование и прокачка")+1 == 0 && $('.TankPerformance .mw-headline a img').attr("src") != '/uploads/2/2b/Gold_icon.png'){ problems.push('<a href="/WoT:Содержание_статей_о_технике#.D0.98.D1.81.D1.81.D0.BB.D0.B5.D0.B4.D0.BE.D0.B2.D0.B0.D0.BD.D0.B8.D0.B5_.D0.B8_.D0.BF.D1.80.D0.BE.D0.BA.D0.B0.D1.87.D0.BA.D0.B0">Раздел Исследование и прокачка</a>');}+ }
? if( $('.mw-headline').text().indexOf("Боевая эффективность")+1 == 0 ){ problems.push('<a href="/WoT:Содержание_статей_о_технике#.D0.91.D0.BE.D0.B5.D0.B2.D0.B0.D1.8F_.D1.8D.D1.84.D1.84.D0.B5.D0.BA.D1.82.D0.B8.D0.B2.D0.BD.D0.BE.D1.81.D1.82.D1.8C">Раздел Боевая эффективность</a>') }+ }
? if( $('div.wot-panel h3').text().indexOf("Галерея скриншотов")+1 == 0 && $('div.wot-panel h2').text().indexOf("Галерея скриншотов")+1 == 0 && $('.NavHead').text().indexOf("Галерея")+1 == 0 ){ problems.push('<a href="/WoT:Содержание_статей_о_технике#.D0.93.D0.B0.D0.BB.D0.B5.D1.80.D0.B5.D1.8F_.D1.81.D0.BA.D1.80.D0.B8.D0.BD.D1.88.D0.BE.D1.82.D0.BE.D0.B2">Галерея скриншотов</a>') }+ }
? if( $('div.wot-panel h3').text().indexOf("Оценка")+1 == 0 ){ problems.push('<a href="/WoT:Содержание_статей_о_технике#.D0.9E.D1.86.D0.B5.D0.BD.D0.BA.D0.B0_.D0.BC.D0.B0.D1.88.D0.B8.D0.BD.D1.8B">Оценка машины</a>') }+
? if( $('.mw-headline').text().indexOf("Историческая справка")+1 == 0 ){ problems.push('<a href="/WoT:Содержание_статей_о_технике#.D0.98.D1.81.D1.82.D0.BE.D1.80.D0.B8.D1.87.D0.B5.D1.81.D0.BA.D0.B0.D1.8F_.D1.81.D0.BF.D1.80.D0.B0.D0.B2.D0.BA.D0.B0">Раздел Историческая справка</a>') }+
? if( !$('.navbox').length ){ problems.push('<a href="#">Навигация</a>') }+
? if( $('table.improvePlate').length ) { problems.push('Доработать: '+$('table.improvePlate i.reasons').text()); $('table.improvePlate').hide();}+
? if( $('table.finishPlate').length ) { problems.push('<a href="/WoT:Содержание_статей_о_технике">Приведение в соответствие требованиям проекта</a>'); $('table.finishPlate').hide(); }+
? +
? if (problems != "") {+
? for ( key in problems ) {+
? problemsText += '<li>'+problems[key]+'</li>';+
? }+
? $('#mw-panel').append('<div class="portal" style="background:RGBA(255,0,0,0.1); padding: 7px 0px 24px 0px;"><h5>Статье требуется</h5><div class="body"><ul>'+problemsText+'</ul></div></div>');+
  }  }
? } 
 } }
  
?/* Прячет не заданные характеристики в ТТХ */+addOnloadHook( createCollapseButtons );
?function hideNoDataInfoInTankPerformance() { +
? $('.TankPerformance td span').each(function(key, value) { +
? if ($(value).text().indexOf('не задано')+1) $(value).parent().parent().hide();+
? });+
?}+
  
?/* добавляет структуру для просмотра увеличенных изображений без перехода на другую страницу */ 
?function addImagePopupWindow() { 
? $('body').append('<div id="popupImageWindow"><table><tr><td><div id="popupImageWrapper">'+ 
? '<img id="popupImage" src="" /><div id="popupImageInfo"></div></div>'+ 
? '</td></tr></table></div>'+ 
? '<div id="popupImageButtons"><a id="openImageFile" href="#">Файл</a></div>'); 
?} 
  
?/* добавляет функционал просмотра увеличенных изображений без перехода на другую страницу */+var NavigationBarHide = collapseCaption;
?function addImagePopups() {+var NavigationBarShow = expandCaption;
? if(localStorage.oImagePopupOn==0) return true; // для дебага+
? addImagePopupWindow();+
? +
? $('a.image').click(function(index) {+
? $('#popupImage').attr('src','');+
? var srcStr = $(this).children('img').attr('src'); //Адрес картинки+
? if(srcStr.indexOf('thumb')+1>0) {+
? srcStr = srcStr.replace(/thumb\//gi, ''); +
? srcStr = srcStr.substring(0, srcStr.lastIndexOf("/"));+
? }+
? +
? $('#popupImageWindow table').css('background-image', 'url('+imageLoaderUrl+')');+
? $('#popupImage').width('1px'); $('#popupImage').height('1px');+
? $('#popupImage').attr('src',srcStr);+
? $('#popupImageButtons a#openImageFile').attr('href', $(this).attr('href'));+
? +
? var titleStr = ''; //Подпись+
? if($(this).next('div.thumbcaption').length>0) {titleStr=$(this).next('div.thumbcaption').text().trim();} +
? else if($(this).parent().parent().parent().children('div.gallerytext').length>0){titleStr=$(this).parent().parent().parent().children('div.gallerytext').text().trim();} //слабоумие и отвага+
? +
? if(titleStr.trim().length > 0) {$('#popupImageInfo').text(titleStr.trim());} else {$('#popupImageInfo').text('');}+
? +
? $('#popupImageWrapper').hide(); $('#popupImageWindow').show(); $('#popupImageButtons').show();+
? return false;+
? });+
? +
? // При загрузке картинки+
? $('#popupImage').load(function() {+
? $('#popupImage').width(''); $('#popupImage').height('');+
? $(this).css('max-width', (self.innerWidth-100)+'px'); $(this).css('max-height',(self.innerHeight-100)+'px');+
? $('#popupImageWindow table').css('background-image', '');+
? $('#popupImageWrapper').show();+
? if($('#popupImageInfo').text().trim().length > 0) {$('#popupImageInfo').show();} else {$('#popupImageInfo').hide();}+
? });+
? +
? //Закрыть попап+
? $('#popupImageWindow').click(function(index) { +
? $(this).hide(); $('#popupImageButtons').hide();+
? $('#popupImageButtons a').attr('href', '#'); $('#popupImageInfo').text('');$('#popupImage').attr('src','');+
? });+
? +
?};+
  
  
?/* Дерево модулей */+function toggleNavigationBar(indexNavigationBar)
 +{
 + var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
 + var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
  
?function modulesBlock() {+ if (!NavFrame || !NavToggle) {
? var currentModulesBlock = 1; + return false;
? var modulesBlock = [];+
? modulesBlock[1] = $('#modulesBlock').html();+
? modulesBlock[2] = false;+
? var vehicle = $('#codeValue').text();+
? +
? $('#modulesBlockH2').append('<span id="modulesBlockChange"><div class="switcherCtrlBtn active" id="modulesBlockChange_1"><span>список</span></div><div class="switcherCtrlBtn" id="modulesBlockChange_2"><span>дерево развития</span></div></span>');+
? +
? $('#modulesBlockChange .switcherCtrlBtn').click(function(){+
? if ($(this).hasClass('active')) return false;+
? currentModulesBlock = $(this).attr("id") == 'modulesBlockChange_1' ? 1 : 2;+
? if (modulesBlock[currentModulesBlock] == false ) {+
? modulesBlock[currentModulesBlock] = '<iframe frameborder="0" style="border-width: 0; width: 100%; min-width: 780px; height: 620px;" src="https://armor.kiev.ua/wot/tanks/modulestree.php?vehicle=' + vehicle + '"></iframe>'; +
  }  }
? $('#modulesBlock').html(modulesBlock[currentModulesBlock]); 
? $('#modulesBlockChange .switcherCtrlBtn').removeClass('active'); 
? $(this).addClass('active'); 
? return false; 
? }); 
  
? $('.treeFrame').each(function(indx){ 
? $(this).html('<iframe frameborder="0" style="border-width: 0; width: 100%; min-width: 1010px; height: 750px;" src="' + $(this).html() + '"></iframe>');  
? }); 
? $('.modulesTreeFrame').each(function(indx){ 
? $(this).html('<iframe frameborder="0" style="border-width: 0; width: 100%; min-width: 820px; height: 620px;" src="' + $(this).html() + '"></iframe>');  
? }); 
?} 
? 
?/* Переключатель между разными дивами */ 
?function switcher() { 
? try{if (localStorage.o_debug_switcher == 1) {return 0;}} catch (e) {} // дебаг 
? $('.switcher').each(function () { 
? var sWidth = $(this).find('.sw_data-width').text(); 
? var sHeight = $(this).find('.sw_data-height').text(); 
? var sMenuposition = $(this).find('.sw_data-menuposition').text(); 
?  
? if (sWidth!=""){ 
? $(this).find('.switcherWrap').css('width',sWidth); 
? $(this).find('.subSwitcher').css('width',sWidth); 
? } 
? if (sHeight!=""){ 
? $(this).find('.switcherFrame').css('height',sHeight); 
? $(this).find('.subSwitcher').css('height',sHeight); 
? } 
   
? $(this).find('.subSwitcher:first').show();+ if (NavToggle.firstChild.data == NavigationBarHide) {
? $(this).find('.switcherControlButton:first').addClass('active');+ for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
? + if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
? if (sMenuposition != "") {+ NavChild.style.display = 'none';
? if (sMenuposition=='top') {+ }
? $(this).find('.switcherControl').detach().prependTo($(this).find('.switcherWrap'));+ }
? }+ NavToggle.firstChild.data = NavigationBarShow;
? }+
? +
? if ($(this).find('.subSwitcherBackground a img').length) {+
? $(this).find('.switcherFrame').css('backgroundImage', 'url('+$(this).find('.subSwitcherBackground a img').attr('src')+')');+
? }+
? +
? $(this).removeClass('hidden');+
? })+
? +
? $('.switcherControlButton').click(function (){+
? var buttonCkickId=$(this).find('.sw_data-id').text();+
? $(this).parent().children('.switcherControlButton').removeClass('active'); //hurr+
? $(this).addClass('active');+
? $(this).parent().parent().find('.subSwitcher').each(function() { //durr+
? if(buttonCkickId == $(this).find('.sw_data-id').text()) $(this).show();+
? else $(this).hide();+
? });+
? });+
?}+
  
? 
?function switcher_original() { 
? try{if (localStorage.o_debug_switcher == 1) {return 0;}} catch (e) {} // дебаг 
? $('.switcher').each(function () { 
? if ($(this).data('width')!=undefined && $(this).data('width')!=""){ 
? $(this).find('.switcherWrap').css('width',$(this).data('width')); 
? $(this).find('.subSwitcher').css('width',$(this).data('width')); 
? } 
? if ($(this).data('height')!=undefined && $(this).data('height')!=""){ 
? $(this).find('.switcherFrame').css('height',$(this).data('height')); 
? $(this).find('.subSwitcher').css('height',$(this).data('height')); 
? } 
   
? $(this).find('.subSwitcher:first').show();+ } else if (NavToggle.firstChild.data == NavigationBarShow) {
? $(this).find('.switcherControlButton:first').addClass('active');+ for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
? + if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
? if ($(this).data('menuposition') !== undefined) {+ NavChild.style.display = 'block';
? if ($(this).data('menuposition')=='top') {+ }
? $(this).find('.switcherControl').detach().prependTo($(this).find('.switcherWrap'));+ }
? }+ NavToggle.firstChild.data = NavigationBarHide;
  }  }
?  
? console.log($(this).find('.subSwitcherBackground a img').length); 
? if ($(this).find('.subSwitcherBackground a img').length) { 
? $(this).find('.switcherFrame').css('backgroundImage', 'url('+$(this).find('.subSwitcherBackground a img').attr('src')+')'); 
? } 
?  
? $(this).removeClass('hidden'); 
? }) 
?  
? $('.switcherControlButton').click(function (){ 
? var buttonCkickId=$(this).data('id'); 
? $(this).parent().children('.switcherControlButton').removeClass('active'); //hurr 
? $(this).addClass('active'); 
? $(this).parent().parent().find('.subSwitcher').each(function() { //durr 
? if(buttonCkickId == $(this).data('id')) $(this).show(); 
? else $(this).hide(); 
? }); 
? }); 
 } }
  
?/* Улучшение панели */+function createNavigationBarToggleButton()
?function improvedPanelEditTools() {+{
? try {+ var indexNavigationBar = 0;
? if (localStorage['o_improvedEditPanel'] != 1) return 0;+
? if (!$('#wpTextbox1').length) return 0;+
? var animateSpeed = 150;+
? $('#editform').append('<div id="editPanel"></div>');+
? $('#editPanel').addClass('improved'); $('.templatesUsed ul').addClass('improved');+
  
? $('.mw-editTools').appendTo('#editPanel'); + var divs = document.getElementsByTagName("div");
? if (localStorage['o_improvedEditPanelDownKey'] != 1) { $('.editOptions').appendTo('#editPanel'); }+ for (var i = 0; NavFrame = divs[i]; i++) {
? +
? if (localStorage['o_improvedEditPanelShowRight'] != 1) {+
? $("#editPanel").mouseenter(function(){ $('#editPanel').stop(true,true); $('#editPanel').animate({bottom: '0px'}, animateSpeed); })+
? .mouseleave(function(){ $('#editPanel').stop(true,true); $('#editPanel').animate({bottom: '-'+($('#editPanel').height()-10)+'px'}, animateSpeed); });+
? $('#editPanel').animate({bottom: '-'+($('#editPanel').height()-10)+'px'}, animateSpeed);+
? } else {+
? $("#editPanel").mouseenter(function(){ $('#editPanel').stop(true,true); $('#editPanel').animate({right: '0px'}, animateSpeed); })+
? .mouseleave(function(){ $('#editPanel').stop(true,true); $('#editPanel').animate({right: '-'+($('#editPanel').width()-10)+'px'}, animateSpeed); });+
? $('#editPanel').animate({right: '-'+($('#editPanel').width()-10)+'px'}, animateSpeed);+
? }+
  
? wpTextbox1Resizer();+ if (hasClass(NavFrame, "NavFrame")) {
? $('#wpTextbox1').bind('keydown keypress keyup', wpTextbox1Resizer);+
? } catch (e) {console.error('Ошибка в improvedPanelEditTools');}+
?}+
  
?function wpTextbox1Resizer() {+ indexNavigationBar++;
? if ($('#wpTextbox1')[0].scrollHeight > $('#wpTextbox1')[0].offsetHeight) { $('#wpTextbox1').css('height',($('#wpTextbox1')[0].scrollHeight+200)+'px'); }+ var NavToggle = document.createElement("a");
?}+ NavToggle.className = 'NavToggle';
 + NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
 + NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
  
 + var isCollapsed = hasClass( NavFrame, "collapsed" );
  
?/* Доходность (шаблон) */+ for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
?function profitPanel() {+ if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
? $('.profitMore').toggle(+ if ( NavChild.style.display == 'none' ) {
? function() {$(this).prev().prev().show();$(this).text('↑ Подробнее');},+ isCollapsed = true;
? function() {$(this).prev().prev().hide();$(this).text('↓ Подробнее');}+ }
? );+ }
?}+ }
 + if (isCollapsed) {
 + for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
 + if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
 + NavChild.style.display = 'none';
 + }
 + }
 + }
 + var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
 + NavToggle.appendChild(NavToggleText);
  
? + for(var j=0; j < NavFrame.childNodes.length; j++) {
?/* Прозвища ajax */+ if (hasClass(NavFrame.childNodes[j], "NavHead")) {
?function getAlias() {+ NavFrame.childNodes[j].appendChild(NavToggle);
? try {+ }
? if ( $('div.TankPerformance').length ) {+ }
? var codeValue = $('#codeValue').text();+ NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
? var nationValue = $('#nationValue').text();+ }
? $('div.TankPerformance table tbody').eq(1).prepend(''++ }
? '<tr><th class="center group alias aliasHeader" colspan="2">Прозвища в игре <div class="editLink">[<a href="/WoT:Прозвища">править</a>]</div></th></tr>'++
? '<tr><td class="alias aliasContent" colspan="2"></td></tr>'++
? '');+
? $('div.TankPerformance table tbody').eq(4).prepend(''++
? '<tr><th class="center group alias aliasHeader" colspan="2">Прозвища в игре <div class="editLink">[<a href="/WoT:Прозвища">править</a>]</div></th></tr>'++
? '<tr><td class="alias aliasContent" colspan="2"></td></tr>'++
? '');+
? $.get('/WoT:Прозвища/'+nationValue)+
? .done(function(data) { +
? var obj = $.parseJSON(jQuery(data).find("div.mw-content-ltr p").text());+
? if (obj[codeValue] !== undefined) { $('.aliasContent').text(obj[codeValue]); }+
? })+
? .always(function() { if ($('.aliasContent').text() != '') {$('.alias').fadeIn();} });+
? }+
? } catch (e) {+
? console.log("Что-то пошло не так. Пичалька, прозвища ниработают");+
? }+
 } }
  
 +addOnloadHook( createNavigationBarToggleButton );
  
?/* Установка дефолтных настроек */ 
?function setDefaultjsOptions() { 
? try{ 
? lsElement = new Array( 
? {param:'o_showJsOptionsPanel', value:1},  
? {param:'o_additionalEditPanelButtons', value:1},  
? {param:'o_improvedEditPanel', value:0}, {param:'o_improvedEditPanelDownKey', value:0}, {param:'o_improvedEditPanelShowRight', value:0},  
? {param:'o_spellCheck', value:0}, {param:'o_spellCheckIgnoreUppercase', value:0} 
? ); 
? for (key in lsElement) {if (localStorage[lsElement[key].param]===undefined) {localStorage[lsElement[key].param] = lsElement[key].value;}} 
? } catch (e) { console.error('Нет поддержки localStorage? Пришло время обновить браузер.'); } 
?} 
  
 +var hasClass = (function() {
 + var reCache = {};
 + return function( element, className ) {
 + return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
 + };
 +})();
 +/* END n1sK's js, feel free to edit below.*/
  
?/* Панелька настроек */+/* BEGIN SNIB's MAGIC */
?function jsOptionsPanel() {+function toggleSidebar() {
? try {+ try {
? if (localStorage['o_showJsOptionsPanel'] != 1) return 0;+ if(document.getElementById('switcherTop').style.display == 'none')
? if(!(wgTitle==wgUserName && wgCanonicalNamespace=='User')) return 0;+ {
? $('#bodyContent').append('<fieldset id="js_options" style="font-size: 10px;">'++ var stock = document.getElementsByClassName('stock');
? '<legend>Дополнительные настройки скриптов</legend>'++ for (i=0;i<stock.length;i++) stock[i].style.display = 'none';
? '<input type="checkbox" id="o_improvedEditPanel" name="o_improvedEditPanel" /><label for="o_improvedEditPanel"> Улучшеная панель редактирования</label><br>'++ var top = document.getElementsByClassName('top');
? '&nbsp; <input type="checkbox" id="o_improvedEditPanelDownKey" name="o_improvedEditPanelDownKey" /><label for="o_improvedEditPanelDownKey"> Кнопки управления внизу</label><br>'++ for (i=0;i<top.length;i++) top[i].style.display = 'inline';
? '&nbsp; <input type="checkbox" id="o_improvedEditPanelShowRight" name="o_improvedEditPanelShowRight" /><label for="o_improvedEditPanelShowRight"> Отображать панель справа</label><br>'++ document.getElementById('switcherStock').style.display = 'none';
? '<input type="checkbox" id="o_additionalEditPanelButtons" name="o_additionalEditPanelButtons" /><label for="o_additionalEditPanelButtons"> Дополнительные кнопки редактирования</label><br>'++ document.getElementById('switcherTop').style.display = '';
? '</fieldset>');+ }
? + else
? $('#js_options input[type="checkbox"]').each(function (index) { if (localStorage[$(this).attr('name')]==1) { $(this).attr('checked','checked');} })+ {
? + var stock = document.getElementsByClassName('stock');
? $('#js_options input[type="checkbox"]').bind('change', function() {+ for (i=0;i<stock.length;i++) stock[i].style.display = '';
? if ($(this).is(':checked')) { localStorage[$(this).attr('name')] = 1; }+ var top = document.getElementsByClassName('top');
? else { localStorage[$(this).attr('name')] = 0; }+ for (i=0;i<top.length;i++) top[i].style.display = 'none';
? });+ document.getElementById('switcherStock').style.display = '';
? } catch (e) {console.error('Ошибка в jsOptionsPanel');}+ document.getElementById('switcherTop').style.display = 'none';
 + }
 + }catch(err){}
 } }
  
?/* Вводная инструкция по редактированию */+$(function() {
?function KMVAlert() {+ try{
? try {+ $('#switcher').attr('onclick', 'toggleSidebar();');
? if(!$('#editform').length) {return 0;}+ }catch(err){}
? var oToday = new Date();+});
? if (localStorage['o_lastShownKMVAlertDate']==undefined) {localStorage['o_lastShownKMVAlertDate'] = 0;}+
? var lastShownKMVAlertDate = new Date(); lastShownKMVAlertDate.setTime(localStorage['o_lastShownKMVAlertDate']);+
? var nDaysLeft = lastShownKMVAlertDate < oToday ? Math.ceil((oToday-lastShownKMVAlertDate) / (1000 * 60 * 60 * 24)) : 0;+
? if (nDaysLeft>30) {+
? $('body').append('<div id="alertMessage" style="position:fixed; top:0px; left:0px; right:0px; bottom:0px; z-index:9050; background:RGBA(0,0,0,0.4); padding: 50px; overflow:auto;">'++
? '<div class="content" style="padding: 17px; background: white; min-height:300px; font-size: 80%;">'++
? 'Загрузка'++
? '</div><div style="text-align:center;padding: 0px 0px 100px;"><a class="closeBtn" style="padding:12px; background:#FF3333; color:#000000;" onclick="var oToday = new Date(); localStorage[\'o_lastShownKMVAlertDate\'] = oToday.getTime(); $(\'#alertMessage\').hide(); return false;" href="#">Я всё понял</a></div>'++
? '</div>');+
? $('#alertMessage .content').load('/WoT:Краткая_вводная div.mw-content-ltr', function() {});+
? +
? } else {+
? localStorage['o_lastShownKMVAlertDate'] = oToday.getTime();+
? }+
? } catch (e) {+
? console.log("КМВ: Что-то пошло не так");+
? }+
?}+
  
 +$(function() {
 + var first;
 + first = $("#history").html();
 + if(first){
 + first = first.split(/\n/);
 + if(first.length == 0) {
 + first = null;
 + return;
 + }
 + for (var i = 0 ; i < first.length ; i++) {
 + if(first[i].substring(0,4) != '<div'){
 + first = first[i];
 + break;
 + }
 + }
 + if(first == null || first == '') return;
  
 + $("#history").hide();
  
?/* Конфиг */+ $("#readMore").before('<div id="first">'+first+'</div>').show();
?var imageLoaderUrl = '/uploads/4/42/Loading.gif';+ first = null;
?var isRotate = false;+
  
?function addRotatorPopupWindow() {+ $('#readMore').click(function(){
? $('body').append('<div id="popupRotatorWindow"><table><tr><td><div id="popupRotatorWrapper">'++ $("#first").remove();
? '<div id="rotatorTarget"></div><img src="/uploads/b/bd/Close.png" class="closeBtn"></div>'++ $("#readMore").remove();
? '</td></tr></table></div>'+ $("#history").show('slow');
? );+
?}+
? +
?/* ready */+
?$(document).ready( function(){+
? modulesBlock();+
? setDefaultjsOptions();+
? switcher();+
?// setTimeout(addImagePopups,0);+
?// setTimeout(hideNoDataInfoInTankPerformance,0);+
?// setTimeout(getAlias,0);+
? +
? /* setTimeout(function (){$('.rotator').simpleRotator({width: '100%', textLoad: '<img src="https://wiki.worldoftanks.ru/uploads/2/2d/RotateIcon.png" />'});}); */+
? +
? //----+
? setTimeout(function (){+
? $('.myRotator').click(function(){+
? if (isRotate) {return 0;}+
? addRotatorPopupWindow();+
? $('#rotatorTarget').html($(this).children('.rotator').html());+
? $('#rotatorTarget').simpleRotator({width: '1024px', textLoading: '<img src="' + imageLoaderUrl + '" />'});+
? $('#rotatorTarget').children(".loader").click();+
? $('#popupRotatorWindow').find('.closeBtn').click(function(){ +
? $('#popupRotatorWindow').remove(); +
? isRotate = false;+
  });  });
? $('#popupRotatorWindow').show();+ }
? isRotate = true; +});
? });+
? });+
  
? //----+var mwpanel = document.getElementById('mw-panel');
? setTimeout(function (){$('.hangarRotator').simpleRotator({width: '1060px', textLoading: '<img src="' + imageLoaderUrl + '" />'}); $('.hangarRotator').children(".loader").click(); });+if(mwpanel) {
 + var appendContent = document.getElementById('appendContent');
 + if(appendContent) {
 + mwpanel.appendChild(appendContent);
 + }
 +}
  
? //----+/* END SNIB's MAGIC */
?// setTimeout(addAdditionalEdittools,0);+
?// setTimeout(checkContent,0);+
?// setTimeout(jsOptionsPanel,0);+
?// setTimeout(improvedPanelEditTools,0);+
?// setTimeout(profitPanel,0);+
?// setTimeout(KMVAlert,0);+
? +
? //----+
? setTimeout(function (){+
? $('.provRef').click(function(){+
? var ref = '#' + $(this).data('ref');+
? var origin = $(this).parents('tr:first').attr('id');+
? $('.provSelect').removeClass('provSelect');+
? $('.provOrigin').removeClass('provOrigin');+
? $(ref).addClass('provSelect').find('[data-ref=' + origin + ']').addClass('provOrigin'); +
? location.href = ref;+
? });+
? });+
? +
? //----+
? setTimeout(function (){+
? $('#editform').submit(function(){+
? var result = $('#wpTextbox1').val().indexOf('war' + 'blogs.ru') == -1;+
? var mb = $('#mw-js-message');+
? if (!result) {+
? mb.html('Возникла неизвестная ошибка при сохранении');+
? mb.show();+
? }+
? return result; +
? });+
? });+
? +
? +
?});+

Revision as of 20:30, 6 June 2014

/* Any JavaScript here will be loaded for all users on every page load. */

/* ----- BEGIN Jiri_Starrider's JS, please do not touch. Ask me first before editing.-----*/

function showModulesTree() {
  $('.js-modules-tree').each(function(){
    var $this = $(this), contentWidth, contentHeight, iframe, contentPadding;
    $this.html('<div class="b-modulestree"><iframe frameborder="0" style="border-width: 0; width: 1000px; min-width: 100%; height: 695px;" src="https://armor.kiev.ua/wot/tanks/modulestree.php?vehicle=' + $.trim($(this).text()) + '"></iframe></div>');
    iframe = $this.find('iframe');
    contentWidth = iframe.width();
    contentHeight = iframe.height();
    contentPadding = parseInt(iframe.parent().css('padding-bottom'));
    $this.height(contentHeight + contentPadding);
 
    $this.data('jsp','').jScrollPane({showArrows:false, contentWidth: contentWidth, contentHeight: contentHeight});
    $(window).resize(function(){
        $this.data('jsp').reinitialise();
    });
  });
}
addOnloadHook(showModulesTree);

/* ----- END Jiri_Starrider's JS edits, feel free to edit below.-----*/

/* BEGIN n1sK's js, please leave it alone, if you really must edit it ask me first.*/
/* Collapsible tables js*/

var autoCollapse = 2;
var collapseCaption = "hide";
var expandCaption = "show";

function collapseTable( tableIndex )
{
    var Button = document.getElementById( "collapseButton" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );

    if ( !Table || !Button ) {
        return false;
    }

    var Rows = Table.rows;

    if ( Button.firstChild.data == collapseCaption ) {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}

function createCollapseButtons()
{
    var tableIndex = 0;
    var NavigationBoxes = new Object();
    var Tables = document.getElementsByTagName( "table" );

    for ( var i = 0; i < Tables.length; i++ ) {
        if ( hasClass( Tables[i], "collapsible" ) ) {

            var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
            if (!HeaderRow) continue;
            var Header = HeaderRow.getElementsByTagName( "th" )[0];
            if (!Header) continue;

            NavigationBoxes[ tableIndex ] = Tables[i];
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );

            var Button     = document.createElement( "span" );
            var ButtonLink = document.createElement( "a" );
            var ButtonText = document.createTextNode( collapseCaption );

            Button.className = "collapseButton";  //Styles are declared in Common.css

            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
            ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
            ButtonLink.appendChild( ButtonText );

            Button.appendChild( document.createTextNode( "[" ) );
            Button.appendChild( ButtonLink );
            Button.appendChild( document.createTextNode( "]" ) );

            Header.insertBefore( Button, Header.childNodes[0] );
            tableIndex++;
        }
    }

    for ( var i = 0;  i < tableIndex; i++ ) {
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
            collapseTable( i );
        }
        else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
            var element = NavigationBoxes[i];
            while (element = element.parentNode) {
                if ( hasClass( element, "outercollapse" ) ) {
                    collapseTable ( i );
                    break;
                }
            }
        }
    }
}

addOnloadHook( createCollapseButtons );


var NavigationBarHide = collapseCaption;
var NavigationBarShow = expandCaption;


function toggleNavigationBar(indexNavigationBar)
{
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);

    if (!NavFrame || !NavToggle) {
        return false;
    }

    
    if (NavToggle.firstChild.data == NavigationBarHide) {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
            if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
                NavChild.style.display = 'none';
            }
        }
    NavToggle.firstChild.data = NavigationBarShow;

    
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
            if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
                NavChild.style.display = 'block';
            }
        }
        NavToggle.firstChild.data = NavigationBarHide;
    }
}

function createNavigationBarToggleButton()
{
    var indexNavigationBar = 0;

    var divs = document.getElementsByTagName("div");
    for (var i = 0; NavFrame = divs[i]; i++) {

        if (hasClass(NavFrame, "NavFrame")) {

            indexNavigationBar++;
            var NavToggle = document.createElement("a");
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');

            var isCollapsed = hasClass( NavFrame, "collapsed" );

            for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
                if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
                    if ( NavChild.style.display == 'none' ) {
                        isCollapsed = true;
                    }
                }
            }
            if (isCollapsed) {
                for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
                    if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
            NavToggle.appendChild(NavToggleText);

            for(var j=0; j < NavFrame.childNodes.length; j++) {
                if (hasClass(NavFrame.childNodes[j], "NavHead")) {
                    NavFrame.childNodes[j].appendChild(NavToggle);
                }
            }
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
        }
    }
}

addOnloadHook( createNavigationBarToggleButton );


var hasClass = (function() {
	var reCache = {};
	return function( element, className ) {
		return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
	};
})();
/* END n1sK's js, feel free to edit below.*/

/* BEGIN SNIB's MAGIC */
function toggleSidebar() {
	try {
		if(document.getElementById('switcherTop').style.display == 'none')
		{
			var stock = document.getElementsByClassName('stock');
			for (i=0;i<stock.length;i++) stock[i].style.display = 'none';
			var top = document.getElementsByClassName('top');
			for (i=0;i<top.length;i++) top[i].style.display = 'inline';
			document.getElementById('switcherStock').style.display = 'none';
			document.getElementById('switcherTop').style.display = '';
		}
		else
		{
			var stock = document.getElementsByClassName('stock');
			for (i=0;i<stock.length;i++) stock[i].style.display = '';
			var top = document.getElementsByClassName('top');
			for (i=0;i<top.length;i++) top[i].style.display = 'none';
			document.getElementById('switcherStock').style.display = '';
			document.getElementById('switcherTop').style.display = 'none';
		}
	}catch(err){}
}

$(function() {
	try{
		$('#switcher').attr('onclick', 'toggleSidebar();');
	}catch(err){}
});

$(function() {
	var first;
	first = $("#history").html();
	if(first){
		first = first.split(/\n/);
		if(first.length == 0) {
			first = null;
			return;
		}
		for (var i = 0 ; i < first.length ; i++) {
			if(first[i].substring(0,4) != '<div'){
				first = first[i];
				break;
			}
		}
		if(first == null || first == '') return;

		$("#history").hide();

		$("#readMore").before('<div id="first">'+first+'</div>').show();
		first = null;

		$('#readMore').click(function(){  
			$("#first").remove();
			$("#readMore").remove();
			$("#history").show('slow');
		});
	}
});

var mwpanel = document.getElementById('mw-panel');
if(mwpanel) {
	var appendContent = document.getElementById('appendContent');
	if(appendContent) {
		mwpanel.appendChild(appendContent);
	}
}

/* END SNIB's MAGIC */