Rewrite code to es5 (hint manager)

This commit is contained in:
JuliaSvinareva 2021-07-23 12:56:58 +03:00
parent ebfc5ee7d8
commit c7b877ae9a

View file

@ -183,8 +183,8 @@ Common.UI.HintManager = new(function() {
}; };
var _getLetters = function(countButtons) { var _getLetters = function(countButtons) {
var arr = [..._arrAlphabet]; var arr = _arrAlphabet.slice();
arr[0] = _arrAlphabet[0].repeat(2); arr[0] = _arrAlphabet[0] + _arrAlphabet[0];
for (var i = 1; arr.length < countButtons; i++) { for (var i = 1; arr.length < countButtons; i++) {
arr.push(_arrAlphabet[0] + _arrAlphabet[i]); arr.push(_arrAlphabet[0] + _arrAlphabet[i]);
} }
@ -215,7 +215,7 @@ Common.UI.HintManager = new(function() {
if (visibleItems.length > _arrAlphabet.length) { if (visibleItems.length > _arrAlphabet.length) {
_arrLetters = _getLetters(visibleItems.length); _arrLetters = _getLetters(visibleItems.length);
} else { } else {
_arrLetters = [..._arrAlphabet]; _arrLetters = _arrAlphabet.slice();
} }
var usedLetters = []; var usedLetters = [];
if ($(_currentSection).find('[data-hint-title]').length > 0) { if ($(_currentSection).find('[data-hint-title]').length > 0) {
@ -295,7 +295,7 @@ Common.UI.HintManager = new(function() {
break; break;
} }
} else { } else {
offsets = offsets ? item.attr('data-hint-offset').split(',').map((item) => (parseInt(item))) : [0, 0]; offsets = offsets ? item.attr('data-hint-offset').split(',').map(function (item) { return parseInt(item); }) : [0, 0];
} }
var offset = item.offset(); var offset = item.offset();
if (direction === 'left-top') if (direction === 'left-top')