Projet

Général

Profil

Révision 136a805a

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/js/dependent.js
97 97
          else {
98 98
            switch ($(trigger).attr('type')) {
99 99
              case 'checkbox':
100
                var val = $(trigger).attr('checked') ? true : false;
100
                // **This check determines if using a jQuery version 1.7 or newer which requires the use of the prop function instead of the attr function when not called on an attribute
101
                if ($().prop) {
102
                  var val = $(trigger).prop('checked') ? true : false;
103
                }
104
                else {
105
                  var val = $(trigger).attr('checked') ? true : false;
106
                }
101 107

  
102 108
                if (val) {
103 109
                  $(trigger).siblings('label').removeClass('hidden-options').addClass('expanded-options');
......
148 154
                len++;
149 155
              }
150 156

  
151
              var object = $('#' + id + '-wrapper');
152
              if (!object.size()) {
153
                // Some elements can't use the parent() method or they can
154
                // damage things. They are guaranteed to have wrappers but
155
                // only if dependent.inc provided them. This check prevents
156
                // problems when multiple AJAX calls cause settings to build
157
                // up.
158
                var $original = $('#' + id);
159
                if ($original.is('fieldset') || $original.is('textarea')) {
160
                  continue;
161
                }
162

  
163
                object = $('#' + id).parent();
157
              var $original = $('#' + id);
158
              if ($original.is('fieldset') || $original.is('textarea')) {
159
                continue;
164 160
              }
165 161

  
162
              var object = $original.parent();
163

  
166 164
              if (Drupal.settings.CTools.dependent[id].type == 'disable') {
167 165
                if (Drupal.settings.CTools.dependent[id].num <= len) {
168 166
                  // Show if the element if criteria is matched
169
                  object.attr('disabled', false);
170
                  object.addClass('dependent-options');
171
                  object.children().attr('disabled', false);
167
                  // **This check determines if using a jQuery version 1.7 or newer which requires the use of the prop function instead of the attr function when not called on an attribute
168
                  if (typeof $().prop == 'function') {
169
                    object.prop('disabled', false);
170
                    object.addClass('dependent-options');
171
                    object.children().prop('disabled', false);
172
                  }
173
                  else {
174
                    object.attr('disabled', false);
175
                    object.addClass('dependent-options');
176
                    object.children().attr('disabled', false);
177
                  }
172 178
                }
173 179
                else {
174 180
                  // Otherwise hide. Use css rather than hide() because hide()
175 181
                  // does not work if the item is already hidden, for example,
176 182
                  // in a collapsed fieldset.
177
                  object.attr('disabled', true);
178
                  object.children().attr('disabled', true);
183
                  // **This check determines if using a jQuery version 1.7 or newer which requires the use of the prop function instead of the attr function when not called on an attribute
184
                  if (typeof $().prop == 'function') {
185
                    object.prop('disabled', true);
186
                    object.children().prop('disabled', true);
187
                  }
188
                  else {
189
                    object.attr('disabled', true);
190
                    object.children().attr('disabled', true);
191
                  }
179 192
                }
180 193
              }
181 194
              else {

Formats disponibles : Unified diff