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%',
|
width: '100%',
|
||||||
status: 'on',
|
status: 'on',
|
||||||
language: 'de_CH',
|
language: 'de_CH',
|
||||||
theme: 'black',
|
theme: window._uhr.themes[0].class,
|
||||||
force: false,
|
force: false,
|
||||||
controls: true
|
controls: true
|
||||||
},
|
},
|
||||||
|
@ -225,22 +225,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
e.after(toggleSwitch);
|
e.after(toggleSwitch);
|
||||||
|
|
||||||
// language chooser
|
// language chooser
|
||||||
var languageChooser = $('<select id="uhr-languagechooser' + this._id + '"></select>');
|
var options = [];
|
||||||
for (var code in window._uhr.languages) {
|
for (var code in window._uhr.languages) {
|
||||||
if (window._uhr.languages.hasOwnProperty(code)) {
|
if (window._uhr.languages.hasOwnProperty(code)) {
|
||||||
var language = window._uhr.languages[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
|
// theme chooser
|
||||||
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
if (window._uhr.themes.length > 1) {
|
||||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
||||||
var theme = window._uhr.themes[i];
|
for (var i = 0; i < window._uhr.themes.length; i++) {
|
||||||
themeChooser.append('<option value="' + theme.class + '">' + theme.name + '</option>');
|
var theme = window._uhr.themes[i];
|
||||||
|
themeChooser.append('<option value="' + theme.class + '">' + theme.name + '</option>');
|
||||||
|
}
|
||||||
|
e.after(themeChooser);
|
||||||
}
|
}
|
||||||
e.after(themeChooser);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_wireFunctionality: function() {
|
_wireFunctionality: function() {
|
||||||
|
|
Loading…
Reference in a new issue