Spring til indhold

Bruger:Barklund/drsport.js

Fra Wikipedia, den frie encyklopædi
 // ---------------------------------------
 // BEGIN CLEAR DR SPORT COOKIE
 function clearDRSportCookie()
 {
     if (document.getElementById("t-clearsport")) return;
     var li_current = document.getElementById("t-upload");
     if (!li_current) return;
     var li_next = li_current.nextSibling;
     var ul_node = li_current.parentNode;
     var li = document.createElement("li");
     li.setAttribute("id", "t-clearsport");
     li.setAttribute("title", "Fjern cookie, der fastholder DR Sport skin.");
     li.appendChild(document.createElement("a"));
     li.firstChild.setAttribute("href","#");
     li.firstChild.setAttribute("onclick","doClearDRSportCookie");
     li.firstChild.onclick = doClearDRSportCookie;
     li.firstChild.appendChild(document.createTextNode("Almindeligt skin"));
     ul_node.insertBefore(li, li_next);
 }
 addOnloadHook(clearDRSportCookie);
 function doClearDRSportCookie() {
     var c = document.cookie.split(';'), d;
     for (var i in c) {
         d = c[i].split("=");
         if (d[0].toLowerCase().indexOf('useskin') != -1) {
             document.cookie = d[0]+'=; expires='+new Date().toGMTString()+'; path=/';
             if (document.location.href.indexOf('useskin=') != -1) {
                 document.location.href = document.location.href.replace('useskin=','ignore='); 
             } else {
                 document.location.reload();
             }
             break;
         }
     }
 }
 // 
 // END CLEAR DR SPORT COOKIE
 // ---------------------------------------