chg: [decaying:JS] refacto - declare local variable

pull/5032/head
mokaddem 2019-08-23 09:26:42 +02:00
parent b39f355ef8
commit 79af3e9c33
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 8 additions and 8 deletions

View File

@ -17,8 +17,8 @@ function addTagWithValue(clicked) {
function addPickedTags(clicked) {
var numerical_values = [];
$select = $('#basescore-example-tag-picker');
$previous_tags = $('#basescore-example-customtag-container span.decayingExampleTags');
var $select = $('#basescore-example-tag-picker');
var $previous_tags = $('#basescore-example-customtag-container span.decayingExampleTags');
$previous_tags.each(function() {
numerical_values.push({name: $(this).text().split(':')[0], value: parseInt($(this).data('numerical_value'))});
});
@ -43,7 +43,7 @@ function removeCustomTag(clicked) {
$(clicked).parent().tooltip('destroy');
$(clicked).add($(clicked).prev()).remove();
var numerical_values = [];
$previous_tags = $('#basescore-example-customtag-container span.decayingExampleTags');
var $previous_tags = $('#basescore-example-customtag-container span.decayingExampleTags');
$previous_tags.each(function() {
numerical_values.push({name: $(this).text().split(':')[0], value: parseInt($(this).data('numerical_value'))});
});
@ -210,8 +210,8 @@ function genHelpBaseScoreComputation(e, index) {
function refreshExamples() {
for (var i = 1; i <= 3; i++) {
var numerical_values = [];
tags = pickRandomTags();
tags_html = '<div style="display: flex; flex-flow: wrap;">';
var tags = pickRandomTags();
var tags_html = '<div style="display: flex; flex-flow: wrap;">';
tags.forEach(function(tag) {
numerical_values.push({name: tag.name.split(':')[0], value: tag['numerical_value']});
var text_color = getTextColour(tag.colour);

View File

@ -4286,18 +4286,18 @@ function jsonToNestedTable(json, header, table_classes) {
}
header = header === undefined ? [] : header;
table_classes = table_classes === undefined ? [] : table_classes;
$table = $('<table></table>');
var $table = $('<table></table>');
table_classes.forEach(function(classname) {
$table.addClass(classname);
});
if (header.length > 0) {
$header = $('<thead><tr></tr></thead>');
var $header = $('<thead><tr></tr></thead>');
header.forEach(function(col) {
$header.child().append($('<td>' + col + '</td>'));
});
$table.append($header);
}
$body = $('<tbody></tbody>');
var $body = $('<tbody></tbody>');
Object.keys(json).forEach(function(k) {
var value = json[k];
if (typeof value === 'object') {