only render selectors for language and theme if there is more than one
language / theme definition. use the first defined theme as default if not explicitly specified.
This commit is contained in:
parent
1bc60d7a1b
commit
ae3da935be
1 changed files with 17 additions and 9 deletions
26
uhr.js
26
uhr.js
|
@ -42,7 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
width: '100%',
|
||||
status: 'on',
|
||||
language: 'de_CH',
|
||||
theme: 'black',
|
||||
theme: window._uhr.themes[0].class,
|
||||
force: false,
|
||||
controls: true
|
||||
},
|
||||
|
@ -225,22 +225,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
e.after(toggleSwitch);
|
||||
|
||||
// language chooser
|
||||
var languageChooser = $('<select id="uhr-languagechooser' + this._id + '"></select>');
|
||||
var options = [];
|
||||
for (var code in window._uhr.languages) {
|
||||
if (window._uhr.languages.hasOwnProperty(code)) {
|
||||
var language = window._uhr.languages[code];
|
||||
languageChooser.append('<option value="' + code + '">' + language.language + '</option>');
|
||||
options.push('<option value="' + code + '">' + language.language + '</option>');
|
||||
}
|
||||
}
|
||||
e.after(languageChooser);
|
||||
if (options.length > 1) {
|
||||
var languageChooser = $('<select id="uhr-languagechooser' + this._id + '"></select>');
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
languageChooser.append(options[i]);
|
||||
}
|
||||
e.after(languageChooser);
|
||||
}
|
||||
|
||||
// theme chooser
|
||||
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
||||
var theme = window._uhr.themes[i];
|
||||
themeChooser.append('<option value="' + theme.class + '">' + theme.name + '</option>');
|
||||
if (window._uhr.themes.length > 1) {
|
||||
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
||||
var theme = window._uhr.themes[i];
|
||||
themeChooser.append('<option value="' + theme.class + '">' + theme.name + '</option>');
|
||||
}
|
||||
e.after(themeChooser);
|
||||
}
|
||||
e.after(themeChooser);
|
||||
}
|
||||
},
|
||||
_wireFunctionality: function() {
|
||||
|
|
Loading…
Reference in a new issue