use forEach() instead of for(i=0...)

This commit is contained in:
Manuel Friedli 2014-07-03 21:26:13 +02:00
parent 9720d1dcd1
commit dd752c8db0

View file

@ -162,20 +162,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// language chooser
if (uhrGlobals.languages.length > 1) {
var languageChooser = $('<select id="uhr-languagechooser' + uhr.id + '"></select>');
for (var i = 0; i < uhrGlobals.languages.length; i++) {
var language = uhrGlobals.languages[i];
languageChooser.append('<option value="' + language.code + '">' + language.language + '</option>');
}
uhrGlobals.languages.forEach(function (item) {
languageChooser.append('<option value="' + item.code + '">' + item.language + '</option>');
});
e.after(languageChooser);
}
// theme chooser
if (uhrGlobals.themes.length > 1) {
var themeChooser = $('<select id="uhr-themechooser' + uhr.id + '"></select>');
for (var i = 0; i < uhrGlobals.themes.length; i++) {
var theme = uhrGlobals.themes[i];
themeChooser.append('<option value="' + theme.styleClass + '">' + theme.name + '</option>');
}
uhrGlobals.themes.forEach(function (item) {
themeChooser.append('<option value="' + item.styleClass + '">' + item.name + '</option>');
});
e.after(themeChooser);
}
}