Что написано в этой Китайской грамоте?

NatalieRedFox_333

Чего мне бояться? - подумала Красная Шапочка...)))
Топикстартер
Сообщения
2 089
Реакции
145
Hi guys!
Кто знает что написано в этой Китайской грамоте?

Код:
//-------------Imports-------------//

// Import the wix-data module for working with queries.
import wixData from 'wix-data';

//-------------Global Variables-------------//

// Maximum number of charms that can be added to a bracelet.
const MAX_NUMBER_OF_CHARMS = 5;
// List of selected charms.
const selectedCharms = [];
// Map of bracelet product information.
let braceletsMap = {};
// Selected bracelet.
let selectedBracelet;

//-------------Page Setup-------------//

// Retrieve data when the page loads.
$w.onReady(async () => {
    // Set a list of bracelet material types.
    const braceletNames = ['Silver Bracelet', 'Rose Gold Bracelet', 'Gold Bracelet'];
    // Query the collection for products whose name is one of the names from the bracelet names.
    let newQuery = await wixData.query("Stores/Products").hasSome("name", braceletNames).find();
    // Get the items from the query results.
    const allBracelets = newQuery.items;
    // Create the bracelet map based on the items returned by the query.
    // For each item returned:
    allBracelets.forEach(product => {
        // Set the map key to the first part of the name (e.g. 'Silver Bracelet' becomes 'silver').
        const keyName = product.name.split(' ')[0].toLowerCase();
        // Set the corresponding map value to the product data.
        braceletsMap[keyName] = product;
    });
});

//-------------Repeater Setup-------------//

// Set up each item in the charms repeater as it is loaded.
export function charmsRepeater_itemReady($w, itemData, index) {
    // Set the action that occurs when a user clicks the current charm image.
    $w('#charmImage').onClick(() => {
        // If the border is hidden, meaning the charm is being selected:
        if ($w('#charmBorder').hidden) {
            // Add the charm to the list of selected charms.
            selectedCharms.push(itemData);
            // Show the charm border, indicating it is now selected.
            $w('#charmBorder').show();
            // Add the selected charm to the bracelet image.
            showCharmOnBracelet(itemData.mainMedia);
            // Set the selected charms repeater in step 3 to reflect the charms that have been selected.
            $w('#selectedCharmsRepeater').data = selectedCharms;
            // If the user has now selected the maximum number of charms:
            if (selectedCharms.length === MAX_NUMBER_OF_CHARMS) {
                // Disable further charm selection.
                disableCharmsSelection();
            }
        // If the border is not hidden, meaning the charm is being deselected:
        } else {
            // If further charm selection was disabled because the user had selected the maximum number of charms:
            if (selectedCharms.length === MAX_NUMBER_OF_CHARMS) {
                // Enable charm selection because an empty slot has opened up.
                enableCharmsSelection();
            }
            // Find the index of the charm that is being deselected in the list of selected charms.
            const indexOfCharm = selectedCharms.findIndex(item => item._id === itemData._id);
            // Remove the charm that is being deselected from the list of selected charms.
            selectedCharms.splice(indexOfCharm, 1);
            // Set the selected charms repeater in step 3 to reflect the charms that are still selected.
            $w('#selectedCharmsRepeater').data = selectedCharms;
            // Remove deselected charm from the bracelet image.
            hideCharmFromBracelet(itemData.mainMedia);
            // Hide the charm border, indicating it is no longer selected.
            $w('#charmBorder').hide();
        }
    });
}
 

suntory

Administrator
15 лет на форуме
Сообщения
23 349
Реакции
12 401
В чем "этом"?
 

JAW

15 лет на форуме
Сообщения
15 797
Реакции
3 454
Мне кажется, что всё совершенно понятно написано, да ещё и код документирован, просто для идиотов.
Но что это? Кусок чего?
Контекст где?
 

suntory

Administrator
15 лет на форуме
Сообщения
23 349
Реакции
12 401
просто для идиотов
Они примерно так себя и рекламируют
Да и в коде он есть. Тут форум про не про веб и тем более не про конкретную платформу, исполнителей за $ проще где-то еще искать, сначала сформулировав, что им надо исполнить.
 

NatalieRedFox_333

Чего мне бояться? - подумала Красная Шапочка...)))
Топикстартер
Сообщения
2 089
Реакции
145
...
58caf92e34653.jpg