Jump to content

User:PrimeHunter/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PrimeHunter (talk | contribs) at 15:03, 29 March 2017 (add code from Wikipedia:Village pump (technical)#Wikidata description in mobile view on enwiki). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
importScript('User:קיפודנחש/cat-a-lot.js');// Backlink: [[User:קיפודנחש/cat-a-lot.js]]
importScript('User:PrimeHunter/Subpages.js'); // Linkback: [[User:PrimeHunter/Subpages.js]]
importScript('User:PrimeHunter/Image tabs.js'); // Linkback: [[User:PrimeHunter/Image tabs.js]]
importScript('User:PrimeHunter/English_interface.js'); // Linkback: [[User:PrimeHunter/English interface.js]]
importScript('User:Mr. Stradivarius/gadgets/DiffOnly.js') // Linkback: [[User:Mr. Stradivarius/gadgets/DiffOnly.js]]
importScript('User:Mr. Stradivarius/gadgets/SearchEditLink.js') // Linkback: [[User:Mr. Stradivarius/gadgets/SearchEditLink.js]]
importScript('User:PrimeHunter/Pageviews.js'); // Linkback: [[User:PrimeHunter/Pageviews.js]]

https: //www.wikidata.org/w/api.php?action=wbgetentities&ids=Q146%7CQ42&props=descriptions&languages=en
    $("#siteSub").append('<br><a class="wdDescBtn"> Show wikidata description </a><div class = "wdDesc"></div>');
$(".wdDescBtn").on("click", {
    type: "normal"
}, function() {
    var wgLanguage = mw.config.get("wgContentLanguage");
    var wgQid = mw.config.get("wgWikibaseItemId");
    $.ajax({
            url: '//www.wikidata.org/w/api.php',
            data: {
                action: 'wbgetentities',
                ids: wgQid,
                props: "descriptions",
                languages : wgLanguage,
                format: 'json'
            },
            dataType: 'jsonp',
            success: function(data) {
                $(".wdDesc").text(data.entities[wgQid].descriptions[wgLanguage].value)
            }
    });
});