Hello Thwackers
I have been looking for a way to include NetPaths in a widget. In this thread https://thwack.solarwinds.com/ideas/7115#comment-303243 (scroll way down), lazyrabbitt has provided an ingenious solution which uses JavaScript to place the NetPath in an iFrame. The screen shot you see is produced by the lazyrabbitt's script below. I've bolded the problem; I can't seem to suppress the Mega Menu with this piece of the script: frameContents.find(".sw-mega-menu").css("display","none");
Any suggestions for troubleshooting this problem with be greatly appreciated.
Cheers!
Brent Papworth

lazyrabbitt's Script:
<script>
//////////////////////////////////////////////
//////////////// Variables
//////////////////////////////////////////////
// Refresh period for the iframe 1 second X 60 = 1 minute (iFrame Refresh)
var refreshPeriod = 1000 * 60;
// Refresh period for the iframe 1 second X 4 = 4 seconds (CSS wait time)
var cssWait = 1000 * 4;
// GMT Offset
var offset = 60000;
// iFrame height
var vheight = 500;
// NetPath Array (first value is the NetPathID, second value is the PollingEngineID)
var NetPaths = [];
NetPaths[0] = [54,46];
NetPaths[1] = [55,46];
NetPaths[2] = [56,46];
//////////////////////////////////////////////
//////////////// Process Array to Build DIVs and iFrames
//////////////////////////////////////////////
jQuery.each(NetPaths, function(index, item) {
document.write('<div id="NetPathDiv' + index + '"></div>');
// Initial load of the iframe
$("#NetPathDiv" + index).html(updateDIV(index, item[0], item[1], offset, vheight));
setTimeout(function(){ hideHF(index); }, cssWait );
// Reload of the html iframe based on refresh period
var myVar = setInterval(function() {
$("#NetPathDiv"+index).html(updateDIV(index, item[0], item[1], offset, vheight));
setTimeout(function(){ hideHF(index); }, cssWait );
}, refreshPeriod);
});
//////////////////////////////////////////////
//////////////// Functions
//////////////////////////////////////////////
// Function that determines the current date and time, adjusts for the GMT offset and then formats the iframe HTML with the latest URL
function updateDIV(id, pathID, pollingEngineID, offset, vheight){
// Automatically pulls the current hostname
var urlPath = "https://" + window.location.hostname;
var d = new Date();
var utc = d.getTime() + (d.getTimezoneOffset() * offset);
var nd = new Date(utc);
var path = urlPath + "/ui/netpath/routeinspector/" + pathID + "/" + pollingEngineID + "/" + nd.getFullYear() + "/" + ( nd.getMonth() + 1 ) + "/" + nd.getDate() + "/" + nd.getHours() + "/" + nd.getMinutes() + "/0";
return '<iframe id="NetPathiFrame' + id + '" src="' + path + '" width="100%" height="' + vheight + '" frameborder="0" scrolling="no"></iframe>';
}
// Hides the Header and Footer from the Netpath iframe
function hideHF(id){
var frameContents = $("#NetPathiFrame"+id).contents();
frameContents.find(".sw-mega-menu").css("display","none");
frameContents.find(".sw-footer").css("display","none");
frameContents.find("#content").css("padding-top","0px");
frameContents.find(".xui-page-content").css("padding","0px");
}
</script>