Try using a lazy loader  which will inject the jquery request into the
page
http://wonko.com/post/painless_javascript_lazy_loading_with_lazyload

I did something like this
        var LazyLoad=function(){var E=document,D=null,A=[],C;function B(){if
(C){return }var G=navigator.userAgent,F;C={gecko:0,ie:0,webkit:
0};F=G.match(/AppleWebKit\/(\S*)/);if(F&&F[1]){C.webkit=parseFloat(F
[1])}else{F=G.match(/MSIE\s([^;]*)/);if(F&&F[1]){C.ie=parseFloat(F[1])}
else{if((/Gecko\/(\S*)/).test(G)){C.gecko=1;F=G.match(/rv:([^\s\)]
*)/);if(F&&F[1]){C.gecko=parseFloat(F[1])}}}}}return{load:function
(K,L,J,I){var H=E.getElementsByTagName("head")[0],G,F;if(K)
{K=K.constructor===Array?K:[K];for(G=0;G<K.length;++G){A.push({url:K
[G],callback:G===K.length-1?L:null,obj:J,scope:I})}}if(D||!(D=A.shift
())){return }B();F=E.createElement("script");F.src=D.url;if(C.ie)
{F.onreadystatechange=function(){if(this.readyState==="loaded"||
this.readyState==="complete"){LazyLoad.requestComplete()}}}else{if
(C.gecko||C.webkit>=420)
{F.onload=LazyLoad.requestComplete;F.onerror=LazyLoad.requestComplete}}
H.appendChild(F);if(!C.ie&&!C.gecko&&!(C.webkit>=420))
{F=E.createElement("script");F.appendChild(E.createTextNode
("LazyLoad.requestComplete();"));H.appendChild(F)}},loadOnce:function
(N,O,L,P,G){var H=[],I=E.getElementsByTagName
("script"),M,J,K,F;N=N.constructor===Array?N:[N];for(M=0;M<N.length;+
+M){K=false;F=N[M];for(J=0;J<I.length;++J){if(F===I[J].src)
{K=true;break}}if(!K){H.push(F)}}if(H.length>0){LazyLoad.load(H,O,L,P)}
else{if(G){if(L){if(P){O.call(L)}else{O.call(window,L)}}else{O.call
()}}}},requestComplete:function(){if(D.callback){if(D.obj){if(D.scope)
{D.callback.call(D.obj)}else{D.callback.call(window,D.obj)}}else
{D.callback.call()}}D=null;if(A.length){LazyLoad.load()}}}}();
        function loadme(){
                LazyLoad.loadOnce(['http://ajax.googleapis.com/ajax/libs/jquery/
1.3.2/jquery.min.js'],loadComplete);
        };
        function loadComplete(){
                //fire your jquery code

                };

then you just need to fire this after page is loaded  but this ca
inject multiple files.... but they have to be OOP to really work clean
you need to fire them after this is done laoding stuff

On Jun 25, 10:03 am, Walt <walter.cro...@gmail.com> wrote:
> I'm having trouble loading jQuery into SQL Server Reporting Services
> Report Manager.  Since SSRS is a proe-compiles ASPX
>
> page, and we are not given the source code, we have little ability to
> make changes to the interface.  If I could add jQuery
>
> directly, the progblem would be trivial.  However, all we have the
> ability to modify is an existing Javascript file that is
>
> loaded at runtime in the head of each page.
>
> I have been able to get this to load relatively reliably using IE 8,
> but other browsers either don't load it at all, or
>
> only on the first pass.
>
> Here is the structure that I have in place:
>
> 1.  Each page load /Reports/ReportManager/js/ReportingServices.js:
>
> <head>
>         <script language="JScript" src="/Reports/js/ReportingServices.js"
> type="text/Javascript"></script>
>
> 2.  ReportingServices.js Contains the following lines at the top:
>
> addLoadEvent(SetMultiSelectParamWidth);
> addLoadEvent(loadjQueryFile);
>
> function addLoadEvent(fn)
> {
>     if (window.addEventListener)
>        window.addEventListener('load', fn, false)
>     else if (window.attachEvent)
>        window.attachEvent('onload', fn);
>
> }
>
> function loadjQueryFile()
> {
>         loadjscssfile("/Reports/js/jquery-1.3.2.min.js", "js"); //dynamically
> load and add this .js file
>         loadjscssfile("/Reports/js/jQueryPageCommands.js", "js");  //
> dynmically load the js Page Commands
>
> }
>
> function loadjscssfile(filename, filetype){
>  if (filetype=="js"){ //if filename is a external JavaScript file
>   var fileref=document.createElement('script')
>   fileref.setAttribute("type","text/javascript")
>   fileref.setAttribute("src", filename)
>  }
>  else if (filetype=="css"){ //if filename is an external CSS file
>   var fileref=document.createElement("link")
>   fileref.setAttribute("rel", "stylesheet")
>   fileref.setAttribute("type", "text/css")
>   fileref.setAttribute("href", filename)
>  }
>  if (typeof fileref!="undefined")
>   document.getElementsByTagName("head")[0].appendChild(fileref)
>
> }
>
> The first addLoadEvent is for a user interface modification for SSRS
> itself.  The second loads the jquery system as well as
>
> some jquery commands.
>
> I understand that there is some discussion that the addLoadEvent that
> I am using will wipe out an existing LoadEvent.  I
>
> also understand that Simon Willison has specified a more reliable
> loader at
>
> http://simonwillison.net/2004/May/26/addLoadEvent/ -- however, when I
> try that version, I don't seem to get it to load at
>
> all.  Willison's code looks like:
>
> function addLoadEvent(func) {
>   var oldonload = window.onload;
>   if (typeof window.onload != 'function') {
>     window.onload = func;
>   } else {
>     window.onload = function() {
>       oldonload();
>       func();
>     }
>   }
>
> }
>
> 3  The jQueryPageCommands contains:
>
>    $(document).ready(function(){
>         $("a:contains('Test 1')").attr('href','http://www.google.com');
>    });
>
> Which I use as a test to modify a URL.  On the browsers that this
> works on, the URL is modified as requested.
>
> Some of the things that I have been thinking about:
>
> 1.  Switch to the googleapu method of loading jquery.
> 2.  trying to get Simon Willison's addLoadEvent to properly work.
> 3.  Trying to load fewer js files into Head, and seeing if I can load
> some of this stuff inline
> 4.  Finding an already used inline function that is running in SSRS on
> each page, and trying to stuff my code into that.
> 5.  Decompile Report Manager and try to rebuild it myself.
>
> Any ideas or recommendations would be gladly accepted.
>
> Walt Crosby
> VP of Development
> Interval Data Systems, Inc.

Reply via email to