Proxer-Collapsable-Lists

Dieses Script bringt die zusammenklappbaren Anime-/Mangalisten aus dem Mobile Client ins Webinterface

目前為 2015-10-01 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Proxer-Collapsable-Lists
// @namespace    
// @version      0.1
// @description  Dieses Script bringt die zusammenklappbaren Anime-/Mangalisten aus dem Mobile Client ins Webinterface
// @author       TheExoduser
// @include      http://proxer.me/*
// @include      https://proxer.me/*
// @include      http://www.proxer.me/*
// @include      https://www.proxer.me/*        
// @run-at       document-start
// ==/UserScript==

// Adds functions to load jQuery via UserScript
var load,execute,loadAndExecute;load=function(a,b,c){var d;d=document.createElement("script"),d.setAttribute("src",a),b!=null&&d.addEventListener("load",b),c!=null&&d.addEventListener("error",c),document.body.appendChild(d);return d},execute=function(a){var b,c;typeof a=="function"?b="("+a+")();":b=a,c=document.createElement("script"),c.textContent=b,document.body.appendChild(c);return c},loadAndExecute=function(a,b){return load(a,function(){return execute(b)})};

document.addEventListener('DOMContentLoaded', function(event) {
    $(document).ajaxSuccess (function () {
        main();
    });
    main();
});

var main = function () {
    var checkTrue = false;
    if (window.location.href.indexOf('anime') > -1 || window.location.href.indexOf('manga') > -1) {
        checkTrue = true;
    };
    if (window.location.href.indexOf('ucp') === -1 || checkTrue === false || window.location.href.indexOf('forum') > -1) {
        return;
    };
    
    var table = document.getElementById("box-table-a").parentNode.getElementsByTagName("table");
    for (var i = 0; i < 4; i++) {
        var rowFirst = table[i].rows[0];
        
        if(i === 1) {
            rowFirst.innerHTML = rowFirst.innerHTML.replace("</th>","<span style=\"float:right;\">-</span></th>");
        } else {
            rowFirst.innerHTML = rowFirst.innerHTML.replace("</th>","<span style=\"float:right;\">+</span></th>");
        }
        
        table[i].deleteRow(0);
        
        var header = table[i].createTHead();
        var row = header.insertRow(0);  
        
        row.innerHTML = rowFirst.innerHTML;
    };
    
    loadAndExecute("//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js", function() {
        $(document).on('click','th',function(){
            if ($(this).html().indexOf("+") >= 0) {
                $(this).html($(this).html().replace("+", "-"));
            } else {
                $(this).html($(this).html().replace("-", "+"));
            }
            
            $(this).closest('table').find('tbody').toggle("slow");
        });
        $(document).ready(function(){
            $("table").find('tbody').toggle();
            $('table:eq(1)').find('tbody').show();
        });
    });
};

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址