From: Vlad Chernushevich Date: Sun, 16 Jun 2013 17:37:22 +0000 (+0200) Subject: Check if setting exists X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ad6e3f2ba3225185b6b94cb2ab25ff4e548a777b;p=KiwiIRC.git Check if setting exists --- diff --git a/client/assets/src/applets/settings.js b/client/assets/src/applets/settings.js index d292ef0..e8c35dd 100644 --- a/client/assets/src/applets/settings.js +++ b/client/assets/src/applets/settings.js @@ -22,15 +22,21 @@ $.each(_kiwi.global.settings.attributes, function(key, value) { - switch ($('[data-setting="' + key + '"]', that.$el).prop('type')) { + var $el = $('[data-setting="' + key + '"]', that.$el); + + // Only deal with settings we have a UI element for + if (!$el) + return; + + switch ($el.prop('type')) { case 'checkbox': - $('[data-setting="' + key + '"]', that.$el).prop('checked', value); + $el.prop('checked', value); break; case 'radio': $('[data-setting="' + key + '"][value="' + value + '"]', that.$el).prop('checked', true); break; case 'text': - $('[data-setting="' + key + '"]', that.$el).val(value); + $el.val(value); break; default: $('[data-setting="' + key + '"][data-value="' + value + '"]', that.$el).addClass('active');