Digg View Key Shortcut

By starsky51 Last update Mar 10, 2009 — Installed 60 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

There are 1 previous version of this script.

// ==UserScript==
// @name           Digg View Key Shortcut
// @namespace      http://starsky51.googlepages.com/digg_view_key_shortcut.user
// @description    Captures single press of the 'v' button and activates digg article link. Based on Matt Garrett's accesskey script (http://userscripts.org/scripts/show/11429).
// @include        http://digg.com/*
// @include        http://www.digg.com/*
// ==/UserScript==

window.addEventListener('keydown', diggKeyboardShortcuts, false);

function diggKeyboardShortcuts (e) {
  var ev = e||event;
  var key = ev.which||ev.keyCode;
  if (key == 86) { //'v' key
    if (document.activeElement.type != "textarea" && document.getElementById('title')) { // Check that a comment isn't being entered
      location.href = document.getElementById('title').getElementsByTagName('a')[0].href;
      e.preventDefault(); //Prevent quick find box popping up
    }
  }
}