-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
128 lines (109 loc) · 5.38 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CoD issue 24</title>
<!-- <link rel="stylesheet" href="style.css"> -->
<link rel="stylesheet" href="BKstyle.css">
<link rel="shortcut icon" href="img/favicon.ico">
<link rel="icon" type="image/x-icon" sizes="16x16 32x32" href="img/favicon.ico">
<link rel="apple-touch-icon" sizes="152x152" href="img/favicon-152-precomposed.png">
<link rel="apple-touch-icon" sizes="144x144" href="img/favicon-144-precomposed.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/favicon-120-precomposed.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/favicon-114-precomposed.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon-180-precomposed.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/favicon-72-precomposed.png">
<link rel="apple-touch-icon" sizes="57x57" href="img/favicon-57.png">
<link rel="icon" sizes="32x32" href="img/favicon-32.png" >
<meta name="msapplication-TileColor" content="#FFFFFF">
<meta name="msapplication-TileImage" content="img/favicon-144.png">
<meta name="theme-color" content="#ffffff">
<link rel="manifest" href="img/manifest.json">
<link rel="icon" sizes="192x192" href="img/favicon-192.png">
</head>
<body>
<form id="urlForm">
<div class="search-container">
<input type="text" id="codInput" placeholder="Inserisci CODICE...">
<input type="button" value="Vai all'Ordine" onclick="searchCOD()">
<br> <br>
<input type="text" id="url" name="url" placeholder="Inserisci URL del prodotto..." required>
<input type="submit" value="cerca stringhe SKU da URL">
<br> <br>
<input type="text" id="prodInput" placeholder="Inserisci parole chiave...">
<input type="button" value="Cerca sul sito Olalla.it" onclick="searchPROD()">
<br> <br>
<input type="button" value="Reset" onclick="resetForms()">
</div>
</form>
<div id="results"></div>
<script>
document.getElementById('urlForm').addEventListener('submit', async function(event) {
event.preventDefault(); // Previene il refresh della pagina
const url = document.getElementById('url').value;
const resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = ''; // Pulisce i risultati precedenti
try {
// Esegui la richiesta per ottenere il codice sorgente della pagina
const response = await fetch(`https://api.allorigins.win/raw?url=${encodeURIComponent(url)}`);
const text = await response.text();
// RegExp per trovare "SKU" e i 40 caratteri successivi
const regex = /"sku".{0,40}/g;
let match;
const results = [];
// Esegui la ricerca nel testo HTML
while ((match = regex.exec(text)) !== null) {
results.push(match[0]);
}
// Visualizza i risultati
if (results.length > 0) {
resultsDiv.innerHTML = "<h2>stringhe trovate:</h2>";
results.forEach(result => {
const p = document.createElement('p');
p.textContent = result;
resultsDiv.appendChild(p);
});
} else {
resultsDiv.textContent = 'Nessuna stringa SKU trovata.';
}
} catch (error) {
resultsDiv.textContent = 'Errore durante il recupero del codice HTML: ' + error;
}
});
function searchCOD() {
const codice1 = document.getElementById('codInput').value.trim();
if (codice1) {
let nuovoURL = `https://www.olalla.it/wp-admin/post.php?post=${codice1}&action=edit`;
window.open(nuovoURL, '_blank'); // Apri in una nuova scheda
} else {
alert("Per favore, inserisci un codice COD.");
}
}
function searchSKU() {
const codice2 = document.getElementById('skuInput').value.trim();
if (codice2) {
const nuovoURL = `https://www.olalla.it/wp-admin/edit.php?s=${codice2}&post_status=all&post_type=product&action=-1&seo_filter&product_type&stock_status&wcpv_product_vendors&paged=1&action2=-1`;
window.open(nuovoURL, '_blank'); // Apri in una nuova scheda
} else {
alert("Per favore, inserisci un codice SKU.");
}
}
function searchPROD() {
const codice3 = document.getElementById('prodInput').value.trim();
if (codice3) {
let nuovoURL = `https://www.olalla.it/?s=${codice3}&post_type=product`;
window.open(nuovoURL, '_blank'); // Apri in una nuova scheda
} else {
alert("Per favore, inserisci una descrizione migliore.");
}
}
function resetForms() {
document.getElementById('codInput').value = '';
document.getElementById('url').value = '';
document.getElementById('prodInput').value = '';
document.getElementById('results').innerHTML = ''; // Pulisce i risultati
}
</script>
</body>
</html>