diff --git a/core/modules/views_ui/js/views_ui.listing.js b/core/modules/views_ui/js/views_ui.listing.js index ee2199f..30d60e2 100644 --- a/core/modules/views_ui/js/views_ui.listing.js +++ b/core/modules/views_ui/js/views_ui.listing.js @@ -51,4 +51,31 @@ } }; + //Enable button fix + Drupal.behaviors.viewsEnableFix = { + attach: function (context, settings) { + String.prototype.endsWith = function(str){return (this.match(str+"$")==str)}; + + if(window.location.href.endsWith('/admin/structure/views')==true){ + + $('tr.views-ui-list-disabled li.enable .use-ajax', context).on('click', function(){ + var title=$(this).closest('tr').attr('title');// Get element title + var interval=setInterval(function(){ // Listen for changes on upper DOM lists + + var trs=$('tr.views-ui-list-enabled'); + trs.each(function(i){ + if($(this).attr('title')==title){// If upper DOM gets updated get element(based on title) and scrool to it + $('html, body').animate({scrollTop: Math.round($(this).offset().top)-$(this).innerHeight() },'fast'); + $(this).find('a').focus(); + clearInterval(interval); + } + }); + + },500); + + });// on click end + }// if location end + }// attach end + }; + }(jQuery, Drupal));