// ==UserScript== // @name WoTStatScript - Tournament Teams // @version 0.9.13.0.1 // @description More info for World of Tanks tournament teams // @author Orrie // @namespace http://forum.worldoftanks.eu/index.php?/topic/263423- // @icon http://dl.dropboxusercontent.com/u/12497046/wot/projects/statscript/img/icon.png // @include http://worldoftanks.eu/*/teams/*/ // @include http://worldoftanks.com/*/teams/*/ // @include http://worldoftanks.ru/*/teams/*/ // @include http://worldoftanks.asia/*/teams/*/ // @include http://worldoftanks.kr/*/teams/*/ // @grant GM_xmlhttpRequest // @license MIT License // @downloadURL none // ==/UserScript== (function () { // global vars var d = document, c = d.cookie; // get server info and webpage var wg = { srv: d.location.host.match(/\.(eu|ru|com|asia|kr)/)[1] }; // server, API and cluster settings var sc = { vers: "0.9.13.0.1", host: "http://greasyfork.org/en/scripts/13064-wotstatscript-tournament-teams", user: "http://forum.wotlabs.net/index.php?/user/1618-orrie/", top: { eu: "http://forum.worldoftanks.eu/index.php?showtopic=263423", na: "http://forum.worldoftanks.com/index.php?showtopic=404652" }, api: { ru: "98ca7c4fb108175b67d6505b9c3f3ebd", eu: "a7595640a90bf2d19065f3f2683b171c", com: "bf5dba0efd444d75147b6222dd903fd2", asia: "95f8713eccd322e52dbf521dbd28b19c", kr: "ffea0f1c3c5f770db09357d94fe6abfb" }, sym: ",", wn: "http://www.wnefficiency.net/exp/expected_tank_values_latest.json", loc: c.match(/hllang=(\w+)/)[1], locSup: ["en", "ru", "cs", "de", "fr", "pl", "es", "tr"] }; // script threadlink sc.link = "
"; // fetch wnefficiency values - check if array exists in localStorage, otherwise fetch and reload page var statArr = [], wnExpValues = locStorage("wnExpValues", "", "get", "parse"), wnExpDate = locStorage("wnExpDate", "", "get", "parse")+12096e5 >= Date.now(), // true if timestamp is less than 2 weeks old, refresh list if false. wnExpVers = locStorage("wnExpVers", "", "get", "parse") || ""; if (wnExpVers[0]==sc.vers && wnExpValues && wnExpDate) { statArr = wnExpValues.data; } else { reqHnd(sc.wn, wnHnd); } // style contents var style = elem("style", "wotstatscript", "", "text/css"), styleText = [ // script header rules "#common_menu .cm-menu__user > *:not(.cm-notifications):not(.js-cm-user-menu-dropdown) {display: inline-block}", "#common_menu .cm-parent-link:hover {cursor: inherit; color: #707273 !important;}", "#common_menu .b-scriptlink a {color: #E5B12E;}", "#common_menu .b-scriptlink a:hover {color: #FFBE4C; text-shadow: 0px 0px 7px rgba(255, 126, 0, 0.7);}", // settings menu rules "#common_menu .menu-settings {text-align: left;}", "#common_menu .menu-settings .cm-parent-link:hover {cursor: pointer;}", "#common_menu .menu-settings label {display: table; line-height: normal; cursor: pointer;}", "#common_menu .menu-settings .l-box {display: none;}", "#common_menu .menu-settings .b-checkbox {height: 16px; width: 16px; float: left; margin-right: 5px;}", "#common_menu .menu-settings .b-checkbox span {height: 16px; width: 16px;}", "#common_menu .menu-settings .b-combobox-label__checked {color: #DCDCDC;}", "#common_menu .menu-settings .settingItem .b-combobox-label:hover {color: #DCDCDC;}", "#common_menu .menu-settings .settingItem .b-combobox-label:hover .b-checkbox {background-position: 0px -34px; box-shadow: 0px 0px 10px 1px rgba(191, 166, 35, 0.15), 0px 0px 3px 1px rgba(191, 166, 35, 0.25);}", "#common_menu .menu-settings .settingItem .b-combobox-label:hover .b-checkbox.b-checkbox__checked {background-position: 0px -68px;}", "#common_menu .menu-settings textarea.l-textarea {background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 2px; color: #FFFFFF; line-height: normal; padding: 5px; min-height: 50px; margin: 5px 0 5px 0; min-width: 175px;}", "#common_menu .menu-settings textarea::-webkit-input-placeholder {color: #FFFFFF;}", "#common_menu .menu-settings textarea::-moz-placeholder {color: #FFFFFF;}", "#common_menu .menu-settings .b-settingLink {line-height: 26px;}", "#common_menu .menu-settings .b-settingLink a {cursor: pointer; color: #B1B2B3; text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.5);}", "#common_menu .menu-settings .b-settingLink a:hover {color: #FFFFFF; text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.75);}", // profile main rules ".profile__main {margin: 0; padding: 0;}", ".b-profile-header {font-family: Arial;}", // member table rules ".t-table th.stat-total {text-align: center;}", ".t-table th.stat-total span {margin: 0 15px;}", ".b-user {width: 50%;}", ".b-user .xvm-lang {margin: 0 0 -1px 3px;}", ".b-user .stat {float: right;}", ".b-user .stat-win {display: inline-block; width: 60px;}", ".b-user .stat-rat {display: inline-block; text-align: right; width: 32px;}" ]; style.textContent = styleText.join(""); d.head.appendChild(style); // end style // colour scale array var colArr = { // col wr bat wn8 wn7 eff nm pr sUni: [ "#5A3175", 65, 30000, 2900, 2050, 2050, 2000 ], // 99.99% super unicum uni: [ "#83579D", 60, 25000, 2450, 1850, 1800, 1950, 9930 ], // 99.90% unicum gr8: [ "#3972C6", 56, 21000, 2000, 1550, 1500, 1750, 8525 ], // 99.00% great vGud: [ "#4099BF", 54, 17000, 1600, 1350 ], // 95.00% very good good: [ "#4D7326", 52, 13000, 1200, 1100, 1200, 1450, 6340 ], // 82.00% good aAvg: [ "#849B24", 50, 10000, 900 ], // 63.00% above average avg: [ "#CCB800", 48, 7000, 650, 900, 900, 1250, 4185 ], // 40.00% average bAvg: [ "#CC7A00", 47, 3000, 450, 700, 600, 1150, 2020 ], // 20.00% below average bas: [ "#CD3333", 46, 1000, 300, 500 ], // 6.00% basic beg: [ "#930D0D", 0, 0, 0, 0, 0, 0, 0 ], // 0.00% beginner dft: [ "#6B6B6B" ], // default id: { "col": 0, "wr": 1, "bat": 2, "wn8": 3, "wn7": 4, "eff": 5, "nm": 6, "pr": 7 } // type identifier }; // localization // cz-czech - Crabtr33 and Ragnarocek // de-german - ArtiOpa, Crakker and multimill // fr-french - SuperPommeDeTerre // pl-polish - KeluMocy and pokapokami // es-spanish - Frodo45127 // tr-turkish - Ufuko // ru-russian - dimon222 var loc = [ { en: "Script Menu", ru: "Script Menu", cs: "Nastavení scriptu", de: "Script Menu", fr: "Script Menu", pl: "Script Menu", es:"Script Menu", tr: "Script Menu"}, { en: "Refresh WN8 Table", ru: "Refresh WN8 Table", cs: "Obnov WN8 Tabulku", de: "Refresh WN8 Table", fr: "Refresh WN8 Table", pl: "Refresh WN8 Table", es: "Refresh WN8 Table", tr: "Refresh WN8 Table"} ]; // process localization if (sc.locSup.indexOf(sc.loc) == -1) { sc.loc = "en"; } for (var _l=0, l_len = loc.length; _l