Get Online Users

Get list of users from Community page

目前為 2018-02-05 提交的版本,檢視 最新版本

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

  1. /*
  2. * @name Get Online Users
  3. * @namespace pxgamer
  4. * @version 0.2
  5. * @description Get list of users from Community page
  6. * @author pxgamer
  7. */
  8.  
  9. function gou() {
  10. 'use strict';
  11.  
  12. var returnedData;
  13. var searchString = /<a href="\/user\/[a-z)-9_.-]+\/" class="tag1 aclColor_[0-9a-z]">([a-z)-9_.-]+)<\/a>/gi, matches, onlineUsers = [];
  14.  
  15. $.ajax({
  16. type: "GET",
  17. url: "/community/",
  18. async: false,
  19. success: function (data) {
  20. returnedData = data;
  21. while (matches = searchString.exec(returnedData.html)) {
  22. onlineUsers.push(matches[1]);
  23. }
  24. console.log(onlineUsers);
  25. },
  26. returnData: "json"
  27. });
  28. return onlineUsers;
  29. }