|
|
| Zeile 28: |
Zeile 28: |
| } | | } |
|
| |
|
| /** Fügt bei SVG-Grafiken Links zu gerenderten PNGs in verschiedenen Breiten hinzu */ | | //*** Fügt eine Betreffzeile auf leeren Diskussionsseiten ein |
| function SVGThumbs() { | | |
| var file = document.getElementById("file"); // might fail if MediaWiki can't render the SVG
| | addOnloadHook(function() { |
| if (file && wgIsArticle && wgTitle.match(/\.svg$/i)) {
| | if(wgNamespaceNumber != 0 && wgNamespaceNumber != 1) return; |
| var thumbu = file.getElementsByTagName('IMG')[0].src;
| | var tab = document.getElementById( 'ca-talk' ); |
| if(!thumbu) return;
| | if( !tab || tab.className != 'new' ) return; |
|
| | var link = tab.getElementsByTagName( 'a' )[0]; |
| function svgAltSize( w, title) {
| | if( !link ) return; |
| var path = thumbu.replace(/\/\d+(px-[^\/]+$)/, "/" + w + "$1");
| | link.href += '§ion=new'; |
| var a = document.createElement("A");
| | }); |
| a.setAttribute("href", path);
| |
| a.appendChild(document.createTextNode(title));
| |
| return a;
| |
| }
| |
|
| |
| var p = document.createElement("p");
| |
| p.className = "SVGThumbs";
| |
| p.appendChild(document.createTextNode("Aus SVG automatisch erzeugte PNG-Grafiken in verschiedenen Auflösungen"+": "));
| |
| var l = [200, 500, 1000, 2000];
| |
| for( var i = 0; i < l.length; i++ ) {
| |
| p.appendChild(svgAltSize( l[i], l[i] + "px"));
| |
| if( i < l.length-1 ) p.appendChild(document.createTextNode(", "));
| |
| }
| |
| p.appendChild(document.createTextNode("."));
| |
| var info = getElementsByClassName( file.parentNode, 'div', 'fullMedia' )[0];
| |
| if( info ) info.appendChild(p);
| |
| }
| |
| };
| |