Implementato il calcolo del valore reale dei prodotti in asta, includendo il prezzo "Compra Subito", spese di spedizione e risparmio stimato. Aggiunta una nuova sezione "Info Prodotto" nella UI per visualizzare i dettagli estratti e i calcoli. - **AuctionMonitorControl.xaml**: Aggiunta sezione fissa per mostrare informazioni prodotto e calcolo valore. - **AuctionMonitorControl.xaml.cs**: Gestiti eventi per il caricamento e aggiornamento delle informazioni prodotto. - **MainWindow**: Integrati handler per il calcolo e refresh delle informazioni prodotto. - **AuctionInfo.cs**: Aggiunte proprietà per gestire prezzo "Compra Subito", spese di spedizione e limiti di vincita. - **ProductValueCalculator.cs**: Nuova utility per calcolare il valore del prodotto e parsare informazioni dall'HTML. - **AuctionViewModel.cs**: Binding per visualizzare risparmio, costo totale e convenienza nella UI. - **Documentazione**: Aggiornata con dettagli sull'algoritmo di calcolo e layout UI. Fix: - Risolto problema di encoding UTF-8 per emoji nella UI. - Migliorato parsing HTML per prezzi e limiti di vincita. TODO: - Testare parsing su più aste e gestire edge cases. - Implementare caricamento automatico delle informazioni.
220 lines
4.6 KiB
Plaintext
220 lines
4.6 KiB
Plaintext
|
|
var mult_send = 0;
|
|
|
|
function Contest_Send(){
|
|
|
|
mult_send = mult_send + 1;
|
|
PreparaContestSend('senduscontestform',false);
|
|
|
|
if (mult_send == 1)
|
|
{
|
|
AJAXReqContestSend("POST","send_us_contest.php",true);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function PreparaContestSend(nome,ele){
|
|
stringa = "";
|
|
var form = document.forms[nome];
|
|
|
|
var numeroElementi = form.elements.length;
|
|
|
|
for(var i = 0; i < numeroElementi; i++){
|
|
|
|
nmfrm = form.elements[i].name;
|
|
|
|
if(i < numeroElementi-1)
|
|
{
|
|
stringa += form.elements[i].name+"="+encodeURIComponent(form.elements[i].value)+"&";
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
stringa += form.elements[i].name+"="+encodeURIComponent(form.elements[i].value);
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function AJAXReqContestSend(method,url,bool){
|
|
if(window.XMLHttpRequest){
|
|
myReq = new XMLHttpRequest();
|
|
} else
|
|
|
|
if(window.ActiveXObject){
|
|
myReq = new ActiveXObject("Microsoft.XMLHTTP");
|
|
|
|
if(!myReq){
|
|
myReq = new ActiveXObject("Msxml2.XMLHTTP");
|
|
}
|
|
}
|
|
|
|
if(myReq){
|
|
|
|
myReq.onreadystatechange = state_ContestSend;
|
|
|
|
myReq.open(method,url,bool);
|
|
|
|
|
|
myReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
|
|
myReq.send(stringa);
|
|
|
|
}else{
|
|
alert("Impossibilitati ad usare AJAX");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function state_ContestSend(bReload){
|
|
|
|
if (myReq.readyState==4){
|
|
|
|
mult_send = 0;
|
|
|
|
if (myReq.status==200){
|
|
|
|
ResponseContestSend(myReq.responseText);
|
|
}
|
|
else {
|
|
if (bDebug) {alert("Problem retrieving XML data");}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ResponseContestSend(sResponse){
|
|
|
|
|
|
var vetResp = sResponse.split('|');
|
|
|
|
if (vetResp[0].toUpperCase() == 'OK')
|
|
{
|
|
if (MM_findObj("contest_name_msg"))
|
|
{
|
|
DisplayHTMLData(MM_findObj('contest_name_msg'), ' ');
|
|
}
|
|
if (MM_findObj("contest_video_msg"))
|
|
{
|
|
DisplayHTMLData(MM_findObj('contest_video_msg'), ' ');
|
|
}
|
|
if (MM_findObj("send_box_contest"))
|
|
{
|
|
MM_findObj("send_box_contest").style.display='none';
|
|
}
|
|
if (MM_findObj("send_box_contest_response"))
|
|
{
|
|
MM_findObj("send_box_contest_response").style.display='block';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
if (MM_findObj("contest_name_msg"))
|
|
{
|
|
DisplayHTMLData(MM_findObj('contest_name_msg'), ' ');
|
|
}
|
|
if (MM_findObj("contest_video_msg"))
|
|
{
|
|
DisplayHTMLData(MM_findObj('contest_video_msg'), ' ');
|
|
}
|
|
for (b=1; b<vetResp.length; b++)
|
|
{
|
|
var f = vetResp[b].split(';');
|
|
var fldcont = f[0];
|
|
var msgcont = f[1];
|
|
|
|
if (fldcont == 'contest_name')
|
|
{
|
|
DisplayHTMLData(MM_findObj(fldcont + '_msg'), msgcont);
|
|
}
|
|
|
|
if (fldcont == 'contest_video')
|
|
{
|
|
DisplayHTMLData(MM_findObj(fldcont + '_msg'), msgcont);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var HTTP_FIRSTAUCT_URL = new String ('first_auct.php');
|
|
var xmlhttpFirstAuct = null;
|
|
|
|
function FirstAuct() {
|
|
|
|
var sUrlFirstAuct = HTTP_FIRSTAUCT_URL + "?chk=" + new Date().valueOf();
|
|
|
|
if (xmlhttpFirstAuct) {
|
|
|
|
if ((xmlhttpFirstAuct.readyState != 4) && (xmlhttpFirstAuct.readyState != 0)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
if (window.XMLHttpRequest){
|
|
|
|
xmlhttpFirstAuct = new XMLHttpRequest();
|
|
} else if (window.ActiveXObject){
|
|
|
|
xmlhttpFirstAuct = new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
if (xmlhttpFirstAuct != null){
|
|
xmlhttpFirstAuct.onreadystatechange = state_FirstAuct;
|
|
xmlhttpFirstAuct.open("GET",sUrlFirstAuct,true);
|
|
xmlhttpFirstAuct.send(null);
|
|
return true;
|
|
} else {
|
|
if (bDebug)
|
|
{
|
|
alert("Your browser does not support XMLHTTP.");
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
catch (e) {
|
|
xmlhttpFirstAuct = null;
|
|
if (bDebug) alert('Errore in loadXMLDocElenco');
|
|
}
|
|
finally {}
|
|
|
|
}
|
|
|
|
|
|
function state_FirstAuct(){
|
|
|
|
if (xmlhttpFirstAuct.readyState==4){
|
|
|
|
if (xmlhttpFirstAuct.status!=200){
|
|
|
|
if (bDebug) {
|
|
alert("Problem retrieving XML data");
|
|
}
|
|
}
|
|
}
|
|
} |