// ==UserScript==
// @name        YAGVD: Yet Another Google Video Downloader
// @namespace   http://www.chocolatey.com/code/js
// @description Download the .avi directly via the "Download" button
// @version     0.02 (2007-06-14) - updated @include to work in new frameset
// @version     0.01 (2007-02-18)
// @author      chocolateboy
// @license     GPL: http://www.gnu.org/copyleft/gpl.html
// @include     http://video.google.*/videohosted?*
// ==/UserScript==

const $xpath = '//a[1][parent::div[@id="thumbsetc"]] | //img[1][parent::a[parent::div[@id="thumbsetc"]]]';
const $uri = document.getElementById('macdownloadlink').getAttribute('href');

var $nodes = document.evaluate($xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

$nodes.snapshotItem(0).setAttribute('href', $uri); // a
$nodes.snapshotItem(1).setAttribute('onclick', ''); // img
