diff --git a/core/modules/views_ui/js/views_ui.listing.js b/core/modules/views_ui/js/views_ui.listing.js index 30d60e2..e5f0217 100644 --- a/core/modules/views_ui/js/views_ui.listing.js +++ b/core/modules/views_ui/js/views_ui.listing.js @@ -52,30 +52,30 @@ }; //Enable button fix - Drupal.behaviors.viewsEnableFix = { + Drupal.behaviors.viewsEnableFocus = { attach: function (context, settings) { - String.prototype.endsWith = function(str){return (this.match(str+"$")==str)}; + 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'); + if (window.location.href.endsWith('/admin/structure/views') == true) { + $('tr.views-ui-list-disabled li.enable .use-ajax', context).on('click', function() { + // Get element title. + var title=$(this).closest('tr').attr('title'); + 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 scrool to it. + if ($(this).attr('title') == title) { + $('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 + }, 500); + }); + } + } }; }(jQuery, Drupal));