i am using a hosted cms that will automatically include prototype.js but only if certain elements of the CMS are being used on the page. if those elements are not being used on the page then prototype is not included. this is a pain because i want to write some of my own prototype scripts to use on the page but if prototype is not included i obviously get errors with my scripts. so with that said, i was thinking that there must be a way to include a javascript that check to see if prototype has been included already, and inf it hasn''t been included - include it. does anyone have any idea how i could accomplish this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You could just do a simple check to see if Prototype has been defined... if (!Prototype) includePrototype() Where I''ll leave the implementation of includePrototype() for you to Google ("lazy loading javascript files")... On 11/27/07, bdee1 <blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > i am using a hosted cms that will automatically include prototype.js > but only if certain elements of the CMS are being used on the page. > if those elements are not being used on the page then prototype is not > included. > > this is a pain because i want to write some of my own prototype > scripts to use on the page but if prototype is not included i > obviously get errors with my scripts. > > so with that said, i was thinking that there must be a way to include > a javascript that check to see if prototype has been included already, > and inf it hasn''t been included - include it. > > does anyone have any idea how i could accomplish this? > > >-- Ryan Gahl Manager, Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com -- Architect WebWidgetry.com / MashupStudio.com Future Home of the World''s First Complete Web Platform -- Inquire: 1-262-951-6727 Blog: http://www.someElement.com LinkedIn Profile: http://www.linkedin.com/in/ryangahl --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote:> > i am using a hosted cms that will automatically include prototype.js > but only if certain elements of the CMS are being used on the page. > if those elements are not being used on the page then prototype is not > included. > > this is a pain because i want to write some of my own prototype > scripts to use on the page but if prototype is not included i > obviously get errors with my scripts. > > so with that said, i was thinking that there must be a way to include > a javascript that check to see if prototype has been included already, > and inf it hasn''t been included - include it. > > does anyone have any idea how i could accomplish this?<script type="text/javascript"> if (!(window.Prototype && window.Prototype.Version)) { document.write(''<scrip'' + ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + ''t>''; } </script> --Greg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
i keep getting an "unterminated string literal" error on the following line: document.write(''<script type="text/javascript" src="/Websites/ndbg/ templates/NDBG/scripts/prototype.js"></script>''); not sure why. any thoughts? On Nov 27, 11:59 am, Gregory Seidman <gsslist +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote:> On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > i am using a hosted cms that will automatically include prototype.js > > but only if certain elements of the CMS are being used on the page. > > if those elements are not being used on the page then prototype is not > > included. > > > this is a pain because i want to write some of my own prototype > > scripts to use on the page but if prototype is not included i > > obviously get errors with my scripts. > > > so with that said, i was thinking that there must be a way to include > > a javascript that check to see if prototype has been included already, > > and inf it hasn''t been included - include it. > > > does anyone have any idea how i could accomplish this? > > <script type="text/javascript"> > if (!(window.Prototype && window.Prototype.Version)) { > document.write(''<scrip'' + > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > ''t>'';} > > </script> > > --Greg- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
did you wrap the text or did the email client wrap the text? as in is there actually a line break in your code? document.write(''<script type="text/javascript" src="/Websites/ndbg/ templates/NDBG/scripts/prototype.js"></script>''); On Nov 27, 2007 1:58 PM, bdee1 <blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > i keep getting an "unterminated string literal" error on the following > line: > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > templates/NDBG/scripts/prototype.js"></script>''); > > not sure why. any thoughts? > > On Nov 27, 11:59 am, Gregory Seidman <gsslist > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > > > i am using a hosted cms that will automatically include prototype.js > > > but only if certain elements of the CMS are being used on the page. > > > if those elements are not being used on the page then prototype is not > > > included. > > > > > this is a pain because i want to write some of my own prototype > > > scripts to use on the page but if prototype is not included i > > > obviously get errors with my scripts. > > > > > so with that said, i was thinking that there must be a way to include > > > a javascript that check to see if prototype has been included already, > > > and inf it hasn''t been included - include it. > > > > > does anyone have any idea how i could accomplish this? > > > > <script type="text/javascript"> > > if (!(window.Prototype && window.Prototype.Version)) { > > document.write(''<scrip'' + > > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > > ''t>'';} > > > > </script> > > > > --Greg- Hide quoted text - > > > > - Show quoted text - > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
that was the email client - in my page there is no break in the text. also i notice that on my page, a ''); } is displayed so it looks like it is dying right before the closing single quote. On Nov 27, 1:59 pm, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> did you wrap the text or did the email client wrap the text? > as in > > is there actually a line break in your code? > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > templates/NDBG/scripts/prototype.js"></script>''); > > On Nov 27, 2007 1:58 PM, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > i keep getting an "unterminated string literal" error on the following > > line: > > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > > templates/NDBG/scripts/prototype.js"></script>''); > > > not sure why. any thoughts? > > > On Nov 27, 11:59 am, Gregory Seidman <gsslist > > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > > On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > > > i am using a hosted cms that will automatically include prototype.js > > > > but only if certain elements of the CMS are being used on the page. > > > > if those elements are not being used on the page then prototype is not > > > > included. > > > > > this is a pain because i want to write some of my own prototype > > > > scripts to use on the page but if prototype is not included i > > > > obviously get errors with my scripts. > > > > > so with that said, i was thinking that there must be a way to include > > > > a javascript that check to see if prototype has been included already, > > > > and inf it hasn''t been included - include it. > > > > > does anyone have any idea how i could accomplish this? > > > > <script type="text/javascript"> > > > if (!(window.Prototype && window.Prototype.Version)) { > > > document.write(''<scrip'' + > > > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > > > ''t>'';} > > > > </script> > > > > --Greg- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
i don''t know but it works escaping the slash of closing script tag O.o document.write(''<script src=\"me.js\" type=\"text/javascript\"><\/script>''); On Nov 27, 2007 12:58 PM, bdee1 <blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > i keep getting an "unterminated string literal" error on the following > line: > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > templates/NDBG/scripts/prototype.js"></script>''); > > not sure why. any thoughts? > > On Nov 27, 11:59 am, Gregory Seidman <gsslist > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > > > i am using a hosted cms that will automatically include prototype.js > > > but only if certain elements of the CMS are being used on the page. > > > if those elements are not being used on the page then prototype is not > > > included. > > > > > this is a pain because i want to write some of my own prototype > > > scripts to use on the page but if prototype is not included i > > > obviously get errors with my scripts. > > > > > so with that said, i was thinking that there must be a way to include > > > a javascript that check to see if prototype has been included already, > > > and inf it hasn''t been included - include it. > > > > > does anyone have any idea how i could accomplish this? > > > > <script type="text/javascript"> > > if (!(window.Prototype && window.Prototype.Version)) { > > document.write(''<scrip'' + > > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > > ''t>'';} > > > > </script> > > > > --Greg- Hide quoted text - > > > > - Show quoted text - > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Nov 27, 2007 at 01:17:10PM -0600, Elden wrote:> i don''t know but it works > > escaping the slash of closing script tag O.o > > document.write(''<script src=\"me.js\" type=\"text/javascript\"><\/script>'');If you had copied my script verbatim (except changing the src URL), it would have worked. Did you not notice that I was deliberately breaking up the <script and </script tags? The unterminated string literal error is because the browser sees </script> and takes it to mean the end of the current script tag, even though it is in a string literal. Escaping the / doesn''t so much escape it as keep it from looking like a proper end tag. --Greg> On Nov 27, 2007 12:58 PM, bdee1 <blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > i keep getting an "unterminated string literal" error on the following > > line: > > > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > > templates/NDBG/scripts/prototype.js"></script>''); > > > > not sure why. any thoughts? > > > > On Nov 27, 11:59 am, Gregory Seidman <gsslist > > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > > On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > > > > > i am using a hosted cms that will automatically include prototype.js > > > > but only if certain elements of the CMS are being used on the page. > > > > if those elements are not being used on the page then prototype is not > > > > included. > > > > > > > this is a pain because i want to write some of my own prototype > > > > scripts to use on the page but if prototype is not included i > > > > obviously get errors with my scripts. > > > > > > > so with that said, i was thinking that there must be a way to include > > > > a javascript that check to see if prototype has been included already, > > > > and inf it hasn''t been included - include it. > > > > > > > does anyone have any idea how i could accomplish this? > > > > > > <script type="text/javascript"> > > > if (!(window.Prototype && window.Prototype.Version)) { > > > document.write(''<scrip'' + > > > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > > > ''t>'';} > > > > > > </script> > > > > > > --Greg- Hide quoted text - > > > > > > - Show quoted text - > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
oh - ok that makes sense - i had noticed that you broke up the script tags but had no idea why. now i get it. one more question though, now that this is working... how could i do the same thing for scriptaculous - check to see if it is included and if not, include it. On Nov 27, 2:44 pm, Gregory Seidman <gsslist +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote:> On Tue, Nov 27, 2007 at 01:17:10PM -0600, Elden wrote: > > i don''t know but it works > > > escaping the slash of closing script tag O.o > > > document.write(''<script src=\"me.js\" type=\"text/javascript\"><\/script>''); > > If you had copied my script verbatim (except changing the src URL), it > would have worked. Did you not notice that I was deliberately breaking up > the <script and </script tags? The unterminated string literal error is > because the browser sees </script> and takes it to mean the end of the > current script tag, even though it is in a string literal. Escaping the / > doesn''t so much escape it as keep it from looking like a proper end tag. > > --Greg > > > > > On Nov 27, 2007 12:58 PM, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > i keep getting an "unterminated string literal" error on the following > > > line: > > > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > > > templates/NDBG/scripts/prototype.js"></script>''); > > > > not sure why. any thoughts? > > > > On Nov 27, 11:59 am, Gregory Seidman <gsslist > > > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > > > On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > > > > i am using a hosted cms that will automatically include prototype.js > > > > > but only if certain elements of the CMS are being used on the page. > > > > > if those elements are not being used on the page then prototype is not > > > > > included. > > > > > > this is a pain because i want to write some of my own prototype > > > > > scripts to use on the page but if prototype is not included i > > > > > obviously get errors with my scripts. > > > > > > so with that said, i was thinking that there must be a way to include > > > > > a javascript that check to see if prototype has been included already, > > > > > and inf it hasn''t been included - include it. > > > > > > does anyone have any idea how i could accomplish this? > > > > > <script type="text/javascript"> > > > > if (!(window.Prototype && window.Prototype.Version)) { > > > > document.write(''<scrip'' + > > > > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > > > > ''t>'';} > > > > > </script> > > > > > --Greg- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
any ideas on this? right now i am particularly looking for the existance of effects.js but it woudl be cool to have a test for each of the available libraries (builder.js, controls.js, dragdrop.js, effects.js, slider.js, sound.js) On Nov 27, 2:48 pm, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> oh - ok that makes sense - i had noticed that you broke up the script > tags but had no idea why. now i get it. > > one more question though, now that this is working... > > how could i do the same thing for scriptaculous - check to see if it > is included and if not, include it. > On Nov 27, 2:44 pm, Gregory Seidman <gsslist > > > > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > On Tue, Nov 27, 2007 at 01:17:10PM -0600, Elden wrote: > > > i don''t know but it works > > > > escaping the slash of closing script tag O.o > > > > document.write(''<script src=\"me.js\" type=\"text/javascript\"><\/script>''); > > > If you had copied my script verbatim (except changing the src URL), it > > would have worked. Did you not notice that I was deliberately breaking up > > the <script and </script tags? The unterminated string literal error is > > because the browser sees </script> and takes it to mean the end of the > > current script tag, even though it is in a string literal. Escaping the / > > doesn''t so much escape it as keep it from looking like a proper end tag. > > > --Greg > > > > On Nov 27, 2007 12:58 PM, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > i keep getting an "unterminated string literal" error on the following > > > > line: > > > > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > > > > templates/NDBG/scripts/prototype.js"></script>''); > > > > > not sure why. any thoughts? > > > > > On Nov 27, 11:59 am, Gregory Seidman <gsslist > > > > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > > > > On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > > > > > i am using a hosted cms that will automatically include prototype.js > > > > > > but only if certain elements of the CMS are being used on the page. > > > > > > if those elements are not being used on the page then prototype is not > > > > > > included. > > > > > > > this is a pain because i want to write some of my own prototype > > > > > > scripts to use on the page but if prototype is not included i > > > > > > obviously get errors with my scripts. > > > > > > > so with that said, i was thinking that there must be a way to include > > > > > > a javascript that check to see if prototype has been included already, > > > > > > and inf it hasn''t been included - include it. > > > > > > > does anyone have any idea how i could accomplish this? > > > > > > <script type="text/javascript"> > > > > > if (!(window.Prototype && window.Prototype.Version)) { > > > > > document.write(''<scrip'' + > > > > > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > > > > > ''t>'';} > > > > > > </script> > > > > > > --Greg- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
will that code check for script tags in the whole document (head and body) or just the body? just curious because for soem reason my gut is telling me that it would just check within the body but i could be completely wrong. On Nov 28, 3:31 am, Wizz <woutaw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If the entire CMS is used without frames, you could always iterate > through all the script elements and check if the ones you need are > there. > > $$(''script'').each(function(s) { > var scr = s.readAttribute(''src''); > // do something with src > > }); > > I think you can also just include the scripts you need, where you need > them... I''m not sure about this, but if there is a duplicate script it > will not load it again. > > Wizz > > On 27 nov, 21:36, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > any ideas on this? > > right now i am particularly looking for the existance of effects.js > > but it woudl be cool to have a test for each of the available > > libraries (builder.js, controls.js, dragdrop.js, effects.js, > > slider.js, sound.js) > > > On Nov 27, 2:48 pm, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > oh - ok that makes sense - i had noticed that you broke up the script > > > tags but had no idea why. now i get it. > > > > one more question though, now that this is working... > > > > how could i do the same thing for scriptaculous - check to see if it > > > is included and if not, include it. > > > On Nov 27, 2:44 pm, Gregory Seidman <gsslist > > > > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > > > On Tue, Nov 27, 2007 at 01:17:10PM -0600, Elden wrote: > > > > > i don''t know but it works > > > > > > escaping the slash of closing script tag O.o > > > > > > document.write(''<script src=\"me.js\" type=\"text/javascript\"><\/script>''); > > > > > If you had copied my script verbatim (except changing the src URL), it > > > > would have worked. Did you not notice that I was deliberately breaking up > > > > the <script and </script tags? The unterminated string literal error is > > > > because the browser sees </script> and takes it to mean the end of the > > > > current script tag, even though it is in a string literal. Escaping the / > > > > doesn''t so much escape it as keep it from looking like a proper end tag. > > > > > --Greg > > > > > > On Nov 27, 2007 12:58 PM, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > i keep getting an "unterminated string literal" error on the following > > > > > > line: > > > > > > > document.write(''<script type="text/javascript" src="/Websites/ndbg/ > > > > > > templates/NDBG/scripts/prototype.js"></script>''); > > > > > > > not sure why. any thoughts? > > > > > > > On Nov 27, 11:59 am, Gregory Seidman <gsslist > > > > > > +protot...-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote: > > > > > > > On Tue, Nov 27, 2007 at 08:52:04AM -0800, bdee1 wrote: > > > > > > > > > i am using a hosted cms that will automatically include prototype.js > > > > > > > > but only if certain elements of the CMS are being used on the page. > > > > > > > > if those elements are not being used on the page then prototype is not > > > > > > > > included. > > > > > > > > > this is a pain because i want to write some of my own prototype > > > > > > > > scripts to use on the page but if prototype is not included i > > > > > > > > obviously get errors with my scripts. > > > > > > > > > so with that said, i was thinking that there must be a way to include > > > > > > > > a javascript that check to see if prototype has been included already, > > > > > > > > and inf it hasn''t been included - include it. > > > > > > > > > does anyone have any idea how i could accomplish this? > > > > > > > > <script type="text/javascript"> > > > > > > > if (!(window.Prototype && window.Prototype.Version)) { > > > > > > > document.write(''<scrip'' + > > > > > > > ''t type="text/javascript" src="javascripts/prototype.js"></scrip'' + > > > > > > > ''t>'';} > > > > > > > > </script> > > > > > > > > --Greg- Hide quoted text - > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---