MediaWiki:Gadget-showWikiCode.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica |
metto tutto in funzioni anonime |
||
Riga 1:
function delShowWikiCode() {$(".showCode").remove();}▼
//apre un box fixed in cui visualizzare il wikicode e ci aggiunge una barra e il wikicode▼
var wt=acchiappaWikicode(mw.config.get("wgPageName"));▼
// var wt=$.ajax({url:"https://it.wikisource.org/w/index.php?action=raw&title="+mw.config.get("wgPageName"),async:false}).responseText;▼
var commandBar='<div style="white-space:pre-wrap; width:100%; height:17px; background-color:#4D8AC0;"><img src="//upload.wikimedia.org/wikipedia/commons/f/f8/Tooltip-CloseButton.png" onclick="delShowWikiCode()" style="align:right;cursor:pointer;"/></div>\n';▼
var headerDiv='<div style="white-space:pre-wrap; width:97%; padding:5px; background-color:#D9FFFF;">'+wt[0]+ '</div>\n';▼
var bodyDiv='<div style="white-space:pre-wrap; width:97%; padding:5px; background-color:#FCFCFC;">'+wt[1]+ '</div>\n';▼
var footerDiv='<div style="white-space:pre-wrap; width:97%; padding:5px; background-color:#CCFFFF;">'+wt[2]+' </div>\n';▼
var box='<div ondblclick="delShow()" style="white-space:pre-wrap; background-color:#FCFCFC; font-family:Courier; font-size:0.7pc; position:fixed; width:45%; height:70%; top:20px; right:20px; z-index:999; overflow:auto; border:1px solid #bbb;" class="showCode">';▼
//var box='<div ondblclick="delShow()" style="white-space:pre-wrap; background-color:#F2FFFF; font-family:Courier; font-size:0.7pc; width:100%; heigth:100%; position: absolute; top:0px; left:0px; z-index:999; overflow:scroll; border:1px solid black;" class="showCode">';▼
box+=commandBar;▼
if (wt[0]!="") box+=headerDiv;▼
box+=bodyDiv;▼
if (wt[0]!="") box+=footerDiv;▼
box+='</div>';▼
$(box).appendTo($("body"));▼
// crea un tattoo per invocare la funzione show
$(document).ready(function
if (mw.config.get("wgAction")=="view"){
var tattooDiv='<div id="tattoo" style="position:fixed; bottom:2px;right:80px; z-index:1003;display:block">';
tattooDiv+='<a id="showWikiCodeBtn" href="
tattooDiv+='</div>';
$('#content').append(tattooDiv);
▲ //apre un box fixed in cui visualizzare il wikicode e ci aggiunge una barra e il wikicode
$('#showWikiCodeBtn').click(function(e) {
e.preventDefault();
▲ var wt=acchiappaWikicode(mw.config.get("wgPageName"));
▲
var commandBar='<div style="white-space:pre-wrap; width:100%; height:17px; background-color:#4D8AC0;">'+
▲
▲
▲
▲
▲
▲
box += headerDiv;
box += footerDiv;
$('#delWikiCodeBtn').click(function(e) {
e.preventDefault();
});
});
}
});
|