mollom.admin.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. (function ($) {
  2. /**
  3. * Attaches jQuery MultiSelect.
  4. */
  5. Drupal.behaviors.mollomMultiSelect = {
  6. attach: function (context) {
  7. if ($().chosen) {
  8. $(context).find('select[multiple]').chosen({
  9. width: '90%',
  10. // @see search-results.tpl.php
  11. no_results_text: Drupal.t('Your search yielded no results')
  12. });
  13. }
  14. // Adjust the recommended display for discarding spam based on moderation
  15. // settings.
  16. $(context).find('#mollom-admin-configure-form').once(function() {
  17. function updateRecommendedDiscard($form) {
  18. $form.find('label[for="edit-mollom-discard-1"] .mollom-recommended').toggle(!$form.find('input[name="mollom[moderation]"]').is(':checked'));
  19. $form.find('label[for="edit-mollom-discard-0"] .mollom-recommended').toggle($form.find('input[name="mollom[moderation]"]').is(':checked'));
  20. }
  21. $(this).find('input[name="mollom[moderation]"]').change(function(e) {
  22. updateRecommendedDiscard($(this).closest('form'));
  23. });
  24. updateRecommendedDiscard($(this));
  25. });
  26. }
  27. };
  28. })(jQuery);