pereka4mod

Add progress bar for sum of faction exp. and balance coef.

当前为 2016-11-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2.  
  3. // @name pereka4mod
  4.  
  5. // @author dw4rf & Casperovskii
  6.  
  7. // @namespace Pereka4
  8.  
  9. // @version 2.7 (2016.10.16)
  10.  
  11. // @description Add progress bar for sum of faction exp. and balance coef.
  12.  
  13. // @include http://*heroeswm.*/home.php*
  14. // @include http://178.248.235.15/home.php*
  15. // @include http://*герои.рф/home.php*
  16. // @include http://*lordswm.*/home.php*
  17. // @include http://*heroeswm.*/pl_info.php*
  18. // @include http://178.248.235.15/pl_info.php*
  19. // @include http://*герои.рф/pl_info.php*
  20. // @include http://*lordswm.*/pl_info.php*
  21.  
  22. // ==/UserScript==
  23.  
  24.  
  25.  
  26. // Основная функция, выполняемая при загрузке страницы целиком
  27.  
  28. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  29. this.GM_getValue=function (key,def) {
  30. return localStorage[key] || def;
  31. };
  32. this.GM_setValue=function (key,value) {
  33. return localStorage[key]=value;
  34. };
  35. this.GM_deleteValue=function (key) {
  36. return delete localStorage[key];
  37. };
  38. this.GM_addStyle = function(css) {
  39. var style = document.createElement('style');
  40. style.textContent = css;
  41. document.getElementsByTagName('head')[0].appendChild(style);
  42. };
  43. this.GM_registerMenuCommand = function(name, funk) {
  44. //todo
  45. };
  46. }
  47.  
  48. function browser()
  49. {
  50. var ua = navigator.userAgent;
  51. if (ua.search(/MSIE/) > 0) return 'Internet Explorer';
  52. if (ua.search(/Firefox/) > 0) return 'Firefox';
  53. if (ua.search(/Opera/) > 0) return 'Opera';
  54. if (ua.search(/Chrome/) > 0) return 'Google Chrome';
  55. if (ua.search(/Safari/) > 0) return 'Safari';
  56. if (ua.search(/Konqueror/) > 0) return 'Konqueror';
  57. if (ua.search(/Iceweasel/) > 0) return 'Debian Iceweasel';
  58. if (ua.search(/SeaMonkey/) > 0) return 'SeaMonkey';
  59. // Браузеров очень много, все вписывать смысле нет, Gecko почти везде встречается
  60. if (ua.search(/Gecko/) > 0) return 'Gecko';
  61.  
  62. // а может это вообще поисковый робот
  63. return 'Search Bot';
  64. }
  65.  
  66. function main(e){
  67. var browserVersion = browser();
  68.  
  69. var version = "2.7";
  70. var srednya_umka = 0;
  71. var umk_min = 0;
  72. var umk_max = 0;
  73.  
  74. var sum_umk = 0;
  75.  
  76. var lang_en = new Array();
  77.  
  78. var lang_uk = lang_en;
  79.  
  80. var lang_us = lang_en;
  81.  
  82. var lang_com = lang_en;
  83.  
  84. lang_en['Knight'] = 'Knight';
  85.  
  86. lang_en['Necromancer'] = 'Necromancer';
  87.  
  88. lang_en['Wizard'] = 'Wizard';
  89.  
  90. lang_en['Elf'] = 'Elf';
  91.  
  92. lang_en['Barbarian'] = 'Barbarian';
  93.  
  94. lang_en['Dark elf'] = 'Dark elf';
  95.  
  96. lang_en['Demon'] = 'Demon';
  97.  
  98. lang_en['Dwarf'] = 'Dwarf';
  99.  
  100. lang_en['Steepe barbarian'] = 'Steepe barbarian';
  101.  
  102. lang_en['Combat level'] = 'Combat level';
  103.  
  104.  
  105.  
  106.  
  107. var lang_ru = new Array();
  108.  
  109. lang_ru['Knight'] = '\u0420\u044B\u0446\u0430\u0440\u044C';
  110.  
  111. lang_ru['Necromancer'] = '\u041D\u0435\u043A\u0440\u043E\u043C\u0430\u043D\u0442';
  112.  
  113. lang_ru['Wizard'] = '\u041C\u0430\u0433';
  114.  
  115. lang_ru['Elf'] = '\u042D\u043B\u044C\u0444';
  116.  
  117. lang_ru['Barbarian'] = '\u0412\u0430\u0440\u0432\u0430\u0440';
  118.  
  119. lang_ru['Dark elf'] = '\u0422\u0435\u043C\u043D\u044B\u0439 \u044D\u043B\u044C\u0444';
  120.  
  121. lang_ru['Demon'] = '\u0414\u0435\u043C\u043E\u043D';
  122.  
  123. lang_ru['Dwarf'] = '\u0413\u043D\u043E\u043C';
  124.  
  125. lang_ru['Steepe barbarian'] = '\u0421\u0442\u0435\u043f\u043d\u043e\u0439 \u0432\u0430\u0440\u0432\u0430\u0440';
  126.  
  127. lang_ru['Combat level'] = '\u0411\u043E\u0435\u0432\u043E\u0439 \u0443\u0440\u043E\u0432\u0435\u043D\u044C';
  128.  
  129.  
  130. var language=lang_en;
  131.  
  132.  
  133.  
  134.  
  135.  
  136. // Определение языка
  137.  
  138. var lingua;
  139.  
  140. if (location.hostname.match('lordswm')) {lingua='en';} else {lingua = 'ru';}
  141.  
  142. try{
  143.  
  144. eval('language = lang_' + lingua);
  145.  
  146. }catch(e){
  147.  
  148. }
  149.  
  150.  
  151.  
  152. //Фракции
  153.  
  154. var factions = [
  155. T('Knight'),T('Necromancer'),T('Wizard'),T('Elf'),T('Barbarian'),T('Dark elf'),T('Demon'),T('Dwarf'),T('Steepe barbarian')
  156. ];
  157.  
  158.  
  159. //Боевой уровень (21 уровень)
  160.  
  161. var combat_exp_lvl = [
  162.  
  163. 0,1500,4500,15000,32000,90000,190000,400000,860000,1650000,
  164. 3000000,5000000,8500000,14500000,25000000,43000000,70000000,
  165. 108000000,160000000,230000000,325000000
  166.  
  167. ];
  168.  
  169.  
  170.  
  171. //Умение фракции (12 уровней)
  172.  
  173. var racial_skill_lvl = [
  174.  
  175. 20,50,90,160,280,
  176.  
  177. 500,900,1600,2900,5300,9600,17300
  178.  
  179. ];
  180. //Средние умения фракций на 5-21 уровне
  181. var sred_umk = [
  182. 63.5,109,223,320,520,860,1360,2000,2880,3960,5520,
  183.  
  184. 8100,12120,18540,26720,37240,37497,54278,68909
  185. ];
  186.  
  187.  
  188. var XPFirst = XPathResult.FIRST_ORDERED_NODE_TYPE; // Постоянные для первого элемента XPath
  189.  
  190. var XPList = XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE; // Постоянные элементы списка XPath
  191.  
  192.  
  193.  
  194. /**
  195.  
  196. * Поиск по документу с помощью XPath
  197.  
  198. *
  199.  
  200. * Ввод:
  201.  
  202. * xpath Выражение для поиска
  203.  
  204. * xpres Тип поиска
  205.  
  206. *
  207.  
  208. * Вывод:
  209.  
  210. * Ссылка на найденный объект
  211.  
  212. */
  213.  
  214. function find(xpath, xpres,startnode){
  215.  
  216. if (!startnode) {startnode=document;}
  217.  
  218. var ret = document.evaluate(xpath, startnode, null, xpres, null);
  219.  
  220. return xpres == XPFirst ? ret.singleNodeValue : ret;
  221.  
  222. }
  223.  
  224.  
  225.  
  226. /**
  227.  
  228. * Добавляет узел после 1 условия
  229.  
  230. *
  231.  
  232. * Ввод:
  233.  
  234. * refChild узел ссылки
  235.  
  236. * newChild узлы, которые будут добавлены
  237.  
  238. */
  239.  
  240. function insertAfter(newChild, refChild) {
  241.  
  242. node.parentNode.insertBefore(newChild, refChild.nextSibling);
  243.  
  244. }
  245.  
  246.  
  247.  
  248. /**
  249.  
  250. * Создание элемента
  251.  
  252. *
  253.  
  254. * Ввод:
  255.  
  256. * tag Название нового элемента
  257.  
  258. * content Содержание нового элемента в текстовом формате
  259.  
  260. *
  261.  
  262. * Вывод:
  263.  
  264. * Ссылка на созданный элемент
  265.  
  266. */
  267.  
  268.  
  269. function elem(tag, content){
  270.  
  271. var ret = document.createElement(tag);
  272.  
  273. ret.innerHTML = content;
  274.  
  275. return ret;
  276.  
  277. }
  278.  
  279.  
  280.  
  281. /**
  282.  
  283. * Перевод текста на определенный язык
  284.  
  285. *
  286.  
  287. * Ввод:
  288.  
  289. * Текст для перевода
  290.  
  291. *
  292.  
  293. * Вывод:
  294.  
  295. * Перевод
  296.  
  297. */
  298.  
  299.  
  300. function T(testo){
  301.  
  302. // Язык по умолчанию, если слово не существует: английский
  303.  
  304. if (language[testo] == undefined) return lang_en[testo]; else return language[testo];
  305.  
  306. }
  307.  
  308. /**
  309.  
  310. * Создание прогресс бара
  311.  
  312. *
  313.  
  314. * Ввод:
  315.  
  316. * Текущий опыт
  317.  
  318. * Текущее умение фракции
  319.  
  320. * Уровень
  321.  
  322. *
  323.  
  324. * Вывод:
  325.  
  326. * HTML для создания прогресс бара
  327.  
  328. */
  329.  
  330. function makeProgressBar(exp_attuale, min_umka, max_umka){
  331.  
  332.  
  333. exp_attuale = exp_attuale - min_umka;
  334.  
  335. max_umka = max_umka - min_umka;
  336.  
  337. var perc = exp_attuale * 100 / max_umka;
  338.  
  339.  
  340. // Stile
  341.  
  342. /*
  343. var cssStyle = "";
  344.  
  345. return progress_bar_html;
  346.  
  347. */
  348.  
  349. var cssStyle = "";
  350.  
  351. if (perc<100 && perc>0) {
  352. cssStyle += ".bar_wrap {width:150px; margin:3px 0 3px 9px;border: 1px solid #1C1C1C;background-color: #8C7526;box-shadow: 0 0 1px #666, inset 0 1px 1px #222;-webkit-box-shadow: 0 0 1px #666, inset 0 1px 1px #222;background-image: -moz-linear-gradient(#65541B, #8C7526 50%, #65541B);background-image: -webkit-linear-gradient(#65541B, #8C7526 50%, #65541B);}.bar {height: 5px;background-color: #f9e37e;border-right: 1px solid #282828;box-shadow: inset 0 0 1px #ddd;-webkit-box-shadow: inset 0 0 1px #ddd;background-image: -moz-linear-gradient(#e7ae6b, #be8d55 50%, #a57b4b 51%, #ae804c);background-image: -webkit-linear-gradient(#e7ae6b, #be8d55 50%, #a57b4b 51%, #ae804c);-moz-transition: all 1s ease;-webkit-transition: all 1s ease;}@-moz-keyframes slidein {from {width: 100%}}@-webkit-keyframes slidein {from {width: 100%}}.bar:hover {-moz-animation: animate-stripes 3s linear infinite;-webkit-animation: animate-stripes 3s linear infinite;}@-moz-keyframes animate-stripes {0% {background-position: 0 0;} 100% {background-position:0 22px;}}@-webkit-keyframes animate-stripes {0% {background-position: 0 0;} 100% {background-position:0 22px;}}.htooltip, .htooltip:visited, .tooltip:active {color: #0077AA;text-decoration: none;}.htooltip:hover {color: #0099CC;}.htooltip span {background-color: rgba(0,0,0, 0.8);border-radius: 5px 5px 0px 0px;-webkit-border-radius: 5px 5px 0px 0px;box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);-webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);color: #fff;margin-left: -1px;margin-top: -24px;opacity: 0;padding: 2px 5px;position: absolute;text-decoration: none;visibility: hidden;z-index: 10;-ms-transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;}.htooltip:hover span {position: absolute;opacity: 1;visibility: visible;}";
  353. GM_addStyle(cssStyle);
  354. var progress_bar_html = "<div class=\"bar_wrap htooltip\">"+
  355. "<div class=\"bar\" style=\"max-width:150px;width:"+ perc +"%\"></div>"+
  356. "<span>\u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441: "+ Math.round(perc*100)/100 +"%</span>"+
  357. "</div>"+"<div style='font-size: 8px; font-weight: bold; margin: -11px 0 0 165px'>"+Math.round(perc)/1+"% </div>" +
  358. "<div>&nbsp;&nbsp;\u0412 \u043D\u043E\u0440\u043C\u0435!</div>";
  359. }
  360. if (perc>100){
  361. perc = 100;
  362. cssStyle += ".bar_wrap {width:150px; margin:3px 0 3px 9px;border: 1px solid #1C1C1C;background-color: #8C7526;box-shadow: 0 0 1px #666, inset 0 1px 1px #222;-webkit-box-shadow: 0 0 1px #666, inset 0 1px 1px #222;background-image: -moz-linear-gradient(#65541B, #8C7526 50%, #65541B);background-image: -webkit-linear-gradient(#65541B, #8C7526 50%, #65541B);}.bar {height: 5px;background-color: #f9e37e;border-right: 1px solid #282828;box-shadow: inset 0 0 1px #ddd;-webkit-box-shadow: inset 0 0 1px #ddd;background-image: -moz-linear-gradient(#e7ae6b, #be8d55 50%, #a57b4b 51%, #ae804c);background-image: -webkit-linear-gradient(#e7ae6b, #be8d55 50%, #a57b4b 51%, #ae804c);-moz-transition: all 1s ease;-webkit-transition: all 1s ease;}@-moz-keyframes slidein {from {width: 100%}}@-webkit-keyframes slidein {from {width: 100%}}.bar:hover {-moz-animation: animate-stripes 3s linear infinite;-webkit-animation: animate-stripes 3s linear infinite;}@-moz-keyframes animate-stripes {0% {background-position: 0 0;} 100% {background-position:0 22px;}}@-webkit-keyframes animate-stripes {0% {background-position: 0 0;} 100% {background-position:0 22px;}}.htooltip, .htooltip:visited, .tooltip:active {color: #0077AA;text-decoration: none;}.htooltip:hover {color: #0099CC;}.htooltip span {background-color: rgba(0,0,0, 0.8);border-radius: 5px 5px 0px 0px;-webkit-border-radius: 5px 5px 0px 0px;box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);-webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);color: #fff;margin-left: -1px;margin-top: -24px;opacity: 0;padding: 2px 5px;position: absolute;text-decoration: none;visibility: hidden;z-index: 10;-ms-transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;}.htooltip:hover span {position: absolute;opacity: 1;visibility: visible;}";
  363. GM_addStyle(cssStyle);
  364. var progress_bar_html = "<div class=\"bar_wrap htooltip\">"+
  365. "<div class=\"bar\" style=\"max-width:150px;width:"+ perc +"%\"></div>"+
  366. "<span>\u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441: "+ perc +"%</span>"+
  367. "</div>"+"<div style='font-size: 8px; font-weight: bold; margin: -11px 0 0 165px'>"+perc+"% </div>"+
  368. "</div><br>&nbsp;&nbsp;\u041F\u0435\u0440\u0435\u043A\u0430\u0447!<br>&nbsp;&nbsp;\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u043E\u043F\u044B\u0442\u0430: +"+(((sum_umk/srednya_umka/1.6)-1)*100).toFixed(2)+"%<br>";
  369. }
  370. if (perc<0) {
  371. perc = 0;
  372. cssStyle += ".bar_wrap {width:150px; margin:3px 0 3px 9px;border: 1px solid #1C1C1C;background-color: #8C7526;box-shadow: 0 0 1px #666, inset 0 1px 1px #222;-webkit-box-shadow: 0 0 1px #666, inset 0 1px 1px #222;background-image: -moz-linear-gradient(#65541B, #8C7526 50%, #65541B);background-image: -webkit-linear-gradient(#65541B, #8C7526 50%, #65541B);}.bar {height: 5px;background-color: #f9e37e;border-right: 1px solid #282828;box-shadow: inset 0 0 1px #ddd;-webkit-box-shadow: inset 0 0 1px #ddd;background-image: -moz-linear-gradient(#e7ae6b, #be8d55 50%, #a57b4b 51%, #ae804c);background-image: -webkit-linear-gradient(#e7ae6b, #be8d55 50%, #a57b4b 51%, #ae804c);-moz-transition: all 1s ease;-webkit-transition: all 1s ease;}@-moz-keyframes slidein {from {width: 100%}}@-webkit-keyframes slidein {from {width: 100%}}.bar:hover {-moz-animation: animate-stripes 3s linear infinite;-webkit-animation: animate-stripes 3s linear infinite;}@-moz-keyframes animate-stripes {0% {background-position: 0 0;} 100% {background-position:0 22px;}}@-webkit-keyframes animate-stripes {0% {background-position: 0 0;} 100% {background-position:0 22px;}}.htooltip, .htooltip:visited, .tooltip:active {color: #0077AA;text-decoration: none;}.htooltip:hover {color: #0099CC;}.htooltip span {background-color: rgba(0,0,0, 0.8);border-radius: 5px 5px 0px 0px;-webkit-border-radius: 5px 5px 0px 0px;box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);-webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);color: #fff;margin-left: -1px;margin-top: -24px;opacity: 0;padding: 2px 5px;position: absolute;text-decoration: none;visibility: hidden;z-index: 10;-ms-transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;}.htooltip:hover span {position: absolute;opacity: 1;visibility: visible;}";
  373. GM_addStyle(cssStyle);
  374. var progress_bar_html = "<div class=\"bar_wrap htooltip\">"+
  375. "<div class=\"bar\" style=\"max-width:150px;width:"+ perc +"%\"></div>"+
  376. "<span>\u041F\u0440\u043E\u0433\u0440\u0435\u0441\u0441: "+ perc +"%</span>"+
  377. "</div>"+"<div style='font-size: 8px; font-weight: bold; margin: -11px 0 0 165px'>"+perc+"% </div>"+
  378. "</div><br>&nbsp;&nbsp;\u041D\u0435\u0434\u043E\u043A\u0430\u0447!<br>&nbsp;&nbsp;\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u043C\u0435\u043D\u0438\u0439: +"+Math.round(((srednya_umka/sum_umk)-1)*1000)/10+"%<br><br>";
  379. }
  380. return progress_bar_html;
  381.  
  382. }
  383.  
  384.  
  385.  
  386. function showExpBar(){
  387.  
  388. var tabelle = find("//table", XPList);
  389.  
  390. var player_info = "";
  391.  
  392. var skill_info = "";
  393.  
  394. var player_faction = "";
  395.  
  396.  
  397.  
  398. if (location.href.indexOf('home.php') != -1) {
  399.  
  400. //Поиск страницы
  401.  
  402. for (var i = 25; i < tabelle.snapshotLength; i++){
  403.  
  404. if (!tabelle.snapshotItem(i)) continue;
  405.  
  406. if (!tabelle.snapshotItem(i).childNodes[0]) continue;
  407.  
  408. if (!tabelle.snapshotItem(i).childNodes[0].childNodes[0]) continue;
  409.  
  410.  
  411. //Player level
  412.  
  413. if (tabelle.snapshotItem(i).childNodes[0].childNodes[0].childNodes[0]) {
  414.  
  415. if (tabelle.snapshotItem(i).childNodes[0].childNodes[0].childNodes[0].innerHTML.indexOf(T('Combat level') +":") > 0) {
  416.  
  417. player_info = tabelle.snapshotItem(i).childNodes[0].childNodes[0].childNodes[0];
  418.  
  419. }
  420.  
  421. }
  422.  
  423.  
  424.  
  425. //Skill Info
  426.  
  427. if (tabelle.snapshotItem(i).childNodes[0].childNodes[0].childNodes[1]) {
  428.  
  429. if (tabelle.snapshotItem(i).childNodes[0].childNodes[0].childNodes[1].innerHTML.indexOf(T('Knight') +":") > 0) {
  430.  
  431. skill_info = tabelle.snapshotItem(i).childNodes[0].childNodes[0].childNodes[1];
  432.  
  433. }
  434.  
  435. }
  436.  
  437. }
  438. } else if (location.href.indexOf('pl_info.php') != -1) {
  439.  
  440. //Поиск страницы
  441.  
  442. for (var i = 25; i < tabelle.snapshotLength; i++){
  443.  
  444. if (!tabelle.snapshotItem(i)) continue;
  445.  
  446. if (!tabelle.snapshotItem(i).childNodes[0]) continue;
  447.  
  448.  
  449.  
  450. //Player Info
  451.  
  452. if (tabelle.snapshotItem(i).childNodes[0].childNodes[2]) {
  453.  
  454. if (tabelle.snapshotItem(i).childNodes[0].childNodes[2].childNodes[0]) {
  455.  
  456. if (tabelle.snapshotItem(i).childNodes[0].childNodes[2].childNodes[0].textContent.indexOf(T('Combat level') +":") > 0) {
  457.  
  458. player_info = tabelle.snapshotItem(i).childNodes[0].childNodes[2].childNodes[0];
  459.  
  460. }
  461.  
  462. }
  463.  
  464. }
  465.  
  466.  
  467.  
  468. //Skill Info
  469.  
  470. if (tabelle.snapshotItem(i).childNodes[0].childNodes[1]) {
  471.  
  472. if (tabelle.snapshotItem(i).childNodes[0].childNodes[1].childNodes[1]) {
  473.  
  474. if (tabelle.snapshotItem(i).childNodes[0].childNodes[1].childNodes[1].textContent.indexOf(T('Knight')) > 0) {
  475.  
  476. skill_info = tabelle.snapshotItem(i).childNodes[0].childNodes[1].childNodes[1];
  477.  
  478. }
  479.  
  480. }
  481.  
  482. }
  483.  
  484.  
  485. }
  486.  
  487.  
  488.  
  489. /*tabelle.snapshotItem(31).childNodes[0].childNodes[0].childNodes[0].innerHTML.search(/\- (.*)</);
  490.  
  491. player_faction = RegExp.$1;
  492.  
  493. alert("player_faction = "+player_faction);*/
  494.  
  495. }
  496.  
  497.  
  498.  
  499. //alert(player_faction+'\n\n'+factions.indexOf(player_faction));
  500.  
  501.  
  502.  
  503. //========== Combat Level
  504.  
  505. var lvl_info = player_info.textContent.split("\u00BB")[1];
  506.  
  507. lvl_info.search(/(.*)\((.*)\)(.*)/);
  508.  
  509. var lvl_attuale = eval(RegExp.$1.replace(T('Combat level') +": ","")); //БУ
  510. var exp_attuale = 0;
  511.  
  512. var skills = skill_info.innerHTML.split(">&nbsp;&nbsp;");
  513.  
  514. //========== Player Faction(s)
  515.  
  516. var active_faction_index = factions.indexOf(player_faction);
  517.  
  518.  
  519.  
  520. // show ALL factions
  521.  
  522. for(var faction_index=0; faction_index<factions.length; faction_index++){
  523.  
  524. lvl_info = skills[faction_index];
  525.  
  526. lvl_info.search(/\((\d*.?\d*)\)/);
  527.  
  528. exp_attuale = RegExp.$1;
  529. sum_umk = sum_umk + Number(exp_attuale);
  530. }
  531. sum_umk = Math.round(sum_umk*100)/100;
  532. var nomerumki = (lvl_attuale - 3);
  533. srednya_umka = sred_umk[nomerumki];
  534. umk_min = sred_umk[nomerumki]/1.6;
  535. umk_max = sred_umk[nomerumki]*1.6;
  536. if (lvl_attuale>2){
  537. progress_bar_html = makeProgressBar(sum_umk, umk_min, umk_max);}
  538.  
  539. if (faction_index<factions.length-1) {
  540.  
  541. var next_faction = factions[faction_index + 1];
  542.  
  543. skill_info.innerHTML = skill_info.innerHTML.replace("<br>&nbsp;&nbsp;"+ next_faction, progress_bar_html +"&nbsp;&nbsp;"+ next_faction);
  544.  
  545. skill_info.innerHTML = skill_info.innerHTML.replace("<br>&nbsp;&nbsp;<b>"+ next_faction, progress_bar_html +"&nbsp;&nbsp;<b>"+ next_faction);
  546.  
  547. } else {
  548. skill_info.innerHTML = skill_info.innerHTML.replace("<br>&nbsp;&nbsp;\u0413\u0438\u043B\u044C\u0434\u0438\u044F \u041E\u0445\u043E\u0442\u043D\u0438\u043A\u043E\u0432","<br>&nbsp;&nbsp;<span style='font-weight: bold;'>\u0421\u0443\u043C\u043C\u0430 \u0443\u043C\u0435\u043D\u0438\u0439:</span> "+ sum_umk + progress_bar_html +"<br>&nbsp;&nbsp;\u0413\u0438\u043B\u044C\u0434\u0438\u044F \u041E\u0445\u043E\u0442\u043D\u0438\u043A\u043E\u0432");
  549. }
  550. };
  551.  
  552.  
  553. // Конкретные действия для некоторых страниц
  554.  
  555. if (location.href.indexOf('home.php') != -1) showExpBar();
  556.  
  557. if (location.href.indexOf('pl_info.php') != -1) showExpBar();
  558.  
  559. };
  560.  
  561.  
  562.  
  563. window.addEventListener('load', main, false);