Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @include http://hup.hu/node/*
- // @include http://hup.hu/cikkek/*
- // ==/UserScript==
- /* TODO
- &comments_per_page=9999
- comments idõrendbe
- */
- document.addEventListener("DOMContentLoaded", function() {
- /* functions*/
- document.mark_red = function(id,canunred) {
- o1=document.getElementById("ujcomm"+id);
- os=o1.style;
- o2=document.getElementById("ujcomment"+id);
- o2p=o2.parentNode;
- c=o2p.getAttribute("class");
- if(canunred && !c.match(/comment-new/)) {
- os.textDecoration="none";
- os.fontStyle="normal";
- o2p.setAttribute("class",c+" comment-new");
- o2.innerHTML='új ';
- } else {
- os.textDecoration="line-through";
- os.fontStyle="italic";
- c=c.replace("comment-new","");
- o2p.setAttribute("class",c);
- o2.innerHTML='';
- }
- }
- /* Hic sunt leones */
- news = document.createElement("div");
- news.innerHTML += "<a name='newsdiv' /><h2>Új hozzászólások</h2>";
- news.setAttribute("class","block block-block");
- x = document.createElement("div");
- x.setAttribute("class","content");
- newsul = document.createElement("ul");
- newsul.setAttribute("class","menu");
- x.appendChild(newsul);
- news.appendChild(x);
- as = document.getElementsByClassName("new");
- for(i=0; i<as.length; i++) {
- as[i].setAttribute("id","ujcomment"+i);
- submitter = as[i].nextSibling.nextSibling.childNodes[1].innerHTML;
- anchor = document.createElement("a");
- anchor.setAttribute("name","ujcomment"+i);
- as[i].parentNode.insertBefore(anchor, as[i])
- gototop = document.createElement("span");
- gototop.setAttribute("style","float: right;");
- gototop.innerHTML="<a href='#newsdiv' onClick='document.mark_red("+i+",0);'>top^ </a>";
- /*par=as[i].parentNode;
- for(ii=0; par.childNodes[ii]; ii++) {
- if(par.childNodes[ii].getAttribute("class").match(/content/)) par.childNodes[ii].setAttribute("onClick","document.mark_red("+i+",1);");
- }*/
- as[i].parentNode.childNodes[8].setAttribute("onClick","document.mark_red("+i+",1);");
- as[i].parentNode.insertBefore(gototop, as[i].nextSibling);
- newsul.innerHTML += "<li class='leaf'><a href='#ujcomment"+i+"' id='ujcomm"+i+"' onClick=''>"+submitter+"</a></li>";
- }
- o = document.getElementById('sidebar-right');
- o.insertBefore(news, o.firstChild)
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment