„Melding:Common.js“: Munur á milli breytinga

Efni eytt Efni bætt við
mEkkert breytingarágrip
mEkkert breytingarágrip
Lína 282:
//frá [[en:MediaWiki:Common.js]] höfundur: [[:en:User:Connel MacKenzie]], hjálparmaður: [[:de:User:Melancholie]]
 
function doRedirect() {
var dym = document.getElementById('varstu-ad-leita');
var wiktDYMfrom = mw.util.getParamValue('rdfrom');
var wiktRndLang = mw.util.getParamValue('rndLang');
 
// REDIRECTED FROM
if(mw.util.getParamValue('rdfrom')) {
var insertPosition= document.getElementById("siteSub");
var div=document.createElement("div");
if(insertPosition) {
div.setAttribute("id","contentSub");
var tt=document.createElement('tt');
var lnk =document.createElement('a');
lnk.setAttribute("href",mw.config.get('wgArticlePath').replace("$1",wiktDYMfrom)+ '?redirect=no');
lnk.className="new"; //As they are redlinks
lnk.appendChild(document.createTextNode(decodeURIComponent(wiktDYMfrom)));
tt.appendChild(lnk);
div.appendChild(document.createTextNode("(Sjálf-tilvísað frá "));
div.appendChild(tt);
div.appendChild(document.createTextNode(")"));
insertPosition.parentNode.insertBefore(div,insertPosition.nextSibling);
}else{
alert('No insertposition');
}
 
// DID YOU MEAN - varstu að leita að...
}else{
if(dym && mw.util.getParamValue('redirect') !== 'no' && ($.cookie('WiktionaryDisableAutoRedirect') !== 'true')) {
var target = dym.firstChild.title;
var pagetitle = mw.config.get('wgPageName');
 
if(pagetitle !== target && pagetitle.toLowerCase().replace(/[^a-z]/g, "") === target.toLowerCase().replace(/[^a-z]/g, "") && mw.config.get('wgAction') !== "edit" && !(document.getElementById('contentSub') && document.getElementById('contentSub').innerHTML.indexOf("Redirected from")>=0)) { // does contentSub always exist
document.location = mw.config.get('wgArticlePath').replace("$1",encodeURIComponent(target.replace(/\ /g, "_"))) + '?rdfrom=' + encodeURIComponent(pagetitle.replace(/ /g,"_"));
}
}
}
}
 
$(document).ready(doRedirect);
//--------------------- autoredirect - end -----------------------------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
 
// This script is needed for anonymously logging search terms by the Squids
// The search URL will contain the search term
// Please modify retroactively at [[wikt:de:MediaWiki:If-search.js]]
// Rather IMPORT this script, ask [[meta:User:Melancholie]]
 
mw.loader.load('//de.wiktionary.org/w/index.php?title=MediaWiki:If-search.js&action=raw&ctype=text/javascript');