From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

mw.config.get("wgNamespaceNumber") === 0 && mw.config.get("wgWikibaseItemId") && $.ajax({

    url: '//www.wikidata.org/w/api.php',

    data: {

        format: 'json',

        action: 'wbgetclaims',

        entity: mw.config.get("wgWikibaseItemId"),

        property: "P948",

        sites: mw.config.get('wgDBname'),

        maxage: 300,

        smaxage: 300,

        maxlag: 1

    },

    dataType: 'jsonp',

    success: function (a) {

        try {

            a = a.claims"P948"][0].mainsnak.datavalue.value;

        } catch (e) {

            return;

        }



        a && $.ajax({

            url: '//commons.wikimedia.org/w/api.php',

            data: {

                'format': 'json',

                action: 'query',

                format: 'json',

                titles: "File:" + a,

                prop: 'imageinfo',

                iiprop: 'url',

                maxage: 300,

                smaxage: 300,

                maxlag: 1

            },

            dataType: 'jsonp',

            success: function (b) {

                b = b.query.pages;

                for (var i in b) {}

                b = bi].imageinfo0].url;

                $(document).ready(function ($) {

                    $("#firstHeading").wrapInner( 

                    	$( "<span>" ).css({

	                        position: 'relative',

	                        display: 'block',

	                        padding: '.2em',

	                        top: '-1.4em',

	                        'background-color': 'rgba(0,0,0,.5)',

	                        color: 'white',

	                        height: '1em',

	                        'margin-bottom': '-1.4em'

                    	})

                    )

                    .prepend(

                    	$("<a>")

                    		.attr("href", "/wiki/commons:File:" + a)

                    		.append(

                    			$("<img>").attr("src", b).css({

				                    height: "auto",

                        			width: "100%"

                    			})

                    		)

                    );

                });

            }

        });

    }

});