WalterMorris
2015-01-08T09:21:01Z
I noticed yesterday that on pages where I included the forum server control, my radMenu stopped working. After a bit of digging, I figured out that the forum was injecting the following at the bottom of the page :

Quote:

<script type="text/javascript">
//<![CDATA[

if(typeof(CKEDITOR)=='undefined' ) {Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(loadTimeAgo);function loadTimeAgo(){jQuery.timeago.settings.refreshMillis=60000;jQuery.timeago.settings.strings={prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",numbers:[]} ; jQuery('abbr.timeago' ).timeago( ) ;}}
if(typeof(jQuery.fn.hovercard)!='undefined' ){jQuery('.userHoverCard' ).hovercard({showYafCard:true,delay:2000,width:350,loadingHTML:'Loading User Info ...',errorHTML:'Sorry, no data found or something went wrong.'} ) ;}
//]]>
</script>



Firebug shows that loadTimeAgo() at the point of being called isn't defined ; that stops the processing of Javascript in the browser and thus Telerik's injected code doesn't run and the radMenu isn't initialised.

Ideally the injected code above would be wrapped inside

Quote:

Sys.Application.add_init(function()

so it runs at the correct time - I'm guessing this is going to behave differently depending on browser and version.

For the .NET developers out there, I created a workaround, which is a bit of a hack :

Quote:



Dim cs As ClientScriptManager = Page.ClientScript
If (Not cs.IsStartupScriptRegistered(Me.GetType, "DirtyHack" ) ) Then
Dim sb As New StringBuilder
sb.AppendLine("<script type=""text/javascript""> " )
sb.AppendLine("function loadTimeAgo(){}; " )
sb.AppendLine("</script>" )
cs.RegisterStartupScript(Me.GetType, "DirtyHack", sb.ToString )

End If

Sponsor
tha_watcha
2015-01-09T03:53:23Z
This is a known issue and will be fixed in YAF 2.2.0. You can also fix this by disabling "Show Relative Time" in the host settings.
UserPostedImage

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved