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
14
uhr.js
14
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,16 +225,23 @@ 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>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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);
|
e.after(languageChooser);
|
||||||
|
}
|
||||||
|
|
||||||
// theme chooser
|
// theme chooser
|
||||||
|
if (window._uhr.themes.length > 1) {
|
||||||
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
var themeChooser = $('<select id="uhr-themechooser' + this._id + '"></select>');
|
||||||
for (var i = 0; i < window._uhr.themes.length; i++) {
|
for (var i = 0; i < window._uhr.themes.length; i++) {
|
||||||
var theme = window._uhr.themes[i];
|
var theme = window._uhr.themes[i];
|
||||||
|
@ -242,6 +249,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
}
|
}
|
||||||
e.after(themeChooser);
|
e.after(themeChooser);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_wireFunctionality: function() {
|
_wireFunctionality: function() {
|
||||||
var uhr = this;
|
var uhr = this;
|
||||||
|
|
Loading…
Reference in a new issue