Profiler - draft

basic stuff is working with examplary static data
need to sit down and collect mods from talents and class-spells
<bla bla>                         from profession perks
loadOnDemandData not implemented as the structure needs more research

some visual bugs

remember to generate your realm-file. i used these example realms
[
    ["us","US & Oceanic",null,[["pure-pwnage","Pure Pwnage",null,[["trinity","Trinity"]]]]],
    ["eu","Europe",null,[["pure-pwnage","Pure Pwnage",null,[["dafuque","da'Fuqú]]]
]
This commit is contained in:
Sarjuuk
2014-03-14 16:32:15 +01:00
parent 63895e838b
commit c865a3a9a4
42 changed files with 13685 additions and 129 deletions

99
template/js/Book.js Normal file
View File

@@ -0,0 +1,99 @@
function Book(opt) {
if (!opt.parent || !opt.pages || opt.pages.length == 0) {
return;
}
opt.parent = $WH.ge(opt.parent);
var
d,
a,
_;
this.nPages = opt.pages.length;
this.parent = $WH.ge(opt.parent);
this.parent.className += ' book';
d = $WH.ce('div');
d.className = 'paging';
if (this.nPages == 1) {
d.style.display = 'none';
}
$WH.ns(d);
_ = $WH.ce('div');
_.style.visibility = 'hidden';
_.className = 'previous';
a = $WH.ce('a');
a.appendChild($WH.ct(String.fromCharCode(8249) + LANG.lvpage_previous));
a.href = 'javascript:;';
a.onclick = this.previous.bind(this);
_.appendChild(a);
d.appendChild(_);
_ = $WH.ce('div');
_.style.visibility = 'hidden';
_.className = 'next';
a = $WH.ce('a');
a.appendChild($WH.ct(LANG.lvpage_next + String.fromCharCode(8250)));
a.href = 'javascript:;';
a.onclick = this.next.bind(this);
_.appendChild(a);
d.appendChild(_);
_ = $WH.ce('b');
_.appendChild($WH.ct('1'));
d.appendChild(_);
d.appendChild($WH.ct(LANG.lvpage_of));
_ = $WH.ce('b');
_.appendChild($WH.ct(this.nPages));
d.appendChild(_);
opt.parent.appendChild(d);
for (var i = 0; i < this.nPages; ++i) {
d = $WH.ce('div');
d.className = 'page';
d.style.display = 'none';
d.innerHTML = opt.pages[i];
opt.parent.appendChild(d);
}
this.page = 1;
this.changePage(opt.page || 1);
}
Book.prototype = {
changePage: function(page) {
if (page < 1) {
page = 1;
}
else if (page > this.nPages) {
page = this.nPages;
}
var _ = this.parent.childNodes;
_[this.page].style.display = 'none';
_[page].style.display = '';
this.page = page;
_ = _[0].childNodes;
_[0].style.visibility = (page == 1) ? 'hidden': 'visible';
_[1].style.visibility = (page == this.nPages) ? 'hidden': 'visible';
_[2].innerHTML = page;
},
next: function() {
this.changePage(this.page + 1);
},
previous: function() {
this.changePage(this.page - 1);
}
};

10059
template/js/Profiler.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3776,14 +3776,156 @@ var LANG = {
message_nosigbookmarks: "You have not bookmarked any characters. Please add some to continue.",
message_bookmarkforsig: "Please bookmark this character before creating a signature.",
pr_dialog_level: "Level:",
confirm_linkcharacter: "This character will be added to your list of characters.\n\nDo you want to continue?",
confirm_linkedcharacter: "This character has been added to your list.\n\nDo you want to be taken there?",
confirm_unlinkcharacter: "Are you sure that you want to remove the selected characters from your list?",
confirm_deleteprofile: "Are you sure that you want to delete the selected profiles?",
confirm_deleteprofile2: "Are you sure that you want to delete this profile?",
confirm_privateprofile: "Are you sure that you want to make the selected profiles private?",
confirm_publicprofile: "Are you sure that you want to make the selected profiles public?",
confirm_purgedata: "Are you sure you wish to purge your $1?",
confirm_newprofile: "Create a new profile?\n\nYou will be redirected upon saving the profile.",
confirm_resetexclusions: "This will reset your exclusion settings to the default. Are you sure you want to proceed?",
confirm_pincharacter: "This character will be pinned as your default character throughout the site.\n\nDo you want to continue?",
confirm_unpincharacter: "You will no longer have a pinned character.\n\nDo you want to continue?",
confirm_deletesigimages: "Are you sure you want to delete these signature backgrounds?",
confirm_deletesignature: "Are you sure that you want to delete the selected signatures?",
loremasteryes_tip: "This quest counts towards<br />loremaster achievements",
loremasterno_tip: "This quest does not count<br />towards loremaster achievements",
prompt_charlookup: "Please enter the name of the character you wish to view:",
prompt_nameprofile: "Please provide a name for this profile.\n(i.e. Resistance Gear, PvP Set, Wishlist, etc.)\n\nYou will be redirected upon saving the profile.",
dialog_notavail: "Not available to players",
dialog_tcg: "Obtained via TCG loot redemption",
dialog_collector: "Reward from a Collector's Edition",
dialog_promo: "Obtained from a promotion",
dialog_nonus: "Not available on US servers",
dialog_faction: "Favored by opposite faction",
dialog_profession: "Requires another profession",
dialog_exclude: "Excluding entries lets you remove things you can't or don't plan on completing. Individual inclusions/exclusions will override the quick categories below.<br /><br />Your exclusion settings are shared between all characters.",
dialog_noexalted: "Impossible to reach exalted",
dialog_manageexclusions: "Manage Personal Exclusions",
dialog_resetexclusions: "Reset all exclusions",
tab_arenateams: "Arena teams",
tab_character: "Character",
tab_characters: "Characters",
tab_guilds: "Guilds",
tab_reputation: "Reputation",
lvnote_clicksubcatg: "Click on a subcategory below to filter the other tabs.",
button_save: "Save",
button_saveas: "Save as",
button_bookmark: "Bookmark",
button_pin: "Pin",
button_unpin: "Unpin",
button_claimchar: "Claim character",
button_resync: "Resync",
button_signature: "Signature",
button_customprofile: "Custom profile",
button_armorychar: "Manage character",
pr_clienttab: "$1<br /><span class=\"q1\">If this is your character, you can track your<br />$2 using the Wowhead Client!</span><br /><span class=\"q2\">Click to learn more</span>",
pr_lookup: "Lookup: ",
pr_noneitem: "None",
pr_nonegem: "None",
pr_noneenchant: "None",
pr_nonepet: "None",
pr_specifyitem: "Please enter an item name to search for.",
pr_searching: 'Searching for items named "$1"...',
pr_noresults: 'No results found for "$1"!',
pr_region: "(Region)",
pr_realm: "(Realm)",
pr_selectregion: "Select a region",
pr_vendorsin: "Vendors in ",
pr_yes: "Yes",
pr_dungeons: "Dungeons",
pr_tt_items: "Items",
pr_tt_enchants: "Enchants",
pr_tt_gems: "Gems",
pr_tt_normal: "$1 (10-player)",
pr_tt_heroic: "$1 (25-player)",
pr_tt_earned: "$1 has earned $2 of $3 achievements ($4%).",
pr_tt_earned2: "$1 has killed all bosses in this instance.",
pr_tt_progress: "Progress",
pr_tt_obtained: "Total number obtained: $1",
pr_tt_nodata: "This statistic is not currently available in-game<br />and cannot be tracked by Wowhead.",
pr_tt_enchreq: "Enchantment Requires Level $1",
pr_tt_new: '<b class="q">New</b><br />Create a new custom profile from scratch.',
pr_tt_saveas: '<b class="q">Save as</b><br />Save the current character as a custom<br />profile tied to your Wowhead account.',
pr_tt_resync: '<b class="q">Resync</b><br />Resync the character with the latest<br />version available on the Armory.',
pr_tt_claim: '<b class="q">Claim character</b><br />Add this character to your list of characters.',
pr_tt_include: '<b class="q">Include</b><br />Move selected entries out of your exclusion list.',
pr_tt_exclude: '<b class="q">Exclude</b><br />Move selected entries to your exclusion list.<br />This can be useful to hide things you don\'t<br />consider important to reach 100% completion.',
pr_tt_noqexcl: '<div class="pad"><span class="q10">Note:</span> Quick exclusions aren\'t currently available for this tab.',
pr_tt_excldone: "Complete but excluded",
pr_tt_questtip: "Repeatable quests and quests that don't<br />appear in your quest log aren't tracked.",
pr_tip_rclkopt: "Tip: Right-click slots for more options.",
pr_tip_sclkopt: "Tip: Shift-click items for more options.",
pr_tip_rclkopt2: "Tip: Right-click items, gems and enchants for more options.",
pr_tip_sclkopt2: "Tip: Shift-click items, gems and enchants for more options.",
pr_tip_quests: "Note: <span class=\"tip\">Certain</span> quests aren't tracked by Blizzard's API.",
pr_header_noname: "Noname",
pr_header_character: 'Level $1 <a href="?race=$4">$2</a> <a href="?class=$5" class="c$5">$3</a>',
pr_header_edit: "Edit",
pr_header_armory: "Armory",
pr_header_help: "Help",
pr_header_print: "Print",
pr_dialog_chardetails: "Character Details",
pr_dialog_name: "Name: ",
pr_dialog_level: "Level: ",
pr_dialog_class: "Class: ",
pr_dialog_race: "Race: ",
pr_dialog_gender: "Gender: ",
pr_dialog_icon: "Icon: ",
pr_dialog_iconeg: "e.g. INV_Axe_54",
pr_dialog_description: "Description: ",
pr_dialog_public: "Visibility: ",
pr_qf_quickfacts: "Quick Facts",
pr_qf_progress: "Progress",
pr_qf_toc: "Table of Contents",
pr_qf_owner: "Owner: ",
pr_qf_character: "Character: ",
pr_qf_profiles: "Profiles: ",
pr_qf_playedtime: "Played time: ",
pr_qf_itemlevel: "Item Level: ",
pr_qf_gearscore: "Gear score: ",
pr_qf_talents: "Talents: ",
pr_qf_achievements: "Achievements: ",
pr_qf_xvxteam: "$1v$1 team: ",
pr_qf_updated: "Updated ",
pr_qf_resynced: "Resynced ",
pr_qf_notsaved: "Profile has not been saved!",
pr_qf_gearmeter: "Gear",
pr_qf_raidactivity1: "All Raid Activity",
pr_qf_raidactivity2: "Recent Raid Activity",
pr_qf_activitytip1: "Click to display recent raid activity",
pr_qf_activitytip2: "Click to display all raid activity",
pr_qf_activitypct1: "$1% of all activity",
pr_qf_activitypct2: "$1% of recent activity",
pr_qf_raidcomplete: "$1% complete",
pr_qf_gear0: "Trivial",
pr_qf_gear1: "Easy",
pr_qf_gear2: "Ideal",
pr_qf_gear3: "Challenging",
pr_qf_gear4: "Difficult",
pr_qf_gear5: "Futile",
menu_charlookup: "Lookup by name...",
menu_newprofile: "New Custom Profile",
menu_chooseclassspec: "Choose Your Class/Spec",
pr_selectregion: "Select a region",
pr_menu_equip: "Equip...",
pr_menu_replace: "Replace...",
pr_menu_add: "Add...",
@@ -3803,9 +3945,134 @@ var LANG = {
pr_menu_upgrades: "Find Upgrades",
pr_menu_whowears: "Who Wears This?",
pr_noneitem: "None",
pr_nonegem: "None",
pr_noneenchant: "None",
pr_queue_unknown: "Unknown",
pr_queue_noprocess: "The queue is not currently running.",
pr_queue_resyncreq: "<b>An Armory resync has been requested.</b>",
pr_queue_addqueue: "Adding to the Armory queue...",
pr_queue_status1: "Position in queue: <b>$1</b> &ndash; Estimated time: <b>$2</b>",
pr_queue_status2: "Fetching data now...",
pr_queue_status3: 'Data is ready! <a href="?$2" rel="np">Reload to view</a>.',
pr_queue_status4: 'Unable to resync from the Armory: $1. Try <a href="javascript:;">resyncing</a> again.',
pr_queue_batch: "Queue: <b>$1</b> Processing: <b>$2</b> Ready: <b>$3</b> Error: <b>$4</b>",
pr_error_armory0: "Error unknown",
pr_error_armory1: "Character does not exist",
pr_error_armory2: "The Armory could not be reached",
pr_inv_title: "Gear Summary",
pr_inv_missing: "Missing: ",
pr_inv_lowlevel: "Low level: ",
pr_inv_metareq: "Meta condition: ",
pr_inv_item: "$1 item",
pr_inv_items: "$1 items",
pr_inv_gem: "$1 gem",
pr_inv_gems: "$1 gems",
pr_inv_enchant: "$1 enchant",
pr_inv_enchants: "$1 enchants",
pr_inv_socket: "$1 socket",
pr_inv_sockets: "$1 sockets",
pr_print_none: "None",
pr_print_yes: "Yes",
pr_print_no: "No",
pr_print_normal: "Normal",
pr_print_heroic: "Heroic",
pr_stats_warning: "Warning: Some statistics (particularly dodge) may not be entirely accurate.",
pr_stats_title: "Statistics",
pr_stats_base: "Base",
pr_stats_melee: "Melee",
pr_stats_ranged: "Ranged",
pr_stats_spell: "Spell",
pr_stats_defenses: "Defenses",
pr_stats_resistances: "Resistances",
pr_stats_beta: "beta",
pr_stats_agi: "Agility",
pr_stats_arcres: "Arcane resistance",
pr_stats_armor: "Armor",
pr_stats_armorpenpct: "Penetration",
pr_stats_blockpct: "Block",
pr_stats_def: "Defense",
pr_stats_dodgepct: "Dodge",
pr_stats_energy: "Energy",
pr_stats_exp: "Expertise",
pr_stats_firres: "Fire resistance",
pr_stats_frores: "Frost resistance",
pr_stats_health: "Health",
pr_stats_holres: "Holy resistance",
pr_stats_int: "Intellect",
pr_stats_mana: "Mana",
pr_stats_mleatkpwr: "Power",
pr_stats_mlecritstrkpct: "Critical",
pr_stats_mlehastepct: "Haste",
pr_stats_mlehitpct: "Hit",
pr_stats_natres: "Nature resistance",
pr_stats_oocmanargn: "Mana Regen",
pr_stats_parrypct: "Parry",
pr_stats_rage: "Rage",
pr_stats_resipct: "Resilience",
pr_stats_rgdatkpwr: "Power",
pr_stats_rgdcritstrkpct: "Critical",
pr_stats_rgdhastepct: "Haste",
pr_stats_rgdhitpct: "Hit",
pr_stats_runic: "Runic Power",
pr_stats_shares: "Shadow resistance",
pr_stats_spi: "Spirit",
pr_stats_splcritstrkpct: "Critical",
pr_stats_spldmg: "Bonus Damage",
pr_stats_splhastepct: "Haste",
pr_stats_splheal: "Bonus Healing",
pr_stats_splhitpct: "Hit",
pr_stats_splpen: "Penetration",
pr_stats_sta: "Stamina",
pr_stats_str: "Strength",
pr_statstt_arc: "Arcane",
pr_statstt_fir: "Fire",
pr_statstt_fro: "Frost",
pr_statstt_hol: "Holy",
pr_statstt_nat: "Nature",
pr_statstt_sha: "Shadow",
pr_statstt_agi: "Increases attack power by $1<br />Increases physical critical hit chance by $2%<br />Increases armor by $3",
pr_statstt_armor: "Reduces physical damage taken by $2%",
pr_statstt_armor2: "Reduces physical damage taken by $2%<br />Increases your pet's armor by $1",
pr_statstt_armorpenpct: '<span class="q2">Armor penetration rating $1 (+$2% armor penetration)</span><br />Reduces enemy armor by $3%',
pr_statstt_blockpct: '<span class="q2">Block rating $1 (+$2% block)</span><br />Increases chance to block by $4%<br />Your block stops $3 damage',
pr_statstt_def: '<span class="q2">Defense rating $1 (+$2 defense)</span><br />Increases chance to dodge, block and parry by $3%<br />Decreases chance to be hit and critically hit by $4%',
pr_statstt_dodgepct: '<span class="q2">Dodge rating $1 (+$2% dodge)</span><br />Increases chance to dodge by $3%<br /><span class="q0">(Before diminishing returns)</span>',
pr_statstt_exp: '<span class="q2">Expertise rating $1 (+$2 expertise)</span><br />Reduces chance to be dodged or parried by $3%',
pr_statstt_int: "Increases mana by $1<br />Increases spell critical hit chance by $2%",
pr_statstt_int2: "Increases mana by $1<br />Increases spell critical hit chance by $2%<br />Increases your pet's intellect by $3",
pr_statstt_mleatkpwr: "Increases damage with melee weapons by $1 per second",
pr_statstt_mlecritstrkpct: '<span class="q2">Crit rating $1 (+$2% crit chance)</span><br />Increases melee critical strike chance by $3%',
pr_statstt_mlehastepct: '<span class="q2">Haste rating $1 (+$2% haste)</span><br />Increases melee attack speed by $3%',
pr_statstt_mlehitpct: '<span class="q2">Hit rating $1 (+$2% hit chance)</span><br />Increases melee chance to hit a level $4 target by $3%',
pr_statstt_oocmanargn: "$1 mana regenerated every 5 seconds while not casting<br />$2 mana regenerated every 5 seconds while casting",
pr_statstt_parrypct: '<span class="q2">Parry rating $1 (+$2% parry)</span><br />Increases chance to parry by $3%<br /><span class="q0">(Before diminishing returns)</span>',
pr_statstt_resipct: '<span class="q2">Resilience rating $1 (+$2% resilience)</span><br />Reduces chance to be critically hit by $3%<br />Reduces the effect of mana-drains and the damage of critical strikes by $4%<br />Provides $5% additional damage reduction against all damage done by players and their pets or minions',
pr_statstt_resist: "Increases resistance to $1-based attacks, spells, and abilities.<br />Average resistance against spells cast by level $3: $1%",
pr_statstt_rgdatkpwr: "Increases damage with ranged weapons by $1 per second",
pr_statstt_rgdatkpwr2: "Increases damage with ranged weapons by $1 per second<br />Increases your pet's attack power by $2<br />Increases your pet's spell damage by $3",
pr_statstt_rgdcritstrkpct: '<span class="q2">Crit rating $1 (+$2% crit chance)</span><br />Increases ranged critical strike chance by $3%',
pr_statstt_rgdhastepct: '<span class="q2">Haste rating $1 (+$2% haste)</span><br />Increases ranged attack speed by $3%',
pr_statstt_rgdhitpct: '<span class="q2">Hit rating $1 (+$2% hit chance)</span><br />Increases ranged chance to hit a level $4 target by $3%',
pr_statstt_spi: "Increases health regeneration by $1 per 5 seconds while not in combat<br />Increases mana regeneration by $2 per 5 seconds while not casting",
pr_statstt_splcritstrkpct: '<span class="q2">Crit rating $2 (+$3% crit chance)</span><br />$1',
pr_statstt_spldmg: "$1",
pr_statstt_spldmg2: "$1<br />Increases your pet's attack power by $3<br />Increases your pet's spell damage by $4",
pr_statstt_splhastepct: '<span class="q2">Haste rating $1 (+$2% haste)</span><br />Increases spell casting speed by $3%',
pr_statstt_splheal: "Increases healing by up to $1",
pr_statstt_splhitpct: '<span class="q2">Hit rating $1 (+$2% hit chance)</span><br />Increases spell chance to hit a level $4 target by $3%',
pr_statstt_splpen: "Reduces enemy resistances by $1",
pr_statstt_sta: "Increases health by $1",
pr_statstt_sta2: "Increases health by $1<br />Increases your pet's stamina by $2",
pr_statstt_str: "Increases attack power by $1",
pr_statstt_str2: "Increases attack power by $1<br />Increases block value by $2",
pr_ach_overall: "Overall Progress",
pr_note_color: "Color: ",
pr_note_source: "Source: ",
@@ -3815,7 +4082,7 @@ var LANG = {
pr_note_family: "Family: ",
pr_note_sort: "Sort by: ",
ddaysago: "$1 days ago",
ddaysago: "$1 days ago",
pr_note_all: "All",
pr_note_bc: "BC",
@@ -3833,6 +4100,8 @@ var LANG = {
pr_note_missing: "Missing",
pr_note_normal: "Normal",
pr_note_exotic: "Exotic",
pr_note_gearscore: "Gear score",
pr_note_weighted: "Weighted",
su_note_stats: "Stats",
su_note_other: "Other",

806
template/js/profile.js Normal file
View File

@@ -0,0 +1,806 @@
function pr_setRegionRealm(f, region, server)
{
if(!f) return;
var
r = f.elements['rg'] || f.elements[0],
s = f.elements['sv'] || f.elements[1];
if(!r || !s) return;
for(var i = 0, len = r.options.length; i < len; ++i)
{
if(r.options[i].value == region)
{
r.options[i].selected = true;
break;
}
}
pr_onChangeRegion(f, region, server);
if(s.onchange)
s.onchange();
}
function pr_onChangeRegion(f, region, server)
{
if(!f) return;
var
r = f.elements['rg'] || f.elements[0],
s = f.elements['sv'] || f.elements[1];
if(!r || !s) return;
var o = r.options[0];
o.value = '';
o.style.color = '#999999';
$WH.ee(s);
o = $WH.ce('option');
o.value = '';
o.style.color = '#999999';
$WH.ae(s, o);
if(s.onchange == null)
s.onchange = function() { this.className = (this.selectedIndex ? '' : 'search-character'); };
if(region == null)
region = r.options[r.selectedIndex].value;
if(!region)
{
r.className = 'search-character';
s.className = 'search-character';
var o = $WH.ce('option');
o.disabled = true;
$WH.ae(o, $WH.ct(LANG.pr_selectregion));
$WH.ae(s, o);
}
else
{
var realms;
r.className = '';
s.className = 'search-character';
realms = pr_getRealms(region);
for(var i = 0, len = realms.length; i < len; ++i)
{
var
realmId = realms[i],
realm = g_realms[realmId];
o = $WH.ce('option');
o.value = g_urlize(realm.name, true, true);
$WH.ae(o, $WH.ct(realm.name));
if(server != null && realm.name == server)
{
s.className = '';
o.selected = true;
}
$WH.ae(s, o);
}
}
}
pr_onChangeRegion.C = {};
function pr_onChangeRace()
{
if($('select[name=ra[]] option:selected').length)
$('select[name=si]').attr('disabled', true).val('');
else
$('select[name=si]').attr('disabled', false);
}
function pr_suggestRealms(region, realm, autoComplete)
{
autoComplete.empty();
if(realm.val().length >= 2)
{
var realms = pr_getRealms(region.val(), realm.val());
if(realms.length)
{
$.each(realms, function(i, realmId) {
autoComplete.append('<span>' + g_realms[realmId].name + '</span>');
});
realm.removeClass('oops');
autoComplete.show();
}
else
{
realm.addClass('oops');
autoComplete.hide();
}
}
else
{
realm.removeClass('oops');
autoComplete.hide();
}
}
function pr_highlightRealm(selectedRealm, autoComplete, realm)
{
var spans = $('span', autoComplete),
active = $(spans.get(selectedRealm - 1));
spans.removeClass('active');
active.addClass('active');
realm.val(active.text()).focus();
}
function pr_getRealms(region, text)
{
if(pr_onChangeRegion.C[region] != null)
realms = pr_onChangeRegion.C[region];
else
{
realms = pr_onChangeRegion.C[region] = g_sortJsonArray(
g_realms,
g_realms,
function(a, b) { return $WH.strcmp(g_realms[a].name, g_realms[b].name) },
function(x) { return x.region == region }
);
}
if(text != null)
realms = $WH.array_filter(realms, function(x) { return g_realms[x].name.toLowerCase().match(text.toLowerCase()) });
return realms;
}
function pr_updateStatus(page, div, id, request, tryAgain)
{
if (tryAgain == null) {
tryAgain = function(noUpdate) {
new Ajax('?' + page + '=resync&id=' + id, {
method: 'POST',
onSuccess: function(xhr, opt) {
if (!noUpdate) {
pr_updateStatus(page, div, id, request, null);
}
}
});
};
}
new Ajax('?' + page + '=status&id=' + id + '&t=' + (new Date().getTime()), {
onSuccess: function(xhr, opt) {
var text = xhr.responseText;
if (text.charAt(0) != '[' || text.charAt(text.length - 1) != ']') {
return;
}
var
a = eval(text),
processes = a[0],
profile = (location.search || location.pathname).substr(1),
working = false,
action = false,
statusTotal = { 1: 0, 2: 0, 3: 0, 4: 0 },
duration;
$WH.ee(div);
for (var i = 1; i < a.length; ++i) {
var
status = a[i][0],
refresh = a[i][1],
count = a[i][2],
errcode = a[i][3],
nresyncs = a[i][4];
if (!statusTotal[status]) {
statusTotal[status] = 0;
}
statusTotal[status]++;
if (status == 3 && !nresyncs) {
request = true;
}
if (status && (status != 3 || request)) {
if (a.length == 2) { // single status
duration = (count && processes ? g_formatTimeElapsed((count * 15 / processes) + 2) : LANG.pr_queue_unknown);
count = (!isNaN(count) ? $WH.number_format(count) : LANG.pr_queue_unknown);
div.innerHTML = LANG.pr_queue_resyncreq;
if (!processes) {
div.innerHTML += ' ' + LANG.pr_queue_noprocess;
}
div.innerHTML += '<a id="close-profiler-notification" class="announcement-close" href="javascript:;" onclick="$(\'.profiler-message\').remove(); return false;">';
div.innerHTML += '<br />' + (status < 3 && !refresh && !nresyncs ? LANG.pr_queue_addqueue : (status > 2 ? $WH.sprintf(LANG['pr_queue_status' + status], LANG['pr_error_armory' + errcode], profile) : $WH.sprintf(LANG['pr_queue_status' + status], count, duration, profile)));
div.style.backgroundImage = '';
if (status == 4) {
var _ = $WH.gE(div, 'a')[1];
_.onclick = tryAgain.bind(null, false);
}
}
if (status == 4) {
$('a', div).click(tryAgain);
}
else if (refresh && !action) {
setTimeout(pr_updateStatus.bind(null, page, div, id, request, tryAgain), refresh);
working = true;
action = true;
}
}
}
if (!div.childNodes) {
div.style.display = 'none';
}
if (!working) {
div.style.backgroundImage = 'none';
}
if (a.length > 2) { // Multiple status returned
div.innerHTML = LANG.pr_queue_resyncreq + (!processes ? ' ' + LANG.pr_queue_noprocess : '') + '<br />' + $WH.sprintf(LANG['pr_queue_batch'], statusTotal[1], statusTotal[2], statusTotal[3], statusTotal[4]);
}
}
});
}
function pr_resyncRoster(id, mode)
{
var div = $WH.ge('roster-status');
div.innerHTML = LANG.pr_queue_addqueue;
div.style.display = '';
new Ajax(
'/' + mode + '=resync&id=' + id + '&profile',
{
method: 'POST',
onSuccess: function(xhr, opt)
{
var result = parseInt(xhr.responseText);
if(isNaN(result))
alert(LANG.message_resyncerror + result);
else if(result < 0 && result != -102)
alert(LANG.message_resyncerror + '#' + result);
pr_updateStatus('profile', div, id + '&' + mode, true);
}
}
);
}
// imported from deprecated version
function pr_initRosterListview() {
this.applySort();
if (g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU)) {
this.mode = 1;
this.createCbControls = function (c, b) {
if (!b && this.data.length < 15) {
return
}
var a = $WH.ce("input");
a.type = "button";
a.value = LANG.button_resync;
a.onclick = (function () {
var e = this.getCheckedRows();
if (!e.length) {
alert(LANG.message_nocharacterselected)
} else {
var d = "";
$WH.array_walk(e, function (f) {
d += f.id + ","
});
d = $WH.rtrim(d, ",");
if (d != "") {
new Ajax("?profile=resync&id=" + d)
} (Listview.cbSelect.bind(this, false))();
alert(LANG.message_characterresync)
}
}).bind(this);
$WH.ae(c, a)
}
}
}
function pr_getGearScoreQuality(level, gearScore, relics, slotId, use2h)
{
var baseScore, totalMod, quality;
if(!gearScore)
return 0;
if(slotId == null)
{
totalMod = 12.25390625;
if(level < 55)
{
if(relics)
totalMod -= 81/256; // Relic
totalMod -= 18/16; // Trinkets x2
if(level < 25)
{
totalMod -= 25/16; // Head and Neck
if(level < 20)
totalMod -= 30/16; // Shoulder and Rings x2
}
}
}
else
{
switch(slotId)
{
case 1: // Head
case 5: // Chest
case 7: // Legs
case 16: // Main Hand (Modified)
case 17: // Off Hand (Modified)
totalMod = 1;
break;
case 3: // Shoulder
case 10: // Hands
case 6: // Waist
case 8: // Feet
totalMod = 3/4;
break;
case 9: // Wrists
case 2: // Neck
case 15: // Back
case 11: // Finger #1
case 12: // Finger #2
case 13: // Trinket #1
case 14: // Trinket #2
totalMod = 9/16;
break;
case 18: // Ranged, Relic
totalMod = 81/256;
break;
}
if(use2h)
totalMod *= 2;
}
if(level > 80)
baseScore = ((level - 80) * 12) + 293;
else if(level > 70)
baseScore = ((level - 70) * 6) + 140;
else if(level > 60)
baseScore = ((level - 60) * 4) + 80;
else
baseScore = level + 5;
if(level <= 80)
baseScore *= 1.2;
if(gearScore >= baseScore * totalMod * 1.25)
quality = 5; // Legendary
else
{
quality = 4; // Epic
while(gearScore < baseScore * totalMod && quality > 0)
{
baseScore -= (level > 80 ? (5 - quality) * 12 : 0.6 * baseScore);
quality--;
}
}
return quality;
}
function pr_getSpecFromTalents(classs, spent)
{
var spec = 0; // Hybrid
if(spent == null || (spent[0] == 0 && spent[1] == 0 && spent[2] == 0))
spec = -1; // Untalented
else if(spent[0] - spent[1] > 5 && spent[0] - spent[2] > 5)
spec = 1;
else if(spent[1] - spent[0] > 5 && spent[1] - spent[2] > 5)
spec = 2;
else if(spent[2] - spent[0] > 5 && spent[2] - spent[1] > 5)
spec = 3;
var specName;
var specIcon;
if(spec <= 0)
{
specName = g_chr_specs[spec];
if(spec == -1)
specIcon = 'spell_shadow_sacrificialshield'; // Untalented
else
specIcon = 'spell_nature_elementalabsorption'; // Hybrid
}
else
{
specName = g_chr_specs[classs][spec - 1];
if(wt_presets && wt_presets[classs] && wt_presets[classs].pve)
{
var j = 1;
for(var p in wt_presets[classs].pve)
{
if(j++ == spec)
{
specIcon = wt_presets[classs].pve[p].__icon;
break;
}
}
}
}
return {
id: spec,
name: specName || '',
icon: specIcon || ''
};
}
function pr_getScaleFromSpec(classs, spec, getName)
{
var pve = wt_presets[classs].pve,
temp = [];
for(var p in pve)
temp.push(getName ? LANG.presets[p] : pve[p]);
return (getName? temp[spec] : $WH.dO(temp[spec]));
}
function pr_getScaleFilter(scale, noFilter) {
var temp = [];
if (scale) {
for (var i = 0, len = fi_filters.items.length; i < len; ++i) {
var f = fi_filters.items[i];
if (LANG.traits[f.name] && scale[f.name]) {
temp.push([f.id, scale[f.name]]);
}
}
}
temp.sort(function(a, b) {
return -$WH.strcmp(a[1], b[1]);
});
var
wt = [],
wtv = [];
for (var i = 0, len = temp.length; i < len; ++i) {
wt.push(temp[i][0]);
wtv.push(temp[i][1]);
}
if (wt.length && wtv.length) {
return (noFilter ? '&' : ';gm=3;') + 'wt=' + wt.join(':') + (noFilter ? '&' : ';') + 'wtv=' + wtv.join(':');
}
return '';
}
function pr_showClassPresetMenu(a, itemId, itemClass, itemSlot, event)
{
var menu = [[, LANG.menu_chooseclassspec]];
if(itemId && itemClass && (itemClass != 2 || itemSlot))
{
if(g_user.weightscales && g_user.weightscales.length)
{
var __ = [0, LANG.ficustom,, []];
menu.push(__);
for(var i = 0, len = g_user.weightscales.length; i < len; ++i)
{
var scale = g_user.weightscales[i];
__[3].push([scale.id, scale.name, '?items=' + itemClass + '&filter=cr=161;crs=1;crv=0' + pr_getScaleFilter(scale) + (itemClass == 2 ? ';gb=1' : ';gb=3') + ';upg=' + itemId + (itemClass == 2 && g_item_slots[itemSlot] ? '#' + g_urlize(g_item_slots[itemSlot]) : '')]);
}
}
for(var c in wt_presets)
{
var __ = [c, g_chr_classes[c],, [], {className:'c'+c,tinyIcon:'class_'+g_file_classes[c]}];
menu.push(__);
var j = 0;
for(var p in wt_presets[c].pve)
{
__[3].push([j, LANG.presets[p], '?items=' + itemClass + '&filter=ub=' + c + ';cr=161;crs=1;crv=0' + pr_getScaleFilter(wt_presets[c].pve[p]) + (itemClass == 2 ? ';gb=1' : ';gb=3') + ';upg=' + itemId + (itemClass == 2 && g_item_slots[itemSlot] ? '#' + g_urlize(g_item_slots[itemSlot]) : ''),, {tinyIcon:wt_presets[c].pve[p].__icon}]);
j++;
}
}
var pos = $WH.g_getCursorPos(event);
Menu.sort(menu);
Menu.showAtXY(menu, pos.x, pos.y);
}
}
function pr_addEquipButton(id, itemId)
{
$.each(g_user.characters, function(idx, character)
{
if(character.pinned)
{
var button = RedButton.create(LANG.button_equip, true, function() {
location.href = g_getProfileUrl(character) + '&items=' + itemId;
});
g_addTooltip(button, LANG.tooltip_equip, 'q1');
$('#' + id).append(button);
return;
}
});
}
function pr_onBreadcrumbUpdate() // Add character lookup textbox to the breadcrumb
{
// var breadcrumb = PageTemplate.get('breadcrumb');
var breadcrumb = temp_path;
// end
if(!breadcrumb || breadcrumb.length != 6) // Realm is required
return;
var path = Menu.getFullPath(mn_path, breadcrumb);
var menuItem = path[path.length - 1];
// var span = PageTemplate.expandBreadcrumb()[0];
$('.path').children('span:last').addClass('breadcrumb-arrow');
var span = ($('<span/>').appendTo($('.path')))[0];
// end
var f = $WH.ce('form'),
i = $WH.ce('input'),
a = $WH.ce('a');
span.className = 'profiler-charlookup';
f.onsubmit = pr_DirectLookup.bind(0, f, false);
i.name = 'na';
i.className = 'search-character';
i.type = 'text';
i.onfocus = function()
{
this.className = '';
};
i.onblur = function()
{
if($WH.trim(this.value) == '')
{
this.className = 'search-character';
this.value = '';
}
};
a.className = 'profiler-charlookup-go';
a.href = 'javascript:;';
a.onclick = f.onsubmit.bind(f);
$WH.ae(f, i);
$WH.ae(f, a);
$WH.ae(span, f);
}
function pr_DirectLookup(form, browse)
{
var region = $('*[name="rg"]', form),
server = $('*[name="sv"]', form),
name = $('*[name="na"]', form),
usePath;
if(region.length > 1) // Radio
region = $('*[name="rg"]:checked', form);
if(browse)
{
if(region.val() || server.val() || name.val())
location.href = '/profiles' + (region.val() ? '=' + region.val() + (server.val() ? '.' + g_urlize(server.val(), false, true) : '') : '') + (name.val() ? '?filter=na=' + name.val() + ';ex=on' : '');
return false;
}
var breadcrumb = PageTemplate.get('breadcrumb');
if(usePath = (breadcrumb && breadcrumb.length == 6)) // Realm is required
{
var path = Menu.getFullPath(mn_path, breadcrumb),
menuItem = path[path.length - 1];
}
if(!name.val())
{
alert(LANG.message_missingcharacter);
name.focus().addClass('oops');
return false;
}
if(!region.val() && !usePath)
{
alert(LANG.message_missingregion);
region.focus().addClass('oops');
return false;
}
if(!server.val() && !usePath)
{
alert(LANG.message_missingrealm);
server.focus().addClass('oops');
return false;
}
if(region.val() && server.val())
usePath = false;
location.href = (usePath ? menuItem[2].replace('profiles', 'profile') : '/profile=' + region.val() + '.' + g_urlize(server.val(), false, true)) + '.' + g_cleanCharacterName(name.val());
return false;
}
function pr_lookupOrSearch(forceLookup)
{
if(!forceLookup)
{
if($('input[name="sv"]').val())
{
var realmName = $('input[name="sv"]').val().toLowerCase(),
valid = false;
$.each(g_realms, function(i, realm) {
if(realm.name.toLowerCase() == realmName)
valid = true;
});
if(!valid)
{
alert(LANG.message_missingrealm);
$('input[name="sv"]').focus().addClass('oops');
return;
}
}
forceLookup = ($('input[name="na"]').val() && $('input[name="sv"]').val());
}
pr_DirectLookup($('.profiler-home'), !forceLookup);
}
function pr_initProfilerHome()
{
$('input[name="na"]')
.keyup(function(e) {
$(this).removeClass('oops');
if(e.keyCode == 13) // Enter
pr_lookupOrSearch(false);
})
.focus();
$('input[type="radio"]')
.change(function() {
$('label').removeClass('selected');
$('label[for="' + $(this).attr('id') + '"]').addClass('selected');
pr_suggestRealms($('input[name="rg"]:checked'), $('input[name="sv"]'), $('.profiler-autocomplete'));
$('input[name="sv"]').focus();
});
$('input[name="sv"]')
.keyup(function(e) {
switch(e.keyCode)
{
case 13: // Enter
$('.profiler-autocomplete').hide();
pr_lookupOrSearch(false);
break;
case 27: // Escape
$('.profiler-autocomplete').hide();
break;
case 38: // Up
selectedRealm--;
if(selectedRealm < 0)
selectedRealm = $('.profiler-autocomplete span').length - 1;
pr_highlightRealm(selectedRealm, $('.profiler-autocomplete'), $('input[name="sv"]'));
break;
case 40: // Down
selectedRealm++;
if(selectedRealm >= $('.profiler-autocomplete span').length)
selectedRealm = 0;
pr_highlightRealm(selectedRealm, $('.profiler-autocomplete'), $('input[name="sv"]'));
break;
default:
pr_suggestRealms($('input[name="rg"]:checked'), $('input[name="sv"]'), $('.profiler-autocomplete'));
selectedRealm = 0;
break;
}
});
$('.profiler-autocomplete')
.delegate('span', 'mouseover', function() {
$('.profiler-autocomplete span').removeClass('active');
})
.delegate('span', 'click', function() {
$('input[name="sv"]').val($(this).text()).focus();
$('.profiler-autocomplete').hide();
});
$('#profiler-lookup, #profiler-search')
.click(function(e) {
pr_lookupOrSearch(this.id == 'profiler-lookup');
});
$('body')
.click(function() {
$('.profiler-autocomplete').hide();
});
}
if($WH.isset('mn_profiles'))
{
// Add submenu to "Tools > Profiler"
Menu.findItem(mn_path, [1,5,0])[MENU_IDX_SUB] = mn_profiles;
Menu.findItem(mn_path, [1,5,2])[MENU_IDX_SUB] = mn_guilds;
Menu.findItem(mn_path, [1,5,3])[MENU_IDX_SUB] = mn_arenateams;
// todo (low): understand and use pageTemplate
// PageTemplate.getBreadcrumb().bind('update', pr_onBreadcrumbUpdate);
DomContentLoaded.addEvent(function() {
pr_onBreadcrumbUpdate();
});
}