Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Javascript help

Name: Anonymous 2012-09-09 17:18

Can anyone help me make this code not as shit?

function replyBacklinkingPrep(){
    var references = document.getElementsByClassName("postlink processed");
    var postNumbers = document.getElementsByClassName("refLinkInner");
    for (var i = 0; i < references.length; i++ ){   
        for (var a = 0; a < postNumbers.length; a++){
            var referencedPost = references[i].innerHTML.replace("&gt;&gt;","No.");
            if (postNumbers[a].innerHTML.indexOf(referencedPost) != -1){
                var backlink = document.createElement("a");
                var postReferenced = $(references[i]).parents().map(function(){return this.id;}).get().join(',');
                if(postReferenced.indexOf("reply")!=-1){
                    var postReferencedId = "reply" + referencedPost.replace("No.","");
                    postReferenced = postReferenced.split(',');
                    for(var x = 0; x < postReferenced.length; x++){
                        if (postReferenced[x].indexOf("reply")!=-1){
                            postReferenced = postReferenced[x];
                        }
                    }
                    postReferenced = postReferenced.replace("reply","");
                }
                else{
                    var postReferencedId = "parent" + referencedPost.replace("No.","");
                    postReferenced = postReferenced.split(',');
                    for(var x = 0; x < postReferenced.length; x++){
                        if (postReferenced[x].indexOf("parent")!=-1){
                            postReferenced = postReferenced[x];
                        }
                    }
                    postReferenced = postReferenced.replace("parent","");
                }
                if(document.getElementById("backlink" + postReferenced) == null){
                    backlink.innerHTML = "&gt;&gt;" + postReferenced;
                    backlink.href = "javascript:void(0);"
                    backlink.id = "backlink" + postReferenced;
                    backlink.style.paddingRight="3px";
                    backlink.addEventListener("mouseover", function(e){quotePreview(this,0);e.preventDefault();}, true);   
                    backlink.addEventListener("mouseout", function(e){quotePreview(this,1);e.preventDefault();
                    }, true);
                    if(localStorage.getItem('inlineQuote')=='true'){   
                        backlink.addEventListener("click",function(a){inlineQuote(this,this.href,0,1);a.preventDefault();},true);
                    }
                    postNumbers[a].parentElement.parentElement.appendChild(backlink);
                }
            }
        }
    }
}

Name: Anonymous 2012-09-09 17:25

Rewrite it in Scheme

Name: Anonymous 2012-09-09 17:33

>>2
Maybe another day.

Name: Anonymous 2012-09-09 17:39

PIG DISGUSTING!!

Name: Anonymous 2012-09-09 17:41

Rewrite it in C.

Name: Anonymous 2012-09-09 17:47

>>4
Yeah, I know.
>>5
Maybe another day.

Name: Anonymous 2012-09-09 17:50

Well the only way you're gonna be able to make that shit not shit is for that other day to roll around.

Name: Anonymous 2012-09-09 17:53

>>7
It kinda needs to be in javascript, sorry.

Name: Anonymous 2012-09-09 18:19

Name: Anonymous 2012-09-09 19:27

looks like some spam seo shit. what is this for?

Name: Anonymous 2012-09-09 22:27

>>10
To what are you referring? 誤爆?

Name: Anonymous 2012-09-10 0:08

>>10
What? No, its post backlinking, like in 4chan X, except it's not for 4chan X.

Name: Anonymous 2012-09-10 0:42

Use jQuery. It will make the code a lot cleaner and scalable and OOP compliant.

Name: Anonymous 2012-09-10 10:08

>>13
no
use mootools for that

Don't change these.
Name: Email:
Entire Thread Thread List