diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 4dba53e..0be9dfe 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -52,6 +52,28 @@ // than the usual location. if ($(this).attr('href')) { element_settings.url = $(this).attr('href'); + String.prototype.endsWith = function(str){return (this.match(str+"$")==str)}; + + //If we are on VIEWS page and there's button whit href enabled + if(element_settings.url.indexOf('enable?')>-1 && window.location.href.endsWith('/admin/structure/views')==true){ + $(this).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); + }); + } element_settings.event = 'click'; } element_settings.dialogType = $(this).data('dialog-type');