C# Class NovelTheory.Component.JavascriptHelper

Mostrar archivo Open project: jamescurran/JavascriptHelper Class Usage Examples

Private Properties

Property Type Description
CombineUrl string
CombineUrlPath string
Create JavascriptHelper
InsertCss_Bundled System.Web.Mvc.MvcHtmlString
InsertCss_None System.Web.Mvc.MvcHtmlString
InsertDependancy int
InsertScripts_Bundled System.Web.Mvc.MvcHtmlString
InsertScripts_None System.Web.Mvc.MvcHtmlString
JavascriptHelper System
RenderCssFile void
RenderJavascriptBlocks void
RenderJavascriptFile void

Public Methods

Method Description
AddFile ( string filename ) : System.Web.Mvc.MvcHtmlString
AddInlineFile ( string text ) : System.Web.Mvc.MvcHtmlString
AddInlineScript ( string text ) : System.Web.Mvc.MvcHtmlString

Adds the inline script.

AddNoScriptText ( string text ) : System.Web.Mvc.MvcHtmlString
AddOnReadyScript ( string text ) : string

Adds the on ready script.

accepts a block of script as text. Appended to script run on page ready. All on rendered, wrapped in a jQuery document ready event function, at the point of InsertOnReady()

AddScript ( string text ) : string

Adds the script.

accepts a block of script as text. Each call is rendered. All script from either AddScript methods is rendered in a block at the script insertion point.

AddScript ( string id, string text ) : string

Adds the script.

accepts a block of script as text. Multiple calls with the same id are rendered only once. All script from either AddScript methods is rendered in a block at the script insertion point.

Create ( System.Web.Mvc.ViewContext vc ) : JavascriptHelper
Create ( System.Web.WebPages.WebPageContext webPageContext ) : JavascriptHelper

Creates the specified web page context.

Used in @helper functions: var script = StateTheaterMvc.Component.JavascriptHelper.Create(WebPageContext.Current);

Create ( System.Web.Mvc.WebViewPage page ) : JavascriptHelper

Creates the specified page.

Used in view pages functions: var script = StateTheaterMvc.Component.JavascriptHelper.Create(this);

InsertCss ( ) : System.Web.Mvc.MvcHtmlString

Inserts the CSS.

Renders all css files

InsertOnReady ( ) : System.Web.Mvc.MvcHtmlString
InsertScripts ( ) : System.Web.Mvc.MvcHtmlString
Std ( string std ) : string

Adds standard javascript files

Private Methods

Method Description
CombineUrl ( string baseUrl ) : string
CombineUrlPath ( string path1, string path2 ) : string
Create ( System.Web.Mvc.HtmlHelper html ) : JavascriptHelper
InsertCss_Bundled ( transformType ttype ) : System.Web.Mvc.MvcHtmlString
InsertCss_None ( ) : System.Web.Mvc.MvcHtmlString
InsertDependancy ( string name, int pos ) : int

Inserts the details of a required javascript file into the list.

Places the details of the js script file known by name onto the list of files that will be included on this page. Designed to place new files at the end, and files they depend on just before them.

InsertScripts_Bundled ( transformType ttype ) : System.Web.Mvc.MvcHtmlString
InsertScripts_None ( ) : System.Web.Mvc.MvcHtmlString

Inserts the scripts.

Renders all script files & script blocks.

JavascriptHelper ( System.Web.Mvc.ViewContext vc ) : System
RenderCssFile ( TextWriter tw, string file ) : void
RenderJavascriptBlocks ( TextWriter sb ) : void
RenderJavascriptFile ( TextWriter sb, string file ) : void

Method Details

AddFile() public method

public AddFile ( string filename ) : System.Web.Mvc.MvcHtmlString
filename string
return System.Web.Mvc.MvcHtmlString

AddInlineFile() public method

public AddInlineFile ( string text ) : System.Web.Mvc.MvcHtmlString
text string
return System.Web.Mvc.MvcHtmlString

AddInlineScript() public method

Adds the inline script.
public AddInlineScript ( string text ) : System.Web.Mvc.MvcHtmlString
text string The text.
return System.Web.Mvc.MvcHtmlString

AddNoScriptText() public method

public AddNoScriptText ( string text ) : System.Web.Mvc.MvcHtmlString
text string
return System.Web.Mvc.MvcHtmlString

AddOnReadyScript() public method

Adds the on ready script.
accepts a block of script as text. Appended to script run on page ready. All on rendered, wrapped in a jQuery document ready event function, at the point of InsertOnReady()
public AddOnReadyScript ( string text ) : string
text string The text.
return string

AddScript() public method

Adds the script.
accepts a block of script as text. Each call is rendered. All script from either AddScript methods is rendered in a block at the script insertion point.
public AddScript ( string text ) : string
text string The text.
return string

AddScript() public method

Adds the script.
accepts a block of script as text. Multiple calls with the same id are rendered only once. All script from either AddScript methods is rendered in a block at the script insertion point.
public AddScript ( string id, string text ) : string
id string The id.
text string The text.
return string

Create() public static method

public static Create ( System.Web.Mvc.ViewContext vc ) : JavascriptHelper
vc System.Web.Mvc.ViewContext
return JavascriptHelper

Create() public static method

Creates the specified web page context.
Used in @helper functions: var script = StateTheaterMvc.Component.JavascriptHelper.Create(WebPageContext.Current);
public static Create ( System.Web.WebPages.WebPageContext webPageContext ) : JavascriptHelper
webPageContext System.Web.WebPages.WebPageContext The web page context.
return JavascriptHelper

Create() public static method

Creates the specified page.
Used in view pages functions: var script = StateTheaterMvc.Component.JavascriptHelper.Create(this);
public static Create ( System.Web.Mvc.WebViewPage page ) : JavascriptHelper
page System.Web.Mvc.WebViewPage
return JavascriptHelper

InsertCss() public method

Inserts the CSS.
Renders all css files
public InsertCss ( ) : System.Web.Mvc.MvcHtmlString
return System.Web.Mvc.MvcHtmlString

InsertOnReady() public method

public InsertOnReady ( ) : System.Web.Mvc.MvcHtmlString
return System.Web.Mvc.MvcHtmlString

InsertScripts() public method

public InsertScripts ( ) : System.Web.Mvc.MvcHtmlString
return System.Web.Mvc.MvcHtmlString

Std() public method

Adds standard javascript files
public Std ( string std ) : string
std string a comma-separated list of script file ids.
return string