Goal
When a user logs into siteadmin console http://localhost:4502/siteadmin, the Websites tab is shown. Here we need the Search tab to be shown by default and not Websites
Solution
1) Use the overlay architecture of CQ and extend SiteAdmin actions. So login to CRXDE Lite (http://localhost:4502/crx/de) and create file /apps/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js to overlay /libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js
2) Add the following code in js /apps/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js
Here we execute ootb SiteActions js before executing the script to activate Search tab
$.getScript("/libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.Actions.js", function(){
var interval = setInterval(function(){
var comp = CQ.Ext.getCmp("cq-siteadmin-tabpanel");
if(comp){
comp.setActiveTab(1);
clearInterval(interval);
}
}, 500);
});