您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
try to take over the world!
当前为
// ==UserScript== // @name moegirlTable // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://zh.moegirl.org/* // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js // @grant none // ==/UserScript== (function () { 'use strict'; var listc = []; var num = 0; var lista = $('h2'); lista.each(function () { var t = $(this); var name = t.text(); if (name != '目录' && name != '导航' && name != '参见' && name != '导航菜单') { var href = t.nextAll('.thumb').find('img').eq(0).attr('src'); var time = t.nextAll('dl').find('dd').eq(1).text(); var describe = t.nextAll('.poem').eq(0); var staff = t.nextAll('.columns-list').eq(0); var cast = t.nextAll('.columns-list').eq(1); describe = describe.length > 0 ? describe.html() : ''; staff = staff.length > 0 ? staff.html() : ''; cast = cast.length > 0 ? cast.html() : ''; var c = { no: num++, name: name, href: href, describe: describe, time: time, staff: staff, cast: cast } listc.push(c); } }); var table = $('<table></table>'); table.append('<caption>表格的标题</caption><tr><th>表头1</th><th>表头1</th><th>表头1</th><th>表头1</th><th>表头1</th><th>表头1</th><th>表头1</th></tr>'); listc.forEach(function (t) { var tr = '<tr></tr>'; tr += '<td>' + t.no + '</td>'; tr += '<td>' + t.name + '</td>'; tr += '<td>' + t.time + '</td>'; tr += '<td>' + t.staff + '</td>'; tr += '<td>' + t.cast + '</td>'; tr += '<td>' + t.describe + '</td>'; tr += '<td><img src="' + t.href + '" width="300" height="424"></td>'; tr += '</tr>'; table.append(tr); }); $('body').append(table); console.log(listc); console.log(table); var content = document.createElement("div"); document.body.appendChild(content); content.outerHTML = ` <div id="CWDownContent"> <div style="width:60px;height:30px;position:fixed;left:5PX;top:5PX;z-index:100000;/*! background-color:#ffffff; *//*! border:1px solid #afb3b6; *//*! opacity:0.95; */filter:alpha(opacity=95);"> <div id="CWDownSave" style="/*! width:43px; *//*! height:26px; */cursor: pointer;background-color:#3169da;margin: 2px 5px 3px 10px;"> <span style="/*! line-height:25px; */display:block;color:#FFF;text-align:center;font-size: 10px;">产生TABLE</span> </div> </div> </div> `; var WCSave = document.querySelector("#CWDownSave"); WCSave.onclick = function () { var newwindow = window.open('', "_blank", ''); var html = '<html><body><table>' + table.html() + '</table></body></html>'; newwindow.document.write(html); }; })();