User:Yair rand/PanoramicBanners.js

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 = b[i].imageinfo[0].url;                $(document).ready(function ($) { $("#firstHeading").wrapInner(                    	$( " " ).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(                    	$("")                    		.attr("href", "/wiki/commons:File:" + a)                    		.append( $(" ").attr("src", b).css({				                   height: "auto",                        			width: "100%"                    			}) )                   );                });            }        });    } });