diff --git a/engine/player/player.cpp b/engine/player/player.cpp index 7207af253fc..8276499f5d4 100644 --- a/engine/player/player.cpp +++ b/engine/player/player.cpp @@ -16440,9 +16440,9 @@ void player_t::print_parsed_effects( report::sc_html_stream& os ) const if ( !sim->report_details ) return; - os << R"(
)" - << R"(

Parsed Player Effects

)" - << R"(
)"; + os << R"(
)"; + os.format( R"(

Parsed Player Effects

)", index ); + os << R"(
)"; os << R"()" << R"()"; diff --git a/engine/report/data/html_report_script.js b/engine/report/data/html_report_script.js index 68d91a4cb48..713b9fe7eff 100644 --- a/engine/report/data/html_report_script.js +++ b/engine/report/data/html_report_script.js @@ -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'); @@ -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'); @@ -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(); }); @@ -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'); diff --git a/engine/report/data/report_data.inc b/engine/report/data/report_data.inc index e55d8319aaf..c070c957ed7 100644 --- a/engine/report/data/report_data.inc +++ b/engine/report/data/report_data.inc @@ -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 = '

NO HELP FOUND

PLEASE REPOR", -"T AS A BUG

'; } 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", +" = '

NO HELP FOUND

PLEASE REPORT AS A BUG

'; } 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 diff --git a/engine/report/report_html_player.cpp b/engine/report/report_html_player.cpp index a262bb4575c..32bd75c2b10 100644 --- a/engine/report/report_html_player.cpp +++ b/engine/report/report_html_player.cpp @@ -1181,10 +1181,10 @@ void print_html_gear( report::sc_html_stream& os, const player_t& p ) if ( p.items.empty() ) return; + os << "
\n"; + os.printf( "

Gear

\n", p.index ); + os << "
\n"; os.printf( - "
\n" - "

Gear

\n" - "
\n" "
Passive EffectsSpellIDValueSource
\n" "\n" "\n" @@ -1437,10 +1437,10 @@ void print_html_profile( report::sc_html_stream& os, const player_t& p, profile_str = util::encode_html( profile_str ); util::replace_all( profile_str, "\n", "
" ); - os << "
\n" - << "

Profile

\n" - << "
\n" - << "
\n" + os << "
\n"; + os.printf( "

Profile

\n", p.index ); + os << "
\n"; + os << "
\n" << "

" << profile_str << "

\n" << "
\n" << "
\n" @@ -1475,10 +1475,10 @@ void print_html_stats( report::sc_html_stream& os, const player_t& p ) if ( p.collected_data.fight_length.mean() > 0 ) { - os << "
\n" - << "

Stats

\n" - << "
\n" - << "
\n" + os << "
\n"; + os.printf( "

Stats

\n", p.index ); + os << "
\n"; + os << "
\n" << "\n" << "\n" << "\n" @@ -2042,22 +2042,17 @@ void print_html_talents( report::sc_html_stream& os, const player_t& p ) *points_ptr += _rank; } - os << "
\n" - << "

Talents

\n" - << "
\n"; + os << "
\n"; + os.printf( "

Talents

