Greasy Fork

Get Online Users

Get list of users from Community page

目前为 2016-05-08 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.icu/scripts/19524/124470/Get%20Online%20Users.js

// ==UserScript==
// @name         Get Online Users
// @namespace    PXgamer
// @version      0.1
// @description  Get list of users from Community page
// @author       PXgamer
// @match        *kat.cr/*
// @grant        none
// ==/UserScript==

function gou() {
    'use strict';

    var returnedData;
    var searchString = /<a href="\/user\/[a-z)-9_.-]+\/" class="tag1 aclColor_[0-9a-z]">([a-z)-9_.-]+)<\/a>/gi, matches, onlineUsers = [];

    $.ajax({
        type: "GET",
        url: "/community/",
        success: function (data) {
            returnedData = data;
            while (matches = searchString.exec(returnedData.html)) {
                onlineUsers.push(matches[1]);
            }
            console.log(onlineUsers);
        },
        returnData: "json"
    });
	return onlineUsers;
}