User:So9q/folkets-lexicon-link.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
( function ( mw, $ ) {
if (mw.config.get( 'wgNamespaceNumber' ) != 146) {
return;
} else {
mw.hook("wikibase.entityPage.entityLoaded").add( function ( e ) {
var language = e.language,
lemma = e.lemmas && e.lemmas.sv ? e.lemmas.sv.value : false;
if (lemma && language == 'Q9027') {
// Construct the URL with the lemma for Fula Ordboken
var fulaOrdbokenURL = 'http://folkets-lexikon.csc.kth.se/folkets/service?word=' + encodeURIComponent(lemma);
// Add portlet link for item
mw.util.addPortletLink(
'p-tb',
fulaOrdbokenURL,
'Lookup in Folkets Lexicon',
't-folkets',
'Search for this lemma in Folkets Lexicon'
);
}
});
}
}( mediaWiki, jQuery ) );