Announcement

Collapse
No announcement yet.

Act_section_tree_URLs.js

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Act_section_tree_URLs.js

    Sorry for yet another thread on section trees.

    I've just made the switch from the bulky, decidedly plump Act_section_tree.js to its trimmer siblings, Act_section_tree_names.js and Act_section_treeURLs.js. However, Act_section_tree_URLs.js is still slightly portly, and for no obvious reason.

    Currently, every element of the array is declared as:
    Code:
    section_tree_URLs[3].pChild[10].sURL = "http://www.printinginks.net/cgi-bin/ss000001.pl?SECTIONID=XXXehtml&NOLOGIN=1";
    The XXX part is the only actualy variable in the document, though. So by declaring these variables:

    Code:
    var url = 'http://www.printinginks.net/cgi-bin/ss000001.pl?SECTIONID=';
    var login = 'ehtml&NOLOGIN=1';
    we can condense every line to just

    Code:
    section_tree_URLs[3].pChild[10].sURL = url+"XXX"+login;
    which results in a dramatic reduction in file size, and therefore download times. Or even better, we can give the variables arbitrary names like 'a' and 'b', remove all white space and end up with an unreadable but perfectly functional document.

    Is there any chance of Actinic implementing something along these lines to get the size of these files down? Could this be something for V8? V9, maybe?

    I could write something to go through and do it automatically, but it would have to be run every time we want to do an upload, which would make it kind of awkward to use. It would really help, since these javascript files are the single largest component of each page, making it a long wait for first-time visitors. It's a big issue for us simply because of the number of products we have in the database.

    Thanks.

    #2
    Rob,

    Is there any chance of Actinic implementing something along these lines to get the size of these files down? Could this be something for V8? V9, maybe?
    This is one for the wish list for the moment. The javascripts are actually generated by the application when you use <!--@act NETQUOTEVAR:SECTIONTREE_RAW --> in the <head> tags.

    This would need a change in the application, therefore a wishlist item for the time being. I will add it in for you.

    Kind regards,
    Bruce King
    SellerDeck

    Comment


      #3
      Thanks Bruce, that's great.

      Comment


        #4
        I've written a PHP add-on that strips the raw section tree of all unnecessary code, reduces the length of variable names and limits it to 2 or 3 levels. My code runs automatically on the server and inspects the timestamp on the Actinic generated file. It then only runs once to create a new file if the timestamp has changed.

        The results are dramatic. One huge site with a 1.4Mb file now has a 100Kb one.

        Similar savings could be made by the Actinic application if it tried a bit harder.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X