\n", p.index ); + os << "
\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( 1165 - max_col * 28 ); - os.format( R"()", - 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( 1165 - max_col * 28 ); + os.format( R"()", + 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 << "

Talent Tables

\n" - << "
\n"; - } + os.printf( "

Talent Tables

\n", p.index ); + os << "
\n"; if ( range::accumulate( class_traits, 0, &std::vector::size ) ) { @@ -2087,11 +2082,8 @@ void print_html_talents( report::sc_html_stream& os, const player_t& p ) os << "
\n"; } - // Close the talent table div only if it exists. - if ( num_players == 1 ) - os << "
\n"; - os << "
\n" + << "
\n" << "
\n"; } @@ -2475,9 +2467,9 @@ void print_html_sample_sequence_table_entry( report::sc_html_stream& os, void print_html_player_action_priority_list( report::sc_html_stream& os, const player_t& p ) { const sim_t& sim = *( p.sim ); - os << "
\n" - << "

Action Priority List

\n" - << "
\n"; + os << "
\n"; + os.printf( "

Action Priority List

\n", p.index ); + os << "
\n"; action_priority_list_t* alist = nullptr; @@ -2652,10 +2644,10 @@ void print_html_player_statistics( report::sc_html_stream& os, const player_t& p { // Statistics & Data Analysis - os << "
\n" - "

Statistics & Data Analysis

\n" - "
\n" - "
\n"; + os << "
\n"; + os.printf( "

Statistics & Data Analysis

\n", p.index ); + os << "
\n"; + os << "
\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" ); @@ -2673,8 +2665,8 @@ void print_html_player_statistics( report::sc_html_stream& os, const player_t& p report_helper::print_html_sample_data( os, p, *sample_data, util::encode_html( sample_data->name_str ) ); } - os << "
\n" - "
\n" + os << "\n"; + os << "
\n" "
\n"; } @@ -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 << "
\n"; // Open DIV for charts + os << "
\n"; + os << "
\n"; // Open DIV for charts for ( resource_e r = RESOURCE_MAX; --r > RESOURCE_NONE; ) { @@ -3721,7 +3714,7 @@ 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 << "
\n"; + os << "
\n"; os << "

\n"; + os.printf( R"(\n"; os << "

\n" << "
\n\n"; } diff --git a/engine/report/report_html_sim.cpp b/engine/report/report_html_sim.cpp index 32dac66b791..fd0b58d94ab 100644 --- a/engine/report/report_html_sim.cpp +++ b/engine/report/report_html_sim.cpp @@ -58,7 +58,7 @@ void print_html_contents( report::sc_html_stream& os, const sim_t& sim ) } } - os << "
\n" + os << "
\n" << "

Table of Contents

\n" << "
\n"; @@ -349,7 +349,7 @@ void print_html_sim_summary( report::sc_html_stream& os, sim_t& sim ) void print_html_raid_summary( report::sc_html_stream& os, sim_t& sim ) { - os << "
\n\n" + os << "
\n\n" << "

Raid Summary

\n" << "
\n"; @@ -377,16 +377,18 @@ void print_html_raid_summary( report::sc_html_stream& os, sim_t& sim ) { raid_dps.width_ += raid_dps.width_ + 12; raid_dps.set( "chart.marginLeft", margin ); + raid_dps.set( "plotOptions.series.animation", false ); // no initial draw animation on the main DPS chart os << raid_dps.to_target_div(); - sim.add_chart_data( raid_dps ); + os << "\n"; } if ( has_priority ) { priority_dps.width_ += priority_dps.width_ + 12; priority_dps.set( "chart.marginLeft", margin ); + priority_dps.set( "plotOptions.series.animation", false ); os << priority_dps.to_target_div(); - sim.add_chart_data( priority_dps ); + os << "\n"; } if ( !sim.raid_events_str.empty() ) @@ -888,7 +890,7 @@ void print_html_hotfixes( report::sc_html_stream& os, const sim_t& sim ) { std::vector entries = hotfix::hotfix_entries(); - os << "
\n"; + os << "
\n"; os << "

Current simulator hotfixes

\n"; os << "
\n"; @@ -1156,7 +1158,7 @@ void print_profilesets( std::ostream& out, const profileset::profilesets_t& prof return; } - out << "
\n"; + out << "
\n"; out << "

Profile sets

\n"; out << "
\n"; @@ -1276,15 +1278,7 @@ void print_html_( report::sc_html_stream& os, sim_t& sim ) if ( sim.decorated_tooltips ) { - //Apply the prettification stuff only if its a single report - if ( num_players > 1 ) - { - os << R"()"; - } - else - { - os << R"()"; - } + os << R"()"; if ( !sim.offline ) os << std::endl << R"()"; @@ -1300,14 +1294,6 @@ void print_html_( report::sc_html_stream& os, sim_t& sim ) print_html_report_scripts( os ); os << "\n\n"; - os << "\n"; os << "