Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions engine/report/data/html_report_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ jQuery(document).ready(function ($) {
scrollTop: $anchor.parent().offset().top - $anchor.height()
}, 300);
});
$('.toggle').click(function (e) {
$(document).on('click', '.toggle', function (e) {
e.preventDefault();
var $me = $(this);
revealSection(this.id);
$me.toggleClass('open');
$me.next('.toggle-content').slideToggle(150);
var section = $me.parent('.section');
Expand All @@ -86,10 +87,11 @@ jQuery(document).ready(function ($) {
}
}
});
$('.toggle-details').click(function (e) {
$(document).on('click', '.toggle-details', function (e) {
e.preventDefault();
e.stopPropagation();
var $me = $(this);
if ( this.id ) renderCharts(this.id);
var $row = $me.closest('tr').nextAll('.details').first();
if ($me.hasClass('open')) {
$me.removeClass('open');
Expand All @@ -99,16 +101,30 @@ jQuery(document).ready(function ($) {
$row.fadeToggle(150);
}
});
$('.toggle, .toggle-details').each(function() {
if ( __chartData[this.id] === undefined ) return;
$(this).one('click', function() {
var d = __chartData[this.id];
for (var idx in d) {
$('#' + d[idx]['target']).highcharts(d[idx]['data']);
function renderCharts(key) {
var items = __chartData[key];
if ( items === undefined ) return;
items.forEach(function(chart) {
var $el = $('#' + chart.target);
if ( $el.length && !$el.highcharts() ) {
$el.highcharts(chart.data);
}
});
});
$('table.stripetoprow .toprow td:first-of-type, table.stripebody tbody td:first-of-type').click(function (e) {
}
function revealSection(id) {
var $deferred = id ? $('script[type="text/x-deferred-html"][data-toggle="' + id + '"]') : $();
if ( $deferred.length ) {
$deferred.each(function() {
$(this).replaceWith($($.parseHTML(this.textContent)));
});
$('.stripetoprow').oddstripe();
renderCharts('');
}
if ( id ) renderCharts(id);
}
$('.toggle.open').each(function() { revealSection(this.id); });
renderCharts('');
$(document).on('click', 'table.stripetoprow .toprow td:first-of-type, table.stripebody tbody td:first-of-type', function (e) {
e.preventDefault();
$(this).children('.toggle-details').first().click();
});
Expand Down Expand Up @@ -202,7 +218,7 @@ jQuery(document).ready(function ($) {
$cells.removeClass('pulse');
}, 150);
}
$('.sort').on('click', 'th.toggle-sort', function (e) {
$(document).on('click', '.sort th.toggle-sort', function (e) {
e.preventDefault();
var $me = $(this);
var $col = $me.closest('th');
Expand Down
92 changes: 48 additions & 44 deletions engine/report/data/report_data.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1135,50 +1135,54 @@ static const char* __html_report_script[] = {
"$('a.ext').mouseover(function () { $(this).attr('target', '_blank'); }); $('ul.toc li a').click(function (e) { e.pre",
"ventDefault(); var href = this.getAttribute('href'); var $anchor = $(href).children('h2').first(); if (!$anchor.hasC",
"lass('open')) { $anchor.click(); } $('html, body').animate( { scrollTop: $anchor.parent().offset().top - $anchor.hei",
"ght() }, 300); }); $('.toggle').click(function (e) { e.preventDefault(); var $me = $(this); $me.toggleClass('open');",
" $me.next('.toggle-content').slideToggle(150); var section = $me.parent('.section'); if (section.length) { section.v",
"alidate_section(); if ($me.hasClass('open')) { var wh = $(window).height() / 3; var pos = section[0].getBoundingClie",
"ntRect().top; if (pos > wh * 2) { $('html, body').animate( { scrollTop: section.offset().top - wh }, 300); } } } });",
" $('.toggle-details').click(function (e) { e.preventDefault(); e.stopPropagation(); var $me = $(this); var $row = $m",
"e.closest('tr').nextAll('.details').first(); if ($me.hasClass('open')) { $me.removeClass('open'); $row.fadeToggle(75",
"); } else { $me.addClass('open'); $row.fadeToggle(150); } }); $('.toggle, .toggle-details').each(function() { if ( _",
"_chartData[this.id] === undefined ) return; $(this).one('click', function() { var d = __chartData[this.id]; for (var",
" idx in d) { $('#' + d[idx]['target']).highcharts(d[idx]['data']); } }); }); $('table.stripetoprow .toprow td:first-",
"of-type, table.stripebody tbody td:first-of-type').click(function (e) { e.preventDefault(); $(this).children('.toggl",
"e-details').first().click(); }); var hoverTimeout; function hoverHide() { clearTimeout(hoverTimeout); $('#active-hel",
"p','.help-box').hide(); $('#active-help').removeAttr('style'); } $('.help').hover(function (e) { var $target = $(thi",
"s.dataset.help + ' .help-box'); var content; if (!$target.length) { content = '<h3>NO HELP FOUND</h3><p>PLEASE REPOR",
"T AS A BUG</p>'; } else { content = $target.html(); } $('#active-help-dynamic .help-box').html(content); $('#active-",
"help .help-box').show(); var pos = $(this).offset(); $('#active-help').css({ top: pos.top - $('#active-help').height",
"() - $(this).height(), left: pos.left, }); hoverTimeout = setTimeout(function() { $('#active-help').fadeIn(300); }, ",
"750); }, hoverHide); window.onblur = hoverHide; function getCell(elem, i, both) { var $row; var ret; var idx = i; if",
" ($(elem).is('tr')) { $row = $(elem); } else { $row = $(elem).find('tr').first(); } ret = $row.children('td').eq(idx",
").text().trim(); if (!ret.length && both) { var span = $row.children('td[rowspan]').length; $row = $row.nextAll('.ch",
"ildrow').first(); if ($row.length && idx >= span) { idx -= span; ret = $row.children('td').eq(idx).text().trim(); } ",
"} return ret; } function strip(val) { return val.slice(val.indexOf('\\xa0') + 1).replace(/[^\\d.-]/g,''); } function",
" numberSort(a, b, i, dsc, both) { var va = +strip(getCell(a, i, both)) || 0; var vb = +strip(getCell(b, i, both)) ||",
" 0; return dsc \? vb - va : va - vb; } function alphaSort(a, b, i, dsc, both) { var va = getCell(a, i, both); var vb",
" = getCell(b, i, both); if (dsc) { return va < vb \? 1 : -1; } else { return va > vb \? 1 : -1; } } function pulseco",
"lumn(table, index, both) { var $cells = $(); if (table.hasClass('stripetoprow')) { table.find('.toprow:not(.childrow",
")').each(function() { var me = $(this); var cell = me.children('td').eq(index); if (both && (!cell.length || cell.is",
"(':empty'))) { var span = me.children('td[rowspan]').length; var row = me.nextAll('.childrow').first(); if (row.leng",
"th && index >= span) { cell = row.children('td').eq(index - span); } } if (cell.length && !cell.is(':empty')) { $.me",
"rge($cells, cell); } }); } else if (table.hasClass('stripebody')) { $cells = table.find('tbody tr:first-of-type td:n",
"th-of-type(' + (index + 1) + '):not(:empty)'); } else { $cells = table.find('tbody tr td:nth-of-type(' + (index + 1)",
" + '):not(:empty)'); } $cells.addClass('pulse'); setTimeout(function () { $cells.removeClass('pulse'); }, 150); } $(",
"'.sort').on('click', 'th.toggle-sort', function (e) { e.preventDefault(); var $me = $(this); var $col = $me.closest(",
"'th'); var $thd = $col.closest('thead'); var $tbl = $thd.closest('table.sort'); var $sib = $col.siblings('.asc-sorte",
"d, .dsc-sorted'); $sib.removeClass('asc-sorted dsc-sorted'); var idx = $col.index(); var doAlpha = this.dataset.sort",
"type == 'alpha'; var doAsc = this.dataset.sortdir == 'asc'; var doRows = this.dataset.sortrows == 'both'; if (!($me.",
"hasClass('dsc-sorted') || $me.hasClass('asc-sorted'))) { $me.toggleClass('dsc-sorted', !doAsc); } else { $me.toggleC",
"lass('dsc-sorted'); } var isDsc = $me.hasClass('dsc-sorted'); $me.toggleClass('asc-sorted', !isDsc); var srt; if (do",
"Alpha) { srt = function(i, dsc, both) { return function(a, b) { return alphaSort(a, b, i, dsc, both); }; }; } else {",
" srt = function(i, dsc, both) { return function(a, b) { return numberSort(a, b, i, dsc, both); }; }; } var $bucket =",
" $thd.nextUntil('.petrow'); if ($bucket.length == 1) { $bucket = $bucket.children('tr').first().nextUntil('.petrow')",
".addBack(); } var $remain = $bucket.last().nextAll(); var $petrow; do { $bucket.sort(srt(idx, isDsc, doRows)); $tbl.",
"append($bucket); if (!$remain.length) { break; } $tbl.append($remain); $petrow = $remain.first(); $bucket = $petrow.",
"nextUntil('.petrow'); $remain = $bucket.last().nextAll(); } while ($bucket.length > 1); if ($tbl.hasClass('stripetop",
"row')) { $tbl.oddstripe(); } pulsecolumn($tbl, idx, doRows); });});",
"ght() }, 300); }); $(document).on('click', '.toggle', function (e) { e.preventDefault(); var $me = $(this); revealSe",
"ction(this.id); $me.toggleClass('open'); $me.next('.toggle-content').slideToggle(150); var section = $me.parent('.se",
"ction'); if (section.length) { section.validate_section(); if ($me.hasClass('open')) { var wh = $(window).height() /",
" 3; var pos = section[0].getBoundingClientRect().top; if (pos > wh * 2) { $('html, body').animate( { scrollTop: sect",
"ion.offset().top - wh }, 300); } } } }); $(document).on('click', '.toggle-details', function (e) { e.preventDefault(",
"); e.stopPropagation(); var $me = $(this); if ( this.id ) renderCharts(this.id); var $row = $me.closest('tr').nextAl",
"l('.details').first(); if ($me.hasClass('open')) { $me.removeClass('open'); $row.fadeToggle(75); } else { $me.addCla",
"ss('open'); $row.fadeToggle(150); } }); function renderCharts(key) { var items = __chartData[key]; if ( items === un",
"defined ) return; items.forEach(function(chart) { var $el = $('#' + chart.target); if ( $el.length && !$el.highchart",
"s() ) { $el.highcharts(chart.data); } }); } function revealSection(id) { var $deferred = id \? $('script[type=\"text",
"/x-deferred-html\"][data-toggle=\"' + id + '\"]') : $(); if ( $deferred.length ) { $deferred.each(function() { $(thi",
"s).replaceWith($($.parseHTML(this.textContent))); }); $('.stripetoprow').oddstripe(); renderCharts(''); } if ( id ) ",
"renderCharts(id); } $('.toggle.open').each(function() { revealSection(this.id); }); renderCharts(''); $(document).on",
"('click', 'table.stripetoprow .toprow td:first-of-type, table.stripebody tbody td:first-of-type', function (e) { e.p",
"reventDefault(); $(this).children('.toggle-details').first().click(); }); var hoverTimeout; function hoverHide() { c",
"learTimeout(hoverTimeout); $('#active-help','.help-box').hide(); $('#active-help').removeAttr('style'); } $('.help')",
".hover(function (e) { var $target = $(this.dataset.help + ' .help-box'); var content; if (!$target.length) { content",
" = '<h3>NO HELP FOUND</h3><p>PLEASE REPORT AS A BUG</p>'; } else { content = $target.html(); } $('#active-help-dynam",
"ic .help-box').html(content); $('#active-help .help-box').show(); var pos = $(this).offset(); $('#active-help').css(",
"{ top: pos.top - $('#active-help').height() - $(this).height(), left: pos.left, }); hoverTimeout = setTimeout(functi",
"on() { $('#active-help').fadeIn(300); }, 750); }, hoverHide); window.onblur = hoverHide; function getCell(elem, i, b",
"oth) { var $row; var ret; var idx = i; if ($(elem).is('tr')) { $row = $(elem); } else { $row = $(elem).find('tr').fi",
"rst(); } ret = $row.children('td').eq(idx).text().trim(); if (!ret.length && both) { var span = $row.children('td[ro",
"wspan]').length; $row = $row.nextAll('.childrow').first(); if ($row.length && idx >= span) { idx -= span; ret = $row",
".children('td').eq(idx).text().trim(); } } return ret; } function strip(val) { return val.slice(val.indexOf('\\xa0')",
" + 1).replace(/[^\\d.-]/g,''); } function numberSort(a, b, i, dsc, both) { var va = +strip(getCell(a, i, both)) || 0",
"; var vb = +strip(getCell(b, i, both)) || 0; return dsc \? vb - va : va - vb; } function alphaSort(a, b, i, dsc, bot",
"h) { var va = getCell(a, i, both); var vb = getCell(b, i, both); if (dsc) { return va < vb \? 1 : -1; } else { retur",
"n va > vb \? 1 : -1; } } function pulsecolumn(table, index, both) { var $cells = $(); if (table.hasClass('stripetopr",
"ow')) { table.find('.toprow:not(.childrow)').each(function() { var me = $(this); var cell = me.children('td').eq(ind",
"ex); if (both && (!cell.length || cell.is(':empty'))) { var span = me.children('td[rowspan]').length; var row = me.n",
"extAll('.childrow').first(); if (row.length && index >= span) { cell = row.children('td').eq(index - span); } } if (",
"cell.length && !cell.is(':empty')) { $.merge($cells, cell); } }); } else if (table.hasClass('stripebody')) { $cells ",
"= table.find('tbody tr:first-of-type td:nth-of-type(' + (index + 1) + '):not(:empty)'); } else { $cells = table.find",
"('tbody tr td:nth-of-type(' + (index + 1) + '):not(:empty)'); } $cells.addClass('pulse'); setTimeout(function () { $",
"cells.removeClass('pulse'); }, 150); } $(document).on('click', '.sort th.toggle-sort', function (e) { e.preventDefau",
"lt(); var $me = $(this); var $col = $me.closest('th'); var $thd = $col.closest('thead'); var $tbl = $thd.closest('ta",
"ble.sort'); var $sib = $col.siblings('.asc-sorted, .dsc-sorted'); $sib.removeClass('asc-sorted dsc-sorted'); var idx",
" = $col.index(); var doAlpha = this.dataset.sorttype == 'alpha'; var doAsc = this.dataset.sortdir == 'asc'; var doRo",
"ws = this.dataset.sortrows == 'both'; if (!($me.hasClass('dsc-sorted') || $me.hasClass('asc-sorted'))) { $me.toggleC",
"lass('dsc-sorted', !doAsc); } else { $me.toggleClass('dsc-sorted'); } var isDsc = $me.hasClass('dsc-sorted'); $me.to",
"ggleClass('asc-sorted', !isDsc); var srt; if (doAlpha) { srt = function(i, dsc, both) { return function(a, b) { retu",
"rn alphaSort(a, b, i, dsc, both); }; }; } else { srt = function(i, dsc, both) { return function(a, b) { return numbe",
"rSort(a, b, i, dsc, both); }; }; } var $bucket = $thd.nextUntil('.petrow'); if ($bucket.length == 1) { $bucket = $bu",
"cket.children('tr').first().nextUntil('.petrow').addBack(); } var $remain = $bucket.last().nextAll(); var $petrow; d",
"o { $bucket.sort(srt(idx, isDsc, doRows)); $tbl.append($bucket); if (!$remain.length) { break; } $tbl.append($remain",
"); $petrow = $remain.first(); $bucket = $petrow.nextUntil('.petrow'); $remain = $bucket.last().nextAll(); } while ($",
"bucket.length > 1); if ($tbl.hasClass('stripetoprow')) { $tbl.oddstripe(); } pulsecolumn($tbl, idx, doRows); });});",
};

// Automatically generated from file style.css
Expand Down
49 changes: 20 additions & 29 deletions engine/report/report_html_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2046,18 +2046,13 @@ void print_html_talents( report::sc_html_stream& os, const player_t& p )
<< "<h3 class=\"toggle\">Talents</h3>\n"
<< "<div class=\"toggle-content hide\">\n";

auto num_players = p.sim->players_by_name.size();
if ( num_players == 1 )
{
auto max_col = class_columns( p.specialization(), p.is_ptr() ) + spec_columns( p.specialization(), p.is_ptr() );
auto h_ = static_cast<int>( 1165 - max_col * 28 );
os.format( R"(<iframe src="{}" width="1165" height="{}"></iframe>)",
raidbots_talent_render_src( p.talents_str, p.true_level, 1165, false, p.dbc->ptr ), h_ );
auto max_col = class_columns( p.specialization(), p.is_ptr() ) + spec_columns( p.specialization(), p.is_ptr() );
auto h_ = static_cast<int>( 1165 - max_col * 28 );
os.format( R"(<iframe src="{}" width="1165" height="{}" style="background:#160f0b"></iframe>)",
raidbots_talent_render_src( p.talents_str, p.true_level, 1165, false, p.dbc->ptr ), h_ );

// Hide the talent table only if the Raidbots talent iframe is present.
os << "<h3 class=\"toggle\">Talent Tables</h3>\n"
<< "<div class=\"toggle-content hide\">\n";
}
os << "<h3 class=\"toggle\">Talent Tables</h3>\n"
<< "<div class=\"toggle-content hide\">\n";

if ( range::accumulate( class_traits, 0, &std::vector<talentrank_t>::size ) )
{
Expand Down Expand Up @@ -2087,11 +2082,8 @@ void print_html_talents( report::sc_html_stream& os, const player_t& p )
os << "</div>\n";
}

// Close the talent table div only if it exists.
if ( num_players == 1 )
os << "</div>\n";

os << "</div>\n"
<< "</div>\n"
<< "</div>\n";
}

Expand Down Expand Up @@ -2653,9 +2645,9 @@ void print_html_player_statistics( report::sc_html_stream& os, const player_t& p
// Statistics & Data Analysis

os << "<div class=\"player-section analysis\">\n"
"<h3 class=\"toggle\">Statistics & Data Analysis</h3>\n"
"<div class=\"toggle-content hide\">\n"
"<table class=\"sc stripebody\">\n";
<< "<h3 class=\"toggle\">Statistics & Data Analysis</h3>\n"
<< "<div class=\"toggle-content hide\">\n"
<< "<table class=\"sc stripebody\">\n";

report_helper::print_html_sample_data( os, p, p.collected_data.fight_length, "Fight Length" );
report_helper::print_html_sample_data( os, p, p.collected_data.dps, "DPS" );
Expand All @@ -2674,8 +2666,8 @@ void print_html_player_statistics( report::sc_html_stream& os, const player_t& p
}

os << "</table>\n"
"</div>\n"
"</div>\n";
<< "</div>\n"
<< "</div>\n";
}

// print_html_player_statistics =============================================
Expand Down Expand Up @@ -2994,7 +2986,8 @@ void print_html_player_resources( report::sc_html_stream& os, const player_t& p
print_html_resource_changes_table( os, p );
}

os << "</div><div class=\"column-charts\">\n"; // Open DIV for charts
os << "</div>\n"
<< "<div class=\"column-charts\">\n"; // Open DIV for charts

for ( resource_e r = RESOURCE_MAX; --r > RESOURCE_NONE; )
{
Expand Down Expand Up @@ -3721,13 +3714,8 @@ void print_html_player_description( report::sc_html_stream& os, const player_t&
bool one_player = sim.players_by_name.size() == 1 && !p.is_enemy() && sim.profilesets->n_profilesets() == 0;

// Player Description
os << "<div id=\"player" << p.index << "\" class=\"player section\">\n";

os << "<h2 id=\"player" << p.index << "toggle\" class=\"toggle";
if ( one_player )
{
os << " open";
}
os.printf( R"(<div id="player%d" class="player section%s">)""\n", p.index, (one_player ? " section-open" : "" ) );
os.printf( R"(<h2 id="player%dtoggle" class="toggle%s")", p.index, (one_player ? " open" : "" ) );

const std::string n = util::encode_html( p.name() );
if ( ( p.collected_data.dps.mean() >= p.collected_data.hps.mean() && sim.enemy_targets > 1 ) ||
Expand Down Expand Up @@ -3766,6 +3754,8 @@ void print_html_player_description( report::sc_html_stream& os, const player_t&
}
os << "\">\n";

os.printf( R"(<script type="text/x-deferred-html" data-toggle="player%dtoggle">)", p.index );

os << "<ul class=\"params\">\n";
#if SC_BETA
os << "<li><b>BETA activated</b></li>\n";
Expand Down Expand Up @@ -3836,7 +3826,7 @@ void print_html_player_results_spec_gear( report::sc_html_stream& os, const play

os << "<div class=\"toggle-content\">\n";

if ( p.sim->players_by_name.size() == 1 && p.is_player() )
if ( p.is_player() )
{
auto max_col = class_columns( p.specialization(), p.is_ptr() ) + spec_columns( p.specialization(), p.is_ptr() );
auto w_ = static_cast<int>( max_col * 12.5 - 25 );
Expand Down Expand Up @@ -4987,6 +4977,7 @@ void print_html_player_( report::sc_html_stream& os, const player_t& p )

// print_html_player_gear_weights( os, p, p.report_information );

os << "</script>\n";
os << "</div>\n"
<< "</div>\n\n";
}
Expand Down
Loading
Loading