IGG Games Direct Downloads

IGG Games download links all contain multiple forwarders before you get the actual download link. This automatically re-formats each available download link to be direct.

目前為 2017-04-26 提交的版本,檢視 最新版本

// ==UserScript==
// @name         IGG Games Direct Downloads
// @namespace    http://tampermonkey.net/
// @version      1.0.4
// @description  IGG Games download links all contain multiple forwarders before you get the actual download link. This automatically re-formats each available download link to be direct.
// @author       MooreR
// @include      http://igg-games.com/*
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    var interval = setInterval(function(){
        var didLoad = document.getElementsByClassName('padPreload').length;
        if(didLoad == 1){
            didLoad = 0;
            reformatLayout();
            var allLinks = $('a[rel*=\'nofollow\']');
            if(allLinks.length > 1){
                makeDirectLinks(allLinks);
            }
            clearInterval(interval);
        }
    },2000);

    function reformatLayout() {
        $('#igggamescom-style-css').attr('href', 'https://dl.dropbox.com/s/6rivaxmujgm94f0/newgreen.css');
        $('#igggamescom-core-css').attr('href', 'https://dl.dropboxusercontent.com/s/xzt0csi3mrwepst/newstyle.css');\
        $('#header').remove();
        $('#page').css('background', "0");
        $('#page').removeClass('background');
        $("body").removeClass("home blog custom-background  c2right browser-unknown myatu_bgm_body");
        $('.flexslider').remove();
        $('.fixed.c2right #primary-content').css('width', 'auto');
        $('.body.fixed .page-content').css('width', '100%');
        $('#page-ext').css('background', '#34495e');
        $('#main').css('background', '0');
        $('.clearField').css('background', "");
        $('.clearField').css('border', "");
        $('.clearField').css('color', '#C5EFF7');
        $('.clearField').css('font-weight', '900');
        $('#sidebar').remove();
        $('.submit').attr('value', 'Search');
        $('.shadow-left page-content').remove();
        $('.shadow-left').remove();
        window.open = null;
        $('document').onclick = null;
        $('MsoPFwqg').remove();
        var strVar = "";
        strVar += "<div class=\"search-form\" role=\"search\">";
        strVar += "  <form method=\"get\" class=\"search-form clear-block\" action=\"http:\/\/igg-games.com\/\" _lpchecked=\"1\">";
        strVar += "    <input type=\"submit\" class=\"submit\" title=\"Search Website\" value=\"\">";
        strVar += "    <fieldset>";
        strVar += "      <input type=\"text\" name=\"s\" data-default=\"Search Website\" class=\"text alignleft clearField suggestTerms clearFieldBlurred\" value=\"\">";
        strVar += "      <input type=\"hidden\" value=\"submit\">";
        strVar += "    <\/fieldset>";
        strVar += " <\/form>";
        strVar += "<\/div>";
        $("#main-ext").append(strVar);

    }

    function makeDirectLinks(allLinks) {
        if(allLinks.length > 50){
            alert('There are a lot of links for this game! This script will more than likely fail. Maybe choose a different source for now.');
        } else {
            var xmlReq = [];
            var i = 0;
            for (i = 0; i < allLinks.length - 2; i++) {
                (function(i) {
                    allLinks[i].text = 'Getting direct link....';
                    xmlReq[i] = new XMLHttpRequest();
                    xmlReq[i].timeout = 2000;
                    xmlReq[i].open("GET", allLinks[i].href, true);
                    xmlReq[i].onreadystatechange = function (oEvent) {
                        if (xmlReq[i].readyState === 4) {
                            var resp = xmlReq[i].responseText.split('xurl=');
                            if(resp.length > 1){
                                var test = resp[resp.length - 1].split('"')[0];
                                allLinks[i].text = 'Direct Download';
                                allLinks[i].setAttribute('href', test.split(':')[1]);
                            }
                        }
                    };
                    xmlReq[i].send(null);
                })(i);
            }
        }
    }
})();
长期地址
遇到问题?请前往 GitHub 提 Issues。