/// <summary> /// Includes the script text for the given browser in the given version range. /// </summary> /// <remarks>Script blocks are only include in the output is the browser specified matches the /// browser making the request. <paramref name="browser"/> can be the name of a browser defined in the BrowserCaps /// (<c>"ie", "firefox", "netscape"</c>, et al, including all defined in the *.browser files installed), /// <c>"all", "other", "inline" </c>or <c> "noscript"</c>. /// "all" block are always included. "other" blocks are include only if a more specific block has /// not already included. <para/> /// "inline" and "noscript" blocks are rendered in place with the rest of the viewcomponent. /// Other blocks are gathered together, and rendered at the location of the <see cref="InsertJavascriptComponent"/>. /// </remarks> /// <param name="browser">The name of the browser which this script is specific to.</param> /// <param name="baseversion">The baseversion.</param> /// <param name="direction">The direction versionDirection.andUp or .andDown.</param> /// <param name="script">The script.</param> public void IncludeScriptText(string browser, int baseversion, versionDirection direction, string script) { BrowserSpec spec = new BrowserSpec(browser, baseversion, direction); if (browser == "all") { AddScriptBlock(script); } if ((browser == "inline")) { RenderScriptImmedaitely(script); } if (!segmentChoosen) { if (browser=="other" || spec.MatchesBrowser(browCaps)) { AddScriptBlock(script); segmentChoosen = true; } } }
/// <summary> /// Indicates whether or not the user's browser mets the given specification. /// </summary> /// <param name="browser">The browser.</param> /// <param name="baseversion">The baseversion.</param> /// <param name="direction">The direction.</param> /// <returns></returns> public bool BrowserIs(string browser, int baseversion, versionDirection direction) { BrowserSpec spec = new BrowserSpec(browser, baseversion, direction); return spec.MatchesBrowser(browCaps); }