l10n_update.admin.js 1.0 KB

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