[GC | Library] - SSW: Savvy Shop Wiz

Library to call.

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/487361/1389917/%5BGC%20%7C%20Library%5D%20-%20SSW%3A%20Savvy%20Shop%20Wiz.js

  1. // ==UserScript==
  2. // @name [GC | Library] - SSW: Savvy Shop Wiz
  3. // @namespace https://greasyfork.org/en/users/1225524-kaitlin
  4. // @require https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js
  5. // @grant GM.getValue
  6. // @grant GM.setValue
  7. // @grant GM.listValues
  8. // @grant GM.addStyle
  9. // @license MIT
  10. // @version 1.1
  11. // @author Cupkait
  12. // @icon https://i.imgur.com/4Hm2e6z.png
  13. // @description Library to call.
  14. // ==/UserScript==
  15.  
  16. var friendList = GM.getValue('friendList', []);
  17. var syncedGuilds = GM.getValue('syncedGuilds', []);
  18. var blockList = GM.getValue('blockList', []);
  19.  
  20.  
  21. const SSWMenuContainer = document.createElement('div');
  22. SSWMenuContainer.id = 'sswcontainer';
  23.  
  24.  
  25. const SSWButton = document.createElement('button');
  26. SSWButton.textContent = 'SSW Settings';
  27. SSWButton.id = 'sswsettings';
  28.  
  29.  
  30. const SSWMenu = document.createElement('div');
  31. SSWMenu.id = 'sswmenu';
  32.  
  33. const ManualAdd = document.createElement('button');
  34. ManualAdd.textContent = 'Add User Manually';
  35. ManualAdd.id = 'menubutton';
  36. $(ManualAdd).on('click', addUsersManually);
  37. SSWMenu.appendChild(ManualAdd);
  38.  
  39.  
  40. const ManualRemove = document.createElement('button');
  41. ManualRemove.textContent = 'Remove User Manually';
  42. ManualRemove.id = 'menubutton';
  43. SSWMenu.appendChild(ManualRemove);
  44.  
  45.  
  46. const SyncFriends = document.createElement('button');
  47. SyncFriends.textContent = 'Sync Friends';
  48. SyncFriends.id = 'menubutton';
  49. SSWMenu.appendChild(SyncFriends);
  50.  
  51. const SyncBlocked = document.createElement('button');
  52. SyncBlocked.textContent = 'Sync Blocked Users';
  53. SyncBlocked.id = 'menubutton';
  54. SSWMenu.appendChild(SyncBlocked);
  55.  
  56.  
  57. const SyncGuild = document.createElement('button');
  58. SyncGuild.textContent = 'Sync Guild Members';
  59. SyncGuild.id = 'menubutton';
  60. SSWMenu.appendChild(SyncGuild);
  61.  
  62. function createSSWMenu() {
  63.  
  64. SSWMenuContainer.appendChild(SSWButton);
  65. SSWMenuContainer.appendChild(SSWMenu);
  66. $('#sb_edge').append(SSWMenuContainer);
  67.  
  68. $(SSWButton).on('click', function() {
  69. $(SSWMenu).fadeToggle(150);
  70. });
  71.  
  72. return SSWMenuContainer;
  73. return SSWMenu;
  74. };
  75.  
  76.  
  77.  
  78.  
  79.  
  80. function addUsersManually() {
  81. var userInput = prompt('Who would you like to add to your list? This is CASE SENSITIVE! Enter one username then click OK. When you are done adding, click cancel.');
  82.  
  83. if (userInput !== null && userInput.trim() !== '') {
  84. friendList.push(userInput.trim());
  85. GM.setValue('friendList', friendList);
  86. console.log('Added', userInput.trim(), 'to the friend list.');
  87.  
  88. if (window.location.href === 'https://www.grundos.cafe/market/wizard/') {
  89. if (confirm('Do you want to reload the page to see the updated results?')) {
  90. location.reload();
  91. }
  92. }
  93.  
  94. } else {
  95. console.log('No username entered. Operation canceled.');
  96. }
  97. }