|
630 | 630 | template += '<div class="bu-is-flex">\
|
631 | 631 | <div class="chart-tooltip__bar bu-mr-2 bu-mt-1" style="background-color: ' + params.color + ';"></div>\
|
632 | 632 | <div>\
|
633 |
| - <div class="chart-tooltip__header text-smaller font-weight-bold bu-mb-3">' + countlyCommon.encodeHtml(params.seriesName) + '</div>\ |
634 |
| - <div class="text-small"> ' + countlyCommon.encodeHtml(params.data.name) + '</div>\ |
635 |
| - <div class="text-big">' + formatter(countlyCommon.encodeHtml(params.data.value)) + '</div>\ |
| 633 | + <div class="chart-tooltip__header text-smaller font-weight-bold bu-mb-3">' + this.sanitizeHtml(params.seriesName) + '</div>\ |
| 634 | + <div class="text-small"> ' + this.sanitizeHtml(params.data.name) + '</div>\ |
| 635 | + <div class="text-big">' + formatter(this.sanitizeHtml(params.data.value)) + '</div>\ |
636 | 636 | </div>\
|
637 | 637 | </div>';
|
638 | 638 |
|
|
641 | 641 | else {
|
642 | 642 | template = "<div class='chart-tooltip" + ((params.length > 10) ? " chart-tooltip__has-scroll" : "") + "'>";
|
643 | 643 | if (params.length > 0) {
|
644 |
| - template += "<span class='chart-tooltip__header text-smaller font-weight-bold'>" + countlyCommon.encodeHtml(params[0].axisValueLabel) + "</span></br>"; |
| 644 | + template += "<span class='chart-tooltip__header text-smaller font-weight-bold'>" + this.sanitizeHtml(params[0].axisValueLabel) + "</span></br>"; |
645 | 645 | }
|
646 | 646 |
|
647 | 647 | if (self.sortBy === "index") {
|
|
670 | 670 | template += '<div class="chart-tooltip__body' + ((params.length > 4) ? " chart-tooltip__single-row" : " ") + '">\
|
671 | 671 | <div class="chart-tooltip__bar" style="background-color: ' + params[i].color + ';"></div>\
|
672 | 672 | <div class="chart-tooltip__series">\
|
673 |
| - <span class="text-small">' + countlyCommon.encodeHtml(params[i].seriesName) + '</span>\ |
| 673 | + <span class="text-small">' + this.sanitizeHtml(params[i].seriesName) + '</span>\ |
674 | 674 | </div>\
|
675 | 675 | <div class="chart-tooltip__value">\
|
676 |
| - <span class="text-big">' + (typeof params[i].value === 'object' ? formatter((isNaN(countlyCommon.encodeHtml(params[i].value[1])) ? 0 : countlyCommon.encodeHtml(params[i].value[1])), countlyCommon.encodeHtml(params[i].value), i) : formatter((isNaN(params[i].value) ? 0 : countlyCommon.encodeHtml(params[i].value)), null, i)) + '</span>\ |
| 676 | + <span class="text-big">' + (typeof params[i].value === 'object' ? formatter((isNaN(this.sanitizeHtml(params[i].value[1])) ? 0 : this.sanitizeHtml(params[i].value[1])), this.sanitizeHtml(params[i].value), i) : formatter((isNaN(params[i].value) ? 0 : this.sanitizeHtml(params[i].value)), null, i)) + '</span>\ |
677 | 677 | </div>\
|
678 | 678 | </div>';
|
679 | 679 | }
|
|
727 | 727 | show: true,
|
728 | 728 | color: "#81868D",
|
729 | 729 | fontSize: 12,
|
730 |
| - formatter: function(value) { |
| 730 | + formatter: (value) => { |
731 | 731 | if (typeof value === "number") {
|
732 |
| - return countlyCommon.getShortNumber(countlyCommon.encodeHtml(value)); |
| 732 | + return countlyCommon.getShortNumber(this.sanitizeHtml(value)); |
733 | 733 | }
|
734 | 734 | return value;
|
735 | 735 | }
|
|
867 | 867 |
|
868 | 868 | return options;
|
869 | 869 | },
|
| 870 | + sanitizeHtml: function(value) { |
| 871 | + if (value) { |
| 872 | + value = countlyCommon.encodeHtml(value); |
| 873 | + return countlyCommon.unescapeHtml(value); |
| 874 | + } |
| 875 | + return value; |
| 876 | + } |
870 | 877 | }
|
871 | 878 | });
|
872 | 879 |
|
|
1113 | 1120 | </div>\
|
1114 | 1121 | <div class="graph-tooltip-wrapper__container">';
|
1115 | 1122 | }
|
1116 |
| - template += '<div class="' + countlyCommon.encodeHtml(conditionalClassName) + '">\ |
1117 |
| - <div class="bu-mb-1"><span class="text-small color-cool-gray-50">#' + countlyCommon.encodeHtml(filteredNotes[i].indicator) + '</span></div>\ |
| 1123 | + template += '<div class="' + this.sanitizeHtml(conditionalClassName) + '">\ |
| 1124 | + <div class="bu-mb-1"><span class="text-small color-cool-gray-50">#' + this.sanitizeHtml(filteredNotes[i].indicator) + '</span></div>\ |
1118 | 1125 | <div class="bu-is-flex bu-is-justify-content-space-between graph-notes-tooltip__header">\
|
1119 | 1126 | <div class="bu-is-flex bu-is-flex-direction-column">\
|
1120 |
| - <div class="text-small input-owner">' + countlyCommon.encodeHtml(filteredNotes[i].owner_name) + '</div>\ |
| 1127 | + <div class="text-small input-owner">' + this.sanitizeHtml(filteredNotes[i].owner_name) + '</div>\ |
1121 | 1128 | <div class="text-small color-cool-gray-50 note-date">' + moment(filteredNotes[i].ts).format("MMM D, YYYY hh:mm A") + '</div>\
|
1122 | 1129 | </div>\
|
1123 | 1130 | <div class="bu-is-flex bu-is-flex-direction-column bu-is-align-items-flex-end">\
|
1124 |
| - <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + countlyCommon.encodeHtml(filteredNotes[i].noteType) + '</span>\ |
| 1131 | + <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + this.sanitizeHtml(filteredNotes[i].noteType) + '</span>\ |
1125 | 1132 | </div>\
|
1126 | 1133 | </div>\
|
1127 |
| - <div class="bu-mt-2 graph-notes-tooltip__body"><span class="text-small input-notes input-minimizer">' + countlyCommon.encodeHtml(filteredNotes[i].note) + '</span></div>\ |
| 1134 | + <div class="bu-mt-2 graph-notes-tooltip__body"><span class="text-small input-notes input-minimizer">' + this.sanitizeHtml(filteredNotes[i].note) + '</span></div>\ |
1128 | 1135 | </div>';
|
1129 | 1136 | if (i === filteredNotes.length) {
|
1130 | 1137 | template = "</div>";
|
1131 | 1138 | }
|
1132 | 1139 | }
|
1133 | 1140 | }
|
1134 | 1141 | else {
|
1135 |
| - template += '<div class="' + countlyCommon.encodeHtml(conditionalClassName) + '">\ |
| 1142 | + template += '<div class="' + this.sanitizeHtml(conditionalClassName) + '">\ |
1136 | 1143 | <div class="bu-is-flex bu-is-justify-content-space-between graph-notes-tooltip__header">\
|
1137 | 1144 | <div class="bu-is-flex bu-is-flex-direction-column name-wrapper">\
|
1138 |
| - <div class="text-medium input-owner">' + countlyCommon.encodeHtml(params.data.note.owner_name) + '</div>\ |
| 1145 | + <div class="text-medium input-owner">' + this.sanitizeHtml(params.data.note.owner_name) + '</div>\ |
1139 | 1146 | <div class="text-small color-cool-gray-50 note-date">' + moment(params.data.note.ts).format("MMM D, YYYY hh:mm A") + '</div>\
|
1140 | 1147 | </div>\
|
1141 | 1148 | <div class="bu-is-flex bu-is-flex-direction-column bu-is-align-items-flex-end">\
|
1142 | 1149 | <span onClick="window.hideGraphTooltip()">\
|
1143 | 1150 | <i class="el-icon-close"></i>\
|
1144 | 1151 | </span>\
|
1145 |
| - <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + countlyCommon.encodeHtml(params.data.note.noteType) + '</span>\ |
| 1152 | + <span class="text-small color-cool-gray-50 bu-is-capitalized note-type">' + this.sanitizeHtml(params.data.note.noteType) + '</span>\ |
1146 | 1153 | </div>\
|
1147 | 1154 | </div>\
|
1148 |
| - <div class="graph-notes-tooltip__body"><span class="text-medium input-notes">' + countlyCommon.encodeHtml(params.data.note.note) + '</span></div>\ |
| 1155 | + <div class="graph-notes-tooltip__body"><span class="text-medium input-notes">' + this.sanitizeHtml(params.data.note.note) + '</span></div>\ |
1149 | 1156 | </div>';
|
1150 | 1157 | }
|
1151 | 1158 | return template;
|
|
0 commit comments