5

I am used to using Ctrll to access my address bar. Unfortunately YouTube "helpfully" defines Ctrll as a hotkey to jump forward several seconds in the currently playing video, so I need a way to stop YouTube from adding that key binding. A Greasemonkey/Scriptish userscript that disables the binding after page load would be acceptable.

To be clear, this is while I am on a YouTube video's page, not on a third-party site that has embedded a YouTube video, and the behavior occurs when the Flash player does not have focus.

Note: I am aware that Altd does the same as Ctrll in Firefox, but I'm too used to Ctrll and I'd rather not be forced to switch.

Edit: OS-specific solutions are less desirable since I use multiple OSes; in-browser solutions are preferred.

4
  • Which operating system?
    – iglvzx
    Jun 12, 2012 at 23:07
  • 1
    The OS is not relevant. This is YouTube telling the browser, in this case Firefox, to do something I don't want. (And before I am asked, yes, I verified that this happens regardless of OS.)
    – Heptite
    Jun 12, 2012 at 23:34
  • Oh. I know. If you are on Windows, I would suggest AutoHotkey to easily work around this.
    – iglvzx
    Jun 13, 2012 at 1:40
  • F6 also selects the address bar in FF with the bonus not only is it one less keystroke, but also works in IE. (Opera uses F8, though.) However, Google have been adding more keystroke shortcuts to their websites, obviously believing that if you want to interact with the browser itself, you should grab the mouse.
    – staticsan
    Jun 19, 2012 at 0:56

4 Answers 4

2

First, the bug has been around since 2001. Or earlier. It was reported as far back as that.

Reported: 2001-05-01 14:28 PDT

Mozilla Bug Report. Which tells you that not only is Mozilla aware of it, but they've known about it for a while. Oh, and I know that seems to be a more generic bug report, but this one here is more recent, and more specific to your issue, and is tagged as a duplicate of the first I linked you to.

That said, there is code to disable some (most?) Youtube keyboard shortcuts... but it must be added to the embedded tags when the video is put in the web page.

&amp:disablekb=1

There are numerous sites on the web passing that information out, here is just one. Unfortunately, I believe that if this was as simple as running a Greasemonkey script to add that code to any YouTUbe emedded video tags as you load the page, it would have been done already. By the people at Mozilla.

Now, I spent some time digging through the Addons at Firefox, and I came across this one called Stylish, which enables you to personalize your experience at sites like Youtube. I don't know personally, but depending on the level of customization, and exactly how it does what it does, you might be able to get it to inject the code.

There are Greasemonkey scripts that alter your Youtube experience like this one, but none detail the ability to disable keyboard shortcuts. However, either the author of the script didn't consider it, or it was never suggested to them.

5
  • Stylish is for CSS. It does not let you modify source code as Greasemonkey does with JavaScript.
    – iglvzx
    Jun 13, 2012 at 1:39
  • @iglvzx I was afraid of that. But I couldn't find a greasemonkey script already out there that would let you inject that code into a Youtube page and embedded video code... because of how it works I guess.
    – Bon Gart
    Jun 13, 2012 at 1:41
  • 1
    The code used to display videos on a YouTube page is different than the embed HTML they give you. I'm not sure if the disablekb query would work here.
    – iglvzx
    Jun 13, 2012 at 1:47
  • @iglvzx There is that too. Again, this could be why the issue has existed for more than 11 years now.
    – Bon Gart
    Jun 13, 2012 at 1:48
  • Interestingly, control-l still skips forward in the video even when the Flash based player does not have focus, although it does also select the location bar. I still want to suppress the skip-forward part, though.
    – Heptite
    Jun 13, 2012 at 3:43
1

The simplest solution using AutoHotkey would be to map Ctrl+L to Alt+D when viewing a YouTube page on Firefox:

SetTitleMatchMode, RegEx
#IfWinActive, - YouTube - Mozilla Firefox$
    ^l::SendInput, !d
#IfWinActive

Since YouTube could change their HTML <title> naming scheme anytime, a more reliable solution would be to replace the first #IfWinActive line with:

