0

First of all, I am not an expert at coding Javascript. I have only begun about a month ago, starting from Codecademy. I have a Javascript code here that gives me an error that I am unable to solve:

TypeError: undefined is not an object (evaluating 'c[_0x2374[1]]')

My main goal for this script is that when this script is to be put into the Javascript console on the website Ourworldoftext.com, I want the script to first of all ask for a url link from the user, and then when the key "ctrl A" is pressed, it inputs a hyperlink that links to the inputted url (var e) onto the website where the yellow cursor is. I have done extensive research and found no specific answer on how to correct this problem. Of course, the solution could be blatantly staring me in the face (again, I am a complete beginner at Javascript). However, I cannot seem to fix this, which is why I am posting this so that I can get some answers on how to get rid of this error.

Please note that this code was specifically designed to be implemented into the website www.ourworldoftext.com. It was originally supposed to be for the site www.yourworldoftext.com, but I have tried converting the variables in this code to make sense in www.ourworldoftext.com. Here is the code:

var _0x2374 = ["_state.selected", "parentNode", 
               "tileX", "data", "tileY", "onkeydown", 
               "keyCode", "http://www.ourworldoftext.com/ajax/urllink/", 
               "path", "worldName", "rowIndex", "cellIndex", 
               "post", "right", "moveCursor", "onkeyup", 
               "Link URL"];

setInterval(function() {
    c = $(_0x2374[0])[0];
    f = c[_0x2374[1]][_0x2374[1]][_0x2374[1]][_0x2374[1]];
    x = $[_0x2374[3]](f, _0x2374[2]);
    y = $[_0x2374[3]](f, _0x2374[4]);
});

var e = prompt(_0x2374[16]);
document[_0x2374[5]] = function(_0xf18fx1) {
    var _0xf18fx2 = _0xf18fx1[_0x2374[6]];
    keys[_0xf18fx2] = true;
    if (keys[17] && keys[65]) {
        jQuery[_0x2374[12]](_0x2374[7], {
            namespace: _state.worldName,
            tileY: YX_yx[0],
            tileX: YX_yx[1],
            charY: YX_yx[2],
            charX: YX_yx[3],
            url: url
        });
        w[_0x2374[14]](_0x2374[13]);
    };
};

document[_0x2374[15]] = function(_0xf18fx1) {
    if (keys[17] && keys[88]) {
        changelink();
    };
    var _0xf18fx2 = _0xf18fx1[_0x2374[6]];
    keys[_0xf18fx2] = false;
};
changelink = function() {
    e = prompt(_0x2374[16]);
};

Please go easy on me, as I am a beginner at coding Javascript. Thank you so much.

atmd
  • 7,034
  • 2
  • 28
  • 62
Science
  • 1
  • 2
  • 2
    your code is very unreadable for someone who's new to javascript – Isaac Feb 23 '15 at 06:45
  • why are your keywords in an array rather then written normally? – atmd Feb 23 '15 at 15:56
  • It would help a lot if you wouldn't post and work with uglified code. Please show us the original code. – Bergi Feb 23 '15 at 16:00
  • 1
    `"_state.selected"` does not appear to be a valid DOM selector. Also, your `setInterval` misses an interval, and might run before the DOM is loaded. – Bergi Feb 23 '15 at 16:02

0 Answers0