window.onload=LoadPage; window.onunload=Window_Unload; //window.onresize=ResizeWindow; window.onbeforeprint = set_to_print; window.onafterprint = reset_form; var scrollPos = 0; var inheritedMembers; var protectedMembers; var netcfMembersOnly; var netXnaMembersOnly; // Initialize array of section states var sectionStates = new Array(); var sectionStatesInitialized = false; //Hide sample source in select element function HideSelect() { var selectTags = document.getElementsByTagName("SELECT"); var spanEles = document.getElementsByTagName("span"); var i = 10; var m; if (selectTags.length != null || selectTags.length >0) { for (n=0; n0) { for (n=0; n node ids begin with "sectionToggle", so the same id can refer to different sections in different topics // we don't want to persist their state; set it to expanded if (itemId.indexOf("sectionToggle", 0) == 0) return "e"; // the default state for new section ids is expanded if (sectionStates[itemId] == null) return "e"; // otherwise, persist the passed in state return sectionStates[itemId]; } var noReentry = false; function OnLoadImage(eventObj) { if (noReentry) return; if (!sectionStatesInitialized) InitSectionStates(); var elem; if(document.all) elem = eventObj.srcElement; else elem = eventObj.target; if ((sectionStates[elem.id] == "e")) ExpandSection(elem); else CollapseSection(elem); } /* ********** ********** Begin ********** */ var docSettings; function LoadPage() { // If not initialized, grab the DTE.Globals object if (globals == null) globals = GetGlobals(); // docSettings has settings for the current document, // which include persistent and non-persistent keys for checkbox filters and expand/collapse section states // persistKeys is an array of the checkbox ids to persist if (docSettings == null) { docSettings = new Array(); persistKeys = new Array(); } if (!sectionStatesInitialized) InitSectionStates(); var imgElements = document.getElementsByName("toggleSwitch"); for (i = 0; i < imgElements.length; i++) { if ((sectionStates[imgElements[i].id] == "e")) ExpandSection(imgElements[i]); else CollapseSection(imgElements[i]); } SetCollapseAll(); // split screen var screen = new SplitScreen('header', 'mainSection'); // init devlang filter checkboxes SetupDevlangsFilter(); // init memberlist filter checkboxes for protected, inherited, etc SetupMemberOptionsFilter(); // init memberlist platforms filter checkboxes, e.g. .Net Framework, CompactFramework, XNA, Silverlight, etc. SetupMemberFrameworksFilter(); var mainSection = document.getElementById("mainSection"); // vs70.js did this to allow up/down arrow scrolling, I think try { mainSection.setActive(); } catch(e) { } //set the scroll position try{mainSection.scrollTop = scrollPos;} catch(e){} } function Window_Unload() { // for each key in persistArray, write the key/value pair to globals for (var i = 0; i < persistKeys.length; i++) Save(persistKeys[i],docSettings[persistKeys[i]]); // save the expand/collapse section states SaveSections(); } function set_to_print() { //breaks out of divs to print var i; if (window.text)document.all.text.style.height = "auto"; for (i=0; i < document.all.length; i++) { if (document.all[i].tagName == "body") { document.all[i].scroll = "yes"; } if (document.all[i].id == "header") { document.all[i].style.margin = "0px 0px 0px 0px"; document.all[i].style.width = "100%"; } if (document.all[i].id == "mainSection") { document.all[i].style.overflow = "visible"; document.all[i].style.top = "5px"; document.all[i].style.width = "100%"; document.all[i].style.padding = "0px 10px 0px 30px"; } } } function reset_form() { //returns to the div nonscrolling region after print document.location.reload(); } /* ********** ********** End ********** */ /* ********** ********** Begin Language Filtering ********** */ var devlangsMenu; var devlangsDropdown; var memberOptionsMenu; var memberOptionsDropdown; var memberFrameworksMenu; var memberFrameworksDropdown; var dropdowns = new Array(); // initialize the devlang filter dropdown menu function SetupDevlangsFilter() { var divNode = document.getElementById('devlangsMenu'); if (divNode == null) return; var checkboxNodes = divNode.getElementsByTagName("input"); if (checkboxNodes.length == 1) { // only one checkbox, so we don't need a menu // get the devlang and use it to display the correct devlang spans // a one-checkbox setting like this is NOT persisted, nor is it set from the persisted globals var checkboxData = checkboxNodes[0].getAttribute('data'); var dataSplits = checkboxData.split(','); var devlang = ""; if (dataSplits.length > 1) devlang = dataSplits[1]; styleSheetHandler(devlang); } else { // setup the dropdown menu devlangsMenu = new CheckboxMenu("devlangsMenu", docSettings, persistKeys, globals); devlangsDropdown = new Dropdown('devlangsDropdown', 'devlangsMenu'); dropdowns.push(devlangsDropdown); // update the label of the dropdown menu SetDropdownMenuLabel(devlangsMenu, devlangsDropdown); // toggle the document's display docSettings codeBlockHandler(); styleSheetHandler(""); } } // called onclick in a devlang filter checkbox // tasks to perform at this event are: // toggle the check state of the checkbox that was clicked // update the user's devlang preference, based on devlang checkbox states // update stylesheet based on user's devlang preference // show/hide snippets/syntax based on user's devlang preference // function SetLanguage(checkbox) { // toggle the check state of the checkbox that was clicked devlangsMenu.ToggleCheckState(checkbox.id); // update the label of the dropdown menu SetDropdownMenuLabel(devlangsMenu, devlangsDropdown); // update the display of the document's items that are dependent on the devlang setting codeBlockHandler(); styleSheetHandler(""); } /* ********** ********** End Language Filtering ********** */ /* ********** ********** Begin Members Options Filtering ********** */ // initialize the memberlist dropdown menu for protected, inherited, etc function SetupMemberOptionsFilter() { if (document.getElementById('memberOptionsMenu') != null) { memberOptionsMenu = new CheckboxMenu("memberOptionsMenu", docSettings, persistKeys, globals); memberOptionsDropdown = new Dropdown('memberOptionsDropdown', 'memberOptionsMenu'); dropdowns.push(memberOptionsDropdown); // update the label of the dropdown menu SetDropdownMenuLabel(memberOptionsMenu, memberOptionsDropdown); // show/hide memberlist rows based on the current docSettings memberlistHandler(); } } function SetupMemberFrameworksFilter() { if (document.getElementById('memberFrameworksMenu') != null) { memberFrameworksMenu = new CheckboxMenu("memberFrameworksMenu", docSettings, persistKeys, globals); memberFrameworksDropdown = new Dropdown('memberFrameworksDropdown', 'memberFrameworksMenu'); dropdowns.push(memberFrameworksDropdown); // update the label of the dropdown menu SetDropdownMenuLabel(memberFrameworksMenu, memberFrameworksDropdown); // show/hide memberlist rows based on the current docSettings memberlistHandler(); } } function SetMemberOptions(checkbox, groupName) { var checkboxGroup = new Array(); if (groupName == "vis") { if (document.getElementById('PublicCheckbox') != null) checkboxGroup.push('PublicCheckbox'); if (document.getElementById('ProtectedCheckbox') != null) checkboxGroup.push('ProtectedCheckbox'); } else if (groupName == "decl") { if (document.getElementById('DeclaredCheckbox') != null) checkboxGroup.push('DeclaredCheckbox'); if (document.getElementById('InheritedCheckbox') != null) checkboxGroup.push('InheritedCheckbox'); } // toggle the check state of the checkbox that was clicked memberOptionsMenu.ToggleGroupCheckState(checkbox.id, checkboxGroup); // update the label of the dropdown menu SetDropdownMenuLabel(memberOptionsMenu, memberOptionsDropdown); // update the display of the document's items that are dependent on the member options settings memberlistHandler(); } function SetMemberFrameworks(checkbox) { // toggle the check state of the checkbox that was clicked memberFrameworksMenu.ToggleCheckState(checkbox.id); // update the label of the dropdown menu SetDropdownMenuLabel(memberFrameworksMenu, memberFrameworksDropdown); // update the display of the document's items that are dependent on the member platforms settings memberlistHandler(); } function DisplayFilteredMembers() { var iAllMembers = document.getElementsByTagName("tr"); var i; for(i = 0; i < iAllMembers.length; ++i) { if (((iAllMembers[i].notSupportedOnXna == "true") && (netXnaMembersOnly == "on")) || ((iAllMembers[i].getAttribute("name") == "inheritedMember") && (inheritedMembers == "off")) || ((iAllMembers[i].getAttribute("notSupportedOn") == "netcf") && (netcfMembersOnly == "on"))) iAllMembers[i].style.display = "none"; else iAllMembers[i].style.display = ""; } // protected members are in separate collapseable sections in vs2005, so expand or collapse the sections ExpandCollapseProtectedMemberSections(); } function ExpandCollapseProtectedMemberSections() { var imgElements = document.getElementsByName("toggleSwitch"); var i; // Family for(i = 0; i < imgElements.length; ++i) { if(imgElements[i].id.indexOf("protected", 0) == 0) { if ((sectionStates[imgElements[i].id] == "e" && protectedMembers == "off") || (sectionStates[imgElements[i].id] == "c" && protectedMembers == "on")) { ExpandCollapse(imgElements[i]); } } } } /* ********** ********** End Members Options Filtering ********** */ /* ********** ********** Begin Expand/Collapse ********** */ // expand or collapse a section function ExpandCollapse(imageItem) { if (sectionStates[imageItem.id] == "e") CollapseSection(imageItem); else ExpandSection(imageItem); SetCollapseAll(); } // expand or collapse all sections function ExpandCollapseAll(imageItem) { var collapseAllImage = document.getElementById("collapseAllImage"); var expandAllImage = document.getElementById("expandAllImage"); if (imageItem == null || collapseAllImage == null || expandAllImage == null) return; noReentry = true; // Prevent entry to OnLoadImage var imgElements = document.getElementsByName("toggleSwitch"); var i; var collapseAll = (imageItem.src == collapseAllImage.src); if (collapseAll) { imageItem.src = expandAllImage.src; imageItem.alt = expandAllImage.alt; for (i = 0; i < imgElements.length; ++i) { CollapseSection(imgElements[i]); } } else { imageItem.src = collapseAllImage.src; imageItem.alt = collapseAllImage.alt; for (i = 0; i < imgElements.length; ++i) { ExpandSection(imgElements[i]); } } SetAllSectionStates(collapseAll); SetToggleAllLabel(collapseAll); noReentry = false; } function ExpandCollapse_CheckKey(imageItem, eventObj) { if(eventObj.keyCode == 13) ExpandCollapse(imageItem); } function ExpandCollapseAll_CheckKey(imageItem, eventObj) { if(eventObj.keyCode == 13) ExpandCollapseAll(imageItem); } function SetAllSectionStates(collapsed) { for (var sectionId in sectionStates) sectionStates[sectionId] = (collapsed) ? "c" : "e"; } function ExpandSection(imageItem) { noReentry = true; // Prevent re-entry to OnLoadImage try { var collapseImage = document.getElementById("collapseImage"); imageItem.src = collapseImage.src; imageItem.alt = collapseImage.alt; imageItem.parentNode.parentNode.nextSibling.style.display = ""; sectionStates[imageItem.id] = "e"; } catch (e) { } noReentry = false; } function CollapseSection(imageItem) { noReentry = true; // Prevent re-entry to OnLoadImage var expandImage = document.getElementById("expandImage"); imageItem.src = expandImage.src; imageItem.alt = expandImage.alt; imageItem.parentNode.parentNode.nextSibling.style.display = "none"; sectionStates[imageItem.id] = "c"; noReentry = false; } function AllCollapsed() { var imgElements = document.getElementsByName("toggleSwitch"); var allCollapsed = true; var i; for (i = 0; i < imgElements.length; i++) allCollapsed = allCollapsed && (sectionStates[imgElements[i].id] == "c"); return allCollapsed; } function SetCollapseAll() { var imageElement = document.getElementById("toggleAllImage"); if (imageElement == null) return; var allCollapsed = AllCollapsed(); if (allCollapsed) { var expandAllImage = document.getElementById("expandAllImage"); if (expandAllImage == null) return; imageElement.src = expandAllImage.src; imageElement.alt = expandAllImage.alt; } else { var collapseAllImage = document.getElementById("collapseAllImage"); if (collapseAllImage == null) return; imageElement.src = collapseAllImage.src; imageElement.alt = collapseAllImage.alt; } SetToggleAllLabel(allCollapsed); } function SetToggleAllLabel(allCollapsed) { var collapseLabelElement = document.getElementById("collapseAllLabel"); var expandLabelElement = document.getElementById("expandAllLabel"); if (collapseLabelElement == null || expandLabelElement == null) return; if (allCollapsed) { collapseLabelElement.style.display = "none"; expandLabelElement.style.display = "inline"; } else { collapseLabelElement.style.display = "inline"; expandLabelElement.style.display = "none"; } } function SaveSections() { try { var states = ""; for (var sectionId in sectionStates) states += sectionId + ":" + sectionStates[sectionId] + ";"; Save("SectionStates", states.substring(0, states.length - 1)); } catch (e) { } } function OpenSection(imageItem) { if (sectionStates[imageItem.id] == "c") ExpandCollapse(imageItem); } /* ********** ********** End Expand/Collapse ********** */ /* ********** ********** Begin Copy Code ********** */ function CopyCode(key) { var trElements = document.getElementsByTagName("tr"); var i; for(i = 0; i < trElements.length; ++i) { if(key.parentNode.parentNode.parentNode == trElements[i].parentNode) { if (window.clipboardData) { // the IE-manner window.clipboardData.setData("Text", trElements[i].innerText); } else if (window.netscape) { // Gives unrestricted access to browser APIs using XPConnect try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch(e) { alert("Universal Connect was refused, cannot copy to " + "clipboard. Go to about:config and set " + "signed.applets.codebase_principal_support to true to " + "enable clipboard support."); return; } // Creates an instance of nsIClipboard var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) return; // Creates an instance of nsITransferable var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) return; // register the data flavor trans.addDataFlavor('text/unicode'); // Create object to hold the data var str = new Object(); // Creates an instance of nsISupportsString var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); //Assigns the data to be copied var copytext = trElements[i].textContent; str.data = copytext; // Add data objects to transferable trans.setTransferData("text/unicode",str,copytext.length*2); var clipid = Components.interfaces.nsIClipboard; if (!clip) return false; // Transfer the data to clipboard clip.setData(trans,null,clipid.kGlobalClipboard); } } } } function ChangeCopyCodeIcon(key) { var i; var imageElements = document.getElementsByName("ccImage") for(i=0; i=5){ document.body.addBehavior(gsContextMenuPath); document.body.onbehaviorready="fnSetMenus()"; document.body.oncontextopen="clearDef()"; } } // Called by showDef. The showDef function sniffs for initialization. function openDialog(oNode,x,y){ var bStatus=oDialog.dlg_status; // BUGBUG: This code assumes that oDialog has been initialized if(bStatus==false){ oDialog.dlg_status=true; oDialog.style.display="block"; } else{ if(typeof(oTimeout)=="number"){ window.clearTimeout(oTimeout); } } var sTerm=oNode.getAttribute("G_RID"); var oDef=oNode.children(0); var sDef=oDef.text; sDef=sDef.substr(4,sDef.length-7); //Strips the html comment markers from the definition. oDialog.innerHTML=sDef //oDialog.innerHTML=g_glossary[sTerm]; var iScrollLeft=document.body.scrollLeft; var iScrollTop=document.body.scrollTop; var iOffsetLeft=getAbsoluteLeft(oNode)// - iScrollLeft; var iOffsetWidth=oNode.offsetWidth; var oParent=oNode.parentNode; var iOffsetParentLeft=getAbsoluteLeft(oParent); var iOffsetTop=getAbsoluteTop(oNode); //- iScrollTop; var iOffsetDialogWidth=oDialog.offsetWidth; if((iOffsetLeft + iOffsetWidth) > (iOffsetParentLeft + oParent.offsetWidth)){ iOffsetLeft=iOffsetParentLeft; if(iOffsetLeft - iOffsetDialogWidth>0){ iOffsetTop+=oNode.offsetHeight; } } var iLeft=0; var iTop=0; if((iOffsetLeft + iOffsetWidth - iScrollLeft + iOffsetDialogWidth) < document.body.offsetWidth ){ iLeft=iOffsetLeft + iOffsetWidth; } else{ if(iOffsetLeft - iOffsetDialogWidth>0){ iLeft=iOffsetLeft - iOffsetDialogWidth; } else{ iLeft=iOffsetParentLeft; } } if(iOffsetTop - iScrollTop"); oNewDialog=document.body.children(document.body.children.length-1); oNewDialog.className="clsTooltip"; oNewDialog.style.width=iWidth; oNewDialog.dlg_status=false; return oNewDialog; } function sendfeedback(subject, id,alias){ var rExp = /\"/gi; var url = location.href; // Need to replace the double quotes with single quotes for the mailto to work. var rExpSingleQuotes = /\'\'"/gi; var title = document.getElementsByTagName("TITLE")[0].innerText.replace(rExp, "''"); location.href = "mailto:" + alias + "?subject=" + subject + title + "&body=Topic%20ID:%20" + id + "%0d%0aURL:%20" + url + "%0d%0a%0d%0aComments:%20"; }