//Height of ProofReadDiv
var DivHeight=0;
function ProofReading () {
if (window.location.search.indexOf("image=") != -1) {
var ImageString = window.location.search.substring(window.location.search.indexOf("image=")+6,window.location.search.length);
if (ImageString != "") {
TextBoxRows= document.getElementsByName("wpTextbox1")[0].getAttribute('rows');
TextBoxRows=Math.ceil(TextBoxRows/2);
document.getElementsByName("wpTextbox1")[0].setAttribute('rows',TextBoxRows);
var ImageFrame = "<div id=\"ImageFrame\">" + ImageFrameContent(ImageString) + "</div>";
document.getElementById("contentSub").innerHTML += ImageFrame
}
}
}
function ImageFrameContent(ImageString) {
if (DivHeight == 0) {
if(document.selection && !is_gecko) {
//IE:
DivHeight=Math.ceil(document.body.clientHeight*0.5)+"px";
} else {
//andere:
DivHeight=Math.ceil(window.innerHeight*0.4)+"px";
}
}
var ZoomInIcon = "<a href=\"javascript:Zoom(50)\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/4/48/Magnifier_zoom_in.png\" title=\"vergrößern\" width=24 height=24></a>";
var ZoomOutIcon = "<a href=\"javascript:Zoom(-50)\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/9/92/Magifier_zoom_out.png\" title=\"verkleinern\" width=24 height=24></a>";
var ZoomStdIcon = "<a href=\"javascript:Zoom(0)\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/7/79/Magnifier.png\" title=\"Fensterbreite\" width=24 height=24></a>";
var ImageFrame = ZoomOutIcon + " " + ZoomStdIcon + " " + ZoomInIcon;
var ImageApp = /\.png$|\.jpeg$|\.jpg$|\.gif$/;
if (ImageApp.test(ImageString) == true) {
ImageFrame += "<div style=\"overflow: scroll; height: " + DivHeight + "; width: 100%;\">";
ImageFrame += "<img onerror=\"ImageError('"+ ImageString+"')\" id=\"ProofReadImage\" src=\""+ GetImageUrl(ImageString) +"\" alt=\""+ GetImageUrl(ImageString) +"\"";
if (GetCookie("PrImageWidth")) {
ImageFrame +="width = \"" + GetCookie("PrImageWidth") +"\"";
}
ImageFrame += "></div>";
} else {
ImageFrame += "<iframe id=\"ProofReadImage\" src=\""+ GetImageUrl(ImageString) +"\" style=\"height: " + DivHeight + "; width: 100%;\">";
}
return ImageFrame
}
function GetImageUrl(name) {
var retval = name;
if (name.indexOf("http:") != 0) retval = "index.php/Special:Filepath/" + name;
return retval;
}
function ImageError(imagename) {
if (document.getElementById("ProofReadImage").src.indexOf("commons") == -1 && document.getElementById("ProofReadImage").src.indexOf("Special:Filepath") != -1) {
//image not from commons
document.getElementById("ProofReadImage").src = "http://commons.wikimedia.org/wiki/Special:Filepath/" + imagename;
}
}
function Zoom(value) {
PrImage = document.getElementById("ProofReadImage");
if (value == 0) PrImage.width = document.getElementById("ImageFrame").offsetWidth-15;
else PrImage.width=PrImage.width+value;
SetCookie("PrImageWidth",PrImage.width);
if(document.selection && !is_gecko) {
//IE:
document.getElementById("ImageFrame").innerHTML = ImageFrameContent(PrImage.src);
}
}
addLoadEvent(customizeWikipedia);
addLoadEvent(ProofReading);