[GC | Library] - SSW: Savvy Shop Wiz

Library to call.

Ce script ne doit pas être installé directement. C'est une librairie destinée à être incluse dans d'autres scripts avec la méta-directive // @require https://update.greasyfork.org/scripts/487361/1389917/%5BGC%20%7C%20Library%5D%20-%20SSW%3A%20Savvy%20Shop%20Wiz.js

// ==UserScript==
// @name        [GC | Library] - SSW: Savvy Shop Wiz
// @namespace   https://greasyfork.org/en/users/1225524-kaitlin
// @require	https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js
// @grant	GM.getValue
// @grant	GM.setValue
// @grant	GM.listValues
// @grant	GM.addStyle
// @license     MIT
// @version     1.1
// @author      Cupkait
// @icon        https://i.imgur.com/4Hm2e6z.png
// @description		Library to call.
// ==/UserScript==

var friendList = GM.getValue('friendList', []);
var syncedGuilds = GM.getValue('syncedGuilds', []);
var blockList = GM.getValue('blockList', []);


    const SSWMenuContainer = document.createElement('div');
	  SSWMenuContainer.id = 'sswcontainer';


    const SSWButton = document.createElement('button');
          SSWButton.textContent = 'SSW Settings';
  	  SSWButton.id = 'sswsettings';


    const SSWMenu = document.createElement('div');
	  SSWMenu.id = 'sswmenu';

    const ManualAdd = document.createElement('button');
          ManualAdd.textContent = 'Add User Manually';
	  ManualAdd.id = 'menubutton';
          $(ManualAdd).on('click', addUsersManually);
	  SSWMenu.appendChild(ManualAdd);


    const ManualRemove = document.createElement('button');
          ManualRemove.textContent = 'Remove User Manually';
	  ManualRemove.id = 'menubutton';
	  SSWMenu.appendChild(ManualRemove);


    const SyncFriends = document.createElement('button');
          SyncFriends.textContent = 'Sync Friends';
          SyncFriends.id = 'menubutton';
          SSWMenu.appendChild(SyncFriends);
               

    const SyncBlocked = document.createElement('button');
          SyncBlocked.textContent = 'Sync Blocked Users';
          SyncBlocked.id = 'menubutton';
          SSWMenu.appendChild(SyncBlocked);


    const SyncGuild = document.createElement('button');
	  SyncGuild.textContent = 'Sync Guild Members';
	  SyncGuild.id = 'menubutton';
          SSWMenu.appendChild(SyncGuild);

function createSSWMenu() {

    SSWMenuContainer.appendChild(SSWButton);
    SSWMenuContainer.appendChild(SSWMenu);
    $('#sb_edge').append(SSWMenuContainer);

    $(SSWButton).on('click', function() {
        $(SSWMenu).fadeToggle(150);
    });

    return SSWMenuContainer;
		return SSWMenu;
};





function addUsersManually() {
    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.');

    if (userInput !== null && userInput.trim() !== '') {
        friendList.push(userInput.trim());
        GM.setValue('friendList', friendList);
        console.log('Added', userInput.trim(), 'to the friend list.');

if (window.location.href === 'https://www.grundos.cafe/market/wizard/') {
    if (confirm('Do you want to reload the page to see the updated results?')) {
        location.reload();
    }
}

} else {
        console.log('No username entered. Operation canceled.');
    }
}