Admin Forum:Random background

Are we allowed to use a random wiki background?

ForestMonthZero 08:39, May 19, 2012 (UTC)
 * I don't think so. Perhaps ask using Special:Contact -- Sam Wang (talk) 09:19, May 19, 2012 (UTC)


 * Um, I can't at all see why you wouldn't be able to. If you do file a Special:Contact and get an answer in the negative, I'd greatly appreciate your update in this thread.  On the face of it, that seems to be 100% stylistic choice and 0% Wikia-wide functionality.  Therefore, it hardly seems like a TOU violation.  13:45: Sat 19 May 2012


 * So would the following work?

 function RandomBkgnd { var bkgndArray = new Array; bkgndArray[0] = ''; bkgndArray[1] = ''; bkgndArray[2] = ''; ... bkgndArray[xyz] = '';

var chosenBkgnd = Math.round(Math.random * (bkgndArray.length - 1));

var selectedBkgnd = ' background-image:url('+ bkgndArray[chosenBkgnd] +');'; var body = document.getElementsByTagName('body')[0];  body.className+= selectedBknd ;
 * OR

 body.setAttribute("background", bkgndArray[chosenBkgnd] );  } addOnloadHook(RandomBkgnd);


 * ForestMonthZero 08:27, May 20, 2012 (UTC)

This should work: randomBack = function { var opts = []; opts.push('url here'); opts.push('url here'); // ....   $("body").css("background-image",'url(' + opts[Math.floor(Math.random*opts.length)] + ')'); } addOnloadHook(randomBack); You'll still briefly see the background from your CSS at first though (due to the JS only being executed when it's done loading) - Tjcool007 (Talk) 09:59, May 20, 2012 (UTC)