Skip to content

Commit 1098b6b

Browse files
Merge pull request #2440 from sensei-hacker/fix-search-tab-strict-mode
Fix undeclared variables in search.js for ESM strict mode
2 parents 5ecac63 + 20eab91 commit 1098b6b

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

tabs/search.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import i18n from './../js/localization.js';
66
TABS.search = { };
77

88

9-
tabNames = [
9+
const tabNames = [
1010
"adjustments",
1111
"advanced_tuning",
1212
"auxiliary",
@@ -43,9 +43,9 @@ tabNames = [
4343
keyword = keyword.toLowerCase();
4444
resultsDiv.innerHTML = '';
4545

46-
simClick = function (evt) {
47-
tabName = evt.currentTarget.getAttribute("tabName");
48-
tabLink = document.getElementsByClassName("tab_".concat(tabName))[0].getElementsByTagName("a")[0];
46+
const simClick = function (evt) {
47+
const tabName = evt.currentTarget.getAttribute("tabName");
48+
const tabLink = document.getElementsByClassName("tab_".concat(tabName))[0].getElementsByTagName("a")[0];
4949
tabLink.click();
5050
};
5151

@@ -77,7 +77,7 @@ tabNames = [
7777
}
7878
}
7979

80-
for ( result of document.getElementsByClassName("searchResult") ) {
80+
for ( const result of document.getElementsByClassName("searchResult") ) {
8181
result.addEventListener('click', simClick, false);
8282
}
8383
}
@@ -101,24 +101,24 @@ tabNames = [
101101
const htmlDoc = parser.parseFromString(filecontents, 'text/html');
102102
var hasDataI18n = htmlDoc.querySelectorAll('[data-i18n]:not([data-i18n=""])');
103103
for (const element of hasDataI18n) {
104-
key = element.getAttribute('data-i18n');
104+
const key = element.getAttribute('data-i18n');
105105
if (! this.key2page.has(key) ) {
106106
this.key2page.set( key, new Set() );
107107
}
108108
this.key2page.get(key).add(filename);
109109
}
110110
hasDataI18n = htmlDoc.querySelectorAll('[i18n]:not([i18n=""])');
111111
for (const element of hasDataI18n) {
112-
key = element.getAttribute('i18n');
112+
const key = element.getAttribute('i18n');
113113
if (! this.key2page.has(key) ) {
114114
this.key2page.set( key, new Set() );
115115
}
116116
this.key2page.get(key).add(filename);
117117
}
118118

119-
settings = htmlDoc.querySelectorAll('[data-setting]:not([data-setting=""])');
119+
const settings = htmlDoc.querySelectorAll('[data-setting]:not([data-setting=""])');
120120
for (const element of settings) {
121-
key = element.getAttribute('data-setting');
121+
const key = element.getAttribute('data-setting');
122122
if (! this.setting2page.has(key) ) {
123123
this.setting2page.set( key, new Set() );
124124
}
@@ -131,8 +131,9 @@ tabNames = [
131131
TABS.search.geti18nJs = function (filename, filecontents) {
132132
var re = /(?:data-i18n=|i18n.getMessage\()["']([^"']*)['"]/g
133133

134-
while (match = re.exec(filecontents)) {
135-
key = match[1];
134+
let match;
135+
while ((match = re.exec(filecontents))) {
136+
const key = match[1];
136137
if (! this.key2page.has(key) ) {
137138
this.key2page.set( key, new Set() );
138139
}

0 commit comments

Comments
 (0)