Beispiel #1
0
 public static TElement[] Scripts <TElement, TAttribute, TObject>(IElementProvider <TElement, TAttribute, TObject> elementProvider, bool isDebug = false, TimeSpan?refreshPeriod = null, bool isInlineSyncScript = true)
 {
     return(new[]
     {
         elementProvider.Element("meta",
                                 elementProvider.Attribute("http-equiv", "X-UA-Compatible"),
                                 elementProvider.Attribute("content", "IE=11")
                                 ),
         //<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
         elementProvider.Element("link",
                                 elementProvider.Attribute("rel", "stylesheet"),
                                 elementProvider.Attribute("href", "http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css")
                                 ),
         elementProvider.Element("script", elementProvider.Attribute("src", "http://cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.min.js"), ""),
         isDebug
     ? elementProvider.Element("script", elementProvider.Attribute("src", "http://code.jquery.com/jquery-1.10.2.js"), "")
     : elementProvider.Element("script", elementProvider.Attribute("src", "http://code.jquery.com/jquery-1.10.2.min.js"), ""),
         elementProvider.Element("script", elementProvider.Attribute("src", "http://code.jquery.com/ui/1.10.3/jquery-ui.js"), ""),
         isInlineSyncScript
   ? elementProvider.Element("script",
                             elementProvider.Attribute("type", "text/javascript"),
                             elementProvider.Raw(SyncScript)
                             )
   : default(TElement),
         isInlineSyncScript ? default(TElement) : elementProvider.Element("script", elementProvider.Attribute("src", "/sync.js"), ""),
         isInlineSyncScript ? default(TElement) : elementProvider.Element("script", "$(function(){new ContainerSynchronizer(__ARGS__);});".Replace("__ARGS__", refreshPeriod != null ? "null, null, " + refreshPeriod.Value.TotalMilliseconds.ToString("f0") : ""))
     });
 }
Beispiel #2
0
 public static TElement[] Scripts <TElement, TAttribute, TObject>(IElementProvider <TElement, TAttribute, TObject> elementProvider, bool isDebug = false, TimeSpan?refreshPeriod = null, bool isInlineSyncScript = true, string syncJsName = null, string frame = null)
 {
     return(new[]
     {
         elementProvider.Element("meta",
                                 elementProvider.Attribute("http-equiv", "X-UA-Compatible"),
                                 elementProvider.Attribute("content", "IE=11")
                                 ),
         isDebug
     ? elementProvider.Element("script", elementProvider.Attribute("src", "https://code.jquery.com/jquery-1.10.2.js"), "")
     : elementProvider.Element("script", elementProvider.Attribute("src", "https://code.jquery.com/jquery-1.10.2.min.js"), ""),
         isInlineSyncScript
   ? elementProvider.Element("script",
                             elementProvider.Attribute("type", "text/javascript"),
                             elementProvider.Raw(SyncScript)
                             )
   : default(TElement),
         isInlineSyncScript ? default(TElement) : elementProvider.Element("script", elementProvider.Attribute("src", (!syncJsName.IsNullOrEmpty() && !syncJsName.StartsWith("/") ? "/" + syncJsName : syncJsName) ?? "/sync.js"), ""),
         isInlineSyncScript ? default(TElement) : elementProvider.Element("script", "$(function(){new ContainerSynchronizer(__ARGS__);});".Replace("__ARGS__", refreshPeriod != null ? "null, null, " + refreshPeriod.Value.TotalMilliseconds.ToString("f0") : ""))
     });
 }