User:84user/Magnus Manske image siblings.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at User:84user/Magnus Manske image siblings. |
/* Benutzung : Auf der eigenen monobook.js-Seite folgenden Text einfuegen:
importScript('Benutzer:Magnus_Manske/image_siblings.js');
*/
function commonsSiblingsAddScript(url) {
var script = document.createElement('script');
script.src = url;
document.body.appendChild(script);
}
function commonsSiblingsInit () {
if ( wgNamespaceNumber != 6 ) return ;
url = "http://toolserver.org/~magnus/file_siblings.php?language=commons&project=wikimedia&sort_by_date=0&sib_cat=1&sib_gal=1&mode=json&file=" + escape ( wgTitle ) ;
url += "&uselang=" + wgUserLanguage ;
url += "&message=" + escape ( "Related images from<br/><a href='http://commons.wikimedia.org'>Wikimedia Commons</a>" ) ;
commonsSiblingsAddScript ( url ) ;
}
function file_siblings_callback ( html ) {
var file = document.getElementById ( 'file' ) ;
file.innerHTML = html + file.innerHTML ;
// jQuery('#file_siblings_table').fadeTo ( 'fast' , 0.5 ) ;
}
$(commonsSiblingsInit);