Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12

Thread: all in one js?

  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts

    all in one js?

    Code:
    <script type="text/javascript" src="http://tf.ivorpadilla.net/pixelcreative/min/b=pixelcreative/js&f=jquery.faded.js,jquery.tipsy.js,supersubs.js,hoverIntent.js,superfish.js,jquery.nivo.slider.pack.js,browser.selector.js,pixelstudio.js,stylesheetToggle.js"></script>
    saw this code in one of a premium themes may i know how to make it work? because my current webpage the script line is around 7 line so i prefer to make it single line as above

    may i know how do it work or what this call as?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Quote Originally Posted by lazyserv View Post
    Code:
    <script type="text/javascript" src="http://tf.ivorpadilla.net/pixelcreative/min/b=pixelcreative/js&f=jquery.faded.js,jquery.tipsy.js,supersubs.js,hoverIntent.js,superfish.js,jquery.nivo.slider.pack.js,browser.selector.js,pixelstudio.js,stylesheetToggle.js"></script>
    saw this code in one of a premium themes may i know how to make it work? because my current webpage the script line is around 7 line so i prefer to make it single line as above

    may i know how do it work or what this call as?
    Why? Let well alsone! But you can place multiple .js files on one line separated by commas if you insist, although it makes it harder to read and debug.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Quote Originally Posted by lazyserv View Post
    Code:
    <script type="text/javascript" src="http://tf.ivorpadilla.net/pixelcreative/min/b=pixelcreative/js&f=jquery.faded.js,jquery.tipsy.js,supersubs.js,hoverIntent.js,superfish.js,jquery.nivo.slider.pack.js,browser.selector.js,pixelstudio.js,stylesheetToggle.js"></script>
    saw this code in one of a premium themes may i know how to make it work? because my current webpage the script line is around 7 line so i prefer to make it single line as above

    may i know how do it work or what this call as?
    Why? Let well alone! But you can place multiple .js files on one line separated by commas if you insist, although it makes it harder to read and debug.

    "If it ain't broke, keep on at it until it is".
    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • #4
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts
    so let say my scripts i put it in js folder so i assume this is the code?

    Code:
    http://www.example.com/js/jquery.js,fancybox.js,java.js
    am i correct?

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Yes, surrounded by <script> tags.

  • #6
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts
    thanks bro u save my day again

  • #7
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts
    tested the website work with my original code
    Code:
    <script src="./scripts/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="./scripts/easing.js" type="text/javascript"></script>
    <script src="./scripts/coda-slider.js" type="text/javascript"></script>
    <script src="./scripts/pirobox.js" type="text/javascript"></script>
    <script src="./scripts/color.js" type="text/javascript"></script>
    <script src="./scripts/nivo-slider.js" type="text/javascript"></script>
    <script src="./scripts/curvycorners.js" type="text/javascript"></script>
    <script src="./scripts/cufon-yui.js" type="text/javascript"></script>
    <script src="./scripts/porscha.font.js" type="text/javascript"></script>
    <script src="./scripts/main.js" type="text/javascript"></script>
    is working but if i put this code to replace all this code and is not working

    Code:
    <script src="http://www.domain.com/website/scripts/easing.js,coda-slider.js,pirobox.js,color.js,nivo-slider.js,curvycorners.js,cufon-yui.js,porscha.font.js,main.js" type="text/javascript"></script>
    please advise

  • #8
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts
    bump~ anyone can help me?

  • #9
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    I am afraid that the advice I gave you was incorrect - it seems that you may not place multiple .js files within one src tag. I do not understand how the code you mentioned in your original post could work.

    But why do you want to do this anyway? It seems pointless.

  • #10
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts
    because i wanted to make my source look cleaner

    i made my website to jquery powered so inside alot of jquery js when view it at source it look so untidy...

    btw this is the site original link.. maybe u have a look and let me know is it they got use other script to make it work?

    http://tf.ivorpadilla.net/pixelcreative/

  • #11
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That site is using a minifier, you can see that here (I took it from the source of the link you provided):
    http://tf.ivorpadilla.net/pixelcreative/min/

    That's Minify URI Builder:
    http://code.google.com/p/minify/

    As it says: "Minify is a PHP5 app that helps you follow several of Yahoo!'s Rules for High Performance Web Sites"

    As you can see, it is not just for "tidy coding", but to reduce the requests and bytes sent and received

    Regards.

  • #12
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Quote Originally Posted by Philip M View Post
    I am afraid that the advice I gave you was incorrect - it seems that you may not place multiple .js files within one src tag. I do not understand how the code you mentioned in your original post could work.

    But why do you want to do this anyway? It seems pointless.
    The original code works because the multiple js files are passed as parameter (and not as script src files itself as you had thought) to the minifier script that zemma correctly pointed out. Minifying is not for tidying code, actually it untidies your js code as it removes whitespaces, but for reducing file size and increasing download performance resulting to faster loading pages. This is becoming standard nowadays especially for big sites that heavily rely on Javascript.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •