1
+ <!DOCTYPE html>
2
+ < html lang ="it ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < title > Cerca in Olalla</ title >
7
+ < style >
8
+ body {
9
+ font-family : Arial, sans-serif;
10
+ display : flex;
11
+ justify-content : center;
12
+ align-items : center;
13
+ height : 100vh ;
14
+ background-color : # f0f0f0 ;
15
+ margin : 0 ;
16
+ }
17
+ .search-container {
18
+ display : flex;
19
+ flex-direction : column;
20
+ align-items : center;
21
+ gap : 10px ;
22
+ }
23
+ input [type = "text" ] {
24
+ padding : 10px ;
25
+ width : 300px ;
26
+ font-size : 16px ;
27
+ }
28
+ input [type = "button" ] {
29
+ padding : 10px ;
30
+ font-size : 16px ;
31
+ cursor : pointer;
32
+ background-color : # 2289CD ;
33
+ color : white;
34
+ border : none;
35
+ border-radius : 5px ;
36
+ transition : background-color 0.3s ;
37
+ }
38
+ input [type = "button" ]: hover {
39
+ background-color : # 339ce1 ;
40
+ }
41
+ input [type = "submit" ] {
42
+ padding : 10px ;
43
+ font-size : 16px ;
44
+ cursor : pointer;
45
+ background-color : # 2289CD ;
46
+ color : white;
47
+ border : none;
48
+ border-radius : 5px ;
49
+ transition : background-color 0.3s ;
50
+ }
51
+ input [type = "submit" ]: hover {
52
+ background-color : # 339ce1 ;
53
+ }
54
+ # results {
55
+ margin-top : 20px ;
56
+ }
57
+
58
+ </ style >
59
+
60
+ <!-- For old IEs -->
61
+ < link rel ="shortcut icon " href ="favicon.ico " />
62
+
63
+ <!-- For new browsers - multisize ico -->
64
+ < link rel ="icon " type ="image/x-icon " sizes ="16x16 32x32 " href ="favicon.ico ">
65
+
66
+ <!-- For iPad with high-resolution Retina display running iOS ≥ 7: -->
67
+ < link rel ="apple-touch-icon " sizes ="152x152 " href ="favicon-152-precomposed.png ">
68
+
69
+ <!-- For iPad with high-resolution Retina display running iOS ≤ 6: -->
70
+ < link rel ="apple-touch-icon " sizes ="144x144 " href ="favicon-144-precomposed.png ">
71
+
72
+ <!-- For iPhone with high-resolution Retina display running iOS ≥ 7: -->
73
+ < link rel ="apple-touch-icon " sizes ="120x120 " href ="favicon-120-precomposed.png ">
74
+
75
+ <!-- For iPhone with high-resolution Retina display running iOS ≤ 6: -->
76
+ < link rel ="apple-touch-icon " sizes ="114x114 " href ="favicon-114-precomposed.png ">
77
+
78
+ <!-- For iPhone 6+ -->
79
+ < link rel ="apple-touch-icon " sizes ="180x180 " href ="favicon-180-precomposed.png ">
80
+
81
+ <!-- For first- and second-generation iPad: -->
82
+ < link rel ="apple-touch-icon " sizes ="72x72 " href ="favicon-72-precomposed.png ">
83
+
84
+ <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
85
+ < link rel ="apple-touch-icon " sizes ="57x57 " href ="favicon-57.png ">
86
+
87
+ <!-- For Old Chrome -->
88
+ < link rel ="icon " sizes ="32x32 " href ="favicon-32.png " >
89
+
90
+ <!-- For IE10 Metro -->
91
+ < meta name ="msapplication-TileColor " content ="#FFFFFF ">
92
+ < meta name ="msapplication-TileImage " content ="favicon-144.png ">
93
+ < meta name ="theme-color " content ="#ffffff ">
94
+
95
+ <!-- Chrome for Android -->
96
+ < link rel ="manifest " href ="manifest.json ">
97
+ < link rel ="icon " sizes ="192x192 " href ="favicon-192.png ">
98
+
99
+
100
+
101
+ </ head >
102
+ < body >
103
+
104
+ < form id ="urlForm ">
105
+ < div class ="search-container ">
106
+ < input type ="text " id ="codInput " placeholder ="Inserisci CODICE... ">
107
+ < input type ="button " value ="Vai all'Ordine " onclick ="searchCOD() ">
108
+ < br > < br >
109
+
110
+ < input type ="text " id ="url " name ="url " placeholder ="Inserisci URL del prodotto... " required >
111
+ < input type ="submit " value ="ricerca SKU ">
112
+ < br > < br >
113
+
114
+ < input type ="text " id ="prodInput " placeholder ="Inserisci parole chiave... ">
115
+ < input type ="button " value ="Cerca sul sito Olalla.it " onclick ="searchPROD() ">
116
+ < br > < br >
117
+
118
+ <!-- Bottone per resettare -->
119
+ < input type ="button " value ="Reset " onclick ="resetForms() ">
120
+ </ div >
121
+ </ form >
122
+ < div id ="results "> </ div >
123
+
124
+ < script >
125
+ document . getElementById ( 'urlForm' ) . addEventListener ( 'submit' , async function ( event ) {
126
+ event . preventDefault ( ) ; // Previene il refresh della pagina
127
+ const url = document . getElementById ( 'url' ) . value ;
128
+ const resultsDiv = document . getElementById ( 'results' ) ;
129
+ resultsDiv . innerHTML = '' ; // Pulisce i risultati precedenti
130
+
131
+ try {
132
+ // Esegui la richiesta per ottenere il codice sorgente della pagina
133
+ const response = await fetch ( `https://api.allorigins.win/raw?url=${ encodeURIComponent ( url ) } ` ) ;
134
+ const text = await response . text ( ) ;
135
+
136
+ // RegExp per trovare "SKU" e i 40 caratteri successivi
137
+ const regex = / " s k u " .{ 0 , 40 } / g;
138
+ let match ;
139
+ const results = [ ] ;
140
+
141
+ // Esegui la ricerca nel testo HTML
142
+ while ( ( match = regex . exec ( text ) ) !== null ) {
143
+ results . push ( match [ 0 ] ) ;
144
+ }
145
+
146
+ // Visualizza i risultati
147
+ if ( results . length > 0 ) {
148
+ resultsDiv . innerHTML = "<h2>stringhe trovate:</h2>" ;
149
+ results . forEach ( result => {
150
+ const p = document . createElement ( 'p' ) ;
151
+ p . textContent = result ;
152
+ resultsDiv . appendChild ( p ) ;
153
+ } ) ;
154
+ } else {
155
+ resultsDiv . textContent = 'Nessuna stringa SKU trovata.' ;
156
+ }
157
+ } catch ( error ) {
158
+ resultsDiv . textContent = 'Errore durante il recupero del codice HTML: ' + error ;
159
+ }
160
+ } ) ;
161
+
162
+ function searchCOD ( ) {
163
+ const codice1 = document . getElementById ( 'codInput' ) . value . trim ( ) ;
164
+
165
+ if ( codice1 ) {
166
+ let nuovoURL = `https://www.olalla.it/wp-admin/post.php?post=${ codice1 } &action=edit` ;
167
+ window . open ( nuovoURL , '_blank' ) ; // Apri in una nuova scheda
168
+ } else {
169
+ alert ( "Per favore, inserisci un codice COD." ) ;
170
+ }
171
+ }
172
+
173
+ function searchSKU ( ) {
174
+ const codice2 = document . getElementById ( 'skuInput' ) . value . trim ( ) ;
175
+
176
+ if ( codice2 ) {
177
+ 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` ;
178
+ window . open ( nuovoURL , '_blank' ) ; // Apri in una nuova scheda
179
+ } else {
180
+ alert ( "Per favore, inserisci un codice SKU." ) ;
181
+ }
182
+ }
183
+
184
+ function searchPROD ( ) {
185
+ const codice3 = document . getElementById ( 'prodInput' ) . value . trim ( ) ;
186
+
187
+ if ( codice3 ) {
188
+ let nuovoURL = `https://www.olalla.it/?s=${ codice3 } &post_type=product` ;
189
+ window . open ( nuovoURL , '_blank' ) ; // Apri in una nuova scheda
190
+ } else {
191
+ alert ( "Per favore, inserisci una descrizione migliore." ) ;
192
+ }
193
+ }
194
+
195
+ function resetForms ( ) {
196
+ document . getElementById ( 'codInput' ) . value = '' ;
197
+ document . getElementById ( 'url' ) . value = '' ;
198
+ document . getElementById ( 'prodInput' ) . value = '' ;
199
+ document . getElementById ( 'results' ) . innerHTML = '' ; // Pulisce i risultati
200
+ }
201
+ </ script >
202
+ </ body >
203
+ </ html >
0 commit comments