GreasyFork script list beautifier

Reformat script list on GreasyFork

Version au 01/07/2014. Voir la dernière version.

// ==UserScript==
// @name       GreasyFork script list beautifier
// @namespace  http://websocket.bplaced.net
// @version    1.0.0
// @description  Reformat script list on GreasyFork
// @match      https://greasyfork.dpdns.org/users/*
// @match      https://greasyfork.dpdns.org/scripts*
// @copyright  2014, Thomas Theiner
// ==/UserScript==

window.addEventListener('load', function() {
    if(unsafeWindow.jQuery) {
        $ = unsafeWindow.jQuery;
        
        $('section .script-list, body > .script-list').each(function() {
            $table = $('<table border="0" width="100%"></table>');
            $tbody = $('<tbody></tbody>');
            $thead = $('<thead></thead>');
            $theadtr = $('<tr></tr>');
            
            $th = $('<td style="font-weight: bold" width="60%"></td>');
            $th.html('Title');
            $theadtr.append($th);
            $th = $('<td style="font-weight: bold" width="8%"></td>');
            $th.html('Author');
            $theadtr.append($th);
            $th = $('<td style="font-weight: bold" width="8%"></td>');
            $th.html('Daily');
            $theadtr.append($th);
            $th = $('<td style="font-weight: bold" width="8%"></td>');
            $th.html('Total');
            $theadtr.append($th);
            $th = $('<td style="font-weight: bold" width="8%"></td>');
            $th.html('Created');
            $theadtr.append($th);
            $th = $('<td style="font-weight: bold" width="8%"></td>');
            $th.html('Updated');
            $theadtr.append($th);
            
            $tbody.append($theadtr);
            
            $(this).find('li').each(function() {
                var $scriptlink = $(this).find('article h2 a');
                var $scriptdesc = $(this).find('article h2 .description');
                $tr = $('<tr></tr>');
                $td = $('<td></td>');
                $td.append($scriptlink);
                $td.append('<br/>');
                $td.append($scriptdesc);
                $tr.append($td);
                
                $(this).find('article dl dd').each(function() {
                    $td = $('<td></td>');
                    $td.html($(this).html());
                    $tr.append($td);
                });
                
                $tbody.append($tr);
            });
            
            $table.append($tbody);
            
            $(this).replaceWith($table);
            //$(this).hide();
        });
    }
}, false);
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元