akznuts / 蛋蛋

// ==UserScript==
// @name         蛋蛋
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  500w 蛋蛋
// @license      MIT
// @author       You
// @match        http://6500z.cc/L325Qwa7/index.php
// @grant        GM_getValue
// @grant        GM_listValues
// @grant        GM_setClipboard
// @require      http://code.jquery.com/jquery-3.4.1.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.js
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    var copy_btn = $('<a></a>');
    copy_btn.text('Copy');
    //copy_btn.attr('href','javascript:;');
    setTimeout(function(){
        //console.log($('frameset').contents('frame#top').contents().find('#menuinfo'));
        $('frameset').contents('frame#top').contents().find('#menuinfo').append(copy_btn);
    },2000);

    copy_btn.click(function(){copyAll()});
})();

function copyAll(){
    var mframe = $('frameset').contents('frame#main').contents();
    var rows = mframe.find('#list tbody tr');
    var egg_arr = [];
    $.each(rows, function(idx, row){
        if(idx === 0 ){
            return;
        }
        var egg_data = {};
        //console.log(row, idx);
        console.log($(row).find('td:nth-child(3)').text());
        egg_data['userid'] = $(row).find('td:nth-child(3)').text();
        egg_data['amount'] = $(row).find('td:nth-child(6)').text();
        egg_arr.push(egg_data);
    });
    console.log(egg_arr);
    GM_setClipboard(JSON.stringify(egg_arr));
}