LEGOlord208 / Video Redirecter

// ==UserScript==
// @name         Video Redirecter
// @namespace    none
// @version      0.1
// @description  Redirecting videos to their source
// @author       LEGOlord208
// @match        http://www.mycollection.net/file/*
// @grant        none
// ==/UserScript==
/* jshint -W097 */
'use strict';

window.onload = function(){
    setTimeout(function(){
        var iframe = document.getElementsByTagName("iframe")[0].contentDocument;
        var scripts = iframe.getElementsByTagName("script");
        for(var i = 0; i < scripts.length; i++){
            var regex = /^[\s\S]+?file:\s"([^"]+)"[\s\S]+$/;
            var links = regex.exec(scripts[i].innerHTML);
            if(links !== null && links.length == 2){
                var link = links[1];
                location.href = link;
                break;
            }
        }
    }, 3000);
};