- catalogo

- corretto logica del RefreshToken che non richiedeva il nuovo token, quindi scadeva tutte le volte, richiedendo sempre l'accesso !
This commit is contained in:
Surya Paolo
2025-01-07 16:50:55 +01:00
parent 7f6ed73763
commit 9fb7df56e6
24 changed files with 1199 additions and 59 deletions

429
docs/libro1.htm Normal file
View File

@@ -0,0 +1,429 @@
<!DOCTYPE html>
<!-- saved from url=(0067)http://vps-88271abb.vps.ovh.net/apimacro/public/mylinkspao?id=22467 -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Link Page</title>
<style>
#loading {
display: none;
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 5px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<h1>Links</h1>
<form id="articleForm">
<pre> Per vedere la lista -&gt; "LIBRI IN PREVENDITA"
in <span style="color: green;">VERDE</span> quelli in PreOrdine
in <span style="color: red;">ROSSO</span> quelli ancora non abilitati.
cliccare sul link <span style="font-weight: bold;">Imposta in PREORDINE"</span> per abilitarlo.
</pre>
<label for="article_id">ID Articolo or Ordine:</label>
<input type="text" id="article_id" name="id" value="22467">
<input type="text" id="action" name="action" value="" hidden="">
<br>
<button type="button" data-action="search">Cerca Articolo</button>
<button type="button" data-action="search_isbn">Cerca ISBN</button>
<button type="button" data-action="updateArtFromGM">Aggiorna Articolo da GM</button>
<button type="button" data-action="checkPrevendita">E' in PreVendita?</button>
<button type="button" data-action="setPreOrder">Impostalo in PreVendita!</button>
<button type="button" data-action="setDataPubblicazione">Aggiorna Data Pubblicazione</button>
<button type="button" data-action="showDettSingleOrdine">Dett. Ordine</button>
<button type="button" data-action="showDettSingleOrdineWeb">Dett. Ordine Web</button>
<br><br>
<button type="button" data-action="showTest">Test</button>
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
<button type="button" data-action="cartolibri">Cartolibri</button>
<button type="button" data-action="riviste">Riviste</button>
<button type="button" data-action="showOrdini">Mostra Ordini</button>
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
<button type="button" data-action="showArticoliFatturatiWeb">Mostra Fatturati</button>
<button type="button" data-action="Vendite">Vendite</button>
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
<button type="button" data-action="showDettOrdiniWeb">Dettaglio Ordini Web</button>
</form>
<div>
<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-articles-sales" target="_blank">Vedi Articoli Venduti e Fatturati</a> - <a href="http://vps-88271abb.vps.ovh.net/apimacro/public/export-articles-sales-json" target="_blank">(Esporta)</a><br>
</div>
<div id="result">Articles di 22467 :
<pre>[
{
"Id": "258787",
"IdArticolo": "22467",
"Ean13": "9788828510147",
"Titolo": "Le Stelle Cadranno dal Cielo?",
"ListaAutori": "17",
"ListaArgomenti": "9",
"IdStatoProdotto": "34",
"PrezzoIvato": "24.9000",
"IdMarchioEditoriale": "1",
"IdCollana": "73",
"DataPubblicazione": "2025-01-14 00:00:00.000",
"IdTipologia": "1",
"IdTipoFormato": "1",
"Misure": "cm 13,5x20,5",
"Pagine": "192",
"Sottotitolo": "Non \u00e8 una catastrofe ma la Rivelazione dell'Universo reale",
"Durata": "",
"Numero": "",
"Edizione": "Dicembre 2024",
"Ristampa": "",
"DataInizioCampagna": "2024-11-07 00:00:00.000",
"DataFineCampagna": "2099-12-31 00:00:00.000",
"ScontoCampagna": "5.00",
"PrezzoIvatoScontatoCampagna": "23.6550",
"DataOra": "2024-12-19 09:24:01.593",
"Enabled": "0",
"IDTagGruppo": "0",
"Utente": "FLANZA-NOTE",
"PercIva": ".00",
"IdTitoloOriginale": "13415",
"EnabledAlFresco": "1",
"CodEdizione": "16",
"FasciaEta": null,
"FasciaEta2": null,
"data": "2024-12-19 09:24:01.593",
"DescrizioneStatoProdotto": "In prevendita",
"Codice": "22467",
"QtaDisponibile": "-6"
}
]</pre>Product:
<pre>{
"id": 74617,
"name": "Le stelle cadranno dal cielo? - Nuovo",
"slug": "le-stelle-cadranno-dal-cielo-nuovo",
"permalink": "https:\/\/www.fioredellavita.it\/le-stelle-cadranno-dal-cielo\/?attribute_pa_versione=nuovo",
"date_created": "2024-12-19T15:26:11",
"date_created_gmt": "2024-12-19T14:26:11",
"date_modified": "2024-12-20T13:02:31",
"date_modified_gmt": "2024-12-20T12:02:31",
"type": "variation",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "22467",
"price": "23.6550",
"regular_price": "24.9000",
"sale_price": "23.6550",
"date_on_sale_from": "2024-11-07T00:00:00",
"date_on_sale_from_gmt": "2024-11-06T23:00:00",
"date_on_sale_to": "2099-12-31T23:59:59",
"date_on_sale_to_gmt": "2099-12-31T22:59:59",
"on_sale": true,
"purchasable": true,
"total_sales": "0",
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": true,
"stock_quantity": 10000,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": false,
"average_rating": "0.00",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 70642,
"purchase_note": "",
"categories": [],
"tags": [],
"images": [
{
"id": 73623,
"date_created": "2024-11-20T11:12:29",
"date_created_gmt": "2024-11-20T09:12:29",
"date_modified": "2024-12-20T14:02:31",
"date_modified_gmt": "2024-12-20T12:02:31",
"src": "https:\/\/i0.wp.com\/www.fioredellavita.it\/wp-content\/uploads\/2024\/09\/le-stella-cadranno-dal-cielo-copertina-web.jpg?fit=450%2C624&amp;ssl=1",
"name": "le-stella-cadranno-dal-cielo-copertina-web",
"alt": "\"Le stelle cadranno dal cielo?\""
}
],
"attributes": [
{
"id": 6,
"name": "Versione",
"slug": "pa_versione",
"option": "Nuovo"
}
],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "<del aria-hidden="\&quot;true\&quot;"><span class="\&quot;woocommerce-Price-amount" amount\"=""><bdi>24,90<span class="\&quot;woocommerce-Price-currencySymbol\&quot;">&lt;\/span&gt;&lt;\/bdi&gt;&lt;\/span&gt;&lt;\/del&gt; <span class="\&quot;screen-reader-text\&quot;">Il prezzo originale era: 24,90€.&lt;\/span&gt;<ins aria-hidden="\&quot;true\&quot;"><span class="\&quot;woocommerce-Price-amount" amount\"=""><bdi>23,66<span class="\&quot;woocommerce-Price-currencySymbol\&quot;">&lt;\/span&gt;&lt;\/bdi&gt;&lt;\/span&gt;&lt;\/ins&gt;<span class="\&quot;screen-reader-text\&quot;">Il prezzo attuale \u00e8: 23,66€.&lt;\/span&gt;",
"related_ids": [],
"meta_data": [
{
"id": 1521527,
"key": "ISBN",
"value": "9788828510147"
},
{
"id": 1521528,
"key": "misure",
"value": "cm 13,5x20,5"
},
{
"id": 1521529,
"key": "formato",
"value": "Brossura"
},
{
"id": 1521530,
"key": "pagine",
"value": "192"
},
{
"id": 1521531,
"key": "edizione",
"value": "Dicembre 2024"
},
{
"id": 1521532,
"key": "DataPubblicazione",
"value": "1736809200"
},
{
"id": 1521533,
"key": "DataPubbStr",
"value": "14\/01\/2025"
},
{
"id": 1521535,
"key": "_wpro_variable_is_preorder",
"value": "yes"
},
{
"id": 1521536,
"key": "_is_pre_order",
"value": "yes"
},
{
"id": 1521537,
"key": "_pre_order_date",
"value": "2025-01-14"
},
{
"id": 1521538,
"key": "_wpro_date_label_variable",
"value": "Prenotalo per riceverlo entro il 14 gennaio 2025"
},
{
"id": 1521539,
"key": "_wpro_no_date_label_variable",
"value": ""
},
{
"id": 1521540,
"key": "_wpro_manage_price_variable",
"value": ""
},
{
"id": 1521541,
"key": "_wpro_price_variable",
"value": ""
},
{
"id": 1521542,
"key": "_wpro_label_variable",
"value": "Pre Ordinalo!"
},
{
"id": 1521543,
"key": "_wpro_price_type_variable",
"value": "manual"
},
{
"id": 1521544,
"key": "_wpro_amount_price_variable",
"value": "fixed"
},
{
"id": 1521545,
"key": "_wpro_date_variable",
"value": "2025-01-14"
},
{
"id": 1521546,
"key": "_wpro_time_variable",
"value": ""
},
{
"id": 1521547,
"key": "_rank_math_gtin_code",
"value": ""
},
{
"id": 1521680,
"key": "_ywpo_preorder",
"value": "yes"
},
{
"id": 1521681,
"key": "_ywpo_availability_date_mode",
"value": "date"
},
{
"id": 1521682,
"key": "_ywpo_for_sale_date",
"value": "2025-01-14"
},
{
"id": 1521683,
"key": "_ywpo_price_mode",
"value": "default"
},
{
"id": 1521684,
"key": "_ywpo_preorder_price",
"value": "0"
},
{
"id": 1521685,
"key": "_ywpo_preorder_discount_percentage",
"value": ""
},
{
"id": 1521686,
"key": "_ywpo_preorder_discount_fixed",
"value": ""
},
{
"id": 1521687,
"key": "_ywpo_preorder_increase_percentage",
"value": ""
},
{
"id": 1521688,
"key": "_ywpo_preorder_increase_fixed",
"value": ""
},
{
"id": 1521711,
"key": "woo_feed_availability_date_var",
"value": "2025-01-14"
}
],
"stock_status": "instock",
"has_options": false,
"post_password": "",
"global_unique_id": "",
"jetpack_sharing_enabled": true,
"jetpack-related-posts": [],
"builder_content": "",
"_links": {
"self": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/74617",
"targetHints": {
"allow": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
]
}
}
],
"collection": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
}
],
"up": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/70642"
}
]
}
}</span></span></bdi></span></ins></span></span></bdi></span></del></pre></div>
<div id="loading" style="display: none;"></div>
<script>
const form = document.getElementById('articleForm');
const result = document.getElementById('result');
const loading = document.getElementById('loading');
const buttons = form.querySelectorAll('button');
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
function handleButtonClick(event) {
let action = event.target.dataset.action;
let id = '0';
try {
id = form.querySelector('input[name="id"]').value;
if (!action) {
action = form.querySelector('input[name="action"]').value;
}
} catch (e) {
id = 0;
}
if (!id) {
id = 0;
}
loading.style.display = 'block'; // Mostra la clessidra
let baseUrl = window.location.href;
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
.then(response => response.text())
.then(data => {
result.innerHTML = data;
loading.style.display = 'none'; // Nasconde la clessidra una volta completato
});
}
</script>
<deepl-input-controller><template shadowrootmode="open"><link rel="stylesheet" href="chrome-extension://cofdbpoegempjloogbagkncekinflcnj/build/content.css"><div dir="ltr" style="visibility: initial !important;"><div class="dl-input-translation-container svelte-95aucy"><div></div></div></div></template></deepl-input-controller></body></html>

