diff --git a/core/modules/views_ui/js/views_ui.listing.js b/core/modules/views_ui/js/views_ui.listing.js index 30d60e2..cd09979 100644 --- a/core/modules/views_ui/js/views_ui.listing.js +++ b/core/modules/views_ui/js/views_ui.listing.js @@ -52,29 +52,20 @@ }; //Enable button fix - Drupal.behaviors.viewsEnableFix = { + Drupal.behaviors.viewsEnableFocus = { 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 + $('tr.views-ui-list-disabled li.enable .use-ajax', context).on('click', function(){ + // Get element title. + var title = $(this).closest('tr').attr('title'); + // Listen for changes on upper DOM lists + var interval=setInterval(function() { + var trs = $('tr.views-ui-list-enabled'); + trs.each(function(i) { + // If upper DOM gets updated get element(based on title) and focus it. + if( $(this).attr('title') == title ){ + $(this).find('a').focus(); + clearInterval(interval); + } + }); + },500); + }); } };