Jump to content

MediaWiki:Common.js/User:Gryllida/GalleryThings

From Wikinews, the free news source you can write!

alert('hi');

function refreshList(){

 alert('3');
 $('<input/>',{name:"Foo"}).appendTo('#gt-list');

$.ajax( {

   'url': 'https://commons.wikimedia.org/w/api.php',
   'data': {
       'action': 'query',
       'meta': 'userinfo',
       'format': 'json',
       'origin': 'https://www.mediawiki.org'
   },
   'xhrFields': {
       'withCredentials': true
   },
   'success': function( data ) {
       alert( 'Foreign user ' + data.query.userinfo.name +
           ' (ID ' + data.query.userinfo.id + ')' );
   },
   'dataType': 'json'

} );

 $('<input/>',{name:"Bar"}).appendTo('#gt-list');
 $('#gt-list > input').each(function(){
   alert(this.name);
 });

}

$(document).ready( function() {

 alert('2');
 $('#gt-refresh').click(refreshList);

});