Hmm, doesn't seem to work for me yet - I have a blue "Loading..."
Best, Lodewijk No dia 25 de Setembro de 2011 15:02, Hay (Husky) <[email protected]>escreveu: > Hi guys, > i've added a photo counter to the wlm.eu and wlm.nl websites. This > counter shows how many photos have been uploaded to a specific country > (such as the Netherlands) and globally for the .eu site. > > To add such a counter yourself you can use the following piece of HTML > and Javascript. Simply replace the name between the quotes behind > 'CATEGORY' to the name of the Category on Commons. You might want to > separate the piece of Javascript and HTML to make it load faster. In > that case, put the <div> tag on the place where you want the counter > to appear and the piece of Javascript just before the closing </body> > tag. > > Kind regards, > -- Hay > > <div id="wlm-counter">Loading statistics...</div> > <script> > (function() { > window._wlmCounterCallback = function(data) { > for (var i in data.query.pages) { > var cat = data.query.pages[i]; > } > > (document.getElementById('wlm-counter')).innerHTML = > cat.categoryinfo.size; > } > > // Change this to the cat on Commons that holds your images... > var CATEGORY = "Category:Images from Wiki Loves Monuments 2011", > url = ''.concat( > 'http://commons.wikimedia.org/w/api.php?action=query', > '&prop=categoryinfo&titles=', > encodeURIComponent(CATEGORY), > '&format=json&callback=_wlmCounterCallback' > ); > > // Load stuff > var s = document.createElement('script'); > s.src = url; > (document.getElementsByTagName('head')[0]).appendChild(s); > })(); > </script> > > _______________________________________________ > Wiki Loves Monuments mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/wikilovesmonuments > http://www.wikilovesmonuments.eu >
_______________________________________________ Wiki Loves Monuments mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikilovesmonuments http://www.wikilovesmonuments.eu
