User:CharlotteWebb/gallery.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
//add some useful links to image gallery/thumbnail captions function f_link(f){ return '<div id="gallerylinks" style="clear:both;"><a href="/w/index.php?title=Image:' + f + '&action=edit">edit</a> • <a href="/wiki/Image_talk:' + f + '">talk</a> • <a href="/w/index.php?title=Image:' + f + '&action=history">history</a> • <a href="/w/index.php?title=Special:Log&page=Image:' + f + '">logs</a> • <a href="/w/index.php?title=Image:' + f + '&action=delete">delete</a></div>' } function dgebc(c){ var t = document.getElementsByTagName("*"); var m = new Array(); for (var i = 0; i < t.length; i++) if (t[i].className == c) m.push(t[i]); return m; // [[User:CharlotteWebb/gallery.js]] } addOnloadHook(function(){ var b = dgebc("gallerytext").concat(dgebc("thumbcaption")); for (var i =0; i < b.length; i++) b[i].innerHTML += f_link(encodeURIComponent(b[i].getElementsByTagName("a")[0].href.split("/wiki/Image:")[1])); });