#IfWinActive, - Mozilla Firefox$

This will apply to any Firefox tab/window, but you should not notice a difference in functionality.

4
  • Any idea why this doesn't work unless I place it above all of my other hotkey rules?
    – Heptite
    Jun 15, 2012 at 6:40
  • Are you missing any required return statements for any of your other hotkeys? I like to place #IfWinActive blocks at the end of my scripts, with no problems.
    – iglvzx
    Jun 15, 2012 at 6:46
  • It appears that if it's below any Capslock:: rule, regardless of what's in it, it doesn't work.
    – Heptite
    Jun 15, 2012 at 7:05
  • Scratch that, any rule above it breaks it. This is AutoHotkey_L.
    – Heptite
    Jun 15, 2012 at 7:24
0

I had the same problem and wrote a quick fix in a http://www.autohotkey.com/ script for use on Firefox in Windows. The script controls ctrl+tab, ctrl+shift+tab and ctrl+l hotkeys when Firefox is active and make them always do the regular Firefox hotkey actions (next tab, previous tab and activate URL toolbar). Works in windowed mode and in full screen mode. Note: the script mouse clicks a neutral spot near the upper left Firefox window corner. If you've altered the GUI via Stylish to cover that spot with e.g. a button then you may need to modify the x/y value of the Click command to target some other non-button spot. If you want this script to work for ctrl+l only then remove the second and third line of code.

edit: sorry, the default x/y value below might not work well in maximized window mode depending on how you display your Firefox button. Again, modify the x/y to target a non-button spot for example a few pixels to the right of the Firefox button.

#IfWinActive, ahk_class MozillaWindowClass
^Tab::
^+Tab::
^l::
SystemCursor("Toggle")
SetDefaultMouseSpeed, 0
MouseGetPos, mx, my
click 2,2
if A_ThisHotkey = ^Tab
 send ^{tab}
if A_ThisHotkey = ^+Tab
 send ^+{tab}
if A_ThisHotkey = ^l
 send ^l
MouseMove, %mx%,%my%
SystemCursor("Toggle")
return
#IfWinActive


; http://www.autohotkey.com/docs/commands/DllCall.htm#HideCursor

SystemCursor(OnOff=1)   ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
{
    static AndMask, XorMask, $, h_cursor
        ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors
        , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13   ; blank cursors
        , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13   ; handles of default cursors
    if (OnOff = "Init" or OnOff = "I" or $ = "")       ; init when requested or at first call
    {
        $ = h                                          ; active default cursors
        VarSetCapacity( h_cursor,4444, 1 )
        VarSetCapacity( AndMask, 32*4, 0xFF )
        VarSetCapacity( XorMask, 32*4, 0 )
        system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650
        StringSplit c, system_cursors, `,
        Loop %c0%
        {
            h_cursor   := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% )
            h%A_Index% := DllCall( "CopyImage",  "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 )
            b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0
                , "int",32, "int",32, "uint",&AndMask, "uint",&XorMask )
        }
    }
    if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T"))
        $ = b  ; use blank cursors
    else
        $ = h  ; use the saved cursors

    Loop %c0%
    {
        h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 )
        DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% )
    }
}
2
  • 2
    This is overly complex.
    – iglvzx
    Jun 14, 2012 at 20:46
  • Yes, for only ctrl+l functionality your solution is simpler. But youtube also takes over ctrl+tab and those looking for a fix for that too might find the above useful. Jun 14, 2012 at 21:01
0

After testing some more I think neither my or iglvzx's AHK code above solves the issue fully even on Firefox in Windows. To reproduce the remaining problem do these steps:

  1. load a youtube clip, for example http://www.youtube.com/watch?v=a1Y73sPHKxw
  2. click anywhere in the video player, for example the pause button
  3. press tab or ctrl+tab or ctrl+l

result: for ctrl+l nothing happens. For control+tab the player cycles focus to the next control and marks it with a thick yellow border

The autohotkey script does not override youtube's control of those hotkeys when the video player has focus it seems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .