MediaWiki:Gadget-ec-make-pie.js
Nota: tras guardar, quizás necesites actualizar la caché de tu navegador para ver los cambios.
- Firefox/Safari: Mantén presionada la tecla Mayús mientras pulsas el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
- Google Chrome: presiona Ctrl+Shift+R (⌘+Mayús+R en Mac)
- Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar, o presiona Ctrl+F5
- Opera: dirígete a Menú → Configuración (Opera → Preferencias en Mac) y luego a Privacidad y seguridad → Borrar datos de navegación → Imágenes y archivos en caché.
///# show graphs on editors corner mw.hook( 'wikipage.content' ).add(function make_pie() { if (mw.config.get('wgPageName') != "Coppermind:Editor's_Corner") return console.warn('gadget:', 'ec-make-pie') const cats = { stub: 'Stubs', part: 'Partially complete articles', good: 'Articles nearing completion', done: 'Complete articles', } // PIE CHART: mw.loader.using('ext.gadget.make-pie').then(function make_pie(require) { // find a place for it const place = document.querySelector('.infobox td').parentElement.insertCell(0) place.rowSpan = 2 place.setAttribute('style', 'max-width: 50mm; min-width: 50mm; vertical-align: middle;') document.querySelector('.infobox th').colSpan += 1 // make the pie const make = require('ext.gadget.make-pie'); const pie = make('test', 75)// TODO: what radius? place.append(pie) // fill in the data function add_wedge(name, icon, fill) { const count = +document.querySelector('[title="Category:'+ cats[name] +'"]').textContent if(!count) return pie.add_data_entry(count, name, icon, fill) } add_wedge('done', '⬤', '#DFD') add_wedge('good', '◕', '#FEB') add_wedge('part', '◒', 'white') add_wedge('stub', '◔', '#DDD') pie.render() }) // END: PIE CHART // done });