Save and Get

Yo saveData, getData.

Skrip ini tidak untuk dipasang secara langsung. Ini adalah pustaka skrip lain untuk disertakan dengan direktif meta // @require https://update.greatest.deepsurf.us/scripts/489971/1343998/Save%20and%20Get.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Save and Get
// @namespace    none
// @version      0.1
// @description  Yo saveData, getData.
// @author       no
// @match        *://*/*
// @grant        unsafeWindow
// ==/UserScript==
(() => {
    'use strict';

    unsafeWindow.saveData = (key, value) => {
        localStorage.setItem(key, JSON.stringify(value));
    };

    unsafeWindow.getData = (keysArray) => {
        const data = {};
        keysArray.forEach(key => {
            try {
                const value = localStorage.getItem(key);
                if (value !== null) {
                    data[key] = JSON.parse(value);
                }
            } catch (error) {
                console.error('Ошибка при загрузке данных:', error);
            }
        });
        return data;
    };
})();