Differenze tra le versioni di "Utente:Alex brollo/eiv.js"

nessun oggetto della modifica
$("#sfondoEiv").toggle();
});
$("#wpSave").click(function(){
pageSave();
});
$("#wpPreview").click(function(){
pagePreview();
});
// closeButton generico (chiude parent())
var closeButton=$('<img>')
.attr("src","//upload.wikimedia.org/wikipedia/commons/f/f8/Tooltip-CloseButton.png")
.attr("style",'position:absolute; top:0;right:0;cursor:pointer; z-index:200;')
.click(function(){$(this).parent().toggle();
});
//creazione box divPreview
var divPreview=$("<div>").css({
"position":"absolute",
"top":"20px",
"left":"100px",
"width":"580px",
"height":"700px",
"overflow":"scroll",
"padding":"20px",
"z-index":"150",
"background-color":"white",
"border":"1px dotted black",
"display":"none"
}).attr("id","divPreview")
.append(closeButton);
$("#sfondoEiv").append(divPreview);
$("#divPreview").draggable();
}
}
});
}
function pagePreview() {
//caricamento preview
var wikicode=pageBuild();
$("#divPreview").toggle();
$.ajax({
url: mw.util.wikiScript( 'api' ),
data: {
format: 'json',
action: 'parse',
contentmodel: 'proofread-page',
summary: "ajax preview",
text: wikicode,
},
dataType: 'json',
type: 'POST',
success: function( data ) {
if ( data && data.parse ) {
$("#divPreview").append($(data.parse.text["*"];));
 
} else if ( data && data.error ) {
alert( 'Error: API returned error code "' + data.error.code + '": ' + data.error.info );
} else {
alert( 'Error: Unknown result from API.' );
}
},
error: function( xhr ) {
alert( 'Error: Request failed.' );
}
});
}
 
362 077

contributi