SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 33
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Find me a handle in .js file

    While minifying script files I need to prevent a .js file from it. The instructions ask me to put in the Handle name and not the filename. Can anyone please help me out?

    (I did not know whether I should post it here or in WordPress section.)
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Handles are abstract and typically only relevant to the OS's memory of which they're stored on

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How does this reply help me? please do not put unclear and vague statements that do not help to solve the problem. It frustrates.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,807
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    JavaScript itself doesn't have handles. It is whatever application you are using that has defined the handle you need to reference. Without knowing what application you are referring to it is impossible to know where you need to go to find the handle.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    I'm not 100% sure, but after browsing around a bit (esp http://codex.wordpress.org/Function_...enqueue_script) and checking wp-cycle.php (esp the line wp_enqueue_script('cycle', WP_CONTENT_URL.'/plugins/wp-cycle/jquery.cycle.all.min.js', array('jquery'), '', true); ), I think the handle you're looking for is 'cycle'
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  6. #6
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by coolygreen View Post
    How does this reply help me? please do not put unclear and vague statements that do not help to solve the problem. It frustrates.
    It helps you by letting you know that your question is as vague as the answer you've received. I've told you what a handle is and I've explained to you that JS isn't typically written with reference to handles by letting you know that OS's usually create the handles rather than scripts.

    I may be wrong but i doubt "cycle" is the handle.
    As an assembly programmer, what i know about handles tells me that what you're looking for is going to be a seemingly random hex string . i.e. "723FA1-3D4CBC-6FF23A-411DFA"
    The handle will be stored in memory(RAM) on the wordpress server at the time of script execution. (Like I said before...)

    Unless you have some other enlightening information to provide about exactly what you're trying to do or what you mean by "handle" than I doubt anyone will be able to help you much.

    I believe the information you're looking for is probably the reference value of the script object.
    If you're attempting to prevent access to a certain script you're going to be defeating yourself by creating the object within the script you want to block.
    Otherwise you'll have to invoke an OS call along the lines of "CreateFile()" which will instantiate said "handle" in memory on the server.

    Could you point me towards the directions you speak of?

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What can I say? I am a newbie and have no idea what more to add. I had uploaded the message pic and the script in question. Looking at your replies it appears the programmer who created the minifying script is at fault. I think he should have given some sample of what he expects, then maybe you all could have helped.

  8. #8
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Just curious, have you tried 'cycle' ?
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  9. #9
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No. I think I should try contacting the author. I am scared of seeing unexpected behavior so I decided not to "try".

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    More context is required. Can you please show us more from where your instruction came from?

    To ignore a script, just copy the handle (not the filename!) and put it in the 'Scripts to be ignored' box on a separate line.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    I just tried it on a fresh WP 3.1.3 install with Better WordPress Minify (I assume that's the one you're using) and WP-Cycle and I put the word 'cycle' in the text box 'Scripts to be ignored (not minified)' and that works as expected, see code below:

    Code:
    <script type='text/javascript' src='http://wp/wp-content/plugins/bwp-minify/min/?f=wp-includes/js/admin-bar.js'></script> 
    <script type='text/javascript' src='http://wp/wp-content/plugins/wp-cycle/jquery.cycle.all.min.js?ver=3.1.3'></script>
    (check how "bwp-minify" is not in the second src)
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  12. #12
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the input ScallioXTX. I will try and inform you of the result.

  13. #13
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks ScallioXTX. I will try and report back.

  14. #14
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, it did not work. First I used the bottom code with wp-cycle and then both. Once I put the code and update, the code vanished from the window and the image rotator stopped.
    see it here: Free Accident Insurance | Prevent Accidents, Injuries &#038; Trauma

    May be there are some other settings and/or conflicts on my site. But I have no idea

  15. #15
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Your code is still being minified. Did you use 'cycle' (~not~ 'wp-cycle'), and fill that in in the field 'Scripts to be ignored (not minified)' ?
    (see attachment for my working settings)

    And indeed it may be a conflict with some other script, but I can't see that from here ...
    Attached Images Attached Images
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  16. #16
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry Sir, it does not work. The rotator is unoperative.

  17. #17
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    I see, but it doesn't work because the page has an error: jQuery is not defined (it says so in the JS console of chrome)

    And that error is caused by the minify script not working. The JS url returns an HTTP 400 error, saying the request is not valid. So you don't get jQuery, and the plugin doesn't work because it's dependent on jQuery.

    I had the same problem, and fixed by changing line 65 of wp-content/plugins/bwp-minify/min/config.php to:

    PHP Code:
    $min_documentRoot realpath(dirname(__FILE__).'/../../../..'); 
    But at least what we set out for is working now: the js script is not minified, so we have established that it's handle is, indeed, 'cycle'
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  18. #18
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I read you correctly, the handle name provided is "cycle", yet the minify plugin cannot isolate and blocks the needed jquery.

    Till now I have tried this one and wp-minify. Do you know of any better plugins, as I just have the option of NOT minifying altogether.

  19. #19
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    jQuery doesn't load because the minify plugin doesn't work correctly (because it assumes there is a setting available in PHP -- $_SERVER['DOCUMENT_ROOT'] to be precise -- which is not available on your system, for whatever reason).
    The change I proposed in my previous post to line 65 to config.php solves that problem and if you do that the plugin works (at least it does on my system), and everything is good to go.

    As for the other minify plugins, I have no idea; I've never really looked for any.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  20. #20
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sir
    Thanks for your reply. Could you help one last bit more? Please help me configure the setting you told:

    "$min_documentRoot = http://www.mysite.com/..'); "

    is this what I have to enter?

  21. #21
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    No, what you have to enter is $min_documentRoot = realpath(dirname(__FILE__).'/../../../..');
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  22. #22
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I entered, but still it does not work.

  23. #23
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Okay, than that probably wasn't the problem.

    Looking at the script some more I see it's trying to include wp-content/plugins/estore/lib/jquery.cookie.js and wp-content/plugins/estore/lib/jquery.lightbox-0.5.pack.js, and both of those files don't exists.

    In that case minify also gives the error 400. Do you know to which plugin those files belong? Can you try turning off the plugin and see if it works then?
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  24. #24
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I deactivated the said plugin and now the rotator works. But is it the solution? I need the plugin

  25. #25
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,063
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Apparently that estore plugin is broken in that includes javascript files that don't exist. So you can either try to contact the author of the estore plugin and ask him to fix his plugin, or disable the minify plugin.
    Or if you're tech savvy you could try to fix the estore plugin yourself.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Bookmarks

Posting Permissions

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