User:Jinbobo/Sandbox

mw.user.isAnon - Check if user is logged in.

Scrape image URLs from navboxes
Array.prototype.getUnique = function{ var u = {}, a = []; for(var i = 0, l = this.length; i < l; ++i){ if(u.hasOwnProperty(this[i])) { continue; }     a.push(this[i]); u[this[i]] = 1; }  return a; } arr = $(".navbox").html.match(/\/images\/thumb\/.\/..\/Grid[^\.]+\.png/g); for(i=0; i<arr.length; i++){ arr[i] = arr[i].replace("%28","(").replace("%29",")"); } arr = arr.getUnique; for(i=0; i<arr.length; i++){ $("#mw-content-text").append("http://wiki.feed-the-beast.com"+arr[i].replace("%28","(").replace("%29",")")+" "); }

Database access
& wfGetDB ($db, $groups=array, $wiki=false) DatabaseBase class documentation