/*********************************************** * PAGE INIT ***********************************************/ /** * Splitting the screen */ function SplitScreen (nonScrollingRegionId, scrollingRegionId) { this.nonScrollingRegion = document.getElementById(nonScrollingRegionId); this.scrollingRegion = document.getElementById(scrollingRegionId); document.body.style.margin = "0px"; document.body.style.overflow = "hidden"; this.scrollingRegion.style.overflow = "auto"; this.resize(null); registerEventHandler(window, 'resize', getInstanceDelegate(this, "resize")); // clean itself on document unload registerEventHandler(window, 'unload', getInstanceDelegate(this, "dispose")); } SplitScreen.prototype.resize = function(e) { var scrollRegionHeight = document.body.clientHeight - this.nonScrollingRegion.offsetHeight; if (scrollRegionHeight < 0) { scrollRegionHeight = 0; } this.scrollingRegion.style.height = scrollRegionHeight; this.scrollingRegion.style.width = document.body.clientWidth; } SplitScreen.prototype.dispose = function(e) { try { this.nonScrollingRegion = null; this.scrollingRegion = null; //remove events so if external document is open in window, it will not be affected unregisterEventHandler(window, 'load', init); unregisterEventHandler(window, 'resize', getInstanceDelegate(this, "resize")); unregisterEventHandler(window, 'unload', getInstanceDelegate(this, "dispose")); // This is not neccessary. In IE (6 at least) the "scrolling" attribute from frameset's HTML // is always used when new page is loaded in the frame. document.body.style.overflow = "auto"; document.body.style.height = "100%"; document.body.scroll="yes"; window.frameElement.scrolling = "auto"; } catch (ex) {} } // Event handler attachment function registerEventHandler (element, event, handler) { if (element.attachEvent) { element.attachEvent('on' + event, handler); } else if (element.addEventListener) { element.addEventListener(event, handler, false); } else { element[event] = handler; } } // Event handler detachment function unregisterEventHandler(element, event, handler) { if (typeof element.removeEventListener == "function") element.removeEventListener(event, handler, false); else element.detachEvent("on" + event, handler); } function getInstanceDelegate (obj, methodName) { return( function(e) { e = e || window.event; return obj[methodName](e); } ); } //element manipulation, functions with limited functionality defined not to throw errors on the page //window.onload=init; registerEventHandler(window, 'load', init); function init() { try { fixImages(); fixMoniker(); fixMsdnLinks(); loadLangFilter(); showSelectedLanguages(); var langDropDown = document.getElementById("devlangsDropdown"); var langMenu = document.getElementById("devlangsMenu"); registerEventHandler(langDropDown,'mouseover', showLangFilter); registerEventHandler(langDropDown,'mouseout', hideLangFilter); registerEventHandler(langMenu,'mouseover', showLangFilter); registerEventHandler(langMenu,'mouseout', hideLangFilter); } catch (e) {} try { expandAll(document.getElementById("toggleAllImage")); } catch (e2) {} // split screen try { // hide frame scrollbar in HTML output (not in CHM or Help2) if (window.name=="vbdocright") { //it's HTML output in frame document.body.scroll="no"; window.frameElement.scrolling = "no"; } var screen = new SplitScreen('header', 'mainSection'); } catch (e3) {} } /*********************************************** * END PAGE INIT ***********************************************/ /*********************************************** * LANGUAGE FILTER ***********************************************/ function loadLangFilter() { var inputTags = document.getElementsByTagName("input"); var i; for (i=0; i 1) { showHideTag(document.getElementById("devlangsMenuVisualBasicLabel"), false); showHideTag(document.getElementById("devlangsMenuCSharpLabel"), false); showHideTag(document.getElementById("devlangsMenuManagedCPlusPlusLabel"), false); showHideTag(document.getElementById("devlangsMenuJSharpLabel"), false); showHideTag(document.getElementById("devlangsMenuJScriptLabel"), false); if (selectedCount == allCount) { showHideTag(document.getElementById("devlangsMenuAllLabel"), true); } else { showHideTag(document.getElementById("devlangsMenuMultipleLabel"), true); } } var sTags = document.getElementsByTagName("span"); for (i=0; i var code; code = td.innerHTML; code = code.replace(/
/gi, "\n"); code = code.replace(/<\/td>/gi, "\n"); // syntax highlighter removes \n chars and puts each line in separate // get plain text var tmpDiv = document.createElement('div'); tmpDiv.innerHTML = code; if (typeof(tmpDiv.textContent) != "undefined") { // standards compliant code = tmpDiv.textContent; } else if (typeof(tmpDiv.innerText) != "undefined") { // IE only code = tmpDiv.innerText; } try { // works in IE only window.clipboardData.setData("Text", code); } catch (ex) { popCodeWindow(code); } } } catch (e) {} } function CopyCode_CheckKey(spanItem) { if(window.event.keyCode == 13) CopyCode(spanItem); } function popCodeWindow(code) { try { var codeWindow = window.open ("", "Copy the selected code", "location=0,status=0,toolbar=0,menubar =0,directories=0,resizable=1,scrollbars=1,height=400, width=400"); codeWindow.document.writeln(""); codeWindow.document.writeln(""); codeWindow.document.writeln("Copy the selected code"); codeWindow.document.writeln(""); codeWindow.document.writeln("'); codeWindow.document.writeln(escapeHTML(code)); codeWindow.document.writeln(""); codeWindow.document.writeln(""); // the selectNode function below, converted by http://www.howtocreate.co.uk/tutorials/jsexamples/syntax/prepareInline.html var ftn = "function selectNode (node) {\n\tvar selection, range, doc, win;\n\tif ((doc = node.ownerDocument) && \n\t\t(win = doc.defaultView) && \n\t\ttypeof win.getSelection != \'undefined\' && \n\t\ttypeof doc.createRange != \'undefined\' && \n\t\t(selection = window.getSelection()) && \n\t\ttypeof selection.removeAllRanges != \'undefined\') {\n\t\t\t\n\t\trange = doc.createRange();\n\t\trange.selectNode(node);\n selection.removeAllRanges();\n selection.addRange(range);\n\t} else if (document.body && \n\t\t\ttypeof document.body.createTextRange != \'undefined\' && \n\t\t\t(range = document.body.createTextRange())) {\n \n\t\t \trange.moveToElementText(node);\n \trange.select();\n }\n} "; codeWindow.document.writeln(ftn); codeWindow.document.writeln("selectNode(document.getElementById('code_text'));"); codeWindow.document.writeln(""); codeWindow.document.writeln(""); codeWindow.document.close(); } catch (ex) {} } function escapeHTML (str) { return str.replace(/&/g,"&"). replace(/>/g,">"). replace(/ in HxS format takes care of it, redirect.htm used in CHM format doesn't. So we must do it. */ var res = keyword; res = res.replace(/,/g, "\t"); res = res.replace(/;/g, "\n"); res = escape(res); return res; } /** * Converts MSDN2 keyword (cref) to MSDN2 web link */ function convertMsdnKeywordToMsdn2Link(keyword) { var res = keyword; // remove prefix res = res.replace(/^.+:(.*)/g, "$1"); // remove parameters res = res.replace(/(.*)\(.*/g, "$1"); res = res.toLowerCase(); res = "http://msdn.microsoft.com/en-us/library/" + res + ".aspx"; return res; } // Highest MSDN version installed. var msdnVersion; /** * Returns highest MSDN version installed. * @return The MSDN version found in format 8.0 or 9.0 or web. If none is found, * the "web" is returned. */ function getHighestMsdnVersion () { var MSDN_9_CSS = "ms-help://MS.VSCC.v90/dv_vscccommon/styles/presentation.css"; var MSDN_8_CSS = "ms-help://MS.VSCC.v80/dv_vscccommon/local/Classic.css"; if (cssFileExists(MSDN_9_CSS)) { return "9.0"; } if (cssFileExists(MSDN_8_CSS)) { return "8.0"; } return "web"; } /** * Tests whether specified CSS url exists. */ function cssFileExists(cssUrl) { var sheet = null var temporary = false res = false; // first detect whether this CSS is already used in this document (it should be) try { var i; for (i=0; i 0) { res = true } } else if (sheet.cssRules) { // FF if (sheet.cssRules.length > 0) { res = true } } } catch (ex) { } return res; } /*********************************************** * END MSDN LINKS FIX ***********************************************/