context_layouts_reaction_block.js 1023 B

123456789101112131415161718192021222324252627
  1. (function($) {
  2. Drupal.behaviors.contextLayoutsReactionBlock = {};
  3. Drupal.behaviors.contextLayoutsReactionBlock.attach = function(context) {
  4. // ContextBlockForm: Init.
  5. $('.context-blockform-layout:not(.contextLayoutsProcessed)').each(function() {
  6. $(this).addClass('contextLayoutsProcessed');
  7. $(this).change(function() {
  8. var layout = $(this).val();
  9. if (Drupal.settings.contextLayouts.layouts[layout]) {
  10. $('#context-blockform td.blocks').find('table, div.label, div.tabledrag-toggle-weight-wrapper').hide();
  11. for (var key in Drupal.settings.contextLayouts.layouts[layout]) {
  12. var region = Drupal.settings.contextLayouts.layouts[layout][key];
  13. $('.context-blockform-regionlabel-'+region).show().next('div.tabledrag-toggle-weight-wrapper').show();
  14. $('#context-blockform-region-'+region).show();
  15. }
  16. if (Drupal.contextBlockForm) {
  17. Drupal.contextBlockForm.setState();
  18. }
  19. }
  20. });
  21. $(this).change();
  22. });
  23. };
  24. })(jQuery);