protected void sm_ResolveScriptReference(object sender, ScriptReferenceEventArgs e) { if (System.Array.IndexOf(MicrosoftJavaScript, e.Script.Name) >= 0) { e.Script.Path = String.Format("~/Scripts/{0}?{1}", e.Script.Name, ApplicationServices.Version); } }
protected void sm_ResolveScriptReference(object sender, ScriptReferenceEventArgs e) { if (System.Array.IndexOf(MicrosoftJavaScript, e.Script.Name) >= 0) { e.Script.Name = ("TimeNAction.Scripts." + e.Script.Name); e.Script.Assembly = typeof(AquariumExtenderBase).Assembly.FullName; } }
protected override void OnResolveScriptReference(ScriptReferenceEventArgs args) { base.OnResolveScriptReference(args); // If the bundle is created and it is not a postponed script, override the path of the script to the path of the bundle if (_bundle != null && _bundle.Paths.Contains(GetUrl(args.Script)) && !_postponedList.Contains(args.Script.Path)) { args.Script.Path = "/" + BundleHandler.UrlPart + "/" + _bundle.FakeFilename; } }
private void ResolveScriptReferenceHandler(object sender, ScriptReferenceEventArgs e) { var clonedReference = string.IsNullOrEmpty(e.Script.Path) ? new ScriptReference(e.Script.Name, e.Script.Assembly) : new ScriptReference(e.Script.Path); clonedReference.IgnoreScriptPath = e.Script.IgnoreScriptPath; clonedReference.ResourceUICultures = e.Script.ResourceUICultures; clonedReference.ScriptMode = ScriptMode.Auto; _references.Add(clonedReference); }
protected void sm_ResolveScriptReference(object sender, ScriptReferenceEventArgs e) { if (System.Array.IndexOf(MicrosoftJavaScript, e.Script.Name) >= 0) { if (AquariumExtenderBase.EnableCombinedScript) { string lang = CultureInfo.CurrentUICulture.IetfLanguageTag.ToLower(); string scriptPath = ResolveUrl(String.Format("~/appservices/combined-{0}.{1}.js", ApplicationServices.Version, lang)); if (ApplicationServices.IsTouchClient) { scriptPath = String.Format("{0}?_spa", scriptPath); } e.Script.Path = scriptPath; e.Script.ResourceUICultures = null; return; } e.Script.Path = String.Format("~/Scripts/{0}?{1}", e.Script.Name, ApplicationServices.Version); } }
/// <summary> /// On async post back, control carries out the script references information that needed to be added to the Page. /// In this overridden method, script will be determined whether it's already combined or not. /// If it's already combined then we just need to change the pointer of script reference to combined script address, /// so there will be no redundant scripts added on a Page. /// </summary> /// <param name="e"></param> protected override void OnResolveScriptReference(ScriptReferenceEventArgs e) { #if !NET40 && !NET45 ApplyAssembly(e.Script, false); #endif base.OnResolveScriptReference(e); bool enableCdn = false; #if NET45 || NET40 enableCdn = EnableCdn; #endif if (_combineScripts && !IsDebugMode && !String.IsNullOrEmpty(e.Script.Assembly) && !String.IsNullOrEmpty(e.Script.Name) && _combiner.IsScriptRegistered(e.Script) && _combiner.IsScriptCombinable(e.Script, enableCdn)) { // Verify combined script URL. When async postback occurred, the _combinedScriptUrl is lost, // we need to restore it from posted hidden field if (IsInAsyncPostBack && String.IsNullOrEmpty(_combinedScriptUrl)) { var contentHash = Page.Request.Form[HiddenFieldParamName]; if (String.IsNullOrEmpty(contentHash)) { throw new Exception(HiddenFieldParamName + " is empty"); } _combinedScriptUrl = BuildCombinedScriptUrl(contentHash); } // Change script reference address to combined script URL if (!string.IsNullOrEmpty(_combinedScriptUrl)) { e.Script.Name = ""; e.Script.Assembly = ""; e.Script.Path = _combinedScriptUrl; } } }
protected override void OnResolveScriptReference(ScriptReferenceEventArgs e) { base.OnResolveScriptReference(e); ScriptReference script = e.Script; ScriptEntry item = new ScriptEntry(script); if (this.ScriptsBuckets != null) { foreach (CombinableScripts combinableScripts in this.ScriptsBuckets) { if (combinableScripts.Scripts.Contains(item)) { script.Name = string.Empty; script.Assembly = string.Empty; script.Path = base.ResolveUrl(this.ScriptsPath + combinableScripts.Alias.ToLower() + ".js"); if (combinableScripts.HasScriptResources) { this.AddScriptResourceLink(combinableScripts.Alias); } break; } } } }
protected override void OnResolveScriptReference(ScriptReferenceEventArgs e) { #if !NET4 && !NET45 ApplyAssembly(e.Script, false); #endif base.OnResolveScriptReference(e); // If combining scripts and this is a candidate script if (_combineScripts && !String.IsNullOrEmpty(e.Script.Assembly) && !String.IsNullOrEmpty(e.Script.Name)) { // Initialize ScriptReference scriptReference = e.Script; ScriptEntry scriptEntry = new ScriptEntry(scriptReference); if (IsScriptCombinable(scriptEntry)) { if (!_scriptEntries.Contains(scriptEntry)) { // Haven't seen this script yet; add it to the list and invalidate the Url _scriptEntries.Add(scriptEntry); _combinedScriptUrl = null; } if (null == _combinedScriptUrl) { // Url is invalid; update it _combinedScriptUrl = String.Format(CultureInfo.InvariantCulture, "{0}?{1}={2}&{3}={4}", ((null != _combineScriptsHandlerUrl) ? _combineScriptsHandlerUrl.ToString() : Page.Request.Path.Replace(" ", "%20")), HiddenFieldParamName, HiddenFieldName, CombinedScriptsParamName, HttpUtility.UrlEncode(SerializeScriptEntries(_scriptEntries, false))); } // Remove the script from the list and track it scriptReference.Name = ""; scriptReference.Assembly = ""; _disabledScriptReferences.Add(scriptReference); // Update the common (combined) Url for all tracked scripts foreach (ScriptReference disabledScriptReference in _disabledScriptReferences) { disabledScriptReference.Path = _combinedScriptUrl; } } else { // See if we've already seen this uncombinable script reference bool alreadySeen = false; foreach (ScriptReference uncombinableScriptReference in _uncombinableScriptReferences) { if ((uncombinableScriptReference.Assembly == scriptReference.Assembly) && (uncombinableScriptReference.Name == scriptReference.Name)) { alreadySeen = true; } } if (!alreadySeen) { // Haven't seen the script reference yet, so we need to stop building the current combined script // file and let the uncombinable script reference be output so as not to alter the ordering of // scripts (which may have dependencies). Update our state so we'll start building a new combined // script file with the next combinable script. // Note: _combinedScriptUrl was initially cleared here. While that's correct behavior (and was // released without issue), not clearing it means that we can omit an unnecessary <script> tag // for the scenario "CombinableA, Uncombinable?, CombinableA, Uncombinable?" because the second // instance of CombinableA will reuse the URL from the first (vs. an empty one) and ScriptManager // will detect and omit the redundant URL. _uncombinableScriptReferences.Add(scriptReference); _disabledScriptReferences.Clear(); foreach (ScriptEntry se in _scriptEntries) { se.Loaded = true; } } } } }
protected void sm_ResolveScriptReference(object sender, ScriptReferenceEventArgs e) { }