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

nessun oggetto della modifica
(function ($,mw) {
console.log("passo 1");
if(mw.config.get("wgCanonicalNamespace")=!=="Page" || mw.config.get("wgAction")=!=="view") { console.log("eiv non eseguito"); return false;}
console.log("passo 2");
var eiv={};
 
/* passo 1 : costruire l'ambiente */
 
// in nsPage, and in view mode, eiv environment is built
/* passo 1 : costruire l'ambiente */
creabox();
activate();
 
function toggle() {
$("#sfondoEiv").toggle();
return false;
}
 
function activate() {
$('<li id="ca-eiv"><span><a href="#" title="Attiva eiv" >eiv</a></span></li>').click(function() {toggle();}).insertAfter($("#ca-view"));
return false;
}
// in nsPage, and in view mode, eiv environment is built
 
creabox();
function creabox() {
activate();
 
$('<div id="sfondoEiv" style="width: 100%; height: 100%; position: fixed; z-index: 100; top: 0px; left: 0px; background-color: rgb(250, 250, 250); display:none;"></div>').appendTo($("#content"));
$(".prp-page-image").clone().appendTo($("#sfondoEiv"));
$("#sfondoEiv .prp-page-image").css("width","40%");
$("#sfondoEiv .prp-page-image img").draggable();
var box=$('<div style="display:block; border:1px solid black; position:fixed; top:10px; left:10px; /* z-index:999; */ background-color:#efefef;padding:6px;" id="editBox"></div>');
function toggle() {
box.append($("<div id='handle' style='width:100%; background-color:#dfdfdf; min-height:10px;' ><div id='areaBottoni' style='float:left;max-width:400px'></div> </div>"))
$("#sfondoEiv").toggle();
box.append($("<textarea name='wpHeaderTextbox' id='wpHeaderTextbox' style='width:100%; height:30px; border:1px solid gray;' />"));
return false;
box.append($("<textarea name='wpTextbox1' id='wpTextbox1' rows='35' style='width:550px; border:1px solid gray;' />"));
}
box.append($("<textarea name='wpFooterTextbox' id='wpFooterTextbox' style='width:100%; height:30px; border:1px solid gray;' />"));
$("#sfondoEiv").append(box);
// attivazione alex.activeEleme
$("#editBox textarea").focusin(function () {alex.activeElement=this;})
$("#editBox").draggable({ handle: "areaBottoni" });
var qb='<span id="radiobuttons" style="float:right">'+
function activate() {
'<span class="quality0"><input tabindex="5" title="Pagine_SAL_00%" type="radio" value="0" name="wpQuality"></span>'+
$('<li id="ca-eiv"><span><a href="#" title="Attiva eiv" >eiv</a></span></li>').click(function() {toggle();}).insertAfter($("#ca-view"));
'<span class="quality2"><input tabindex="6" title="Pagine_SAL_50%" type="radio" value="2" name="wpQuality"></span>'+
'<span class="quality1"><input tabindex="7" title="Pagine_SAL_25%" type="radio" value="1" name="wpQuality"></span>'+
return false;
'<span class="quality3"><input tabindex="8" title="Pagine_SAL_75%" checked="" type="radio" value="3" name="wpQuality"></span>'+
}
'<span id="radioQuality4" class="quality4"><input tabindex="9" title="Pagine_SAL_100%" type="radio" value="4" name="wpQuality"></span></span>';
 
qb+='<br><span style="float:right">'+
'<button class="baseButton" id="wpSave" style="display: inline; padding: 1px 2px;" type="button" title="Salva le modifiche" onclick="alex.eiv.salvaPagina()"><small>Salva</small></button>'+
'<button class="baseButton" id="wpPreview" style="display: inline; padding: 1px 2px;" type="button" title="Visualizza anteprima" onclick="alex.eiv.pagePreview()"><small>Anteprima</small></button>'+
'<button class="baseButton" style="display: inline; padding: 1px 2px;" type="button" title="Annulla e chiudi" onclick="alex.eiv.chiudiEditBox()"><small>Annulla</small></button>'+
'</span>';
$("#handle").append($(qb));
 
function creabox() {
$('<div id="sfondoEiv" style="width: 100%; height: 100%; position: fixed; z-index: 100; top: 0px; left: 0px; background-color: rgb(250, 250, 250); display:none;"></div>').appendTo($("#content"));
$(".prp-page-image").clone().appendTo($("#sfondoEiv"));
$("#sfondoEiv .prp-page-image").css("width","40%");
$("#sfondoEiv .prp-page-image img").draggable();
var box=$('<div style="display:block; border:1px solid black; position:fixed; top:10px; left:10px; /* z-index:999; */ background-color:#efefef;padding:6px;" id="editBox"></div>');
box.append($("<div id='handle' style='width:100%; background-color:#dfdfdf; min-height:10px;' ><div id='areaBottoni' style='float:left;max-width:400px'></div> </div>"))
box.append($("<textarea name='wpHeaderTextbox' id='wpHeaderTextbox' style='width:100%; height:30px; border:1px solid gray;' />"));
box.append($("<textarea name='wpTextbox1' id='wpTextbox1' rows='35' style='width:550px; border:1px solid gray;' />"));
box.append($("<textarea name='wpFooterTextbox' id='wpFooterTextbox' style='width:100%; height:30px; border:1px solid gray;' />"));
$("#sfondoEiv").append(box);
// attivazione alex.activeEleme
$("#editBox textarea").focusin(function () {alex.activeElement=this;})
$("#editBox").draggable({ handle: "areaBottoni" });
var qb='<span id="radiobuttons" style="float:right">'+
'<span class="quality0"><input tabindex="5" title="Pagine_SAL_00%" type="radio" value="0" name="wpQuality"></span>'+
'<span class="quality2"><input tabindex="6" title="Pagine_SAL_50%" type="radio" value="2" name="wpQuality"></span>'+
'<span class="quality1"><input tabindex="7" title="Pagine_SAL_25%" type="radio" value="1" name="wpQuality"></span>'+
'<span class="quality3"><input tabindex="8" title="Pagine_SAL_75%" checked="" type="radio" value="3" name="wpQuality"></span>'+
'<span id="radioQuality4" class="quality4"><input tabindex="9" title="Pagine_SAL_100%" type="radio" value="4" name="wpQuality"></span></span>';
qb+='<br><span style="float:right">'+
'<button class="baseButton" id="wpSave" style="display: inline; padding: 1px 2px;" type="button" title="Salva le modifiche" onclick="alex.eiv.salvaPagina()"><small>Salva</small></button>'+
'<button class="baseButton" id="wpPreview" style="display: inline; padding: 1px 2px;" type="button" title="Visualizza anteprima" onclick="alex.eiv.pagePreview()"><small>Anteprima</small></button>'+
'<button class="baseButton" style="display: inline; padding: 1px 2px;" type="button" title="Annulla e chiudi" onclick="alex.eiv.chiudiEditBox()"><small>Annulla</small></button>'+
'</span>';
$("#handle").append($(qb));
}
}
})($,mw);
362 077

contributi