public override void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript) { includeJs.FilePath = "~/Resources/Shared/components/lightbox/js/lightbox.min.js"; includeCss.FilePath = "~/Resources/Shared/components/lightbox/css/lightbox.css"; // no startup script required for the Lightbox literalScript.Visible = false; }
public override void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript) { // HACK: point to already defined stylesheet and dummy script includeJs.FilePath = "~/DesktopModules/R7.MiniGallery/R7.MiniGallery/js/dummy.js"; includeCss.FilePath = "~/DesktopModules/R7.MiniGallery/R7.MiniGallery/module.css"; // hide startup script block literalScript.Visible = false; }
/// <summary> /// Requests that a JavaScript file be registered on the client browser /// </summary> /// <param name="page">The current page. Used to get a reference to the client resource loader.</param> /// <param name="filePath">The relative file path to the JavaScript resource.</param> /// <param name="priority">The relative priority in which the file should be loaded.</param> /// <param name="provider">The name of the provider responsible for rendering the script output.</param> /// <param name="name">Name of framework like Bootstrap, Angular, etc</param> /// <param name="version">Version nr of framework</param> public static void RegisterScript(Page page, string filePath, int priority, string provider, string name, string version) { var include = new DnnJsInclude { ForceProvider = provider, Priority = priority, FilePath = filePath, Name = name, Version = version }; var loader = page.FindControl("ClientResourceIncludes"); if (loader != null) { loader.Controls.Add(include); } }
/// <summary> /// Requests that a JavaScript file be registered on the client browser /// </summary> /// <param name="page">The current page. Used to get a reference to the client resource loader.</param> /// <param name="filePath">The relative file path to the JavaScript resource.</param> /// <param name="priority">The relative priority in which the file should be loaded.</param> /// <param name="provider">The name of the provider responsible for rendering the script output.</param> public static void RegisterScript(Page page, string filePath, int priority, string provider) { var include = new DnnJsInclude { ForceProvider = provider, Priority = priority, FilePath = filePath.ToLowerInvariant(), AddTag = false }; var loader = page.FindControl("ClientResourceIncludes"); if (loader != null) { loader.Controls.Add(include); } }
public override void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript) { includeJs.FilePath = "~/Resources/Shared/components/colorbox/jquery.colorbox-min.js"; includeCss.FilePath = "~/Resources/Shared/components/colorbox/example1/colorbox.css"; var scriptTemplate = "<script type=\"text/javascript\">" + "$(document).ready(function(){" + "$(\"a[data-colorbox=module_[KEY]]\")" + ".colorbox({rel:\"module_[KEY]\",photo:true,maxWidth:\"95%\",maxHeight:\"95%\"});" + "});</script>"; literalScript.Text = scriptTemplate.Replace ("[KEY]", Key); }
/// <summary> /// Requests that a JavaScript file be registered on the client browser /// </summary> /// <param name="page">The current page. Used to get a reference to the client resource loader.</param> /// <param name="filePath">The relative file path to the JavaScript resource.</param> /// <param name="priority">The relative priority in which the file should be loaded.</param> /// <param name="provider">The name of the provider responsible for rendering the script output.</param> public static void RegisterScript(Page page, string filePath, int priority, string provider) { var include = new DnnJsInclude { ForceProvider = provider, Priority = priority, FilePath = filePath.ToLowerInvariant(), AddTag = false }; var loader = page.FindControl("ClientResourceIncludes"); if (loader != null) { loader.Controls.Add(include); } }
// NOTE: using ClientResourceManager.RegisterStyleSheet(), ClientResourceManager.RegisterScript() and // Page.ClientScript.RegisterStartupScript() methods won't produce cached content, // so we use DnnJsInclude, DnnCssInclude controls to make links on the lighbox scripts and stylesheets, // and literal to store startup script block. Produced content will be cached this way. public abstract void Register (DnnJsInclude includeJs, DnnCssInclude includeCss, Literal literalScript);