Results 1 to 23 of 23

Thread: [SOLVED pg.2] How to disable mediabox (lightbox) hot keys?

  1. #1
    User
    Join Date
    10-15-10.
    Posts
    279

    Default [SOLVED pg.2] How to disable mediabox (lightbox) hot keys?

    The lightbox feature has 4 hot-keys (that I know of):
    (N) Next - (P) Previous - (X) Close - (C) Close
    Is there a way to disable these hot-keys? If so, is it possible to limit the changes to one instance of a lightbox?

  2. #2
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    :cry:

  3. #3
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable lightbox hot keys?

    Is there a way to disable these hot-keys?
    Have you tried smashing them with a hammer. This sometimes works.

  4. #4
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    10 tries and $400 later... hotkeys still work

  5. #5
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    The reason I want to disable them is to use lightboxes for small forms. If the user hits X or C while typing in a form field, it closes the lightbox :? . So if I had newsletter signups and I used a lightbox for the form... every Chris and Catherine in the world will think I'm racist

  6. #6
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable lightbox hot keys?

    Is it mediabox?
    In plugins/mediabox/js there are 2 files mediabox.js and mediabox_src.js
    Changing alpha:true to alpha:false in both of these may work.

    alpha: true, // Adds 'x', 'c', 'p', and 'n' when keyboard control is also set to true
    Probably not update safe, but I don't know if theres another way that is.

  7. #7
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    i'm goin in coach............

  8. #8
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    Nope it didn't do anything...

    I checked the module I'm using the iframes through and it references rel="lightbox" ... are lightbox and mediabox the same?

  9. #9
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable lightbox hot keys?

    Not sure.
    In your page layout, under Mootools Templates is mediabox, slimbox or both selected?

    Also javascripts have a terrible habit of remaining cached... try deleting browser cache etc

  10. #10
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable lightbox hot keys?

    If its slimbox being used go to plugins/slimbox/js and alter slimbox.js and slimbox_src.js

    closeKeys: [27, 88, 67], // Array of keycodes to close Slimbox, default: Esc (27), 'x' (88), 'c' (67)
    change to closeKeys: [27]

  11. #11
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    ahhh it's mediabox-white... the .tpl file calls for mediabox.js so that is the correct file... one sec.

  12. #12
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    *sigh* no good. It seems as though the changes to the .js file has no effect on it. Tested the regular mediabox as well as mediabox-white turning alpha to false as well as keyboard to false without any luck. Caching is turned off... but just in case I purposely broke the javascript once and it updated instantly... so it's not caching the script.

    This is very perplexing :?

  13. #13
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable lightbox hot keys?

    post a link if you can and i'll check if its caching or not.

  14. #14
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    its on a private server =/

  15. #15
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable lightbox hot keys?

    i wonder though... since I'm using the mediabox via Popup_Content module... I've been wondering if there was a specially made .js file for it. I've changed every reference of x, c, n, p, and every instance of stopKey and alpha in the .js files in ...plugins/mediabox/js. For good measure, i restarted the server, cleared my firefox browser cache and cookies... and still no go. So there has to be something else controlling it from another directory... but which one

  16. #16
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable mediabox (lightbox) hot keys?

    That modules moo_mediabox-white.tpl template calls on plugins/mediabox/js/mediabox.js

    It does have this in the function
    Code:
      $$(links).mediabox({/* Put custom options here */}, null, function(el) {
    which would appear to allow you to add custom options - which is much better than my idea of hacking the plugin files.
    The only thing you need to do is make "alpha" false.At a guess (i'm a js dummy)....
    restore all your original plugin js
    try
    Code:
      $$(links).mediabox({alpha:false}, null, function(el) {
    in the template

  17. #17
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable mediabox (lightbox) hot keys?

    you were right on the money with that one.

    only problem is... it looks as if "alpha" is not the correct command...
    i used stopKey: true and it worked (doesn't allow the user to type anything within the iFrame... but hotkeys still work)
    alpha doesn't do anything... tried Alpha as well. I know the mediabox_src.js file states as a comment that 'alpha' controls the x,c,n,p keys... but iono it may be wrong.

  18. #18
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable mediabox (lightbox) hot keys?

    may need a space? alpha: false
    also keyboard must be true.

    mediaboxAdvanced v1.2.5 - The ultimate extension of Slimbox and Mediabox; an all-media script
    updated 2010.08.11
    (c) 2007-2010 John Einselen <http://iaian7.com>
    http://iaian7.com/webcode/mediaboxAdvanced
    and support
    http://groups.google.com/group/mediaboxsupport

  19. #19
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable mediabox (lightbox) hot keys?

    :? sorry for my ignorance, thought this was a unique extension to Contao. Sent the moderators a ticket to request information on hotkeys for mediabox.

  20. #20
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable mediabox (lightbox) hot keys?

    ZOMG I FIGURED IT OUT!!!

    Notice in the template for mediabox, it points to the mediabox.js. In essence, both the mediabox.js and mediabox_src.js files are identical, but mediabox.js calls different functions because it has predefined values. So the option for "alpha" was plugged in differently (looks to be hard coded into the script).

    I had to remove the two instances of the 'case' that the 2 hotkeys represented in mediabox.js (case 88, case 67), and it ceased the 'c' and 'x' input.

    In mediabox.js

    Code:
    function u(X){switch(X.code)[case 27:case 88:case67:N();break;
    in mediabox_src.js
    Code:
    function keyDown(event){switch(event.code)[case 27:case 88:case 67:close();break;
    one thing I noticed from the original code mediabox code found at
    http://codepaste.net/setr6j
    there is a string missing in between each of those
    Code:
    // In .js
    if (A.alpha){
    // In _src.js
    if (options.alpha){
    but even if I plug these into the script, it doesn't do anything. So unfortunately, the only way to remove the X and C hotkeys is to delete case 88 and case 67 from the mediabox.js file. What I find strange is that options.alpha isn't represented anywhere else in the code besides those two instances. So I wonder if alpha is a broken call function?

    EDIT: *Pats himself on the back for figuring it out* lol

  21. #21
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable mediabox (lightbox) hot keys?

    i've never figured out why there is usually a .js and a _src.js file.
    I assumed they would be identical (except one has spaces removed). I don't know if the _src one is ever called, and figured it is just there to provide a more readable version for reference.

    I'm also not sure if Leo modifies them for inclusion in Contao, but it may be worth pointing out in a ticket your findings to Leo, as it obviously affects usability .... and more importantly Scarlett Johanssen could never join your site! :D

  22. #22
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: How to disable mediabox (lightbox) hot keys?

    the thing that confuzzles me is that they look exactly the same, but they created variables for all of the functions, and smashed it all up... I attempted to force the _src.js file to be the referenced file, but all it did was break mediabox. So there is definitely something unique hidden in all that mesh of code... but why go through all the trouble of screwing with it so much to make it unreadable :?: :?: :? :?: :?:

  23. #23
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: How to disable mediabox (lightbox) hot keys?

    19 kb as opposed to 39 kb... rapid delivery i think

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
  •