l10n_update.admin.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @file
  3. * JavaScript for the translate interface update page.
  4. */
  5. (function ($) {
  6. 'use strict';
  7. /**
  8. * Show/hide the description details on Translate interface update page.
  9. */
  10. Drupal.behaviors.hideUpdateInformation = {
  11. attach: function (context, settings) {
  12. var $table = $('#l10n-update-status-form').once('expand-updates');
  13. if ($table.length) {
  14. var $tbodies = $table.find('tbody');
  15. // Open/close the description details by toggling a tr class.
  16. $tbodies.find('.description').bind('click keydown', function (e) {
  17. if (e.keyCode && (e.keyCode !== 13 && e.keyCode !== 32)) {
  18. return;
  19. }
  20. e.preventDefault();
  21. var $tr = $(this).closest('tr');
  22. $tr.toggleClass('expanded');
  23. // Change screen reader text.
  24. $tr.find('.update-description-prefix').text(function () {
  25. if ($tr.hasClass('expanded')) {
  26. return Drupal.t('Hide description');
  27. }
  28. else {
  29. return Drupal.t('Show description');
  30. }
  31. });
  32. });
  33. $table.find('.requirements, .links').hide();
  34. }
  35. }
  36. };
  37. })(jQuery);