Stupidedia:Hauptseite/Leseempfehlung
Aus Stupidedia, der sinnfreien Enzyklopädie!
<script type="text/javascript"> var ranhofart = {
init: function(){ $( '#articles ul' ).html( 'Bitte warten... <img src="">' ); api.request( ranhofart.req, ranhofart.continue, [] ); }, artobj: { hr: [], div: [] }, req: { action: 'query', list: 'categorymembers', cmlimit: 'max', cmtitle: 'Kategorie:Stupidedia:Gelungene Artikel' }, continue: function( data, oldarts ){ var arts = $.merge( oldarts, api.makeArray( data ) ); if( data['query-continue'] ){ ranhofart.req.cmcontinue = data['query-continue'].categorymembers.cmcontinue; api.request( ranhofart.req, ranhofart.continue, arts ); }else{ $.each( arts, function(){ switch( this.ns ){ case 0: ranhofart.artobj.hr.push( this.title ); break; case 102: ranhofart.artobj.div.push( this.title ); } }); delete ranhofart.req.cmcontinue; switch( ranhofart.req.cmtitle ){ case 'Kategorie:Stupidedia:Gelungene Artikel': ranhofart.req.cmtitle = 'Kategorie:Stupidedia:Hammer-Artikel'; break; case 'Kategorie:Stupidedia:Hammer-Artikel': ranhofart.req.cmtitle = 'Kategorie:Stupidedia:Goldpokal'; break; case 'Kategorie:Stupidedia:Goldpokal': ranhofart.randomarticle(); return; } api.request( ranhofart.req , ranhofart.continue, [] ); } }, randomarticle: function(){ var hrr = [ ranhofart.artobj.hr[ Math.floor( Math.random() * ranhofart.artobj.hr.length ) ], ranhofart.artobj.hr[ Math.floor( Math.random() * ranhofart.artobj.hr.length ) ] ]; while( hrr[0] === hrr[1] ){ hrr[0] = ranhofart.artobj.hr[ Math.floor( Math.random() * ranhofart.artobj.hr.length ) ]; hrr[1] = ranhofart.artobj.hr[ Math.floor( Math.random() * ranhofart.artobj.hr.length ) ]; } var divr = [ranhofart.artobj.div[ Math.floor( Math.random() * ranhofart.artobj.div.length ) ], ranhofart.artobj.div[ Math.floor( Math.random() * ranhofart.artobj.div.length ) ], ranhofart.artobj.div[ Math.floor( Math.random() * ranhofart.artobj.div.length ) ] ]; while( divr[0] === divr[1] || divr[0] === divr[2] || divr[1] === divr[2] ){ divr[0] = ranhofart.artobj.div[ Math.floor( Math.random() * ranhofart.artobj.div.length ) ]; divr[1] = ranhofart.artobj.div[ Math.floor( Math.random() * ranhofart.artobj.div.length ) ]; divr[2] = ranhofart.artobj.div[ Math.floor( Math.random() * ranhofart.artobj.div.length ) ]; } $( '#articles ul' ).html( ); $.each( $.merge( hrr, divr ), function(){$( '#articles ul' ).append( '
});$( '#articles ul' ).append( '
}
}; execute( 'ranhofart.init' ); </script>