Question

I'm creating a Chrome extension for a website that has no open API, so I'm stuck reading Closure Compiled spaghetti code for a long time. I've made a lot of progress but I seem to be stuck. On the page's onload, this function executes:

function comments_initReply(){
    var b=$("#ajax_comm div.com");
    for(var a=0;a<b.length;a++){var d=$(b[a]);
    var c=d.find(".commentReplyLink");
    if(c.length){
        d.on("dblclick",function(){$(this).closest("div.com").find(".commentReplyLink").click()}).find(".t")}
    }
} 

What it does is it takes a comment div on a website and it makes it into a large double-clickable area for you to open a reply. All I want to do is remove the double-clicking property so you can double-click text and highlight it instead of opening a reply modal dialog.

Since the function is anonymous, it cannot using removeEventListener to detach it. Any ideas? I prefer to not use jQuery.

Was it helpful?

Solution

Well, although you prefer not to use jQuery, it's much easier to use it, and my solution here will be jQuery-based, and feel free to convert it into a normal Javascript, if you want to.

function comments_endReply() {
    $("#ajax_comm div.com").off("dblclick");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top