use forEach() instead of for(i=0...)
This commit is contained in:
parent
9720d1dcd1
commit
dd752c8db0
1 changed files with 6 additions and 8 deletions
14
js/uhr.js
14
js/uhr.js
|
@ -162,20 +162,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// language chooser
|
// language chooser
|
||||||
if (uhrGlobals.languages.length > 1) {
|
if (uhrGlobals.languages.length > 1) {
|
||||||
var languageChooser = $('<select id="uhr-languagechooser' + uhr.id + '"></select>');
|
var languageChooser = $('<select id="uhr-languagechooser' + uhr.id + '"></select>');
|
||||||
for (var i = 0; i < uhrGlobals.languages.length; i++) {
|
uhrGlobals.languages.forEach(function (item) {
|
||||||
var language = uhrGlobals.languages[i];
|
languageChooser.append('<option value="' + item.code + '">' + item.language + '</option>');
|
||||||
languageChooser.append('<option value="' + language.code + '">' + language.language + '</option>');
|
});
|
||||||
}
|
|
||||||
e.after(languageChooser);
|
e.after(languageChooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
// theme chooser
|
// theme chooser
|
||||||
if (uhrGlobals.themes.length > 1) {
|
if (uhrGlobals.themes.length > 1) {
|
||||||
var themeChooser = $('<select id="uhr-themechooser' + uhr.id + '"></select>');
|
var themeChooser = $('<select id="uhr-themechooser' + uhr.id + '"></select>');
|
||||||
for (var i = 0; i < uhrGlobals.themes.length; i++) {
|
uhrGlobals.themes.forEach(function (item) {
|
||||||
var theme = uhrGlobals.themes[i];
|
themeChooser.append('<option value="' + item.styleClass + '">' + item.name + '</option>');
|
||||||
themeChooser.append('<option value="' + theme.styleClass + '">' + theme.name + '</option>');
|
});
|
||||||
}
|
|
||||||
e.after(themeChooser);
|
e.after(themeChooser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue