diagrams.popup = function()

in hive/scaladocs/lib/diagrams.js [251:293]


diagrams.popup = function(diagram)
{
	var id = diagram.attr("id");
	if(!diagrams.windows[id] || diagrams.windows[id].closed) {
		var title = $(".symbol .name", $("#signature")).text();
		// cloning from parent window to popup somehow doesn't work in IE
		// therefore include the SVG as a string into the HTML
		var svgIE = jQuery.browser.msie ? $("<div />").append(diagram.data("svg")).html() : "";
		var html = '' +
		'<?xml version="1.0" encoding="UTF-8"?>\n' +
		'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n' + 
		'<html>\n' +
		'	<head>\n' +
		'		<title>' + title + '</title>\n' +
		'		<link href="' + $("#diagrams-css").attr("href") + '" media="screen" type="text/css" rel="stylesheet" />\n' +
		'		<script type="text/javascript" src="' + $("#jquery-js").attr("src") + '"></script>\n' +
		'		<script type="text/javascript" src="' + $("#diagrams-js").attr("src") + '"></script>\n' +
		'		<script type="text/javascript">\n' +
		'			diagrams.isPopup = true;\n' +
		'		</script>\n' +
		'	</head>\n' +
		'	<body onload="diagrams.initPopup(\'' + id + '\');">\n' +
		'		<a href="#" onclick="window.close();" id="close-link">Close this window</a>\n' +
		'		' + svgIE + '\n' +
		'	</body>\n' +
		'</html>';

		var padding = 30;
		var screenHeight = screen.availHeight;
		var screenWidth = screen.availWidth;
		var w = Math.min(screenWidth, diagram.data("width") + 2 * padding);
		var h = Math.min(screenHeight, diagram.data("height") + 2 * padding);
		var left = (screenWidth - w) / 2;
		var top = (screenHeight - h) / 2;
		var parameters = "height=" + h + ", width=" + w + ", left=" + left + ", top=" + top + ", scrollbars=yes, location=no, resizable=yes";
		var win = window.open("about:blank", "_blank", parameters);
		win.document.open();
		win.document.write(html);
		win.document.close();
		diagrams.windows[id] = win;
	}
	win.focus();
};