Rockwell Automation Silver Status

Makes the Rockwell Automation Product Lifecycle Status page more user friendly

当前为 2014-07-30 提交的版本,查看 最新版本

// ==UserScript==
// @name       Rockwell Automation Silver Status
// @namespace  http://techwizworld.net/
// @version    0.1
// @description  Makes the Rockwell Automation Product Lifecycle Status page more user friendly
// @match      http://www.rockwellautomation.com/rockwellautomation/solutions-services/capabilities/migration-solutions/product-search/results.page
// @copyright  2014+, Techplex Engineer. Blake Bourque
// ==/UserScript==

/*$("ul.linklist>li").each(function(idx){
    var link = $("a", this).attr("href");
    
    $.get( link, function( data ) {
        $(this).html($(".data.multicolumn", $(data)).html());
    });
});*/
window.addEventListener('load', function() {
    //get the current table headers
    var header = $(".data.multicolumn tr:first");
    //remove the details column
    $("th:last", header).remove();
    //get the first subage link so we can grab the headers to add
    var link1 = $(".data.multicolumn tr:nth-child(2) ul.linklist>li>a");
    
    //get the headers, remove the first header(product id) and append them to the table header
    $.get(link1.attr('href'), function( data ) {
        var headers = $(".data.multicolumn tr:first", $(data));
        $("th:first", headers).remove();
        header.append($("th", headers));
    });
    
    //for each non header row in the table HTTPGet the details page and load it up
    $(".data.multicolumn tr:not(:first)").each(function(idx){
        var self = $(this);
        var link = $("td:nth-child(3) a", this).attr('href')
        $.get(link, function( data ) {
            var table = $(".data.multicolumn tr:nth-child(2) td:not(:first)", $(data));
            self.append(table);
            $("td:nth-child(3)", self).remove();
        });
    });
}, false);