Post comments on Facebook page via console

前端 未结 5 1149
说谎
说谎 2021-02-06 04:10

Like in the image, the Facebook comment box has no submit button, when you write something and press Enter button, the comment posted.

I want to submit the comment via J

5条回答
  •  后悔当初
    2021-02-06 04:30

    function fireEvent(type, element) {
        var evt;
    
        if(document.createEvent) {
            evt = document.createEvent("HTMLEvents");
            evt.initEvent(type, true, true);
        } else {
            evt = document.createEventObject();
            evt.eventType = type;
        }
    
        evt.eventName = type;
        evt.keyCode = 13;
        evt.which = 13;
    
        if(document.createEvent) {
            element.dispatchEvent(evt);
        } else {
            element.fireEvent("on" + evt.eventType, evt);
        }
    }
    
    fireEvent('keydown', document.
    

提交回复
热议问题