/* Javascript inkluderet her vil være aktivt for alle brugere. */
/**
* WikiMiniAtlas is a popup click and drag world map.
* See ] for more information.
* Maintainers: ]
*/
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
/**
* Test if an element has a certain class
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: ], ], ]
*/
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache ? reCache : (reCache = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
function LinkFA() {
// iterate over all <span>-elements
for(var i=0; a = document.getElementsByTagName("span"); i++) {
// if found a FA span
if(a.className == "FA") {
// iterate over all <li>-elements
for(var j=0; b = document.getElementsByTagName("li"); j++) {
// if found a FA link
if(b.className == "interwiki-" + a.id && b.className.indexOf("badge-featuredarticle") === -1 && b.className.indexOf("badge-goodarticle") === -1) {
b.style.padding = "0 0 0 16px";
b.style.backgroundImage = "url('//upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Symbol_star_gold.svg/15px-Symbol_star_gold.svg.png')";
b.style.backgroundRepeat = "no-repeat";
b.title = "Denne artikel er markeret som en fremragende artikel.";
}
}
}
}
}
$(LinkFA);
function LinkGA() {
var a;
// iterate over all <span>-elements
for(var i=0; a = document.getElementsByTagName("span"); i++) {
// if found an GA span
if(a.className == "GA") {
// iterate over all <li>-elements
var b;
for(var j=0; b = document.getElementsByTagName("li"); j++) {
// if found an GA link
if(b.className == "interwiki-" + a.id && b.className.indexOf("badge-featuredarticle") === -1 && b.className.indexOf("badge-goodarticle") === -1) {
b.style.padding = "0 0 0 16px";
b.style.backgroundImage = "url('//upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/14px-Symbol_support_vote.svg.png')";
b.style.backgroundRepeat = "no-repeat";
b.title = "Denne artikel er markeret som en god artikel.";
}
}
}
}
}
$(LinkGA);
/**
* Koperet og indsat fra en:MediaWiki:Common.js 2024-04-22
* Collapsible tables; reimplemented with mw-collapsible
* Styling is also in place to avoid FOUC
*
* Allows tables to be collapsed, showing only the header. See ].
* @version 3.0.0 (2018-05-20)
* @source https://www.mediawiki.orghttps://wikifreehand.com/da/MediaWiki:Gadget-collapsibleTables.js
* @author ]
* @author ]
* @author ]
* @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which
* is supported in MediaWiki core. Shimmable since MediaWiki 1.32
*
* @param {jQuery} $content
*/
function makeCollapsibleMwCollapsible( $content ) {
var $tables = $content
.find( 'table.collapsible:not(.mw-collapsible)' )
.addClass( 'mw-collapsible' );
$.each( $tables, function ( index, table ) {
// mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');
if ( $( table ).hasClass( 'collapsed' ) ) {
$( table ).addClass( 'mw-collapsed' );
// mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');
}
} );
if ( $tables.length > 0 ) {
mw.loader.using( 'jquery.makeCollapsible' ).then( function () {
$tables.makeCollapsible();
} );
}
}
mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible );
/**
* Koperet og indsat fra en:MediaWiki:Common.js 2024-04-22
* Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
*
* Maintainers: TheDJ
*/
function mwCollapsibleSetup( $collapsibleContent ) {
var $element,
$toggle,
autoCollapseThreshold = 2;
$.each( $collapsibleContent, function ( index, element ) {
$element = $( element );
if ( $element.hasClass( 'collapsible' ) ) {
$element.find( 'tr:first > th:first' ).prepend( $element.find( 'tr:first > * > .mw-collapsible-toggle' ) );
}
if ( $collapsibleContent.length >= autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
$element.data( 'mw-collapsible' ).collapse();
} else if ( $element.hasClass( 'innercollapse' ) ) {
if ( $element.parents( '.outercollapse' ).length > 0 ) {
$element.data( 'mw-collapsible' ).collapse();
}
}
// because of colored backgrounds, style the link in the text color
// to ensure accessible contrast
$toggle = $element.find( '.mw-collapsible-toggle' );
if ( $toggle.length ) {
// Make the toggle inherit text color (Updated for T333357 2023-04-29)
if ( $toggle.parent().style.color ) {
$toggle.css( 'color', 'inherit' );
$toggle.find( '.mw-collapsible-text' ).css( 'color', 'inherit' );
}
}
} );
}
mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );
/**
* Flyt portallinks
*
* Beskrivelse: Flytter portallinks op i toppen af siden. Bruges af ]
*/
$( function () {
try {
var x = document.getElementById('siteSub');
if(!x) return;
var y = document.getElementById('portlinks');
if(!y) return;
var str = y.innerHTML;
if (str.length) str = str.replace(/(?: | |\u00a0|\u000d|\x0d|\r|\u000a|\x0a|\n)*(?:·|·|\|)(?: | |\u00a0|\u000d|\x0d|\r|\u000a|\x0a|\n)*/g, ", ");
y = y.parentNode;
if(!y) return;
y.parentNode.removeChild(y);
x.innerHTML = str;
}
catch (e) {
// Woopsie, die without a notice
}
});
// Flyt portallinks slut
// OpenStreetMap til at åbne i artikler med koordinater - ligger i egen js fil. Inkludert af ] efter vejledning af ]
mw.config.set( 'osm_proj_map', 'kort' ); //"map" in project language
mw.config.set( 'osm_proj_lang', 'da' ); //project language
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:OSM.js&action=raw&ctype=text/javascript');
/**
* iProject (InterProjectLinks)
* Written by: Erwin (]), modified by Kildor
* Description: Adds links to other WMF projects in the sidebar
* (]). Works for all skins with a sidebar.
*
* Originally written by Magnus Manske. Version forked from
* ] and ]
*/
function iProject() {
// Find templates with interproject links. These templates should have a div
// with class 'interProject' that only contains a link to the other project.
iProjectLinks = $('div.interProject').toArray();
if (iProjectLinks.length > 0) {
// The element below should always be available. To not break code
// we do check for it, but don't have a fallback.
if (document.getElementById('p-tb')) {
prevNode = document.getElementById('p-tb');
} else {
return false;
}
// Clone previous node including child nodes.
interProject = prevNode.cloneNode(true);
interProject.id = 'p-project';
// Set header of new toolbox
h = interProject.getElementsByTagName('h5');
if(h) {
h.innerHTML = 'På andre projekter';
}
// The links are included in the first and only div of the toolbox
d = interProject.getElementsByTagName('div');
if(d) {
d = d;
} else {
return false;
}
// Remove current children, i.e. current ul element.
while(d.hasChildNodes()) {
d.removeChild(d.childNodes)
}
// Create new list with links
ul = document.createElement('ul')
ul.className += " interProject";
for (i = 0; i< iProjectLinks.length; i++) {
li = document.createElement('li');
li.className += " " + iProjectLinks.className;
li.innerHTML = iProjectLinks.innerHTML;
ul.appendChild(li)
}
d.appendChild(ul);
// Insert new node
prevNode.parentNode.insertBefore(interProject, prevNode.nextSibling);
}
}
$(iProject);
//Søg i Wikidata
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript');
/* End */
/* indsæt fra ] iflg
*/
//*** Configuration for "star" logo in front of interwiki links to Featured Articles
//*** and green symbol in front of interwiki links to Good Articles
/** set in Special:Mypage/common.js to switch off this "feature"
mw.user.options.set( 'linkFA_enabled', false );
* star logo for featured articles in other languages,
* see Template:Link_FA / Template:Link_GA and MediaWiki:Common.css
*/
mw.loader.using( , function() { $(function() {
/** description that is displayed when cursor hovers above FA interwiki links */
var linkFA_description = "Denne artikel er markeret som en fremragende artikel";
var linkGA_description = "Denne artikel er markeret som en god artikel";
// linkFA_bullet/linkGA_bullet and linkFA_style/linkGA_Style wird nur für cologneblue verwendet,
// für monobook, modern siehe ], vector hat in ] eigene Definitionen
/** image to use instead of the standard bullet (for cologneblue) */
var linkFA_bullet = "//upload.wikimedia.org/wikipedia/commons/d/d0/Monobook-bullet-star-transparent.png";
var linkGA_bullet = "//upload.wikimedia.org/wikipedia/commons/a/a1/Monobook-bullet-star-gray.png";
/** style to use for the linkFA_bullet/LinkGA_bullet img */
var linkFA_style = "margin-right: 0.2em;";
var linkGA_style = "margin-right: 0.2em;";
// early exit when disabled
if ( !mw.user.options.get( 'linkFA_enabled', true ) ) {
return;
}
// skins that can be handled the CSS class way
var skin = mw.config.get( 'skin' );
if (skin === "monobook" || skin === "modern" || skin === "vector" ) {
linkFA_CSS();
}
else if (skin === "cologneblue") {
linkFA_decorate();
}
/** skin == "monobook" || skin="modern" || skin== "vector" */
function linkFA_CSS() {
// links are to replaced in p-lang only
var pLang = document.getElementById("p-lang");
if (!pLang) return;
var lis = pLang.getElementsByTagName("li");
for (var i = 0; i < lis.length; i++) {
var li = lis;
//extract necessary classname
var matches = li.className.match( /(?:^| )(interwiki-+)(?: |$)/ );
if ( !matches || matches.length != 2 ) {
continue;
}
var className = matches;
// only links with a corresponding Link_FA template are interesting
if (document.getElementById(className + "-fa") && li.className.indexOf("badge-featuredarticle") === -1) {
li.className += " FA"; // additional class so the template can be hidden with CSS
li.title = linkFA_description; // change title
continue;
}
if (document.getElementById(className + "-ga") && li.className.indexOf("badge-goodarticle") === -1) {
li.className += " GA"; // additional class so the template can be hidden with CSS
li.title = linkGA_description; // change title
continue;
}
}
}
/** skin == "cologneblue" */
function linkFA_decorate() {
// these root elements can contain FA-/GA-links
var rootIds = new Array("topbar", "footer");
for (var i=0; i<rootIds.length; i++) {
var root = document.getElementById(rootIds);
if (!root) continue;
// if the root exists, try to decorate all the links within
var links = root.getElementsByTagName("a");
for (var j=0; j<links.length; j++) {
decorate(links, "-fa", linkFA_bullet, linkFA_description, linkFA_style);
decorate(links, "-ga", linkGA_bullet, linkGA_description, linkGA_style);
}
}
}
/** id necessary, modify a link to show the FA- or GA-star (older) */
function decorate(link, idSuffix, bullet, description, style) {
var lang = link.hostname.split(".");
var fa = document.getElementById("interwiki-" + lang + idSuffix);
if (!fa) return;
// build an image-node for the FA-star
var img = document.createElement("img");
img.setAttribute("src", bullet);
img.setAttribute("alt", description);
img.setAttribute("style", style);
// decorate the link with the image
link.appendChild(img);
link.appendChild(link.removeChild(link.firstChild));
link.setAttribute("title", description);
}
})});