User:Edgars2007/rio petscan.js

//http://stackoverflow.com/questions/3559070/are-there-dictionaries-in-javascript-like-python //if ( mw.config.get( 'wgNamespaceNumber' ) === 14 ) { var maincats; var cat = mw.config.get( 'wgTitle' ); var link = "http://petscan.wmflabs.org/?language=en&project=wikipedia&categories=$1&ns%5B0%5D=1&common_wiki=cats&wikidata_item=with\ &wikidata_label_language=en&wikidata_prop_item_use=P$2&wpiu=none&interface_language=en&active_tab=tab_other_sources";

maincats=[ ["Cyclists at the 2016 Summer Olympics","1409"], ["Athletes (track and field) at the 2016 Summer Olympics","1146"], //["Cyclists at the 2016 Summer Olympics",""], ["Footballers at the 2016 Summer Olympics","2574"], //["Golfers at the 2016 Summer Olympics",""], ["Gymnasts at the 2016 Summer Olympics","2696"], ["Judoka at the 2016 Summer Olympics","2767"], ["Modern pentathletes at the 2016 Summer Olympics","2726"], ["Rowers at the 2016 Summer Olympics","2091"], //["Rugby sevens players at the 2016 Olympic Games",""], ["Sailors at the 2016 Summer Olympics","2804"], ["Shooters at the 2016 Summer Olympics","2804"], ["Swimmers at the 2016 Summer Olympics","2640"], //["Synchronized swimmers at the 2016 Summer Olympics",""]; ["Table tennis players at the 2016 Summer Olympics","1364"], //["Taekwondo practitioners at the 2016 Summer Olympics",""]; //["Tennis players at the 2016 Summer Olympics",""]; ["Triathletes at the 2016 Summer Olympics",""], ["Volleyball players at the 2016 Summer Olympics","2778"], ["Weightlifters at the 2016 Summer Olympics","2779"], ["Wrestlers at the 2016 Summer Olympics","2727"] ];

var len = maincats.length;//, console.log(len);

/*   element = null;*/

var text = "";

//link = link.replace('$1',encodeURIComponent(cat)).replace('$2',dictionary[cat]);

for (var i = 0; i < len; i++) { catname = maincats[i][0]; prop = maincats[i][1]; console.log(catname); console.log(prop); text += "" + catname + " - "+ prop +""; }

text += '';

//link = link.replace('$1',encodeURIComponent(cat)).replace('$2',dictionary[cat]);

//console.log(dictionary[cat]); //console.log(link);//(dictionary["Cyclists at the 2016 Summer Olympics"]);

//var text = "Is in category, doesn't have property"; mw.loader.using( [ 'mediawiki.util', 'oojs-ui' ], function {	var messageDialog = new OO.ui.MessageDialog;

// Create and append a window manager. var windowManager = new OO.ui.WindowManager; $( 'body' ).append( windowManager.$element ); // Add the dialog to the window manager. windowManager.addWindows( [ messageDialog ] );

// Add the portlet link to the toolbar. var portletLink = mw.util.addPortletLink(		'p-tb',		'#',		'Rio cats--',		't-rio1', // the link ID		null,		'#t-whatlinkshere' // put it before the what links here link	);

// Tell the portlet link what to do when we click it. $( portletLink ).click( function ( event ) {		event.preventDefault;

// Configure the message dialog when it is opened with the window manager's openWindow method. windowManager.openWindow( messageDialog, {		 title: 'Check with Petscan1',		  message: $( text ),		  size: 'large'		} ); } ); } );

//show alert window for cyclists with all links + beach //}