MediaWiki:Common.js/file.js: Difference between revisions
Jump to navigation
Jump to search
resolutions -> sizes |
prioritize changes. |
||
| Line 8: | Line 8: | ||
div.appendChild(document.createTextNode("This image rendered as PNG in some sizes"+": ")); | div.appendChild(document.createTextNode("This image rendered as PNG in some sizes"+": ")); | ||
var a200 = document.createElement("a"); | var a200 = document.createElement("a"); | ||
a200.setAttribute("href", " | a200.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=200px&height=200px"); | ||
a200.appendChild(document.createTextNode("200px")); | a200.appendChild(document.createTextNode("200px")); | ||
var a500 = document.createElement("a"); | var a500 = document.createElement("a"); | ||
a500.setAttribute("href", " | a500.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=500px&height=500px"); | ||
a500.appendChild(document.createTextNode("500px")); | a500.appendChild(document.createTextNode("500px")); | ||
var a1000 = document.createElement("a"); | var a1000 = document.createElement("a"); | ||
a1000.setAttribute("href", " | a1000.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=1000px&height=1000px"); | ||
a1000.appendChild(document.createTextNode("1000px")); | a1000.appendChild(document.createTextNode("1000px")); | ||
var a2000 = document.createElement("a"); | var a2000 = document.createElement("a"); | ||
a2000.setAttribute("href", " | a2000.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=2000px&height=2000px"); | ||
a2000.appendChild(document.createTextNode("2000px")); | a2000.appendChild(document.createTextNode("2000px")); | ||
div.appendChild(a200); | div.appendChild(a200); | ||
Revision as of 21:12, 25 November 2009
/* <source lang="javascript"><nowiki> */
// SVG images: adds links to rendered PNG images in different resolutions
function SVGThumbs() {
if (wgAction == "view" && wgTitle.substring(wgTitle.lastIndexOf(".")).toLowerCase() == ".svg") {
var file = document.getElementById("file");
if (!file) return; // might happen if MediaWiki can't render the SVG
var div = document.createElement("p");
div.appendChild(document.createTextNode("This image rendered as PNG in some sizes"+": "));
var a200 = document.createElement("a");
a200.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=200px&height=200px");
a200.appendChild(document.createTextNode("200px"));
var a500 = document.createElement("a");
a500.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=500px&height=500px");
a500.appendChild(document.createTextNode("500px"));
var a1000 = document.createElement("a");
a1000.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=1000px&height=1000px");
a1000.appendChild(document.createTextNode("1000px"));
var a2000 = document.createElement("a");
a2000.setAttribute("href", wgServer + wgScriptPath + "/thumb.php?f=" + encodeURIComponent(wgTitle) + "&width=2000px&height=2000px");
a2000.appendChild(document.createTextNode("2000px"));
div.appendChild(a200);
div.appendChild(document.createTextNode(", "));
div.appendChild(a500);
div.appendChild(document.createTextNode(", "));
div.appendChild(a1000);
div.appendChild(document.createTextNode(", "));
div.appendChild(a2000);
div.appendChild(document.createTextNode("."));
var info = getElementsByClassName( file.parentNode, 'div', 'fullMedia' )[0];
if( info ) info.appendChild(div);
}
};
addOnloadHook( SVGThumbs )
/* </nowiki></source> */