403
docs/libro2.htm Normal file
View File

@@ -0,0 +1,403 @@
<!DOCTYPE html>
<!-- saved from url=(0067)http://vps-88271abb.vps.ovh.net/apimacro/public/mylinkspao?id=22753 -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Link Page</title>
<style>
#loading {
display: none;
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 5px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<h1>Links</h1>
<form id="articleForm">
<pre> Per vedere la lista -&gt; "LIBRI IN PREVENDITA"
in <span style="color: green;">VERDE</span> quelli in PreOrdine
in <span style="color: red;">ROSSO</span> quelli ancora non abilitati.
cliccare sul link <span style="font-weight: bold;">Imposta in PREORDINE"</span> per abilitarlo.
</pre>
<label for="article_id">ID Articolo or Ordine:</label>
<input type="text" id="article_id" name="id" value="22753">
<input type="text" id="action" name="action" value="" hidden="">
<br>
<button type="button" data-action="search">Cerca Articolo</button>
<button type="button" data-action="search_isbn">Cerca ISBN</button>
<button type="button" data-action="updateArtFromGM">Aggiorna Articolo da GM</button>
<button type="button" data-action="checkPrevendita">E' in PreVendita?</button>
<button type="button" data-action="setPreOrder">Impostalo in PreVendita!</button>
<button type="button" data-action="setDataPubblicazione">Aggiorna Data Pubblicazione</button>
<button type="button" data-action="showDettSingleOrdine">Dett. Ordine</button>
<button type="button" data-action="showDettSingleOrdineWeb">Dett. Ordine Web</button>
<br><br>
<button type="button" data-action="showTest">Test</button>
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
<button type="button" data-action="cartolibri">Cartolibri</button>
<button type="button" data-action="riviste">Riviste</button>
<button type="button" data-action="showOrdini">Mostra Ordini</button>
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
<button type="button" data-action="showArticoliFatturatiWeb">Mostra Fatturati</button>
<button type="button" data-action="Vendite">Vendite</button>
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
<button type="button" data-action="showDettOrdiniWeb">Dettaglio Ordini Web</button>
</form>
<div>
<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-articles-sales" target="_blank">Vedi Articoli Venduti e Fatturati</a> - <a href="http://vps-88271abb.vps.ovh.net/apimacro/public/export-articles-sales-json" target="_blank">(Esporta)</a><br>
</div>
<div id="result">Articles di 22753 :
<pre>[
{
"Id": "258799",
"IdArticolo": "22753",
"Ean13": "9788865934883",
"Titolo": "La Storia di Flumeide e la Bambina",
"ListaAutori": "4184",
"ListaArgomenti": "6",
"IdStatoProdotto": "34",
"PrezzoIvato": "13.0000",
"IdMarchioEditoriale": "34",
"IdCollana": "1033",
"DataPubblicazione": "2025-01-21 00:00:00.000",
"IdTipologia": "1",
"IdTipoFormato": "1",
"Misure": "cm 28x19",
"Pagine": "32",
"Sottotitolo": "Una fiaba per grandi",
"Durata": "",
"Numero": "",
"Edizione": "Gennaio 2025",
"Ristampa": "",
"DataInizioCampagna": "2024-11-15 00:00:00.000",
"DataFineCampagna": "2099-11-15 00:00:00.000",
"ScontoCampagna": "5.00",
"PrezzoIvatoScontatoCampagna": "12.3500",
"DataOra": "2024-12-19 11:16:13.993",
"Enabled": "0",
"IDTagGruppo": "0",
"Utente": "AZANGHERI-NOTE",
"PercIva": ".00",
"IdTitoloOriginale": "13664",
"EnabledAlFresco": "1",
"CodEdizione": "1",
"FasciaEta": "Genitori",
"FasciaEta2": "Ragazze e ragazzi",
"data": "2024-12-19 11:16:13.993",
"DescrizioneStatoProdotto": "In prevendita",
"Codice": "22753",
"QtaDisponibile": "-2"
}
]</pre>Product:
<pre>{
"id": 73612,
"name": "La storia di Flumeide e la bambina - Nuovo",
"slug": "la-storia-di-flumeide-e-la-bambina-nuovo",
"permalink": "https:\/\/www.fioredellavita.it\/?post_type=product&amp;p=73611&amp;attribute_pa_versione=nuovo",
"date_created": "2024-11-20T04:49:10",
"date_created_gmt": "2024-11-20T03:49:10",
"date_modified": "2024-12-20T12:56:24",
"date_modified_gmt": "2024-12-20T11:56:24",
"type": "variation",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "22753",
"price": "12.3500",
"regular_price": "13.0000",
"sale_price": "12.3500",
"date_on_sale_from": "2024-11-15T00:00:00",
"date_on_sale_from_gmt": "2024-11-14T23:00:00",
"date_on_sale_to": "2099-11-15T23:59:59",
"date_on_sale_to_gmt": "2099-11-15T22:59:59",
"on_sale": true,
"purchasable": true,
"total_sales": "0",
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": true,
"stock_quantity": 10000,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": false,
"average_rating": "0.00",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 73611,
"purchase_note": "",
"categories": [],
"tags": [],
"images": [],
"attributes": [
{
"id": 6,
"name": "Versione",
"slug": "pa_versione",
"option": "Nuovo"
}
],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 1,
"price_html": "<del aria-hidden="\&quot;true\&quot;"><span class="\&quot;woocommerce-Price-amount" amount\"=""><bdi>13,00<span class="\&quot;woocommerce-Price-currencySymbol\&quot;">&lt;\/span&gt;&lt;\/bdi&gt;&lt;\/span&gt;&lt;\/del&gt; <span class="\&quot;screen-reader-text\&quot;">Il prezzo originale era: 13,00€.&lt;\/span&gt;<ins aria-hidden="\&quot;true\&quot;"><span class="\&quot;woocommerce-Price-amount" amount\"=""><bdi>12,35<span class="\&quot;woocommerce-Price-currencySymbol\&quot;">&lt;\/span&gt;&lt;\/bdi&gt;&lt;\/span&gt;&lt;\/ins&gt;<span class="\&quot;screen-reader-text\&quot;">Il prezzo attuale \u00e8: 12,35€.&lt;\/span&gt;",
"related_ids": [],
"meta_data": [
{
"id": 1501793,
"key": "ISBN",
"value": "9788865934883"
},
{
"id": 1501794,
"key": "misure",
"value": "cm 28x19"
},
{
"id": 1501795,
"key": "formato",
"value": "Brossura"
},
{
"id": 1501796,
"key": "pagine",
"value": "32"
},
{
"id": 1501798,
"key": "_wpro_variable_is_preorder",
"value": "yes"
},
{
"id": 1501799,
"key": "_is_pre_order",
"value": "yes"
},
{
"id": 1521636,
"key": "_pre_order_date",
"value": "2025-01-21"
},
{
"id": 1521637,
"key": "_wpro_date_label_variable",
"value": "Prenotalo per riceverlo entro il 21 gennaio 2025"
},
{
"id": 1521638,
"key": "_wpro_no_date_label_variable",
"value": ""
},
{
"id": 1521639,
"key": "_wpro_manage_price_variable",
"value": ""
},
{
"id": 1521640,
"key": "_wpro_price_variable",
"value": ""
},
{
"id": 1521641,
"key": "_wpro_label_variable",
"value": "Pre Ordinalo!"
},
{
"id": 1521642,
"key": "_wpro_price_type_variable",
"value": "manual"
},
{
"id": 1521643,
"key": "_wpro_amount_price_variable",
"value": "fixed"
},
{
"id": 1521644,
"key": "_wpro_date_variable",
"value": "2025-01-21"
},
{
"id": 1521645,
"key": "_wpro_time_variable",
"value": ""
},
{
"id": 1521646,
"key": "_rank_math_gtin_code",
"value": ""
},
{
"id": 1521698,
"key": "_ywpo_preorder",
"value": "yes"
},
{
"id": 1521699,
"key": "_ywpo_availability_date_mode",
"value": "date"
},
{
"id": 1521700,
"key": "_ywpo_for_sale_date",
"value": "1736809200"
},
{
"id": 1521701,
"key": "_ywpo_price_mode",
"value": "default"
},
{
"id": 1521702,
"key": "_ywpo_preorder_price",
"value": "0"
},
{
"id": 1521703,
"key": "_ywpo_preorder_discount_percentage",
"value": ""
},
{
"id": 1521704,
"key": "_ywpo_preorder_discount_fixed",
"value": ""
},
{
"id": 1521705,
"key": "_ywpo_preorder_increase_percentage",
"value": ""
},
{
"id": 1521706,
"key": "_ywpo_preorder_increase_fixed",
"value": ""
},
{
"id": 1521707,
"key": "edizione",
"value": ""
}
],
"stock_status": "instock",
"has_options": false,
"post_password": "",
"global_unique_id": "",
"jetpack_sharing_enabled": true,
"jetpack-related-posts": [],
"builder_content": "",
"_links": {
"self": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73612",
"targetHints": {
"allow": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
]
}
}
],
"collection": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
}
],
"up": [
{
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73611"
}
]
}
}</span></span></bdi></span></ins></span></span></bdi></span></del></pre></div>
<div id="loading" style="display: none;"></div>
<script>
const form = document.getElementById('articleForm');
const result = document.getElementById('result');
const loading = document.getElementById('loading');
const buttons = form.querySelectorAll('button');
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
function handleButtonClick(event) {
let action = event.target.dataset.action;
let id = '0';
try {
id = form.querySelector('input[name="id"]').value;
if (!action) {
action = form.querySelector('input[name="action"]').value;
}
} catch (e) {
id = 0;
}
if (!id) {
id = 0;
}
loading.style.display = 'block'; // Mostra la clessidra
let baseUrl = window.location.href;
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
.then(response => response.text())
.then(data => {
result.innerHTML = data;
loading.style.display = 'none'; // Nasconde la clessidra una volta completato
});
}
</script>
<deepl-input-controller><template shadowrootmode="open"><link rel="stylesheet" href="chrome-extension://cofdbpoegempjloogbagkncekinflcnj/build/content.css"><div dir="ltr" style="visibility: initial !important;"><div class="dl-input-translation-container svelte-95aucy"><div></div></div></div></template></deepl-input-controller></body></html>