Get Online Users

Get list of users from Community page

目前為 2016-05-08 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/19524/124571/Get%20Online%20Users.js

// ==UserScript==
// @name         Get Online Users
// @namespace    PXgamer
// @version      0.2
// @description  Get list of users from Community page
// @author       PXgamer
// @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/",
        async: false,
        success: function (data) {
            returnedData = data;
            while (matches = searchString.exec(returnedData.html)) {
                onlineUsers.push(matches[1]);
            }
            console.log(onlineUsers);
        },
        returnData: "json"
    });
	return onlineUsers;
}