Notandaspjall:Hoo man
Bæta við umræðuHello, please explain why you are removing code here and there, I get it you did replace http for this, but why removing essential code. Thank, --geimfyglið (:> )=| 13. janúar 2012 kl. 21:48 (UTC)
- While fixing those security issues, I on the run fixed other critical bugs. The things changed shouldn't affect how the site works in any manner, cause everything I removed has been replaced with a newer/ better function. (Eg. the document.writes can fully break the page (blank it) and the $() function crashed jQuery). If you got anything that isn't working as it did before, please report it, thanks - Hoo man (spjall) 13. janúar 2012 kl. 21:53 (UTC)
- Ok, found my error in the mean time (I forgot Melding:Monobook.js), should be fixed now (you might have to clear your cache to see it), I'm sorry for the troubles - Hoo man (spjall) 13. janúar 2012 kl. 21:58 (UTC)
- Thanks a lot and don't be sorry! Best, --geimfyglið (:> )=| 13. janúar 2012 kl. 22:05 (UTC)
javascript help
[breyta]Dear Hoo man, please could you help me in making the auto-redirect work again, I don't know since when it does not work, but in the past it did, I just stumbled into it not working by clicking on a link I just moved [1], the code is in the Melding:Common.js and it is
function doRedirect() { var dym = document.getElementById('varstu-ad-leita') var wiktDYMfrom= window.location.href.replace(/^(.+[&\?]rdfrom=([^&]+).*|.*)?$/,"$2"); var wiktRndLang= window.location.href.replace(/^(.+[&\?]rndLang=([^&]+).*|.*)?$/,"$2"); // REDIRECTED FROM if( window.location.href.indexOf('rdfrom=')!=-1 ) { 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",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 && !window.location.href.match(/[&\?]redirect=no/) && (getCookie('WiktionaryDisableAutoRedirect') != 'true') ) { var target = dym.firstChild.title; var pagetitle = document.getElementsByTagName('h1')[0].firstChild.nodeValue; if( pagetitle != target && pagetitle.toLowerCase().replace(/[^a-z]/g, "") == target.toLowerCase().replace(/[^a-z]/g, "") && wgAction != "edit" && !(document.getElementById('contentSub') && document.getElementById('contentSub').innerHTML.indexOf("Redirected from")>=0) // does contentSub always exist ) { document.location = wgArticlePath.replace("$1",encodeURIComponent(target.replace(/\ /g, "_"))) + '?rdfrom=' + encodeURIComponent(pagetitle.replace(/ /g,"_")); } } } } addOnloadHook(doRedirect);
The thing it should do is to auto redirect if the entry exists in upper/lower case already and give a redlink in case someone wants to create the entry anyway. Also we can disable it in the preferences: Wikiorðabók:Stillingar.
Melancholie did make it work in the past, but I can't reach him anymore (unfortunately).
Kind thanks in advance for any help, best regards, --geimfyglið (:> )=| 2. apríl 2012 kl. 20:15 (UTC)
- I've fixed that and changed a few other things in the script (replaced deprecated functions and such). If it still doesn't work for you, please clear your cache. Feel free to ask for further fixes - Hoo man (spjall) 2. apríl 2012 kl. 20:35 (UTC)
- Great!! (and fast) :) Kind thanks! --geimfyglið (:> )=| 2. apríl 2012 kl. 20:39 (UTC)