protected override void Render(HtmlTextWriter writer) { base.Render(writer); if (StringUtil.IsNullOrEmpty(Js)) { return; } ClientScriptProxy proxy = ClientScriptProxy.Current; foreach (string js in StringUtil.Split(Js, ",", true, true)) { if (js.Contains("|")) { string[] array = StringUtil.Split(js, "|", true, true); if (array.Length != 2) { continue; } proxy.RegisterJsResource(array[1], array[0]); } else if (js.EndsWith(".js", StringComparison.InvariantCultureIgnoreCase)) { if (js.Contains("*")) { string vp = "/"; var index = js.LastIndexOf('/'); if (index != -1) { vp = js.Substring(0, index + 1); } string path; if (vp.StartsWith(".")) { path = ServerUtil.MapPath(StringUtil.CombinUrl(CurrentSite.VirtualPath, CurrentSite.ThemeRoot, MobileDetect.Instance.GetRealThemeName(CurrentSite), vp.Substring(1))); } else { path = ServerUtil.MapPath(StringUtil.CombinUrl(CurrentSite.VirtualPath, vp)); } if (!Directory.Exists(Path.GetDirectoryName(path))) { continue; } foreach (var item in Directory.GetFiles(Path.GetDirectoryName(path), js.Substring(index + 1), SearchOption.AllDirectories)) { string relativePath = item.ToLower().Replace(path.ToLower(), string.Empty); relativePath = relativePath.Replace(Path.DirectorySeparatorChar, '/'); if (vp.StartsWith("~")) { proxy.RegisterJs(StringUtil.CombinUrl(ServerUtil.ResolveUrl(vp), relativePath), NoCombine); } else if (vp.StartsWith(".")) { proxy.RegisterJs(StringUtil.CombinUrl(CurrentSite.VirtualPath, CurrentSite.ThemeRoot, MobileDetect.Instance.GetRealThemeName(CurrentSite), vp.Substring(1), relativePath), NoCombine); } else { proxy.RegisterJs(StringUtil.CombinUrl(CurrentSite.VirtualPath, StringUtil.CombinUrl(vp, relativePath)), NoCombine); } } } else { if (js.StartsWith("~")) { proxy.RegisterJs(ServerUtil.ResolveUrl(js), NoCombine); } else if (js.StartsWith(".")) { proxy.RegisterJs(StringUtil.CombinUrl(CurrentSite.VirtualPath, CurrentSite.ThemeRoot, MobileDetect.Instance.GetRealThemeName(CurrentSite), js.Substring(1)), NoCombine); } else { proxy.RegisterJs(StringUtil.CombinUrl(CurrentSite.VirtualPath, js), NoCombine); } } } else { proxy.RegisterJsResource( GetType(), string.Format("Kiss.Web.jQuery.{0}.js", js), NoCombine); } } }